Rename OBJECT_NO_SAVE flag
This commit is contained in:
parent
96296417c6
commit
c7ca358295
|
@ -1610,7 +1610,7 @@ int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object*
|
||||||
}
|
}
|
||||||
|
|
||||||
objectHide(explosion, NULL);
|
objectHide(explosion, NULL);
|
||||||
explosion->flags |= OBJECT_TEMPORARY;
|
explosion->flags |= OBJECT_NO_SAVE;
|
||||||
|
|
||||||
objectSetLocation(explosion, tile, elevation, NULL);
|
objectSetLocation(explosion, tile, elevation, NULL);
|
||||||
|
|
||||||
|
@ -1628,7 +1628,7 @@ int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object*
|
||||||
}
|
}
|
||||||
|
|
||||||
objectHide(adjacentExplosions[rotation], NULL);
|
objectHide(adjacentExplosions[rotation], NULL);
|
||||||
adjacentExplosions[rotation]->flags |= OBJECT_TEMPORARY;
|
adjacentExplosions[rotation]->flags |= OBJECT_NO_SAVE;
|
||||||
|
|
||||||
int adjacentTile = tileGetTileInDirection(tile, rotation, 1);
|
int adjacentTile = tileGetTileInDirection(tile, rotation, 1);
|
||||||
objectSetLocation(adjacentExplosions[rotation], adjacentTile, elevation, NULL);
|
objectSetLocation(adjacentExplosions[rotation], adjacentTile, elevation, NULL);
|
||||||
|
@ -1915,7 +1915,7 @@ void actionDamage(int tile, int elevation, int minDamage, int maxDamage, int dam
|
||||||
|
|
||||||
objectHide(attacker, NULL);
|
objectHide(attacker, NULL);
|
||||||
|
|
||||||
attacker->flags |= OBJECT_TEMPORARY;
|
attacker->flags |= OBJECT_NO_SAVE;
|
||||||
|
|
||||||
objectSetLocation(attacker, tile, elevation, NULL);
|
objectSetLocation(attacker, tile, elevation, NULL);
|
||||||
|
|
||||||
|
|
|
@ -3248,7 +3248,7 @@ int _gdialog_barter_create_win()
|
||||||
_barterer_table_obj->flags |= OBJECT_HIDDEN;
|
_barterer_table_obj->flags |= OBJECT_HIDDEN;
|
||||||
|
|
||||||
if (objectCreateWithFidPid(&_barterer_temp_obj, gGameDialogSpeaker->fid, -1) != -1) {
|
if (objectCreateWithFidPid(&_barterer_temp_obj, gGameDialogSpeaker->fid, -1) != -1) {
|
||||||
_barterer_temp_obj->flags |= OBJECT_HIDDEN | OBJECT_TEMPORARY;
|
_barterer_temp_obj->flags |= OBJECT_HIDDEN | OBJECT_NO_SAVE;
|
||||||
_barterer_temp_obj->sid = -1;
|
_barterer_temp_obj->sid = -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1976,13 +1976,13 @@ int gameMouseObjectsInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
gGameMouseBouncingCursor->flags |= OBJECT_LIGHT_THRU;
|
gGameMouseBouncingCursor->flags |= OBJECT_LIGHT_THRU;
|
||||||
gGameMouseBouncingCursor->flags |= OBJECT_TEMPORARY;
|
gGameMouseBouncingCursor->flags |= OBJECT_NO_SAVE;
|
||||||
gGameMouseBouncingCursor->flags |= OBJECT_NO_REMOVE;
|
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_NO_REMOVE;
|
gGameMouseHexCursor->flags |= OBJECT_NO_REMOVE;
|
||||||
gGameMouseHexCursor->flags |= OBJECT_TEMPORARY;
|
gGameMouseHexCursor->flags |= OBJECT_NO_SAVE;
|
||||||
gGameMouseHexCursor->flags |= OBJECT_LIGHT_THRU;
|
gGameMouseHexCursor->flags |= OBJECT_LIGHT_THRU;
|
||||||
gGameMouseHexCursor->flags |= OBJECT_SHOOT_THRU;
|
gGameMouseHexCursor->flags |= OBJECT_SHOOT_THRU;
|
||||||
gGameMouseHexCursor->flags |= OBJECT_NO_BLOCK;
|
gGameMouseHexCursor->flags |= OBJECT_NO_BLOCK;
|
||||||
|
@ -2038,8 +2038,8 @@ void gameMouseObjectsFree()
|
||||||
if (gGameMouseObjectsInitialized) {
|
if (gGameMouseObjectsInitialized) {
|
||||||
gameMouseActionMenuFree();
|
gameMouseActionMenuFree();
|
||||||
|
|
||||||
gGameMouseBouncingCursor->flags &= ~OBJECT_TEMPORARY;
|
gGameMouseBouncingCursor->flags &= ~OBJECT_NO_SAVE;
|
||||||
gGameMouseHexCursor->flags &= ~OBJECT_TEMPORARY;
|
gGameMouseHexCursor->flags &= ~OBJECT_NO_SAVE;
|
||||||
|
|
||||||
objectDestroy(gGameMouseBouncingCursor, NULL);
|
objectDestroy(gGameMouseBouncingCursor, NULL);
|
||||||
objectDestroy(gGameMouseHexCursor, NULL);
|
objectDestroy(gGameMouseHexCursor, NULL);
|
||||||
|
|
|
@ -1030,7 +1030,7 @@ static void opDestroyObject(Program* program)
|
||||||
|
|
||||||
if (isSelf) {
|
if (isSelf) {
|
||||||
object->sid = -1;
|
object->sid = -1;
|
||||||
object->flags |= (OBJECT_HIDDEN | OBJECT_TEMPORARY);
|
object->flags |= (OBJECT_HIDDEN | OBJECT_NO_SAVE);
|
||||||
} else {
|
} else {
|
||||||
reg_anim_clear(object);
|
reg_anim_clear(object);
|
||||||
objectDestroy(object, NULL);
|
objectDestroy(object, NULL);
|
||||||
|
@ -4485,7 +4485,7 @@ static void opDestroyMultipleObjects(Program* program)
|
||||||
|
|
||||||
if (isSelf) {
|
if (isSelf) {
|
||||||
object->sid = -1;
|
object->sid = -1;
|
||||||
object->flags |= (OBJECT_HIDDEN | OBJECT_TEMPORARY);
|
object->flags |= (OBJECT_HIDDEN | OBJECT_NO_SAVE);
|
||||||
} else {
|
} else {
|
||||||
reg_anim_clear(object);
|
reg_anim_clear(object);
|
||||||
objectDestroy(object, NULL);
|
objectDestroy(object, NULL);
|
||||||
|
|
|
@ -953,7 +953,7 @@ static int mapLoad(File* stream)
|
||||||
Object* object;
|
Object* object;
|
||||||
int fid = buildFid(OBJ_TYPE_MISC, 12, 0, 0, 0);
|
int fid = buildFid(OBJ_TYPE_MISC, 12, 0, 0, 0);
|
||||||
objectCreateWithFidPid(&object, fid, -1);
|
objectCreateWithFidPid(&object, fid, -1);
|
||||||
object->flags |= (OBJECT_LIGHT_THRU | OBJECT_TEMPORARY | OBJECT_HIDDEN);
|
object->flags |= (OBJECT_LIGHT_THRU | OBJECT_NO_SAVE | OBJECT_HIDDEN);
|
||||||
objectSetLocation(object, 1, 0, NULL);
|
objectSetLocation(object, 1, 0, NULL);
|
||||||
object->sid = gMapSid;
|
object->sid = gMapSid;
|
||||||
scriptSetFixedParam(gMapSid, (gMapHeader.flags & 1) == 0);
|
scriptSetFixedParam(gMapSid, (gMapHeader.flags & 1) == 0);
|
||||||
|
@ -1361,7 +1361,7 @@ static int _map_save_file(File* stream)
|
||||||
Object* object = objectFindFirstAtElevation(elevation);
|
Object* object = objectFindFirstAtElevation(elevation);
|
||||||
if (object != NULL) {
|
if (object != NULL) {
|
||||||
// TODO: Implementation is slightly different, check in debugger.
|
// TODO: Implementation is slightly different, check in debugger.
|
||||||
while (object != NULL && (object->flags & OBJECT_TEMPORARY)) {
|
while (object != NULL && (object->flags & OBJECT_NO_SAVE)) {
|
||||||
object = objectFindNextAtElevation();
|
object = objectFindNextAtElevation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1637,7 +1637,7 @@ static void _map_place_dude_and_mouse()
|
||||||
}
|
}
|
||||||
|
|
||||||
objectSetLight(gDude, 4, 0x10000, 0);
|
objectSetLight(gDude, 4, 0x10000, 0);
|
||||||
gDude->flags |= OBJECT_TEMPORARY;
|
gDude->flags |= OBJECT_NO_SAVE;
|
||||||
|
|
||||||
_dude_stand(gDude, gDude->rotation, gDude->fid);
|
_dude_stand(gDude, gDude->rotation, gDude->fid);
|
||||||
_partyMemberSyncPosition();
|
_partyMemberSyncPosition();
|
||||||
|
|
|
@ -44,7 +44,18 @@ typedef enum OutlineType {
|
||||||
|
|
||||||
typedef enum ObjectFlags {
|
typedef enum ObjectFlags {
|
||||||
OBJECT_HIDDEN = 0x01,
|
OBJECT_HIDDEN = 0x01,
|
||||||
OBJECT_TEMPORARY = 0x04,
|
|
||||||
|
// Specifies that the object should not be saved to the savegame file.
|
||||||
|
//
|
||||||
|
// This flag is used in these situations:
|
||||||
|
// - To prevent saving of system objects like dude (which has separate
|
||||||
|
// saving routine), egg, mouse cursors, etc.
|
||||||
|
// - To prevent saving of temporary objects (projectiles, explosion
|
||||||
|
// effects, etc.).
|
||||||
|
// - To prevent saving of objects which cannot be removed for some reason,
|
||||||
|
// like objects trying to delete themselves from scripting engine (used
|
||||||
|
// together with `OBJECT_HIDDEN` to prevent affecting game world).
|
||||||
|
OBJECT_NO_SAVE = 0x04,
|
||||||
OBJECT_FLAT = 0x08,
|
OBJECT_FLAT = 0x08,
|
||||||
OBJECT_NO_BLOCK = 0x10,
|
OBJECT_NO_BLOCK = 0x10,
|
||||||
OBJECT_LIGHTING = 0x20,
|
OBJECT_LIGHTING = 0x20,
|
||||||
|
|
|
@ -337,7 +337,7 @@ int objectsInit(unsigned char* buf, int width, int height, int pitch)
|
||||||
objectCreateWithFidPid(&gDude, dudeFid, 0x1000000);
|
objectCreateWithFidPid(&gDude, dudeFid, 0x1000000);
|
||||||
|
|
||||||
gDude->flags |= OBJECT_NO_REMOVE;
|
gDude->flags |= OBJECT_NO_REMOVE;
|
||||||
gDude->flags |= OBJECT_TEMPORARY;
|
gDude->flags |= OBJECT_NO_SAVE;
|
||||||
gDude->flags |= OBJECT_HIDDEN;
|
gDude->flags |= OBJECT_HIDDEN;
|
||||||
gDude->flags |= OBJECT_LIGHT_THRU;
|
gDude->flags |= OBJECT_LIGHT_THRU;
|
||||||
objectSetLight(gDude, 4, 0x10000, NULL);
|
objectSetLight(gDude, 4, 0x10000, NULL);
|
||||||
|
@ -350,7 +350,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_NO_REMOVE;
|
gEgg->flags |= OBJECT_NO_REMOVE;
|
||||||
gEgg->flags |= OBJECT_TEMPORARY;
|
gEgg->flags |= OBJECT_NO_SAVE;
|
||||||
gEgg->flags |= OBJECT_HIDDEN;
|
gEgg->flags |= OBJECT_HIDDEN;
|
||||||
gEgg->flags |= OBJECT_LIGHT_THRU;
|
gEgg->flags |= OBJECT_LIGHT_THRU;
|
||||||
|
|
||||||
|
@ -690,7 +690,7 @@ int objectSaveAll(File* stream)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((object->flags & OBJECT_TEMPORARY) != 0) {
|
if ((object->flags & OBJECT_NO_SAVE) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3523,7 +3523,7 @@ static void _obj_blend_table_exit()
|
||||||
// 0x48D348
|
// 0x48D348
|
||||||
static int _obj_save_obj(File* stream, Object* object)
|
static int _obj_save_obj(File* stream, Object* object)
|
||||||
{
|
{
|
||||||
if ((object->flags & OBJECT_TEMPORARY) != 0) {
|
if ((object->flags & OBJECT_NO_SAVE) != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3561,7 +3561,7 @@ static int _obj_save_obj(File* stream, Object* object)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((inventoryItem->item->flags & OBJECT_TEMPORARY) != 0) {
|
if ((inventoryItem->item->flags & OBJECT_NO_SAVE) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3645,13 +3645,13 @@ int _obj_save_dude(File* stream)
|
||||||
{
|
{
|
||||||
int field_78 = gDude->sid;
|
int field_78 = gDude->sid;
|
||||||
|
|
||||||
gDude->flags &= ~OBJECT_TEMPORARY;
|
gDude->flags &= ~OBJECT_NO_SAVE;
|
||||||
gDude->sid = -1;
|
gDude->sid = -1;
|
||||||
|
|
||||||
int rc = _obj_save_obj(stream, gDude);
|
int rc = _obj_save_obj(stream, gDude);
|
||||||
|
|
||||||
gDude->sid = field_78;
|
gDude->sid = field_78;
|
||||||
gDude->flags |= OBJECT_TEMPORARY;
|
gDude->flags |= OBJECT_NO_SAVE;
|
||||||
|
|
||||||
if (fileWriteInt32(stream, gCenterTile) == -1) {
|
if (fileWriteInt32(stream, gCenterTile) == -1) {
|
||||||
fileClose(stream);
|
fileClose(stream);
|
||||||
|
@ -3677,7 +3677,7 @@ int _obj_load_dude(File* stream)
|
||||||
|
|
||||||
memcpy(gDude, temp, sizeof(*gDude));
|
memcpy(gDude, temp, sizeof(*gDude));
|
||||||
|
|
||||||
gDude->flags |= OBJECT_TEMPORARY;
|
gDude->flags |= OBJECT_NO_SAVE;
|
||||||
|
|
||||||
scriptsClearDudeScript();
|
scriptsClearDudeScript();
|
||||||
|
|
||||||
|
|
|
@ -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_NO_REMOVE | OBJECT_TEMPORARY);
|
object->flags |= (OBJECT_NO_REMOVE | OBJECT_NO_SAVE);
|
||||||
|
|
||||||
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_NO_REMOVE | OBJECT_TEMPORARY);
|
object->flags &= ~(OBJECT_NO_REMOVE | OBJECT_NO_SAVE);
|
||||||
|
|
||||||
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_NO_REMOVE | OBJECT_TEMPORARY);
|
ptr->object->flags &= ~(OBJECT_NO_REMOVE | OBJECT_NO_SAVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
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_NO_REMOVE | OBJECT_TEMPORARY);
|
ptr->object->flags |= (OBJECT_NO_REMOVE | OBJECT_NO_SAVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Script* script;
|
Script* script;
|
||||||
|
|
Loading…
Reference in New Issue