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
This commit is contained in:
Max Horn 2003-05-23 00:22:41 +00:00
parent 47246c35b3
commit edf5946c40
2 changed files with 14 additions and 16 deletions

View File

@ -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() {

View File

@ -2358,8 +2358,7 @@ void Scumm_v5::o5_walkActorToActor() {
int nr;
int nr2 = getVarOrDirectByte(0x80);
a = derefActorSafe(nr2, "o5_walkActorToActor");
if (!a)
return;
assert(a);
if (!a->isInCurrentRoom()) {
getVarOrDirectByte(0x40);
@ -2375,8 +2374,7 @@ void Scumm_v5::o5_walkActorToActor() {
}
// warning("walk actor %d to actor %d", nr, nr2);
a2 = derefActorSafe(nr, "o5_walkActorToActor(2)");
if (!a2)
return;
assert(a2);
if (!a2->isInCurrentRoom()) {
fetchScriptByte();