Fixed most of the speed issues of insane
svn-id: r3833
This commit is contained in:
parent
13bf453232
commit
71be0400dc
5 changed files with 38 additions and 12 deletions
3
Makefile
3
Makefile
|
@ -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 \
|
||||
|
|
26
insane.cpp
26
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);
|
||||
}
|
||||
|
||||
if ( _frameChanged)
|
||||
{
|
||||
blitToScreen(sm,sm->_videoBuffer, 0, 0, 320 ,200);
|
||||
updateScreen(sm);
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
9
sdl.cpp
9
sdl.cpp
|
@ -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,12 +962,10 @@ int main(int argc, char* argv[]) {
|
|||
scumm->delta=0;
|
||||
scumm->_system = &_system;
|
||||
|
||||
_system.last_time = SDL_GetTicks();
|
||||
_system.last_time=0;
|
||||
|
||||
scumm->launch();
|
||||
|
||||
_system.last_time = SDL_GetTicks();
|
||||
|
||||
// scumm->runScript(1,0,0,&scumm->_bootParam);
|
||||
|
||||
// scumm->scummMain(argc, argv); // Todo: need to change that as well
|
||||
|
@ -2010,3 +2009,7 @@ int OSystem::waitTick(int delta)
|
|||
|
||||
return(delta);
|
||||
}
|
||||
|
||||
OSystem::OSystem(){
|
||||
last_time = SDL_GetTicks();
|
||||
}
|
||||
|
|
2
smush.h
2
smush.h
|
@ -74,4 +74,6 @@ struct SmushPlayer {
|
|||
|
||||
Scumm *sm;
|
||||
|
||||
int _frameChanged;
|
||||
|
||||
};
|
||||
|
|
2
system.h
2
system.h
|
@ -4,4 +4,6 @@ class OSystem
|
|||
int waitTick(int delta);
|
||||
int last_time;
|
||||
int new_time;
|
||||
|
||||
OSystem();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue