aboutsummaryrefslogtreecommitdiff
path: root/scumm/script_v2.cpp
diff options
context:
space:
mode:
authorMax Horn2003-05-23 00:22:41 +0000
committerMax Horn2003-05-23 00:22:41 +0000
commitedf5946c408efebda37d37b4814822fb9578b141 (patch)
tree4b589960a6e4040cb277c720586d2bd2e639ba43 /scumm/script_v2.cpp
parent47246c35b316adcdba95ec98b0552a895a988eb4 (diff)
downloadscummvm-rg350-edf5946c408efebda37d37b4814822fb9578b141.tar.gz
scummvm-rg350-edf5946c408efebda37d37b4814822fb9578b141.tar.bz2
scummvm-rg350-edf5946c408efebda37d37b4814822fb9578b141.zip
some well placed asserts (triggering any of those means with 99% a bug in some other place; so don't just remove the asserts if you trigger one of 'em!
svn-id: r7840
Diffstat (limited to 'scumm/script_v2.cpp')
-rw-r--r--scumm/script_v2.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index 946fc45897..51b4ad7dc2 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -642,7 +642,9 @@ void Scumm_v2::o2_subtract() {
}
void Scumm_v2::o2_waitForActor() {
- if (derefActorSafe(getVarOrDirectByte(0x80), "o2_waitForActor")->moving) {
+ Actor *a = derefActorSafe(getVarOrDirectByte(0x80), "o2_waitForActor");
+ assert(a);
+ if (a->moving) {
_scriptPointer -= 2;
o5_breakHere();
}
@@ -672,6 +674,8 @@ void Scumm_v2::o2_actorSet() {
_opcode = fetchScriptByte();
if (!a) {
+ // This case happens in the Zak/MM bootscript exactly once each, to
+ // set the default talk color (9).
return;
}
@@ -983,10 +987,11 @@ void Scumm_v2::o2_walkActorTo() {
int x, y;
Actor *a;
a = derefActorSafe(getVarOrDirectByte(0x80), "o2_walkActorTo");
+ assert(a);
+
x = getVarOrDirectByte(0x40) * 8;
y = getVarOrDirectByte(0x20) * 2;
- assert(a);
a->startWalkActor(x, y, -1);
}
@@ -1050,9 +1055,7 @@ void Scumm_v2::o2_setActorElevation() {
int elevation = getVarOrDirectByte(0x40);
Actor *a = derefActorSafe(act, "o2_setActorElevation");
- if (!a)
- return;
-
+ assert(a);
a->elevation = elevation;
}
@@ -1061,9 +1064,7 @@ void Scumm_v2::o2_animateActor() {
int anim = getVarOrDirectByte(0x40);
Actor *a = derefActorSafe(act, "o2_animateActor");
- if (!a)
- return;
-
+ assert(a);
a->animateActor(anim);
}
@@ -1114,6 +1115,7 @@ void Scumm_v2::o2_loadRoomWithEgo() {
room = getVarOrDirectByte(0x40);
a = derefActorSafe(VAR(VAR_EGO), "o2_loadRoomWithEgo");
+ assert(a);
a->putActor(0, 0, room);
_egoPositioned = false;
@@ -1364,10 +1366,8 @@ void Scumm_v2::o2_getActorWalkBox() {
Actor *a;
getResultPos();
a = derefActorSafe(getVarOrDirectByte(0x80), "o2_getActorWalkbox");
- if (a)
- setResult(a->walkbox);
- else
- setResult(0);
+ assert(a);
+ setResult(a->walkbox);
}
void Scumm_v2::o2_dummy() {