Skip to content

Commit

Permalink
port InitialiseLOTArray
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Feb 9, 2021
1 parent ee0b2bd commit 727e74f
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions src/func.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions src/func.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
23 changes: 23 additions & 0 deletions src/struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand Down Expand Up @@ -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

0 comments on commit 727e74f

Please sign in to comment.