diff options
| -rw-r--r-- | gfx.cpp | 2 | ||||
| -rw-r--r-- | insane.cpp | 8 | ||||
| -rw-r--r-- | scumm.h | 17 | ||||
| -rw-r--r-- | scummvm.cpp | 10 | ||||
| -rw-r--r-- | sdl.cpp | 44 |
5 files changed, 56 insertions, 25 deletions
@@ -87,7 +87,7 @@ void Scumm::initVirtScreen(int slot, int top, int height, bool twobufs, bool fou size += 320*4; // createResource(rtBuffer, slot+1, size); - vs->screenPtr = _videoBuffer+320*top; + vs->screenPtr = _videoBuffer+328*top; if (twobufs) { createResource(rtBuffer, slot+5, size); diff --git a/insane.cpp b/insane.cpp index 6b45036084..3a89efbb07 100644 --- a/insane.cpp +++ b/insane.cpp @@ -109,7 +109,7 @@ bool SmushPlayer::parseTag() { void SmushPlayer::parseAHDR() { -// memcpy(_fluPalette, _block, 0x300); + memcpy(_fluPalette, _block, 0x300); _paletteChanged = true; printf("parse AHDR\n"); @@ -591,7 +591,7 @@ void SmushPlayer::startVideo(short int arg, byte* videoFile) if(_in==NULL) return; - if (fileReadBE32() != 'ANIM') + if (fileReadBE32() != 'ANIM') error("file is not an anim"); fileSize=fileReadBE32(); @@ -612,8 +612,8 @@ void SmushPlayer::startVideo(short int arg, byte* videoFile) blitToScreen(sm,sm->_videoBuffer, 0, 0, 320 ,200); updateScreen(sm); - waitForTimer(sm,20); - + sm->delta = sm->_system->waitTick(sm->delta); + if(sm->_keyPressed == sm->_vars[sm->VAR_CUTSCENEEXIT_KEY]) return; } while (1); @@ -24,6 +24,8 @@ #include <mad.h> #endif +#include "system.h" + #if defined(macintosh) && !defined(__APPLE__CW) #define Point SCUMM_Point #endif @@ -923,11 +925,20 @@ public: /* video buffer */ - byte _videoBuffer[320*200]; - byte _svideoBuffer[320*200+4*320]; + byte _videoBuffer[328*200]; // main video buffer + + /* system call object */ + + OSystem *_system; + + /* Scumm main loop */ + + void mainRun(); + int delta; // global time + void scummInit(); - void scummMain(int argc, char **argv); + void scummMain(int argc, char **argv); // is it still used ? int scummLoop(int delta); void initScummVars(); diff --git a/scummvm.cpp b/scummvm.cpp index 37aba0e60f..66f56c6235 100644 --- a/scummvm.cpp +++ b/scummvm.cpp @@ -1332,3 +1332,13 @@ void checkHeap() { #endif } +void Scumm::mainRun() { + + delta=0; + + do + { + _system->waitTick(delta); + delta = scummLoop(delta); + }while(1); +} @@ -35,6 +35,7 @@ static unsigned int scale; Scumm scumm; ScummDebugger debugger; Gui gui; +OSystem _system; SoundEngine sound; SOUND_DRIVER_TYPE snd_driv; @@ -922,25 +923,17 @@ int main(int argc, char* argv[]) { scumm._gui = &gui; gui.init(&scumm); sound.initialize(&scumm, &snd_driv); - scumm.scummMain(argc, argv); + + scumm.delta=0; + scumm._system = &_system; + + scumm.scummMain(argc, argv); // Todo: need to change that as well + gui.init(&scumm); /* Reinit GUI after loading a game */ - last_time = SDL_GetTicks(); - delta = 0; - do { - updateScreen(&scumm); - - new_time = SDL_GetTicks(); - waitForTimer(&scumm, delta * 15 + last_time - new_time); - last_time = SDL_GetTicks(); - - if (gui._active) { - gui.loop(); - delta = 5; - } else { - delta = scumm.scummLoop(delta); - } - } while(1); + _system.last_time = SDL_GetTicks(); + + scumm.mainRun(); return 0; } @@ -1958,3 +1951,20 @@ void Scale_2xSaI (uint8 *srcPtr, uint32 srcPitch, uint8 * /* deltaPtr */, dstPtr += dstPitch; } } + + +/********* ScummVM call back functions **********/ + +int OSystem::waitTick(int delta) +{ + updateScreen(&scumm); + new_time = SDL_GetTicks(); + waitForTimer(&scumm, delta * 15 + last_time - new_time); + last_time = SDL_GetTicks(); + if (gui._active) { + gui.loop(); + delta = 5; + } + + return(delta); +} |
