mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
tr2/objects/waterfall: save waterfall flags
This updates waterfall objects to have their flags saved in order to be able to restore them correctly on load. Legacy saves will ignore this. Resolves #2686.
This commit is contained in:
parent
10f1bc6fbd
commit
0e24b65ae6
4 changed files with 12 additions and 2 deletions
|
@ -11,6 +11,7 @@
|
|||
- added BSON savegame support, removing the limits imposed by the OG 8KB file size, so allowing for storing more data and offering improved feature support (legacy save files can still be read, similar to TR1) (#2662)
|
||||
- added NG+, Japanese, and Japanese NG+ game mode options to the New Game page in the passport (#2731)
|
||||
- added the ability for spike walls to be reset (antitriggered)
|
||||
- added waterfalls to the savegame so that they now persist on load (#2686)
|
||||
- changed savegame files to be stored in the `saves` directory (#2087)
|
||||
- changed the default fog distance to 22 tiles cutting off at 30 tiles to match TR1X (#1622)
|
||||
- changed the number of static mesh slots from 50 to 256 (#2734)
|
||||
|
|
|
@ -180,6 +180,7 @@ as Notepad.
|
|||
- added a photo mode feature
|
||||
- added combined support for The Golden Mask
|
||||
- added NG+, Japanese, and Japanese NG+ game mode options to the New Game page in the passport
|
||||
- added waterfalls to the savegame so that they now persist on load
|
||||
- changed inventory to pause the music rather than muting it
|
||||
- fixed killing the T-Rex with a grenade launcher crashing the game
|
||||
- fixed secret rewards not displaying shotgun ammo
|
||||
|
|
|
@ -17,6 +17,7 @@ static void M_Setup(OBJECT *const obj)
|
|||
{
|
||||
obj->control_func = M_Control;
|
||||
obj->draw_func = Object_DrawDummyItem;
|
||||
obj->save_flags = 1;
|
||||
}
|
||||
|
||||
static void M_Control(const int16_t item_num)
|
||||
|
|
|
@ -45,6 +45,8 @@ typedef struct {
|
|||
static int32_t m_BufPos = 0;
|
||||
static char *m_BufPtr = nullptr;
|
||||
|
||||
static bool M_ItemHasSaveFlags(const OBJECT *obj, const ITEM *item);
|
||||
|
||||
static void M_Reset(char *buffer);
|
||||
|
||||
static void M_Read(void *ptr, size_t size);
|
||||
|
@ -93,6 +95,11 @@ static SAVEGAME_STRATEGY m_Strategy = {
|
|||
// clang-format on
|
||||
};
|
||||
|
||||
static bool M_ItemHasSaveFlags(const OBJECT *const obj, const ITEM *const item)
|
||||
{
|
||||
return obj->save_flags && item->object_id != O_WATERFALL;
|
||||
}
|
||||
|
||||
static void M_Reset(char *const buffer)
|
||||
{
|
||||
m_BufPos = 0;
|
||||
|
@ -224,7 +231,7 @@ static void M_ReadItems(void)
|
|||
item->hit_points = M_ReadS16();
|
||||
}
|
||||
|
||||
if (obj->save_flags) {
|
||||
if (M_ItemHasSaveFlags(obj, item)) {
|
||||
item->flags = M_ReadU16();
|
||||
|
||||
if (obj->intelligent) {
|
||||
|
@ -507,7 +514,7 @@ static void M_WriteItems(void)
|
|||
M_WriteS16(item->hit_points);
|
||||
}
|
||||
|
||||
if (obj->save_flags) {
|
||||
if (M_ItemHasSaveFlags(obj, item)) {
|
||||
uint16_t flags = item->flags + item->active + (item->status << 1)
|
||||
+ (item->gravity << 3) + (item->collidable << 4);
|
||||
if (obj->intelligent && item->data != nullptr) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue