Fixed gGameStatusPtr (#220)

* fixed gGameStatusPtr

* fixed non-matching

* PR comments
This commit is contained in:
Ethan Roseman 2021-03-23 11:25:48 +09:00 committed by GitHub
parent f04b7f1300
commit 9e06bed2b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 218 additions and 458 deletions

View File

@ -263,7 +263,7 @@ void exec_entity_updatecmd(Entity* entity);
void func_802D7460(f32 x, f32 y, f32 z, s32 arg3);
void func_802D74C0(f32 x, f32 y, f32 z, s32 arg3);
void show_damage_popup(f32 x, f32 y, f32 z, s32 damageAmount);
void show_damage_popup(f32 x, f32 y, f32 z, s32 damageAmount, s32);
void func_80070B50(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4);
void func_800718D0(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5);
void func_80070BB0(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5);

View File

@ -14,7 +14,8 @@ extern PlayerAnim gPlayerAnimation;
extern PlayerStatus gPlayerStatus;
extern PlayerStatus* gPlayerStatusPtr;
extern CollisionStatus gCollisionStatus;
extern GameStatus* gGameStatusPtr[1];
extern GameStatus gGameStatus;
extern GameStatus* gGameStatusPtr;
extern s32 gRandSeed;
extern StaticItem gItemTable[364];
extern s16 gMainGameState; /* 0 = battle, 1 = pause, 2 = world */

View File

@ -41,12 +41,10 @@ void func_802E117C(void) {
}
void save_game_at_player_position(void) {
GameStatus* gameStatus = *gGameStatusPtr;
gameStatus->savedPos.x = gPlayerStatusPtr->position.x;
gameStatus->savedPos.y = gPlayerStatusPtr->position.y;
gameStatus->savedPos.z = gPlayerStatusPtr->position.z;
fio_save_game(gameStatus->saveSlot);
gGameStatusPtr->savedPos.x = gPlayerStatusPtr->position.x;
gGameStatusPtr->savedPos.y = gPlayerStatusPtr->position.y;
gGameStatusPtr->savedPos.z = gPlayerStatusPtr->position.z;
fio_save_game(gGameStatusPtr->saveSlot);
}
void func_802E1204(Entity* entity) {

View File

@ -36,7 +36,7 @@ void func_802E89F8(Entity* entity) {
void func_802E8A58(Entity* entity) {
struct802E89B0* temp = entity->dataBuf;
if (temp->unk_0C == (*gGameStatusPtr)->entryID) {
if (temp->unk_0C == gGameStatusPtr->entryID) {
switch (temp->unk_04) {
case 0:
if (gCollisionStatus.currentFloor > 0) {

View File

@ -20,8 +20,8 @@ void func_80035E24(void) {
}
void func_80035E54(void) {
GameStatus** gameStatus = &gGameStatusPtr;
u16* mapTransitonAlpha;
GameStatus** gameStatus = gGameStatusPtr; // :/
D_800A0944 = 0;
D_800A0946 = 4;
@ -40,25 +40,23 @@ void func_80035E54(void) {
INCLUDE_ASM(s32, "code_111f0_len_860", func_80035EEC);
void func_800360FC(void) {
GameStatus* gameStatus = *gGameStatusPtr;
if (gameStatus->loadMenuState == 2) {
if (gGameStatusPtr->loadMenuState == 2) {
draw_status_ui();
}
}
void func_80036130(void) {
GameStatus* gameStatus = *gGameStatusPtr;
//GameStatus* gameStatus = gGameStatusPtr;
gMapTransitionAlpha = 0x00;
D_800A0942 = 0x14;
D_800A0944 = 0x00;
if (gameStatus->prevArea != gameStatus->areaID) {
gameStatus->changedArea = 1;
gameStatus->prevArea = gameStatus->areaID;
if (gGameStatusPtr->prevArea != gGameStatusPtr->areaID) {
gGameStatusPtr->changedArea = 1;
gGameStatusPtr->prevArea = gGameStatusPtr->areaID;
} else {
gameStatus->changedArea = 0;
gGameStatusPtr->changedArea = 0;
}
}

View File

@ -1,15 +1,16 @@
#include "code_11a50_len_7a0.h"
#ifdef NON_MATCHING
void begin_state_intro(void) {
GameStatus** gameStatus = &gGameStatusPtr;
s8 unk_A8;
u8* mystery;
(*gGameStatusPtr)->loadMenuState = 0;
(*gameStatus)->loadMenuState = 0;
set_curtain_scale_goal(1.0f);
set_curtain_fade_goal(0.3f);
unk_A8 = (*gGameStatusPtr)->unk_A8;
unk_A8 = (*gameStatus)->unk_A8;
switch (unk_A8) {
case 0:
intro_logos_set_fade_alpha(0);
@ -23,15 +24,10 @@ void begin_state_intro(void) {
D_800A095E = 0xD0;
D_800A0964 = 0;
do {
GameStatus* gameStatus = *gGameStatusPtr;
// hos_05 (Star Sanctuary)
gameStatus->areaID = 5;
gameStatus->mapID = 5;
gameStatus->entryID = 3;
} while (0);
// hos_05 (Star Sanctuary)
(*gameStatus)->areaID = 5;
(*gameStatus)->mapID = 5;
(*gameStatus)->entryID = 3;
break;
case 1:
intro_logos_set_fade_alpha(0);
@ -45,47 +41,36 @@ void begin_state_intro(void) {
D_800A095E = 0;
D_800A0964 = 0;
// FIXME: regalloc issues
do {
GameStatus* gameStatus = *gGameStatusPtr;
// hos_04 (Outside the Sanctuary)
gameStatus->areaID = 5;
gameStatus->mapID = 4;
gameStatus->entryID = 4;
} while (0);
// hos_04 (Outside the Sanctuary)
(*gameStatus)->areaID = 5;
(*gameStatus)->mapID = 4;
(*gameStatus)->entryID = 4;
break;
default:
intro_logos_set_fade_alpha(0);
intro_logos_set_fade_color(0xD0);
intro_logos_set_fade_color(208);
{
GameStatus* gameStatus = *gGameStatusPtr;
u8* mystery = &D_800779B0;
mystery = &D_800779B0;
gameStatus->unk_A8 = -1;
gGameStatusPtr->unk_A8 = -1;
D_800A0956 = 6;
D_800A0958 = 6;
D_800A0956 = 6;
D_800A0958 = 6;
++*mystery;
if (*mystery >= 4) {
*mystery = 0;
}
D_800A0964 = 3;
++*mystery;
if (*mystery >= 4) {
*mystery = 0;
}
D_800A0964 = 3;
break;
}
set_transition_stencil_zoom_1(D_800A0963, (f32)D_800A0954);
set_transition_stencil_zoom_1(D_800A0963, D_800A0954);
set_transition_stencil_color(1, D_800A095B, D_800A095D, D_800A095F);
intro_logos_update_fade();
}
#else
INCLUDE_ASM(s32, "code_11a50_len_7a0", begin_state_intro);
#endif
INCLUDE_ASM(s32, "code_11a50_len_7a0", step_intro);

View File

@ -1,19 +1,16 @@
#include "common.h"
void init_demo_data(void) {
GameStatus* gameStatus;
GameStatus* gameStatus2;
GameStatus** gameStatus = &gGameStatusPtr;
if ((*gGameStatusPtr)->demoState == 0) {
(*gGameStatusPtr)->nextDemoScene = 0;
(*gGameStatusPtr)->demoState = 1;
if ((*gameStatus)->demoState == 0) {
(*gameStatus)->nextDemoScene = 0;
(*gameStatus)->demoState = 1;
}
gameStatus = *gGameStatusPtr;
(*gGameStatusPtr)->demoStickX = 0;
gameStatus2 = *gGameStatusPtr;
gameStatus->demoButtonInput = 0;
gameStatus2->demoStickY = 0;
(*gameStatus)->demoButtonInput = 0;
(*gameStatus)->demoStickX = 0;
(*gameStatus)->demoStickY = 0;
func_80056228();
set_map_transition_effect(2);

View File

@ -32,7 +32,7 @@ void boot_main(void) {
crash_create_monitor();
func_80025C60();
nuGfxInitEX2();
(*gGameStatusPtr)->contBitPattern = nuContInit();
gGameStatusPtr->contBitPattern = nuContInit();
func_8002D160();
func_802B2000();
func_802B203C();

View File

@ -15,7 +15,7 @@ void mtx_ident_mirror_y(Matrix4f* mtx) {
INCLUDE_ASM(s32, "code_13870_len_6980", clear_npcs);
void init_npc_list(void) {
if (!(gGameStatusPtr[0]->isBattle)) {
if (!gGameStatusPtr->isBattle) {
gCurrentNpcListPtr = &gWorldNpcList;
} else {
gCurrentNpcListPtr = &gBattleNpcList;
@ -28,7 +28,7 @@ void init_npc_list(void) {
void func_8003857C(void) {
s32 phi_v1 = 0;
s32 temp_v0 = phi_v1 < 0x40;
while (temp_v0) {
phi_v1++;
temp_v0 = phi_v1 < 0x40;
@ -113,7 +113,7 @@ func_802DE2AC(s32 arg0, s32 arg1, f32 arg2);
void set_npc_sprite(Npc *npc, s32 arg1, s32 arg2) {
s32 flagsTemp;
ASSERT(((npc->flags & 0x1000000)) || (func_802DE5E8(npc->unk_24) == 0));
npc->unk_B0 = arg2;
if (!(npc->flags & 0x1000000)) {

View File

@ -1275,7 +1275,7 @@ s32 get_defense(Actor* actor, s32* defenseTable, s32 elementFlags) {
INCLUDE_ASM(s32, "code_190B20", func_802664DC);
INCLUDE_ASM(void, "code_190B20", show_damage_popup, f32 x, f32 y, f32 z, s32 damageAmount);
INCLUDE_ASM(void, "code_190B20", show_damage_popup, f32 x, f32 y, f32 z, s32 damageAmount, s32 arg4);
INCLUDE_ASM(s32, "code_190B20", func_80266684);

View File

@ -94,30 +94,30 @@ ApiStatus MakeOwnerTargetIndex(ScriptInstance* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "code_1AC760", MakeOwnerTargetIndex);
#endif
#ifdef NON_MATCHING
s32 calc_partner_damage_enemy(void);
ApiStatus func_8027FC90(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
BattleStatus* battleStatus = &gBattleStatus;
s32 hitResult;
Actor* actor;
Bytecode* args = script->ptrReadPos;
s32 outVar = args[0];
s32 enemyID = get_variable(script, args[0]);
ActorID actorID = get_variable(script, *args++);
s32 outVar;
if (enemyID == -0x7F) {
enemyID = script->owner1.enemyID;
if (actorID == ActorID_SELF) {
actorID = script->owner1.enemyID;
}
actor = get_actor(enemyID);
outVar = *args++;
actor = get_actor(actorID);
battleStatus->flags1 |= 0x20;
hitResult = calc_partner_damage_enemy();
show_damage_popup(actor->walk.goalPos.x, actor->walk.goalPos.y, actor->walk.goalPos.z, battleStatus->lastAttackDamage);
show_damage_popup(actor->walk.goalPos.x, actor->walk.goalPos.y, actor->walk.goalPos.z, battleStatus->lastAttackDamage, 0);
set_variable(script, outVar, hitResult);
return ApiStatus_DONE2;
}
#else
INCLUDE_ASM(s32, "code_1AC760", func_8027FC90);
#endif
ApiStatus GetActorLevel(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -5,7 +5,7 @@ s8 D_80074020 = 1;
s8 D_80074021 = 5;
GameStatus gGameStatus = {0};
GameStatus* gGameStatusPtr[1] = { &gGameStatus };
GameStatus* gGameStatusPtr = &gGameStatus;
s16 D_800741A0 = 0;
s16 D_800741A2 = 0;
s32 D_800741A4 = 0;
@ -50,7 +50,7 @@ void step_game_loop(void) {
update_input();
(*gGameStatusPtr)->frameCounter++;
gGameStatusPtr->frameCounter++;
playerData->frameCounter += 2;
if (playerData->frameCounter > 215999999) {
@ -170,9 +170,7 @@ void gfx_task_background(void) {
INCLUDE_ASM(s32, "code_1b40_len_20b0", gfx_draw_frame);
void load_engine_data(void) {
GameStatus** gameStatusPtrTemp = gGameStatusPtr;
GameStatus** gameStatusPtrTemp2 = gGameStatusPtr;
GameStatus* gameStatus3;
GameStatus** gameStatus = &gGameStatusPtr;
s32 i;
dma_copy(&code_code_FEE30_ROM_START, &code_code_FEE30_ROM_END, &code_code_FEE30_VRAM);
@ -183,19 +181,19 @@ void load_engine_data(void) {
dma_copy(&code_code_10CC10_ROM_START, &code_code_10CC10_ROM_END, &code_code_10CC10_VRAM);
gOverrideFlags = 0;
(*gGameStatusPtr)->unk_79 = 0;
(*gameStatusPtrTemp2)->enableBackground = 0;
(*gGameStatusPtr)->musicEnabled = 1;
(*gameStatusPtrTemp)->unk_7C = 1;
(*gGameStatusPtr)->unk_A8 = -1;
(*gGameStatusPtr)->unk_AA = 0;
(*gGameStatusPtr)->unk_81 = 0;
(*gGameStatusPtr)->unk_82 = -8;
(*gGameStatusPtr)->unk_83 = 4;
(*gameStatus)->unk_79 = 0;
(*gameStatus)->enableBackground = 0;
(*gameStatus)->musicEnabled = 1;
(*gameStatus)->unk_7C = 1;
(*gameStatus)->unk_A8 = -1;
(*gameStatus)->unk_AA = 0;
(*gameStatus)->unk_81 = 0;
(*gameStatus)->unk_82 = -8;
(*gameStatus)->unk_83 = 4;
D_8009A5D8 = 0;
(*gGameStatusPtr)->unk_75 = (*gGameStatusPtr)->unk_13C = 0;
(*gameStatus)->unk_75 = (*gameStatus)->unk_13C = 0;
D_80074021 = 5;
(*gGameStatusPtr)->saveCount = 0;
(*gameStatus)->saveCount = 0;
fio_init_flash();
func_80028838();
general_heap_create();
@ -230,10 +228,9 @@ void load_engine_data(void) {
initialize_curtains();
poll_rumble();
gameStatus3 = gGameStatusPtr[0];
for (i = 0; i < 4; i++) {
gameStatus3->unk_50[i] = 3;
gameStatus3->unk_48[i] = 0xC;
(*gameStatus)->unk_50[i] = 3;
(*gameStatus)->unk_48[i] = 12;
}
OVERRIDE_FLAG_SET(0x8);

View File

@ -46,7 +46,7 @@ ApiStatus MakeNpcs(ScriptInstance* script, s32 isInitialCall) {
switch (script->functionTemp[0].s) {
case 0:
make_npcs(get_variable(script, *args++), (*gGameStatusPtr)->mapID, get_variable(script, *args++));
make_npcs(get_variable(script, *args++), gGameStatusPtr->mapID, get_variable(script, *args++));
script->functionTemp[0].s = 1;
break;
case 1:

View File

@ -50,7 +50,7 @@ s32 render_effects(void) {
curEffectInst = &D_800B4398[0];
for (i = 0; i < ARRAY_COUNT(D_800B4398); i++) {
if ((curEffectInst[i] != NULL) && (curEffectInst[i]->flags & 1) && (curEffectInst[i]->flags & 8)) {
if ((*gGameStatusPtr)->isBattle) {
if (gGameStatusPtr->isBattle) {
if (curEffectInst[i]->flags & 4) {
curEffectInst[i]->effect->renderWorld(curEffectInst[i]);
}
@ -121,7 +121,7 @@ EffectInstance* func_8005A2BC(EffectBlueprint* effectBp) {
effectBp->init(newEffectInst);
}
if ((*gGameStatusPtr)->isBattle) {
if (gGameStatusPtr->isBattle) {
newEffectInst->flags |= 4;
}
return newEffectInst;

View File

@ -1,27 +1,18 @@
#include "common.h"
void func_800287F0(void) {
// TODO: Figure out macros
GameStatus* gameStatus;
GameStatus* gameStatus2;
GameStatus** gameStatus = &gGameStatusPtr;
gameStatus = *gGameStatusPtr;
gameStatus->stickX = 0;
gameStatus2 = *gGameStatusPtr;
gameStatus->currentButtons = 0;
gameStatus->pressedButtons = 0;
gameStatus->heldButtons = 0;
gameStatus2->stickY = 0;
// TODO: macro
{
GameStatus* gameStatus = *gGameStatusPtr;
gameStatus->prevButtons = 0;
gameStatus->unk_50[0] = 4;
gameStatus->unk_48[0] = 15;
gameStatus->unk_60 = 0;
gameStatus->unk_58 = 0;
}
(*gameStatus)->currentButtons = 0;
(*gameStatus)->pressedButtons = 0;
(*gameStatus)->heldButtons = 0;
(*gameStatus)->stickX = 0;
(*gameStatus)->stickY = 0;
(*gameStatus)->prevButtons = 0;
(*gameStatus)->unk_50[0] = 4;
(*gameStatus)->unk_48[0] = 15;
(*gameStatus)->unk_60 = 0;
(*gameStatus)->unk_58 = 0;
}
void func_80028838(void) {

View File

@ -12,7 +12,7 @@ void poll_rumble(void) {
}
void start_rumble(s32 freq, s32 frame) {
if ((*gGameStatusPtr)->demoState == 0) {
if (gGameStatusPtr->demoState == 0) {
u16* sym = &D_80074260;
if (*sym != 0) {
@ -34,8 +34,8 @@ void update_max_rumble_duration(void) {
s32* sym = &D_80074264;
u16* sym2;
if (*sym != (*gGameStatusPtr)->currentButtons) {
*sym = (*gGameStatusPtr)->currentButtons;
if (*sym != gGameStatusPtr->currentButtons) {
*sym = gGameStatusPtr->currentButtons;
reset_max_rumble_duration();
}

View File

@ -185,7 +185,7 @@ void func_80029860(s32 dramAddr, s32 devAddr, s32 size) {
s32 _advance_rng(void) {
s32* rngVal = &gRandSeed;
(*gGameStatusPtr)->nextRNG = *rngVal = (*rngVal * 0x5D588B65) + 1;
gGameStatusPtr->nextRNG = *rngVal = (*rngVal * 0x5D588B65) + 1;
return *rngVal;
}
@ -304,15 +304,16 @@ f32 get_clamped_angle_diff(f32 a, f32 b) {
INCLUDE_ASM(f32, "code_43F0", atan2, f32 startX, f32 startZ, f32 endX, f32 endZ);
f32 get_player_normal_yaw(void) {
return atan2(0, 0, (*gGameStatusPtr)->playerTraceNormal.x, (*gGameStatusPtr)->playerTraceNormal.z);
return atan2(0, 0, gGameStatusPtr->playerTraceNormal.x, gGameStatusPtr->playerTraceNormal.z);
}
f32 get_player_normal_pitch(void) {
f32 traceNormalX = (*gGameStatusPtr)->playerTraceNormal.x;
f32 traceNormalZ = (*gGameStatusPtr)->playerTraceNormal.z;
GameStatus** gameStatus = &gGameStatusPtr;
f32 traceNormalX = (*gameStatus)->playerTraceNormal.x;
f32 traceNormalZ = (*gameStatus)->playerTraceNormal.z;
f32 sqrt = sqrtf(SQ(traceNormalX) + SQ(traceNormalZ));
return atan2(0.0f, 0.0f, sqrt, -(*gGameStatusPtr)->playerTraceNormal.y);
return atan2(0.0f, 0.0f, sqrt, -(*gameStatus)->playerTraceNormal.y);
}
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by) {

View File

@ -33,7 +33,7 @@ s32 func_8002ACDC(void) {
}
s32 heap_malloc(s32 size) {
if ((*gGameStatusPtr)->isBattle == 0) {
if (gGameStatusPtr->isBattle == 0) {
return general_heap_malloc(size);
} else {
return _heap_malloc(&D_803DA800, size);
@ -41,7 +41,7 @@ s32 heap_malloc(s32 size) {
}
s32 heap_free(s32 size) {
if ((*gGameStatusPtr)->isBattle != 0) {
if (gGameStatusPtr->isBattle != 0) {
return _heap_free(&D_803DA800, size);
} else {
return general_heap_free(size);
@ -56,7 +56,7 @@ s32 collision_heap_create(void) {
}
s32 collision_heap_malloc(s32 size) {
if (!(*gGameStatusPtr)->isBattle) {
if (!gGameStatusPtr->isBattle) {
return _heap_malloc(&D_80268000, size);
} else {
return _heap_malloc(&D_803DA800, size);
@ -64,7 +64,7 @@ s32 collision_heap_malloc(s32 size) {
}
s32 collision_heap_free(void* data) {
if ((*gGameStatusPtr)->isBattle) {
if (gGameStatusPtr->isBattle) {
return _heap_free(&D_803DA800, data);
} else {
return _heap_free(&D_80268000, data);

View File

@ -65,7 +65,7 @@ INCLUDE_ASM(s32, "code_6240_len_c00", fio_erase_game);
INCLUDE_ASM(s32, "code_6240_len_c00", fio_deserialize_state);
void func_8002B608(void) {
(*gGameStatusPtr)->entryID = 10;
gGameStatusPtr->entryID = 10;
fio_serialize_state();
}

View File

@ -96,7 +96,7 @@ void update_player(void) {
func_800E0B90();
gameStatus = *gGameStatusPtr;
gameStatus = gGameStatusPtr;
gameStatus->playerPos.x = playerStatus->position.x;
gameStatus->playerPos.y = playerStatus->position.y;
gameStatus->playerPos.z = playerStatus->position.z;
@ -305,10 +305,9 @@ void func_800E01DC(void) {
}
s32 func_800E0208(void) {
GameStatus* gameStatus = *gGameStatusPtr;
s32 ret = 0;
if (gameStatus->disableScripts && (gameStatus->currentButtons & 0x10)) {
if (gGameStatusPtr->disableScripts && (gGameStatusPtr->currentButtons & 0x10)) {
if (D_8010EBB0.unk_00 == 0) {
set_action_state(ActionState_IDLE);
}
@ -398,7 +397,7 @@ void func_800E0B14(void) {
void update_partner_timers(void) {
PlayerData* playerData = &gPlayerData;
if (!(*gGameStatusPtr)->isBattle) {
if (!gGameStatusPtr->isBattle) {
s32 i;
for (i = 1; i < ARRAY_COUNT(playerData->unk_2C4); i++) {
@ -414,7 +413,7 @@ INCLUDE_ASM(s32, "code_77480", func_800E0B90);
INCLUDE_ASM(s32, "code_77480", get_player_back_anim);
void render_player(void) {
if (!(*gGameStatusPtr)->disableScripts) {
if (!gGameStatusPtr->disableScripts) {
render_player_model();
}
}

View File

@ -5,11 +5,11 @@ void update_player_input(void) {
PlayerStatus* playerStatus = ps; // ??? necessary
s32 inputBufPos = playerStatus->inputBufPos;
playerStatus->stickAxis[0] = (*gGameStatusPtr)->stickX;
playerStatus->stickAxis[1] = (*gGameStatusPtr)->stickY;
playerStatus->currentButtons = (*gGameStatusPtr)->currentButtons;
playerStatus->pressedButtons = (*gGameStatusPtr)->pressedButtons;
playerStatus->heldButtons = (*gGameStatusPtr)->heldButtons;
playerStatus->stickAxis[0] = gGameStatusPtr->stickX;
playerStatus->stickAxis[1] = gGameStatusPtr->stickY;
playerStatus->currentButtons = gGameStatusPtr->currentButtons;
playerStatus->pressedButtons = gGameStatusPtr->pressedButtons;
playerStatus->heldButtons = gGameStatusPtr->heldButtons;
inputBufPos++;
if (inputBufPos >= 10) {

View File

@ -278,7 +278,7 @@ PartnerID get_current_partner_id(void) {
}
void func_800E5098(s32 arg0) {
if (((*gGameStatusPtr)->frameCounter % arg0) == 0) {
if ((gGameStatusPtr->frameCounter % arg0) == 0) {
u8 colliderType = get_collider_type_by_id(gCollisionStatus.currentFloor);
s32 soundID;
s32 soundID2;
@ -534,7 +534,7 @@ void func_800E63A4(s32 arg0) {
set_action_state(0x19);
} else {
playerStatus->animFlags &= ~0x2000;
(*gGameStatusPtr)->peachFlags &= ~0x2;
gGameStatusPtr->peachFlags &= ~0x2;
playerStatus->peachDisguise = 0;
free_npc_by_index(D_8010C96C);
set_action_state(ActionState_IDLE);
@ -556,17 +556,17 @@ void func_800E6428(void) {
if (*temp_8010C92C != 0) {
(*temp_8010C92C)--;
if (*temp_8010C92C == 0) {
if ((*gGameStatusPtr)->peachFlags & 2) {
if (gGameStatusPtr->peachFlags & 2) {
playerStatus->animFlags |= 0x2000;
(*gGameStatusPtr)->peachFlags |= 2;
gGameStatusPtr->peachFlags |= 2;
disguiseNpc = make_disguise_npc((*gGameStatusPtr)->peachDisguise);
disguiseNpc = make_disguise_npc(gGameStatusPtr->peachDisguise);
if (disguiseNpc != NULL) {
disguiseNpc->flags &= ~0x40000;
}
}
}
} else if ((*gGameStatusPtr)->peachFlags & 4 && gPlayerStatus.pressedButtons & B_BUTTON) {
} else if (gGameStatusPtr->peachFlags & 4 && gPlayerStatus.pressedButtons & B_BUTTON) {
set_action_state(0x19);
}
}

View File

@ -69,7 +69,7 @@ void check_input_status_menu(void) {
if (playerStatus->actionState != ActionState_RIDE) {
pressedButtons = playerStatus->pressedButtons;
} else {
pressedButtons = (*gGameStatusPtr)->pressedButtons;
pressedButtons = gGameStatusPtr->pressedButtons;
}
if (!is_status_menu_visible()) {

View File

@ -394,7 +394,7 @@ void coin_counter_draw_content(UNK_TYPE arg0, s32 posX, s32 posY) {
UiStatus* uiStatus = &gUIStatus;
s32 iconIndex;
if ((gPlayerData.coins != uiStatus->displayCoins) && (((*gGameStatusPtr)->frameCounter % 3) == 0)) {
if ((gPlayerData.coins != uiStatus->displayCoins) && ((gGameStatusPtr->frameCounter % 3) == 0)) {
play_sound(0x211);
}
@ -628,11 +628,10 @@ s32 is_status_menu_visible(void) {
}
void status_menu_start_blinking_hp(void) {
GameStatus* gameStatus = *gGameStatusPtr;
UiStatus* uiStatus = &gUIStatus;
UiStatus* uiStatus2 = &gUIStatus;
if (gameStatus->isBattle == 0) {
if (gGameStatusPtr->isBattle == 0) {
uiStatus->hpBlinkTimer = 120;
}
@ -653,11 +652,10 @@ void status_menu_stop_blinking_hp(void) {
}
void status_menu_start_blinking_fp(void) {
GameStatus* gameStatus = *gGameStatusPtr;
UiStatus* uiStatus = &gUIStatus;
UiStatus* uiStatus2 = &gUIStatus;
if (gameStatus->isBattle == 0) {
if (gGameStatusPtr->isBattle == 0) {
uiStatus->fpBlinkTimer = 120;
}
@ -677,11 +675,10 @@ void status_menu_stop_blinking_fp(void) {
}
void status_menu_start_blinking_coins(void) {
GameStatus* gameStatus = *gGameStatusPtr;
UiStatus* uiStatus = &gUIStatus;
UiStatus* uiStatus2 = &gUIStatus;
if (gameStatus->isBattle == 0) {
if (gGameStatusPtr->isBattle == 0) {
uiStatus->coinsBlinkTimer = 120;
}
@ -851,7 +848,7 @@ s32 is_ability_active(s32 arg0) {
local_20[i] = 0;
}
if (((*gGameStatusPtr)->unk_7E & 1) == 0) {
if ((gGameStatusPtr->unk_7E & 1) == 0) {
iVar2 = 0;
iVar7 = 0;
piVar6 = 0;

View File

@ -373,17 +373,17 @@ ApiStatus GotoMapByID(ScriptInstance* script, s32 isInitialCall) {
}
ApiStatus GetEntryID(ScriptInstance* script, s32 isInitialCall) {
set_variable(script, *script->ptrReadPos, (*gGameStatusPtr)->entryID);
set_variable(script, *script->ptrReadPos, gGameStatusPtr->entryID);
return ApiStatus_DONE2;
}
ApiStatus GetMapID(ScriptInstance* script, s32 isInitialCall) {
set_variable(script, *script->ptrReadPos, (*gGameStatusPtr)->mapID);
set_variable(script, *script->ptrReadPos, gGameStatusPtr->mapID);
return ApiStatus_DONE2;
}
ApiStatus GetLoadType(ScriptInstance* script, s32 isInitialCall) {
set_variable(script, *script->ptrReadPos, (*gGameStatusPtr)->loadType != 0);
set_variable(script, *script->ptrReadPos, gGameStatusPtr->loadType != 0);
return ApiStatus_DONE2;
}

View File

@ -48,7 +48,7 @@ Shadow* get_shadow_by_index(s32 index) {
EntityList* get_entity_list(void) {
EntityList* ret;
if (!(*gGameStatusPtr)->isBattle) {
if (!gGameStatusPtr->isBattle) {
ret = &gWorldEntityList;
} else {
ret = &gBattleEntityList;
@ -59,7 +59,7 @@ EntityList* get_entity_list(void) {
ShadowList* get_shadow_list(void) {
ShadowList* ret;
if (!(*gGameStatusPtr)->isBattle) {
if (!gGameStatusPtr->isBattle) {
ret = &gWorldShadowList;
} else {
ret = &gBattleShadowList;

View File

@ -103,7 +103,7 @@ void stub_dynamic_entity_delegate(void) {
INCLUDE_ASM(s32, "code_b72b0_len_15ed0", clear_dynamic_entity_list);
void init_dynamic_entity_list(void) {
if (!(*gGameStatusPtr)->isBattle) {
if (!gGameStatusPtr->isBattle) {
gCurrentDynamicEntityListPtr = gWorldDynamicEntityList;
} else {
gCurrentDynamicEntityListPtr = gBattleDynamicEntityList;

View File

@ -25,7 +25,7 @@ void clear_area_flags(void) {
SaveData* saveFile = &gCurrentSaveFile;
s32 i;
if ((*gGameStatusPtr)->changedArea) {
if (gGameStatusPtr->changedArea) {
for (i = 0; i < ARRAY_COUNT(saveFile->areaFlags); i++) {
saveFile->areaFlags[i] = 0;
}

View File

@ -8,7 +8,7 @@ void clear_trigger_data(void) {
CollisionStatus* collisionStatus = &gCollisionStatus;
s32 i;
if (!(*gGameStatusPtr)->isBattle) {
if (!gGameStatusPtr->isBattle) {
gCurrentTriggerListPtr = &gTriggerList1;
} else {
gCurrentTriggerListPtr = &gTriggerList2;
@ -37,7 +37,7 @@ void clear_trigger_data(void) {
}
void init_trigger_list(void) {
if (!(*gGameStatusPtr)->isBattle) {
if (!gGameStatusPtr->isBattle) {
gCurrentTriggerListPtr = &gTriggerList1;
} else {
gCurrentTriggerListPtr = &gTriggerList2;

View File

@ -27,34 +27,28 @@ void load_map_bg(char* optAssetName) {
}
void use_default_background_settings(void) {
GameStatus* gameStatus = *gGameStatusPtr;
D_801595A0 = 0;
D_8014F12F = 0;
gameStatus->unk_15C = 0xB4;
gameStatus->enableBackground &= 0xF0;
gGameStatusPtr->unk_15C = 0xB4;
gGameStatusPtr->enableBackground &= 0xF0;
}
void read_background_size(BackgroundHeader* bg) {
GameStatus* gameStatus = *gGameStatusPtr;
gameStatus->backgroundMaxW = bg->width;
gameStatus->backgroundMaxH = bg->height;
gameStatus->backgroundMinW = bg->startX;
gameStatus->backgroundMinH = bg->startY;
gameStatus->backgroundRaster = bg->raster;
gameStatus->backgroundPalette = bg->palette;
gameStatus->enableBackground |= 1;
gGameStatusPtr->backgroundMaxW = bg->width;
gGameStatusPtr->backgroundMaxH = bg->height;
gGameStatusPtr->backgroundMinW = bg->startX;
gGameStatusPtr->backgroundMinH = bg->startY;
gGameStatusPtr->backgroundRaster = bg->raster;
gGameStatusPtr->backgroundPalette = bg->palette;
gGameStatusPtr->enableBackground |= 1;
}
void set_background_size(s16 startX, s16 startY, s16 sizeX, s16 sizeY) {
GameStatus* gameStatus = *gGameStatusPtr;
gameStatus->enableBackground &= ~1;
gameStatus->backgroundMaxW = startX;
gameStatus->backgroundMaxH = startY;
gameStatus->backgroundMinW = sizeX;
gameStatus->backgroundMinH = sizeY;
gGameStatusPtr->enableBackground &= ~1;
gGameStatusPtr->backgroundMaxW = startX;
gGameStatusPtr->backgroundMaxH = startY;
gGameStatusPtr->backgroundMinW = sizeX;
gGameStatusPtr->backgroundMinH = sizeY;
}
u16 blend_background_channel(s32 arg0, s32 arg1, s32 alpha) {

View File

@ -67,7 +67,7 @@ s32 play_ambient_sounds(s32 fadeInTime, s32 fadeOutTime) {
struct_80147230* temp1 = &D_8015C7C0;
struct_80147230* temp2 = &D_8015C7C0;
if (!(*gGameStatusPtr)->musicEnabled) {
if (!gGameStatusPtr->musicEnabled) {
func_800554A4(temp1->fadeInTime, fadeOutTime);
temp1->fadeFlags &= ~1;
return 1;

View File

@ -32,11 +32,12 @@ void transition_music_volume_to(s16 volume);
s32 get_song_variation_override_for_cur_map(SongID songID) {
u32 i = 0;
Area* areas = gAreas;
GameStatus** gameStatus = &gGameStatusPtr;
SongID* allowed = gSongsUsingVariationFlag;
for (i = 0; i < ARRAY_COUNT(gSongsUsingVariationFlag); i++) {
if (allowed[i] == songID) {
Map* map = &areas[(*gGameStatusPtr)->areaID].maps[(*gGameStatusPtr)->mapID];
Map* map = &areas[(*gameStatus)->areaID].maps[(*gameStatus)->mapID];
return map->songVariation & 1;
}
@ -68,16 +69,14 @@ void func_8014A52C(void) {
INCLUDE_ASM(s32, "code_e0b30_len_b80", func_8014A548);
s32 _set_music_track(s32 playerIndex, SongID songID, s32 variation, s32 fadeOutTime, s16 volume) {
GameStatus* gameStatus = *gGameStatusPtr;
if (gameStatus->demoState != 0) {
if (gGameStatusPtr->demoState != 0) {
return 1;
} else {
// TODO: these two lines likely a MUSIC_PLAYER(idx) macro
MusicPlayer* musicPlayers = gMusicPlayers;
MusicPlayer* musicPlayer = &musicPlayers[playerIndex];
if (!gameStatus->musicEnabled) {
if (!gGameStatusPtr->musicEnabled) {
func_800559C4(musicPlayer->unk_18);
musicPlayer->flags &= ~1;
@ -120,15 +119,13 @@ s32 set_music_track(s32 playerIndex, SongID songID, s32 variation, s32 fadeOutTi
}
s32 func_8014A964(s32 playerIndex, SongID songID, s32 variation, s32 fadeInTime, s16 arg4, s16 arg5) {
GameStatus* gameStatus = *gGameStatusPtr;
if (gameStatus->demoState != 0) {
if (gGameStatusPtr->demoState != 0) {
return 1;
} else {
MusicPlayer* musicPlayers = gMusicPlayers;
MusicPlayer* musicPlayer = &musicPlayers[playerIndex];
if (!gameStatus->musicEnabled) {
if (!gGameStatusPtr->musicEnabled) {
func_800559C4(musicPlayer->unk_18);
musicPlayer->flags &= ~1;
@ -269,7 +266,7 @@ INCLUDE_ASM(s32, "code_e0b30_len_b80", func_8014AD40);
void func_8014ADA4(void) {
MusicPlayer* musicPlayer = &gMusicPlayers[0];
if ((*gGameStatusPtr)->demoState == 0) {
if (gGameStatusPtr->demoState == 0) {
musicPlayer->flags |= 8;
_set_music_track(0, musicPlayer->unk_24, musicPlayer->unk_28, 0, 8);
}
@ -278,7 +275,7 @@ void func_8014ADA4(void) {
void func_8014ADF8(SongID songID, s32 variation) {
MusicPlayer* musicPlayer = &gMusicPlayers[0];
if ((*gGameStatusPtr)->demoState == 0) {
if (gGameStatusPtr->demoState == 0) {
musicPlayer->unk_24 = musicPlayer->songID;
musicPlayer->unk_28 = musicPlayer->variation;
musicPlayer->unk_2C = musicPlayer->unk_18;
@ -290,7 +287,7 @@ void func_8014ADF8(SongID songID, s32 variation) {
void func_8014AE6C(void) {
MusicPlayer* musicPlayer = &gMusicPlayers[0];
if ((*gGameStatusPtr)->demoState == 0) {
if (gGameStatusPtr->demoState == 0) {
if (OVERRIDE_FLAG_CHECK(0x20000)) {
OVERRIDE_FLAG_UNSET(0x20000);
} else {
@ -304,7 +301,7 @@ void func_8014AE6C(void) {
void func_8014AEF8(void) {
MusicPlayer* musicPlayer = &gMusicPlayers[0];
if ((*gGameStatusPtr)->demoState == 0 && !OVERRIDE_FLAG_CHECK(0x20000)) {
if (gGameStatusPtr->demoState == 0 && !OVERRIDE_FLAG_CHECK(0x20000)) {
func_8005553C(0, 250);
musicPlayer->unk_24 = musicPlayer->songID;
musicPlayer->unk_28 = musicPlayer->variation;

View File

@ -89,7 +89,7 @@ void find_script_labels(ScriptInstance* script) {
void clear_script_list(void) {
s32 i;
if ((*gGameStatusPtr)->isBattle == 0) {
if (gGameStatusPtr->isBattle == 0) {
gCurrentScriptListPtr = &gWorldScriptList;
gMapVars = gWorldMapVars;
gMapFlags = gWorldMapFlags;
@ -121,7 +121,7 @@ void clear_script_list(void) {
void init_script_list(void) {
if ((*gGameStatusPtr)->isBattle == 0) {
if (gGameStatusPtr->isBattle == 0) {
gCurrentScriptListPtr = &gWorldScriptList;
gMapVars = gWorldMapVars;
gMapFlags = gWorldMapFlags;

View File

@ -2,22 +2,22 @@
void begin_state_init(void) {
OVERRIDE_FLAG_SET(0x8);
(*gGameStatusPtr)->loadMenuState = 3;
gGameStatusPtr->loadMenuState = 3;
}
void step_init_state(void) {
GameStatus** gameStatusPtr = gGameStatusPtr;
GameStatus** gameStatusPtr = &gGameStatusPtr;
GameStatus* gameStatus = *gameStatusPtr;
s32 i;
if ((*gGameStatusPtr)->loadMenuState != 0) {
(*gGameStatusPtr)->loadMenuState--;
if (gameStatus->loadMenuState != 0) {
gameStatus->loadMenuState--;
return;
}
gOverrideFlags = 0;
(*gameStatusPtr)->areaID = 0;
gameStatus->isBattle = 0;
(*gameStatusPtr)->isBattle = 0;
gameStatus->prevArea = -1;
gameStatus->mapID = 0;
gameStatus->entryID = 0;
@ -70,10 +70,10 @@ void step_init_state(void) {
fio_has_valid_backup();
if (D_800D9620 == 0) {
(*gGameStatusPtr)->unk_AB = 1;
gGameStatusPtr->unk_AB = 1;
func_8005615C();
} else {
(*gGameStatusPtr)->unk_AB = 0;
gGameStatusPtr->unk_AB = 0;
func_80056180();
}

View File

@ -13,26 +13,20 @@ extern s32 D_800A0908;
extern s16** D_800778A0;
void intro_logos_set_fade_alpha(s16 alpha) {
GameStatus* gameStatus = *gGameStatusPtr;
gameStatus->bootAlpha = alpha;
gGameStatusPtr->bootAlpha = alpha;
}
void intro_logos_set_fade_color(s16 color) {
GameStatus* gameStatus = *gGameStatusPtr;
gameStatus->bootRed = color;
gameStatus->bootGreen = color;
gameStatus->bootBlue = color;
gGameStatusPtr->bootRed = color;
gGameStatusPtr->bootGreen = color;
gGameStatusPtr->bootBlue = color;
}
s16 intro_logos_fade_in(s16 subtractAlpha) {
GameStatus* gameStatus = *gGameStatusPtr;
if (gameStatus->bootAlpha != 0) {
gameStatus->bootAlpha -= subtractAlpha;
if (gameStatus->bootAlpha << 16 < 0) {
gameStatus->bootAlpha = 0;
if (gGameStatusPtr->bootAlpha != 0) {
gGameStatusPtr->bootAlpha -= subtractAlpha;
if (gGameStatusPtr->bootAlpha << 16 < 0) {
gGameStatusPtr->bootAlpha = 0;
}
} else {
return 1;
@ -41,12 +35,10 @@ s16 intro_logos_fade_in(s16 subtractAlpha) {
}
s16 intro_logos_fade_out(s16 addAlpha) {
GameStatus* gameStatus = *gGameStatusPtr;
if (gameStatus->bootAlpha != 0xFF) {
gameStatus->bootAlpha += addAlpha;
if ((gameStatus->bootAlpha > 0xFF)) {
gameStatus->bootAlpha = 0xFF;
if (gGameStatusPtr->bootAlpha != 255) {
gGameStatusPtr->bootAlpha += addAlpha;
if (gGameStatusPtr->bootAlpha > 255) {
gGameStatusPtr->bootAlpha = 255;
}
} else {
return 1;
@ -55,8 +47,10 @@ s16 intro_logos_fade_out(s16 addAlpha) {
}
void intro_logos_update_fade(void) {
set_transition_stencil_zoom_0(0, (*gGameStatusPtr)->bootAlpha);
set_transition_stencil_color(0, (*gGameStatusPtr)->bootBlue, (*gGameStatusPtr)->bootGreen, (*gGameStatusPtr)->bootRed);
GameStatus** gameStatus = &gGameStatusPtr;
set_transition_stencil_zoom_0(0, (*gameStatus)->bootAlpha);
set_transition_stencil_color(0, (*gameStatus)->bootBlue, (*gameStatus)->bootGreen, (*gameStatus)->bootRed);
}
void begin_state_battle(void) {
@ -88,13 +82,13 @@ void step_battle(void) {
nuContRmbForceStopEnd();
func_80149838();
func_8003B1A8();
(*gGameStatusPtr)->isBattle = TRUE;
gGameStatusPtr->isBattle = TRUE;
allocate_hit_tables();
func_8002D160();
func_802B20B4();
func_80149670(0);
gameStatus = *gGameStatusPtr;
gameStatus = gGameStatusPtr;
// This part sucks
if (!(gameStatus->peachFlags & 1)) {

View File

@ -480,7 +480,7 @@ void func_802CCAC0(void) {
INCLUDE_ASM(s32, "code_ef070_len_3400", draw_anim_models);
ApiStatus func_802CCCB0(ScriptInstance* script, s32 isInitialCall) {
if (!(*gGameStatusPtr)->isBattle) {
if (!gGameStatusPtr->isBattle) {
gCurrentMeshAnimationListPtr = &gWorldMeshAnimationList;
} else {
gCurrentMeshAnimationListPtr = &gBattleMeshAnimationList;
@ -688,7 +688,7 @@ ApiStatus func_802CD418(ScriptInstance* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "code_ef070_len_3400", func_802CD4B4);
void func_802CD57C(void) {
if (!(*gGameStatusPtr)->isBattle) {
if (!gGameStatusPtr->isBattle) {
gCurrentMeshAnimationListPtr = &gWorldMeshAnimationList;
} else {
gCurrentMeshAnimationListPtr = &gBattleMeshAnimationList;

View File

@ -12,26 +12,27 @@ ApiStatus EnableSpriteShading(ScriptInstance* script, s32 isInitialCall) {
}
s32 GetDemoState(ScriptInstance* script) {
set_variable(script, *script->ptrReadPos, (*gGameStatusPtr)->demoState);
set_variable(script, *script->ptrReadPos, gGameStatusPtr->demoState);
return ApiStatus_DONE2;
}
ApiStatus DemoPressButton(ScriptInstance* script, s32 isInitialCall) {
(*gGameStatusPtr)->demoButtonInput |= get_variable(script, *script->ptrReadPos);
gGameStatusPtr->demoButtonInput |= get_variable(script, *script->ptrReadPos);
return ApiStatus_DONE2;
}
ApiStatus DemoReleaseButton(ScriptInstance* script, s32 isInitialCall) {
(*gGameStatusPtr)->demoButtonInput &= ~get_variable(script, *script->ptrReadPos);
gGameStatusPtr->demoButtonInput &= ~get_variable(script, *script->ptrReadPos);
return ApiStatus_DONE2;
}
ApiStatus DemoSetButtons(ScriptInstance* script, s32 isInitialCall) {
(*gGameStatusPtr)->demoButtonInput = get_variable(script, *script->ptrReadPos);
gGameStatusPtr->demoButtonInput = get_variable(script, *script->ptrReadPos);
return ApiStatus_DONE2;
}
ApiStatus DemoJoystickRadial(ScriptInstance* script, s32 isInitialCall) {
GameStatus** gameStatus = &gGameStatusPtr;
f32 a;
f32 b;
s32* thisPos = script->ptrReadPos;
@ -39,13 +40,14 @@ ApiStatus DemoJoystickRadial(ScriptInstance* script, s32 isInitialCall) {
a = get_float_variable(script, *thisPos++);
b = get_float_variable(script, *thisPos++);
(*gGameStatusPtr)->demoStickX = a * sin_deg(b);
(*gGameStatusPtr)->demoStickY = a * cos_deg(b);
(*gameStatus)->demoStickX = a * sin_deg(b);
(*gameStatus)->demoStickY = a * cos_deg(b);
return ApiStatus_DONE2;
}
ApiStatus DemoJoystickXY(ScriptInstance* script, s32 isInitialCall) {
GameStatus** gameStatus = &gGameStatusPtr;
f32 x;
f32 y;
s32* thisPos = script->ptrReadPos;
@ -53,8 +55,8 @@ ApiStatus DemoJoystickXY(ScriptInstance* script, s32 isInitialCall) {
x = get_float_variable(script, *thisPos++);
y = get_float_variable(script, *thisPos++);
(*gGameStatusPtr)->demoStickX = x;
(*gGameStatusPtr)->demoStickY = y;
(*gameStatus)->demoStickX = x;
(*gameStatus)->demoStickY = y;
return ApiStatus_DONE2;
}

View File

@ -2,10 +2,8 @@
#include "map.h"
ApiStatus N(IsGameStatusUnkAA_1)(ScriptInstance* script, s32 isInitialCall) {
GameStatus* gameStatus = *gGameStatusPtr;
script->varTable[0] = 0;
if (gameStatus->unk_AA & 1) {
if (gGameStatusPtr->unk_AA & 1) {
script->varTable[0] = 1;
}

View File

@ -14,8 +14,8 @@ ApiStatus func_80240034_7EAD44(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
stickX = (*gGameStatusPtr)->stickX;
stickY = (*gGameStatusPtr)->stickY;
stickX = gGameStatusPtr->stickX;
stickY = gGameStatusPtr->stickY;
if (stickX < 0) {
stickX = -stickX;
}

View File

@ -3,7 +3,7 @@
ApiStatus func_80240000_800880(ScriptInstance* script, s32 isInitialCall) {
s32 itemIndex = get_variable(script, *script->ptrReadPos);
set_item_entity_flags((*gGameStatusPtr)->shopItemData[itemIndex * 4], 0x40);
set_item_entity_flags(gGameStatusPtr->shopItemData[itemIndex * 4], 0x40);
return ApiStatus_DONE2;
}
@ -11,7 +11,7 @@ ApiStatus func_80240044_8008C4(ScriptInstance* script, s32 isInitialCall) {
s32 itemIndex = get_variable(script, *script->ptrReadPos);
s32* var1 = get_variable(NULL, SI_MAP_VAR(2));
set_item_entity_flags((*gGameStatusPtr)->shopItemData[itemIndex * 4], 0x40);
set_item_entity_flags(gGameStatusPtr->shopItemData[itemIndex * 4], 0x40);
set_variable(NULL, var1[itemIndex], 1);
return ApiStatus_DONE2;
}

View File

@ -6,9 +6,9 @@ ApiStatus func_80240000_9A4650(ScriptInstance* script, s32 isInitialCall) {
stickX = 0;
if (gCollisionStatus.pushingAgainstWall == COLLIDER_o84) {
stickX = (*gGameStatusPtr)->stickX < 0;
stickX = gGameStatusPtr->stickX < 0;
}
if ((gCollisionStatus.pushingAgainstWall == COLLIDER_o85) && ((*gGameStatusPtr)->stickX > 0)) {
if ((gCollisionStatus.pushingAgainstWall == COLLIDER_o85) && (gGameStatusPtr->stickX > 0)) {
stickX = 2;
}
@ -17,6 +17,6 @@ ApiStatus func_80240000_9A4650(ScriptInstance* script, s32 isInitialCall) {
}
ApiStatus GetFrameCounter(ScriptInstance* script, s32 isInitialCall) {
set_variable(script, *script->ptrReadPos, (*gGameStatusPtr)->frameCounter);
set_variable(script, *script->ptrReadPos, gGameStatusPtr->frameCounter);
return ApiStatus_DONE2;
}

View File

@ -2,6 +2,6 @@
#include "map.h"
ApiStatus N(GetGameStatus75)(ScriptInstance* script, s32 isInitialCall) {
set_variable(script, SI_VAR(0), (*gGameStatusPtr)->unk_75);
set_variable(script, SI_VAR(0), gGameStatusPtr->unk_75);
return ApiStatus_DONE2;
}

View File

@ -2,6 +2,6 @@
#include "map.h"
ApiStatus N(SetGameStatusUnk84_1)(ScriptInstance* script, s32 isInitialCall) {
(*gGameStatusPtr)->unk_84 = 1;
gGameStatusPtr->unk_84 = 1;
return ApiStatus_BLOCK;
}

View File

@ -411,7 +411,7 @@ s32 partner_use_ability(void) {
wPartner != NULL &&
(wPartner->canUseAbility == NULL || wPartner->canUseAbility(wPartnerNpc)))
{
if (((*gGameStatusPtr)->unk_81 != 0) && (temp8010EBB0->unk_08 & 0x4000)) {
if ((gGameStatusPtr->unk_81 != 0) && (temp8010EBB0->unk_08 & 0x4000)) {
play_sound(0x21D);
} else if (D_8010CFD8 != 0) {
D_8010CFE0 = 1;
@ -457,9 +457,9 @@ void partner_reset_data(void) {
*temp8010CFE8 = 9;
*temp8010CFD8 = temp_s0;
if ((*gGameStatusPtr)->unk_7D != 0) {
if (gGameStatusPtr->unk_7D != 0) {
D_8010EBB0.unk_00 = 1;
(*gGameStatusPtr)->unk_7D = 0;
gGameStatusPtr->unk_7D = 0;
}
wPartner = NULL;
@ -597,7 +597,7 @@ void func_800EBB40(Npc *partner) {
PlayerStatus* playerStatus = &gPlayerStatus;
Temp8010EBB0* temp8010EBB0 = &D_8010EBB0;
if ((*gGameStatusPtr)->unk_81 == 0 || playerStatus->flags & 0x3000 || temp8010EBB0->unk_14 != 0 || temp8010EBB0->unk_02 != 0) {
if (gGameStatusPtr->unk_81 == 0 || playerStatus->flags & 0x3000 || temp8010EBB0->unk_14 != 0 || temp8010EBB0->unk_02 != 0) {
if (!(playerStatus->animFlags & 0x800)) {
func_800EBC74(partner);
}

View File

@ -58,7 +58,7 @@ INCLUDE_ASM(s32, "world/script_api/7E0E80", draw_shop_items);
INCLUDE_ASM(s32, "world/script_api/7E0E80", MakeShop);
ApiStatus MakeShopOwner(ScriptInstance* script, s32 isInitialCall) {
Shop* mapShop = (*gGameStatusPtr)->mapShop;
Shop* mapShop = gGameStatusPtr->mapShop;
mapShop->owner = get_variable(script, *script->ptrReadPos);
return ApiStatus_DONE2;

View File

@ -48,9 +48,9 @@ ApiStatus func_80283908(ScriptInstance* script, s32 isInitialCall) {
Camera* camera = CURRENT_CAM;
s8 currentPartner = gPlayerData.currentPartner;
playerStatus->position.x = (*gGameStatusPtr)->savedPos.x;
playerStatus->position.y = (*gGameStatusPtr)->savedPos.y;
playerStatus->position.z = (*gGameStatusPtr)->savedPos.z;
playerStatus->position.x = gGameStatusPtr->savedPos.x;
playerStatus->position.y = gGameStatusPtr->savedPos.y;
playerStatus->position.z = gGameStatusPtr->savedPos.z;
if (currentPartner != PartnerID_NONE) {
Npc* partner = get_npc_unsafe(NpcId_PARTNER);

View File

@ -1,138 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel begin_state_intro
/* 11A50 80036650 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 11A54 80036654 AFB10014 */ sw $s1, 0x14($sp)
/* 11A58 80036658 3C118007 */ lui $s1, %hi(gGameStatusPtr)
/* 11A5C 8003665C 2631419C */ addiu $s1, $s1, %lo(gGameStatusPtr)
/* 11A60 80036660 AFBF0018 */ sw $ra, 0x18($sp)
/* 11A64 80036664 AFB00010 */ sw $s0, 0x10($sp)
/* 11A68 80036668 8E220000 */ lw $v0, ($s1)
/* 11A6C 8003666C 3C013F80 */ lui $at, 0x3f80
/* 11A70 80036670 44816000 */ mtc1 $at, $f12
/* 11A74 80036674 0C00AFB7 */ jal set_curtain_scale_goal
/* 11A78 80036678 A04000AC */ sb $zero, 0xac($v0)
/* 11A7C 8003667C 3C013E99 */ lui $at, 0x3e99
/* 11A80 80036680 3421999A */ ori $at, $at, 0x999a
/* 11A84 80036684 44816000 */ mtc1 $at, $f12
/* 11A88 80036688 0C00AFC5 */ jal set_curtain_fade_goal
/* 11A8C 8003668C 00000000 */ nop
/* 11A90 80036690 8E220000 */ lw $v0, ($s1)
/* 11A94 80036694 805000A8 */ lb $s0, 0xa8($v0)
/* 11A98 80036698 12000005 */ beqz $s0, .L800366B0
/* 11A9C 8003669C 24020001 */ addiu $v0, $zero, 1
/* 11AA0 800366A0 12020020 */ beq $s0, $v0, .L80036724
/* 11AA4 800366A4 00000000 */ nop
/* 11AA8 800366A8 0800D9E3 */ j .L8003678C
/* 11AAC 800366AC 00000000 */ nop
.L800366B0:
/* 11AB0 800366B0 0C00CDF4 */ jal intro_logos_set_fade_alpha
/* 11AB4 800366B4 0000202D */ daddu $a0, $zero, $zero
/* 11AB8 800366B8 240200FF */ addiu $v0, $zero, 0xff
/* 11ABC 800366BC 3C01800A */ lui $at, %hi(D_800A0954)
/* 11AC0 800366C0 A4220954 */ sh $v0, %lo(D_800A0954)($at)
/* 11AC4 800366C4 24020010 */ addiu $v0, $zero, 0x10
/* 11AC8 800366C8 3C01800A */ lui $at, %hi(D_800A0956)
/* 11ACC 800366CC A4220956 */ sh $v0, %lo(D_800A0956)($at)
/* 11AD0 800366D0 24020004 */ addiu $v0, $zero, 4
/* 11AD4 800366D4 3C01800A */ lui $at, %hi(D_800A0958)
/* 11AD8 800366D8 A4220958 */ sh $v0, %lo(D_800A0958)($at)
/* 11ADC 800366DC 240200D0 */ addiu $v0, $zero, 0xd0
/* 11AE0 800366E0 3C01800A */ lui $at, %hi(D_800A0960)
/* 11AE4 800366E4 AC200960 */ sw $zero, %lo(D_800A0960)($at)
/* 11AE8 800366E8 3C01800A */ lui $at, %hi(D_800A095A)
/* 11AEC 800366EC A422095A */ sh $v0, %lo(D_800A095A)($at)
/* 11AF0 800366F0 3C01800A */ lui $at, %hi(D_800A095C)
/* 11AF4 800366F4 A422095C */ sh $v0, %lo(D_800A095C)($at)
/* 11AF8 800366F8 3C01800A */ lui $at, %hi(D_800A095E)
/* 11AFC 800366FC A422095E */ sh $v0, %lo(D_800A095E)($at)
/* 11B00 80036700 3C01800A */ lui $at, %hi(D_800A0964)
/* 11B04 80036704 AC200964 */ sw $zero, %lo(D_800A0964)($at)
/* 11B08 80036708 8E230000 */ lw $v1, ($s1)
/* 11B0C 8003670C 24020005 */ addiu $v0, $zero, 5
/* 11B10 80036710 A4620086 */ sh $v0, 0x86($v1)
/* 11B14 80036714 A462008C */ sh $v0, 0x8c($v1)
/* 11B18 80036718 24020003 */ addiu $v0, $zero, 3
/* 11B1C 8003671C 0800D9FC */ j .L800367F0
/* 11B20 80036720 A462008E */ sh $v0, 0x8e($v1)
.L80036724:
/* 11B24 80036724 0C00CDF4 */ jal intro_logos_set_fade_alpha
/* 11B28 80036728 0000202D */ daddu $a0, $zero, $zero
/* 11B2C 8003672C 2402000C */ addiu $v0, $zero, 0xc
/* 11B30 80036730 24040004 */ addiu $a0, $zero, 4
/* 11B34 80036734 3C01800A */ lui $at, %hi(D_800A0954)
/* 11B38 80036738 A4200954 */ sh $zero, %lo(D_800A0954)($at)
/* 11B3C 8003673C 3C01800A */ lui $at, %hi(D_800A0956)
/* 11B40 80036740 A4220956 */ sh $v0, %lo(D_800A0956)($at)
/* 11B44 80036744 3C01800A */ lui $at, %hi(D_800A0958)
/* 11B48 80036748 A4240958 */ sh $a0, %lo(D_800A0958)($at)
/* 11B4C 8003674C 3C01800A */ lui $at, %hi(D_800A0960)
/* 11B50 80036750 AC300960 */ sw $s0, %lo(D_800A0960)($at)
/* 11B54 80036754 3C01800A */ lui $at, %hi(D_800A095A)
/* 11B58 80036758 A420095A */ sh $zero, %lo(D_800A095A)($at)
/* 11B5C 8003675C 3C01800A */ lui $at, %hi(D_800A095C)
/* 11B60 80036760 A420095C */ sh $zero, %lo(D_800A095C)($at)
/* 11B64 80036764 3C01800A */ lui $at, %hi(D_800A095E)
/* 11B68 80036768 A420095E */ sh $zero, %lo(D_800A095E)($at)
/* 11B6C 8003676C 3C01800A */ lui $at, %hi(D_800A0964)
/* 11B70 80036770 AC200964 */ sw $zero, %lo(D_800A0964)($at)
/* 11B74 80036774 8E220000 */ lw $v0, ($s1)
/* 11B78 80036778 24030005 */ addiu $v1, $zero, 5
/* 11B7C 8003677C A4430086 */ sh $v1, 0x86($v0)
/* 11B80 80036780 A444008C */ sh $a0, 0x8c($v0)
/* 11B84 80036784 0800D9FC */ j .L800367F0
/* 11B88 80036788 A444008E */ sh $a0, 0x8e($v0)
.L8003678C:
/* 11B8C 8003678C 0C00CDF4 */ jal intro_logos_set_fade_alpha
/* 11B90 80036790 0000202D */ daddu $a0, $zero, $zero
/* 11B94 80036794 0C00CDF8 */ jal intro_logos_set_fade_color
/* 11B98 80036798 240400D0 */ addiu $a0, $zero, 0xd0
/* 11B9C 8003679C 2402FFFF */ addiu $v0, $zero, -1
/* 11BA0 800367A0 3C038007 */ lui $v1, %hi(gGameStatusPtr)
/* 11BA4 800367A4 8C63419C */ lw $v1, %lo(gGameStatusPtr)($v1)
/* 11BA8 800367A8 3C048007 */ lui $a0, %hi(D_800779B0)
/* 11BAC 800367AC 248479B0 */ addiu $a0, $a0, %lo(D_800779B0)
/* 11BB0 800367B0 A06200A8 */ sb $v0, 0xa8($v1)
/* 11BB4 800367B4 90820000 */ lbu $v0, ($a0)
/* 11BB8 800367B8 24030006 */ addiu $v1, $zero, 6
/* 11BBC 800367BC 3C01800A */ lui $at, %hi(D_800A0956)
/* 11BC0 800367C0 A4230956 */ sh $v1, %lo(D_800A0956)($at)
/* 11BC4 800367C4 3C01800A */ lui $at, %hi(D_800A0958)
/* 11BC8 800367C8 A4230958 */ sh $v1, %lo(D_800A0958)($at)
/* 11BCC 800367CC 24420001 */ addiu $v0, $v0, 1
/* 11BD0 800367D0 A0820000 */ sb $v0, ($a0)
/* 11BD4 800367D4 304200FF */ andi $v0, $v0, 0xff
/* 11BD8 800367D8 2C420004 */ sltiu $v0, $v0, 4
/* 11BDC 800367DC 50400001 */ beql $v0, $zero, .L800367E4
/* 11BE0 800367E0 A0800000 */ sb $zero, ($a0)
.L800367E4:
/* 11BE4 800367E4 24020003 */ addiu $v0, $zero, 3
/* 11BE8 800367E8 3C01800A */ lui $at, %hi(D_800A0964)
/* 11BEC 800367EC AC220964 */ sw $v0, %lo(D_800A0964)($at)
.L800367F0:
/* 11BF0 800367F0 3C02800A */ lui $v0, %hi(D_800A0954)
/* 11BF4 800367F4 84420954 */ lh $v0, %lo(D_800A0954)($v0)
/* 11BF8 800367F8 3C04800A */ lui $a0, %hi(D_800A0963)
/* 11BFC 800367FC 90840963 */ lbu $a0, %lo(D_800A0963)($a0)
/* 11C00 80036800 44820000 */ mtc1 $v0, $f0
/* 11C04 80036804 00000000 */ nop
/* 11C08 80036808 46800020 */ cvt.s.w $f0, $f0
/* 11C0C 8003680C 44050000 */ mfc1 $a1, $f0
/* 11C10 80036810 0C04DF69 */ jal set_transition_stencil_zoom_1
/* 11C14 80036814 00000000 */ nop
/* 11C18 80036818 3C05800A */ lui $a1, %hi(D_800A095B)
/* 11C1C 8003681C 90A5095B */ lbu $a1, %lo(D_800A095B)($a1)
/* 11C20 80036820 3C06800A */ lui $a2, %hi(D_800A095D)
/* 11C24 80036824 90C6095D */ lbu $a2, %lo(D_800A095D)($a2)
/* 11C28 80036828 3C07800A */ lui $a3, 0x800a
/* 11C2C 8003682C 90E7095F */ lbu $a3, 0x95f($a3)
/* 11C30 80036830 0C04DF84 */ jal set_transition_stencil_color
/* 11C34 80036834 24040001 */ addiu $a0, $zero, 1
/* 11C38 80036838 0C00CE1D */ jal intro_logos_update_fade
/* 11C3C 8003683C 00000000 */ nop
/* 11C40 80036840 8FBF0018 */ lw $ra, 0x18($sp)
/* 11C44 80036844 8FB10014 */ lw $s1, 0x14($sp)
/* 11C48 80036848 8FB00010 */ lw $s0, 0x10($sp)
/* 11C4C 8003684C 03E00008 */ jr $ra
/* 11C50 80036850 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,51 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8027FC90
/* 1AE570 8027FC90 27BDFFD0 */ addiu $sp, $sp, -0x30
/* 1AE574 8027FC94 AFB40028 */ sw $s4, 0x28($sp)
/* 1AE578 8027FC98 0080A02D */ daddu $s4, $a0, $zero
/* 1AE57C 8027FC9C AFBF002C */ sw $ra, 0x2c($sp)
/* 1AE580 8027FCA0 AFB30024 */ sw $s3, 0x24($sp)
/* 1AE584 8027FCA4 AFB20020 */ sw $s2, 0x20($sp)
/* 1AE588 8027FCA8 AFB1001C */ sw $s1, 0x1c($sp)
/* 1AE58C 8027FCAC AFB00018 */ sw $s0, 0x18($sp)
/* 1AE590 8027FCB0 8E92000C */ lw $s2, 0xc($s4)
/* 1AE594 8027FCB4 8E450000 */ lw $a1, ($s2)
/* 1AE598 8027FCB8 0C0B1EAF */ jal get_variable
/* 1AE59C 8027FCBC 26520004 */ addiu $s2, $s2, 4
/* 1AE5A0 8027FCC0 0040202D */ daddu $a0, $v0, $zero
/* 1AE5A4 8027FCC4 3C13800E */ lui $s3, %hi(gBattleStatus)
/* 1AE5A8 8027FCC8 2673C070 */ addiu $s3, $s3, %lo(gBattleStatus)
/* 1AE5AC 8027FCCC 2402FF81 */ addiu $v0, $zero, -0x7f
/* 1AE5B0 8027FCD0 14820002 */ bne $a0, $v0, .L8027FCDC
/* 1AE5B4 8027FCD4 00000000 */ nop
/* 1AE5B8 8027FCD8 8E840148 */ lw $a0, 0x148($s4)
.L8027FCDC:
/* 1AE5BC 8027FCDC 0C09A75B */ jal get_actor
/* 1AE5C0 8027FCE0 8E520000 */ lw $s2, ($s2)
/* 1AE5C4 8027FCE4 8E630000 */ lw $v1, ($s3)
/* 1AE5C8 8027FCE8 0040802D */ daddu $s0, $v0, $zero
/* 1AE5CC 8027FCEC 34630020 */ ori $v1, $v1, 0x20
/* 1AE5D0 8027FCF0 0C09F8CA */ jal calc_partner_damage_enemy
/* 1AE5D4 8027FCF4 AE630000 */ sw $v1, ($s3)
/* 1AE5D8 8027FCF8 AFA00010 */ sw $zero, 0x10($sp)
/* 1AE5DC 8027FCFC 8E060020 */ lw $a2, 0x20($s0)
/* 1AE5E0 8027FD00 86670180 */ lh $a3, 0x180($s3)
/* 1AE5E4 8027FD04 C60C0018 */ lwc1 $f12, 0x18($s0)
/* 1AE5E8 8027FD08 C60E001C */ lwc1 $f14, 0x1c($s0)
/* 1AE5EC 8027FD0C 0C09996B */ jal show_damage_popup
/* 1AE5F0 8027FD10 0040882D */ daddu $s1, $v0, $zero
/* 1AE5F4 8027FD14 0280202D */ daddu $a0, $s4, $zero
/* 1AE5F8 8027FD18 0240282D */ daddu $a1, $s2, $zero
/* 1AE5FC 8027FD1C 0C0B2026 */ jal set_variable
/* 1AE600 8027FD20 0220302D */ daddu $a2, $s1, $zero
/* 1AE604 8027FD24 8FBF002C */ lw $ra, 0x2c($sp)
/* 1AE608 8027FD28 8FB40028 */ lw $s4, 0x28($sp)
/* 1AE60C 8027FD2C 8FB30024 */ lw $s3, 0x24($sp)
/* 1AE610 8027FD30 8FB20020 */ lw $s2, 0x20($sp)
/* 1AE614 8027FD34 8FB1001C */ lw $s1, 0x1c($sp)
/* 1AE618 8027FD38 8FB00018 */ lw $s0, 0x18($sp)
/* 1AE61C 8027FD3C 24020002 */ addiu $v0, $zero, 2
/* 1AE620 8027FD40 03E00008 */ jr $ra
/* 1AE624 8027FD44 27BD0030 */ addiu $sp, $sp, 0x30