Fix flags on non-door objects
This commit is contained in:
parent
43ad927817
commit
25e07fb597
|
@ -46,6 +46,7 @@ static int useStairs(Object* a1, Object* stairs, int a3);
|
||||||
static int _set_door_state_open(Object* a1, Object* a2);
|
static int _set_door_state_open(Object* a1, Object* a2);
|
||||||
static int _set_door_state_closed(Object* a1, Object* a2);
|
static int _set_door_state_closed(Object* a1, Object* a2);
|
||||||
static int _check_door_state(Object* a1, Object* a2);
|
static int _check_door_state(Object* a1, Object* a2);
|
||||||
|
static bool _obj_is_portal(Object* obj);
|
||||||
static bool _obj_is_lockable(Object* obj);
|
static bool _obj_is_lockable(Object* obj);
|
||||||
static bool _obj_is_openable(Object* obj);
|
static bool _obj_is_openable(Object* obj);
|
||||||
static int objectOpenClose(Object* obj);
|
static int objectOpenClose(Object* obj);
|
||||||
|
@ -1595,7 +1596,10 @@ static int _set_door_state_closed(Object* a1, Object* a2)
|
||||||
static int _check_door_state(Object* a1, Object* a2)
|
static int _check_door_state(Object* a1, Object* a2)
|
||||||
{
|
{
|
||||||
if ((a1->data.scenery.door.openFlags & 0x01) == 0) {
|
if ((a1->data.scenery.door.openFlags & 0x01) == 0) {
|
||||||
|
// SFALL: Fix flags on non-door objects.
|
||||||
|
if (_obj_is_portal(a1)) {
|
||||||
a1->flags &= ~OBJECT_OPEN_DOOR;
|
a1->flags &= ~OBJECT_OPEN_DOOR;
|
||||||
|
}
|
||||||
|
|
||||||
_obj_rebuild_all_light();
|
_obj_rebuild_all_light();
|
||||||
tileWindowRefresh();
|
tileWindowRefresh();
|
||||||
|
@ -1630,7 +1634,10 @@ static int _check_door_state(Object* a1, Object* a2)
|
||||||
artUnlock(artHandle);
|
artUnlock(artHandle);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
// SFALL: Fix flags on non-door objects.
|
||||||
|
if (_obj_is_portal(a1)) {
|
||||||
a1->flags |= OBJECT_OPEN_DOOR;
|
a1->flags |= OBJECT_OPEN_DOOR;
|
||||||
|
}
|
||||||
|
|
||||||
_obj_rebuild_all_light();
|
_obj_rebuild_all_light();
|
||||||
tileWindowRefresh();
|
tileWindowRefresh();
|
||||||
|
@ -1869,6 +1876,21 @@ int _obj_use_skill_on(Object* source, Object* target, int skill)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 0x49D140
|
||||||
|
static bool _obj_is_portal(Object* obj)
|
||||||
|
{
|
||||||
|
if (obj == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Proto* proto;
|
||||||
|
if (protoGetProto(obj->pid, &proto) == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return proto->scenery.type == SCENERY_TYPE_DOOR;
|
||||||
|
}
|
||||||
|
|
||||||
// 0x49D178
|
// 0x49D178
|
||||||
static bool _obj_is_lockable(Object* obj)
|
static bool _obj_is_lockable(Object* obj)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue