Skip to content

Commit

Permalink
Add GAME_ADDR macro to remaining addresses in C files
Browse files Browse the repository at this point in the history
  • Loading branch information
Kewlan committed Apr 28, 2024
1 parent 697ef0d commit e8c03b7
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 30 deletions.
28 changes: 14 additions & 14 deletions code/include/z3D/z3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,22 +694,22 @@ typedef struct MainClass {
extern GlobalContext* gGlobalContext;
extern const u32 ItemSlots[];
extern const char DungeonNames[][25];
#define gSaveContext (*(SaveContext*)0x00587958)
#define gSaveContext (*(SaveContext*)GAME_ADDR(0x587958))
#define gStaticContext (*(StaticContext*)0x08080010)
#define gObjectTable ((ObjectFile*)0x53CCF4)
#define gEntranceTable ((EntranceInfo*)0x543BB8)
#define gItemUsabilityTable ((u8*)0x506C58)
#define gGearUsabilityTable ((u32*)0x4D47C8)
#define gDungeonSceneTable ((Scene*)0x4DC400)
#define gMQDungeonSceneTable ((Scene*)0x4DCBA8)
#define gSceneTable ((Scene*)0x545484)
#define gRandInt (*(u32*)0x50C0C4)
#define gRandFloat (*(f32*)0x50C0C8)
#define gDrawItemTable ((DrawItemTableEntry*)0x4D88C8)
#define gRestrictionFlags ((RestrictionFlags*)0x539DC4)
#define gObjectTable ((ObjectFile*)GAME_ADDR(0x53CCF4))
#define gEntranceTable ((EntranceInfo*)GAME_ADDR(0x543BB8))
#define gItemUsabilityTable ((u8*)GAME_ADDR(0x506C58))
#define gGearUsabilityTable ((u32*)GAME_ADDR(0x4D47C8))
#define gDungeonSceneTable ((Scene*)GAME_ADDR(0x4DC400))
#define gMQDungeonSceneTable ((Scene*)GAME_ADDR(0x4DCBA8))
#define gSceneTable ((Scene*)GAME_ADDR(0x545484))
#define gRandInt (*(u32*)GAME_ADDR(0x50C0C4))
#define gRandFloat (*(f32*)GAME_ADDR(0x50C0C8))
#define gDrawItemTable ((DrawItemTableEntry*)GAME_ADDR(0x4D88C8))
#define gRestrictionFlags ((RestrictionFlags*)GAME_ADDR(0x539DC4))
#define PLAYER ((Player*)gGlobalContext->actorCtx.actorList[ACTORTYPE_PLAYER].first)
#define gMainClass ((MainClass*)0x5BE5B8)
#define gIsBottomScreenDimmed (*(s32*)0x5043EC)
#define gMainClass ((MainClass*)GAME_ADDR(0x5BE5B8))
#define gIsBottomScreenDimmed (*(s32*)GAME_ADDR(0x5043EC))

#define GearSlot(X) (X - ITEM_SWORD_KOKIRI)

Expand Down
2 changes: 1 addition & 1 deletion code/include/z3D/z3Dactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ typedef struct ActorHeapNode {
} ActorHeapNode;

void Actor_Kill(Actor* actor);
#define gActorOverlayTable ((ActorOverlay*)0x50CD84)
#define gActorOverlayTable ((ActorOverlay*)GAME_ADDR(0x50CD84))

typedef u32 (*Actor_HasParent_proc)(Actor* actor, struct GlobalContext* globalCtx);
#define Actor_HasParent ((Actor_HasParent_proc)GAME_ADDR(0x371E40))
Expand Down
2 changes: 1 addition & 1 deletion code/src/actors/anju.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ u32 EnNiwLady_CheckCuccoAmount(u32 cuccosInPen) {
void EnNiwLady_rGiveCojiro(EnNiwLady* self, GlobalContext* globalCtx) {
if (Actor_HasParent(&self->actor, globalCtx)) {
gSaveContext.itemGetInf[2] |= 0x4000;
self->actionFunc = (EnNiwLady_ActionFunc)0x2389EC;
self->actionFunc = (EnNiwLady_ActionFunc)GAME_ADDR(0x2389EC);
} else {
GiveItem(&self->actor, globalCtx, GI_COJIRO, 200.0f, 100.0f);
}
Expand Down
2 changes: 1 addition & 1 deletion code/src/actors/checkable_spot.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

void EnWonderTalk_rUpdate(Actor* thisx, GlobalContext* globalCtx) {
EnWonderTalk* this = (EnWonderTalk*)thisx;
if (this->actionFunc == (ActorFunc)0x2065E0 && thisx->params == 0x0FFF) { // reading ToT altar
if (this->actionFunc == (ActorFunc)GAME_ADDR(0x2065E0) && thisx->params == 0x0FFF) { // reading ToT altar
gExtSaveData.extInf[EXTINF_TOTALTAR_FLAGS] |= (1 << gSaveContext.linkAge);
}
EnWonderTalk_Update(thisx, globalCtx);
Expand Down
11 changes: 6 additions & 5 deletions code/src/actors/door.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void EnDoor_Unlock(EnDoor* thisx) {
return;
}
thisx->action_fn = &EnDoor_Unlocking;
PlaySFX(0x10001D3, &thisx->base.world.pos, 4, (f32*)0x54AC20, (f32*)0x54AC20,
(s8*)0x54AC24); // NA_SE_EV_CHAIN_KEY_UNLOCK
PlaySFX(0x10001D3, &thisx->base.world.pos, 4, (f32*)GAME_ADDR(0x54AC20), (f32*)GAME_ADDR(0x54AC20),
(s8*)GAME_ADDR(0x54AC24)); // NA_SE_EV_CHAIN_KEY_UNLOCK
}

void EnDoor_Unlocking(EnDoor* thisx, GlobalContext* globalCtx) {
Expand Down Expand Up @@ -98,7 +98,8 @@ void DoorShutter_Unlock(DoorShutter* thisx) {
thisx->action_fn = &DoorShutter_Unlocking;
// NA_SE_EV_CHAIN_KEY_UNLOCK : NA_SE_EV_CHAIN_KEY_UNLOCK_B
u32 sfx_id = thisx->door_type_maybe != 5 ? 0x10001D3 : 0x1000200;
PlaySFX(sfx_id, &thisx->base.world.pos, 4, (f32*)0x54AC20, (f32*)0x54AC20, (s8*)0x54AC24);
PlaySFX(sfx_id, &thisx->base.world.pos, 4, (f32*)GAME_ADDR(0x54AC20), (f32*)GAME_ADDR(0x54AC20),
(s8*)GAME_ADDR(0x54AC24));
}

void DoorShutter_Unlocking(DoorShutter* thisx, GlobalContext* globalCtx) {
Expand Down Expand Up @@ -132,6 +133,6 @@ void DoorGerudo_Unlock(DoorGerudo* thisx) {
return;
}
thisx->action_fn = DoorGerudo_Unlocking;
PlaySFX(0x10001D3, &thisx->base.world.pos, 4, (f32*)0x54AC20, (f32*)0x54AC20,
(s8*)0x54AC24); // NA_SE_EV_CHAIN_KEY_UNLOCK
PlaySFX(0x10001D3, &thisx->base.world.pos, 4, (f32*)GAME_ADDR(0x54AC20), (f32*)GAME_ADDR(0x54AC20),
(s8*)GAME_ADDR(0x54AC24)); // NA_SE_EV_CHAIN_KEY_UNLOCK
}
4 changes: 2 additions & 2 deletions code/src/actors/graveyard_objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ void BgSpot02Objects_rUpdate(Actor* thisx, GlobalContext* globalCtx) {
}

void BgSpot02Objects_ExplodeGrave(BgSpot02Objects* thisx) {
PlaySFX(0x1000219, &thisx->base.world.pos, 4, (f32*)0x54AC20, (f32*)0x54AC20,
(s8*)0x54AC24); // NA_SE_EV_GRAVE_EXPLOSION
PlaySFX(0x1000219, &thisx->base.world.pos, 4, (f32*)GAME_ADDR(0x54AC20), (f32*)GAME_ADDR(0x54AC20),
(s8*)GAME_ADDR(0x54AC24)); // NA_SE_EV_GRAVE_EXPLOSION
thisx->timer = 38;
thisx->action_fn = BgSpot02Objects_Explode;
}
2 changes: 1 addition & 1 deletion code/src/actors/item00.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#define THIS ((EnItem00*)thisx)

#define FUN_002B175C (void*)0x2B175C
#define FUN_002B175C (void*)GAME_ADDR(0x2B175C)

typedef enum {
/* 0x00 */ ITEM00_RUPEE_GREEN,
Expand Down
2 changes: 1 addition & 1 deletion code/src/actors/link_puppet.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void EnLinkPuppet_Init(EnLinkPuppet* this, GlobalContext* globalCtx) {

// Shadow
f32 feetShadowScale = (this->ghostPtr->ghostData.age == 0) ? 90.0f : 60.0f;
ActorShape_Init(&this->base.shape, 0.0f, (void*)0x1D04F4, feetShadowScale);
ActorShape_Init(&this->base.shape, 0.0f, (void*)GAME_ADDR(0x1D04F4), feetShadowScale);
}

typedef void (*SkelAnime_Free2_proc)(SkelAnime* anime);
Expand Down
3 changes: 2 additions & 1 deletion code/src/actors/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ void PlayerActor_rDraw(Actor* thisx, GlobalContext* globalCtx) {
f32 Player_GetSpeedMultiplier(void) {
f32 speedMultiplier = 1;

if (gSettingsContext.fastBunnyHood && PLAYER->currentMask == 4 && PLAYER->stateFuncPtr == (void*)0x4BA378) {
if (gSettingsContext.fastBunnyHood && PLAYER->currentMask == 4 &&
PLAYER->stateFuncPtr == (void*)GAME_ADDR(0x4BA378)) {
speedMultiplier *= 1.5;
}

Expand Down
4 changes: 2 additions & 2 deletions code/src/actors/token.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ typedef u32 (*EnSi_Draw_GetData_proc)(void);
void EnSi_rDraw(Actor* thisx, GlobalContext* globalCtx) {
EnSi* token = THIS;

if (token->actionFunc != (EnSiActionFunc)0x3D0544) {
token->unk_20C[3] = ((EnSi_Draw_GetData_proc)0x3695F8)() ? 0.0f : 2.0f;
if (token->actionFunc != (EnSiActionFunc)GAME_ADDR(0x3D0544)) {
token->unk_20C[3] = ((EnSi_Draw_GetData_proc)GAME_ADDR(0x3695F8))() ? 0.0f : 2.0f;
if (!Model_DrawByActor(&token->actor)) {
EnSi_Draw(&token->actor, globalCtx);
}
Expand Down
3 changes: 2 additions & 1 deletion code/src/multiplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,8 @@ void Multiplayer_Receive_LinkSFX(u16 senderID) {
}

mp_duplicateSendProtection = true;
PlaySFX(mBuffer[1], &ghostDataPtr->position, 4, (f32*)0x54AC20, (f32*)0x54AC20, (s8*)0x54AC24);
PlaySFX(mBuffer[1], &ghostDataPtr->position, 4, (f32*)GAME_ADDR(0x54AC20), (f32*)GAME_ADDR(0x54AC20),
(s8*)GAME_ADDR(0x54AC24));
}

// Shared Progress
Expand Down

0 comments on commit e8c03b7

Please sign in to comment.