Skip to content

Commit

Permalink
setup: move to objects
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Sep 12, 2024
1 parent 5e6ec68 commit 453d1ed
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ sources = [
'src/game/objects/general/trapdoor.c',
'src/game/objects/general/waterfall.c',
'src/game/objects/names.c',
'src/game/objects/setup.c',
'src/game/objects/traps/damocles_sword.c',
'src/game/objects/traps/dart.c',
'src/game/objects/traps/dart_emitter.c',
Expand Down Expand Up @@ -258,7 +259,6 @@ sources = [
'src/game/savegame/savegame_bson.c',
'src/game/savegame/savegame_legacy.c',
'src/game/screen.c',
'src/game/setup.c',
'src/game/shell.c',
'src/game/sound.c',
'src/game/stats.c',
Expand Down
4 changes: 2 additions & 2 deletions src/game/level.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#include "game/lot.h"
#include "game/music.h"
#include "game/objects/creatures/pierre.h"
#include "game/objects/setup.h"
#include "game/output.h"
#include "game/overlay.h"
#include "game/room.h"
#include "game/setup.h"
#include "game/shell.h"
#include "game/sound.h"
#include "game/stats.h"
Expand Down Expand Up @@ -905,7 +905,7 @@ static void Level_CompleteSetup(int32_t level_num)
Stats_ObserveRoomsLoad();

// Must be called after all g_Anims, g_Meshes etc initialised.
Setup_AllObjects();
Object_SetupAllObjects();

// Must be called after Setup_AllObjects using the cached item
// count, as individual setups may increment g_LevelItemCount.
Expand Down
20 changes: 11 additions & 9 deletions src/game/setup.c → src/game/objects/setup.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "game/setup.h"
#include "game/objects/setup.h"

#include "config.h"
#include "game/lara.h"
Expand Down Expand Up @@ -85,9 +85,11 @@
#include "global/types.h"
#include "global/vars.h"

#include <stddef.h>
static void Object_SetupCreatures(void);
static void Object_SetupTraps(void);
static void Object_SetupMiscObjects(void);

void Setup_Creatures(void)
static void Object_SetupCreatures(void)
{
g_Objects[O_LARA].initialise = Lara_InitialiseLoad;
g_Objects[O_LARA].draw_routine = Object_DrawDummyItem;
Expand Down Expand Up @@ -131,7 +133,7 @@ void Setup_Creatures(void)
Statue_Setup(&g_Objects[O_STATUE]);
}

void Setup_Traps(void)
static void Object_SetupTraps(void)
{
FallingBlock_Setup(&g_Objects[O_FALLING_BLOCK]);
Pendulum_Setup(&g_Objects[O_PENDULUM]);
Expand Down Expand Up @@ -160,7 +162,7 @@ void Setup_Traps(void)
LavaWedge_Setup(&g_Objects[O_LAVA_WEDGE]);
}

void Setup_MiscObjects(void)
static void Object_SetupMiscObjects(void)
{
CameraTarget_Setup(&g_Objects[O_CAMERA_TARGET]);
BridgeFlat_Setup(&g_Objects[O_BRIDGE_FLAT]);
Expand Down Expand Up @@ -251,7 +253,7 @@ void Setup_MiscObjects(void)
GunShot_Setup(&g_Objects[O_GUN_FLASH]);
}

void Setup_AllObjects(void)
void Object_SetupAllObjects(void)
{
for (int i = 0; i < O_NUMBER_OF; i++) {
OBJECT_INFO *obj = &g_Objects[i];
Expand All @@ -272,9 +274,9 @@ void Setup_AllObjects(void)
obj->hit_points = DONT_TARGET;
}

Setup_Creatures();
Setup_Traps();
Setup_MiscObjects();
Object_SetupCreatures();
Object_SetupTraps();
Object_SetupMiscObjects();

Lara_Hair_Initialise();

Expand Down
5 changes: 5 additions & 0 deletions src/game/objects/setup.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#include "global/types.h"

void Object_SetupAllObjects(void);
8 changes: 0 additions & 8 deletions src/game/setup.h

This file was deleted.

0 comments on commit 453d1ed

Please sign in to comment.