diff --git a/src/game_mouse.cc b/src/game_mouse.cc index 492b53b..bafbf82 100644 --- a/src/game_mouse.cc +++ b/src/game_mouse.cc @@ -1977,11 +1977,11 @@ int gameMouseObjectsInit() gGameMouseBouncingCursor->flags |= OBJECT_LIGHT_THRU; gGameMouseBouncingCursor->flags |= OBJECT_TEMPORARY; - gGameMouseBouncingCursor->flags |= OBJECT_FLAG_0x400; + gGameMouseBouncingCursor->flags |= OBJECT_NO_REMOVE; gGameMouseBouncingCursor->flags |= OBJECT_SHOOT_THRU; gGameMouseBouncingCursor->flags |= OBJECT_NO_BLOCK; - gGameMouseHexCursor->flags |= OBJECT_FLAG_0x400; + gGameMouseHexCursor->flags |= OBJECT_NO_REMOVE; gGameMouseHexCursor->flags |= OBJECT_TEMPORARY; gGameMouseHexCursor->flags |= OBJECT_LIGHT_THRU; gGameMouseHexCursor->flags |= OBJECT_SHOOT_THRU; diff --git a/src/obj_types.h b/src/obj_types.h index 158d789..02d9e7f 100644 --- a/src/obj_types.h +++ b/src/obj_types.h @@ -48,7 +48,13 @@ typedef enum ObjectFlags { OBJECT_FLAT = 0x08, OBJECT_NO_BLOCK = 0x10, 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_NO_HIGHLIGHT = 0x1000, OBJECT_QUEUED = 0x2000, // set if there was/is any event for the object diff --git a/src/object.cc b/src/object.cc index 4df1512..01ea0ed 100644 --- a/src/object.cc +++ b/src/object.cc @@ -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); objectCreateWithFidPid(&gDude, dudeFid, 0x1000000); - gDude->flags |= OBJECT_FLAG_0x400; + gDude->flags |= OBJECT_NO_REMOVE; gDude->flags |= OBJECT_TEMPORARY; gDude->flags |= OBJECT_HIDDEN; 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); objectCreateWithFidPid(&gEgg, eggFid, -1); - gEgg->flags |= OBJECT_FLAG_0x400; + gEgg->flags |= OBJECT_NO_REMOVE; gEgg->flags |= OBJECT_TEMPORARY; gEgg->flags |= OBJECT_HIDDEN; gEgg->flags |= OBJECT_LIGHT_THRU; @@ -385,8 +385,8 @@ void objectsReset() void objectsExit() { if (gObjectsInitialized) { - gDude->flags &= ~OBJECT_FLAG_0x400; - gEgg->flags &= ~OBJECT_FLAG_0x400; + gDude->flags &= ~OBJECT_NO_REMOVE; + gEgg->flags &= ~OBJECT_NO_REMOVE; _obj_remove_all(); textObjectsFree(); @@ -540,8 +540,8 @@ static int objectLoadAllInternal(File* stream) _obj_insert(objectListNode); - if ((objectListNode->obj->flags & OBJECT_FLAG_0x400) && PID_TYPE(objectListNode->obj->pid) == OBJ_TYPE_CRITTER && objectListNode->obj->pid != 18000) { - objectListNode->obj->flags &= ~OBJECT_FLAG_0x400; + if ((objectListNode->obj->flags & OBJECT_NO_REMOVE) && PID_TYPE(objectListNode->obj->pid) == OBJ_TYPE_CRITTER && objectListNode->obj->pid != 18000) { + objectListNode->obj->flags &= ~OBJECT_NO_REMOVE; } Inventory* inventory = &(objectListNode->obj->data.inventory); @@ -2047,7 +2047,7 @@ int _obj_inven_free(Inventory* inventory) objectListNodeCreate(&node); node->obj = inventoryItem->item; - node->obj->flags &= ~OBJECT_FLAG_0x400; + node->obj->flags &= ~OBJECT_NO_REMOVE; _obj_remove(node, node); inventoryItem->item = NULL; @@ -3716,7 +3716,7 @@ int _obj_load_dude(File* stream) tempInventory->capacity = 0; tempInventory->items = NULL; - temp->flags &= ~OBJECT_FLAG_0x400; + temp->flags &= ~OBJECT_NO_REMOVE; if (objectDestroy(temp, NULL) == -1) { 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; } - if ((a1->obj->flags & OBJECT_FLAG_0x400) != 0) { + if ((a1->obj->flags & OBJECT_NO_REMOVE) != 0) { return -1; } diff --git a/src/party_member.cc b/src/party_member.cc index c5787ae..3425ba3 100644 --- a/src/party_member.cc +++ b/src/party_member.cc @@ -395,7 +395,7 @@ int partyMemberAdd(Object* object) partyMember->vars = NULL; object->id = (object->pid & 0xFFFFFF) + 18000; - object->flags |= (OBJECT_FLAG_0x400 | OBJECT_TEMPORARY); + object->flags |= (OBJECT_NO_REMOVE | OBJECT_TEMPORARY); gPartyMembersLength++; @@ -453,7 +453,7 @@ int partyMemberRemove(Object* object) gPartyMembers[index].object = gPartyMembers[gPartyMembersLength - 1].object; } - object->flags &= ~(OBJECT_FLAG_0x400 | OBJECT_TEMPORARY); + object->flags &= ~(OBJECT_NO_REMOVE | OBJECT_TEMPORARY); gPartyMembersLength--; @@ -482,7 +482,7 @@ int _partyMemberPrepSave() STRUCT_519DA8* ptr = &(gPartyMembers[index]); if (index > 0) { - ptr->object->flags &= ~(OBJECT_FLAG_0x400 | OBJECT_TEMPORARY); + ptr->object->flags &= ~(OBJECT_NO_REMOVE | OBJECT_TEMPORARY); } Script* script; @@ -501,7 +501,7 @@ int _partyMemberUnPrepSave() STRUCT_519DA8* ptr = &(gPartyMembers[index]); if (index > 0) { - ptr->object->flags |= (OBJECT_FLAG_0x400 | OBJECT_TEMPORARY); + ptr->object->flags |= (OBJECT_NO_REMOVE | OBJECT_TEMPORARY); } Script* script;