Rename OBJECT_NO_REMOVE flag

This commit is contained in:
Alexander Batalov 2022-12-22 16:47:11 +03:00
parent 737076a126
commit 96296417c6
4 changed files with 22 additions and 16 deletions

View File

@ -1977,11 +1977,11 @@ int gameMouseObjectsInit()
gGameMouseBouncingCursor->flags |= OBJECT_LIGHT_THRU; gGameMouseBouncingCursor->flags |= OBJECT_LIGHT_THRU;
gGameMouseBouncingCursor->flags |= OBJECT_TEMPORARY; gGameMouseBouncingCursor->flags |= OBJECT_TEMPORARY;
gGameMouseBouncingCursor->flags |= OBJECT_FLAG_0x400; gGameMouseBouncingCursor->flags |= OBJECT_NO_REMOVE;
gGameMouseBouncingCursor->flags |= OBJECT_SHOOT_THRU; gGameMouseBouncingCursor->flags |= OBJECT_SHOOT_THRU;
gGameMouseBouncingCursor->flags |= OBJECT_NO_BLOCK; gGameMouseBouncingCursor->flags |= OBJECT_NO_BLOCK;
gGameMouseHexCursor->flags |= OBJECT_FLAG_0x400; gGameMouseHexCursor->flags |= OBJECT_NO_REMOVE;
gGameMouseHexCursor->flags |= OBJECT_TEMPORARY; gGameMouseHexCursor->flags |= OBJECT_TEMPORARY;
gGameMouseHexCursor->flags |= OBJECT_LIGHT_THRU; gGameMouseHexCursor->flags |= OBJECT_LIGHT_THRU;
gGameMouseHexCursor->flags |= OBJECT_SHOOT_THRU; gGameMouseHexCursor->flags |= OBJECT_SHOOT_THRU;

View File

