- Fixed timers, LGOP2 intro should now play correctly

- Some cleanup in LGOP2 opcodes

svn-id: r32051
This commit is contained in:
Benjamin Haisch 2008-05-12 09:49:10 +00:00
parent 27b9887a30
commit 9e39e7d7a2
2 changed files with 17 additions and 8 deletions

View File

@ -134,21 +134,26 @@ int MadeEngine::init() {
}
int16 MadeEngine::getTimer(int16 timerNum) {
return (_system->getMillis() - _timers[timerNum]) / 60;
if (timerNum > 0 && timerNum <= ARRAYSIZE(_timers) && _timers[timerNum - 1] != -1)
return (_system->getMillis() - _timers[timerNum - 1]) / 60;
else
return 32000;
}
void MadeEngine::setTimer(int16 timerNum, int16 value) {
_timers[timerNum] = value * 60;
if (timerNum > 0 && timerNum <= ARRAYSIZE(_timers))
_timers[timerNum - 1] = value * 60;
}
void MadeEngine::resetTimer(int16 timerNum) {
_timers[timerNum] = _system->getMillis();
if (timerNum > 0 && timerNum <= ARRAYSIZE(_timers))
_timers[timerNum - 1] = _system->getMillis();
}
int16 MadeEngine::allocTimer() {
for (int i = 0; i < ARRAYSIZE(_timers); i++) {
if (_timers[i] == -1) {
resetTimer(i);
_timers[i] = _system->getMillis();
return i + 1;
}
}
@ -156,7 +161,8 @@ int16 MadeEngine::allocTimer() {
}
void MadeEngine::freeTimer(int16 timerNum) {
_timers[timerNum] = -1;
if (timerNum > 0 && timerNum <= ARRAYSIZE(_timers))
_timers[timerNum - 1] = -1;
}
Common::String MadeEngine::getSavegameFilename(int16 saveNum) {

View File

@ -129,6 +129,7 @@ int16 ScriptFunctionsLgop2::o1_CLS(int16 argc, int16 *argv) {
}
int16 ScriptFunctionsLgop2::o1_SHOWPAGE(int16 argc, int16 *argv) {
_vm->_mixer->stopHandle(_audioStreamHandle);
_vm->_screen->show();
return 0;
}
@ -322,7 +323,8 @@ int16 ScriptFunctionsLgop2::o1_FREEANIM(int16 argc, int16 *argv) {
}
int16 ScriptFunctionsLgop2::o1_DRAWSPRITE(int16 argc, int16 *argv) {
return _vm->_screen->drawSprite(argv[2], argv[1], argv[0]);
_vm->_screen->drawSprite(argv[2], argv[1], argv[0]);
return 0;
}
int16 ScriptFunctionsLgop2::o1_ERASESPRITES(int16 argc, int16 *argv) {
@ -350,8 +352,7 @@ int16 ScriptFunctionsLgop2::o1_RESETTIMER(int16 argc, int16 *argv) {
}
int16 ScriptFunctionsLgop2::o1_ALLOCTIMER(int16 argc, int16 *argv) {
int16 timerNum = _vm->allocTimer();
return timerNum;
return _vm->allocTimer();
}
int16 ScriptFunctionsLgop2::o1_FREETIMER(int16 argc, int16 *argv) {
@ -439,6 +440,8 @@ int16 ScriptFunctionsLgop2::o1_RESTEXT(int16 argc, int16 *argv) {
int16 ScriptFunctionsLgop2::o1_ADDMASK(int16 argc, int16 *argv) {
warning("Unimplemented opcode: o1_ADDMASK");
//PictureResource *flex = _vm->_res->getPicture(flexIndex);
//Graphics::Surface *sourceSurface = flex->getPicture();
return 0;
}