aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorAndrew Kurushin2005-05-18 18:28:10 +0000
committerAndrew Kurushin2005-05-18 18:28:10 +0000
commit284ef431e1ce4d54bbabc3886259d0a3075a4905 (patch)
tree2397ad44f668af6dbebfd0a57f2ab29127184836 /saga
parentf7df4797a88db569ab1e3472125772fecd0c4af8 (diff)
downloadscummvm-rg350-284ef431e1ce4d54bbabc3886259d0a3075a4905.tar.gz
scummvm-rg350-284ef431e1ce4d54bbabc3886259d0a3075a4905.tar.bz2
scummvm-rg350-284ef431e1ce4d54bbabc3886259d0a3075a4905.zip
fixed loadsave item resource id
partialy fixed protect rat svn-id: r18174
Diffstat (limited to 'saga')
-rw-r--r--saga/actor.cpp5
-rw-r--r--saga/actor.h10
-rw-r--r--saga/input.cpp1
-rw-r--r--saga/render.cpp1
-rw-r--r--saga/saga.cpp3
-rw-r--r--saga/scene.cpp1
-rw-r--r--saga/scene.h5
-rw-r--r--saga/script.h4
-rw-r--r--saga/sfuncs.cpp44
9 files changed, 41 insertions, 33 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index 856225e111..a7965ae325 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -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);
diff --git a/saga/actor.h b/saga/actor.h
index 9bc2658d47..73b584f37b 100644
--- a/saga/actor.h
+++ b/saga/actor.h
@@ -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;
diff --git a/saga/input.cpp b/saga/input.cpp
index d49dbdf3d3..608a10463b 100644
--- a/saga/input.cpp
+++ b/saga/input.cpp
@@ -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);
diff --git a/saga/render.cpp b/saga/render.cpp
index 35b5013246..ec4d4cd3f7 100644
--- a/saga/render.cpp
+++ b/saga/render.cpp
@@ -84,6 +84,7 @@ Render::Render(SagaEngine *vm, OSystem *system) {
}
Render::~Render(void) {
+ Common::g_timer->removeTimerProc(&fpsTimerCallback);
free(_bg_buf);
free(_tmp_buf);
diff --git a/saga/saga.cpp b/saga/saga.cpp
index 591850b25f..fc7fcbad85 100644
--- a/saga/saga.cpp
+++ b/saga/saga.cpp
@@ -166,6 +166,9 @@ SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst)
SagaEngine::~SagaEngine() {
int i;
+ if (_scene->isSceneLoaded()) {
+ _scene->endScene();
+ }
delete _sndRes;
delete _events;
diff --git a/saga/scene.cpp b/saga/scene.cpp
index 4c33ee59ce..8e94499184 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -125,7 +125,6 @@ Scene::Scene(SagaEngine *vm) : _vm(vm), _initialized(false) {
Scene::~Scene() {
if (_initialized) {
- endScene();
delete _actionMap;
free(_sceneLUT);
}
diff --git a/saga/scene.h b/saga/scene.h
index 125283136a..a71aecbce8 100644
--- a/saga/scene.h
+++ b/saga/scene.h
@@ -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;
diff --git a/saga/script.h b/saga/script.h
index 807dd3111c..7e8973e1f5 100644
--- a/saga/script.h
+++ b/saga/script.h
@@ -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);
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index d58f1dadc0..3b8dd9a3a9 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -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)