diff --git a/src/data.h b/src/data.h index 0b5fcf2da..fb01231f3 100644 --- a/src/data.h +++ b/src/data.h @@ -36,5 +36,8 @@ #define NextFxFree VAR_U_(0x0045EE74, int16_t) #define NextFxActive VAR_U_(0x0045EE7A, int16_t) #define SaveGame ARRAY_(0x0045B9C0, SAVEGAME_INFO, [2]) +#define BaddieSlots VAR_U_(0x0045ED64, CREATURE_INFO*) +#define SlotsUsed VAR_U_(0x0045A1F8, int) +#define NumberBoxes VAR_U_(0x00462DA0, int) #endif diff --git a/src/func.c b/src/func.c index baf0a8e01..cec4976ca 100644 --- a/src/func.c +++ b/src/func.c @@ -521,3 +521,18 @@ void __cdecl InitialiseFXArray() { } fx->next_fx = NO_ITEM; } + +void __cdecl InitialiseLOTArray() { + TRACE(""); + BaddieSlots = game_malloc( + NUM_SLOTS * sizeof(CREATURE_INFO), GBUF_CreatureData + ); + CREATURE_INFO *creature = BaddieSlots; + for (int i = 0; i < NUM_SLOTS; i++, creature++) { + creature->item_num = NO_ITEM; + creature->LOT.node = game_malloc( + sizeof(BOX_NODE) * NumberBoxes, GBUF_CreatureLot + ); + } + SlotsUsed = 0; +} diff --git a/src/func.h b/src/func.h index 2e38992a8..6d34ba2c2 100644 --- a/src/func.h +++ b/src/func.h @@ -42,5 +42,6 @@ int __cdecl S_DrawHealthBar(int percent); int __cdecl LoadItems(FILE *handle); void __cdecl InitialiseLara(); void __cdecl InitialiseFXArray(); +void __cdecl InitialiseLOTArray(); #endif diff --git a/src/main.c b/src/main.c index 4f81d661b..9052c33c9 100755 --- a/src/main.c +++ b/src/main.c @@ -22,6 +22,7 @@ static void tr1m_inject() { INJECT(0x0041AF90, S_LoadLevel); INJECT(0x0041D5A0, LevelStats); INJECT(0x00422250, InitialiseFXArray); + INJECT(0x0042A300, InitialiseLOTArray); //INJECT(0x00402710, my_ins_line); diff --git a/src/struct.h b/src/struct.h index 8c7f7256b..49cc70eed 100644 --- a/src/struct.h +++ b/src/struct.h @@ -8,6 +8,7 @@ typedef uint16_t PHD_ANGLE; typedef uint32_t SG_COL; typedef void UNKNOWN_STRUCT; +#define NUM_SLOTS 8 #define MAX_ROOMS 1024 #define NUMBER_ITEMS 256 #define MAX_SECRETS 16 @@ -99,6 +100,13 @@ typedef enum { AS_WATEROU = 55, } LARA_STATES; +typedef enum { + BORED_MOOD, + ATTACK_MOOD, + ESCAPE_MOOD, + STALK_MOOD +} MOOD_TYPE; + typedef enum { GBUF_RoomInfos = 11, GBUF_RoomMesh = 12, @@ -108,6 +116,8 @@ typedef enum { GBUF_RoomStaticMeshInfos = 16, GBUF_FloorData = 17, GBUF_Items = 18, + GBUF_CreatureData = 33, + GBUF_CreatureLot = 34, } GAMEALLOC_BUFFER; typedef enum { @@ -468,6 +478,19 @@ typedef struct { /* 0038 end */ } TEXTSTRING; +typedef struct { + /* 0000 */ int16_t head_rotation; + /* 0002 */ int16_t neck_rotation; + /* 0004 */ int16_t maximum_turn; + /* 0006 */ uint16_t flags; + /* 0008 */ int16_t item_num; + /* 000A */ int32_t mood; + /* 000E */ LOT_INFO LOT; + /* 002C */ PHD_VECTOR target; + /* 0032 */ uint8_t pad[12]; + /* 003E end */ +} CREATURE_INFO; + #pragma pop #endif