Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
port Item_Create
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Nov 6, 2023
1 parent 2e91821 commit 50930e8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
16 changes: 8 additions & 8 deletions docs/progress.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/progress.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ typedef enum LARA_MESH {
# game/items.c
00426CF0 00000052 + void __cdecl Item_InitialiseArray(int32_t num_items);
00426D50 0000011E + void __cdecl Item_Kill(int16_t item_num);
00426E70 00000039 - int16_t __cdecl Item_Create(void);
00426E70 00000039 + int16_t __cdecl Item_Create(void);
00426EB0 000001B3 - void __cdecl Item_Initialise(int16_t item_num);
00427070 0000008A - void __cdecl Item_RemoveActive(int16_t item_num);
00427100 0000006F - void __cdecl Item_RemoveDrawn(int16_t item_num);
Expand Down
10 changes: 10 additions & 0 deletions src/game/items.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ void __cdecl Item_InitialiseArray(const int32_t num_items)
g_Items[num_items - 1].next_item = NO_ITEM;
}

int16_t __cdecl Item_Create(void)
{
const int16_t result = g_NextItemFree;
if (result != NO_ITEM) {
g_Items[result].flags = 0;
g_NextItemFree = g_Items[result].next_item;
}
return result;
}

void __cdecl Item_Kill(const int16_t item_num)
{
struct ITEM_INFO *const item = &g_Items[item_num];
Expand Down
1 change: 1 addition & 0 deletions src/game/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "global/types.h"

void __cdecl Item_InitialiseArray(int32_t num_items);
int16_t __cdecl Item_Create(void);
void __cdecl Item_Kill(int16_t item_num);

bool Item_IsSmashable(const struct ITEM_INFO *item);
1 change: 0 additions & 1 deletion src/global/funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@
#define ShowGymStatsText ((void __cdecl (*)(char *time_str, int32_t type))0x00426340)
#define ShowStatsText ((void __cdecl (*)(char *time_str, int32_t type))0x00426520)
#define ShowEndStatsText ((void __cdecl (*)(void))0x004268C0)
#define Item_Create ((int16_t __cdecl (*)(void))0x00426E70)
#define Item_Initialise ((void __cdecl (*)(int16_t item_num))0x00426EB0)
#define Item_RemoveActive ((void __cdecl (*)(int16_t item_num))0x00427070)
#define Item_RemoveDrawn ((void __cdecl (*)(int16_t item_num))0x00427100)
Expand Down
1 change: 1 addition & 0 deletions src/inject_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ static void Inject_Items(void)
{
INJECT(1, 0x00426CF0, Item_InitialiseArray);
INJECT(1, 0x00426D50, Item_Kill);
INJECT(1, 0x00426E70, Item_Create);
}

static void Inject_LOS(void)
Expand Down

0 comments on commit 50930e8

Please sign in to comment.