Workaround for wrong anim_move_obj_to_tile usage

Closes #54
This commit is contained in:
Alexander Batalov 2023-02-27 12:28:48 +03:00
parent 9b986d16da
commit 8105529d68

View File

@ -1072,7 +1072,7 @@ static void op_animate_stand_reverse_obj(Program* program)
static void op_animate_move_obj_to_tile(Program* program)
{
int flags = programStackPopInteger(program);
int tile = programStackPopInteger(program);
ProgramValue tileValue = programStackPopValue(program);
Object* object = static_cast<Object*>(programStackPopPointer(program));
if (object == NULL) {
@ -1080,6 +1080,17 @@ static void op_animate_move_obj_to_tile(Program* program)
return;
}
// CE: There is a bug in `sinthia` script. It's supposed that Sinthia moves
// to `dest_tile`, but this function is passed `self_obj` as tile.
int tile;
if (tileValue.opcode == VALUE_TYPE_INT) {
tile = tileValue.integerValue;
} else {
dbg_error(program, "animate_move_obj_to_tile", SCRIPT_ERROR_FOLLOWS);
debug_printf("Invalid tile type.");
tile = -1;
}
if (tile <= -1) {
return;
}