Format everything (#141)

* Add trailing comma

* Run format and add some missing trailing commas

* Enforce the same clang-format version for everybody

* z_en_m_fire1
This commit is contained in:
Anghelo Carvajal
2021-05-18 20:00:36 -04:00
committed by GitHub
parent 091219d742
commit c56934038a
639 changed files with 2535 additions and 2310 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ void EnAObj_Update1(ActorEnAObj* this, GlobalContext* ctxt) {
this->update = (ActorFunc)EnAObj_Update2;
} else {
v0 = this->base.yawTowardsPlayer - this->base.shape.rot.y;
v1 = (v0 < 0)? -v0 : v0;
v1 = (v0 < 0) ? -v0 : v0;
if ((v1 < 10240) || ((this->base.params == 1) && (v1 > 22528))) {
func_800B863C((Actor*)this, ctxt);
}
+45 -46
View File
@@ -128,51 +128,51 @@ void Effect_Add(GlobalContext* ctxt, s32* index, s32 type, u8 param_4, u8 param_
if (func_8016A01C(ctxt) != 1) {
slotFound = 0;
switch (type) {
case 0:
for (i = 0; i < 3; i++) {
if (sEffTable.sparks[i].base.active == 0) {
slotFound = 1;
*index = i;
params = &sEffTable.sparks[i].params;
common = &sEffTable.sparks[i].base;
break;
case 0:
for (i = 0; i < 3; i++) {
if (sEffTable.sparks[i].base.active == 0) {
slotFound = 1;
*index = i;
params = &sEffTable.sparks[i].params;
common = &sEffTable.sparks[i].base;
break;
}
}
}
break;
case 1:
case 2:
for (i = 0; i < 25; i++) {
if (sEffTable.blures[i].base.active == 0) {
slotFound = 1;
*index = i + 3;
params = &sEffTable.blures[i].params;
common = &sEffTable.blures[i].base;
break;
break;
case 1:
case 2:
for (i = 0; i < 25; i++) {
if (sEffTable.blures[i].base.active == 0) {
slotFound = 1;
*index = i + 3;
params = &sEffTable.blures[i].params;
common = &sEffTable.blures[i].base;
break;
}
}
}
break;
case 3:
for (i = 0; i < 3; i++) {
if (sEffTable.shieldParticles[i].base.active == 0) {
slotFound = 1;
*index = i + 28;
params = &sEffTable.shieldParticles[i].params;
common = &sEffTable.shieldParticles[i].base;
break;
break;
case 3:
for (i = 0; i < 3; i++) {
if (sEffTable.shieldParticles[i].base.active == 0) {
slotFound = 1;
*index = i + 28;
params = &sEffTable.shieldParticles[i].params;
common = &sEffTable.shieldParticles[i].base;
break;
}
}
}
break;
case 4:
for (i = 0; i < 15; i++) {
if (sEffTable.tireMarks[i].base.active == 0) {
slotFound = 1;
*index = i + 31;
params = &sEffTable.tireMarks[i].params;
common = &sEffTable.tireMarks[i].base;
break;
break;
case 4:
for (i = 0; i < 15; i++) {
if (sEffTable.tireMarks[i].base.active == 0) {
slotFound = 1;
*index = i + 31;
params = &sEffTable.tireMarks[i].params;
common = &sEffTable.tireMarks[i].base;
break;
}
}
}
break;
break;
}
if (slotFound) {
@@ -264,28 +264,28 @@ void Effect_Destroy(GlobalContext* ctxt, s32 index) {
}
if (index < 3) {
sEffTable.sparks[index].base.active = 0 ;
sEffTable.sparks[index].base.active = 0;
sEffInfoTable[0].destroy(&sEffTable.sparks[index].params);
return;
}
index -= 3;
if (index < 25) {
sEffTable.blures[index].base.active = 0 ;
sEffTable.blures[index].base.active = 0;
sEffInfoTable[1].destroy(&sEffTable.blures[index].params);
return;
}
index -= 25;
if (index < 3) {
sEffTable.shieldParticles[index].base.active = 0 ;
sEffTable.shieldParticles[index].base.active = 0;
sEffInfoTable[3].destroy(&sEffTable.shieldParticles[index].params);
return;
}
index -= 3;
if (index < 15) {
sEffTable.tireMarks[index].base.active = 0 ;
sEffTable.tireMarks[index].base.active = 0;
sEffInfoTable[4].destroy(&sEffTable.tireMarks[index].params);
return;
}
@@ -314,4 +314,3 @@ void Effect_DestroyAll(GlobalContext* ctxt) {
sEffInfoTable[4].destroy(&sEffTable.tireMarks[i].params);
}
}
+39 -34
View File
@@ -12,31 +12,27 @@ void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* ac
Vec3f newPos;
Vec3f posWithInv;
if (BgCheck_IsActorMeshIndexValid(index) == 0) return;
if (BgCheck_IsActorMeshIndexValid(index) == 0) {
return;
}
SkinMatrix_SetScaleRotateYRPTranslate(&prevMatrix,
bgCtxt->dyna.bgActors[index].prevTransform.scale.x,
bgCtxt->dyna.bgActors[index].prevTransform.scale.y,
bgCtxt->dyna.bgActors[index].prevTransform.scale.z,
bgCtxt->dyna.bgActors[index].prevTransform.rot.x,
bgCtxt->dyna.bgActors[index].prevTransform.rot.y,
bgCtxt->dyna.bgActors[index].prevTransform.rot.z,
bgCtxt->dyna.bgActors[index].prevTransform.pos.x,
bgCtxt->dyna.bgActors[index].prevTransform.pos.y,
bgCtxt->dyna.bgActors[index].prevTransform.pos.z);
SkinMatrix_SetScaleRotateYRPTranslate(
&prevMatrix, bgCtxt->dyna.bgActors[index].prevTransform.scale.x,
bgCtxt->dyna.bgActors[index].prevTransform.scale.y, bgCtxt->dyna.bgActors[index].prevTransform.scale.z,
bgCtxt->dyna.bgActors[index].prevTransform.rot.x, bgCtxt->dyna.bgActors[index].prevTransform.rot.y,
bgCtxt->dyna.bgActors[index].prevTransform.rot.z, bgCtxt->dyna.bgActors[index].prevTransform.pos.x,
bgCtxt->dyna.bgActors[index].prevTransform.pos.y, bgCtxt->dyna.bgActors[index].prevTransform.pos.z);
if (SkinMatrix_Invert(&prevMatrix, &prevMatrixInv) == 2) return;
if (SkinMatrix_Invert(&prevMatrix, &prevMatrixInv) == 2) {
return;
}
SkinMatrix_SetScaleRotateYRPTranslate(&currMatrix,
bgCtxt->dyna.bgActors[index].curTransform.scale.x,
bgCtxt->dyna.bgActors[index].curTransform.scale.y,
bgCtxt->dyna.bgActors[index].curTransform.scale.z,
bgCtxt->dyna.bgActors[index].curTransform.rot.x,
bgCtxt->dyna.bgActors[index].curTransform.rot.y,
bgCtxt->dyna.bgActors[index].curTransform.rot.z,
bgCtxt->dyna.bgActors[index].curTransform.pos.x,
bgCtxt->dyna.bgActors[index].curTransform.pos.y,
bgCtxt->dyna.bgActors[index].curTransform.pos.z);
SkinMatrix_SetScaleRotateYRPTranslate(
&currMatrix, bgCtxt->dyna.bgActors[index].curTransform.scale.x,
bgCtxt->dyna.bgActors[index].curTransform.scale.y, bgCtxt->dyna.bgActors[index].curTransform.scale.z,
bgCtxt->dyna.bgActors[index].curTransform.rot.x, bgCtxt->dyna.bgActors[index].curTransform.rot.y,
bgCtxt->dyna.bgActors[index].curTransform.rot.z, bgCtxt->dyna.bgActors[index].curTransform.pos.x,
bgCtxt->dyna.bgActors[index].curTransform.pos.y, bgCtxt->dyna.bgActors[index].curTransform.pos.z);
SkinMatrix_Vec3fMtxFMultXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv);
SkinMatrix_Vec3fMtxFMultXYZ(&currMatrix, &posWithInv, &newPos);
@@ -47,7 +43,9 @@ void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* ac
void BgCheck2_UpdateActorYRotation(CollisionContext* bgCtxt, s32 index, Actor* actor) {
s16 angleChange;
if (BgCheck_IsActorMeshIndexValid(index) == 0) return;
if (BgCheck_IsActorMeshIndexValid(index) == 0) {
return;
}
angleChange = bgCtxt->dyna.bgActors[index].curTransform.rot.y - bgCtxt->dyna.bgActors[index].prevTransform.rot.y;
@@ -60,11 +58,13 @@ void BgCheck2_UpdateActorYRotation(CollisionContext* bgCtxt, s32 index, Actor* a
}
void BgCheck2_AttachToMesh(CollisionContext* bgCtxt, Actor* actor, s32 index) {
DynaPolyActor *meshActor;
DynaPolyActor* meshActor;
if (BgCheck_IsActorMeshIndexValid(index) == 0) return;
if (BgCheck_IsActorMeshIndexValid(index) == 0) {
return;
}
meshActor = BgCheck_GetActorOfMesh(bgCtxt,index);
meshActor = BgCheck_GetActorOfMesh(bgCtxt, index);
if (meshActor != NULL) {
func_800CAE88(meshActor);
@@ -79,26 +79,31 @@ void BgCheck2_AttachToMesh(CollisionContext* bgCtxt, Actor* actor, s32 index) {
u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* bgCtxt, s32 index, Actor* actor) {
u32 wasUpdated = 0;
DynaPolyActor *meshActor;
DynaPolyActor* meshActor;
if (BgCheck_IsActorMeshIndexValid(index) == 0) return 0;
if (BgCheck_IsActorMeshIndexValid(index) == 0) {
return 0;
}
if (((bgCtxt->dyna.bgActorFlags[index] & 2) != 0) || ((bgCtxt->dyna.bgActorFlags[index] & 1) == 0)) return 0;
if (((bgCtxt->dyna.bgActorFlags[index] & 2) != 0) || ((bgCtxt->dyna.bgActorFlags[index] & 1) == 0)) {
return 0;
}
meshActor = BgCheck_GetActorOfMesh(bgCtxt,index);
meshActor = BgCheck_GetActorOfMesh(bgCtxt, index);
if (meshActor == NULL) return 0;
if (meshActor == NULL) {
return 0;
}
if ((meshActor->unk154 & 1) != 0) {
BgCheck2_UpdateActorPosition(bgCtxt,index,actor);
BgCheck2_UpdateActorPosition(bgCtxt, index, actor);
wasUpdated = 1;
}
if ((meshActor->unk154 & 2) != 0) {
BgCheck2_UpdateActorYRotation(bgCtxt,index,actor);
BgCheck2_UpdateActorYRotation(bgCtxt, index, actor);
wasUpdated = 1;
}
return wasUpdated;
}
+2 -2
View File
@@ -33,7 +33,7 @@ void func_800CAEB0(CollisionContext* bgCtxt, s32 index) {
DynaPolyActor* actor;
actor = BgCheck_GetActorOfMesh(bgCtxt, index);
if (actor != (DynaPolyActor *)0x0) {
if (actor != (DynaPolyActor*)0x0) {
func_800CAE9C(actor);
}
}
@@ -46,7 +46,7 @@ void func_800CAEF4(CollisionContext* bgCtxt, s32 index) {
DynaPolyActor* actor;
actor = BgCheck_GetActorOfMesh(bgCtxt, index);
if (actor != (DynaPolyActor *)0x0) {
if (actor != (DynaPolyActor*)0x0) {
func_800CAEE0(actor);
}
}
+23 -22
View File
@@ -10,20 +10,22 @@ s32 nop_800E8ED0(UNK_TYPE4 param_1) {
return 0;
}
void nop_800E8EE0(UNK_TYPE4 param_1) {}
void nop_800E8EE0(UNK_TYPE4 param_1) {
}
s32 nop_800E8EEC(UNK_TYPE4 param_1) {
return 0;
}
void nop_800E8EFC(UNK_TYPE4 param_1) {}
void nop_800E8EFC(UNK_TYPE4 param_1) {
}
s32 func_800E8F08(Vec3s* param_1, Vec3s* param_2) {
Math_SmoothStepToS(&param_1->y, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_1->x, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_2->y, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_2->x, 0, 6, 6200, 100);
return 1;
Math_SmoothStepToS(&param_1->y, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_1->x, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_2->y, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_2->x, 0, 6, 6200, 100);
return 1;
}
s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4) {
@@ -31,30 +33,30 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4)
s16 targetYaw;
s16 yawDiffFromTarget;
targetPitch = Math_Vec3f_Pitch(&actor->focus.pos,param_2);
targetYaw = Math_Vec3f_Yaw(&actor->focus.pos,param_2) - actor->world.rot.y;
targetPitch = Math_Vec3f_Pitch(&actor->focus.pos, param_2);
targetYaw = Math_Vec3f_Yaw(&actor->focus.pos, param_2) - actor->world.rot.y;
Math_SmoothStepToS(&param_3->x, targetPitch, 6, 2000, 1);
param_3->x = (param_3->x < -6000)? -6000 : ((6000 < param_3->x)? 6000 : param_3->x);
param_3->x = (param_3->x < -6000) ? -6000 : ((6000 < param_3->x) ? 6000 : param_3->x);
yawDiffFromTarget = Math_SmoothStepToS(&param_3->y, targetYaw, 6, 2000, 1);
param_3->y = (param_3->y < -8000)? -8000 : ((8000 < param_3->y)? 8000 : param_3->y);
param_3->y = (param_3->y < -8000) ? -8000 : ((8000 < param_3->y) ? 8000 : param_3->y);
if (yawDiffFromTarget != 0) {
if ((param_3->y < 0? -param_3->y : param_3->y) < 8000) {
if ((param_3->y < 0 ? -param_3->y : param_3->y) < 8000) {
return 0;
}
}
Math_SmoothStepToS(&param_4->y, targetYaw - param_3->y, 4, 2000, 1);
param_4->y = (param_4->y < -12000)? -12000 : ((12000 < param_4->y)? 12000 : param_4->y);
param_4->y = (param_4->y < -12000) ? -12000 : ((12000 < param_4->y) ? 12000 : param_4->y);
return 1;
}
s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* param_4, f32 param_5) {
s16 sVar3;
Actor *player;
Actor* player;
Vec3f local_14;
player = (ctxt->actorCtx).actorList[2].first;
@@ -64,8 +66,8 @@ s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
if (((ctxt->csCtx).state == 0) && (D_801D0D50 == 0)) {
sVar3 = actor->yawTowardsPlayer - actor->shape.rot.y;
// TODO is this shifting because of a missing cast?
if (0x42ff < (sVar3 < 0? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3,param_4);
if (0x42ff < (sVar3 < 0 ? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3, param_4);
return 0;
}
}
@@ -76,13 +78,13 @@ s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
local_14 = player->focus.pos;
}
func_800E8FA4(actor,&local_14,param_3,param_4);
func_800E8FA4(actor, &local_14, param_3, param_4);
return 1;
}
s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5) {
s16 sVar3;
Actor *player;
Actor* player;
Vec3f local_14;
player = (ctxt->actorCtx).actorList[2].first;
@@ -91,8 +93,8 @@ s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
if (((ctxt->csCtx).state == 0) && (D_801D0D50 == 0)) {
sVar3 = actor->yawTowardsPlayer - actor->shape.rot.y;
// TODO is this shifting because of a missing cast?
if (0x42ff < (sVar3 < 0? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3,param_4);
if (0x42ff < (sVar3 < 0 ? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3, param_4);
return 0;
}
}
@@ -103,8 +105,7 @@ s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
local_14 = player->focus.pos;
}
func_800E8FA4(actor,&local_14,param_3,param_4);
func_800E8FA4(actor, &local_14, param_3, param_4);
return 1;
}
+3 -1
View File
@@ -2,5 +2,7 @@
#include <global.h>
void func_80183070(void) {
for(;;) func_80087A6C(1000);
for (;;) {
func_80087A6C(1000);
}
}
+30 -35
View File
@@ -11,13 +11,13 @@ u32 D_801D1514[3] = { 0 };
void Game_UpdateFramerateVariables(s32 divisor) {
gFramerateDivisor = divisor;
gFramerateDivisorF = (f32) divisor;
gFramerateDivisorHalf = (f32) (divisor * 0.5f);
gFramerateDivisorThird = (f32) (divisor / 3.0f);
gFramerateDivisorF = (f32)divisor;
gFramerateDivisorHalf = (f32)(divisor * 0.5f);
gFramerateDivisorThird = (f32)(divisor / 3.0f);
}
void Game_SetFramerateDivisor(GameState *gameState, s32 divisor) {
R_UPDATE_RATE = (s16) divisor;
void Game_SetFramerateDivisor(GameState* gameState, s32 divisor) {
R_UPDATE_RATE = (s16)divisor;
gameState->framerateDivisor = divisor;
Game_UpdateFramerateVariables(divisor);
}
@@ -63,11 +63,11 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
*gfx = _gfx;
}
void Game_Nop80173534(GameState *ctxt) {
void Game_Nop80173534(GameState* ctxt) {
;
}
void GameState_Draw(GameState *ctxt, GraphicsContext *gCtxt) {
void GameState_Draw(GameState* ctxt, GraphicsContext* gCtxt) {
Gfx* nextDisplayList;
Gfx* _polyOpa;
// Unused vars impact regalloc
@@ -79,7 +79,7 @@ void GameState_Draw(GameState *ctxt, GraphicsContext *gCtxt) {
gSPDisplayList(gCtxt->overlay.p++, nextDisplayList);
if (R_FB_FILTER_TYPE && R_FB_FILTER_ENV_COLOR(3) == 0) {
GameState_SetFBFilter(&nextDisplayList, (u32) gCtxt->zbuffer);
GameState_SetFBFilter(&nextDisplayList, (u32)gCtxt->zbuffer);
}
if (R_ENABLE_ARENA_DBG < 0) {
@@ -99,7 +99,7 @@ lblUnk:; // Label prevents reordering, if(1) around the above block don't seem t
}
}
void Game_ResetSegments(GraphicsContext *gCtxt) {
void Game_ResetSegments(GraphicsContext* gCtxt) {
gSPSegment(gCtxt->polyOpa.p++, 0, 0);
gSPSegment(gCtxt->polyOpa.p++, 0xF, gCtxt->framebuffer);
gSPSegment(gCtxt->polyXlu.p++, 0, 0);
@@ -108,7 +108,7 @@ void Game_ResetSegments(GraphicsContext *gCtxt) {
gSPSegment(gCtxt->overlay.p++, 0xF, gCtxt->framebuffer);
}
void func_801736DC(GraphicsContext *gCtxt) {
void func_801736DC(GraphicsContext* gCtxt) {
Gfx* nextDisplayList;
Gfx* _polyOpa;
@@ -120,11 +120,11 @@ void func_801736DC(GraphicsContext *gCtxt) {
gCtxt->polyOpa.p = nextDisplayList;
}
void Game_UpdateInput(GameState *ctxt) {
void Game_UpdateInput(GameState* ctxt) {
Padmgr_GetInput(ctxt->input, 1);
}
void Game_Update(GameState *ctxt) {
void Game_Update(GameState* ctxt) {
GraphicsContext* _gCtx;
_gCtx = ctxt->gfxCtx;
@@ -138,14 +138,14 @@ void Game_Update(GameState *ctxt) {
}
}
void Game_IncrementFrameCount(GameState *ctxt) {
void Game_IncrementFrameCount(GameState* ctxt) {
Game_Nop80173534(ctxt);
ctxt->frames++;
}
void Game_InitHeap(GameState *ctxt, u32 size) {
GameState *_ctx;
void *buf;
void Game_InitHeap(GameState* ctxt, u32 size) {
GameState* _ctx;
void* buf;
_ctx = ctxt;
buf = Gamealloc_Alloc(&_ctx->alloc, size);
@@ -159,14 +159,13 @@ void Game_InitHeap(GameState *ctxt, u32 size) {
assert_fail("../game.c", 0x40B);
}
void Game_ResizeHeap(GameState *ctxt, u32 size)
{
GameAlloc *alloc;
void *buf;
void Game_ResizeHeap(GameState* ctxt, u32 size) {
GameAlloc* alloc;
void* buf;
u32 systemMaxFree;
u32 bytesFree;
u32 bytesAllocated;
void *heapStart;
void* heapStart;
heapStart = ctxt->heap.bufp;
alloc = &ctxt->alloc;
@@ -174,23 +173,19 @@ void Game_ResizeHeap(GameState *ctxt, u32 size)
Gamealloc_Free(alloc, heapStart);
StartHeap_AnalyzeArena(&systemMaxFree, &bytesFree, &bytesAllocated);
size = ((systemMaxFree - (sizeof(ArenaNode))) < size) ? (0) : (size);
if (!size)
{
if (!size) {
size = systemMaxFree - (sizeof(ArenaNode));
}
if (buf = Gamealloc_Alloc(alloc, size))
{
if (buf = Gamealloc_Alloc(alloc, size)) {
THA_Ct(&ctxt->heap, buf, size);
}
else
{
} else {
THA_Ct(&ctxt->heap, 0, 0);
assert_fail("../game.c", 0x432);
}
}
void Game_StateInit(GameState *ctxt, GameStateFunc gameStateInit, GraphicsContext *gCtxt) {
void Game_StateInit(GameState* ctxt, GameStateFunc gameStateInit, GraphicsContext* gCtxt) {
ctxt->gfxCtx = gCtxt;
ctxt->frames = 0U;
ctxt->main = NULL;
@@ -220,7 +215,7 @@ lblUnk:;
osSendMesg(&ctxt->gfxCtx->unk5C, NULL, 1);
}
void Game_StateFini(GameState *ctxt) {
void Game_StateFini(GameState* ctxt) {
func_80172BC0();
func_8019E014();
osRecvMesg(&ctxt->gfxCtx->unk5C, 0, 1);
@@ -239,23 +234,23 @@ void Game_StateFini(GameState *ctxt) {
Gamealloc_FreeAll(&ctxt->alloc);
}
GameStateFunc Game_GetNextStateInit(GameState *ctxt) {
GameStateFunc Game_GetNextStateInit(GameState* ctxt) {
return ctxt->nextGameStateInit;
}
u32 Game_GetNextStateSize(GameState *ctxt) {
u32 Game_GetNextStateSize(GameState* ctxt) {
return ctxt->nextGameStateSize;
}
u32 Game_GetShouldContinue(GameState *ctxt) {
u32 Game_GetShouldContinue(GameState* ctxt) {
return ctxt->running;
}
s32 Game_GetHeapFreeSize(GameState *ctxt) {
s32 Game_GetHeapFreeSize(GameState* ctxt) {
return THA_GetSize(&ctxt->heap);
}
s32 func_80173B48(GameState *ctxt) {
s32 func_80173B48(GameState* ctxt) {
s32 result;
result = OS_CYCLES_TO_NSEC(ctxt->framerateDivisor * sIrqMgrRetraceTime) - OS_CYCLES_TO_NSEC(D_801FBAF0);
return result;
+1 -2
View File
@@ -2,7 +2,7 @@
#include <global.h>
void Matrix_Init(GameState* state) {
sMatrixStack = (MtxF *)THA_AllocEndAlign16(&state->heap, 0x500);
sMatrixStack = (MtxF*)THA_AllocEndAlign16(&state->heap, 0x500);
sCurrentMatrix = sMatrixStack;
}
@@ -11,7 +11,6 @@ void Matrix_Push(void) {
sCurrentMatrix++;
Matrix_MtxFCopy(sCurrentMatrix, prev);
}
void Matrix_Pop(void) {
+10 -10
View File
@@ -1,22 +1,22 @@
#include <ultra64.h>
#include <global.h>
#define SLOWLY_STATUS_DONE (1 << 0)
#define SLOWLY_STATUS_DONE (1 << 0)
#define SLOWLY_STATUS_STARTED (1 << 1)
void Slowly_Main(SlowlyTask* slowly) {
slowly->status |= SLOWLY_STATUS_STARTED;
switch (slowly->callbackArgCount) {
case SLOWLY_CALLBACK_NO_ARGS:
slowly->callback0();
break;
case SLOWLY_CALLBACK_ONE_ARG:
slowly->callback1(slowly->callbackArg0);
break;
case SLOWLY_CALLBACK_TWO_ARGS:
slowly->callback2(slowly->callbackArg0, slowly->callbackArg1);
break;
case SLOWLY_CALLBACK_NO_ARGS:
slowly->callback0();
break;
case SLOWLY_CALLBACK_ONE_ARG:
slowly->callback1(slowly->callbackArg0);
break;
case SLOWLY_CALLBACK_TWO_ARGS:
slowly->callback2(slowly->callbackArg0, slowly->callbackArg1);
break;
}
slowly->status |= SLOWLY_STATUS_DONE;
+5 -4
View File
@@ -45,22 +45,23 @@ void TitleSetup_GameStateResetContext(void) {
YREG(43) = 0xB1;
}
void TitleSetup_InitImpl(GameState *gameState) {
void TitleSetup_InitImpl(GameState* gameState) {
func_80185908();
func_800E9360();
TitleSetup_GameStateResetContext();
gameState->running = 0;
setNextGamestate:; // This label is probably a leftover of a debug ifdef, it's essential to not have gameState->running reordered!
setNextGamestate
:; // This label is probably a leftover of a debug ifdef, it's essential to not have gameState->running reordered!
SET_NEXT_GAMESTATE(gameState, Title_Init, TitleContext);
}
void TitleSetup_Destroy(GameState *gameState) {
void TitleSetup_Destroy(GameState* gameState) {
;
}
void TitleSetup_Init(GameState *gameState) {
void TitleSetup_Init(GameState* gameState) {
gameState->destroy = &TitleSetup_Destroy;
TitleSetup_InitImpl(gameState);
}
+14 -17
View File
@@ -1,11 +1,11 @@
#include <ultra64.h>
#include <global.h>
//From OOT
// From OOT
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
void Actor_PrintLists(ActorContext *actorCtx) {
void Actor_PrintLists(ActorContext* actorCtx) {
ActorListEntry* actorList = &actorCtx->actorList[0];
Actor* actor;
s32 i;
@@ -13,7 +13,7 @@ void Actor_PrintLists(ActorContext *actorCtx) {
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_Printf(D_801DC9D0, gMaxActorId);
FaultDrawer_Printf(D_801DC9D8);
for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) {
actor = actorList[i].first;
@@ -21,7 +21,6 @@ void Actor_PrintLists(ActorContext *actorCtx) {
FaultDrawer_Printf(D_801DC9F8, i, actor, actor->id, actor->category, D_801DCA10);
actor = actor->next;
}
}
}
@@ -40,10 +39,9 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf
if (dy >= -50.0f && dy < 500.0f) {
f32 shadowScale;
MtxF mtx;
OPEN_DISPS(globalCtx->state.gfxCtx);
POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C);
gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0,
@@ -66,12 +64,11 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf
Matrix_RotateY((f32)actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY);
}
shadowScale = 1.0f - (dy * D_801DCA14);
shadowScale = 1.0f - (dy * D_801DCA14);
shadowScale *= actor->shape.shadowScale;
Matrix_Scale(shadowScale * actor->scale.x, 1.0f, shadowScale * actor->scale.z, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dlist);
CLOSE_DISPS(globalCtx->state.gfxCtx);
@@ -129,8 +126,7 @@ void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3,
Matrix_RotateY(sp58, MTXMODE_APPLY);
Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, D_04075B30);
CLOSE_DISPS(globalCtx->state.gfxCtx);
@@ -178,7 +174,7 @@ u32 Flags_GetSwitch(GlobalContext* ctxt, s32 flag) {
return 0;
}
void Actor_SetSwitchFlag(GlobalContext* ctxt, s32 flag){
void Actor_SetSwitchFlag(GlobalContext* ctxt, s32 flag) {
if (flag >= 0 && flag < 0x80) {
ctxt->actorCtx.switchFlags[(flag & -0x20) >> 5] |= 1 << (flag & 0x1F);
}
@@ -250,7 +246,8 @@ void Actor_TitleCardContextInit(GlobalContext* ctxt, TitleCardContext* titleCtxt
titleCtxt->alpha = 0;
}
void Actor_TitleCardCreate(GlobalContext* ctxt, TitleCardContext* titleCtxt, u32 texture, s16 param_4, s16 param_5, u8 param_6, u8 param_7) {
void Actor_TitleCardCreate(GlobalContext* ctxt, TitleCardContext* titleCtxt, u32 texture, s16 param_4, s16 param_5,
u8 param_6, u8 param_7) {
titleCtxt->texture = texture;
titleCtxt->unk4 = param_4;
titleCtxt->unk6 = param_5;
@@ -404,7 +401,7 @@ void Actor_SetVelocityAndMoveYRotationAndGravity(Actor* actor) {
}
void Actor_SetVelocityXYRotation(Actor* actor) {
f32 velX = Math_CosS(actor->world.rot.x) * actor->speedXZ;
f32 velX = Math_CosS(actor->world.rot.x) * actor->speedXZ;
actor->velocity.x = Math_SinS(actor->world.rot.y) * velX;
actor->velocity.y = Math_SinS(actor->world.rot.x) * actor->speedXZ;
actor->velocity.z = Math_CosS(actor->world.rot.y) * velX;
@@ -416,7 +413,7 @@ void Actor_SetVelocityAndMoveXYRotation(Actor* actor) {
}
void Actor_SetVelocityXYRotationReverse(Actor* actor) {
f32 velX = Math_CosS(-actor->world.rot.x) * actor->speedXZ;
f32 velX = Math_CosS(-actor->world.rot.x) * actor->speedXZ;
actor->velocity.x = Math_SinS(actor->world.rot.y) * velX;
actor->velocity.y = Math_SinS(-actor->world.rot.x) * actor->speedXZ;
actor->velocity.z = Math_CosS(actor->world.rot.y) * velX;
@@ -740,9 +737,9 @@ void Actor_FreeOverlay(ActorOverlay* entry) {
if (entry->nbLoaded == 0) {
ramAddr = entry->loadedRamAddr;
if (ramAddr != NULL) {
//Bit 1 - always loaded
// Bit 1 - always loaded
if ((entry->allocType & 2) == 0) {
//Bit 0 - don't alloc memory
// Bit 0 - don't alloc memory
if ((entry->allocType & 1) != 0) {
entry->loadedRamAddr = NULL;
} else {
+4 -4
View File
@@ -2,10 +2,10 @@
#include <global.h>
#include "initvars.h"
#define ACTOR_OVERLAY(name, allocType) \
{ \
(u32)_ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \
_ovl_##name##SegmentEnd, NULL, &name##_InitVars, NULL, allocType, 0 \
#define ACTOR_OVERLAY(name, allocType) \
{ \
(u32) _ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \
_ovl_##name##SegmentEnd, NULL, &name##_InitVars, NULL, allocType, 0 \
}
#define ACTOR_OVERLAY_INTERNAL(name, allocType) \
-1
View File
@@ -431,4 +431,3 @@ f32 func_800C411C(CollisionContext* bgCtxt, CollisionPoly* arg1, s32* arg2, Acto
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800CA9D0.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800CAA14.asm")
+1 -1
View File
@@ -55,7 +55,7 @@ DamageTable sDamageTablePresets[] = {
* is out of range.
*/
DamageTable* DamageTable_Get(s32 index) {
if (index < 0 || index > ARRAY_COUNT(sDamageTablePresets)-1) {
if (index < 0 || index > ARRAY_COUNT(sDamageTablePresets) - 1) {
return NULL;
}
+2 -2
View File
@@ -329,8 +329,8 @@ s32 Collider_SetJntSphToActor(GlobalContext* ctxt, ColliderJntSph* collider, Col
return 0;
}
for (destElem = collider->elements, srcElem = src->elements;
destElem < &collider->elements[collider->count]; destElem++, srcElem++) {
for (destElem = collider->elements, srcElem = src->elements; destElem < &collider->elements[collider->count];
destElem++, srcElem++) {
Collider_InitJntSphElement(ctxt, destElem);
Collider_SetJntSphElement(ctxt, destElem, srcElem);
}
+6 -5
View File
@@ -17,7 +17,8 @@ void EffFootmark_Init(GlobalContext* ctxt) {
}
}
void EffFootmark_Add(GlobalContext* ctxt, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) {
void EffFootmark_Add(GlobalContext* ctxt, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red,
u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) {
s32 i;
EffFootmark* footmark;
EffFootmark* destination = NULL;
@@ -52,7 +53,7 @@ void EffFootmark_Add(GlobalContext* ctxt, MtxF* displayMatrix, Actor* actor, u8
if (destination == NULL) {
destination = oldest;
}
Matrix_MtxFCopy(&destination->displayMatrix,displayMatrix);
Matrix_MtxFCopy(&destination->displayMatrix, displayMatrix);
destination->actor = actor;
destination->location.x = location->x;
destination->location.y = location->y;
@@ -98,7 +99,7 @@ void EffFootmark_Update(GlobalContext* ctxt) {
void EffFootmark_Draw(GlobalContext* ctxt) {
EffFootmark* footmark;
s32 i;
GraphicsContext *gfxCtx = ctxt->state.gfxCtx;
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
func_8012C448(ctxt->state.gfxCtx);
@@ -111,10 +112,10 @@ void EffFootmark_Draw(GlobalContext* ctxt) {
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue, footmark->alpha >> 8);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue,
footmark->alpha >> 8);
gSPDisplayList(gfxCtx->polyXlu.p++, D_801BC288);
}
}
}
+8 -10
View File
@@ -112,7 +112,9 @@ s32 EffectSS_FindFreeSpace(u32 priority, u32* tableEntry) {
i = 0;
}
if (i == EffectSS2Info.searchIndex) break;
if (i == EffectSS2Info.searchIndex) {
break;
}
}
if (ret == 1) {
@@ -137,7 +139,6 @@ s32 EffectSS_FindFreeSpace(u32 priority, u32* tableEntry) {
return ret;
}
}
}
*tableEntry = i;
@@ -183,7 +184,8 @@ void EffectSs_Spawn(GlobalContext* ctxt, s32 type, s32 priority, void* initData)
return;
}
load_and_relocate_overlay(entry->vromStart, entry->vromEnd, entry->vramStart, entry->vramEnd, entry->loadedRamAddr);
load_and_relocate_overlay(entry->vromStart, entry->vromEnd, entry->vramStart, entry->vramEnd,
entry->loadedRamAddr);
}
// XXX this should use a0, but it doesn't
@@ -262,13 +264,9 @@ void EffectSS_DrawAllParticles(GlobalContext* ctxt) {
for (i = 0; i < EffectSS2Info.size; i++) {
if (EffectSS2Info.data_table[i].life > -1) {
if (EffectSS2Info.data_table[i].pos.x > 32000 ||
EffectSS2Info.data_table[i].pos.x < -32000 ||
EffectSS2Info.data_table[i].pos.y > 32000 ||
EffectSS2Info.data_table[i].pos.y < -32000 ||
EffectSS2Info.data_table[i].pos.z > 32000 ||
EffectSS2Info.data_table[i].pos.z < -32000
) {
if (EffectSS2Info.data_table[i].pos.x > 32000 || EffectSS2Info.data_table[i].pos.x < -32000 ||
EffectSS2Info.data_table[i].pos.y > 32000 || EffectSS2Info.data_table[i].pos.y < -32000 ||
EffectSS2Info.data_table[i].pos.z > 32000 || EffectSS2Info.data_table[i].pos.z < -32000) {
EffectSS_Delete(&EffectSS2Info.data_table[i]);
} else {
EffectSS_DrawParticle(ctxt, i);
+8 -6
View File
@@ -343,7 +343,6 @@ void EffectSsGSpk_SpawnFuse(GlobalContext* globalCtx, Actor* actor, Vec3f* pos,
EffectSsGSpk_SpawnSmall(globalCtx, actor, pos, velocity, accel, &primColor, &envColor);
}
extern Color_RGBA8 D_801AE3D8;
extern Color_RGBA8 D_801AE3DC;
@@ -782,7 +781,8 @@ void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 sc
// EffectSsEnIce Spawn Functions
void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f * pos, Color_RGBA8 * prim, Color_RGBA8 * env, f32 scale) {
void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Color_RGBA8* prim,
Color_RGBA8* env, f32 scale) {
EffectSsEnIceInitParams initParams;
@@ -936,8 +936,8 @@ void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
}
// EffectSsDeadDb Spawn Functions
void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env,
s16 scale, s16 scaleStep, s32 unk) {
void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk) {
EffectSsDeadDbInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -960,13 +960,15 @@ void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
extern Color_RGBA8 D_801AE48C;
extern Color_RGBA8 D_801AE490[4];
void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s32 colorIndex) {
void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
s32 colorIndex) {
EffectSsDeadDb_Spawn(globalCtx, pos, velocity, accel, &D_801AE48C, &D_801AE490[colorIndex], scale, scaleStep, 9);
}
// EffectSsDeadDd Spawn Functions
void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s16 alphaStep, s32 life) {
void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
Color_RGBA8* env, s16 scale, s16 scaleStep, s16 alphaStep, s32 life) {
EffectSsDeadDdInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
+425 -383
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -1,13 +1,13 @@
#include <ultra64.h>
#include <global.h>
void Kanfont_Nop800F4F40(GlobalContext* ctxt, UNK_TYPE param_2, UNK_TYPE param_3) {}
void Kanfont_Nop800F4F40(GlobalContext* ctxt, UNK_TYPE param_2, UNK_TYPE param_3) {
}
void Kanfont_LoadAsciiChar(GlobalContext* ctxt, u8 character, s32 iParm3) {
// UB to convert pointer to u32
DmaMgr_SendRequest0((void*)((u32)&ctxt->msgCtx.font.unk0[(ctxt->msgCtx).unk11EF0] + iParm3),
(u32)_nes_font_staticSegmentRomStart + character * 0x80 - 0x1000,
0x80);
(u32)_nes_font_staticSegmentRomStart + character * 0x80 - 0x1000, 0x80);
}
void Kanfont_LoadMessageBoxEnd(Font* font, u16 type) {
@@ -28,7 +28,9 @@ void Kanfont_LoadOrderedFont(Font* font) {
}
// UB to convert pointer to u32
DmaMgr_SendRequest0(writeLocation, (u32)_nes_font_staticSegmentRomStart + loadOffset, 0x80);
if (kanfontOrdering[codePointIndex] == 140) break;
if (kanfontOrdering[codePointIndex] == 140) {
break;
}
codePointIndex++;
}
}

Some files were not shown because too many files have changed in this diff Show More