@ -48,7 +48,13 @@ typedef enum ObjectFlags {
OBJECT_FLAT = 0x08, OBJECT_FLAT = 0x08,
OBJECT_NO_BLOCK = 0x10, OBJECT_NO_BLOCK = 0x10,
OBJECT_LIGHTING = 0x20, OBJECT_LIGHTING = 0x20,
OBJECT_FLAG_0x400 = 0x400, // ???
// Specifies that the object should not be removed (freed) from the game
// world for whatever reason.
//
// This flag is used to prevent freeing of system objects like dude, egg,
// mouse cursors, etc.
OBJECT_NO_REMOVE = 0x400,
OBJECT_MULTIHEX = 0x800, OBJECT_MULTIHEX = 0x800,
OBJECT_NO_HIGHLIGHT = 0x1000, OBJECT_NO_HIGHLIGHT = 0x1000,
OBJECT_QUEUED = 0x2000, // set if there was/is any event for the object OBJECT_QUEUED = 0x2000, // set if there was/is any event for the object

View File

@ -336,7 +336,7 @@ int objectsInit(unsigned char* buf, int width, int height, int pitch)
dudeFid = buildFid(OBJ_TYPE_CRITTER, _art_vault_guy_num, 0, 0, 0); dudeFid = buildFid(OBJ_TYPE_CRITTER, _art_vault_guy_num, 0, 0, 0);
objectCreateWithFidPid(&gDude, dudeFid, 0x1000000); objectCreateWithFidPid(&gDude, dudeFid, 0x1000000);
gDude->flags |= OBJECT_FLAG_0x400; gDude->flags |= OBJECT_NO_REMOVE;
gDude->flags |= OBJECT_TEMPORARY; gDude->flags |= OBJECT_TEMPORARY;
gDude->flags |= OBJECT_HIDDEN; gDude->flags |= OBJECT_HIDDEN;
gDude->flags |= OBJECT_LIGHT_THRU; gDude->flags |= OBJECT_LIGHT_THRU;
@ -349,7 +349,7 @@ int objectsInit(unsigned char* buf, int width, int height, int pitch)
eggFid = buildFid(OBJ_TYPE_INTERFACE, 2, 0, 0, 0); eggFid = buildFid(OBJ_TYPE_INTERFACE, 2, 0, 0, 0);
objectCreateWithFidPid(&gEgg, eggFid, -1); objectCreateWithFidPid(&gEgg, eggFid, -1);
gEgg->flags |= OBJECT_FLAG_0x400; gEgg->flags |= OBJECT_NO_REMOVE;
gEgg->flags |= OBJECT_TEMPORARY; gEgg->flags |= OBJECT_TEMPORARY;
gEgg->flags |= OBJECT_HIDDEN; gEgg->flags |= OBJECT_HIDDEN;
gEgg->flags |= OBJECT_LIGHT_THRU; gEgg->flags |= OBJECT_LIGHT_THRU;
@ -385,8 +385,8 @@ void objectsReset()
void objectsExit() void objectsExit()
{ {
if (gObjectsInitialized) { if (gObjectsInitialized) {
gDude->flags &= ~OBJECT_FLAG_0x400; gDude->flags &= ~OBJECT_NO_REMOVE;
gEgg->flags &= ~OBJECT_FLAG_0x400; gEgg->flags &= ~OBJECT_NO_REMOVE;
_obj_remove_all(); _obj_remove_all();
textObjectsFree(); textObjectsFree();
@ -540,8 +540,8 @@ static int objectLoadAllInternal(File* stream)
_obj_insert(objectListNode); _obj_insert(objectListNode);
if ((objectListNode->obj->flags & OBJECT_FLAG_0x400) && PID_TYPE(objectListNode->obj->pid) == OBJ_TYPE_CRITTER && objectListNode->obj->pid != 18000) { if ((objectListNode->obj->flags & OBJECT_NO_REMOVE) && PID_TYPE(objectListNode->obj->pid) == OBJ_TYPE_CRITTER && objectListNode->obj->pid != 18000) {
objectListNode->obj->flags &= ~OBJECT_FLAG_0x400; objectListNode->obj->flags &= ~OBJECT_NO_REMOVE;
} }
Inventory* inventory = &(objectListNode->obj->data.inventory); Inventory* inventory = &(objectListNode->obj->data.inventory);
@ -2047,7 +2047,7 @@ int _obj_inven_free(Inventory* inventory)
objectListNodeCreate(&node); objectListNodeCreate(&node);
node->obj = inventoryItem->item; node->obj = inventoryItem->item;
node->obj->flags &= ~OBJECT_FLAG_0x400; node->obj->flags &= ~OBJECT_NO_REMOVE;
_obj_remove(node, node); _obj_remove(node, node);
inventoryItem->item = NULL; inventoryItem->item = NULL;
@ -3716,7 +3716,7 @@ int _obj_load_dude(File* stream)
tempInventory->capacity = 0; tempInventory->capacity = 0;
tempInventory->items = NULL; tempInventory->items = NULL;
temp->flags &= ~OBJECT_FLAG_0x400; temp->flags &= ~OBJECT_NO_REMOVE;
if (objectDestroy(temp, NULL) == -1) { if (objectDestroy(temp, NULL) == -1) {
debugPrint("\nError: obj_load_dude: Can't destroy temp object!\n"); debugPrint("\nError: obj_load_dude: Can't destroy temp object!\n");
@ -3931,7 +3931,7 @@ static int _obj_remove(ObjectListNode* a1, ObjectListNode* a2)
return -1; return -1;
} }
if ((a1->obj->flags & OBJECT_FLAG_0x400) != 0) { if ((a1->obj->flags & OBJECT_NO_REMOVE) != 0) {
return -1; return -1;
} }

View File

@ -395,7 +395,7 @@ int partyMemberAdd(Object* object)
partyMember->vars = NULL; partyMember->vars = NULL;
object->id = (object->pid & 0xFFFFFF) + 18000; object->id = (object->pid & 0xFFFFFF) + 18000;
object->flags |= (OBJECT_FLAG_0x400 | OBJECT_TEMPORARY); object->flags |= (OBJECT_NO_REMOVE | OBJECT_TEMPORARY);
gPartyMembersLength++; gPartyMembersLength++;
@ -453,7 +453,7 @@ int partyMemberRemove(Object* object)
gPartyMembers[index].object = gPartyMembers[gPartyMembersLength - 1].object; gPartyMembers[index].object = gPartyMembers[gPartyMembersLength - 1].object;
} }
object->flags &= ~(OBJECT_FLAG_0x400 | OBJECT_TEMPORARY); object->flags &= ~(OBJECT_NO_REMOVE | OBJECT_TEMPORARY);
gPartyMembersLength--; gPartyMembersLength--;
@ -482,7 +482,7 @@ int _partyMemberPrepSave()
STRUCT_519DA8* ptr = &(gPartyMembers[index]); STRUCT_519DA8* ptr = &(gPartyMembers[index]);
if (index > 0) { if (index > 0) {
ptr->object->flags &= ~(OBJECT_FLAG_0x400 | OBJECT_TEMPORARY); ptr->object->flags &= ~(OBJECT_NO_REMOVE | OBJECT_TEMPORARY);
} }
Script* script; Script* script;
@ -501,7 +501,7 @@ int _partyMemberUnPrepSave()
STRUCT_519DA8* ptr = &(gPartyMembers[index]); STRUCT_519DA8* ptr = &(gPartyMembers[index]);
if (index > 0) { if (index > 0) {
ptr->object->flags |= (OBJECT_FLAG_0x400 | OBJECT_TEMPORARY); ptr->object->flags |= (OBJECT_NO_REMOVE | OBJECT_TEMPORARY);
} }
Script* script; Script* script;