objects: raise static mesh slot capacity

This raises the static mesh slot capacity from 50 to 256. 2D statics
remain fixed at 50 for the time being.

Resolves #2734.
This commit is contained in:
lahm86 2025-04-12 10:09:49 +01:00
parent adf2703305
commit c69fe9c891
15 changed files with 32 additions and 31 deletions

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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];

View file

@ -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;

View file

@ -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

View file

@ -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);

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -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);