Initial commit
This commit is contained in:
644
engines/ags/plugins/ags_creditz/ags_creditz.cpp
Normal file
644
engines/ags/plugins/ags_creditz/ags_creditz.cpp
Normal file
@@ -0,0 +1,644 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/plugins/ags_creditz/ags_creditz.h"
|
||||
#include "ags/lib/allegro/surface.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace Plugins {
|
||||
namespace AGSCreditz {
|
||||
|
||||
void AGSCreditz::draw() {
|
||||
int endPoint;
|
||||
|
||||
if (_creditsRunning) {
|
||||
_engine->PollSystem();
|
||||
|
||||
if (!_staticCredits) {
|
||||
// Scrolling credits
|
||||
if (_seqSettings[_creditSequence].automatic == 1)
|
||||
endPoint = 0 - _calculatedSequenceHeight;
|
||||
else
|
||||
endPoint = _seqSettings[_creditSequence].endpoint;
|
||||
|
||||
if (_yPos >= endPoint) {
|
||||
doCredits();
|
||||
} else {
|
||||
if (_seqSettings[_creditSequence].endwait > 0 && _timer <= _seqSettings[_creditSequence].endwait) {
|
||||
_paused = true;
|
||||
doCredits();
|
||||
_timer++;
|
||||
return;
|
||||
} else {
|
||||
_paused = false;
|
||||
_timer = 0;
|
||||
_creditsRunning = false;
|
||||
_seqSettings[_creditSequence].finished = true;
|
||||
}
|
||||
}
|
||||
|
||||
_engine->MarkRegionDirty(0, 0, _screenWidth, _screenHeight);
|
||||
} else {
|
||||
// credits
|
||||
if (!_singleStatic.bool_) {
|
||||
if (_currentStatic < (int)_stCredits[_creditSequence].size()) {
|
||||
if (_stCredits[_creditSequence][_currentStatic].pause > 0) {
|
||||
// Pause
|
||||
if (_timer <= _stCredits[_creditSequence][_currentStatic].pause) {
|
||||
_timer++;
|
||||
} else {
|
||||
_timer = 0;
|
||||
_currentStatic++;
|
||||
}
|
||||
} else {
|
||||
if (_stCredits[_creditSequence][_currentStatic].image) {
|
||||
// Image
|
||||
if (_timer <= _stCredits[_creditSequence][_currentStatic].image_time) {
|
||||
drawCredit(_creditSequence, _currentStatic);
|
||||
_timer++;
|
||||
} else {
|
||||
_timer = 0;
|
||||
_currentStatic++;
|
||||
if (_stCredits[_creditSequence][_currentStatic].pause <= 0 &&
|
||||
_currentStatic< (int)_stCredits[_creditSequence].size())
|
||||
drawCredit(_creditSequence, _currentStatic);
|
||||
else
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Text
|
||||
if (_timer <= (_stSeqSettings[_creditSequence].speed *
|
||||
((int)_stCredits[_creditSequence][_currentStatic].title.size() +
|
||||
(int)_stCredits[_creditSequence][_currentStatic].credit.size()))) {
|
||||
drawCredit(_creditSequence, _currentStatic);
|
||||
_timer++;
|
||||
} else {
|
||||
_timer = 0;
|
||||
_currentStatic++;
|
||||
if (_stCredits[_creditSequence][_currentStatic].pause <= 0 &&
|
||||
(int)_currentStatic<= (int)_stCredits[_creditSequence].size())
|
||||
drawCredit(_creditSequence, _currentStatic);
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_stSeqSettings[_creditSequence].finished = true;
|
||||
_creditsRunning = false;
|
||||
_creditSequence = -1;
|
||||
_timer = 0;
|
||||
_currentStatic= 1;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Single Static
|
||||
if (_timer <= _singleStatic.time) {
|
||||
if (_singleStatic.style == 0)
|
||||
drawCredit(_creditSequence, _singleStatic.id);
|
||||
else if (_singleStatic.style == 1)
|
||||
drawStEffects(_creditSequence, _singleStatic.id, _singleStatic.style);
|
||||
|
||||
_timer++;
|
||||
} else {
|
||||
_timer = 0;
|
||||
_singleStatic.bool_ = false;
|
||||
_creditsRunning = false;
|
||||
_staticCredits = false;
|
||||
_stSeqSettings[_creditSequence].finished = true;
|
||||
_creditSequence = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
int font, color;
|
||||
int32 x_pos, leveys, korkeus = 0;
|
||||
int32 scrn_width, scrn_height, coldepth, y_posit;
|
||||
int slot, sprite_height, sprite_width, linecount, line, others;
|
||||
Common::String text;
|
||||
Common::String teksti;
|
||||
BITMAP *sprite;
|
||||
int result = 0;
|
||||
|
||||
_engine->GetScreenDimensions(&scrn_width, &scrn_height, &coldepth);
|
||||
|
||||
if (!_staticCredits) {
|
||||
// Scrolling Credits
|
||||
if ((_yPos + _sequenceHeight) > scrn_height)
|
||||
return 0;
|
||||
|
||||
if (_credits[sequence][credit]._image) {
|
||||
slot = _credits[sequence][credit]._fontSlot;
|
||||
sprite_height = _credits[sequence][credit]._colorHeight;
|
||||
x_pos = _credits[sequence][credit]._x;
|
||||
|
||||
if (x_pos < 0) {
|
||||
sprite_width = _engine->GetSpriteWidth(slot);
|
||||
x_pos = (scrn_width - sprite_width) / 2;
|
||||
} else {
|
||||
x_pos = VGACheck(x_pos);
|
||||
}
|
||||
|
||||
if (sprite_height < 0)
|
||||
sprite_height = _engine->GetSpriteHeight(slot);
|
||||
else
|
||||
sprite_height = VGACheck(sprite_height);
|
||||
|
||||
korkeus = sprite_height;
|
||||
|
||||
sprite = _engine->GetSpriteGraphic(slot);
|
||||
_engine->BlitBitmap(x_pos, _yPos + _sequenceHeight, sprite, 1);
|
||||
|
||||
} else {
|
||||
font = _credits[sequence][credit]._fontSlot;
|
||||
color = _credits[sequence][credit]._colorHeight;
|
||||
text = _credits[sequence][credit]._text;
|
||||
x_pos = _credits[sequence][credit]._x;
|
||||
|
||||
if (!text.empty()) {
|
||||
_engine->GetTextExtent(font, text.c_str(), &leveys, &korkeus);
|
||||
|
||||
if (x_pos < 0) {
|
||||
x_pos = (scrn_width - leveys) / 2;
|
||||
} else {
|
||||
x_pos = VGACheck(x_pos);
|
||||
}
|
||||
|
||||
if (text.contains('<')) {
|
||||
specialEffect(sequence, credit, text, font, color, x_pos);
|
||||
} else {
|
||||
if (_credits[sequence][credit]._outline) {
|
||||
// Outline
|
||||
_engine->DrawText(x_pos - 1, _yPos + _sequenceHeight, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos + 1, _yPos + _sequenceHeight, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight - 1, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight + 1, font, 16, text.c_str());
|
||||
}
|
||||
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight, font, color, text.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = korkeus;
|
||||
} else {
|
||||
|
||||
if (_stCredits[sequence][credit].image) {
|
||||
x_pos = _stCredits[sequence][credit].x;
|
||||
y_posit = _stCredits[sequence][credit].y;
|
||||
font = _stCredits[sequence][credit].image_slot;
|
||||
|
||||
sprite = _engine->GetSpriteGraphic(font);
|
||||
_engine->GetBitmapDimensions(sprite, &leveys, &korkeus, &coldepth);
|
||||
|
||||
if (x_pos < 0)
|
||||
x_pos = (scrn_width - leveys) / 2;
|
||||
else
|
||||
x_pos = VGACheck(x_pos);
|
||||
if (y_posit < 0)
|
||||
y_posit = (scrn_height - korkeus) / 2;
|
||||
else
|
||||
y_posit = VGACheck(y_posit);
|
||||
|
||||
_engine->BlitBitmap(x_pos, y_posit, sprite, 1);
|
||||
result = 0;
|
||||
} else {
|
||||
// Title
|
||||
font = _stCredits[sequence][credit].title_font;
|
||||
color = _stCredits[sequence][credit].title_color;
|
||||
text = _stCredits[sequence][credit].title;
|
||||
x_pos = _stCredits[sequence][credit].title_x;
|
||||
y_posit = _stCredits[sequence][credit].title_y;
|
||||
|
||||
if (!text.empty()) {
|
||||
_engine->GetTextExtent(font, text.c_str(), &leveys, &korkeus);
|
||||
|
||||
if (x_pos < 0)
|
||||
x_pos = (scrn_width - leveys) / 2;
|
||||
else
|
||||
x_pos = VGACheck(x_pos);
|
||||
if (y_posit < 0)
|
||||
y_posit = (scrn_height - korkeus) / 2;
|
||||
else
|
||||
y_posit = VGACheck(y_posit);
|
||||
|
||||
if (_stCredits[sequence][credit].title_outline) {
|
||||
_engine->DrawText(x_pos - 1, y_posit, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos + 1, y_posit, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos, y_posit - 1, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos, y_posit + 1, font, 16, text.c_str());
|
||||
}
|
||||
|
||||
_engine->DrawText(x_pos, y_posit, font, color, text.c_str());
|
||||
_engine->MarkRegionDirty(x_pos - 15, y_posit - 15, x_pos + leveys + 15, y_posit + korkeus + 15);
|
||||
}
|
||||
|
||||
// Credit
|
||||
font = _stCredits[sequence][credit].font;
|
||||
color = _stCredits[sequence][credit].color;
|
||||
text = _stCredits[sequence][credit].credit;
|
||||
x_pos = _stCredits[sequence][credit].x;
|
||||
y_posit = _stCredits[sequence][credit].y;
|
||||
|
||||
if (!text.empty()) {
|
||||
_engine->GetTextExtent(font, text.c_str(), &leveys, &korkeus);
|
||||
|
||||
if (!text.contains("[[")) {
|
||||
if (x_pos < 0)
|
||||
x_pos = (scrn_width - leveys) / 2;
|
||||
else
|
||||
x_pos = VGACheck(x_pos);
|
||||
if (y_posit < 0)
|
||||
y_posit = (scrn_height - korkeus) / 2;
|
||||
else
|
||||
y_posit = VGACheck(y_posit);
|
||||
|
||||
if (_stCredits[sequence][credit].outline) {
|
||||
_engine->DrawText(x_pos - 1, y_posit, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos + 1, y_posit, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos, y_posit - 1, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos, y_posit + 1, font, 16, text.c_str());
|
||||
}
|
||||
|
||||
_engine->DrawText(x_pos, y_posit, font, color, text.c_str());
|
||||
_engine->MarkRegionDirty(x_pos - 15, y_posit - 15, x_pos + leveys + 15, y_posit + korkeus + 15);
|
||||
} else {
|
||||
linecount = countLines(text);
|
||||
line = 1;
|
||||
teksti = text;
|
||||
others = 0;
|
||||
if (y_posit < 0)
|
||||
y_posit = (scrn_height - (korkeus * (linecount + 1))) / 2;
|
||||
else
|
||||
y_posit = VGACheck(y_posit);
|
||||
|
||||
while (line <= linecount + 1) {
|
||||
text = extractParameter(teksti, "[[");
|
||||
_engine->GetTextExtent(font, text.c_str(), &leveys, &korkeus);
|
||||
|
||||
if (x_pos < 0)
|
||||
x_pos = (scrn_width - leveys) / 2;
|
||||
else
|
||||
x_pos = VGACheck(x_pos);
|
||||
|
||||
if (_stCredits[sequence][credit].outline) {
|
||||
_engine->DrawText(x_pos - 1, y_posit + others, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos + 1, y_posit + others, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos, y_posit + others - 1, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos, y_posit + others + 1, font, 16, text.c_str());
|
||||
}
|
||||
_engine->DrawText(x_pos, y_posit + others, font, color, text.c_str());
|
||||
_engine->MarkRegionDirty(x_pos, y_posit + others, x_pos + leveys, y_posit + others + korkeus + 15);
|
||||
others += korkeus;
|
||||
x_pos = _stCredits[sequence][credit].x;
|
||||
line++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void AGSCreditz::doCredits() {
|
||||
int current_line;
|
||||
int32 increment, dum;
|
||||
|
||||
current_line = 1;
|
||||
_sequenceHeight = 0;
|
||||
|
||||
while (current_line < (int)_credits[_creditSequence].size()) {
|
||||
if (_credits[_creditSequence][current_line]._isSet) {
|
||||
if (_credits[_creditSequence][current_line]._image) {
|
||||
increment = _engine->GetSpriteHeight(_credits[_creditSequence][current_line]._fontSlot);
|
||||
|
||||
if ((_yPos + _sequenceHeight + increment) <= 0) {
|
||||
if (_credits[_creditSequence][current_line]._colorHeight >= 0)
|
||||
increment = VGACheck(_credits[_creditSequence][current_line]._colorHeight);
|
||||
}
|
||||
} else {
|
||||
_engine->GetTextExtent(_credits[_creditSequence][current_line]._fontSlot,
|
||||
_credits[_creditSequence][current_line]._text.c_str(), &dum, &increment);
|
||||
}
|
||||
|
||||
if ((_yPos + _sequenceHeight + increment) > 0)
|
||||
increment = drawCredit(_creditSequence, current_line);
|
||||
|
||||
} else {
|
||||
increment = VGACheck(_emptyLineHeight);
|
||||
}
|
||||
|
||||
_sequenceHeight += increment;
|
||||
current_line++;
|
||||
}
|
||||
|
||||
if (!_paused)
|
||||
speeder(_creditSequence);
|
||||
}
|
||||
|
||||
int AGSCreditz::countLines(const Common::String &text) {
|
||||
int lines;
|
||||
Common::String teksti;
|
||||
|
||||
teksti = text;
|
||||
lines = 0;
|
||||
while (teksti.contains("[[")) {
|
||||
extractParameter(teksti, "[[");
|
||||
++lines;
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
Common::String AGSCreditz::extractParameter(Common::String &line, const Common::String &separator) {
|
||||
int p;
|
||||
Common::String result;
|
||||
|
||||
p = line.find(separator, 0);
|
||||
if (p != -1) {
|
||||
if (p > 0) {
|
||||
result = line.substr(0, p);
|
||||
result.trim();
|
||||
}
|
||||
|
||||
line = line.substr(p + separator.size());
|
||||
} else if (!line.empty()) {
|
||||
line.trim();
|
||||
result.clear();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void AGSCreditz::specialEffect(int sequence, int credit, const Common::String &text,
|
||||
int font, int color, int32 x_pos) {
|
||||
Common::String creditt[3];
|
||||
Common::String credit_text, dots;
|
||||
int32 scrn_width, dum, rightside_width, leftside_width, dotwidth;
|
||||
int space, dotcount, dotpos;
|
||||
|
||||
_engine->GetScreenDimensions(&scrn_width, &dum, &dum);
|
||||
|
||||
if (text.contains("<>")) {
|
||||
if (x_pos < 0)
|
||||
x_pos = 0;
|
||||
|
||||
credit_text = text;
|
||||
creditt[0] = extractParameter(credit_text, "<");
|
||||
creditt[1] = extractParameter(credit_text, ">");
|
||||
creditt[2] = credit_text;
|
||||
|
||||
_engine->GetTextExtent(font, creditt[2].c_str(), &rightside_width, &dum);
|
||||
|
||||
if (_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(x_pos - 1, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos + 1, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight - 1, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight + 1, font, color, creditt[0].c_str());
|
||||
}
|
||||
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
|
||||
if (_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width) - 1, _yPos + _sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width) + 1, _yPos + _sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width), _yPos + _sequenceHeight - 1, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width), _yPos + _sequenceHeight + 1, font, color, creditt[2].c_str());
|
||||
}
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width), _yPos + _sequenceHeight, font, color, creditt[2].c_str());
|
||||
} else if (text.contains("<.>")) {
|
||||
if (x_pos < 0)
|
||||
x_pos = 0;
|
||||
|
||||
credit_text = text;
|
||||
creditt[0] = extractParameter(credit_text, "<");
|
||||
creditt[1] = extractParameter(credit_text, ">");
|
||||
creditt[2] = credit_text;
|
||||
|
||||
_engine->GetTextExtent(font, creditt[2].c_str(), &rightside_width, &dum);
|
||||
_engine->GetTextExtent(font, creditt[0].c_str(), &leftside_width, &dum);
|
||||
|
||||
if (_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(x_pos - 1, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos + 1, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight - 1, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight + 1, font, color, creditt[0].c_str());
|
||||
}
|
||||
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
|
||||
if (_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width) - 1, _yPos + _sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width) + 1, _yPos + _sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width), _yPos + _sequenceHeight - 1, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width), _yPos + _sequenceHeight + 1, font, color, creditt[2].c_str());
|
||||
}
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width), _yPos + _sequenceHeight, font, color, creditt[2].c_str());
|
||||
|
||||
_engine->GetTextExtent(font, " .", &dotwidth, &dum);
|
||||
space = scrn_width - (x_pos + leftside_width + x_pos + rightside_width);
|
||||
dotcount = space / dotwidth;
|
||||
dotpos = 0;
|
||||
dots = "";
|
||||
while (dotpos < dotcount) {
|
||||
dots = dots + " .";
|
||||
dotpos++;
|
||||
}
|
||||
|
||||
if (_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(x_pos + leftside_width - 1, _yPos + _sequenceHeight, font, color, dots.c_str());
|
||||
_engine->DrawText(x_pos + leftside_width + 1, _yPos + _sequenceHeight, font, color, dots.c_str());
|
||||
_engine->DrawText(x_pos + leftside_width, _yPos + _sequenceHeight - 1, font, color, dots.c_str());
|
||||
_engine->DrawText(x_pos + leftside_width, _yPos + _sequenceHeight + 1, font, color, dots.c_str());
|
||||
}
|
||||
_engine->DrawText(x_pos + leftside_width, _yPos + _sequenceHeight, font, color, dots.c_str());
|
||||
} else if (text.contains("<#>")) {
|
||||
if (x_pos < 0)
|
||||
x_pos = 0;
|
||||
|
||||
credit_text = text;
|
||||
creditt[0] = extractParameter(credit_text, "<");
|
||||
creditt[1] = extractParameter(credit_text, ">");
|
||||
creditt[2] = credit_text;
|
||||
|
||||
_engine->GetTextExtent(font, creditt[2].c_str(), &rightside_width, &dum);
|
||||
_engine->GetTextExtent(font, creditt[0].c_str(), &leftside_width, &dum);
|
||||
|
||||
if (_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(scrn_width / 2 - x_pos / 2 - leftside_width - 1, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(scrn_width / 2 - x_pos / 2 - leftside_width + 1, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(scrn_width / 2 - x_pos / 2 - leftside_width, _yPos + _sequenceHeight - 1, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(scrn_width / 2 - x_pos / 2 - leftside_width, _yPos + _sequenceHeight + 1, font, color, creditt[0].c_str());
|
||||
}
|
||||
_engine->DrawText(scrn_width / 2 - x_pos / 2 - leftside_width, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
|
||||
if (_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(scrn_width / 2 + x_pos / 2 - 1, _yPos + _sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width / 2 + x_pos / 2 + 1, _yPos + _sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width / 2 + x_pos / 2, _yPos + _sequenceHeight - 1, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width / 2 + x_pos / 2, _yPos + _sequenceHeight + 1, font, color, creditt[2].c_str());
|
||||
}
|
||||
_engine->DrawText(scrn_width / 2 + x_pos / 2, _yPos + _sequenceHeight, font, color, creditt[2].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz::drawStEffects(int sequence, int id, int style) {
|
||||
Common::String teksti;
|
||||
Common::String teksti2;
|
||||
int thischar;
|
||||
Common::String text;
|
||||
int font, color, set1, set2;
|
||||
int32 x_pos, y_posit, scrn_width, leveys, scrn_height, korkeus, coldepth;
|
||||
|
||||
teksti = _stCredits[sequence][id].credit;
|
||||
font = _stCredits[sequence][id].font;
|
||||
color = _stCredits[sequence][id].color;
|
||||
x_pos = _stCredits[sequence][id].x;
|
||||
y_posit = _stCredits[sequence][id].y;
|
||||
set1 = _singleStatic.settings1;
|
||||
set2 = _singleStatic.settings2;
|
||||
|
||||
_engine->GetScreenDimensions(&scrn_width, &scrn_height, &coldepth);
|
||||
_engine->GetTextExtent(font, teksti.c_str(), &leveys, &korkeus);
|
||||
|
||||
if (style == 1) {
|
||||
if (set2 >= 0 && _numChars < (int)teksti.size() && _timer2 == 0) {
|
||||
_playSound(set2);
|
||||
}
|
||||
|
||||
if (_timer2 <= set1) {
|
||||
thischar = 0;
|
||||
if (thischar <= _numChars && _numChars <= (int)teksti.size()) {
|
||||
for (thischar = 0; thischar < _numChars; ++thischar)
|
||||
teksti2 = teksti2 + teksti[thischar];
|
||||
text = teksti2;
|
||||
} else {
|
||||
text = teksti;
|
||||
}
|
||||
|
||||
if (x_pos < 0)
|
||||
x_pos = (scrn_width - leveys) / 2;
|
||||
else
|
||||
x_pos = VGACheck(x_pos);
|
||||
if (y_posit < 0)
|
||||
y_posit = (scrn_height - korkeus) / 2;
|
||||
else
|
||||
y_posit = VGACheck(y_posit);
|
||||
|
||||
_engine->DrawText(x_pos, y_posit, font, color, text.c_str());
|
||||
_timer2++;
|
||||
x_pos = _stCredits[sequence][id].x;
|
||||
y_posit = _stCredits[sequence][id].y;
|
||||
} else {
|
||||
_numChars++;
|
||||
thischar = 0;
|
||||
_timer2 = 0;
|
||||
drawStEffects(sequence, id, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz::speeder(int sequence) {
|
||||
int speed = _seqSettings[sequence].speed;
|
||||
|
||||
if (_speedPoint == speed) {
|
||||
_yPos -= VGACheck(1);
|
||||
_speedPoint = 0;
|
||||
} else {
|
||||
_speedPoint++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AGSCreditz::calculateSequenceHeight(int sequence) {
|
||||
int32 height, creditHeight, dum;
|
||||
height = 0;
|
||||
|
||||
for (uint currentCredit = 0; currentCredit < _credits[sequence].size();
|
||||
++currentCredit) {
|
||||
|
||||
if (_credits[sequence][currentCredit]._isSet) {
|
||||
if (_credits[sequence][currentCredit]._image) {
|
||||
if (_credits[sequence][currentCredit]._colorHeight < 0)
|
||||
creditHeight = _engine->GetSpriteHeight(_credits[sequence][currentCredit]._fontSlot);
|
||||
else
|
||||
creditHeight = _credits[sequence][currentCredit]._colorHeight;
|
||||
} else {
|
||||
_engine->GetTextExtent(_credits[sequence][currentCredit]._fontSlot,
|
||||
_credits[sequence][currentCredit]._text.c_str(),
|
||||
&dum, &creditHeight);
|
||||
}
|
||||
|
||||
height += creditHeight;
|
||||
} else {
|
||||
height += VGACheck(_emptyLineHeight);
|
||||
}
|
||||
}
|
||||
|
||||
_calculatedSequenceHeight = height;
|
||||
}
|
||||
|
||||
int AGSCreditz::VGACheck(int value) {
|
||||
int32 screenX, dum;
|
||||
_engine->GetScreenDimensions(&screenX, &dum, &dum);
|
||||
|
||||
if (screenX == 640)
|
||||
return value * 2;
|
||||
else
|
||||
return value;
|
||||
}
|
||||
|
||||
void AGSCreditz::startSequence(int sequence) {
|
||||
if (!_creditsRunning) {
|
||||
_seqSettings[sequence].finished = false;
|
||||
_creditsRunning = true;
|
||||
_creditSequence = sequence;
|
||||
|
||||
_engine->GetScreenDimensions(&_screenWidth, &_screenHeight,
|
||||
&_screenColorDepth);
|
||||
|
||||
if (_seqSettings[sequence].automatic) {
|
||||
calculateSequenceHeight(sequence);
|
||||
_yPos = _screenHeight + 1;
|
||||
} else {
|
||||
_yPos = _seqSettings[sequence].startpoint;
|
||||
}
|
||||
|
||||
_speedPoint = 0;
|
||||
_timer = 0;
|
||||
draw();
|
||||
} else {
|
||||
_paused = false;
|
||||
_creditsRunning = false;
|
||||
_creditSequence = -1;
|
||||
_seqSettings[sequence].finished = true;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace AGSCreditz
|
||||
} // namespace Plugins
|
||||
} // namespace AGS3
|
||||
146
engines/ags/plugins/ags_creditz/ags_creditz.h
Normal file
146
engines/ags/plugins/ags_creditz/ags_creditz.h
Normal file
@@ -0,0 +1,146 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* of the License, or(at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_PLUGINS_AGSCREDITZ_AGSCREDITZ_H
|
||||
#define AGS_PLUGINS_AGSCREDITZ_AGSCREDITZ_H
|
||||
|
||||
#include "ags/plugins/ags_plugin.h"
|
||||
#include "ags/plugins/ags_creditz/drawing.h"
|
||||
#include "common/array.h"
|
||||
#include "common/rect.h"
|
||||
#include "common/str.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace Plugins {
|
||||
namespace AGSCreditz {
|
||||
|
||||
typedef int (*IntFunction)(int val1);
|
||||
|
||||
struct Credit {
|
||||
Common::String _text;
|
||||
int _x = 0;
|
||||
int _y = 0;
|
||||
int _fontSlot = 0;
|
||||
int _colorHeight = 0;
|
||||
bool _isSet = false;
|
||||
bool _image = false;
|
||||
bool _outline = false;
|
||||
};
|
||||
|
||||
struct SequenceSettings {
|
||||
int startpoint = 0;
|
||||
int endpoint = 0;
|
||||
int speed = 0;
|
||||
bool finished = false;
|
||||
int automatic = 0;
|
||||
int endwait = 0;
|
||||
int topmask = 0;
|
||||
int bottommask = 0;
|
||||
};
|
||||
|
||||
struct StCredit {
|
||||
Common::String credit;
|
||||
Common::String title;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int font = 0;
|
||||
int color = 0;
|
||||
int title_x = 0;
|
||||
int title_y = 0;
|
||||
int title_font = 0;
|
||||
int title_color = 0;
|
||||
bool title_centered = false;
|
||||
bool title_outline = false;
|
||||
int pause = 0;
|
||||
bool image = false;
|
||||
int image_slot = 0;
|
||||
int image_time = 0;
|
||||
bool outline = false;
|
||||
};
|
||||
|
||||
struct StSequenceSettings {
|
||||
int speed = 0;
|
||||
bool finished = false;
|
||||
};
|
||||
|
||||
struct SingleStatic {
|
||||
int id = 0;
|
||||
int time = 0;
|
||||
int style = 0;
|
||||
int settings1 = 01;
|
||||
int settings2 = 0;
|
||||
bool bool_ = false;
|
||||
};
|
||||
|
||||
typedef Common::Array<Credit> CreditArray;
|
||||
typedef Common::Array<StCredit> StCreditArray;
|
||||
|
||||
class AGSCreditz : public PluginBase, public Drawing {
|
||||
private:
|
||||
int drawCredit(int sequence, int credit);
|
||||
void doCredits();
|
||||
int countLines(const Common::String &text);
|
||||
Common::String extractParameter(Common::String &line, const Common::String &separator);
|
||||
void specialEffect(int sequence, int credit, const Common::String &text,
|
||||
int font, int color, int32 x_pos);
|
||||
void drawStEffects(int sequence, int id, int style);
|
||||
void speeder(int sequence);
|
||||
|
||||
protected:
|
||||
enum Version {
|
||||
VERSION_11 = 11, VERSION_20 = 20
|
||||
};
|
||||
|
||||
Version _version;
|
||||
PluginMethod _playSound;
|
||||
CreditArray _credits[10];
|
||||
StCreditArray _stCredits[10];
|
||||
bool _creditsRunning = 0, _paused = 0, _staticCredits = 0;
|
||||
int _creditSequence = 0, _yPos = 0, _sequenceHeight = 0, _speedPoint = 0;
|
||||
int _calculatedSequenceHeight = 0, _timer = 0, _currentStatic = 0;
|
||||
int _numChars = 0, _timer2 = 0;
|
||||
int _emptyLineHeight = 10;
|
||||
int _strCredit[10];
|
||||
SequenceSettings _seqSettings[10];
|
||||
StSequenceSettings _stSeqSettings[10];
|
||||
SingleStatic _singleStatic;
|
||||
|
||||
// Version 1.1 specific
|
||||
bool _resolutionFlag = false;
|
||||
int32 _screenWidth = 0, _screenHeight = 0, _screenColorDepth = 0;
|
||||
int32 _staticScreenWidth = 0;
|
||||
bool _staticWidthMatches = false;
|
||||
|
||||
void draw();
|
||||
void calculateSequenceHeight(int sequence);
|
||||
int VGACheck(int value);
|
||||
void startSequence(int sequence);
|
||||
|
||||
public:
|
||||
AGSCreditz() : PluginBase(), Drawing() {}
|
||||
virtual ~AGSCreditz() {}
|
||||
};
|
||||
|
||||
} // namespace AGSCreditz
|
||||
} // namespace Plugins
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
||||
315
engines/ags/plugins/ags_creditz/ags_creditz1.cpp
Normal file
315
engines/ags/plugins/ags_creditz/ags_creditz1.cpp
Normal file
@@ -0,0 +1,315 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/plugins/ags_creditz/ags_creditz1.h"
|
||||
#include "ags/lib/allegro/surface.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace Plugins {
|
||||
namespace AGSCreditz {
|
||||
|
||||
const char *IMAGE_TEXT = "*i*m*a*g*e*";
|
||||
|
||||
AGSCreditz1::AGSCreditz1() : AGSCreditz() {
|
||||
_version = VERSION_11;
|
||||
}
|
||||
|
||||
const char *AGSCreditz1::AGS_GetPluginName() {
|
||||
return "AGSCreditz v1.1 by AJA";
|
||||
}
|
||||
|
||||
void AGSCreditz1::AGS_EngineStartup(IAGSEngine *engine) {
|
||||
PluginBase::AGS_EngineStartup(engine);
|
||||
engine->RequestEventHook(AGSE_POSTSCREENDRAW);
|
||||
_engine->GetScreenDimensions(&_screenWidth,
|
||||
&_screenHeight, &_screenColorDepth);
|
||||
|
||||
SCRIPT_METHOD(SetCredit, AGSCreditz1::SetCredit);
|
||||
SCRIPT_METHOD(ScrollCredits, AGSCreditz1::ScrollCredits);
|
||||
SCRIPT_METHOD(GetCredit, AGSCreditz1::GetCredit);
|
||||
SCRIPT_METHOD(IsCreditScrollingFinished, AGSCreditz1::IsCreditScrollingFinished);
|
||||
SCRIPT_METHOD(IsFinished, AGSCreditz1::IsCreditScrollingFinished);
|
||||
SCRIPT_METHOD(SetCreditImage, AGSCreditz1::SetCreditImage);
|
||||
SCRIPT_METHOD(PauseScroll, AGSCreditz1::PauseScroll);
|
||||
SCRIPT_METHOD(ScrollReset, AGSCreditz1::ScrollReset);
|
||||
SCRIPT_METHOD(SetEmptyLineHeight, AGSCreditz1::SetEmptyLineHeight);
|
||||
SCRIPT_METHOD(GetEmptyLineHeight, AGSCreditz1::GetEmptyLineHeight);
|
||||
SCRIPT_METHOD(SetStaticCredit, AGSCreditz1::SetStaticCredit);
|
||||
SCRIPT_METHOD(GetStaticCredit, AGSCreditz1::GetStaticCredit);
|
||||
SCRIPT_METHOD(StartEndStaticCredits, AGSCreditz1::StartEndStaticCredits);
|
||||
SCRIPT_METHOD(GetCurrentStaticCredit, AGSCreditz1::GetCurrentStaticCredit);
|
||||
SCRIPT_METHOD(SetDefaultStaticDelay, AGSCreditz1::SetDefaultStaticDelay);
|
||||
SCRIPT_METHOD(SetStaticPause, AGSCreditz1::SetStaticPause);
|
||||
SCRIPT_METHOD(SetStaticCreditTitle, AGSCreditz1::SetStaticCreditTitle);
|
||||
SCRIPT_METHOD(ShowStaticCredit, AGSCreditz1::ShowStaticCredit);
|
||||
SCRIPT_METHOD(StaticReset, AGSCreditz1::StaticReset);
|
||||
SCRIPT_METHOD(GetStaticCreditTitle, AGSCreditz1::GetStaticCreditTitle);
|
||||
SCRIPT_METHOD(SetStaticCreditImage, AGSCreditz1::SetStaticCreditImage);
|
||||
SCRIPT_METHOD(IsStaticCreditsFinished, AGSCreditz1::IsStaticCreditsFinished);
|
||||
}
|
||||
|
||||
int64 AGSCreditz1::AGS_EngineOnEvent(int event, NumberPtr data) {
|
||||
if (event & AGSE_POSTSCREENDRAW)
|
||||
draw();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS7(int, ID, string, credit, int, colour, int, font, bool, center, int, xpos, int, generateoutline);
|
||||
|
||||
if (ID >= (int)_credits[0].size())
|
||||
_credits[0].resize(ID + 1);
|
||||
|
||||
if (center) {
|
||||
int32 creditW, creditH;
|
||||
_engine->GetTextExtent(font, credit, &creditW, &creditH);
|
||||
xpos = (_screenWidth - creditW) / 2;
|
||||
}
|
||||
|
||||
Credit &c = _credits[0][ID];
|
||||
c._text = credit;
|
||||
c._fontSlot = font;
|
||||
c._x = xpos;
|
||||
c._isSet = true;
|
||||
c._outline = generateoutline;
|
||||
c._colorHeight = colour;
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetCreditImage(ScriptMethodParams ¶ms) {
|
||||
PARAMS5(int, ID, int, slot, bool, center, int, xpos, int, pixtonext);
|
||||
|
||||
if (ID >= (int)_credits[0].size())
|
||||
_credits[0].resize(ID + 1);
|
||||
|
||||
BITMAP *gfx = _engine->GetSpriteGraphic(slot);
|
||||
if (center)
|
||||
xpos = (_screenWidth - gfx->w) / 2;
|
||||
|
||||
_credits[0][ID]._image = true;
|
||||
_credits[0][ID]._isSet = true;
|
||||
_credits[0][ID]._x = xpos;
|
||||
_credits[0][ID]._fontSlot = slot;
|
||||
|
||||
if (pixtonext != -1) {
|
||||
_credits[0][ID]._colorHeight = pixtonext;
|
||||
} else {
|
||||
_credits[0][ID]._colorHeight = gfx->h;
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz1::ScrollCredits(ScriptMethodParams ¶ms) {
|
||||
PARAMS7(int, onoff, int, speed, int, fromY, int, toY, int, isautom, int, wait, int, resolution);
|
||||
|
||||
if (onoff == 1) {
|
||||
_seqSettings[0].speed = speed;
|
||||
_seqSettings[0].endwait = wait;
|
||||
_seqSettings[0].startpoint = fromY;
|
||||
_seqSettings[0].endpoint = toY;
|
||||
_seqSettings[0].automatic = isautom;
|
||||
|
||||
if (_screenWidth == 320) {
|
||||
_resolutionFlag = (resolution != 2) ? 1 : 0;
|
||||
} else if (_screenWidth == 640) {
|
||||
_resolutionFlag = (resolution != 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
startSequence(0);
|
||||
|
||||
} else if (onoff == 0) {
|
||||
_creditsRunning = false;
|
||||
|
||||
} else {
|
||||
_engine->AbortGame("ScrollCredits: OnOff value must be 1 or 0!");
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz1::GetCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, ID);
|
||||
|
||||
params._result = (_credits[0][ID]._text == IMAGE_TEXT) ?
|
||||
"image" : _credits[0][ID]._text.c_str();
|
||||
}
|
||||
|
||||
void AGSCreditz1::IsCreditScrollingFinished(ScriptMethodParams ¶ms) {
|
||||
params._result = _seqSettings[0].finished;
|
||||
}
|
||||
|
||||
void AGSCreditz1::PauseScroll(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(bool, onoff);
|
||||
_paused = onoff;
|
||||
}
|
||||
|
||||
void AGSCreditz1::ScrollReset(ScriptMethodParams ¶ms) {
|
||||
_credits[0].clear();
|
||||
_creditsRunning = false;
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetEmptyLineHeight(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, emptylineheight);
|
||||
_emptyLineHeight = emptylineheight;
|
||||
}
|
||||
|
||||
void AGSCreditz1::GetEmptyLineHeight(ScriptMethodParams ¶ms) {
|
||||
params._result = _emptyLineHeight;
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetStaticCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS8(int, ID, int, x, int, y, int, font, int, creditcolour, \
|
||||
bool, center, int, generateoutline, string, credit);
|
||||
|
||||
if (ID >= (int)_credits[0].size())
|
||||
_credits[0].resize(ID + 1);
|
||||
|
||||
if (center) {
|
||||
int32 creditW, creditH;
|
||||
_engine->GetTextExtent(font, credit, &creditW, &creditH);
|
||||
x = (_screenWidth - creditW) / 2;
|
||||
}
|
||||
|
||||
StCredit &c = _stCredits[0][ID];
|
||||
c.credit = credit;
|
||||
c.font = font;
|
||||
c.color = creditcolour;
|
||||
c.x = x;
|
||||
c.y = y;
|
||||
c.outline = generateoutline;
|
||||
}
|
||||
|
||||
void AGSCreditz1::GetStaticCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, ID);
|
||||
StCredit &c = _stCredits[0][ID];
|
||||
params._result = c.credit.c_str();
|
||||
}
|
||||
|
||||
void AGSCreditz1::StartEndStaticCredits(ScriptMethodParams ¶ms) {
|
||||
PARAMS2(bool, onoff, int, res);
|
||||
|
||||
if (!onoff) {
|
||||
_staticCredits = false;
|
||||
|
||||
} else if (res != 1 && res != 2) {
|
||||
_engine->AbortGame("StartEndStaticCredits: Wrong resolution");
|
||||
|
||||
} else {
|
||||
_currentStatic = 0;
|
||||
_engine->GetScreenDimensions(&_screenWidth,
|
||||
&_screenHeight, &_screenColorDepth);
|
||||
|
||||
_staticScreenWidth = (res == 1) ? 320 : 640;
|
||||
_staticWidthMatches = _screenWidth == _staticScreenWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz1::GetCurrentStaticCredit(ScriptMethodParams ¶ms) {
|
||||
params._result = _currentStatic;
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetDefaultStaticDelay(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, Cyclesperchar);
|
||||
_stSeqSettings[0].speed = Cyclesperchar;
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetStaticPause(ScriptMethodParams ¶ms) {
|
||||
PARAMS2(int, ID, int, length);
|
||||
_stCredits[0][ID].pause = length;
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetStaticCreditTitle(ScriptMethodParams ¶ms) {
|
||||
PARAMS8(int, ID, int, x, int, y, int, titlefont, int, titlecolour, \
|
||||
int, centered, int, generateoutline, string, title);
|
||||
|
||||
StCredit &c = _stCredits[0][ID];
|
||||
c.title_x = x;
|
||||
c.title_y = y;
|
||||
c.title_font = titlefont;
|
||||
c.title_color = titlecolour;
|
||||
c.title_centered = centered;
|
||||
c.title_outline = generateoutline;
|
||||
c.title = title;
|
||||
}
|
||||
|
||||
void AGSCreditz1::ShowStaticCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS6(int, ID, int, time, int, style, int, transtime, \
|
||||
int, sound, int, res);
|
||||
const StCredit &c = _stCredits[0][ID];
|
||||
|
||||
if (!_staticCredits) {
|
||||
if (c.credit.empty() && c.title.empty()) {
|
||||
_engine->AbortGame("ShowStaticCredit: Credit not set!");
|
||||
} else if (res == 1 || (res == 2 && c.credit != "P=A=U=S=E")) {
|
||||
if (style == 1) {
|
||||
// TODO: style 1 setup
|
||||
warning("TODO: Use %d %d %d", transtime, time, sound);
|
||||
}
|
||||
|
||||
_engine->GetScreenDimensions(&_screenWidth,
|
||||
&_screenHeight, &_screenColorDepth);
|
||||
|
||||
_staticScreenWidth = (res == 1) ? 320 : 640;
|
||||
_staticWidthMatches = _screenWidth == _staticScreenWidth;
|
||||
_currentStatic = ID;
|
||||
|
||||
// TODO: Final setup
|
||||
}
|
||||
}
|
||||
|
||||
params._result = 0;
|
||||
}
|
||||
|
||||
void AGSCreditz1::StaticReset(ScriptMethodParams ¶ms) {
|
||||
_stCredits[0].clear();
|
||||
}
|
||||
|
||||
void AGSCreditz1::GetStaticCreditTitle(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, ID);
|
||||
|
||||
const StCredit &c = _stCredits[0][ID];
|
||||
params._result = c.title.c_str();
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetStaticCreditImage(ScriptMethodParams ¶ms) {
|
||||
PARAMS7(int, ID, int, x, int, y, int, slot, int, Hcentered, \
|
||||
bool, Vcentered, int, time);
|
||||
|
||||
if (Hcentered) {
|
||||
BITMAP *gfx = _engine->GetSpriteGraphic(slot);
|
||||
if (Hcentered)
|
||||
x = (_screenWidth - gfx->w) / 2;
|
||||
}
|
||||
|
||||
StCredit &c = _stCredits[0][ID];
|
||||
c.credit = "I=M=A=G=E";
|
||||
c.x = x;
|
||||
c.y = y;
|
||||
c.font = slot;
|
||||
// TODO: Below seems *weird*
|
||||
c.outline = Vcentered;
|
||||
c.color = time;
|
||||
}
|
||||
|
||||
void AGSCreditz1::IsStaticCreditsFinished(ScriptMethodParams ¶ms) {
|
||||
params._result = _stSeqSettings[0].finished;
|
||||
}
|
||||
|
||||
} // namespace AGSCreditz
|
||||
} // namespace Plugins
|
||||
} // namespace AGS3
|
||||
68
engines/ags/plugins/ags_creditz/ags_creditz1.h
Normal file
68
engines/ags/plugins/ags_creditz/ags_creditz1.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* of the License, or(at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_PLUGINS_AGSCREDITZ_AGSCREDITZ1_H
|
||||
#define AGS_PLUGINS_AGSCREDITZ_AGSCREDITZ1_H
|
||||
|
||||
#include "ags/plugins/ags_creditz/ags_creditz.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace Plugins {
|
||||
namespace AGSCreditz {
|
||||
|
||||
class AGSCreditz1 : public AGSCreditz {
|
||||
SCRIPT_HASH_SUB(AGSCreditz1, AGSCreditz)
|
||||
private:
|
||||
void SetCredit(ScriptMethodParams ¶ms);
|
||||
void ScrollCredits(ScriptMethodParams ¶ms);
|
||||
void GetCredit(ScriptMethodParams ¶ms);
|
||||
void IsCreditScrollingFinished(ScriptMethodParams ¶ms);
|
||||
void SetCreditImage(ScriptMethodParams ¶ms);
|
||||
void PauseScroll(ScriptMethodParams ¶ms);
|
||||
void ScrollReset(ScriptMethodParams ¶ms);
|
||||
void SetEmptyLineHeight(ScriptMethodParams ¶ms);
|
||||
void GetEmptyLineHeight(ScriptMethodParams ¶ms);
|
||||
void SetStaticCredit(ScriptMethodParams ¶ms);
|
||||
void GetStaticCredit(ScriptMethodParams ¶ms);
|
||||
void StartEndStaticCredits(ScriptMethodParams ¶ms);
|
||||
void GetCurrentStaticCredit(ScriptMethodParams ¶ms);
|
||||
void SetDefaultStaticDelay(ScriptMethodParams ¶ms);
|
||||
void SetStaticPause(ScriptMethodParams ¶ms);
|
||||
void SetStaticCreditTitle(ScriptMethodParams ¶ms);
|
||||
void ShowStaticCredit(ScriptMethodParams ¶ms);
|
||||
void StaticReset(ScriptMethodParams ¶ms);
|
||||
void GetStaticCreditTitle(ScriptMethodParams ¶ms);
|
||||
void SetStaticCreditImage(ScriptMethodParams ¶ms);
|
||||
void IsStaticCreditsFinished(ScriptMethodParams ¶ms);
|
||||
|
||||
public:
|
||||
AGSCreditz1();
|
||||
|
||||
const char *AGS_GetPluginName() override;
|
||||
void AGS_EngineStartup(IAGSEngine *engine) override;
|
||||
int64 AGS_EngineOnEvent(int event, NumberPtr data) override;
|
||||
};
|
||||
|
||||
} // namespace AGSCreditz
|
||||
} // namespace Plugins
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
||||
280
engines/ags/plugins/ags_creditz/ags_creditz2.cpp
Normal file
280
engines/ags/plugins/ags_creditz/ags_creditz2.cpp
Normal file
@@ -0,0 +1,280 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/plugins/ags_creditz/ags_creditz2.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace Plugins {
|
||||
namespace AGSCreditz {
|
||||
|
||||
AGSCreditz2::AGSCreditz2() : AGSCreditz() {
|
||||
_version = VERSION_20;
|
||||
}
|
||||
|
||||
const char *AGSCreditz2::AGS_GetPluginName() {
|
||||
return "AGSCreditz 2.0 (by Dima Software: AJA)";
|
||||
}
|
||||
|
||||
void AGSCreditz2::AGS_EngineStartup(IAGSEngine *engine) {
|
||||
PluginBase::AGS_EngineStartup(engine);
|
||||
_playSound = _engine->GetScriptFunctionAddress("PlaySound");
|
||||
engine->RequestEventHook(AGSE_POSTSCREENDRAW);
|
||||
|
||||
SCRIPT_METHOD(RunCreditSequence, AGSCreditz2::RunCreditSequence);
|
||||
SCRIPT_METHOD(SetCredit, AGSCreditz2::SetCredit);
|
||||
SCRIPT_METHOD(GetCredit, AGSCreditz2::GetCredit);
|
||||
SCRIPT_METHOD(CreditsSettings, AGSCreditz2::CreditsSettings);
|
||||
SCRIPT_METHOD(SequenceSettings, AGSCreditz2::SequenceSettings);
|
||||
SCRIPT_METHOD(IsSequenceFinished, AGSCreditz2::IsSequenceFinished);
|
||||
SCRIPT_METHOD(PauseScrolling, AGSCreditz2::PauseScrolling);
|
||||
SCRIPT_METHOD(SetCreditImage, AGSCreditz2::SetCreditImage);
|
||||
SCRIPT_METHOD(ResetSequence, AGSCreditz2::ResetSequence);
|
||||
|
||||
SCRIPT_METHOD(SetStaticCredit, AGSCreditz2::SetStaticCredit);
|
||||
SCRIPT_METHOD(SetStaticCreditTitle, AGSCreditz2::SetStaticCreditTitle);
|
||||
SCRIPT_METHOD(SetStaticPause, AGSCreditz2::SetStaticPause);
|
||||
SCRIPT_METHOD(RunStaticCreditSequence, AGSCreditz2::RunStaticCreditSequence);
|
||||
SCRIPT_METHOD(IsStaticSequenceFinished, AGSCreditz2::IsStaticSequenceFinished);
|
||||
SCRIPT_METHOD(ShowStaticCredit, AGSCreditz2::ShowStaticCredit);
|
||||
SCRIPT_METHOD(SetStaticImage, AGSCreditz2::SetStaticImage);
|
||||
SCRIPT_METHOD(GetCurrentStaticCredit, AGSCreditz2::GetCurrentStaticCredit);
|
||||
}
|
||||
|
||||
int64 AGSCreditz2::AGS_EngineOnEvent(int event, NumberPtr data) {
|
||||
if (event & AGSE_POSTSCREENDRAW)
|
||||
draw();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AGSCreditz2::RunCreditSequence(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, sequence);
|
||||
|
||||
startSequence(sequence);
|
||||
}
|
||||
|
||||
void AGSCreditz2::SetCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS7(int, sequence, int, line, string, credit, int, x_pos, int, font, int, color, int, gen_outline);
|
||||
|
||||
assert(sequence >= 0 && sequence <= 10);
|
||||
if (line >= (int)_credits[sequence].size())
|
||||
_credits[sequence].resize(line + 1);
|
||||
|
||||
Credit &c = _credits[sequence][line];
|
||||
c._text = credit;
|
||||
c._fontSlot = font;
|
||||
c._colorHeight = color;
|
||||
c._x = x_pos;
|
||||
c._isSet = true;
|
||||
if (gen_outline > 0)
|
||||
c._outline = true;
|
||||
}
|
||||
|
||||
void AGSCreditz2::GetCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS2(int, sequence, int, ID);
|
||||
|
||||
params._result = _credits[sequence][ID]._text.c_str();
|
||||
}
|
||||
|
||||
void AGSCreditz2::CreditsSettings(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, emptylineheight);
|
||||
|
||||
if (emptylineheight >= 0)
|
||||
_emptyLineHeight = emptylineheight;
|
||||
}
|
||||
|
||||
void AGSCreditz2::SequenceSettings(ScriptMethodParams ¶ms) {
|
||||
PARAMS6(int, sequence, int, startpoint, int, endPoint, int, speed, int, automatic, int, endwait);
|
||||
|
||||
_seqSettings[sequence].startpoint = startpoint;
|
||||
_seqSettings[sequence].endpoint = endPoint;
|
||||
_seqSettings[sequence].speed = speed;
|
||||
_seqSettings[sequence].automatic = automatic;
|
||||
_seqSettings[sequence].endwait = endwait;
|
||||
}
|
||||
|
||||
void AGSCreditz2::IsSequenceFinished(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, sequence);
|
||||
|
||||
if (_seqSettings[sequence].finished) {
|
||||
_seqSettings[sequence].finished = false;
|
||||
params._result = 1;
|
||||
} else {
|
||||
params._result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz2::PauseScrolling(ScriptMethodParams ¶ms) {
|
||||
if (_creditsRunning) {
|
||||
_paused = !_paused;
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz2::SetCreditImage(ScriptMethodParams ¶ms) {
|
||||
PARAMS5(int, sequence, int, line, int, xPos, int, slot, int, height);
|
||||
|
||||
assert(sequence >= 0 && sequence <= 10);
|
||||
if (line >= (int)_credits[sequence].size())
|
||||
_credits[sequence].resize(line + 1);
|
||||
|
||||
_credits[sequence][line]._image = true;
|
||||
_credits[sequence][line]._isSet = true;
|
||||
_credits[sequence][line]._x = xPos;
|
||||
_credits[sequence][line]._fontSlot = slot;
|
||||
_credits[sequence][line]._colorHeight = height;
|
||||
}
|
||||
|
||||
void AGSCreditz2::ResetSequence(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, seqtype);
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
if (seqtype != 2)
|
||||
// Scrolling
|
||||
_credits[i].clear();
|
||||
else
|
||||
// Static
|
||||
_stCredits[i].clear();
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz2::SetStaticCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS8(int, sequence, int, id, string, credit, int, xPos, int, yPos,
|
||||
int, font, int, color, int, genOutline);
|
||||
|
||||
assert(sequence >= 0 && sequence <= 10);
|
||||
if (id >= (int)_stCredits[sequence].size())
|
||||
_stCredits[sequence].resize(id + 1);
|
||||
|
||||
_stCredits[sequence][id].credit = credit;
|
||||
_stCredits[sequence][id].x = xPos;
|
||||
_stCredits[sequence][id].y = yPos;
|
||||
_stCredits[sequence][id].font = font;
|
||||
_stCredits[sequence][id].color = color;
|
||||
|
||||
if (genOutline > 0)
|
||||
_stCredits[sequence][id].outline = true;
|
||||
}
|
||||
|
||||
void AGSCreditz2::SetStaticCreditTitle(ScriptMethodParams ¶ms) {
|
||||
PARAMS8(int, sequence, int, id, string, title, int, xPos, int, yPos,
|
||||
int, font, int, color, int, genOutline);
|
||||
|
||||
assert(sequence >= 0 && sequence < 10);
|
||||
if (id >= (int)_stCredits[sequence].size())
|
||||
_stCredits[sequence].resize(id + 1);
|
||||
|
||||
_stCredits[sequence][id].title = title;
|
||||
_stCredits[sequence][id].title_x = xPos;
|
||||
_stCredits[sequence][id].title_y = yPos;
|
||||
_stCredits[sequence][id].title_font = font;
|
||||
_stCredits[sequence][id].title_color = color;
|
||||
|
||||
if (genOutline > 0)
|
||||
_stCredits[sequence][id].title_outline = true;
|
||||
}
|
||||
|
||||
void AGSCreditz2::SetStaticPause(ScriptMethodParams ¶ms) {
|
||||
PARAMS3(int, sequence, int, id, int, length);
|
||||
|
||||
assert(sequence >= 0 && sequence <= 10);
|
||||
if (id >= (int)_stCredits[sequence].size())
|
||||
_stCredits[sequence].resize(id + 1);
|
||||
|
||||
_stCredits[sequence][id].pause = length;
|
||||
}
|
||||
|
||||
void AGSCreditz2::RunStaticCreditSequence(ScriptMethodParams ¶ms) {
|
||||
PARAMS2(int, sequence, int, speed);
|
||||
|
||||
if (!_creditsRunning) {
|
||||
_stSeqSettings[sequence].finished = false;
|
||||
_stSeqSettings[sequence].speed = speed;
|
||||
_creditSequence = sequence;
|
||||
_staticCredits = true;
|
||||
_creditsRunning = true;
|
||||
_currentStatic = 1;
|
||||
_timer = 0;
|
||||
draw();
|
||||
|
||||
} else {
|
||||
_staticCredits = false;
|
||||
_creditSequence = -1;
|
||||
_stSeqSettings[sequence].finished = false;
|
||||
_creditsRunning = false;
|
||||
_currentStatic = 0;
|
||||
_timer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz2::IsStaticSequenceFinished(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, sequence);
|
||||
|
||||
int result = (_stSeqSettings[sequence].finished) ? 1 : 0;
|
||||
_stSeqSettings[sequence].finished = false;
|
||||
|
||||
params._result = result;
|
||||
}
|
||||
|
||||
void AGSCreditz2::ShowStaticCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS6(int, sequence, int, id, int, time, int, style,
|
||||
int, styleSettings1, int, styleSettings2);
|
||||
|
||||
_creditSequence = sequence;
|
||||
_creditsRunning = true;
|
||||
_staticCredits = true;
|
||||
_singleStatic.id = id;
|
||||
_singleStatic.time = time;
|
||||
_singleStatic.style = style;
|
||||
_singleStatic.settings1 = styleSettings1;
|
||||
_singleStatic.settings2 = styleSettings2;
|
||||
_singleStatic.bool_ = true;
|
||||
_stSeqSettings[sequence].finished = false;
|
||||
_timer = 0;
|
||||
_timer2 = 0;
|
||||
_numChars = 0;
|
||||
draw();
|
||||
}
|
||||
|
||||
void AGSCreditz2::SetStaticImage(ScriptMethodParams ¶ms) {
|
||||
PARAMS6(int, sequence, int, id, int, slot, int, xPos, int, yPos, int, length);
|
||||
|
||||
assert(sequence >= 0 && sequence < 10);
|
||||
if (id >= (int)_stCredits[sequence].size())
|
||||
_stCredits[sequence].resize(id + 1);
|
||||
|
||||
_stCredits[sequence][id].image = true;
|
||||
_stCredits[sequence][id].image_slot = slot;
|
||||
_stCredits[sequence][id].x = xPos;
|
||||
_stCredits[sequence][id].y = yPos;
|
||||
_stCredits[sequence][id].image_time = length;
|
||||
}
|
||||
|
||||
void AGSCreditz2::GetCurrentStaticCredit(ScriptMethodParams ¶ms) {
|
||||
int result = -1;
|
||||
if (_creditsRunning && _staticCredits)
|
||||
result = _currentStatic;
|
||||
|
||||
params._result = result;
|
||||
}
|
||||
|
||||
} // namespace AGSCreditz
|
||||
} // namespace Plugins
|
||||
} // namespace AGS3
|
||||
65
engines/ags/plugins/ags_creditz/ags_creditz2.h
Normal file
65
engines/ags/plugins/ags_creditz/ags_creditz2.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* of the License, or(at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_PLUGINS_AGSCREDITZ_AGSCREDITZ2_H
|
||||
#define AGS_PLUGINS_AGSCREDITZ_AGSCREDITZ2_H
|
||||
|
||||
#include "ags/plugins/ags_creditz/ags_creditz.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace Plugins {
|
||||
namespace AGSCreditz {
|
||||
|
||||
class AGSCreditz2 : public AGSCreditz {
|
||||
SCRIPT_HASH_SUB(AGSCreditz2, AGSCreditz)
|
||||
private:
|
||||
void RunCreditSequence(ScriptMethodParams ¶ms);
|
||||
void SetCredit(ScriptMethodParams ¶ms);
|
||||
void GetCredit(ScriptMethodParams ¶ms);
|
||||
void CreditsSettings(ScriptMethodParams ¶ms);
|
||||
void SequenceSettings(ScriptMethodParams ¶ms);
|
||||
void IsSequenceFinished(ScriptMethodParams ¶ms);
|
||||
void PauseScrolling(ScriptMethodParams ¶ms);
|
||||
void SetCreditImage(ScriptMethodParams ¶ms);
|
||||
void ResetSequence(ScriptMethodParams ¶ms);
|
||||
|
||||
void SetStaticCredit(ScriptMethodParams ¶ms);
|
||||
void SetStaticCreditTitle(ScriptMethodParams ¶ms);
|
||||
void SetStaticPause(ScriptMethodParams ¶ms);
|
||||
void RunStaticCreditSequence(ScriptMethodParams ¶ms);
|
||||
void IsStaticSequenceFinished(ScriptMethodParams ¶ms);
|
||||
void ShowStaticCredit(ScriptMethodParams ¶ms);
|
||||
void SetStaticImage(ScriptMethodParams ¶ms);
|
||||
void GetCurrentStaticCredit(ScriptMethodParams ¶ms);
|
||||
|
||||
public:
|
||||
AGSCreditz2();
|
||||
|
||||
const char *AGS_GetPluginName() override;
|
||||
void AGS_EngineStartup(IAGSEngine *engine) override;
|
||||
int64 AGS_EngineOnEvent(int event, NumberPtr data) override;
|
||||
};
|
||||
|
||||
} // namespace AGSCreditz
|
||||
} // namespace Plugins
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
||||
31
engines/ags/plugins/ags_creditz/drawing.cpp
Normal file
31
engines/ags/plugins/ags_creditz/drawing.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/plugins/ags_creditz/drawing.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace Plugins {
|
||||
namespace AGSCreditz {
|
||||
|
||||
|
||||
} // namespace AGSCreditz
|
||||
} // namespace Plugins
|
||||
} // namespace AGS3
|
||||
66
engines/ags/plugins/ags_creditz/drawing.h
Normal file
66
engines/ags/plugins/ags_creditz/drawing.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* of the License, or(at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_PLUGINS_AGSCREDITZ_DRAWING_H
|
||||
#define AGS_PLUGINS_AGSCREDITZ_DRAWING_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace Plugins {
|
||||
namespace AGSCreditz {
|
||||
|
||||
class Drawing {
|
||||
public:
|
||||
void drawPixel(uint8 *bitmap, int32 x, int32 y,
|
||||
uint col, int32 pitch, int32 coldepth) {
|
||||
switch (coldepth) {
|
||||
case 8:
|
||||
bitmap[x + y * pitch] = col;
|
||||
break;
|
||||
case 16:
|
||||
*((uint16 *)(bitmap + y * pitch + x * 2)) = col;
|
||||
break;
|
||||
case 32:
|
||||
*((uint32 *)(bitmap + y * pitch + x * 4)) = col;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint getPixelColor(uint8 *bitmap, int32 x, int32 y,
|
||||
int32 pitch, int32 coldepth) {
|
||||
switch (coldepth) {
|
||||
case 8:
|
||||
return bitmap[x + y * pitch];
|
||||
case 16:
|
||||
return *((uint16 *)(bitmap + y * pitch + x * 2));
|
||||
case 32:
|
||||
return *((uint32 *)(bitmap + y * pitch + x * 4));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace AGSCreditz
|
||||
} // namespace Plugins
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user