mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
AGS: Move separate state structure into AGSCreditz
This commit is contained in:
parent
8caed23e8b
commit
2b719124d3
@ -27,114 +27,105 @@ namespace AGS3 {
|
||||
namespace Plugins {
|
||||
namespace AGSCreditz {
|
||||
|
||||
AGSCreditz::AGSCreditz() : PluginBase(), Drawing() {
|
||||
_state = new State();
|
||||
_engine = nullptr;
|
||||
}
|
||||
|
||||
AGSCreditz::~AGSCreditz() {
|
||||
delete _state;
|
||||
}
|
||||
|
||||
void AGSCreditz::draw() {
|
||||
int endPoint;
|
||||
|
||||
if (_state->_creditsRunning) {
|
||||
if (_creditsRunning) {
|
||||
_engine->PollSystem();
|
||||
|
||||
if (!_state->_staticCredits) {
|
||||
if (!_staticCredits) {
|
||||
// Scrolling credits
|
||||
if (_state->_seqSettings[_state->_creditSequence].automatic == 1)
|
||||
endPoint = 0 - _state->_calculatedSequenceHeight;
|
||||
if (_seqSettings[_creditSequence].automatic == 1)
|
||||
endPoint = 0 - _calculatedSequenceHeight;
|
||||
else
|
||||
endPoint = _state->_seqSettings[_state->_creditSequence].endpoint;
|
||||
endPoint = _seqSettings[_creditSequence].endpoint;
|
||||
|
||||
if (_state->_yPos >= endPoint) {
|
||||
if (_yPos >= endPoint) {
|
||||
doCredits();
|
||||
} else {
|
||||
if (_state->_seqSettings[_state->_creditSequence].endwait > 0 && _state->_timer <= _state->_seqSettings[_state->_creditSequence].endwait) {
|
||||
_state->_paused = true;
|
||||
if (_seqSettings[_creditSequence].endwait > 0 && _timer <= _seqSettings[_creditSequence].endwait) {
|
||||
_paused = true;
|
||||
doCredits();
|
||||
_state->_timer++;
|
||||
_timer++;
|
||||
return;
|
||||
} else {
|
||||
_state->_paused = false;
|
||||
_state->_timer = 0;
|
||||
_state->_creditsRunning = false;
|
||||
_state->_seqSettings[_state->_creditSequence].finished = true;
|
||||
_paused = false;
|
||||
_timer = 0;
|
||||
_creditsRunning = false;
|
||||
_seqSettings[_creditSequence].finished = true;
|
||||
}
|
||||
}
|
||||
|
||||
_engine->MarkRegionDirty(0, 0, _state->_screenWidth, _state->_screenHeight);
|
||||
_engine->MarkRegionDirty(0, 0, _screenWidth, _screenHeight);
|
||||
} else {
|
||||
// credits
|
||||
if (!_state->_singleStatic.bool_) {
|
||||
if (_state->_currentStatic < (int)_state->_stCredits[_state->_creditSequence].size()) {
|
||||
if (_state->_stCredits[_state->_creditSequence][_state->_currentStatic].pause > 0) {
|
||||
if (!_singleStatic.bool_) {
|
||||
if (_currentStatic < (int)_stCredits[_creditSequence].size()) {
|
||||
if (_stCredits[_creditSequence][_currentStatic].pause > 0) {
|
||||
// Pause
|
||||
if (_state->_timer <= _state->_stCredits[_state->_creditSequence][_state->_currentStatic].pause) {
|
||||
_state->_timer++;
|
||||
if (_timer <= _stCredits[_creditSequence][_currentStatic].pause) {
|
||||
_timer++;
|
||||
} else {
|
||||
_state->_timer = 0;
|
||||
_state->_currentStatic++;
|
||||
_timer = 0;
|
||||
_currentStatic++;
|
||||
}
|
||||
} else {
|
||||
if (_state->_stCredits[_state->_creditSequence][_state->_currentStatic].image) {
|
||||
if (_stCredits[_creditSequence][_currentStatic].image) {
|
||||
// Image
|
||||
if (_state->_timer <= _state->_stCredits[_state->_creditSequence][_state->_currentStatic].image_time) {
|
||||
drawCredit(_state->_creditSequence, _state->_currentStatic);
|
||||
_state->_timer++;
|
||||
if (_timer <= _stCredits[_creditSequence][_currentStatic].image_time) {
|
||||
drawCredit(_creditSequence, _currentStatic);
|
||||
_timer++;
|
||||
} else {
|
||||
_state->_timer = 0;
|
||||
_state->_currentStatic++;
|
||||
if (_state->_stCredits[_state->_creditSequence][_state->_currentStatic].pause <= 0 &&
|
||||
_state->_currentStatic< (int)_state->_stCredits[_state->_creditSequence].size())
|
||||
drawCredit(_state->_creditSequence, _state->_currentStatic);
|
||||
_timer = 0;
|
||||
_currentStatic++;
|
||||
if (_stCredits[_creditSequence][_currentStatic].pause <= 0 &&
|
||||
_currentStatic< (int)_stCredits[_creditSequence].size())
|
||||
drawCredit(_creditSequence, _currentStatic);
|
||||
else
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Text
|
||||
if (_state->_timer <= (_state->_stSeqSettings[_state->_creditSequence].speed *
|
||||
((int)_state->_stCredits[_state->_creditSequence][_state->_currentStatic].title.size() +
|
||||
(int)_state->_stCredits[_state->_creditSequence][_state->_currentStatic].credit.size()))) {
|
||||
drawCredit(_state->_creditSequence, _state->_currentStatic);
|
||||
_state->_timer++;
|
||||
if (_timer <= (_stSeqSettings[_creditSequence].speed *
|
||||
((int)_stCredits[_creditSequence][_currentStatic].title.size() +
|
||||
(int)_stCredits[_creditSequence][_currentStatic].credit.size()))) {
|
||||
drawCredit(_creditSequence, _currentStatic);
|
||||
_timer++;
|
||||
} else {
|
||||
_state->_timer = 0;
|
||||
_state->_currentStatic++;
|
||||
if (_state->_stCredits[_state->_creditSequence][_state->_currentStatic].pause <= 0 &&
|
||||
(int)_state->_currentStatic<= (int)_state->_stCredits[_state->_creditSequence].size())
|
||||
drawCredit(_state->_creditSequence, _state->_currentStatic);
|
||||
_timer = 0;
|
||||
_currentStatic++;
|
||||
if (_stCredits[_creditSequence][_currentStatic].pause <= 0 &&
|
||||
(int)_currentStatic<= (int)_stCredits[_creditSequence].size())
|
||||
drawCredit(_creditSequence, _currentStatic);
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_state->_stSeqSettings[_state->_creditSequence].finished = true;
|
||||
_state->_creditsRunning = false;
|
||||
_state->_creditSequence = -1;
|
||||
_state->_timer = 0;
|
||||
_state->_currentStatic= 1;
|
||||
_stSeqSettings[_creditSequence].finished = true;
|
||||
_creditsRunning = false;
|
||||
_creditSequence = -1;
|
||||
_timer = 0;
|
||||
_currentStatic= 1;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Single Static
|
||||
if (_state->_timer <= _state->_singleStatic.time) {
|
||||
if (_state->_singleStatic.style == 0)
|
||||
drawCredit(_state->_creditSequence, _state->_singleStatic.id);
|
||||
else if (_state->_singleStatic.style == 1)
|
||||
drawStEffects(_state->_creditSequence, _state->_singleStatic.id, _state->_singleStatic.style);
|
||||
if (_timer <= _singleStatic.time) {
|
||||
if (_singleStatic.style == 0)
|
||||
drawCredit(_creditSequence, _singleStatic.id);
|
||||
else if (_singleStatic.style == 1)
|
||||
drawStEffects(_creditSequence, _singleStatic.id, _singleStatic.style);
|
||||
|
||||
_state->_timer++;
|
||||
_timer++;
|
||||
} else {
|
||||
_state->_timer = 0;
|
||||
_state->_singleStatic.bool_ = false;
|
||||
_state->_creditsRunning = false;
|
||||
_state->_staticCredits = false;
|
||||
_state->_stSeqSettings[_state->_creditSequence].finished = true;
|
||||
_state->_creditSequence = -1;
|
||||
_timer = 0;
|
||||
_singleStatic.bool_ = false;
|
||||
_creditsRunning = false;
|
||||
_staticCredits = false;
|
||||
_stSeqSettings[_creditSequence].finished = true;
|
||||
_creditSequence = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -153,15 +144,15 @@ int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
|
||||
_engine->GetScreenDimensions(&scrn_width, &scrn_height, &coldepth);
|
||||
|
||||
if (!_state->_staticCredits) {
|
||||
if (!_staticCredits) {
|
||||
// Scrolling Credits
|
||||
if ((_state->_yPos + _state->_sequenceHeight) > scrn_height)
|
||||
if ((_yPos + _sequenceHeight) > scrn_height)
|
||||
return 0;
|
||||
|
||||
if (_state->_credits[sequence][credit]._image) {
|
||||
slot = _state->_credits[sequence][credit]._fontSlot;
|
||||
sprite_height = _state->_credits[sequence][credit]._colorHeight;
|
||||
x_pos = _state->_credits[sequence][credit]._x;
|
||||
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);
|
||||
@ -178,13 +169,13 @@ int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
korkeus = sprite_height;
|
||||
|
||||
sprite = _engine->GetSpriteGraphic(slot);
|
||||
_engine->BlitBitmap(x_pos, _state->_yPos + _state->_sequenceHeight, sprite, 1);
|
||||
_engine->BlitBitmap(x_pos, _yPos + _sequenceHeight, sprite, 1);
|
||||
|
||||
} else {
|
||||
font = _state->_credits[sequence][credit]._fontSlot;
|
||||
color = _state->_credits[sequence][credit]._colorHeight;
|
||||
text = _state->_credits[sequence][credit]._text;
|
||||
x_pos = _state->_credits[sequence][credit]._x;
|
||||
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);
|
||||
@ -198,15 +189,15 @@ int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
if (text.contains('<')) {
|
||||
specialEffect(sequence, credit, text, font, color, x_pos);
|
||||
} else {
|
||||
if (_state->_credits[sequence][credit]._outline) {
|
||||
if (_credits[sequence][credit]._outline) {
|
||||
// Outline
|
||||
_engine->DrawText(x_pos - 1, _state->_yPos + _state->_sequenceHeight, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos + 1, _state->_yPos + _state->_sequenceHeight, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos, _state->_yPos + _state->_sequenceHeight - 1, font, 16, text.c_str());
|
||||
_engine->DrawText(x_pos, _state->_yPos + _state->_sequenceHeight + 1, font, 16, text.c_str());
|
||||
_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, _state->_yPos + _state->_sequenceHeight, font, color, text.c_str());
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight, font, color, text.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -214,10 +205,10 @@ int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
result = korkeus;
|
||||
} else {
|
||||
|
||||
if (_state->_stCredits[sequence][credit].image) {
|
||||
x_pos = _state->_stCredits[sequence][credit].x;
|
||||
y_posit = _state->_stCredits[sequence][credit].y;
|
||||
font = _state->_stCredits[sequence][credit].image_slot;
|
||||
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);
|
||||
@ -235,11 +226,11 @@ int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
result = 0;
|
||||
} else {
|
||||
// Title
|
||||
font = _state->_stCredits[sequence][credit].title_font;
|
||||
color = _state->_stCredits[sequence][credit].title_color;
|
||||
text = _state->_stCredits[sequence][credit].title;
|
||||
x_pos = _state->_stCredits[sequence][credit].title_x;
|
||||
y_posit = _state->_stCredits[sequence][credit].title_y;
|
||||
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);
|
||||
@ -253,7 +244,7 @@ int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
else
|
||||
y_posit = VGACheck(y_posit);
|
||||
|
||||
if (_state->_stCredits[sequence][credit].title_outline) {
|
||||
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());
|
||||
@ -265,11 +256,11 @@ int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
}
|
||||
|
||||
// Credit
|
||||
font = _state->_stCredits[sequence][credit].font;
|
||||
color = _state->_stCredits[sequence][credit].color;
|
||||
text = _state->_stCredits[sequence][credit].credit;
|
||||
x_pos = _state->_stCredits[sequence][credit].x;
|
||||
y_posit = _state->_stCredits[sequence][credit].y;
|
||||
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);
|
||||
@ -284,7 +275,7 @@ int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
else
|
||||
y_posit = VGACheck(y_posit);
|
||||
|
||||
if (_state->_stCredits[sequence][credit].outline) {
|
||||
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());
|
||||
@ -312,7 +303,7 @@ int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
else
|
||||
x_pos = VGACheck(x_pos);
|
||||
|
||||
if (_state->_stCredits[sequence][credit].outline) {
|
||||
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());
|
||||
@ -321,7 +312,7 @@ int AGSCreditz::drawCredit(int sequence, int credit) {
|
||||
_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 = _state->_stCredits[sequence][credit].x;
|
||||
x_pos = _stCredits[sequence][credit].x;
|
||||
line++;
|
||||
}
|
||||
}
|
||||
@ -339,35 +330,35 @@ void AGSCreditz::doCredits() {
|
||||
int32 increment, dum;
|
||||
|
||||
current_line = 1;
|
||||
_state->_sequenceHeight = 0;
|
||||
_sequenceHeight = 0;
|
||||
|
||||
while (current_line < (int)_state->_credits[_state->_creditSequence].size()) {
|
||||
if (_state->_credits[_state->_creditSequence][current_line]._isSet) {
|
||||
if (_state->_credits[_state->_creditSequence][current_line]._image) {
|
||||
increment = _engine->GetSpriteHeight(_state->_credits[_state->_creditSequence][current_line]._fontSlot);
|
||||
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 ((_state->_yPos + _state->_sequenceHeight + increment) <= 0) {
|
||||
if (_state->_credits[_state->_creditSequence][current_line]._colorHeight >= 0)
|
||||
increment = VGACheck(_state->_credits[_state->_creditSequence][current_line]._colorHeight);
|
||||
if ((_yPos + _sequenceHeight + increment) <= 0) {
|
||||
if (_credits[_creditSequence][current_line]._colorHeight >= 0)
|
||||
increment = VGACheck(_credits[_creditSequence][current_line]._colorHeight);
|
||||
}
|
||||
} else {
|
||||
_engine->GetTextExtent(_state->_credits[_state->_creditSequence][current_line]._fontSlot,
|
||||
_state->_credits[_state->_creditSequence][current_line]._text.c_str(), &dum, &increment);
|
||||
_engine->GetTextExtent(_credits[_creditSequence][current_line]._fontSlot,
|
||||
_credits[_creditSequence][current_line]._text.c_str(), &dum, &increment);
|
||||
}
|
||||
|
||||
if ((_state->_yPos + _state->_sequenceHeight + increment) > 0)
|
||||
increment = drawCredit(_state->_creditSequence, current_line);
|
||||
if ((_yPos + _sequenceHeight + increment) > 0)
|
||||
increment = drawCredit(_creditSequence, current_line);
|
||||
|
||||
} else {
|
||||
increment = VGACheck(_state->_emptyLineHeight);
|
||||
increment = VGACheck(_emptyLineHeight);
|
||||
}
|
||||
|
||||
_state->_sequenceHeight += increment;
|
||||
_sequenceHeight += increment;
|
||||
current_line++;
|
||||
}
|
||||
|
||||
if (!_state->_paused)
|
||||
speeder(_state->_creditSequence);
|
||||
if (!_paused)
|
||||
speeder(_creditSequence);
|
||||
}
|
||||
|
||||
int AGSCreditz::countLines(const Common::String &text) {
|
||||
@ -424,22 +415,22 @@ void AGSCreditz::specialEffect(int sequence, int credit, const Common::String &t
|
||||
|
||||
_engine->GetTextExtent(font, creditt[2].c_str(), &rightside_width, &dum);
|
||||
|
||||
if (_state->_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(x_pos - 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos + 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos, _state->_yPos + _state->_sequenceHeight - 1, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos, _state->_yPos + _state->_sequenceHeight + 1, font, color, creditt[0].c_str());
|
||||
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, _state->_yPos + _state->_sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
|
||||
if (_state->_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width) - 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width) + 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width), _state->_yPos + _state->_sequenceHeight - 1, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width), _state->_yPos + _state->_sequenceHeight + 1, font, color, creditt[2].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), _state->_yPos + _state->_sequenceHeight, 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;
|
||||
@ -452,22 +443,22 @@ void AGSCreditz::specialEffect(int sequence, int credit, const Common::String &t
|
||||
_engine->GetTextExtent(font, creditt[2].c_str(), &rightside_width, &dum);
|
||||
_engine->GetTextExtent(font, creditt[0].c_str(), &leftside_width, &dum);
|
||||
|
||||
if (_state->_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(x_pos - 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos + 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos, _state->_yPos + _state->_sequenceHeight - 1, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos, _state->_yPos + _state->_sequenceHeight + 1, font, color, creditt[0].c_str());
|
||||
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, _state->_yPos + _state->_sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(x_pos, _yPos + _sequenceHeight, font, color, creditt[0].c_str());
|
||||
|
||||
if (_state->_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width) - 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width) + 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width), _state->_yPos + _state->_sequenceHeight - 1, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width - (x_pos + rightside_width), _state->_yPos + _state->_sequenceHeight + 1, font, color, creditt[2].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), _state->_yPos + _state->_sequenceHeight, 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);
|
||||
@ -479,13 +470,13 @@ void AGSCreditz::specialEffect(int sequence, int credit, const Common::String &t
|
||||
dotpos++;
|
||||
}
|
||||
|
||||
if (_state->_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(x_pos + leftside_width - 1, _state->_yPos + _state->_sequenceHeight, font, color, dots.c_str());
|
||||
_engine->DrawText(x_pos + leftside_width + 1, _state->_yPos + _state->_sequenceHeight, font, color, dots.c_str());
|
||||
_engine->DrawText(x_pos + leftside_width, _state->_yPos + _state->_sequenceHeight - 1, font, color, dots.c_str());
|
||||
_engine->DrawText(x_pos + leftside_width, _state->_yPos + _state->_sequenceHeight + 1, font, color, dots.c_str());
|
||||
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, _state->_yPos + _state->_sequenceHeight, 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;
|
||||
@ -498,21 +489,21 @@ void AGSCreditz::specialEffect(int sequence, int credit, const Common::String &t
|
||||
_engine->GetTextExtent(font, creditt[2].c_str(), &rightside_width, &dum);
|
||||
_engine->GetTextExtent(font, creditt[0].c_str(), &leftside_width, &dum);
|
||||
|
||||
if (_state->_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(scrn_width / 2 - x_pos / 2 - leftside_width - 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(scrn_width / 2 - x_pos / 2 - leftside_width + 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(scrn_width / 2 - x_pos / 2 - leftside_width, _state->_yPos + _state->_sequenceHeight - 1, font, color, creditt[0].c_str());
|
||||
_engine->DrawText(scrn_width / 2 - x_pos / 2 - leftside_width, _state->_yPos + _state->_sequenceHeight + 1, font, color, creditt[0].c_str());
|
||||
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, _state->_yPos + _state->_sequenceHeight, 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 (_state->_credits[sequence][credit]._outline) {
|
||||
_engine->DrawText(scrn_width / 2 + x_pos / 2 - 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width / 2 + x_pos / 2 + 1, _state->_yPos + _state->_sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width / 2 + x_pos / 2, _state->_yPos + _state->_sequenceHeight - 1, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width / 2 + x_pos / 2, _state->_yPos + _state->_sequenceHeight + 1, font, color, creditt[2].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, _state->_yPos + _state->_sequenceHeight, font, color, creditt[2].c_str());
|
||||
_engine->DrawText(scrn_width / 2 + x_pos / 2, _yPos + _sequenceHeight, font, color, creditt[2].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -524,26 +515,26 @@ void AGSCreditz::drawStEffects(int sequence, int id, int style) {
|
||||
int font, color, set1, set2;
|
||||
int32 x_pos, y_posit, scrn_width, leveys, scrn_height, korkeus, coldepth;
|
||||
|
||||
teksti = _state->_stCredits[sequence][id].credit;
|
||||
font = _state->_stCredits[sequence][id].font;
|
||||
color = _state->_stCredits[sequence][id].color;
|
||||
x_pos = _state->_stCredits[sequence][id].x;
|
||||
y_posit = _state->_stCredits[sequence][id].y;
|
||||
set1 = _state->_singleStatic.settings1;
|
||||
set2 = _state->_singleStatic.settings2;
|
||||
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 && _state->_numChars < (int)teksti.size() && _state->_timer2 == 0) {
|
||||
if (set2 >= 0 && _numChars < (int)teksti.size() && _timer2 == 0) {
|
||||
(*_playSound)(set2);
|
||||
}
|
||||
|
||||
if (_state->_timer2 <= set1) {
|
||||
if (_timer2 <= set1) {
|
||||
thischar = 0;
|
||||
if (thischar <= _state->_numChars && _state->_numChars <= (int)teksti.size()) {
|
||||
for (thischar = 0; thischar < _state->_numChars; ++thischar)
|
||||
if (thischar <= _numChars && _numChars <= (int)teksti.size()) {
|
||||
for (thischar = 0; thischar < _numChars; ++thischar)
|
||||
teksti2 = teksti2 + teksti[thischar];
|
||||
text = teksti2;
|
||||
} else {
|
||||
@ -560,26 +551,26 @@ void AGSCreditz::drawStEffects(int sequence, int id, int style) {
|
||||
y_posit = VGACheck(y_posit);
|
||||
|
||||
_engine->DrawText(x_pos, y_posit, font, color, text.c_str());
|
||||
_state->_timer2++;
|
||||
x_pos = _state->_stCredits[sequence][id].x;
|
||||
y_posit = _state->_stCredits[sequence][id].y;
|
||||
_timer2++;
|
||||
x_pos = _stCredits[sequence][id].x;
|
||||
y_posit = _stCredits[sequence][id].y;
|
||||
} else {
|
||||
_state->_numChars++;
|
||||
_numChars++;
|
||||
thischar = 0;
|
||||
_state->_timer2 = 0;
|
||||
_timer2 = 0;
|
||||
drawStEffects(sequence, id, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz::speeder(int sequence) {
|
||||
int speed = _state->_seqSettings[sequence].speed;
|
||||
int speed = _seqSettings[sequence].speed;
|
||||
|
||||
if (_state->_speedPoint == speed) {
|
||||
_state->_yPos -= VGACheck(1);
|
||||
_state->_speedPoint = 0;
|
||||
if (_speedPoint == speed) {
|
||||
_yPos -= VGACheck(1);
|
||||
_speedPoint = 0;
|
||||
} else {
|
||||
_state->_speedPoint++;
|
||||
_speedPoint++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -588,28 +579,28 @@ void AGSCreditz::calculateSequenceHeight(int sequence) {
|
||||
int32 height, creditHeight, dum;
|
||||
height = 0;
|
||||
|
||||
for (uint currentCredit = 0; currentCredit < _state->_credits[sequence].size();
|
||||
for (uint currentCredit = 0; currentCredit < _credits[sequence].size();
|
||||
++currentCredit) {
|
||||
|
||||
if (_state->_credits[sequence][currentCredit]._isSet) {
|
||||
if (_state->_credits[sequence][currentCredit]._image) {
|
||||
if (_state->_credits[sequence][currentCredit]._colorHeight < 0)
|
||||
creditHeight = _engine->GetSpriteHeight(_state->_credits[sequence][currentCredit]._fontSlot);
|
||||
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 = _state->_credits[sequence][currentCredit]._colorHeight;
|
||||
creditHeight = _credits[sequence][currentCredit]._colorHeight;
|
||||
} else {
|
||||
_engine->GetTextExtent(_state->_credits[sequence][currentCredit]._fontSlot,
|
||||
_state->_credits[sequence][currentCredit]._text.c_str(),
|
||||
_engine->GetTextExtent(_credits[sequence][currentCredit]._fontSlot,
|
||||
_credits[sequence][currentCredit]._text.c_str(),
|
||||
&dum, &creditHeight);
|
||||
}
|
||||
|
||||
height += creditHeight;
|
||||
} else {
|
||||
height += VGACheck(_state->_emptyLineHeight);
|
||||
height += VGACheck(_emptyLineHeight);
|
||||
}
|
||||
}
|
||||
|
||||
_state->_calculatedSequenceHeight = height;
|
||||
_calculatedSequenceHeight = height;
|
||||
}
|
||||
|
||||
int AGSCreditz::VGACheck(int value) {
|
||||
@ -623,29 +614,29 @@ int AGSCreditz::VGACheck(int value) {
|
||||
}
|
||||
|
||||
void AGSCreditz::startSequence(int sequence) {
|
||||
if (!_state->_creditsRunning) {
|
||||
_state->_seqSettings[sequence].finished = false;
|
||||
_state->_creditsRunning = true;
|
||||
_state->_creditSequence = sequence;
|
||||
if (!_creditsRunning) {
|
||||
_seqSettings[sequence].finished = false;
|
||||
_creditsRunning = true;
|
||||
_creditSequence = sequence;
|
||||
|
||||
_engine->GetScreenDimensions(&_state->_screenWidth, &_state->_screenHeight,
|
||||
&_state->_screenColorDepth);
|
||||
_engine->GetScreenDimensions(&_screenWidth, &_screenHeight,
|
||||
&_screenColorDepth);
|
||||
|
||||
if (_state->_seqSettings[sequence].automatic) {
|
||||
if (_seqSettings[sequence].automatic) {
|
||||
calculateSequenceHeight(sequence);
|
||||
_state->_yPos = _state->_screenHeight + 1;
|
||||
_yPos = _screenHeight + 1;
|
||||
} else {
|
||||
_state->_yPos = _state->_seqSettings[sequence].startpoint;
|
||||
_yPos = _seqSettings[sequence].startpoint;
|
||||
}
|
||||
|
||||
_state->_speedPoint = 0;
|
||||
_state->_timer = 0;
|
||||
_speedPoint = 0;
|
||||
_timer = 0;
|
||||
draw();
|
||||
} else {
|
||||
_state->_paused = false;
|
||||
_state->_creditsRunning = false;
|
||||
_state->_creditSequence = -1;
|
||||
_state->_seqSettings[sequence].finished = true;
|
||||
_paused = false;
|
||||
_creditsRunning = false;
|
||||
_creditSequence = -1;
|
||||
_seqSettings[sequence].finished = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,26 +94,6 @@ struct SingleStatic {
|
||||
typedef Common::Array<Credit> CreditArray;
|
||||
typedef Common::Array<StCredit> StCreditArray;
|
||||
|
||||
struct State {
|
||||
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;
|
||||
};
|
||||
|
||||
class AGSCreditz : public PluginBase, public Drawing {
|
||||
private:
|
||||
int drawCredit(int sequence, int credit);
|
||||
@ -131,8 +111,24 @@ protected:
|
||||
};
|
||||
|
||||
Version _version;
|
||||
State *_state;
|
||||
IntFunction _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);
|
||||
@ -140,8 +136,8 @@ protected:
|
||||
void startSequence(int sequence);
|
||||
|
||||
public:
|
||||
AGSCreditz();
|
||||
virtual ~AGSCreditz();
|
||||
AGSCreditz() : PluginBase(), Drawing() {}
|
||||
virtual ~AGSCreditz() {}
|
||||
};
|
||||
|
||||
} // namespace AGSCreditz
|
||||
|
@ -40,8 +40,8 @@ const char *AGSCreditz1::AGS_GetPluginName() {
|
||||
void AGSCreditz1::AGS_EngineStartup(IAGSEngine *engine) {
|
||||
PluginBase::AGS_EngineStartup(engine);
|
||||
engine->RequestEventHook(AGSE_POSTSCREENDRAW);
|
||||
_engine->GetScreenDimensions(&_state->_screenWidth,
|
||||
&_state->_screenHeight, &_state->_screenColorDepth);
|
||||
_engine->GetScreenDimensions(&_screenWidth,
|
||||
&_screenHeight, &_screenColorDepth);
|
||||
|
||||
SCRIPT_METHOD(SetCredit, AGSCreditz1::SetCredit);
|
||||
SCRIPT_METHOD(ScrollCredits, AGSCreditz1::ScrollCredits);
|
||||
@ -77,16 +77,16 @@ int64 AGSCreditz1::AGS_EngineOnEvent(int event, NumberPtr data) {
|
||||
void AGSCreditz1::SetCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS7(int, ID, string, credit, int, colour, int, font, bool, center, int, xpos, int, generateoutline);
|
||||
|
||||
if (ID >= (int)_state->_credits[0].size())
|
||||
_state->_credits[0].resize(ID + 1);
|
||||
if (ID >= (int)_credits[0].size())
|
||||
_credits[0].resize(ID + 1);
|
||||
|
||||
if (center) {
|
||||
int32 creditW, creditH;
|
||||
_engine->GetTextExtent(font, credit, &creditW, &creditH);
|
||||
xpos = (_state->_screenWidth - creditW) / 2;
|
||||
xpos = (_screenWidth - creditW) / 2;
|
||||
}
|
||||
|
||||
Credit &c = _state->_credits[0][ID];
|
||||
Credit &c = _credits[0][ID];
|
||||
c._text = credit;
|
||||
c._fontSlot = font;
|
||||
c._x = xpos;
|
||||
@ -98,22 +98,22 @@ void AGSCreditz1::SetCredit(ScriptMethodParams ¶ms) {
|
||||
void AGSCreditz1::SetCreditImage(ScriptMethodParams ¶ms) {
|
||||
PARAMS5(int, ID, int, slot, bool, center, int, xpos, int, pixtonext);
|
||||
|
||||
if (ID >= (int)_state->_credits[0].size())
|
||||
_state->_credits[0].resize(ID + 1);
|
||||
if (ID >= (int)_credits[0].size())
|
||||
_credits[0].resize(ID + 1);
|
||||
|
||||
BITMAP *gfx = _engine->GetSpriteGraphic(slot);
|
||||
if (center)
|
||||
xpos = (_state->_screenWidth - gfx->w) / 2;
|
||||
xpos = (_screenWidth - gfx->w) / 2;
|
||||
|
||||
_state->_credits[0][ID]._image = true;
|
||||
_state->_credits[0][ID]._isSet = true;
|
||||
_state->_credits[0][ID]._x = xpos;
|
||||
_state->_credits[0][ID]._fontSlot = slot;
|
||||
_credits[0][ID]._image = true;
|
||||
_credits[0][ID]._isSet = true;
|
||||
_credits[0][ID]._x = xpos;
|
||||
_credits[0][ID]._fontSlot = slot;
|
||||
|
||||
if (pixtonext != -1) {
|
||||
_state->_credits[0][ID]._colorHeight = pixtonext;
|
||||
_credits[0][ID]._colorHeight = pixtonext;
|
||||
} else {
|
||||
_state->_credits[0][ID]._colorHeight = gfx->h;
|
||||
_credits[0][ID]._colorHeight = gfx->h;
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,22 +121,22 @@ void AGSCreditz1::ScrollCredits(ScriptMethodParams ¶ms) {
|
||||
PARAMS7(int, onoff, int, speed, int, fromY, int, toY, int, isautom, int, wait, int, resolution);
|
||||
|
||||
if (onoff == 1) {
|
||||
_state->_seqSettings[0].speed = speed;
|
||||
_state->_seqSettings[0].endwait = wait;
|
||||
_state->_seqSettings[0].startpoint = fromY;
|
||||
_state->_seqSettings[0].endpoint = toY;
|
||||
_state->_seqSettings[0].automatic = isautom;
|
||||
_seqSettings[0].speed = speed;
|
||||
_seqSettings[0].endwait = wait;
|
||||
_seqSettings[0].startpoint = fromY;
|
||||
_seqSettings[0].endpoint = toY;
|
||||
_seqSettings[0].automatic = isautom;
|
||||
|
||||
if (_state->_screenWidth == 320) {
|
||||
_state->_resolutionFlag = (resolution != 2) ? 1 : 0;
|
||||
} else if (_state->_screenWidth == 640) {
|
||||
_state->_resolutionFlag = (resolution != 1) ? 1 : 0;
|
||||
if (_screenWidth == 320) {
|
||||
_resolutionFlag = (resolution != 2) ? 1 : 0;
|
||||
} else if (_screenWidth == 640) {
|
||||
_resolutionFlag = (resolution != 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
startSequence(0);
|
||||
|
||||
} else if (onoff == 0) {
|
||||
_state->_creditsRunning = false;
|
||||
_creditsRunning = false;
|
||||
|
||||
} else {
|
||||
_engine->AbortGame("ScrollCredits: OnOff value must be 1 or 0!");
|
||||
@ -146,47 +146,47 @@ void AGSCreditz1::ScrollCredits(ScriptMethodParams ¶ms) {
|
||||
void AGSCreditz1::GetCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, ID);
|
||||
|
||||
params._result = (_state->_credits[0][ID]._text == IMAGE_TEXT) ?
|
||||
"image" : _state->_credits[0][ID]._text.c_str();
|
||||
params._result = (_credits[0][ID]._text == IMAGE_TEXT) ?
|
||||
"image" : _credits[0][ID]._text.c_str();
|
||||
}
|
||||
|
||||
void AGSCreditz1::IsCreditScrollingFinished(ScriptMethodParams ¶ms) {
|
||||
params._result = _state->_seqSettings[0].finished;
|
||||
params._result = _seqSettings[0].finished;
|
||||
}
|
||||
|
||||
void AGSCreditz1::PauseScroll(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(bool, onoff);
|
||||
_state->_paused = onoff;
|
||||
_paused = onoff;
|
||||
}
|
||||
|
||||
void AGSCreditz1::ScrollReset(ScriptMethodParams ¶ms) {
|
||||
_state->_credits[0].clear();
|
||||
_state->_creditsRunning = false;
|
||||
_credits[0].clear();
|
||||
_creditsRunning = false;
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetEmptyLineHeight(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, emptylineheight);
|
||||
_state->_emptyLineHeight = emptylineheight;
|
||||
_emptyLineHeight = emptylineheight;
|
||||
}
|
||||
|
||||
void AGSCreditz1::GetEmptyLineHeight(ScriptMethodParams ¶ms) {
|
||||
params._result = _state->_emptyLineHeight;
|
||||
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)_state->_credits[0].size())
|
||||
_state->_credits[0].resize(ID + 1);
|
||||
if (ID >= (int)_credits[0].size())
|
||||
_credits[0].resize(ID + 1);
|
||||
|
||||
if (center) {
|
||||
int32 creditW, creditH;
|
||||
_engine->GetTextExtent(font, credit, &creditW, &creditH);
|
||||
x = (_state->_screenWidth - creditW) / 2;
|
||||
x = (_screenWidth - creditW) / 2;
|
||||
}
|
||||
|
||||
StCredit &c = _state->_stCredits[0][ID];
|
||||
StCredit &c = _stCredits[0][ID];
|
||||
c.credit = credit;
|
||||
c.font = font;
|
||||
c.color = creditcolour;
|
||||
@ -197,7 +197,7 @@ void AGSCreditz1::SetStaticCredit(ScriptMethodParams ¶ms) {
|
||||
|
||||
void AGSCreditz1::GetStaticCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, ID);
|
||||
StCredit &c = _state->_stCredits[0][ID];
|
||||
StCredit &c = _stCredits[0][ID];
|
||||
params._result = c.credit.c_str();
|
||||
}
|
||||
|
||||
@ -205,40 +205,40 @@ void AGSCreditz1::StartEndStaticCredits(ScriptMethodParams ¶ms) {
|
||||
PARAMS2(bool, onoff, int, res);
|
||||
|
||||
if (!onoff) {
|
||||
_state->_staticCredits = false;
|
||||
_staticCredits = false;
|
||||
|
||||
} else if (res != 1 && res != 2) {
|
||||
_engine->AbortGame("StartEndStaticCredits: Wrong resolution");
|
||||
|
||||
} else {
|
||||
_state->_currentStatic = 0;
|
||||
_engine->GetScreenDimensions(&_state->_screenWidth,
|
||||
&_state->_screenHeight, &_state->_screenColorDepth);
|
||||
_currentStatic = 0;
|
||||
_engine->GetScreenDimensions(&_screenWidth,
|
||||
&_screenHeight, &_screenColorDepth);
|
||||
|
||||
_state->_staticScreenWidth = (res == 1) ? 320 : 640;
|
||||
_state->_staticWidthMatches = _state->_screenWidth == _state->_staticScreenWidth;
|
||||
_staticScreenWidth = (res == 1) ? 320 : 640;
|
||||
_staticWidthMatches = _screenWidth == _staticScreenWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz1::GetCurrentStaticCredit(ScriptMethodParams ¶ms) {
|
||||
params._result = _state->_currentStatic;
|
||||
params._result = _currentStatic;
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetDefaultStaticDelay(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, Cyclesperchar);
|
||||
_state->_stSeqSettings[0].speed = Cyclesperchar;
|
||||
_stSeqSettings[0].speed = Cyclesperchar;
|
||||
}
|
||||
|
||||
void AGSCreditz1::SetStaticPause(ScriptMethodParams ¶ms) {
|
||||
PARAMS2(int, ID, int, length);
|
||||
_state->_stCredits[0][ID].pause = 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 = _state->_stCredits[0][ID];
|
||||
StCredit &c = _stCredits[0][ID];
|
||||
c.title_x = x;
|
||||
c.title_y = y;
|
||||
c.title_font = titlefont;
|
||||
@ -251,9 +251,9 @@ void AGSCreditz1::SetStaticCreditTitle(ScriptMethodParams ¶ms) {
|
||||
void AGSCreditz1::ShowStaticCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS6(int, ID, int, time, int, style, int, transtime, \
|
||||
int, sound, int, res);
|
||||
const StCredit &c = _state->_stCredits[0][ID];
|
||||
const StCredit &c = _stCredits[0][ID];
|
||||
|
||||
if (!_state->_staticCredits) {
|
||||
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")) {
|
||||
@ -262,12 +262,12 @@ void AGSCreditz1::ShowStaticCredit(ScriptMethodParams ¶ms) {
|
||||
warning("TODO: Use %d %d %d", transtime, time, sound);
|
||||
}
|
||||
|
||||
_engine->GetScreenDimensions(&_state->_screenWidth,
|
||||
&_state->_screenHeight, &_state->_screenColorDepth);
|
||||
_engine->GetScreenDimensions(&_screenWidth,
|
||||
&_screenHeight, &_screenColorDepth);
|
||||
|
||||
_state->_staticScreenWidth = (res == 1) ? 320 : 640;
|
||||
_state->_staticWidthMatches = _state->_screenWidth == _state->_staticScreenWidth;
|
||||
_state->_currentStatic = ID;
|
||||
_staticScreenWidth = (res == 1) ? 320 : 640;
|
||||
_staticWidthMatches = _screenWidth == _staticScreenWidth;
|
||||
_currentStatic = ID;
|
||||
|
||||
// TODO: Final setup
|
||||
}
|
||||
@ -277,13 +277,13 @@ void AGSCreditz1::ShowStaticCredit(ScriptMethodParams ¶ms) {
|
||||
}
|
||||
|
||||
void AGSCreditz1::StaticReset(ScriptMethodParams ¶ms) {
|
||||
_state->_stCredits[0].clear();
|
||||
_stCredits[0].clear();
|
||||
}
|
||||
|
||||
void AGSCreditz1::GetStaticCreditTitle(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, ID);
|
||||
|
||||
const StCredit &c = _state->_stCredits[0][ID];
|
||||
const StCredit &c = _stCredits[0][ID];
|
||||
params._result = c.title.c_str();
|
||||
}
|
||||
|
||||
@ -294,10 +294,10 @@ void AGSCreditz1::SetStaticCreditImage(ScriptMethodParams ¶ms) {
|
||||
if (Hcentered) {
|
||||
BITMAP *gfx = _engine->GetSpriteGraphic(slot);
|
||||
if (Hcentered)
|
||||
x = (_state->_screenWidth - gfx->w) / 2;
|
||||
x = (_screenWidth - gfx->w) / 2;
|
||||
}
|
||||
|
||||
StCredit &c = _state->_stCredits[0][ID];
|
||||
StCredit &c = _stCredits[0][ID];
|
||||
c.credit = "I=M=A=G=E";
|
||||
c.x = x;
|
||||
c.y = y;
|
||||
@ -308,7 +308,7 @@ void AGSCreditz1::SetStaticCreditImage(ScriptMethodParams ¶ms) {
|
||||
}
|
||||
|
||||
void AGSCreditz1::IsStaticCreditsFinished(ScriptMethodParams ¶ms) {
|
||||
params._result = _state->_stSeqSettings[0].finished;
|
||||
params._result = _stSeqSettings[0].finished;
|
||||
}
|
||||
|
||||
} // namespace AGSCreditz
|
||||
|
@ -76,10 +76,10 @@ 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)_state->_credits[sequence].size())
|
||||
_state->_credits[sequence].resize(line + 1);
|
||||
if (line >= (int)_credits[sequence].size())
|
||||
_credits[sequence].resize(line + 1);
|
||||
|
||||
Credit &c = _state->_credits[sequence][line];
|
||||
Credit &c = _credits[sequence][line];
|
||||
c._text = credit;
|
||||
c._fontSlot = font;
|
||||
c._colorHeight = color;
|
||||
@ -92,31 +92,31 @@ void AGSCreditz2::SetCredit(ScriptMethodParams ¶ms) {
|
||||
void AGSCreditz2::GetCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS2(int, sequence, int, ID);
|
||||
|
||||
params._result = _state->_credits[sequence][ID]._text.c_str();
|
||||
params._result = _credits[sequence][ID]._text.c_str();
|
||||
}
|
||||
|
||||
void AGSCreditz2::CreditsSettings(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, emptylineheight);
|
||||
|
||||
if (emptylineheight >= 0)
|
||||
_state->_emptyLineHeight = emptylineheight;
|
||||
_emptyLineHeight = emptylineheight;
|
||||
}
|
||||
|
||||
void AGSCreditz2::SequenceSettings(ScriptMethodParams ¶ms) {
|
||||
PARAMS6(int, sequence, int, startpoint, int, endPoint, int, speed, int, automatic, int, endwait);
|
||||
|
||||
_state->_seqSettings[sequence].startpoint = startpoint;
|
||||
_state->_seqSettings[sequence].endpoint = endPoint;
|
||||
_state->_seqSettings[sequence].speed = speed;
|
||||
_state->_seqSettings[sequence].automatic = automatic;
|
||||
_state->_seqSettings[sequence].endwait = 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 (_state->_seqSettings[sequence].finished) {
|
||||
_state->_seqSettings[sequence].finished = false;
|
||||
if (_seqSettings[sequence].finished) {
|
||||
_seqSettings[sequence].finished = false;
|
||||
params._result = 1;
|
||||
} else {
|
||||
params._result = 0;
|
||||
@ -124,8 +124,8 @@ void AGSCreditz2::IsSequenceFinished(ScriptMethodParams ¶ms) {
|
||||
}
|
||||
|
||||
void AGSCreditz2::PauseScrolling(ScriptMethodParams ¶ms) {
|
||||
if (_state->_creditsRunning) {
|
||||
_state->_paused = !_state->_paused;
|
||||
if (_creditsRunning) {
|
||||
_paused = !_paused;
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,14 +133,14 @@ void AGSCreditz2::SetCreditImage(ScriptMethodParams ¶ms) {
|
||||
PARAMS5(int, sequence, int, line, int, xPos, int, slot, int, height);
|
||||
|
||||
assert(sequence >= 0 && sequence <= 10);
|
||||
if (line >= (int)_state->_credits[sequence].size())
|
||||
_state->_credits[sequence].resize(line + 1);
|
||||
if (line >= (int)_credits[sequence].size())
|
||||
_credits[sequence].resize(line + 1);
|
||||
|
||||
_state->_credits[sequence][line]._image = true;
|
||||
_state->_credits[sequence][line]._isSet = true;
|
||||
_state->_credits[sequence][line]._x = xPos;
|
||||
_state->_credits[sequence][line]._fontSlot = slot;
|
||||
_state->_credits[sequence][line]._colorHeight = height;
|
||||
_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) {
|
||||
@ -149,10 +149,10 @@ void AGSCreditz2::ResetSequence(ScriptMethodParams ¶ms) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
if (seqtype != 2)
|
||||
// Scrolling
|
||||
_state->_credits[i].clear();
|
||||
_credits[i].clear();
|
||||
else
|
||||
// Static
|
||||
_state->_stCredits[i].clear();
|
||||
_stCredits[i].clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,17 +161,17 @@ void AGSCreditz2::SetStaticCredit(ScriptMethodParams ¶ms) {
|
||||
int, font, int, color, int, genOutline);
|
||||
|
||||
assert(sequence >= 0 && sequence <= 10);
|
||||
if (id >= (int)_state->_stCredits[sequence].size())
|
||||
_state->_stCredits[sequence].resize(id + 1);
|
||||
if (id >= (int)_stCredits[sequence].size())
|
||||
_stCredits[sequence].resize(id + 1);
|
||||
|
||||
_state->_stCredits[sequence][id].credit = credit;
|
||||
_state->_stCredits[sequence][id].x = xPos;
|
||||
_state->_stCredits[sequence][id].y = yPos;
|
||||
_state->_stCredits[sequence][id].font = font;
|
||||
_state->_stCredits[sequence][id].color = color;
|
||||
_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)
|
||||
_state->_stCredits[sequence][id].outline = true;
|
||||
_stCredits[sequence][id].outline = true;
|
||||
}
|
||||
|
||||
void AGSCreditz2::SetStaticCreditTitle(ScriptMethodParams ¶ms) {
|
||||
@ -179,57 +179,57 @@ void AGSCreditz2::SetStaticCreditTitle(ScriptMethodParams ¶ms) {
|
||||
int, font, int, color, int, genOutline);
|
||||
|
||||
assert(sequence >= 0 && sequence < 10);
|
||||
if (id >= (int)_state->_stCredits[sequence].size())
|
||||
_state->_stCredits[sequence].resize(id + 1);
|
||||
if (id >= (int)_stCredits[sequence].size())
|
||||
_stCredits[sequence].resize(id + 1);
|
||||
|
||||
_state->_stCredits[sequence][id].title = title;
|
||||
_state->_stCredits[sequence][id].title_x = xPos;
|
||||
_state->_stCredits[sequence][id].title_y = yPos;
|
||||
_state->_stCredits[sequence][id].title_font = font;
|
||||
_state->_stCredits[sequence][id].title_color = color;
|
||||
_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)
|
||||
_state->_stCredits[sequence][id].title_outline = true;
|
||||
_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)_state->_stCredits[sequence].size())
|
||||
_state->_stCredits[sequence].resize(id + 1);
|
||||
if (id >= (int)_stCredits[sequence].size())
|
||||
_stCredits[sequence].resize(id + 1);
|
||||
|
||||
_state->_stCredits[sequence][id].pause = length;
|
||||
_stCredits[sequence][id].pause = length;
|
||||
}
|
||||
|
||||
void AGSCreditz2::RunStaticCreditSequence(ScriptMethodParams ¶ms) {
|
||||
PARAMS2(int, sequence, int, speed);
|
||||
|
||||
if (!_state->_creditsRunning) {
|
||||
_state->_stSeqSettings[sequence].finished = false;
|
||||
_state->_stSeqSettings[sequence].speed = speed;
|
||||
_state->_creditSequence = sequence;
|
||||
_state->_staticCredits = true;
|
||||
_state->_creditsRunning = true;
|
||||
_state->_currentStatic = 1;
|
||||
_state->_timer = 0;
|
||||
if (!_creditsRunning) {
|
||||
_stSeqSettings[sequence].finished = false;
|
||||
_stSeqSettings[sequence].speed = speed;
|
||||
_creditSequence = sequence;
|
||||
_staticCredits = true;
|
||||
_creditsRunning = true;
|
||||
_currentStatic = 1;
|
||||
_timer = 0;
|
||||
draw();
|
||||
|
||||
} else {
|
||||
_state->_staticCredits = false;
|
||||
_state->_creditSequence = -1;
|
||||
_state->_stSeqSettings[sequence].finished = false;
|
||||
_state->_creditsRunning = false;
|
||||
_state->_currentStatic = 0;
|
||||
_state->_timer = 0;
|
||||
_staticCredits = false;
|
||||
_creditSequence = -1;
|
||||
_stSeqSettings[sequence].finished = false;
|
||||
_creditsRunning = false;
|
||||
_currentStatic = 0;
|
||||
_timer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void AGSCreditz2::IsStaticSequenceFinished(ScriptMethodParams ¶ms) {
|
||||
PARAMS1(int, sequence);
|
||||
|
||||
int result = (_state->_stSeqSettings[sequence].finished) ? 1 : 0;
|
||||
_state->_stSeqSettings[sequence].finished = false;
|
||||
int result = (_stSeqSettings[sequence].finished) ? 1 : 0;
|
||||
_stSeqSettings[sequence].finished = false;
|
||||
|
||||
params._result = result;
|
||||
}
|
||||
@ -238,19 +238,19 @@ void AGSCreditz2::ShowStaticCredit(ScriptMethodParams ¶ms) {
|
||||
PARAMS6(int, sequence, int, id, int, time, int, style,
|
||||
int, styleSettings1, int, styleSettings2);
|
||||
|
||||
_state->_creditSequence = sequence;
|
||||
_state->_creditsRunning = true;
|
||||
_state->_staticCredits = true;
|
||||
_state->_singleStatic.id = id;
|
||||
_state->_singleStatic.time = time;
|
||||
_state->_singleStatic.style = style;
|
||||
_state->_singleStatic.settings1 = styleSettings1;
|
||||
_state->_singleStatic.settings2 = styleSettings2;
|
||||
_state->_singleStatic.bool_ = true;
|
||||
_state->_stSeqSettings[sequence].finished = false;
|
||||
_state->_timer = 0;
|
||||
_state->_timer2 = 0;
|
||||
_state->_numChars = 0;
|
||||
_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();
|
||||
}
|
||||
|
||||
@ -258,20 +258,20 @@ 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)_state->_stCredits[sequence].size())
|
||||
_state->_stCredits[sequence].resize(id + 1);
|
||||
if (id >= (int)_stCredits[sequence].size())
|
||||
_stCredits[sequence].resize(id + 1);
|
||||
|
||||
_state->_stCredits[sequence][id].image = true;
|
||||
_state->_stCredits[sequence][id].image_slot = slot;
|
||||
_state->_stCredits[sequence][id].x = xPos;
|
||||
_state->_stCredits[sequence][id].y = yPos;
|
||||
_state->_stCredits[sequence][id].image_time = length;
|
||||
_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 (_state->_creditsRunning && _state->_staticCredits)
|
||||
result = _state->_currentStatic;
|
||||
if (_creditsRunning && _staticCredits)
|
||||
result = _currentStatic;
|
||||
|
||||
params._result = result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user