fixed loadsave item resource id

partialy fixed protect rat

svn-id: r18174
This commit is contained in:
Andrew Kurushin 2005-05-18 18:28:10 +00:00
parent f7df4797a8
commit 284ef431e1
9 changed files with 41 additions and 33 deletions

View File

@ -159,7 +159,8 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
ActorData *actor;
ObjectData *obj;
debug(9, "Actor::Actor()");
_handleActionDiv = 15;
_actors = NULL;
_actorsCount = 0;
@ -1136,7 +1137,7 @@ int Actor::direct(int msec) {
// FIXME: HACK. This should be turned into cycle event.
_lastTickMsec += msec;
if (_lastTickMsec > 1000 / 15) { // fixme choose 50 for speed up
if (_lastTickMsec > 1000 / _handleActionDiv) {
_lastTickMsec = 0;
//process actions
handleActions(msec, false);

View File

@ -206,16 +206,16 @@ struct Location {
class CommonObjectData {
public:
//constant
bool disabled; // disabled in init section
bool disabled; // disabled in init section
int32 index; // index in local array
uint16 id; // object id
uint16 id; // object id
int32 scriptEntrypointNumber; // script entrypoint number
int32 spriteListResourceId; // sprite list resource id
//variables
uint16 flags; // initial flags
int32 nameIndex; // index in name string list
int32 sceneNumber; // scene
int32 spriteListResourceId; // sprite list resource id
Location location; // logical coordinates
Point screenPosition; // screen coordinates
@ -226,6 +226,7 @@ public:
out.writeUint16LE(flags);
out.writeSint32LE(nameIndex);
out.writeSint32LE(sceneNumber);
out.writeSint32LE(spriteListResourceId);
location.saveState(out);
out.writeSint16LE(screenPosition.x);
out.writeSint16LE(screenPosition.y);
@ -236,6 +237,7 @@ public:
flags = in.readUint16LE();
nameIndex = in.readSint32LE();
sceneNumber = in.readSint32LE();
spriteListResourceId = in.readSint32LE();
location.loadState(in);
screenPosition.x = in.readSint16LE();
screenPosition.y = in.readSint16LE();
@ -559,7 +561,7 @@ protected:
public:
ActorData *_centerActor;
ActorData *_protagonist;
int _handleActionDiv;
protected:
SpeechData _activeSpeech;
int _protagState;

View File

@ -71,6 +71,7 @@ int SagaEngine::processInput() {
break;
case 282: // F1
_render->toggleFlag(RF_SHOW_FPS);
_vm->_actor->_handleActionDiv = (_vm->_actor->_handleActionDiv == 15) ? 50 : 15;
break;
case 283: // F2
_render->toggleFlag(RF_PALETTE_TEST);

View File

@ -84,6 +84,7 @@ Render::Render(SagaEngine *vm, OSystem *system) {
}
Render::~Render(void) {
Common::g_timer->removeTimerProc(&fpsTimerCallback);
free(_bg_buf);
free(_tmp_buf);

View File

@ -166,6 +166,9 @@ SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst)
SagaEngine::~SagaEngine() {
int i;
if (_scene->isSceneLoaded()) {
_scene->endScene();
}
delete _sndRes;
delete _events;

View File

@ -125,7 +125,6 @@ Scene::Scene(SagaEngine *vm) : _vm(vm), _initialized(false) {
Scene::~Scene() {
if (_initialized) {
endScene();
delete _actionMap;
free(_sceneLUT);
}

View File

@ -257,7 +257,8 @@ class Scene {
}
void changeScene(uint16 sceneNumber, int actorsEntrance, SceneTransitionType transitionType);
bool initialized() { return _initialized; }
bool initialized() const { return _initialized; }
bool isSceneLoaded() const { return _sceneLoaded; }
int getSceneResourceId(int sceneNumber) {
@ -277,7 +278,7 @@ class Scene {
void loadSceneEntryList(const byte* resourcePointer, size_t resourceLength);
int processSceneResources();
private:
SagaEngine *_vm;
bool _initialized;

View File

@ -535,8 +535,8 @@ private:
void sfPlaySound(SCRIPTFUNC_PARAMS);
void SF_playLoopedSound(SCRIPTFUNC_PARAMS);
void sfGetDeltaFrame(SCRIPTFUNC_PARAMS);
void SF_showProtect(SCRIPTFUNC_PARAMS);
void SF_protectResult(SCRIPTFUNC_PARAMS);
void sfShowProtect(SCRIPTFUNC_PARAMS);
void sfProtectResult(SCRIPTFUNC_PARAMS);
void sfRand(SCRIPTFUNC_PARAMS);
void SF_fadeMusic(SCRIPTFUNC_PARAMS);
void SF_playVoice(SCRIPTFUNC_PARAMS);

View File

@ -123,8 +123,8 @@ void Script::setupScriptFuncList(void) {
OPCODE(sfPlaySound),
OPCODE(SF_playLoopedSound),
OPCODE(sfGetDeltaFrame),
OPCODE(SF_showProtect),
OPCODE(SF_protectResult),
OPCODE(sfShowProtect),
OPCODE(sfProtectResult),
OPCODE(sfRand),
OPCODE(SF_fadeMusic),
OPCODE(SF_playVoice),
@ -574,7 +574,7 @@ void Script::SF_getNumber(SCRIPTFUNC_PARAMS) {
for (int i = 0; i < nArgs; i++)
thread->pop();
debug(0, "STUB: SF_getNumber(), %d args", nArgs);
error(0, "STUB: SF_getNumber(), %d args", nArgs);
}
// Script function #21 (0x15)
@ -1049,7 +1049,6 @@ void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) {
// has not been interrupted.
void Script::sfCheckUserInterrupt(SCRIPTFUNC_PARAMS) {
thread->_returnValue = (_skipSpeeches == true);
}
// Script function #45 (0x2D)
@ -1123,7 +1122,7 @@ void Script::SF_simulSpeech2(SCRIPTFUNC_PARAMS) {
for (int i = 0; i < nArgs; i++)
thread->pop();
debug(0, "STUB: SF_simulSpeech2(), %d args", nArgs);
error(0, "STUB: SF_simulSpeech2(), %d args", nArgs);
}
static TEXTLIST_ENTRY *placardTextEntry;
@ -1322,7 +1321,7 @@ void Script::SF_throwActor(SCRIPTFUNC_PARAMS) {
param5 = thread->pop();
param6 = thread->pop();
debug(0, "STUB: SF_throwActor(%d, %d, %d, %d, %d, %d)", param1, param2, param3, param4, param5, param6);
error(0, "STUB: SF_throwActor(%d, %d, %d, %d, %d, %d)", param1, param2, param3, param4, param5, param6);
}
// Script function #53 (0x35)
@ -1352,7 +1351,7 @@ void Script::SF_changeActorScene(SCRIPTFUNC_PARAMS) {
int param1 = thread->pop();
int param2 = thread->pop();
debug(0, "STUB: SF_changeActorScene(%d, %d)", param1, param2);
error(0, "STUB: SF_changeActorScene(%d, %d)", param1, param2);
}
// Script function #56 (0x38)
@ -1362,7 +1361,7 @@ void Script::SF_climb(SCRIPTFUNC_PARAMS) {
int param3 = thread->pop();
int param4 = thread->pop();
debug(0, "STUB: SF_climb(%d, %d, %d, %d)", param1, param2, param3, param4);
error(0, "STUB: SF_climb(%d, %d, %d, %d)", param1, param2, param3, param4);
}
// Script function #57 (0x39)
@ -1386,7 +1385,7 @@ void Script::SF_setActorZ(SCRIPTFUNC_PARAMS) {
int param1 = thread->pop();
int param2 = thread->pop();
debug(0, "STUB: SF_setActorZ(%d, %d)", param1, param2);
error(0, "STUB: SF_setActorZ(%d, %d)", param1, param2);
}
// Script function #59 (0x3B)
@ -1394,21 +1393,21 @@ void Script::SF_text(SCRIPTFUNC_PARAMS) {
for (int i = 0; i < nArgs; i++)
thread->pop();
debug(0, "STUB: SF_text(), %d args", nArgs);
error(0, "STUB: SF_text(), %d args", nArgs);
}
// Script function #60 (0x3C)
void Script::SF_getActorX(SCRIPTFUNC_PARAMS) {
int16 param = thread->pop();
debug(0, "STUB: SF_getActorX(%d)", param);
error(0, "STUB: SF_getActorX(%d)", param);
}
// Script function #61 (0x3D)
void Script::SF_getActorY(SCRIPTFUNC_PARAMS) {
int16 param = thread->pop();
debug(0, "STUB: SF_getActorY(%d)", param);
error(0, "STUB: SF_getActorY(%d)", param);
}
// Script function #62 (0x3E)
@ -1416,7 +1415,7 @@ void Script::SF_eraseDelta(SCRIPTFUNC_PARAMS) {
for (int i = 0; i < nArgs; i++)
thread->pop();
debug(0, "STUB: SF_eraseDelta(), %d args", nArgs);
error(0, "STUB: SF_eraseDelta(), %d args", nArgs);
}
// Script function #63 (0x3F)
@ -1591,19 +1590,20 @@ void Script::sfGetDeltaFrame(SCRIPTFUNC_PARAMS) {
}
// Script function #73 (0x49)
void Script::SF_showProtect(SCRIPTFUNC_PARAMS) {
for (int i = 0; i < nArgs; i++)
thread->pop();
void Script::sfShowProtect(SCRIPTFUNC_PARAMS) {
thread->wait(kWaitTypeRequest);
debug(0, "STUB: SF_showProtect(), %d args", nArgs);
//TODO:protection dialog
thread->_flags &= ~kTFlagWaiting;
}
// Script function #74 (0x4A)
void Script::SF_protectResult(SCRIPTFUNC_PARAMS) {
for (int i = 0; i < nArgs; i++)
thread->pop();
debug(0, "STUB: SF_protectResult(), %d args", nArgs);
void Script::sfProtectResult(SCRIPTFUNC_PARAMS) {
int protectHash;
//cheating
protectHash = thread->pop();
thread->push(protectHash);
thread->_returnValue = protectHash;
}
// Script function #75 (0x4b)