diff options
author | Vincent Hamm | 2002-03-25 22:46:32 +0000 |
---|---|---|
committer | Vincent Hamm | 2002-03-25 22:46:32 +0000 |
commit | 71be0400dc3d243b6854e36d16d30d151aa4fc2c (patch) | |
tree | 101c5db089f4758567aa73cd06d6cac5fb729e48 | |
parent | 13bf453232d27ad2cde9ce25ebeb14c2665a9385 (diff) | |
download | scummvm-rg350-71be0400dc3d243b6854e36d16d30d151aa4fc2c.tar.gz scummvm-rg350-71be0400dc3d243b6854e36d16d30d151aa4fc2c.tar.bz2 scummvm-rg350-71be0400dc3d243b6854e36d16d30d151aa4fc2c.zip |
Fixed most of the speed issues of insane
svn-id: r3833
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | insane.cpp | 32 | ||||
-rw-r--r-- | sdl.cpp | 11 | ||||
-rw-r--r-- | smush.h | 2 | ||||
-rw-r--r-- | system.h | 2 |
5 files changed, 38 insertions, 12 deletions
@@ -15,7 +15,8 @@ OBJS = actor.o boxes.o costume.o gfx.o object.o resource.o \ saveload.o script.o scummvm.o sound.o string.o \ sys.o verbs.o sdl.o script_v1.o script_v2.o debug.o gui.o \ sound/imuse.o sound/fmopl.o sound/adlib.o sound/gmidi.o debugrl.o \ - akos.o vars.o insane.o gameDetector.o init.o v3/resource_v3.o v4/resource_v4.o + akos.o vars.o insane.o gameDetector.o init.o \ + v3/resource_v3.o v4/resource_v4.o DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \ windows.cpp debugrl.h whatsnew.txt readme.txt copying.txt \ diff --git a/insane.cpp b/insane.cpp index c2bb4281f3..498baceae3 100644 --- a/insane.cpp +++ b/insane.cpp @@ -33,6 +33,8 @@ void invalidblock(uint32 tag) { error("Encountered invalid block %c%c%c%c", tag>>24, tag>>16, tag>>8, tag); } +int _frameChanged; + uint32 SmushPlayer::nextBE32() { uint32 a = *((uint32*)_cur); _cur += sizeof(uint32); @@ -354,13 +356,15 @@ void codec37_maketable(PersistentCodecData37 *pcd, int pitch, byte idx) { -void codec37(CodecData *cd, PersistentCodecData37 *pcd) { +int codec37(CodecData *cd, PersistentCodecData37 *pcd) { int width_in_blocks, height_in_blocks; int src_pitch; byte *curbuf; uint size; bool result = false; + _frameChanged=1; + width_in_blocks = (cd->w + 3) >> 2; height_in_blocks = (cd->h + 3) >> 2; src_pitch = width_in_blocks * 4; @@ -383,7 +387,7 @@ void codec37(CodecData *cd, PersistentCodecData37 *pcd) { if(size==64000) codec37_bompdepack(curbuf, cd->src+16, size); else - return; + return(1); memset(pcd->deltaBuf, 0, curbuf - pcd->deltaBuf); memset(curbuf + size, 0, pcd->deltaBuf + pcd->deltaSize - curbuf - size); @@ -397,6 +401,7 @@ void codec37(CodecData *cd, PersistentCodecData37 *pcd) { break; if (number&1 && cd->src[12]&1 && cd->flags&0x10) { + _frameChanged = 0; result=true; break; } @@ -415,7 +420,7 @@ void codec37(CodecData *cd, PersistentCodecData37 *pcd) { case 1: case 4: warning("code %d", cd->src[0]); - return; + return(1); default: error("codec37 default case"); @@ -428,6 +433,8 @@ void codec37(CodecData *cd, PersistentCodecData37 *pcd) { } else { memcpy(cd->out, pcd->deltaBufs[pcd->curtable], 320*200); } + + return(_frameChanged); } void codec37_init(PersistentCodecData37 *pcd, int width, int height) { @@ -461,7 +468,7 @@ void SmushPlayer::parseFOBJ() { codec1(&cd); break; case 37: - codec37(&cd, &pcd37); + _frameChanged = codec37(&cd, &pcd37); break; default: error("invalid codec %d", codec); @@ -599,7 +606,11 @@ void SmushPlayer::startVideo(short int arg, byte* videoFile) sm->videoFinished = 0; sm->_insaneState = 1; + sm->delta = 5; + do { + _frameChanged = 1; + if(ftell(_in)>=fileSize ) return; #ifdef INSANE_DEBUG @@ -615,16 +626,23 @@ void SmushPlayer::startVideo(short int arg, byte* videoFile) sm->setDirtyColors(0, 255); } - blitToScreen(sm,sm->_videoBuffer, 0, 0, 320 ,200); - updateScreen(sm); + if ( _frameChanged) + { + blitToScreen(sm,sm->_videoBuffer, 0, 0, 320 ,200); + updateScreen(sm); - sm->delta = sm->_system->waitTick(sm->delta); + sm->delta = sm->_system->waitTick(sm->delta); + } sm->processKbd(); } while (!sm->videoFinished); sm->_insaneState = 0; + +// if (sm->_lastKeyHit==sm->_vars[sm->VAR_CUTSCENEEXIT_KEY]) + sm->exitCutscene(); + } @@ -953,6 +953,7 @@ int main(int argc, char* argv[]) { scumm->_features = detector._features; scumm->_soundCardType = detector._soundCardType; + scumm->delta=6; scumm->_gui = &gui; // gui.init(scumm); @@ -961,11 +962,9 @@ int main(int argc, char* argv[]) { scumm->delta=0; scumm->_system = &_system; - _system.last_time = SDL_GetTicks(); - - scumm->launch(); + _system.last_time=0; - _system.last_time = SDL_GetTicks(); + scumm->launch(); // scumm->runScript(1,0,0,&scumm->_bootParam); @@ -2010,3 +2009,7 @@ int OSystem::waitTick(int delta) return(delta); } + +OSystem::OSystem(){ + last_time = SDL_GetTicks(); +} @@ -74,4 +74,6 @@ struct SmushPlayer { Scumm *sm; + int _frameChanged; + }; @@ -4,4 +4,6 @@ class OSystem int waitTick(int delta); int last_time; int new_time; + + OSystem(); }; |