Fix gcc warnings (#246)

* fix a huge amount of warnings

* fix another big bunch

* fix remaining warnings

* Run formatter
This commit is contained in:
Anghelo Carvajal
2021-08-04 08:14:38 -04:00
committed by GitHub
parent 7743e5a2c4
commit 51111676c4
33 changed files with 117 additions and 107 deletions
+1 -1
View File
@@ -176,7 +176,7 @@ void Game_ResizeHeap(GameState* gamestate, u32 size) {
size = systemMaxFree - (sizeof(ArenaNode));
}
if (buf = Gamealloc_Alloc(alloc, size)) {
if ((buf = Gamealloc_Alloc(alloc, size)) != NULL) {
THA_Ct(&gamestate->heap, buf, size);
} else {
THA_Ct(&gamestate->heap, 0, 0);
+1 -1
View File
@@ -9,7 +9,7 @@ void TitleSetup_GameStateResetContext(void) {
XREG(13) = 0;
XREG(31) = 0;
XREG(41) = 0x50;
XREG(43) = 0xFFFFFC54;
XREG(43) = 0xFC54;
XREG(44) = 0xD7;
XREG(45) = 0xDA;
+1 -1
View File
@@ -46,7 +46,7 @@ void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
Math_Vec3f_Scale(&sp154, scale);
SkinMatrix_SetTranslate(&sp110, sp160.x, sp160.y, sp160.z);
Matrix_MakeRotationAroundUnitVector(&spD0, this->addAngle, sp154.x, sp154.y, sp154.z);
SkinMatrix_SetRotateAroundVec(&spD0, this->addAngle, sp154.x, sp154.y, sp154.z);
SkinMatrix_MtxFMtxFMult(&sp110, &spD0, &sp90);
SkinMatrix_SetTranslate(&sp110, -sp160.x, -sp160.y, -sp160.z);
SkinMatrix_MtxFMtxFMult(&sp90, &sp110, &sp50);
+20 -17
View File
@@ -468,8 +468,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
Collision_CylinderMoveToActor(&this->actor, &this->collider);
Collision_AddAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if ((this->actor.params == ITEM00_SHIELD_HERO) || (this->actor.params == ITEM00_MAP) ||
(this->actor.params == ITEM00_COMPASS)) {
@@ -866,15 +866,18 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 pa
}
} else if (((paramFF == ITEM00_FLEXIBLE) || ((params & 0xFF) == ITEM00_BIG_FAIRY)) && (param10000 == 0)) {
if ((params & 0xFF) == ITEM00_FLEXIBLE) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
// TODO: fix cast, this actor is not an EnItem00
spawnedActor =
(EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102);
if (!Actor_GetCollectibleFlag(globalCtx, (param7F00 >> 8) & 0x7F)) {
func_800F0568(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY);
}
} else {
spawnedActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7);
// TODO: fix cast, this actor is not an EnItem00
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, spawnPos->x,
spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0,
((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7);
if (param20000 == 0) {
if (!Actor_GetCollectibleFlag(globalCtx, (param7F00 >> 8) & 0x7F)) {
func_800F0568(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY);
@@ -885,9 +888,9 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 pa
if (param8000 == 0) {
params = func_800A7650(params & 0xFF);
}
if (params != ITEM00_NO_DROP) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y,
spawnPos->z, 0, 0, 0, params | param8000 | param7F00);
if (params != (u32)ITEM00_NO_DROP) {
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x,
spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param7F00);
if ((spawnedActor != NULL) && (param8000 == 0)) {
if (param10000 == 0) {
spawnedActor->actor.velocity.y = 8.0f;
@@ -897,7 +900,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 pa
spawnedActor->actor.speedXZ = 2.0f;
spawnedActor->actor.gravity = -0.9f;
spawnedActor->actor.world.rot.y = randPlusMinusPoint5Scaled(65536.0f);
Actor_SetScale(spawnedActor, 0.0f);
Actor_SetScale(&spawnedActor->actor, 0.0f);
spawnedActor->actionFunc = func_800A6780;
spawnedActor->unk152 = 0xDC;
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) &&
@@ -948,7 +951,7 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, u32 para
}
} else {
params = func_800A7650(params);
if (params != ITEM00_NO_DROP) {
if (params != (u32)ITEM00_NO_DROP) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y,
spawnPos->z, 0, 0, 0, params | param8000 | param7F00);
if (spawnedActor != NULL) {
@@ -1137,19 +1140,19 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
}
}
if (dropId != ITEM00_NO_DROP) {
if (dropId != (u8)ITEM00_NO_DROP) {
while (dropQuantity > 0) {
if (param8000 == 0) {
dropId = func_800A7650(dropId);
if (dropId != ITEM00_NO_DROP) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x,
spawnPos->y, spawnPos->z, 0, 0, 0, dropId);
if ((spawnedActor != 0) && (dropId != ITEM00_NO_DROP)) {
if (dropId != (u8)ITEM00_NO_DROP) {
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00,
spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, dropId);
if ((spawnedActor != 0) && (dropId != (u8)ITEM00_NO_DROP)) {
spawnedActor->actor.velocity.y = 8.0f;
spawnedActor->actor.speedXZ = 2.0f;
spawnedActor->actor.gravity = -0.9f;
spawnedActor->actor.world.rot.y = Rand_ZeroOne() * 40000.0f;
Actor_SetScale(spawnedActor, 0.0f);
Actor_SetScale(&spawnedActor->actor, 0.0f);
spawnedActor->actionFunc = func_800A6780;
spawnedActor->actor.flags = spawnedActor->actor.flags | 0x10;
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) &&
+5 -5
View File
@@ -18,11 +18,11 @@ void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) {
FONT_CHAR_TEX_SIZE);
}
static char sFontOrdering[] = "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19"
"!\"#$%&\'()*+,-./0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"\x00\x0D\x0E\x1A"
"afjmosvwxyz{|}~"
"\x7F\x80\x81\x84\x86\x87\x88\x89\x8A\x8B\x8C";
static u8 sFontOrdering[] = "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19"
"!\"#$%&\'()*+,-./0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"\x00\x0D\x0E\x1A"
"afjmosvwxyz{|}~"
"\x7F\x80\x81\x84\x86\x87\x88\x89\x8A\x8B\x8C";
void Font_LoadOrderedFont(Font* font) {
u32 loadOffset;
+2 -2
View File
@@ -1,10 +1,10 @@
#include "global.h"
#define SCENE_ENTRY(name, textId, config) \
{ (u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomEnd, textId, 0, config }
{ { (u32)_##name##SegmentRomStart, (u32)_##name##SegmentRomEnd }, textId, 0, config, 0 }
#define SCENE_ENTRY_NONE() \
{ 0, 0, 0, 0, 0 }
{ { 0, 0 }, 0, 0, 0, 0 }
SceneTableEntry gSceneTable[] = {
SCENE_ENTRY(Z2_20SICHITAI2, 0x0116, SCENE_DRAW_CFG_MAT_ANIM),