summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2023-08-17 12:19:13 -0400
committerGitHub <noreply@github.com>2023-08-17 09:19:13 -0700
commitc65a8dbc3903af19fe0253ab8774accbc06b0cb7 (patch)
tree8c136e0ecea87503261cdd22fc5b81cf31044f50 /src/code
parent1bebc761b638ad061778667e4bab4ec92fe81aa7 (diff)
Game renaming (#63)
* rename GameState to Game * Rename the structs * fix table * whoops * rename play parameter * format * undo what i messed in z64compress
Diffstat (limited to 'src/code')
-rw-r--r--src/code/c_keyframe.c29
-rw-r--r--src/code/game.c36
-rw-r--r--src/code/m_actor.c284
-rw-r--r--src/code/m_controller.c6
-rw-r--r--src/code/m_game_dlftbls.c4
-rw-r--r--src/code/sys_matrix.c2
6 files changed, 182 insertions, 179 deletions
diff --git a/src/code/c_keyframe.c b/src/code/c_keyframe.c
index 352eac5..385de5e 100644
--- a/src/code/c_keyframe.c
+++ b/src/code/c_keyframe.c
@@ -529,7 +529,7 @@ s32 cKF_SkeletonInfo_R_play(SkeletonInfoR* skeletonInfo) {
return cKF_FrameControl_play(&skeletonInfo->frameControl);
} else if (skeletonInfo->morphCounter > 0.0f) {
- // A positive morphCounter will wait to play the animation until the morph has finished.
+ // A positive morphCounter will wait to game_play the animation until the morph has finished.
cKF_SkeletonInfo_R_morphJoint(skeletonInfo);
skeletonInfo->morphCounter -= 1.0f;
@@ -539,7 +539,7 @@ s32 cKF_SkeletonInfo_R_play(SkeletonInfoR* skeletonInfo) {
return 0;
} else {
- // A negative morphCounter will play the animation and morph at the same time.
+ // A negative morphCounter will game_play the animation and morph at the same time.
cKF_SkeletonInfo_R_morphJoint(skeletonInfo);
skeletonInfo->morphCounter += 1.0f;
@@ -563,8 +563,8 @@ s32 cKF_SkeletonInfo_R_play(SkeletonInfoR* skeletonInfo) {
*
* @param jointIndex The index of the jointElem to draw.
*/
-void cKF_Si3_draw_SV_R_child(PlayState* play, SkeletonInfoR* skeletonInfo, s32* jointIndex, DrawCallback beforeCallback,
- DrawCallback afterCallback, void* arg, Mtx** mtx) {
+void cKF_Si3_draw_SV_R_child(Game_Play* game_play, SkeletonInfoR* skeletonInfo, s32* jointIndex,
+ DrawCallback beforeCallback, DrawCallback afterCallback, void* arg, Mtx** mtx) {
JointElemR* jointElem = *jointIndex + (JointElemR*)Lib_SegmentedToVirtual(skeletonInfo->skeleton->jointElemTable);
s32 i;
Gfx* newDlist;
@@ -616,14 +616,14 @@ void cKF_Si3_draw_SV_R_child(PlayState* play, SkeletonInfoR* skeletonInfo, s32*
}
}
- OPEN_DISPS(play->state.gfxCtx);
+ OPEN_DISPS(game_play->state.gfxCtx);
Matrix_push();
newDlist = shape = jointElem->shape;
displayBufferFlag = jointElem->displayBufferFlag;
if ((beforeCallback == NULL) ||
- (beforeCallback != NULL && beforeCallback(play, skeletonInfo, *jointIndex, &newDlist, &displayBufferFlag, arg,
- &rotation, &translation) != NULL)) {
+ (beforeCallback != NULL && beforeCallback(game_play, skeletonInfo, *jointIndex, &newDlist, &displayBufferFlag,
+ arg, &rotation, &translation) != NULL)) {
Matrix_softcv3_mult(&translation, &rotation);
if (newDlist != NULL) {
@@ -647,17 +647,18 @@ void cKF_Si3_draw_SV_R_child(PlayState* play, SkeletonInfoR* skeletonInfo, s32*
}
if (afterCallback != NULL) {
- afterCallback(play, skeletonInfo, *jointIndex, &newDlist, &displayBufferFlag, arg, &rotation, &translation);
+ afterCallback(game_play, skeletonInfo, *jointIndex, &newDlist, &displayBufferFlag, arg, &rotation,
+ &translation);
}
(*jointIndex)++;
for (i = 0; i < jointElem->numberOfChildren; i++) {
- cKF_Si3_draw_SV_R_child(play, skeletonInfo, jointIndex, beforeCallback, afterCallback, arg, mtx);
+ cKF_Si3_draw_SV_R_child(game_play, skeletonInfo, jointIndex, beforeCallback, afterCallback, arg, mtx);
}
Matrix_pull();
- CLOSE_DISPS(play->state.gfxCtx);
+ CLOSE_DISPS(game_play->state.gfxCtx);
}
/**
@@ -665,17 +666,17 @@ void cKF_Si3_draw_SV_R_child(PlayState* play, SkeletonInfoR* skeletonInfo, s32*
*
* This function calls cKF_Si3_draw_SV_R_child() to recursively draw each joint.
*/
-void cKF_Si3_draw_R_SV(PlayState* play, SkeletonInfoR* skeletonInfo, Mtx* mtx, DrawCallback beforeCallback,
+void cKF_Si3_draw_R_SV(Game_Play* game_play, SkeletonInfoR* skeletonInfo, Mtx* mtx, DrawCallback beforeCallback,
DrawCallback afterCallback, void* arg) {
s32 jointIndex;
if (mtx != NULL) {
- OPEN_DISPS(play->state.gfxCtx);
+ OPEN_DISPS(game_play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x0D, mtx);
gSPSegment(POLY_XLU_DISP++, 0x0D, mtx);
jointIndex = 0;
- cKF_Si3_draw_SV_R_child(play, skeletonInfo, &jointIndex, beforeCallback, afterCallback, arg, &mtx);
- CLOSE_DISPS(play->state.gfxCtx);
+ cKF_Si3_draw_SV_R_child(game_play, skeletonInfo, &jointIndex, beforeCallback, afterCallback, arg, &mtx);
+ CLOSE_DISPS(game_play->state.gfxCtx);
}
}
diff --git a/src/code/game.c b/src/code/game.c
index 03677a8..a9a37ed 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -17,17 +17,17 @@
#include "overlays/gamestates/ovl_famicom_emu/famicom_emu.h"
#include "macros.h"
-GameState* gamePT = NULL;
+Game* gamePT = NULL;
struct_80145020_jp B_80145020_jp;
s16 B_80145040_jp;
-GameState* game_class_p;
+Game* game_class_p;
u8 game_GameFrame;
f32 game_GameFrameF;
f32 game_GameFrame_2F;
f32 game_GameFrame__1F;
-void func_800D2E00_jp(GameState* gameState) {
+void func_800D2E00_jp(Game* gameState) {
if (zurumode_flag >= 2) {
Debug_mode_input(CONTROLLER2(gameState));
}
@@ -82,7 +82,7 @@ void func_800D2E58_jp(u16 button, Gfx** gfxP) {
*gfxP = gfx;
}
-void game_debug_draw_last(GameState* gameState, GraphicsContext* gfxCtx) {
+void game_debug_draw_last(Game* gameState, GraphicsContext* gfxCtx) {
Gfx* gfx;
Gfx* gfxHead;
@@ -172,7 +172,7 @@ void game_draw_last(GraphicsContext* gfxCtx) {
CLOSE_DISPS(gfxCtx);
}
-void game_get_controller(GameState* gameState) {
+void game_get_controller(Game* gameState) {
if (gameState->unk_74 == 1) {
padmgr_RequestPadData(gameState->input, 1);
} else {
@@ -190,7 +190,7 @@ void SetGameFrame(s32 divisor) {
}
}
-void game_main(GameState* gameState) {
+void game_main(Game* gameState) {
GraphicsContext* gfxCtx = gameState->gfxCtx;
u8 gameframe = game_GameFrame;
@@ -213,7 +213,7 @@ void game_main(GameState* gameState) {
gameState->unk_A0++;
}
-void game_init_hyral(GameState* gameState, size_t size) {
+void game_init_hyral(Game* gameState, size_t size) {
void* buf = gamealloc_malloc(&gameState->alloc, size);
if (buf != NULL) {
@@ -225,7 +225,7 @@ void game_init_hyral(GameState* gameState, size_t size) {
_dbg_hungup("../game.c", 462);
}
-void game_resize_hyral(GameState* gameState, size_t size) {
+void game_resize_hyral(Game* gameState, size_t size) {
GameAlloc* alloc = &gameState->alloc;
void* gameArena;
size_t maxFree;
@@ -254,7 +254,7 @@ void game_resize_hyral(GameState* gameState, size_t size) {
_dbg_hungup("../game.c", 508);
}
-void game_ct(GameState* gameState, GameStateFunc init, GraphicsContext* gfxCtx) {
+void game_ct(Game* gameState, GameStateFunc init, GraphicsContext* gfxCtx) {
gamePT = gameState;
gfxCtx->unk_2F2 = 1;
@@ -291,7 +291,7 @@ void game_ct(GameState* gameState, GameStateFunc init, GraphicsContext* gfxCtx)
func_800D3E14_jp(gameState->gfxCtx);
}
-void game_dt(GameState* gameState) {
+void game_dt(Game* gameState) {
mCon_dt(gameState);
func_800D3E40_jp(gameState->gfxCtx);
mBGM_cleanup();
@@ -306,28 +306,28 @@ void game_dt(GameState* gameState) {
gamePT = NULL;
}
-GameStateFunc game_get_next_game_init(GameState* gameState) {
+GameStateFunc game_get_next_game_init(Game* gameState) {
return gameState->init;
}
-size_t game_get_next_game_class_size(GameState* gameState) {
+size_t game_get_next_game_class_size(Game* gameState) {
return gameState->size;
}
-s32 game_is_doing(GameState* gameState) {
+s32 game_is_doing(Game* gameState) {
return gameState->running;
}
-s32 game_getFreeBytes(GameState* gameState) {
+s32 game_getFreeBytes(Game* gameState) {
return THA_getFreeBytes(&gameState->heap);
}
-void game_goto_next_game_play(GameState* gameState) {
+void game_goto_next_game_play(Game* gameState) {
STOP_GAMESTATE(gameState);
- SET_NEXT_GAMESTATE(gameState, play_init, sizeof(PlayState));
+ SET_NEXT_GAMESTATE(gameState, play_init, sizeof(Game_Play));
}
-void game_goto_next_game_name_famicom_emu(GameState* gameState) {
+void game_goto_next_game_name_famicom_emu(Game* gameState) {
STOP_GAMESTATE(gameState);
- SET_NEXT_GAMESTATE(gameState, famicom_emu_init, sizeof(FamicomEmuState));
+ SET_NEXT_GAMESTATE(gameState, famicom_emu_init, sizeof(Game_FamicomEmu));
}
diff --git a/src/code/m_actor.c b/src/code/m_actor.c
index ccc31fd..21fc868 100644
--- a/src/code/m_actor.c
+++ b/src/code/m_actor.c
@@ -40,8 +40,8 @@ void func_80056380_jp(void* arg0, void* arg1 UNUSED) {
FaultDrawer_Printf("ACTOR NAME %08x:%s", actor, name);
}
-void projection_pos_set(PlayState* play, Vec3f* worldPos, Vec3f* projectedPos, f32* invW) {
- Skin_Matrix_PrjMulVector(&play->viewProjectionMtxF, worldPos, projectedPos, invW);
+void projection_pos_set(Game_Play* game_play, Vec3f* worldPos, Vec3f* projectedPos, f32* invW) {
+ Skin_Matrix_PrjMulVector(&game_play->viewProjectionMtxF, worldPos, projectedPos, invW);
*invW = (*invW < 1.0f) ? 1.0f : (1.0f / *invW);
}
@@ -56,7 +56,7 @@ void Actor_world_to_eye(Actor* actor, f32 arg1) {
}
void Actor_position_move(Actor* actor) {
- Kankyo* kankyo = &((PlayState*)gamePT)->kankyo;
+ Kankyo* kankyo = &((Game_Play*)gamePT)->kankyo;
f32 speedRate;
speedRate = game_GameFrame_2F;
@@ -80,34 +80,34 @@ void Actor_position_moveF(Actor* actor) {
Actor_position_move(actor);
}
-s32 Actor_player_look_direction_check(Actor* actor, s16 maxAngleDiff, PlayState* play) {
- s16 yawDiff = BINANG_ROT180(actor->yawTowardsPlayer) - get_player_actor_withoutCheck(play)->actor.shape.rot.y;
+s32 Actor_player_look_direction_check(Actor* actor, s16 maxAngleDiff, Game_Play* game_play) {
+ s16 yawDiff = BINANG_ROT180(actor->yawTowardsPlayer) - get_player_actor_withoutCheck(game_play)->actor.shape.rot.y;
return ABS(yawDiff) < maxAngleDiff;
}
-void Actor_display_position_set(PlayState* play, Actor* actor, s16* x, s16* y) {
+void Actor_display_position_set(Game_Play* game_play, Actor* actor, s16* x, s16* y) {
Vec3f projectedPos;
f32 invW;
- projection_pos_set(play, &actor->world.pos, &projectedPos, &invW);
+ projection_pos_set(game_play, &actor->world.pos, &projectedPos, &invW);
// Explicit cast to avoid implicit cast from f32 to s16
*x = (s32)PROJECTED_TO_SCREEN_X(projectedPos, invW);
*y = (s32)PROJECTED_TO_SCREEN_Y(projectedPos, invW);
}
-s32 Actor_data_bank_dma_end_check(Actor* actor, PlayState* play) {
+s32 Actor_data_bank_dma_end_check(Actor* actor, Game_Play* game_play) {
s32 var_v1;
switch (ACTOR_FGNAME_GET_F000(actor->fgName)) {
case FGNAME_F000_D:
case FGNAME_F000_E:
- var_v1 = common_data.unk_1004C->unk_F4(play->unk_0110, actor);
+ var_v1 = common_data.unk_1004C->unk_F4(game_play->unk_0110, actor);
break;
default:
- var_v1 = play->unk_0110[actor->unk_026].unk_00 > 0;
+ var_v1 = game_play->unk_0110[actor->unk_026].unk_00 > 0;
break;
}
@@ -145,14 +145,14 @@ void Actor_delete(Actor* actor) {
}
}
-void Actor_ct(Actor* actor, PlayState* play) {
+void Actor_ct(Actor* actor, Game_Play* game_play) {
s32 pad[2] UNUSED;
- PlayState_unk_0110* temp;
+ Game_Play_unk_0110* temp;
Npc* npc;
CommonData_unk_1004C_unk_14_arg0 sp34;
- PlayState_unk_0110* temp_a0;
+ Game_Play_unk_0110* temp_a0;
- temp_a0 = play->unk_0110;
+ temp_a0 = game_play->unk_0110;
temp = temp_a0;
temp += actor->unk_026;
@@ -192,25 +192,25 @@ void Actor_ct(Actor* actor, PlayState* play) {
CollisionCheck_Status_ct(&actor->colStatus);
Shape_Info_init(actor, 0.0f, NULL, 0.0f, 0.0f);
- if (Actor_data_bank_dma_end_check(actor, play) == 1) {
+ if (Actor_data_bank_dma_end_check(actor, game_play) == 1) {
gSegments[6] = (uintptr_t)OS_K0_TO_PHYSICAL(temp_a0[actor->unk_026].segment);
- actor->ct(actor, play);
+ actor->ct(actor, game_play);
actor->ct = NULL;
}
}
#ifdef NON_MATCHING
-void Actor_dt(Actor* actor, PlayState* play) {
- PlayState_unk_0110* temp_v0_6;
+void Actor_dt(Actor* actor, Game_Play* game_play) {
+ Game_Play_unk_0110* temp_v0_6;
s32 new_var;
if (actor->save != NULL) {
- actor->save(actor, play);
+ actor->save(actor, game_play);
actor->save = NULL;
}
if (actor->dt != NULL) {
- actor->dt(actor, play);
+ actor->dt(actor, game_play);
actor->dt = NULL;
}
@@ -222,7 +222,7 @@ void Actor_dt(Actor* actor, PlayState* play) {
actor->parent->child = NULL;
}
- temp_v0_6 = play->unk_0110;
+ temp_v0_6 = game_play->unk_0110;
if (0) {}
switch ((actor->fgName & 0xF000) >> 0xC) {
@@ -232,7 +232,7 @@ void Actor_dt(Actor* actor, PlayState* play) {
break;
default:
- new_var = play->unk_190C;
+ new_var = game_play->unk_190C;
if (actor->unk_026 >= new_var) {
temp_v0_6 = &temp_v0_6[(void)0, actor->unk_026];
@@ -245,11 +245,11 @@ void Actor_dt(Actor* actor, PlayState* play) {
}
}
#else
-void Actor_dt(Actor* actor, struct PlayState* play);
+void Actor_dt(Actor* actor, struct Game_Play* game_play);
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_actor/Actor_dt.s")
#endif
-void Actor_draw(PlayState* play, Actor* actor) {
+void Actor_draw(Game_Play* game_play, Actor* actor) {
FaultClient faultClient;
Lights* light;
@@ -261,18 +261,19 @@ void Actor_draw(PlayState* play, Actor* actor) {
if (1) {}
if (1) {}
- OPEN_DISPS(play->state.gfxCtx);
+ OPEN_DISPS(game_play->state.gfxCtx);
- light = Global_light_read(&play->lightCtx, play->state.gfxCtx);
- LightsN_list_check(light, play->lightCtx.listHead, (actor->flags & ACTOR_FLAG_400000) ? NULL : &actor->world.pos);
- LightsN_disp(light, play->state.gfxCtx);
+ light = Global_light_read(&game_play->lightCtx, game_play->state.gfxCtx);
+ LightsN_list_check(light, game_play->lightCtx.listHead,
+ (actor->flags & ACTOR_FLAG_400000) ? NULL : &actor->world.pos);
+ LightsN_disp(light, game_play->state.gfxCtx);
Matrix_softcv3_load(actor->world.pos.x, actor->world.pos.y + actor->shape.unk_08 * actor->scale.y,
actor->world.pos.z, &actor->shape.rot);
Matrix_scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY);
{
- void* segment = play->unk_0110[(void)0, actor->unk_026].segment;
+ void* segment = game_play->unk_0110[(void)0, actor->unk_026].segment;
gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(segment);
@@ -281,13 +282,13 @@ void Actor_draw(PlayState* play, Actor* actor) {
gSPSegment(UNK_2C0_DISP++, 0x06, segment);
}
- actor->draw(actor, play);
+ actor->draw(actor, game_play);
if (actor->shape.unk_0C != NULL) {
- actor->shape.unk_0C(actor, light, play);
+ actor->shape.unk_0C(actor, light, game_play);
}
- CLOSE_DISPS(play->state.gfxCtx);
+ CLOSE_DISPS(game_play->state.gfxCtx);
Fault_RemoveClient(&faultClient);
}
@@ -328,7 +329,7 @@ void Actor_cull_check(Actor* actor) {
}
}
-void Actor_delete_check(Actor* actor, PlayState* play) {
+void Actor_delete_check(Actor* actor, Game_Play* game_play) {
if ((actor->flags & (ACTOR_FLAG_40 | ACTOR_FLAG_20 | ACTOR_FLAG_10)) || (actor->fgName == 0)) {
return;
}
@@ -337,15 +338,15 @@ void Actor_delete_check(Actor* actor, PlayState* play) {
return;
}
- if ((actor->unk_008 == play->unk_00E4) && (actor->unk_009 == play->unk_00E5)) {
+ if ((actor->unk_008 == game_play->unk_00E4) && (actor->unk_009 == game_play->unk_00E5)) {
return;
}
Actor_delete(actor);
}
-void Actor_info_ct(PlayState* play2, ActorInfo* actorInfo, ActorEntry* actorEntry) {
- PlayState* play = play2;
+void Actor_info_ct(Game_Play* play2, ActorInfo* actorInfo, ActorEntry* actorEntry) {
+ Game_Play* game_play = play2;
Actor* temp_v0;
ActorOverlay* var_v0;
ActorEntry* var_s0_2;
@@ -355,8 +356,8 @@ void Actor_info_ct(PlayState* play2, ActorInfo* actorInfo, ActorEntry* actorEntr
bzero(actorInfo, sizeof(ActorInfo));
actor_dlftbls_init();
- Matrix_copy_MtxF(&play->billboardMtxF, &MtxF_clear);
- Matrix_copy_MtxF(&play->viewProjectionMtxF, &MtxF_clear);
+ Matrix_copy_MtxF(&game_play->billboardMtxF, &MtxF_clear);
+ Matrix_copy_MtxF(&game_play->viewProjectionMtxF, &MtxF_clear);
var_v0 = actor_dlftbls;
for (var_s1 = 0; var_s1 < 0xC9; var_s1++) {
@@ -370,59 +371,59 @@ void Actor_info_ct(PlayState* play2, ActorInfo* actorInfo, ActorEntry* actorEntr
}
if (common_data.unk_107B6 != 0xC9) {
- Actor_info_make_actor(actorInfo, play, common_data.unk_107B6, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, 0, -1, -1,
- -1);
+ Actor_info_make_actor(actorInfo, game_play, common_data.unk_107B6, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, 0, -1,
+ -1, -1);
}
common_data.unk_107B6 = 0xC9;
label:
- temp_v0 = Actor_info_make_actor(actorInfo, play, actorEntry->id, actorEntry->pos.x, actorEntry->pos.y,
+ temp_v0 = Actor_info_make_actor(actorInfo, game_play, actorEntry->id, actorEntry->pos.x, actorEntry->pos.y,
actorEntry->pos.z, actorEntry->rot.x, actorEntry->rot.y, actorEntry->rot.z, -1, -1,
-1, 0, actorEntry->params, -1, -1);
if (temp_v0 != NULL) {
temp_v0->world.pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(temp_v0->world.pos, 0.0f);
- mFI_SetBearActor(play, temp_v0->world.pos, 0);
+ mFI_SetBearActor(game_play, temp_v0->world.pos, 0);
}
if (common_data.unk_1014E != 0) {
- Actor_info_make_actor(actorInfo, play, common_data.unk_1014E, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, 0, -1, -1,
- -1);
+ Actor_info_make_actor(actorInfo, game_play, common_data.unk_1014E, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, 0, -1,
+ -1, -1);
}
- if (play->unk_1EA6 != 0) {
- var_s0 = play->unk_1EB0;
+ if (game_play->unk_1EA6 != 0) {
+ var_s0 = game_play->unk_1EB0;
- for (var_s1 = 0; var_s1 < play->unk_1EA6; var_s1++) {
- Actor_info_make_actor(&play->actorInfo, play, *var_s0, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, 0, -1, -1,
- -1);
+ for (var_s1 = 0; var_s1 < game_play->unk_1EA6; var_s1++) {
+ Actor_info_make_actor(&game_play->actorInfo, game_play, *var_s0, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, 0,
+ -1, -1, -1);
var_s0 += 1;
}
- play->unk_1EA6 = 0;
+ game_play->unk_1EA6 = 0;
}
- mSc_regist_initial_exchange_bank(play);
+ mSc_regist_initial_exchange_bank(game_play);
- if (play->unk_1EA5 != 0) {
- var_s0_2 = play->unk_1EAC;
- for (var_s1 = 0; var_s1 < play->unk_1EA5; var_s1++) {
- Actor_info_make_actor(&play->actorInfo, play, var_s0_2->id, var_s0_2->pos.x, var_s0_2->pos.y,
+ if (game_play->unk_1EA5 != 0) {
+ var_s0_2 = game_play->unk_1EAC;
+ for (var_s1 = 0; var_s1 < game_play->unk_1EA5; var_s1++) {
+ Actor_info_make_actor(&game_play->actorInfo, game_play, var_s0_2->id, var_s0_2->pos.x, var_s0_2->pos.y,
var_s0_2->pos.z, var_s0_2->rot.x, var_s0_2->rot.y, var_s0_2->rot.z, -1, -1, -1, 0,
var_s0_2->params, -1, -1);
var_s0_2 += 1;
}
- play->unk_1EA5 = 0;
+ game_play->unk_1EA5 = 0;
}
}
-void Actor_info_dt(ActorInfo* actorInfo, PlayState* play) {
+void Actor_info_dt(ActorInfo* actorInfo, Game_Play* game_play) {
s32 i;
for (i = 0; i < ARRAY_COUNT(actorInfo->actorLists); i++) {
Actor* actor = actorInfo->actorLists[i].head;
while (actor != NULL) {
- Actor_info_delete(actorInfo, actor, play);
+ Actor_info_delete(actorInfo, actor, game_play);
actor = actorInfo->actorLists[i].head;
}
}
@@ -430,12 +431,12 @@ void Actor_info_dt(ActorInfo* actorInfo, PlayState* play) {
actor_dlftbls_cleanup();
}
-void Actor_info_call_actor(PlayState* play, ActorInfo* actorInfo) {
+void Actor_info_call_actor(Game_Play* game_play, ActorInfo* actorInfo) {
s32 pad[1] UNUSED;
ActorPart part;
Player* player;
- player = get_player_actor_withoutCheck(play);
+ player = get_player_actor_withoutCheck(game_play);
func_8008E5F4_jp(player->actor.world.pos);
for (part = 0; part < ACTOR_PART_MAX; part++) {
@@ -443,41 +444,41 @@ void Actor_info_call_actor(PlayState* play, ActorInfo* actorInfo) {
Actor* next;
for (actor = actorInfo->actorLists[part].head; actor != NULL; actor = next) {
- play->state.unk_9C = actor->name;
- play->state.unk_9D = 0x97;
+ game_play->state.unk_9C = actor->name;
+ game_play->state.unk_9D = 0x97;
if (actor->world.pos.y < -25000.0f) {
actor->world.pos.y = -25000.0f;
}
if (actor->ct != NULL) {
- if (Actor_data_bank_dma_end_check(actor, play) == 1) {
- gSegments[6] = (uintptr_t)OS_K0_TO_PHYSICAL(play->unk_0110[actor->unk_026].segment);
+ if (Actor_data_bank_dma_end_check(actor, game_play) == 1) {
+ gSegments[6] = (uintptr_t)OS_K0_TO_PHYSICAL(game_play->unk_0110[actor->unk_026].segment);
- play->state.unk_9D = 0x98;
- actor->ct(actor, play);
- play->state.unk_9D = 0x99;
+ game_play->state.unk_9D = 0x98;
+ actor->ct(actor, game_play);
+ game_play->state.unk_9D = 0x99;
actor->ct = NULL;
}
next = actor->next;
- } else if (Actor_data_bank_dma_end_check(actor, play) == 0) {
- play->state.unk_9D = 0x9A;
+ } else if (Actor_data_bank_dma_end_check(actor, game_play) == 0) {
+ game_play->state.unk_9D = 0x9A;
Actor_delete(actor);
- play->state.unk_9D = 0x9B;
+ game_play->state.unk_9D = 0x9B;
next = actor->next;
} else if (actor->update == NULL) {
if (!actor->isDrawn) {
- play->state.unk_9D = 0x9C;
- next = Actor_info_delete(&play->actorInfo, actor, play);
- play->state.unk_9D = 0x9D;
+ game_play->state.unk_9D = 0x9C;
+ next = Actor_info_delete(&game_play->actorInfo, actor, game_play);
+ game_play->state.unk_9D = 0x9D;
} else {
- play->state.unk_9D = 0x9E;
- Actor_dt(actor, play);
- play->state.unk_9D = 0x9F;
+ game_play->state.unk_9D = 0x9E;
+ Actor_dt(actor, game_play);
+ game_play->state.unk_9D = 0x9F;
next = actor->next;
}
} else {
- play->state.unk_9D = 0xA0;
+ game_play->state.unk_9D = 0xA0;
xyz_t_move(&actor->prevPos, &actor->world.pos);
actor->xzDistToPlayer = search_position_distanceXZ(&actor->world.pos, &player->actor.world.pos);
@@ -488,10 +489,10 @@ void Actor_info_call_actor(PlayState* play, ActorInfo* actorInfo) {
actor->flags &= ~ACTOR_FLAG_1000000;
if ((actor->flags & (ACTOR_FLAG_40 | ACTOR_FLAG_10)) || (actor->part == ACTOR_PART_NPC)) {
- gSegments[6] = (uintptr_t)OS_K0_TO_PHYSICAL(play->unk_0110[actor->unk_026].segment);
- play->state.unk_9D = 0xA1;
- actor->update(actor, play);
- play->state.unk_9D = 0xA2;
+ gSegments[6] = (uintptr_t)OS_K0_TO_PHYSICAL(game_play->unk_0110[actor->unk_026].segment);
+ game_play->state.unk_9D = 0xA1;
+ actor->update(actor, game_play);
+ game_play->state.unk_9D = 0xA2;
}
CollisionCheck_Status_Clear(&actor->colStatus);
@@ -500,11 +501,11 @@ void Actor_info_call_actor(PlayState* play, ActorInfo* actorInfo) {
}
}
- play->state.unk_9D = 0xA3;
+ game_play->state.unk_9D = 0xA3;
}
-void Actor_info_draw_actor(PlayState* play, ActorInfo* actorInfo) {
- PlayState_unk_2208 temp_s4 = play->unk_2208;
+void Actor_info_draw_actor(Game_Play* game_play, ActorInfo* actorInfo) {
+ Game_Play_unk_2208 temp_s4 = game_play->unk_2208;
ActorListEntry* actorEntry = actorInfo->actorLists;
ActorPart part = 0;
@@ -516,11 +517,11 @@ void Actor_info_draw_actor(PlayState* play, ActorInfo* actorInfo) {
for (actor = actorEntry->head; actor != NULL; actor = actor->next) {
s32 temp;
- Skin_Matrix_PrjMulVector(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos,
+ Skin_Matrix_PrjMulVector(&game_play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos,
&actor->projectedW);
Actor_cull_check(actor);
- temp = temp_s4(actor, play);
+ temp = temp_s4(actor, game_play);
actor->isDrawn = false;
if (temp != 0) {
@@ -533,17 +534,17 @@ void Actor_info_draw_actor(PlayState* play, ActorInfo* actorInfo) {
if (actor->flags & (ACTOR_FLAG_40 | ACTOR_FLAG_20)) {
if (!(actor->flags & ACTOR_FLAG_80) && (actor->unk_148 == 0) && (actor->unk_149 == 0)) {
- Actor_draw(play, actor);
+ Actor_draw(game_play, actor);
actor->isDrawn = true;
}
} else {
- Actor_delete_check(actor, play);
+ Actor_delete_check(actor, game_play);
}
}
}
if (debug_mode->r[0x380] == 0) {
- Light_list_point_draw(play);
+ Light_list_point_draw(game_play);
}
}
@@ -673,7 +674,8 @@ s32 func_80057940_jp(ActorProfile** profileP, ActorOverlay* overlayEntry, const
}
// this function may be Actor_data_bank_regist_check_npc
-s32 func_80057A8C_jp(s32* arg0, ActorProfile* profile UNUSED, ActorOverlay* overlayEntry, PlayState* play, u16 fgName) {
+s32 func_80057A8C_jp(s32* arg0, ActorProfile* profile UNUSED, ActorOverlay* overlayEntry, Game_Play* game_play,
+ u16 fgName) {
s32 pad UNUSED;
s16 sp92;
s16 sp90;
@@ -691,8 +693,8 @@ s32 func_80057A8C_jp(s32* arg0, ActorProfile* profile UNUSED, ActorOverlay* over
sp90 = sp24.unk_02;
}
- *arg0 = mSc_bank_regist_check(play->unk_0110, sp92);
- temp_v0 = mSc_bank_regist_check(play->unk_0110, sp90);
+ *arg0 = mSc_bank_regist_check(game_play->unk_0110, sp92);
+ temp_v0 = mSc_bank_regist_check(game_play->unk_0110, sp90);
if ((*arg0 < 0) || (temp_v0 < 0)) {
if (*arg0 >= 0) {
@@ -701,21 +703,21 @@ s32 func_80057A8C_jp(s32* arg0, ActorProfile* profile UNUSED, ActorOverlay* over
if (temp_v0 >= 0) {
sp90 = 0;
}
- common_data.unk_1004C->unk_EC(play->unk_0110, sp92, sp90);
+ common_data.unk_1004C->unk_EC(game_play->unk_0110, sp92, sp90);
actor_free_check(overlayEntry, fgName);
ret = 0;
}
return ret;
}
-s32 func_80057B70_jp(s32* arg0, ActorProfile* profile, ActorOverlay* overlayEntry, PlayState* play, u16 fgName) {
+s32 func_80057B70_jp(s32* arg0, ActorProfile* profile, ActorOverlay* overlayEntry, Game_Play* game_play, u16 fgName) {
s32 pad UNUSED;
s32 ret = 1;
- *arg0 = mSc_bank_regist_check(play->unk_0110, profile->objectId);
+ *arg0 = mSc_bank_regist_check(game_play->unk_0110, profile->objectId);
if (*arg0 == -1) {
- func_800C6144_jp(play->unk_0110, profile->objectId);
+ func_800C6144_jp(game_play->unk_0110, profile->objectId);
actor_free_check(overlayEntry, fgName);
ret = 0;
}
@@ -723,15 +725,15 @@ s32 func_80057B70_jp(s32* arg0, ActorProfile* profile, ActorOverlay* overlayEntr
return ret;
}
-s32 Actor_data_bank_regist_check(s32* arg0, ActorProfile* profile, ActorOverlay* overlayEntry, PlayState* play,
+s32 Actor_data_bank_regist_check(s32* arg0, ActorProfile* profile, ActorOverlay* overlayEntry, Game_Play* game_play,
u16 fgName) {
s32 var_v1 = 1;
if (*arg0 == -1) {
if (profile->part == ACTOR_PART_NPC) {
- var_v1 = func_80057A8C_jp(arg0, profile, overlayEntry, play, fgName);
+ var_v1 = func_80057A8C_jp(arg0, profile, overlayEntry, game_play, fgName);
} else {
- var_v1 = func_80057B70_jp(arg0, profile, overlayEntry, play, fgName);
+ var_v1 = func_80057B70_jp(arg0, profile, overlayEntry, game_play, fgName);
}
}
return var_v1;
@@ -768,9 +770,9 @@ s32 Actor_malloc_actor_class(Actor** actorP, ActorProfile* profile, ActorOverlay
return 1;
}
-void Actor_init_actor_class(Actor* actor, ActorProfile* profile, ActorOverlay* overlayEntry, PlayState* play, s32 arg4,
- f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s8 argB, s8 argC, s16 argD, u16 fgName,
- s16 params) {
+void Actor_init_actor_class(Actor* actor, ActorProfile* profile, ActorOverlay* overlayEntry, Game_Play* game_play,
+ s32 arg4, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s8 argB, s8 argC, s16 argD,
+ u16 fgName, s16 params) {
mem_clear(actor, profile->instanceSize, 0);
actor->overlayEntry = overlayEntry;
@@ -788,7 +790,7 @@ void Actor_init_actor_class(Actor* actor, ActorProfile* profile, ActorOverlay* o
actor->params = params;
- actor->unk_004 = play->unk_00E0;
+ actor->unk_004 = game_play->unk_00E0;
actor->home.pos.x = x;
actor->home.pos.y = y;
@@ -806,7 +808,7 @@ void Actor_init_actor_class(Actor* actor, ActorProfile* profile, ActorOverlay* o
extern const struct_801161E8_jp RO_801161E8_jp;
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_actor/RO_801161E8_jp.s")
-Actor* Actor_info_make_actor(ActorInfo* actorInfo, PlayState* play, s16 actorId, f32 x, f32 y, f32 z, s16 rotX,
+Actor* Actor_info_make_actor(ActorInfo* actorInfo, Game_Play* game_play, s16 actorId, f32 x, f32 y, f32 z, s16 rotX,
s16 rotY, s16 rotZ, s8 arg9, s8 argA, s16 argB, u16 fgName, s16 params, s8 argE,
s32 argF) {
u16* new_var = &fgName;
@@ -822,7 +824,7 @@ Actor* Actor_info_make_actor(ActorInfo* actorInfo, PlayState* play, s16 actorId,
if (func_80057940_jp(&profile, temp_s0, &RO_801161E8_jp, size, *new_var) == 0) {
return NULL;
}
- if (Actor_data_bank_regist_check(&argF, profile, temp_s0, play, fgName) == 0) {
+ if (Actor_data_bank_regist_check(&argF, profile, temp_s0, game_play, fgName) == 0) {
return NULL;
}
if (Actor_malloc_actor_class(&sp68, profile, temp_s0, &RO_801161E8_jp, fgName) == 0) {
@@ -830,7 +832,7 @@ Actor* Actor_info_make_actor(ActorInfo* actorInfo, PlayState* play, s16 actorId,
}
temp_s0->numLoaded++;
- Actor_init_actor_class(sp68, profile, temp_s0, play, argF, x, y, z, rotX, rotY, rotZ, arg9, argA, argB, fgName,
+ Actor_init_actor_class(sp68, profile, temp_s0, game_play, argF, x, y, z, rotX, rotY, rotZ, arg9, argA, argB, fgName,
params);
Actor_info_part_new(actorInfo, sp68, profile->part);
@@ -841,17 +843,17 @@ Actor* Actor_info_make_actor(ActorInfo* actorInfo, PlayState* play, s16 actorId,
uintptr_t segmentTemp;
segmentTemp = gSegments[6];
- Actor_ct(sp68, play);
+ Actor_ct(sp68, game_play);
gSegments[6] = segmentTemp;
}
return sp68;
}
-Actor* Actor_info_make_child_actor(ActorInfo* actorInfo, Actor* arg1, PlayState* play, s16 actorId, f32 x, f32 y, f32 z,
- s16 rotX, s16 rotY, s16 rotZ, s16 argA, u16 fgName, s16 params, s32 argD) {
- Actor* temp_v0 = Actor_info_make_actor(actorInfo, play, actorId, x, y, z, rotX, rotY, rotZ, -1, -1, argA, fgName,
- params, -1, argD);
+Actor* Actor_info_make_child_actor(ActorInfo* actorInfo, Actor* arg1, Game_Play* game_play, s16 actorId, f32 x, f32 y,
+ f32 z, s16 rotX, s16 rotY, s16 rotZ, s16 argA, u16 fgName, s16 params, s32 argD) {
+ Actor* temp_v0 = Actor_info_make_actor(actorInfo, game_play, actorId, x, y, z, rotX, rotY, rotZ, -1, -1, argA,
+ fgName, params, -1, argD);
if (temp_v0 != NULL) {
arg1->child = temp_v0;
@@ -861,7 +863,7 @@ Actor* Actor_info_make_child_actor(ActorInfo* actorInfo, Actor* arg1, PlayState*
return temp_v0;
}
-void restore_fgdata(Actor* actor, PlayState* play UNUSED) {
+void restore_fgdata(Actor* actor, Game_Play* game_play UNUSED) {
Vec3f sp34;
if ((actor->fgName == 0) || (actor->unk_00A != -1)) {
@@ -897,16 +899,16 @@ s32 restore_flag[ACTOR_PART_MAX] = {
0, // ACTOR_PART_7
};
-void restore_fgdata_one(Actor* actor, PlayState* play) {
+void restore_fgdata_one(Actor* actor, Game_Play* game_play) {
if (restore_flag[actor->part] == 1) {
- restore_fgdata(actor, play);
+ restore_fgdata(actor, game_play);
} else if (actor->unk_003 == 1) {
- restore_fgdata(actor, play);
+ restore_fgdata(actor, game_play);
}
}
-void restore_fgdata_all(PlayState* play) {
- ActorInfo* actorInfo = &play->actorInfo;
+void restore_fgdata_all(Game_Play* game_play) {
+ ActorInfo* actorInfo = &game_play->actorInfo;
ActorPart part;
for (part = 0; part < ACTOR_PART_MAX; part++) {
@@ -914,20 +916,20 @@ void restore_fgdata_all(PlayState* play) {
if (restore_flag[part] == 1) {
for (actor = actorInfo->actorLists[part].head; actor != NULL; actor = actor->next) {
- restore_fgdata(actor, play);
+ restore_fgdata(actor, game_play);
}
} else {
for (actor = actorInfo->actorLists[part].head; actor != NULL; actor = actor->next) {
if (actor->unk_003 == 1) {
- restore_fgdata(actor, play);
+ restore_fgdata(actor, game_play);
}
}
}
}
}
-void Actor_info_save_actor(PlayState* play) {
- ActorInfo* actorInfo = &play->actorInfo;
+void Actor_info_save_actor(Game_Play* game_play) {
+ ActorInfo* actorInfo = &game_play->actorInfo;
ActorPart part;
for (part = 0; part < ACTOR_PART_MAX; part++) {
@@ -935,16 +937,16 @@ void Actor_info_save_actor(PlayState* play) {
for (actor = actorInfo->actorLists[part].head; actor != NULL; actor = actor->next) {
if (actor->save != NULL) {
- actor->save(actor, play);
+ actor->save(actor, game_play);
actor->save = NULL;
}
}
}
- restore_fgdata_all(play);
+ restore_fgdata_all(game_play);
}
-Actor* Actor_info_delete(ActorInfo* actorInfo, Actor* actor, PlayState* play) {
+Actor* Actor_info_delete(ActorInfo* actorInfo, Actor* actor, Game_Play* game_play) {
Actor* newHead;
s32 pad UNUSED;
ActorOverlay* overlayEntry;
@@ -952,8 +954,8 @@ Actor* Actor_info_delete(ActorInfo* actorInfo, Actor* actor, PlayState* play) {
overlayEntry = actor->overlayEntry;
- restore_fgdata_one(actor, play);
- Actor_dt(actor, play);
+ restore_fgdata_one(actor, game_play);
+ Actor_dt(actor, game_play);
newHead = Actor_info_part_delete(actorInfo, actor);
@@ -1115,29 +1117,29 @@ Hilite* HiliteReflect_light_init(Vec3f* object, Vec3f* eye, Vec3f* lightDir, Gra
return hilite;
}
-Hilite* Setpos_HiliteReflect_init(Vec3f* object, PlayState* play) {
+Hilite* Setpos_HiliteReflect_init(Vec3f* object, Game_Play* game_play) {
Vec3f sp24;
- sp24.x = play->kankyo.unk_02;
- sp24.y = play->kankyo.unk_03;
- sp24.z = play->kankyo.unk_04;
- return HiliteReflect_init(object, &play->unk_1938.unk_028, &sp24, play->state.gfxCtx);
+ sp24.x = game_play->kankyo.unk_02;
+ sp24.y = game_play->kankyo.unk_03;
+ sp24.z = game_play->kankyo.unk_04;
+ return HiliteReflect_init(object, &game_play->unk_1938.unk_028, &sp24, game_play->state.gfxCtx);
}
-Hilite* Setpos_HiliteReflect_xlu_init(Vec3f* object, PlayState* play) {
+Hilite* Setpos_HiliteReflect_xlu_init(Vec3f* object, Game_Play* game_play) {
Vec3f sp24;
- sp24.x = play->kankyo.unk_02;
- sp24.y = play->kankyo.unk_03;
- sp24.z = play->kankyo.unk_04;
- return HiliteReflect_xlu_init(object, &play->unk_1938.unk_028, &sp24, play->state.gfxCtx);
+ sp24.x = game_play->kankyo.unk_02;
+ sp24.y = game_play->kankyo.unk_03;
+ sp24.z = game_play->kankyo.unk_04;
+ return HiliteReflect_xlu_init(object, &game_play->unk_1938.unk_028, &sp24, game_play->state.gfxCtx);
}
-Hilite* Setpos_HiliteReflect_light_init(Vec3f* object, PlayState* play) {
+Hilite* Setpos_HiliteReflect_light_init(Vec3f* object, Game_Play* game_play) {
Vec3f sp24;
- sp24.x = play->kankyo.unk_02;
- sp24.y = play->kankyo.unk_03;
- sp24.z = play->kankyo.unk_04;
- return HiliteReflect_xlu_init(object, &play->unk_1938.unk_028, &sp24, play->state.gfxCtx);
+ sp24.x = game_play->kankyo.unk_02;
+ sp24.y = game_play->kankyo.unk_03;
+ sp24.z = game_play->kankyo.unk_04;
+ return HiliteReflect_xlu_init(object, &game_play->unk_1938.unk_028, &sp24, game_play->state.gfxCtx);
}
diff --git a/src/code/m_controller.c b/src/code/m_controller.c
index 1c108f5..41ab478 100644
--- a/src/code/m_controller.c
+++ b/src/code/m_controller.c
@@ -5,10 +5,10 @@
#include "sys_math_atan.h"
#include "attributes.h"
-void mCon_ct(UNUSED GameState* game) {
+void mCon_ct(UNUSED Game* game) {
}
-void mCon_dt(UNUSED GameState* game) {
+void mCon_dt(UNUSED Game* game) {
}
void mCon_calc(Controller* controller, f32 x, f32 y) {
@@ -54,7 +54,7 @@ void mCon_calc(Controller* controller, f32 x, f32 y) {
}
}
-void mCon_main(GameState* game) {
+void mCon_main(Game* game) {
Controller* controller = &game->controller;
f32 x = getJoystick_X();
f32 y = getJoystick_Y();
diff --git a/src/code/m_game_dlftbls.c b/src/code/m_game_dlftbls.c
index 21e59ec..45b17cc 100644
--- a/src/code/m_game_dlftbls.c
+++ b/src/code/m_game_dlftbls.c
@@ -22,7 +22,7 @@
// Gamestate Overlay Table definition
#define DEFINE_GAMESTATE_INTERNAL(typeName, _enumName) \
- { NULL, 0, 0, NULL, NULL, NULL, typeName##_Init, typeName##_Destroy, NULL, NULL, 0, sizeof(typeName##State) },
+ { NULL, 0, 0, NULL, NULL, NULL, typeName##_Init, typeName##_Destroy, NULL, NULL, 0, sizeof(Game_##typeName) },
#define DEFINE_GAMESTATE(typeName, _enumName, segmentName) \
{ NULL, \
@@ -36,7 +36,7 @@
NULL, \
NULL, \
0, \
- sizeof(typeName##State) },
+ sizeof(Game_##typeName) },
GameStateOverlay game_dlftbls[GAMESTATE_ID_MAX] = {
#include "tables/gamestate_table.h"
diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c
index 815677e..1661c13 100644
--- a/src/code/sys_matrix.c
+++ b/src/code/sys_matrix.c
@@ -75,7 +75,7 @@ MtxF* Matrix_now; // Top of the stack.
/**
* Create the matrix stack and set the pointer to the top of it.
*/
-void new_Matrix(GameState* gameState) {
+void new_Matrix(Game* gameState) {
Matrix_now = THA_alloc16(&gameState->heap, MATRIX_STACK_SIZE * sizeof(MtxF));
Matrix_stack = Matrix_now;
}