aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--saga/resnames.h2
-rw-r--r--saga/script.h8
-rw-r--r--saga/sfuncs.cpp47
3 files changed, 40 insertions, 17 deletions
diff --git a/saga/resnames.h b/saga/resnames.h
index e5b4e486e4..1d0e3aeec9 100644
--- a/saga/resnames.h
+++ b/saga/resnames.h
@@ -97,6 +97,8 @@ namespace Saga {
#define RID_ITE_INTRO_IMG_3 1561
#define RID_ITE_INTRO_IMG_4 1565
+#define RID_ITE_ENDCREDIT_SCENE_1 1802
+
// ITE_VOICES
#define RID_CAVE_VOICE_0 0
#define RID_CAVE_VOICE_1 1
diff --git a/saga/script.h b/saga/script.h
index 5ae4eefd8d..5d6d0328c2 100644
--- a/saga/script.h
+++ b/saga/script.h
@@ -469,10 +469,10 @@ private:
void sfLockUser(SCRIPTFUNC_PARAMS);
void sfPreDialog(SCRIPTFUNC_PARAMS);
void sfKillActorThreads(SCRIPTFUNC_PARAMS);
-
void sfFaceTowards(SCRIPTFUNC_PARAMS);
void sfSetFollower(SCRIPTFUNC_PARAMS);
- void SF_gotoScene(SCRIPTFUNC_PARAMS);
+ void sfScriptGotoScene(SCRIPTFUNC_PARAMS);
+
void SF_setObjImage(SCRIPTFUNC_PARAMS);
void SF_setObjName(SCRIPTFUNC_PARAMS);
void SF_getObjImage(SCRIPTFUNC_PARAMS);
@@ -486,7 +486,7 @@ private:
void sfScriptWalkToAsync(SCRIPTFUNC_PARAMS);
void SF_enableZone(SCRIPTFUNC_PARAMS);
void sfSetActorState(SCRIPTFUNC_PARAMS);
- void scriptMoveTo(SCRIPTFUNC_PARAMS);
+ void sfScriptMoveTo(SCRIPTFUNC_PARAMS);
void SF_sceneEq(SCRIPTFUNC_PARAMS);
void SF_dropObject(SCRIPTFUNC_PARAMS);
void sfFinishBgdAnim(SCRIPTFUNC_PARAMS);
@@ -509,7 +509,7 @@ private:
void SF_setProtagState(SCRIPTFUNC_PARAMS);
void sfResumeBgdAnim(SCRIPTFUNC_PARAMS);
void SF_throwActor(SCRIPTFUNC_PARAMS);
- void SF_waitWalk(SCRIPTFUNC_PARAMS);
+ void sfWaitWalk(SCRIPTFUNC_PARAMS);
void SF_sceneID(SCRIPTFUNC_PARAMS);
void SF_changeActorScene(SCRIPTFUNC_PARAMS);
void SF_climb(SCRIPTFUNC_PARAMS);
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index 322f31562b..14177ee404 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -65,7 +65,7 @@ void Script::setupScriptFuncList(void) {
OPCODE(sfKillActorThreads),
OPCODE(sfFaceTowards),
OPCODE(sfSetFollower),
- OPCODE(SF_gotoScene),
+ OPCODE(sfScriptGotoScene),
OPCODE(SF_setObjImage),
OPCODE(SF_setObjName),
OPCODE(SF_getObjImage),
@@ -79,7 +79,7 @@ void Script::setupScriptFuncList(void) {
OPCODE(sfScriptWalkToAsync),
OPCODE(SF_enableZone),
OPCODE(sfSetActorState),
- OPCODE(scriptMoveTo),
+ OPCODE(sfScriptMoveTo),
OPCODE(SF_sceneEq),
OPCODE(SF_dropObject),
OPCODE(sfFinishBgdAnim),
@@ -102,7 +102,7 @@ void Script::setupScriptFuncList(void) {
OPCODE(SF_setProtagState),
OPCODE(sfResumeBgdAnim),
OPCODE(SF_throwActor),
- OPCODE(SF_waitWalk),
+ OPCODE(sfWaitWalk),
OPCODE(SF_sceneID),
OPCODE(SF_changeActorScene),
OPCODE(SF_climb),
@@ -465,15 +465,27 @@ static struct SceneSubstitutes {
};
// Script function #16 (0x10)
-void Script::SF_gotoScene(SCRIPTFUNC_PARAMS) {
- int16 sceneNum = thread->pop();
- int16 entrance = thread->pop();
+void Script::sfScriptGotoScene(SCRIPTFUNC_PARAMS) {
+ int16 sceneNumber;
+ int16 entrance;
+
+ sceneNumber = thread->pop();
+ entrance = thread->pop();
+ if (sceneNumber < 0) {
+ //TODO: quit from game at all
+ }
+
+// _vm->_scene->loadScene(sceneNumber, BY_SCENE, _vm->_scene->SC_defaultScene, NULL, (sceneNumber = RID_ITE_ENDCREDIT_SCENE_1) ? SCENE_FADE : SCENE_NOFADE, entrance);
- for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++)
+ //TODO: placard stuff
+ _pendingVerb = kVerbNone;
+ _currentObject[0] = _currentObject[1] = ID_NOTHING;
+ showVerb();
+/* for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++)
if (sceneSubstitutes[i].sceneId == sceneNum)
debug(0, "Scene %d substitute exists", sceneNum);
- debug(1, "stub: SF_gotoScene(%d, %d)", sceneNum, entrance);
+ debug(1, "stub: SF_gotoScene(%d, %d)", sceneNum, entrance);*/
}
// Script function #17 (0x11)
@@ -653,7 +665,7 @@ void Script::sfSetActorState(SCRIPTFUNC_PARAMS) {
// Param1: actor id
// Param2: actor pos x
// Param3: actor pos y
-void Script::scriptMoveTo(SCRIPTFUNC_PARAMS) {
+void Script::sfScriptMoveTo(SCRIPTFUNC_PARAMS) {
int16 actorId;
Location actorLocation;
ActorData *actor;
@@ -666,7 +678,6 @@ void Script::scriptMoveTo(SCRIPTFUNC_PARAMS) {
actor->location.x = actorLocation.x;
actor->location.y = actorLocation.y;
-
}
// Script function #31 (0x21)
@@ -1227,10 +1238,20 @@ void Script::SF_throwActor(SCRIPTFUNC_PARAMS) {
}
// Script function #53 (0x35)
-void Script::SF_waitWalk(SCRIPTFUNC_PARAMS) {
- int16 param = thread->pop();
+// Param1: actor id
+// Param2: target object
+void Script::sfWaitWalk(SCRIPTFUNC_PARAMS) {
+ int16 actorId;
+ ActorData *actor;
+
+ actorId = thread->pop();
+ actor = _vm->_actor->getActor(actorId);
- debug(1, "stub: SF_waitWalk(%d)", param);
+ if ((actor->currentAction == kActionWalkToPoint) ||
+ (actor->currentAction == kActionWalkToLink) ||
+ (actor->currentAction == kActionFall)) {
+ thread->waitWalk(actor);
+ }
}
// Script function #54 (0x36)