Skip to content

Commit 727e74f

Browse files
committed
port InitialiseLOTArray
1 parent ee0b2bd commit 727e74f

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed

src/data.h

+3
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@
3636
#define NextFxFree VAR_U_(0x0045EE74, int16_t)
3737
#define NextFxActive VAR_U_(0x0045EE7A, int16_t)
3838
#define SaveGame ARRAY_(0x0045B9C0, SAVEGAME_INFO, [2])
39+
#define BaddieSlots VAR_U_(0x0045ED64, CREATURE_INFO*)
40+
#define SlotsUsed VAR_U_(0x0045A1F8, int)
41+
#define NumberBoxes VAR_U_(0x00462DA0, int)
3942

4043
#endif

src/func.c

+15
Original file line numberDiff line numberDiff line change
@@ -521,3 +521,18 @@ void __cdecl InitialiseFXArray() {
521521
}
522522
fx->next_fx = NO_ITEM;
523523
}
524+
525+
void __cdecl InitialiseLOTArray() {
526+
TRACE("");
527+
BaddieSlots = game_malloc(
528+
NUM_SLOTS * sizeof(CREATURE_INFO), GBUF_CreatureData
529+
);
530+
CREATURE_INFO *creature = BaddieSlots;
531+
for (int i = 0; i < NUM_SLOTS; i++, creature++) {
532+
creature->item_num = NO_ITEM;
533+
creature->LOT.node = game_malloc(
534+
sizeof(BOX_NODE) * NumberBoxes, GBUF_CreatureLot
535+
);
536+
}
537+
SlotsUsed = 0;
538+
}

src/func.h

+1
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ int __cdecl S_DrawHealthBar(int percent);
4242
int __cdecl LoadItems(FILE *handle);
4343
void __cdecl InitialiseLara();
4444
void __cdecl InitialiseFXArray();
45+
void __cdecl InitialiseLOTArray();
4546

4647
#endif

src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static void tr1m_inject() {
2222
INJECT(0x0041AF90, S_LoadLevel);
2323
INJECT(0x0041D5A0, LevelStats);
2424
INJECT(0x00422250, InitialiseFXArray);
25+
INJECT(0x0042A300, InitialiseLOTArray);
2526

2627
//INJECT(0x00402710, my_ins_line);
2728

src/struct.h

+23
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ typedef uint16_t PHD_ANGLE;
88
typedef uint32_t SG_COL;
99
typedef void UNKNOWN_STRUCT;
1010

11+
#define NUM_SLOTS 8
1112
#define MAX_ROOMS 1024
1213
#define NUMBER_ITEMS 256
1314
#define MAX_SECRETS 16
@@ -99,6 +100,13 @@ typedef enum {
99100
AS_WATEROU = 55,
100101
} LARA_STATES;
101102

103+
typedef enum {
104+
BORED_MOOD,
105+
ATTACK_MOOD,
106+
ESCAPE_MOOD,
107+
STALK_MOOD
108+
} MOOD_TYPE;
109+
102110
typedef enum {
103111
GBUF_RoomInfos = 11,
104112
GBUF_RoomMesh = 12,
@@ -108,6 +116,8 @@ typedef enum {
108116
GBUF_RoomStaticMeshInfos = 16,
109117
GBUF_FloorData = 17,
110118
GBUF_Items = 18,
119+
GBUF_CreatureData = 33,
120+
GBUF_CreatureLot = 34,
111121
} GAMEALLOC_BUFFER;
112122

113123
typedef enum {
@@ -468,6 +478,19 @@ typedef struct {
468478
/* 0038 end */
469479
} TEXTSTRING;
470480

481+
typedef struct {
482+
/* 0000 */ int16_t head_rotation;
483+
/* 0002 */ int16_t neck_rotation;
484+
/* 0004 */ int16_t maximum_turn;
485+
/* 0006 */ uint16_t flags;
486+
/* 0008 */ int16_t item_num;
487+
/* 000A */ int32_t mood;
488+
/* 000E */ LOT_INFO LOT;
489+
/* 002C */ PHD_VECTOR target;
490+
/* 0032 */ uint8_t pad[12];
491+
/* 003E end */
492+
} CREATURE_INFO;
493+
471494
#pragma pop
472495

473496
#endif

0 commit comments

Comments
 (0)