From 22b78f169f140249a8be9ebcb41d3d5ac6b94a36 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 13 Oct 2022 10:06:49 +0200 Subject: [PATCH] Fix misc 17 (#1392) * Some cleanup on bgcheck waterbox y funcs * Fix some typo/spelling * EnFz_ApplyDamage match fixup * Turn another sus construction into a switch * Fixup comment on restoring MS as adult * "doesnt, isnt" -> "doesn't, isn't" * Hunt down whitespace at end of lines * Format (clang-format does not like figs bug comment on bongo cutscene unskip sadge) * Viewport z scale/translation: `0x1FF` -> `G_MAXZ/2` (see proman "9.7 Mixing CPU and SP Addresses", "12.7.6 Depth Source") * static symbols: g -> s prefix * Link young/old -> child/adult * Fixups * Get rid of signed vs unsigned comparison warning by changing room temps to s32 * waterbox search funcs consistency * Revert "waterbox search funcs consistency" This reverts commit 8f386e038f5e735f0f5f1240fc4da7bec4e8c7e2. * `curWaterBox` -> `waterBox` --- include/tables/dmadata_table_mqdbg.h | 2 +- include/tables/entrance_table.h | 2 +- include/ultra64/rdb.h | 2 +- include/ultra64/ucode.h | 2 +- include/z64.h | 2 +- include/z64audio.h | 4 +- include/z64camera.h | 4 +- include/z64environment.h | 6 +- include/z64ocarina.h | 6 +- include/z64save.h | 4 +- src/code/kanread.s | 12 ++-- src/code/z_bgcheck.c | 69 +++++++++---------- src/code/z_lights.c | 4 +- src/code/z_sram.c | 2 +- src/code/z_view.c | 4 +- src/libultra/gu/perspective.c | 1 + src/overlays/actors/ovl_En_Am/z_en_am.c | 6 +- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 2 +- src/overlays/actors/ovl_En_Fz/z_en_fz.c | 31 +++++---- .../actors/ovl_En_Heishi1/z_en_heishi1.c | 2 +- .../actors/ovl_En_Heishi2/z_en_heishi2.h | 2 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 2 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 17 +++-- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 2 +- .../ovl_Obj_Timeblock/z_obj_timeblock.c | 4 +- .../ovl_file_choose/z_file_choose.c | 16 ++--- .../ovl_file_choose/z_file_nameset_PAL.c | 22 +++--- 27 files changed, 118 insertions(+), 114 deletions(-) diff --git a/include/tables/dmadata_table_mqdbg.h b/include/tables/dmadata_table_mqdbg.h index 9f621e058b..9d07de8863 100644 --- a/include/tables/dmadata_table_mqdbg.h +++ b/include/tables/dmadata_table_mqdbg.h @@ -1,6 +1,6 @@ /** * Matching dmadata layout for PAL MQ Debug - * + * * DEFINE_DMA_ENTRY should be used for all dmadata entries * - Argument 1: Name of the spec segment * - Argument 2: String matching the original name of the segment diff --git a/include/tables/entrance_table.h b/include/tables/entrance_table.h index 17abdad340..b8d37f5e7a 100644 --- a/include/tables/entrance_table.h +++ b/include/tables/entrance_table.h @@ -7,7 +7,7 @@ * - Argument 3: Spawn number for this entrance * - Argument 4: Toggle if bgm should continue during the transition using this entrance (true or false) * NOTE: For non-cutscene layers, this field is only read from the `SCENE_LAYER_CHILD_DAY` layer. - * Meaning, the setting only matters for the first entry within a group of layers and that + * Meaning, the setting only matters for the first entry within a group of layers and that * setting will apply to the other 3 non-cutscene layers. * - Argument 5: Toggle if a title card should display when using this entrance (true or false) * - Argument 6: Transition type when entering using this entrance (second half of a scene transition) diff --git a/include/ultra64/rdb.h b/include/ultra64/rdb.h index b9e6a52816..31442b587c 100644 --- a/include/ultra64/rdb.h +++ b/include/ultra64/rdb.h @@ -28,7 +28,7 @@ #define RDB_TYPE_HtoG_DEBUG 14 #define RDB_TYPE_HtoG_DEBUG_CT 15 #define RDB_TYPE_HtoG_DATA 16 -#define RDB_TYPE_HtoG_DATA_DONE 17 +#define RDB_TYPE_HtoG_DATA_DONE 17 #define RDB_TYPE_HtoG_REQ_RAMROM 18 #define RDB_TYPE_HtoG_FREE_RAMROM 19 #define RDB_TYPE_HtoG_KDEBUG 20 diff --git a/include/ultra64/ucode.h b/include/ultra64/ucode.h index c39fa938a6..a525b24839 100644 --- a/include/ultra64/ucode.h +++ b/include/ultra64/ucode.h @@ -9,7 +9,7 @@ #define SP_UCODE_SIZE 0x1000 #define SP_UCODE_DATA_SIZE 0x800 - + extern u64 rspbootTextStart[], rspbootTextEnd[]; extern u64 aspMainTextStart[], aspMainTextEnd[]; diff --git a/include/z64.h b/include/z64.h index 06773d9be9..b0138307ef 100644 --- a/include/z64.h +++ b/include/z64.h @@ -966,7 +966,7 @@ typedef enum { /* 6 */ TRANS_TYPE_FADE_BLACK_SLOW, /* 7 */ TRANS_TYPE_FADE_WHITE_SLOW, /* 8 */ TRANS_TYPE_WIPE_FAST, - /* 9 */ TRANS_TYPE_FILL_WHITE2, + /* 9 */ TRANS_TYPE_FILL_WHITE2, /* 10 */ TRANS_TYPE_FILL_WHITE, /* 11 */ TRANS_TYPE_INSTANT, /* 12 */ TRANS_TYPE_FILL_BROWN, diff --git a/include/z64audio.h b/include/z64audio.h index 4f1f0a5543..fe63f75702 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -607,7 +607,7 @@ typedef struct { /** * The high-level audio specifications requested when initializing or resetting the audio heap. * The audio heap can be reset on various occasions, including on most scene transitions. - */ + */ typedef struct { /* 0x00 */ u32 samplingFrequency; // Target sampling rate in Hz /* 0x04 */ u8 unk_04; @@ -909,7 +909,7 @@ typedef struct { /* 0x2990 */ AudioAllocPool sessionPool; // A sub-pool to main pool, contains all sub-pools and data that changes every audio reset /* 0x29A0 */ AudioAllocPool externalPool; // pool allocated externally to the audio heap. Never used in game /* 0x29B0 */ AudioAllocPool initPool;// A sub-pool to the main pool, contains all sub-pools and data that persists every audio reset - /* 0x29C0 */ AudioAllocPool miscPool; // A sub-pool to the session pool. + /* 0x29C0 */ AudioAllocPool miscPool; // A sub-pool to the session pool. /* 0x29D0 */ char unk_29D0[0x20]; // probably two unused pools /* 0x29F0 */ AudioAllocPool cachePool; // The common pool for cache entries /* 0x2A00 */ AudioAllocPool persistentCommonPool; // A sub-pool to the cache pool, contains caches for data stored persistently diff --git a/include/z64camera.h b/include/z64camera.h index 5ea1d97599..a5402d2245 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -27,7 +27,7 @@ #define PARENT_CAM(cam) ((cam)->play->cameraPtrs[(cam)->parentCamId]) #define CHILD_CAM(cam) ((cam)->play->cameraPtrs[(cam)->childCamId]) -// All scenes using `SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT` or `SCENE_CAM_TYPE_FIXED_TOGGLE_VIEWPOINT` are expected +// All scenes using `SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT` or `SCENE_CAM_TYPE_FIXED_TOGGLE_VIEWPOINT` are expected // to have their first two bgCamInfo entries be the following: #define BGCAM_INDEX_TOGGLE_LOCKED 0 #define BGCAM_INDEX_TOGGLE_PIVOT 1 @@ -102,7 +102,7 @@ typedef enum { /* 0x3A */ CAM_SET_NORMAL2, /* 0x3B */ CAM_SET_FISHING, // Fishing pond by the lake /* 0x3C */ CAM_SET_CS_C, // Various cutscenes "DEMOC" - /* 0x3D */ CAM_SET_JABU_TENTACLE, // Jabu-Jabu Parasitic Tenticle Rooms "UO_FIBER" + /* 0x3D */ CAM_SET_JABU_TENTACLE, // Jabu-Jabu Parasitic Tentacle Rooms "UO_FIBER" /* 0x3E */ CAM_SET_DUNGEON2, /* 0x3F */ CAM_SET_DIRECTED_YAW, // Does not auto-update yaw, tends to keep the camera pointed at a certain yaw (used by biggoron and final spirit lowering platform) "TEPPEN" /* 0x40 */ CAM_SET_PIVOT_FROM_SIDE, // Fixed side view, allows rotation of camera (eg. Potion Shop, Meadow at fairy grotto) "CIRCLE7" diff --git a/include/z64environment.h b/include/z64environment.h index 3bfaf00823..5944607b88 100644 --- a/include/z64environment.h +++ b/include/z64environment.h @@ -26,12 +26,12 @@ #define LIGHT_BLEND_OVERRIDE_NONE 0 #define LIGHT_BLEND_OVERRIDE_ON 1 -// This mode disables the light system's automatic blending between +// This mode disables the light system's automatic blending between // light settings for `LIGHT_MODE_SETTINGS` (or using a light setting override). // This is a bit of a hack used only by bosses in the original game. #define LIGHT_BLEND_OVERRIDE_FULL_CONTROL 2 -typedef enum { +typedef enum { /* 0 */ LIGHT_MODE_TIME, // environment lights use `lightConfig` and change based on time of day /* 1 */ LIGHT_MODE_SETTINGS // environment lights use `lightSetting` } LightMode; @@ -76,7 +76,7 @@ typedef enum { typedef enum { /* 0 */ PRECIP_RAIN_MAX, // max number of raindrops that can draw; uses this or SOS_MAX, whichever is larger - /* 1 */ PRECIP_RAIN_CUR, // current number of rain drops being drawn on screen + /* 1 */ PRECIP_RAIN_CUR, // current number of rain drops being drawn on screen /* 2 */ PRECIP_SNOW_CUR, // current number of snowflakes being drawn on screen /* 3 */ PRECIP_SNOW_MAX, // max number of snowflakes that can draw /* 4 */ PRECIP_SOS_MAX, // max number of rain drops requested from song of storms specifically diff --git a/include/z64ocarina.h b/include/z64ocarina.h index 71e3352692..7dc1a4b331 100644 --- a/include/z64ocarina.h +++ b/include/z64ocarina.h @@ -148,14 +148,14 @@ typedef enum { /** * bFlat4Flag Note: - * Flag for resolving whether (pitch = OCARINA_PITCH_BFLAT4) + * Flag for resolving whether (pitch = OCARINA_PITCH_BFLAT4) * gets mapped to either C_RIGHT and C_LEFT - * + * * This is required as C_RIGHT and C_LEFT are the only notes * that map to two semitones apart (OCARINA_PITCH_A4 and OCARINA_PITCH_B4) * 0x40 - BTN_Z is pressed to lower note by a semitone * 0x80 - BTN_R is pressed to raise note by a semitone - */ + */ typedef struct { /* 0x0 */ u8 pitch; // number of semitones above middle C diff --git a/include/z64save.h b/include/z64save.h index ffa2232100..430577f354 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -12,7 +12,7 @@ typedef enum { /* 0x4 */ MAGIC_STATE_METER_FLASH_2, // Flashes border and draws yellow magic to preview target consumption /* 0x5 */ MAGIC_STATE_RESET, // Reset colors and return to idle /* 0x6 */ MAGIC_STATE_METER_FLASH_3, // Flashes border with no additional behaviour - /* 0x7 */ MAGIC_STATE_CONSUME_LENS, // Magic slowly consumed by lens. + /* 0x7 */ MAGIC_STATE_CONSUME_LENS, // Magic slowly consumed by lens. /* 0x8 */ MAGIC_STATE_STEP_CAPACITY, // Step `magicCapacity` to full capacity /* 0x9 */ MAGIC_STATE_FILL, // Add magic until magicFillTarget is reached. /* 0xA */ MAGIC_STATE_ADD // Add requested magic @@ -257,7 +257,7 @@ typedef enum { /* 1 */ SCENE_LAYER_CHILD_NIGHT, /* 2 */ SCENE_LAYER_ADULT_DAY, /* 3 */ SCENE_LAYER_ADULT_NIGHT, - /* 4 */ SCENE_LAYER_CUTSCENE_FIRST + /* 4 */ SCENE_LAYER_CUTSCENE_FIRST } SceneLayer; #define IS_CUTSCENE_LAYER (gSaveContext.sceneLayer >= SCENE_LAYER_CUTSCENE_FIRST) diff --git a/src/code/kanread.s b/src/code/kanread.s index 70a884870e..8f35b713bd 100644 --- a/src/code/kanread.s +++ b/src/code/kanread.s @@ -16,7 +16,7 @@ * A nice Shift-JIS codepoint table: https://uic.io/en/charset/show/shift_jis/ * The file `kanji` contains the 'Level 1' kanji (0x889F-0x9872), and a reworked * version of the non-kanji section that includes extra English and Hylian glyphs. - * + * * @note This function assumes that its argument is a valid Shift-JIS codepoint; * there is no range protection at all. * @@ -26,15 +26,15 @@ * @remark Original name: "LeoGetKadr" */ LEAF(Kanji_OffsetFromShiftJIS) - // Characters with codepoints >= 0x8800 are kanji. Arrangement is regular, + // Characters with codepoints >= 0x8800 are kanji. Arrangement is regular, // so convert index directly. li $at, 0x8800 slt $at, $a0, $at bnez $at, .nonkanji // 0xBC is number of glyphs in one block in the `kanji` file: // 0x100 possible codepoints with the same byte1 - // - 0x40 unused at beginning - // - 1 unused at 0x7F + // - 0x40 unused at beginning + // - 1 unused at 0x7F // - 3 unused at 0xFD, 0xFE, 0xFF li $a2, 0xBC // Get byte1 and adjust so starts at 0 @@ -99,7 +99,7 @@ END(Kanji_OffsetFromShiftJIS) * if (byte2 >= 0x40) { * byte2--; * } - * + * * if (sjis >= 0x8800) { * byte1 -= 0x88; * return (0x30A + byte2 + byte1 * 0xBC) * FONT_CHAR_TEX_SIZE; @@ -134,7 +134,7 @@ DATA(sNonKanjiIndices) /* 0x824_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0092 /* 0x825_ */ .half 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 /* 0x826_ */ .half 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB -/* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +/* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 /* 0x828_ */ .half 0x0000, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4 /* 0x829_ */ .half 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0000, 0x0000, 0x0000, 0x0000, 0x00D0 /* 0x82A_ */ .half 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0 diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 60260a4e10..69c6cd7ae1 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -4239,22 +4239,21 @@ s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { CollisionHeader* colHeader = colCtx->colHeader; - u32 room; - WaterBox* curWaterBox; + s32 room; + WaterBox* waterBox; if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) { return false; } - for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; - curWaterBox++) { - room = WATERBOX_ROOM(curWaterBox->properties); - if (room == (u32)play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) { - if (!(curWaterBox->properties & WATERBOX_FLAG_19)) { - if (curWaterBox->xMin < x && x < curWaterBox->xMin + curWaterBox->xLength) { - if (curWaterBox->zMin < z && z < curWaterBox->zMin + curWaterBox->zLength) { - *outWaterBox = curWaterBox; - *ySurface = curWaterBox->ySurface; + for (waterBox = colHeader->waterBoxes; waterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; waterBox++) { + room = WATERBOX_ROOM(waterBox->properties); + if (room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) { + if (!(waterBox->properties & WATERBOX_FLAG_19)) { + if (waterBox->xMin < x && x < waterBox->xMin + waterBox->xLength) { + if (waterBox->zMin < z && z < waterBox->zMin + waterBox->zLength) { + *outWaterBox = waterBox; + *ySurface = waterBox->ySurface; return true; } } @@ -4287,21 +4286,18 @@ s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, waterBox = &colHeader->waterBoxes[i]; room = WATERBOX_ROOM(waterBox->properties); - if (!(room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL)) { - continue; - } - if (waterBox->properties & WATERBOX_FLAG_19) { - continue; - } - if (!(waterBox->xMin < pos->x && pos->x < waterBox->xMin + waterBox->xLength)) { - continue; - } - if (!(waterBox->zMin < pos->z && pos->z < waterBox->zMin + waterBox->zLength)) { - continue; - } - if (pos->y - surfaceChkDist < waterBox->ySurface && waterBox->ySurface < pos->y + surfaceChkDist) { - *outWaterBox = waterBox; - return i; + if (room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) { + if (!(waterBox->properties & WATERBOX_FLAG_19)) { + if (waterBox->xMin < pos->x && pos->x < waterBox->xMin + waterBox->xLength) { + if (waterBox->zMin < pos->z && pos->z < waterBox->zMin + waterBox->zLength) { + if (pos->y - surfaceChkDist < waterBox->ySurface && + waterBox->ySurface < pos->y + surfaceChkDist) { + *outWaterBox = waterBox; + return i; + } + } + } + } } } @@ -4349,22 +4345,21 @@ u32 WaterBox_GetLightIndex(CollisionContext* colCtx, WaterBox* waterBox) { */ s32 func_800425B0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { CollisionHeader* colHeader = colCtx->colHeader; - u32 room; - WaterBox* curWaterBox; + s32 room; + WaterBox* waterBox; if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) { return false; } - for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; - curWaterBox++) { - room = WATERBOX_ROOM(curWaterBox->properties); - if ((room == (u32)play->roomCtx.curRoom.num) || (room == WATERBOX_ROOM_ALL)) { - if (curWaterBox->properties & WATERBOX_FLAG_19) { - if (curWaterBox->xMin < x && x < (curWaterBox->xMin + curWaterBox->xLength)) { - if (curWaterBox->zMin < z && z < (curWaterBox->zMin + curWaterBox->zLength)) { - *outWaterBox = curWaterBox; - *ySurface = curWaterBox->ySurface; + for (waterBox = colHeader->waterBoxes; waterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; waterBox++) { + room = WATERBOX_ROOM(waterBox->properties); + if ((room == play->roomCtx.curRoom.num) || (room == WATERBOX_ROOM_ALL)) { + if (waterBox->properties & WATERBOX_FLAG_19) { + if (waterBox->xMin < x && x < (waterBox->xMin + waterBox->xLength)) { + if (waterBox->zMin < z && z < (waterBox->zMin + waterBox->zLength)) { + *outWaterBox = waterBox; + *ySurface = waterBox->ySurface; return true; } } diff --git a/src/code/z_lights.c b/src/code/z_lights.c index 4557b63342..d0679c56f5 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -147,7 +147,7 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, Vec3f* vec) { * a light to it. Then apply color and positional/directional info for each light * based on the parameters supplied by the node. * - * Note: Lights in a given list can only be binded to however many free slots are + * Note: Lights in a given list can only be bound to however many free slots are * available in the Lights group. This is at most 7 slots for a new group, but could be less. */ void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* vec) { @@ -217,7 +217,7 @@ void LightContext_SetFog(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 fogNear, } /** - * Allocate a new Lights group and initilize the ambient color with that provided by LightContext + * Allocate a new Lights group and initialize the ambient color with that provided by LightContext */ Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx) { return Lights_New(gfxCtx, lightCtx->ambientColor[0], lightCtx->ambientColor[1], lightCtx->ambientColor[2]); diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 4ce0b5d3a2..4e79b22144 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -312,7 +312,7 @@ static s16 sDungeonEntrances[] = { * - If health is less than 3 hearts, give 3 hearts * - If either scarecrow song is set, copy them from save context to the proper location * - Handle a case where the player saved and quit after zelda cutscene but didnt get the song - * - Give and equip master sword if player is adult and doesnt have kokiri sword (bug?) + * - Give and equip master sword if player is adult and doesn't have master sword * - Revert any trade items that spoil */ void Sram_OpenSave(SramContext* sramCtx) { diff --git a/src/code/z_view.c b/src/code/z_view.c index 044e5603e7..7205f789b8 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -12,11 +12,11 @@ void View_ViewportToVp(Vp* dest, Viewport* src) { dest->vp.vscale[0] = width * 2; dest->vp.vscale[1] = height * 2; - dest->vp.vscale[2] = 0x01FF; + dest->vp.vscale[2] = G_MAXZ / 2; dest->vp.vscale[3] = 0; dest->vp.vtrans[0] = ((src->leftX * 2) + width) * 2; dest->vp.vtrans[1] = ((src->topY * 2) + height) * 2; - dest->vp.vtrans[2] = 0x01FF; + dest->vp.vtrans[2] = G_MAXZ / 2; dest->vp.vtrans[3] = 0; } diff --git a/src/libultra/gu/perspective.c b/src/libultra/gu/perspective.c index 4418a61222..21b0e1a0a6 100644 --- a/src/libultra/gu/perspective.c +++ b/src/libultra/gu/perspective.c @@ -33,6 +33,7 @@ void guPerspectiveF(f32 mf[4][4], u16* perspNorm, f32 fovy, f32 aspect, f32 near } } } + void guPerspective(Mtx* m, u16* perspNorm, f32 fovy, f32 aspect, f32 near, f32 far, f32 scale) { f32 mf[4][4]; diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index 66e27db961..f1085c5df6 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -114,10 +114,10 @@ static ColliderQuadInit sQuadInit = { typedef enum { /* 00 */ AM_DMGEFF_NONE, // used by anything that cant kill the armos /* 01 */ AM_DMGEFF_NUT, - /* 06 */ AM_DMGEFF_STUN = 6, // doesnt include deku nuts + /* 06 */ AM_DMGEFF_STUN = 6, // doesn't include deku nuts /* 13 */ AM_DMGEFF_ICE = 13, /* 14 */ AM_DMGEFF_MAGIC_FIRE_LIGHT, - /* 15 */ AM_DMGEFF_KILL // any damage source that can kill the armos (and isnt a special case) + /* 15 */ AM_DMGEFF_KILL // any damage source that can kill the armos (and isn't a special case) } ArmosDamageEffect; static DamageTable sDamageTable = { @@ -246,7 +246,7 @@ void EnAm_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); Collider_DestroyCylinder(play, &this->hurtCollider); Collider_DestroyCylinder(play, &this->blockCollider); - //! @bug Quad collider is not destroyed (though destroy doesnt really do anything anyway) + //! @bug Quad collider is not destroyed (though destroy doesn't really do anything anyway) } void EnAm_SpawnEffects(EnAm* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 445250e8d5..9e91b70aa7 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -272,7 +272,7 @@ void EnBom_Update(Actor* thisx, PlayState* play2) { thisx->shape.rot.z = 0; } else { // if a lit stick touches the bomb, set timer to 100 - // these bombs never have a timer over 70, so this isnt used + // these bombs never have a timer over 70, so this isn't used if ((this->timer > 100) && Player_IsBurningStickInRange(play, &thisx->world.pos, 30.0f, 50.0f)) { this->timer = 100; } diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 74907881be..46eed1d212 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -341,11 +341,11 @@ void EnFz_ApplyDamage(EnFz* this, PlayState* play) { this->collider1.base.acFlags &= ~AC_HIT; } else if (this->collider1.base.acFlags & AC_HIT) { this->collider1.base.acFlags &= ~AC_HIT; - if (this->actor.colChkInfo.damageEffect != 2) { - if (this->actor.colChkInfo.damageEffect == 0xF) { + switch (this->actor.colChkInfo.damageEffect) { + case 0xF: Actor_ApplyDamage(&this->actor); Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 8); - if (this->actor.colChkInfo.health) { + if (this->actor.colChkInfo.health != 0) { Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FREEZAD_DAMAGE); vec.x = this->actor.world.pos.x; vec.y = this->actor.world.pos.y; @@ -361,16 +361,21 @@ void EnFz_ApplyDamage(EnFz* this, PlayState* play) { EnFz_Damaged(this, play, &vec, 30, 10.0f); EnFz_SetupDespawn(this, play); } - } - } else { - Actor_ApplyDamage(&this->actor); - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 8); - if (this->actor.colChkInfo.health == 0) { - Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FREEZAD_DEAD); - EnFz_SetupMelt(this); - } else { - Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FREEZAD_DAMAGE); - } + break; + + case 2: + Actor_ApplyDamage(&this->actor); + Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 8); + if (this->actor.colChkInfo.health == 0) { + Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FREEZAD_DEAD); + EnFz_SetupMelt(this); + } else { + Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FREEZAD_DAMAGE); + } + break; + + default: + break; } } } diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index be46befc8e..22064e62a5 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -451,7 +451,7 @@ void EnHeishi1_Update(Actor* thisx, PlayState* play) { // sidehops onto the next screen and prevent getting caught. if (!(player->actor.velocity.y > -3.9f)) { this->linkDetected = false; - // this 60 unit height check is so the player doesnt get caught when on the upper path + // this 60 unit height check is so the player doesn't get caught when on the upper path if (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 60.0f) { func_80078884(NA_SE_SY_FOUND); // "Discovered!" diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h index 631c71551a..b4f6ea5e7b 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h @@ -18,7 +18,7 @@ typedef struct EnHeishi2 { /* 0x0260 */ Vec3s unk_260; /* 0x0266 */ char unk_266[0x06]; /* 0x026C */ Vec3s unk_26C; // padding inbetween these - /* 0x0274 */ Vec3f unk_274; + /* 0x0274 */ Vec3f unk_274; /* 0x0280 */ Vec3f subCamEye; /* 0x028C */ Vec3f subCamAt; /* 0x0298 */ Vec3f subCamAtInit; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 5f703ff8cb..69149c8e7e 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -3598,7 +3598,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { this->cyl1.base.atFlags &= ~AT_ON; } - if (gSaveContext.entranceIndex != 343 || gSaveContext.sceneLayer != 9) { + if (gSaveContext.entranceIndex != ENTR_SPOT20_0 || gSaveContext.sceneLayer != 9) { if (this->dustFlags & 1) { this->dustFlags &= ~1; func_800287AC(play, &this->frontRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 1476a9e032..e9f5f2f520 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -579,8 +579,8 @@ s32 EnSkj_CollisionCheck(EnSkj* this, PlayState* play) { if (!((this->unk_2D3 == 0) || (D_80B01EA0 != 0) || !(this->collider.base.acFlags & AC_HIT))) { this->collider.base.acFlags &= ~AC_HIT; - if (this->actor.colChkInfo.damageEffect != 0) { - if (this->actor.colChkInfo.damageEffect == 0xF) { + switch (this->actor.colChkInfo.damageEffect) { + case 0xF: effectPos.x = this->collider.info.bumper.hitPos.x; effectPos.y = this->collider.info.bumper.hitPos.y; effectPos.z = this->collider.info.bumper.hitPos.z; @@ -612,11 +612,14 @@ s32 EnSkj_CollisionCheck(EnSkj* this, PlayState* play) { } EnSkj_SetupDie(this); return 1; - } - } else { - this->backflipFlag = 1; - EnSkj_Backflip(this); - return 1; + + case 0: + this->backflipFlag = 1; + EnSkj_Backflip(this); + return 1; + + default: + break; } } return 0; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 98bd3f0480..79c9eee758 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -506,7 +506,7 @@ void EnZo_Dialog(EnZo* this, PlayState* play) { this->unk_194.unk_18 = player->actor.world.pos; if (this->actionFunc == EnZo_Standing) { - // Look down at link if young, look up if old + // Look down at link if child, look up if adult this->unk_194.unk_14 = !LINK_IS_ADULT ? 10.0f : -10.0f; } else { this->unk_194.unk_18.y = this->actor.world.pos.y; diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index 09247455a2..441084b0cc 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -72,9 +72,9 @@ u32 ObjTimeblock_CalculateIsVisible(ObjTimeblock* this) { if (this->unk_177 == 1) { return this->unk_174 ^ temp; } else { - u8 linkIsYoung = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? true : false; + u8 linkIsChild = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? true : false; - return this->unk_174 ^ temp ^ linkIsYoung; + return this->unk_174 ^ temp ^ linkIsChild; } } } else { diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index c9be4f9ff3..f9f103731d 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -346,7 +346,7 @@ void FileSelect_RotateToMain(GameState* thisx) { } } -static void (*gConfigModeUpdateFuncs[])(GameState*) = { +static void (*sConfigModeUpdateFuncs[])(GameState*) = { FileSelect_StartFadeIn, FileSelect_FinishFadeIn, FileSelect_UpdateMainMenu, FileSelect_SetupCopySource, FileSelect_SelectCopySource, FileSelect_SetupCopyDest1, @@ -441,7 +441,7 @@ void FileSelect_PulsateCursor(GameState* thisx) { void FileSelect_ConfigModeUpdate(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; - gConfigModeUpdateFuncs[this->configMode](&this->state); + sConfigModeUpdateFuncs[this->configMode](&this->state); } void FileSelect_SetWindowVtx(GameState* thisx) { @@ -1514,7 +1514,7 @@ void FileSelect_LoadGame(GameState* thisx) { } } -static void (*gSelectModeUpdateFuncs[])(GameState*) = { +static void (*sSelectModeUpdateFuncs[])(GameState*) = { FileSelect_FadeMainToSelect, FileSelect_MoveSelectedFileToTop, FileSelect_FadeInFileInfo, FileSelect_ConfirmFile, FileSelect_FadeOutFileInfo, FileSelect_MoveSelectedFileToSlot, FileSelect_FadeOut, FileSelect_LoadGame, }; @@ -1522,7 +1522,7 @@ static void (*gSelectModeUpdateFuncs[])(GameState*) = { void FileSelect_SelectModeUpdate(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; - gSelectModeUpdateFuncs[this->selectMode](&this->state); + sSelectModeUpdateFuncs[this->selectMode](&this->state); } void FileSelect_SelectModeDraw(GameState* thisx) { @@ -1577,13 +1577,13 @@ void FileSelect_SelectModeDraw(GameState* thisx) { CLOSE_DISPS(this->state.gfxCtx, "../z_file_choose.c", 2834); } -static void (*gFileSelectDrawFuncs[])(GameState*) = { +static void (*sFileSelectDrawFuncs[])(GameState*) = { FileSelect_InitModeDraw, FileSelect_ConfigModeDraw, FileSelect_SelectModeDraw, }; -static void (*gFileSelectUpdateFuncs[])(GameState*) = { +static void (*sFileSelectUpdateFuncs[])(GameState*) = { FileSelect_InitModeUpdate, FileSelect_ConfigModeUpdate, FileSelect_SelectModeUpdate, @@ -1670,8 +1670,8 @@ void FileSelect_Main(GameState* thisx) { this->emptyFileTextAlpha = 0; FileSelect_PulsateCursor(&this->state); - gFileSelectUpdateFuncs[this->menuMode](&this->state); - gFileSelectDrawFuncs[this->menuMode](&this->state); + sFileSelectUpdateFuncs[this->menuMode](&this->state); + sFileSelectDrawFuncs[this->menuMode](&this->state); // do not draw controls text in the options menu if ((this->configMode <= CM_NAME_ENTRY_TO_MAIN) || (this->configMode >= CM_UNUSED_DELAY)) { diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c index e951eddf70..36f385a2ec 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c @@ -734,7 +734,7 @@ typedef struct { /* 0x12 */ u16 height; } OptionsMenuTextureInfo; // size = 0x14 -static OptionsMenuTextureInfo gOptionsMenuHeaders[] = { +static OptionsMenuTextureInfo sOptionsMenuHeaders[] = { { { gFileSelOptionsENGTex, gFileSelOptionsGERTex, gFileSelOptionsENGTex }, { 128, 128, 128 }, @@ -757,7 +757,7 @@ static OptionsMenuTextureInfo gOptionsMenuHeaders[] = { }, }; -static OptionsMenuTextureInfo gOptionsMenuSettings[] = { +static OptionsMenuTextureInfo sOptionsMenuSettings[] = { { { gFileSelStereoENGTex, gFileSelStereoENGTex, gFileSelStereoFRATex }, { 48, 48, 48 }, @@ -890,9 +890,9 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); for (i = 0, vtx = 0; i < 4; i++, vtx += 4) { - gDPLoadTextureBlock(POLY_OPA_DISP++, gOptionsMenuHeaders[i].texture[gSaveContext.language], G_IM_FMT_IA, - G_IM_SIZ_8b, gOptionsMenuHeaders[i].width[gSaveContext.language], - gOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, + gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuHeaders[i].texture[gSaveContext.language], G_IM_FMT_IA, + G_IM_SIZ_8b, sOptionsMenuHeaders[i].width[gSaveContext.language], + sOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0); } @@ -919,9 +919,9 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); } - gDPLoadTextureBlock(POLY_OPA_DISP++, gOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA, - G_IM_SIZ_8b, gOptionsMenuSettings[i].width[gSaveContext.language], - gOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, + gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA, + G_IM_SIZ_8b, sOptionsMenuSettings[i].width[gSaveContext.language], + sOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0); } @@ -943,9 +943,9 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); } - gDPLoadTextureBlock(POLY_OPA_DISP++, gOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA, - G_IM_SIZ_8b, gOptionsMenuSettings[i].width[gSaveContext.language], - gOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, + gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA, + G_IM_SIZ_8b, sOptionsMenuSettings[i].width[gSaveContext.language], + sOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0); }