diff --git a/docs/tr1/CHANGELOG.md b/docs/tr1/CHANGELOG.md index 7c9fd66f8..fd7753c97 100644 --- a/docs/tr1/CHANGELOG.md +++ b/docs/tr1/CHANGELOG.md @@ -9,6 +9,7 @@ DOS | 153 | 179 | 255 | ![#99B3FF](https://placehold.co/15x15/99B3FF/99B3FF.png) `#99B3FF` - changed the `draw_distance_min` and `draw_distance_max` to `fog_start` and `fog_end` - changed `Select Detail` dialog title to `Graphic Options` +- changed the number of static mesh slots from 50 to 256 (#2734) - fixed the bilinear filter to not readjust the UVs (#2258) - fixed anisotropy filter causing black lines on certain GPUs (#902) - fixed mesh faces not being drawn under some circumstances (#2452, #2438) diff --git a/docs/tr1/README.md b/docs/tr1/README.md index cfd199eea..aad569141 100644 --- a/docs/tr1/README.md +++ b/docs/tr1/README.md @@ -636,6 +636,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det - expanded maximum texture pages from 32 to 128 - expanded maximum vertices of a single drawable object from 1500 to unlimited - expanded the number of visible enemies from 8 to 32 +- expanded the number of static mesh slots from 50 to 256 - ported audio decoding library to ffmpeg - ported video decoding library to ffmpeg - ported image decoding library to ffmpeg diff --git a/docs/tr2/CHANGELOG.md b/docs/tr2/CHANGELOG.md index 55f42608a..517f21750 100644 --- a/docs/tr2/CHANGELOG.md +++ b/docs/tr2/CHANGELOG.md @@ -9,6 +9,7 @@ - added NG+, Japanese, and Japanese NG+ game mode options to the New Game page in the passport (#2731) - 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) - fixed the inability to completely mute the sounds, even at sound volume 0 (#2722) - fixed the final two levels not allowing for secrets to be counted in the statistics (#1582) - fixed Lara's holsters being empty if a game flow level removes all weapons but also re-adds the pistols (#2677) diff --git a/docs/tr2/README.md b/docs/tr2/README.md index 45b9b2c46..e02339990 100644 --- a/docs/tr2/README.md +++ b/docs/tr2/README.md @@ -324,6 +324,7 @@ as Notepad. - expanded maximum object textures from 2048 to unlimited (within game's overall memory cap) - expanded maximum sprite textures from 512 to unlimited (within game's overall memory cap) - expanded maximum texture pages from 32 to 128 +- expanded the number of static mesh slots from 50 to 256 - ported audio decoding library to ffmpeg - ported video decoding library to ffmpeg - ported input backend to SDL diff --git a/src/libtrx/game/inject/data/textures.c b/src/libtrx/game/inject/data/textures.c index 218bb32a9..f970ad9d9 100644 --- a/src/libtrx/game/inject/data/textures.c +++ b/src/libtrx/game/inject/data/textures.c @@ -147,7 +147,7 @@ static void M_HandleSpriteSequences( obj->mesh_count = num_meshes; obj->mesh_idx = mesh_idx + level_info->textures.sprite_count; obj->loaded = true; - } else if (obj_id - O_NUMBER_OF < MAX_STATIC_OBJECTS) { + } else if (obj_id - O_NUMBER_OF < MAX_STATIC_OBJECTS_2D) { STATIC_OBJECT_2D *const obj = Object_Get2DStatic(obj_id - O_NUMBER_OF); obj->frame_count = ABS(num_meshes); diff --git a/src/libtrx/game/inject/editors/meshes.c b/src/libtrx/game/inject/editors/meshes.c index 9544fae4b..a26fc7d7d 100644 --- a/src/libtrx/game/inject/editors/meshes.c +++ b/src/libtrx/game/inject/editors/meshes.c @@ -104,7 +104,7 @@ static void M_ApplyMeshEdit(const MESH_EDIT *const edit) } mesh = Object_GetMesh(obj->mesh_idx + edit->mesh_idx); - } else if (edit->object_id - O_NUMBER_OF < MAX_STATIC_OBJECTS) { + } else if (edit->object_id - O_NUMBER_OF < MAX_STATIC_OBJECTS_3D) { const STATIC_OBJECT_3D *const obj = Object_Get3DStatic(edit->object_id - O_NUMBER_OF); mesh = Object_GetMesh(obj->mesh_idx); diff --git a/src/libtrx/game/level/common.c b/src/libtrx/game/level/common.c index b0183ba82..d3dbc3b4d 100644 --- a/src/libtrx/game/level/common.c +++ b/src/libtrx/game/level/common.c @@ -842,10 +842,10 @@ void Level_ReadStaticObjects(VFILE *const file) LOG_INFO("static objects: %d", num_objects); for (int32_t i = 0; i < num_objects; i++) { const int32_t static_id = VFile_ReadS32(file); - if (static_id < 0 || static_id >= MAX_STATIC_OBJECTS) { + if (static_id < 0 || static_id >= MAX_STATIC_OBJECTS_3D) { Shell_ExitSystemFmt( "Invalid static ID: %d (max=%d)", static_id, - MAX_STATIC_OBJECTS); + MAX_STATIC_OBJECTS_3D - 1); } STATIC_OBJECT_3D *const obj = Object_Get3DStatic(static_id); @@ -936,7 +936,7 @@ void Level_ReadSpriteSequences(VFILE *const file) obj->mesh_idx = mesh_idx; obj->anim_idx = NO_ANIM; obj->loaded = true; - } else if (object_id - O_NUMBER_OF < MAX_STATIC_OBJECTS) { + } else if (object_id - O_NUMBER_OF < MAX_STATIC_OBJECTS_2D) { STATIC_OBJECT_2D *const obj = Object_Get2DStatic(object_id - O_NUMBER_OF); obj->frame_count = ABS(num_meshes); diff --git a/src/libtrx/game/objects/common.c b/src/libtrx/game/objects/common.c index f6d0dbca4..58592ed3c 100644 --- a/src/libtrx/game/objects/common.c +++ b/src/libtrx/game/objects/common.c @@ -9,11 +9,24 @@ #include "game/output/objects.h" static OBJECT m_Objects[O_NUMBER_OF] = {}; -static STATIC_OBJECT_3D m_StaticObjects3D[MAX_STATIC_OBJECTS] = {}; -static STATIC_OBJECT_2D m_StaticObjects2D[MAX_STATIC_OBJECTS] = {}; +static STATIC_OBJECT_3D m_StaticObjects3D[MAX_STATIC_OBJECTS_3D] = {}; +static STATIC_OBJECT_2D m_StaticObjects2D[MAX_STATIC_OBJECTS_2D] = {}; static OBJECT_MESH **m_MeshPointers = nullptr; static int32_t m_MeshCount = 0; +void Object_Reset(void) +{ + for (int32_t i = 0; i < O_NUMBER_OF; i++) { + m_Objects[i].loaded = false; + } + for (int32_t i = 0; i < MAX_STATIC_OBJECTS_3D; i++) { + m_StaticObjects3D[i].loaded = false; + } + for (int32_t i = 0; i < MAX_STATIC_OBJECTS_2D; i++) { + m_StaticObjects2D[i].loaded = false; + } +} + OBJECT *Object_Get(const GAME_OBJECT_ID obj_id) { return &m_Objects[obj_id]; diff --git a/src/libtrx/game/output/textures.c b/src/libtrx/game/output/textures.c index 886efecd4..01b78f7ac 100644 --- a/src/libtrx/game/output/textures.c +++ b/src/libtrx/game/output/textures.c @@ -216,7 +216,7 @@ void Output_CycleAnimatedTextures(void) m_ObjectTextures[range->textures[i]] = temp; } - for (int32_t i = 0; i < MAX_STATIC_OBJECTS; i++) { + for (int32_t i = 0; i < MAX_STATIC_OBJECTS_2D; i++) { const STATIC_OBJECT_2D *const obj = Object_Get2DStatic(i); if (!obj->loaded || obj->frame_count == 1) { continue; diff --git a/src/libtrx/include/libtrx/game/const.h b/src/libtrx/include/libtrx/game/const.h index 5b82588fd..2928947b5 100644 --- a/src/libtrx/include/libtrx/game/const.h +++ b/src/libtrx/include/libtrx/game/const.h @@ -14,4 +14,5 @@ #define GRAVITY 6 #define FAST_FALL_SPEED 128 -#define MAX_STATIC_OBJECTS 50 +#define MAX_STATIC_OBJECTS_2D 50 +#define MAX_STATIC_OBJECTS_3D 256 diff --git a/src/libtrx/include/libtrx/game/objects/common.h b/src/libtrx/include/libtrx/game/objects/common.h index bc21a76a1..fa31e7ace 100644 --- a/src/libtrx/include/libtrx/game/objects/common.h +++ b/src/libtrx/include/libtrx/game/objects/common.h @@ -7,6 +7,7 @@ #include "ids.h" #include "types.h" +void Object_Reset(void); OBJECT *Object_Get(GAME_OBJECT_ID obj_id); STATIC_OBJECT_3D *Object_Get3DStatic(int32_t static_id); STATIC_OBJECT_2D *Object_Get2DStatic(int32_t static_id); diff --git a/src/tr1/game/level.c b/src/tr1/game/level.c index 2dd488c98..a48129ffe 100644 --- a/src/tr1/game/level.c +++ b/src/tr1/game/level.c @@ -400,15 +400,7 @@ bool Level_Initialise( Music_ResetTrackFlags(); - /* Clear Object Loaded flags */ - for (int32_t i = 0; i < O_NUMBER_OF; i++) { - Object_Get(i)->loaded = false; - } - for (int32_t i = 0; i < MAX_STATIC_OBJECTS; i++) { - Object_Get2DStatic(i)->loaded = false; - Object_Get3DStatic(i)->loaded = false; - } - + Object_Reset(); Camera_Reset(); Pierre_Reset(); diff --git a/src/tr1/game/output/textures.c b/src/tr1/game/output/textures.c index 30bf882ed..71f90c6cc 100644 --- a/src/tr1/game/output/textures.c +++ b/src/tr1/game/output/textures.c @@ -71,7 +71,7 @@ static void M_PrepareObjectAnimationRanges(void) static void M_PrepareSpriteAnimationRanges(void) { size_t required_size = 0; - for (int32_t i = 0; i < MAX_STATIC_OBJECTS; i++) { + for (int32_t i = 0; i < MAX_STATIC_OBJECTS_2D; i++) { const STATIC_OBJECT_2D *const obj = Object_Get2DStatic(i); if (!obj->loaded || obj->frame_count == 1) { continue; @@ -82,7 +82,7 @@ static void M_PrepareSpriteAnimationRanges(void) Vector_Clear(m_AnimationRanges.sprites); Vector_EnsureCapacity(m_AnimationRanges.sprites, required_size); - for (int32_t i = 0; i < MAX_STATIC_OBJECTS; i++) { + for (int32_t i = 0; i < MAX_STATIC_OBJECTS_2D; i++) { const STATIC_OBJECT_2D *const obj = Object_Get2DStatic(i); if (!obj->loaded || obj->frame_count == 1) { continue; diff --git a/src/tr2/decomp/decomp.c b/src/tr2/decomp/decomp.c index 474718810..9d3b4287a 100644 --- a/src/tr2/decomp/decomp.c +++ b/src/tr2/decomp/decomp.c @@ -147,10 +147,6 @@ void DecreaseScreenSize(void) void InitialiseGameFlags(void) { Music_ResetTrackFlags(); - for (GAME_OBJECT_ID obj_id = 0; obj_id < O_NUMBER_OF; obj_id++) { - Object_Get(obj_id)->loaded = 0; - } - Output_SetSunsetTimer(0); g_LevelComplete = false; g_DetonateAllMines = false; diff --git a/src/tr2/game/level.c b/src/tr2/game/level.c index b3dda776f..bdba9e135 100644 --- a/src/tr2/game/level.c +++ b/src/tr2/game/level.c @@ -294,13 +294,7 @@ bool Level_Load(const GF_LEVEL *const level) Audio_Sample_CloseAll(); Audio_Sample_UnloadAll(); - for (int32_t i = 0; i < O_NUMBER_OF; i++) { - Object_Get(i)->loaded = false; - } - for (int32_t i = 0; i < MAX_STATIC_OBJECTS; i++) { - Object_Get2DStatic(i)->loaded = false; - Object_Get3DStatic(i)->loaded = false; - } + Object_Reset(); Inject_InitLevel(level);