From 37b2fc0745a149d039b0944ce4e35c0bddc6d1e8 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Sat, 6 Jan 2024 01:51:48 +0000 Subject: Make noclip only effect player (#3788) --- soh/src/code/z_bgcheck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_bgcheck.c b/soh/src/code/z_bgcheck.c index 4acc68e55..7c99e7ca2 100644 --- a/soh/src/code/z_bgcheck.c +++ b/soh/src/code/z_bgcheck.c @@ -1902,7 +1902,7 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul s32 bgId2; f32 nx, ny, nz; // unit normal of polygon - if (CVarGetInteger("gNoClip", 0) != 0) { + if (CVarGetInteger("gNoClip", 0) && actor != NULL && actor->id == ACTOR_PLAYER) { return false; } -- cgit v1.2.3 From a0258f0fca8def02c3ea3e723d359b139525c146 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:21:18 -0500 Subject: Add Invert Y-Axis and Apply Right-Stick Aiming to Z-Weapon Aiming (#3304) * Add right-stick aiming to third-person aim * Add Z-aiming CVar and inversion to Z-aiming * Create calculation for rel.right_stick and apply it in Z-aiming * Move option to First-Person section to match shield * Fix max/min aiming heights * Expand min/max + comment * block out vanilla + comments * block vanilla code better * Remove extra space * new documentation formatting * rewrite ==0 and !=0 --- soh/src/code/padmgr.c | 10 +++++++++ soh/src/code/padutils.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) (limited to 'soh/src/code') diff --git a/soh/src/code/padmgr.c b/soh/src/code/padmgr.c index 4735a259c..3315a9fe8 100644 --- a/soh/src/code/padmgr.c +++ b/soh/src/code/padmgr.c @@ -297,6 +297,11 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) { PadUtils_UpdateRelXY(input); input->press.stick_x += (s8)(input->cur.stick_x - input->prev.stick_x); input->press.stick_y += (s8)(input->cur.stick_y - input->prev.stick_y); + // #region SOH [Enhancement] + PadUtils_UpdateRelRXY(input); + input->press.right_stick_x += (s8)(input->cur.right_stick_x - input->prev.right_stick_x); + input->press.right_stick_y += (s8)(input->cur.right_stick_y - input->prev.right_stick_y); + // #endregion } uint8_t rumble = (padMgr->rumbleEnable[0] > 0); @@ -389,6 +394,11 @@ void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 mode) { PadUtils_UpdateRelXY(newInput); newInput->press.stick_x += (s8)(newInput->cur.stick_x - newInput->prev.stick_x); newInput->press.stick_y += (s8)(newInput->cur.stick_y - newInput->prev.stick_y); + // #region SOH [Enhancement] + PadUtils_UpdateRelRXY(newInput); + newInput->press.right_stick_x += (s8)(newInput->cur.right_stick_x - newInput->prev.right_stick_x); + newInput->press.right_stick_y += (s8)(newInput->cur.right_stick_y - newInput->prev.right_stick_y); + // #endregion } ogInput++; newInput++; diff --git a/soh/src/code/padutils.c b/soh/src/code/padutils.c index 6a58b14f6..c4548ae32 100644 --- a/soh/src/code/padutils.c +++ b/soh/src/code/padutils.c @@ -92,3 +92,60 @@ void PadUtils_UpdateRelXY(Input* input) { PadUtils_SetRelXY(input, relX, relY); } + +// #region SOH [Enhancement] +s8 PadUtils_GetCurRX(Input* input) { + return input->cur.right_stick_x; +} + +s8 PadUtils_GetCurRY(Input* input) { + return input->cur.right_stick_y; +} + +void PadUtils_SetRelRXY(Input* input, s32 x, s32 y) { + input->rel.right_stick_x = x; + input->rel.right_stick_y = y; +} + +s8 PadUtils_GetRelRXImpl(Input* input) { + return input->rel.right_stick_x; +} + +s8 PadUtils_GetRelRYImpl(Input* input) { + return input->rel.right_stick_y; +} + +s8 PadUtils_GetRelRX(Input* input) { + return PadUtils_GetRelRXImpl(input); +} + +s8 PadUtils_GetRelRY(Input* input) { + return PadUtils_GetRelRYImpl(input); +} + +void PadUtils_UpdateRelRXY(Input* input) { + s32 curX = PadUtils_GetCurRX(input); + s32 curY = PadUtils_GetCurRY(input); + s32 relX; + s32 relY; + + if (curX > 7) { + relX = (curX < 0x43) ? curX - 7 : 0x43 - 7; + } else if (curX < -7) { + relX = (curX > -0x43) ? curX + 7 : -0x43 + 7; + } else { + relX = 0; + } + + if (curY > 7) { + relY = (curY < 0x43) ? curY - 7 : 0x43 - 7; + + } else if (curY < -7) { + relY = (curY > -0x43) ? curY + 7 : -0x43 + 7; + } else { + relY = 0; + } + + PadUtils_SetRelRXY(input, relX, relY); +} +// #endregion -- cgit v1.2.3 From 31623a93ab300db898c0a1af0c2d08c8994de8f8 Mon Sep 17 00:00:00 2001 From: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Date: Mon, 15 Jan 2024 10:24:57 -0500 Subject: Remove OpenMenu Bar Check (#3817) Having it set to just -6 makes the Glitch Tick stay in the same spot in game. when the F1 menu bar is open. At least on Windows --- soh/src/code/z_parameter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 46a87d649..f9a54eb2c 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -3583,7 +3583,7 @@ void Interface_DrawLineupTick(PlayState* play) { s16 width = 32; s16 height = 32; s16 x = -8 + (SCREEN_WIDTH / 2); - s16 y = CVarGetInteger("gOpenMenuBar", 0) ? -4 : -6; + s16 y = -6; OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gEmptyCDownArrowTex, width, height, x, y, width, height, 2 << 10, 2 << 10); -- cgit v1.2.3 From db02870a05461a09159a6b9e302056211f1ac625 Mon Sep 17 00:00:00 2001 From: inspectredc <78732756+inspectredc@users.noreply.github.com> Date: Mon, 15 Jan 2024 15:30:20 +0000 Subject: Restore Original Scene Command Object List Behaviour (MacReady) (#3827) * Restore Original Scene_CommandObjectList Behaviour * remove some vrom stuff * add some comments --- soh/src/code/z_actor.c | 6 ++++-- soh/src/code/z_scene.c | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 79a3c8ace..dfb3e4407 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -1219,8 +1219,7 @@ void Actor_Init(Actor* actor, PlayState* play) { CollisionCheck_InitInfo(&actor->colChkInfo); actor->floorBgId = BGCHECK_SCENE; ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f); - //if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) - { + if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { //Actor_SetObjectDependency(play, actor); actor->init(actor, play); actor->init = NULL; @@ -3129,6 +3128,9 @@ void Actor_FreeOverlay(ActorDBEntry* dbEntry) { osSyncPrintf(VT_RST); } +// SoH: Flag to check if actors are being spawned from the actor entry list +// This flag is checked against to allow actors which dont have an objectBankIndex in the objectCtx slot/status array to spawn +// An example of what this fixes, is that it allows hookshot to be used as child int gMapLoading = 0; Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, diff --git a/soh/src/code/z_scene.c b/soh/src/code/z_scene.c index 2a0a5d5d7..579e84eda 100644 --- a/soh/src/code/z_scene.c +++ b/soh/src/code/z_scene.c @@ -83,9 +83,10 @@ void Object_UpdateBank(ObjectContext* objectCtx) { RomFile* objectFile; size_t size; - /* + for (i = 0; i < objectCtx->num; i++) { if (status->id < 0) { + /* if (status->dmaRequest.vromAddr == 0) { osCreateMesgQueue(&status->loadQueue, &status->loadMsg, 1); objectFile = &gObjectTable[-status->id]; @@ -96,10 +97,12 @@ void Object_UpdateBank(ObjectContext* objectCtx) { } else if (!osRecvMesg(&status->loadQueue, NULL, OS_MESG_NOBLOCK)) { status->id = -status->id; } + */ + status->id = -status->id; } status++; } - */ + } s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) { -- cgit v1.2.3 From db2ccd95b76031ef8842b515b805ad8232ddf1bd Mon Sep 17 00:00:00 2001 From: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:33:21 +0100 Subject: Add Collision Header XML parser (#3396) * Add Collision Header XML parser * Update CollisionHeaderFactory.cpp * Remove "Num" attributes * Fix crashes Prevent crash when the camera setting is negative Change some IntAttributes to UnsignedAttributes --- soh/src/code/z_camera.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index ed8b9c8f4..2b5281037 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -7933,7 +7933,8 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) { return -5; } - if (setting == CAM_SET_NONE || setting >= CAM_SET_MAX) { + //modified from "==" to "<=" to not crash when "setting" is a negative value + if (setting <= CAM_SET_NONE || setting >= CAM_SET_MAX) { osSyncPrintf(VT_COL(RED, WHITE) "camera: error: illegal camera set (%d) !!!!\n" VT_RST, setting); return -99; } -- cgit v1.2.3 From 1da1b1a2bb5b453a111ea42512d1c9869c0b0541 Mon Sep 17 00:00:00 2001 From: Archez Date: Mon, 15 Jan 2024 10:39:54 -0500 Subject: Tweak: Improve pause menu dungeon map performance (#3773) * add map palettes per pulse to leverage shader caching * use unregister blended with kaleido maps * use Gfx_TextureCacheDelete for KD lava * bump lus * add miss tex clears for KD --- soh/src/code/z_map_exp.c | 1 - 1 file changed, 1 deletion(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index c4db0098b..213ee018d 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -524,7 +524,6 @@ void Map_Init(PlayState* play) { interfaceCtx->unk_25A = -1; interfaceCtx->mapSegment = GAMESTATE_ALLOC_MC(&play->state, 2 * sizeof(char*)); - interfaceCtx->mapSegmentName = GAMESTATE_ALLOC_MC(&play->state, 2 * sizeof(char*)); // "MAP texture initialization scene_data_ID=%d mapSegment=%x" osSyncPrintf("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", play->sceneNum, interfaceCtx->mapSegment, play); -- cgit v1.2.3 From dd5d8088f6b7fcf545459454ae29bd51119c7343 Mon Sep 17 00:00:00 2001 From: inspectredc <78732756+inspectredc@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:31:06 +0000 Subject: Revert actor uncullZone related checks back to match decomp (#3828) --- soh/src/code/z_actor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index dfb3e4407..df9b6c758 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -2860,9 +2860,9 @@ s32 func_800314D4(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3) { if ((arg2->z > -actor->uncullZoneScale) && (arg2->z < (actor->uncullZoneForward + actor->uncullZoneScale))) { var = (arg3 < 1.0f) ? 1.0f : 1.0f / arg3; - if ((((fabsf(arg2->x) - actor->uncullZoneScale) * var) < 2.0f) && - (((arg2->y + actor->uncullZoneDownward) * var) > -2.0f) && - (((arg2->y - actor->uncullZoneScale) * var) < 2.0f)) { + if ((((fabsf(arg2->x) - actor->uncullZoneScale) * var) < 1.0f) && + (((arg2->y + actor->uncullZoneDownward) * var) > -1.0f) && + (((arg2->y - actor->uncullZoneScale) * var) < 1.0f)) { return true; } } -- cgit v1.2.3 From 16ee20c2a8c7ec6bcb7076d4a962a206387acc90 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Thu, 1 Feb 2024 18:26:36 -0700 Subject: Renames Freecam to Free Look. (#3771) Adds helper info for invert, distance, and transition speed options. --- soh/src/code/z_camera.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index a177e29e7..4353d397e 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -7887,7 +7887,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) { } } - // Clear free camera if an action is performed that would move the camera (targeting, first person, talking) + // Clear free look if an action is performed that would move the camera (targeting, first person, talking) if (CVarGetInteger("gFreeCamera", 0) && SetCameraManual(camera) == 1 && ((mode >= CAM_MODE_TARGET && mode <= CAM_MODE_BATTLE) || (mode >= CAM_MODE_FIRSTPERSON && mode <= CAM_MODE_CLIMBZ) || mode == CAM_MODE_HANGZ || -- cgit v1.2.3 From 7ff46ba1a7a720bd71e531943596ab11badecc40 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Thu, 1 Feb 2024 20:38:54 -0500 Subject: Increase Crawl Speed (#3366) * Increase animation speeds, crawl speed, add magic numbers for camera timer, add to menu and presets * Remove extra space, reformat comments * Initialilze CVar at 0, Initialize default timer, set default case for timer, change all CVarGets to 1, reorg logic * Fix remaining CVars + unify logic * block out vanilla code + comments * new documentation formatting * Simplify camera swing fix * Remove redundant multiplication * Update soh/src/code/z_onepointdemo.c reduce code duplication Co-authored-by: Garrett Cox --------- Co-authored-by: Garrett Cox --- soh/src/code/z_onepointdemo.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_onepointdemo.c b/soh/src/code/z_onepointdemo.c index ab62692cc..9489eefcd 100644 --- a/soh/src/code/z_onepointdemo.c +++ b/soh/src/code/z_onepointdemo.c @@ -69,7 +69,13 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor PosRot sp8C; f32 tempRand; Unique9OnePointCs* csInfo = ONEPOINT_CS_INFO(csCam); - + + // #region SOH [Enhancement] + //the default is 90, lower values necessary to prevent camera swing as animation speeds up + s16 camCrawlTemp = CVarGetInteger("gCrawlSpeed", 1); + s16 camCrawlTimer = D_8012042C / camCrawlTemp; + // #endregion + switch (csId) { case 1020: if (timer < 20) { @@ -330,13 +336,26 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor case 9601: Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); - OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120398); + if (CVarGetInteger("gCrawlSpeed", 1) > 1) { + OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, camCrawlTimer, D_80120308, D_80120398); + } else { + OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120398); + } break; case 9602: - Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); - Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); - OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120434); - break; + // #region SOH [Enhancement] + if (CVarGetInteger("gCrawlSpeed", 1) > 1) { + Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); + Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); + OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, camCrawlTimer, D_80120308, D_80120434); + break; + // #endregion + } else { + Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); + Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); + OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120434); + break; + } case 4175: csInfo->keyFrames = D_8012147C; csInfo->keyFrameCnt = 4; -- cgit v1.2.3 From be948339b965d76337bbec66563e7aabbcf489c1 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Thu, 1 Feb 2024 20:52:10 -0500 Subject: Lost Woods Ocarina Game Difficulty Options (#3371) * Menu options, note speed, unlimited playback time * Instant win * Add custom ocarina game cvar to all options and presets * Extra spaces * Add starting note count, ending note count by round, more presets * Block out vanilla code + comments * finish blocking out vanilla code * new documentation formatting * add starting notes to randomizer preset --- soh/src/code/code_800EC960.c | 61 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 12 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index 27de9b2d5..41d2a8ec3 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -2065,16 +2065,40 @@ void func_800EE404(void) { void Audio_OcaMemoryGameStart(u8 minigameRound) { u8 i; + + // #region SOH [Enhancement] + if (CVarGetInteger("gCustomizeOcarinaGame", 0)) { + u8 startingNotes = 3; + u8 roundOneCount = CVarGetInteger("gOcarinaGameRoundOneNotes", 5); + u8 roundTwoCount = CVarGetInteger("gOcarinaGameRoundTwoNotes", 6); + u8 roundThreeCount = CVarGetInteger("gOcarinaGameRoundThreeNotes", 8); + u8 modMinigameNoteCnts[] = { roundOneCount, roundTwoCount, roundThreeCount }; - if (minigameRound > 2) { - minigameRound = 2; - } - sOcaMinigameAppendPos = 0; - sOcaMinigameEndPos = sOcaMinigameNoteCnts[minigameRound]; + startingNotes = CVarGetInteger("gOcarinaGameStartingNotes", 3); + + if (minigameRound > 2) { + minigameRound = 2; + } + + sOcaMinigameAppendPos = 0; + sOcaMinigameEndPos = modMinigameNoteCnts[minigameRound]; - for (i = 0; i < 3; i++) { - Audio_OcaMemoryGameGenNote(); + for (i = 0; i < startingNotes; i++) { + Audio_OcaMemoryGameGenNote(); + } + // #endregion + } else { + if (minigameRound > 2) { + minigameRound = 2; + } + + sOcaMinigameAppendPos = 0; + sOcaMinigameEndPos = sOcaMinigameNoteCnts[minigameRound]; + + for (i = 0; i < 3; i++) { + Audio_OcaMemoryGameGenNote(); + } } } @@ -2093,11 +2117,24 @@ s32 Audio_OcaMemoryGameGenNote(void) { rndNote = sOcarinaNoteValues[(rnd + 1) % 5]; } - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = 0x2D; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].volume = 0x50; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].vibrato = 0; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].tone = 0; + // #region SOH [Enhancement] + if (CVarGetInteger("gCustomizeOcarinaGame", 0)) { + int noteSpeed = 0x2D; + noteSpeed = noteSpeed / CVarGetInteger("gOcarinaGameNoteSpeed", 1); + + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = noteSpeed; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].volume = 0x50; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].vibrato = 0; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].tone = 0; + // #endregion + } else { + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = 0x2D; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].volume = 0x50; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].vibrato = 0; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].tone = 0; + } sOcaMinigameAppendPos++; -- cgit v1.2.3 From 695ab6c6ee2d7df46096679ab440f8cc0817f045 Mon Sep 17 00:00:00 2001 From: Caladius Date: Thu, 1 Feb 2024 20:57:12 -0500 Subject: Hurt Container Mode (#3336) * Each Heart Container or full Heart Piece reduces Links hearts by 1 * Based on Briaguya's suggested Code but modified slightly as some parts were missing. * Static Bool * The episode without Captain Hook's Hook --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> Co-authored-by: Garrett Cox --- soh/src/code/z_message_PAL.c | 9 +++++++-- soh/src/code/z_parameter.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 7bb3803fc..4c661aad7 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -3361,8 +3361,13 @@ void Message_Update(PlayState* play) { } if ((s32)(gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000) { gSaveContext.inventory.questItems ^= 0x40000000; - gSaveContext.healthCapacity += 0x10; - gSaveContext.health += 0x10; + if (!CVarGetInteger("gHurtContainer", 0)) { + gSaveContext.healthCapacity += 0x10; + gSaveContext.health += 0x10; + } else { + gSaveContext.healthCapacity -= 0x10; + gSaveContext.health -= 0x10; + } } if (msgCtx->ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE) { if (sLastPlayedSong == OCARINA_SONG_SARIAS) { diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index f9a54eb2c..6efa962b6 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -2278,8 +2278,13 @@ u8 Item_Give(PlayState* play, u8 item) { gSaveContext.sohStats.heartPieces++; return Return_Item(item, MOD_NONE, ITEM_NONE); } else if (item == ITEM_HEART_CONTAINER) { - gSaveContext.healthCapacity += 0x10; - gSaveContext.health += 0x10; + if (!CVarGetInteger("gHurtContainer", 0)) { + gSaveContext.healthCapacity += 0x10; + gSaveContext.health += 0x10; + } else { + gSaveContext.healthCapacity -= 0x10; + gSaveContext.health -= 0x10; + } gSaveContext.sohStats.heartContainers++; return Return_Item(item, MOD_NONE, ITEM_NONE); } else if (item == ITEM_HEART) { -- cgit v1.2.3 From 2529dc59bd5ab3be95ed7d5530cde90bc48758de Mon Sep 17 00:00:00 2001 From: inspectredc <78732756+inspectredc@users.noreply.github.com> Date: Fri, 2 Feb 2024 01:58:08 +0000 Subject: Increase Door Cull range (#3888) * cullzone * better cvar name * Update soh/src/code/z_actor.c * Update soh/src/code/z_actor.c --------- Co-authored-by: Garrett Cox --- soh/src/code/z_actor.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index df9b6c758..c1dc66e23 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -2860,11 +2860,19 @@ s32 func_800314D4(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3) { if ((arg2->z > -actor->uncullZoneScale) && (arg2->z < (actor->uncullZoneForward + actor->uncullZoneScale))) { var = (arg3 < 1.0f) ? 1.0f : 1.0f / arg3; - if ((((fabsf(arg2->x) - actor->uncullZoneScale) * var) < 1.0f) && - (((arg2->y + actor->uncullZoneDownward) * var) > -1.0f) && - (((arg2->y - actor->uncullZoneScale) * var) < 1.0f)) { + // #region SoH [Widescreen support] + // Doors will cull quite noticeably on wider screens. For these actors the zone is increased + f32 limit = 1.0f; + if (((actor->id == ACTOR_EN_DOOR) || (actor->id == ACTOR_DOOR_SHUTTER)) && CVarGetInteger("gIncreaseDoorUncullZones", 1)) { + limit = 2.0f; + } + + if ((((fabsf(arg2->x) - actor->uncullZoneScale) * var) < limit) && + (((arg2->y + actor->uncullZoneDownward) * var) > -limit) && + (((arg2->y - actor->uncullZoneScale) * var) < limit)) { return true; } + // #endregion } return false; -- cgit v1.2.3 From 775d3e68b7eb8fa1272d081055e8e0266c2c57be Mon Sep 17 00:00:00 2001 From: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Date: Thu, 1 Feb 2024 22:11:49 -0500 Subject: [Graphics] Show Equipment Regardless of Age (#3830) * Hookshot, Hammer, & Boomerang * Added the remainder of equipment and DL Patching for hands * Removed Mirror Shield Patch Messed with the front texture of shield * Child Hylian Shield Cheat Adds a cheat that allows Child Link to hold Hylian Shield as adult. Added to this since it uses the same way to render the shield * Debugging * Adds Scaling to Child Link with Adult Equipment * Fix Merge Conflict Blunders * More cleanup * Added Scaling checkbox and some clean up * Added an || ITEM_NONE * More cleanup and simplification * Accidently added spacer * Replace B_BTN_ITEM * Spacing Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> * Added most sheath functionality * Updated tooltips * removed child hylian shield and tweaked bow/slingshot Made child hylian shield cheat into a separate branch and hooked into existing bow/slingshot enhancement for drawing those * Prefixes * () --------- Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> Co-authored-by: Garrett Cox --- soh/src/code/z_player_lib.c | 111 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 102 insertions(+), 9 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index e20362fd3..3edaaca5b 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -600,13 +600,23 @@ void Player_SetModelsForHoldingShield(Player* this) { if ((CVarGetInteger("gShieldTwoHanded", 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK) || !Player_HoldsTwoHandedWeapon(this)) && !Player_IsChildWithHylianShield(this)) { this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD; - this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][gSaveContext.linkAge]; + if (LINK_IS_CHILD && (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && (this->currentShield == PLAYER_SHIELD_MIRROR)) { + this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][0]; + } else if (LINK_IS_ADULT && (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && (this->currentShield == PLAYER_SHIELD_DEKU)) { + this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][1]; + } else { + this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][gSaveContext.linkAge]; + } if (this->sheathType == PLAYER_MODELTYPE_SHEATH_18) { this->sheathType = PLAYER_MODELTYPE_SHEATH_16; } else if (this->sheathType == PLAYER_MODELTYPE_SHEATH_19) { this->sheathType = PLAYER_MODELTYPE_SHEATH_17; } this->sheathDLists = &sPlayerDListGroups[this->sheathType][gSaveContext.linkAge]; + if ((CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && LINK_IS_CHILD && + gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI) { + this->sheathDLists = &sPlayerDListGroups[this->sheathType][0]; + } this->modelAnimType = PLAYER_ANIMTYPE_2; this->itemAction = -1; } @@ -617,12 +627,40 @@ void Player_SetModels(Player* this, s32 modelGroup) { // Left hand this->leftHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND]; this->leftHandDLists = &sPlayerDListGroups[this->leftHandType][gSaveContext.linkAge]; - + + if (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { + if (LINK_IS_CHILD && + (this->leftHandType == PLAYER_MODELTYPE_LH_HAMMER || + ((this->leftHandType == PLAYER_MODELTYPE_LH_SWORD || this->leftHandType == PLAYER_MODELTYPE_LH_BGS) && + (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)))) { + this->leftHandDLists = &sPlayerDListGroups[this->leftHandType][0]; + } + + if (LINK_IS_ADULT && (this->leftHandType == PLAYER_MODELTYPE_LH_BOOMERANG || + (this->leftHandType == PLAYER_MODELTYPE_LH_SWORD && gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KOKIRI))) { + this->leftHandDLists = &sPlayerDListGroups[this->leftHandType][1]; + } + } + // Right hand this->rightHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND]; this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][gSaveContext.linkAge]; - if (CVarGetInteger("gBowSlingShotAmmoFix", 0) && this->rightHandType == 11) { // If holding Bow/Slingshot + this->rightHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND]; + this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][gSaveContext.linkAge]; + + if (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { + if (LINK_IS_CHILD && + (this->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT || + (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD && this->currentShield == PLAYER_SHIELD_MIRROR))) { + this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][0]; + } + if (LINK_IS_ADULT && + (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD && this->currentShield == PLAYER_SHIELD_DEKU)) { + this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][1]; + } + } + if ((CVarGetInteger("gBowSlingShotAmmoFix", 0) || CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && this->rightHandType == 11) { // If holding Bow/Slingshot this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][Player_HoldsSlingshot(this)]; } @@ -630,6 +668,23 @@ void Player_SetModels(Player* this, s32 modelGroup) { this->sheathType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH]; this->sheathDLists = &sPlayerDListGroups[this->sheathType][gSaveContext.linkAge]; + if (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { + if (LINK_IS_CHILD && + (this->currentShield == PLAYER_SHIELD_HYLIAN || this->currentShield == PLAYER_SHIELD_MIRROR) && + ((gSaveContext.equips.buttonItems[0] == ITEM_SWORD_MASTER) || + (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_BGS))) { + this->sheathDLists = &sPlayerDListGroups[this->sheathType][0]; + } else if (LINK_IS_CHILD && this->currentShield == PLAYER_SHIELD_MIRROR && gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KOKIRI && + this->sheathType == PLAYER_MODELTYPE_SHEATH_18) { + this->sheathDLists = &sPlayerDListGroups[this->sheathType][0]; + } else if (LINK_IS_ADULT && this->currentShield == PLAYER_SHIELD_DEKU) { + this->sheathDLists = &sPlayerDListGroups[this->sheathType][1]; + } else if (LINK_IS_CHILD && this->sheathType == PLAYER_MODELTYPE_SHEATH_17 && + ((gSaveContext.equips.buttonItems[0] == ITEM_SWORD_MASTER) || (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_BGS))) { + this->sheathDLists = &sPlayerDListGroups[this->sheathType][0]; + } + } + // Waist this->waistDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][4]][gSaveContext.linkAge]; @@ -1187,6 +1242,42 @@ void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* p s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Player* this = (Player*)thisx; + + if (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0) && CVarGetInteger("gEnhancements.ScaleAdultEquimentAsChild", 0) && LINK_IS_CHILD) { + if (limbIndex == PLAYER_LIMB_L_HAND) { + if ((gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI && sLeftHandType == PLAYER_MODELTYPE_LH_SWORD) || + (sLeftHandType == PLAYER_MODELTYPE_LH_BGS) || (sLeftHandType == PLAYER_MODELTYPE_LH_HAMMER)) { + Matrix_Scale(0.8, 0.8, 0.8, MTXMODE_APPLY); + } + } + if (limbIndex == PLAYER_LIMB_R_HAND) { + if ((this->currentShield == PLAYER_SHIELD_MIRROR && sRightHandType == PLAYER_MODELTYPE_RH_SHIELD) || + (this->currentShield == PLAYER_SHIELD_HYLIAN && (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_MASTER || + gSaveContext.equips.buttonItems[0] == ITEM_SWORD_BGS)) || (sRightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT) || + (sRightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT && Player_HoldsBow(this))) { + Matrix_Scale(0.8, 0.8, 0.8, MTXMODE_APPLY); + } + } + if (limbIndex == PLAYER_LIMB_SHEATH) { + if ((this->currentShield == PLAYER_SHIELD_MIRROR || + (this->currentShield == PLAYER_SHIELD_HYLIAN && + (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_MASTER || + gSaveContext.equips.buttonItems[0] == ITEM_SWORD_BGS))) && + ((this->sheathType == PLAYER_MODELTYPE_SHEATH_16) || (this->sheathType == PLAYER_MODELTYPE_SHEATH_17) || + (this->sheathType == PLAYER_MODELTYPE_SHEATH_18) || + (this->sheathType == PLAYER_MODELTYPE_SHEATH_19))) { + Matrix_Translate(218, -100, 62, MTXMODE_APPLY); + Matrix_Scale(0.8, 0.8, 0.8, MTXMODE_APPLY); + } + if ((this->currentShield == PLAYER_SHIELD_DEKU && + gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI && + (this->sheathType == PLAYER_MODELTYPE_SHEATH_16 || + this->sheathType == PLAYER_MODELTYPE_SHEATH_17))) { + Matrix_Translate(218, -100, 62, MTXMODE_APPLY); + Matrix_Scale(0.8, 0.8, 0.8, MTXMODE_APPLY); + } + } + } if (limbIndex == PLAYER_LIMB_ROOT) { sLeftHandType = this->leftHandType; @@ -1305,9 +1396,11 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)) { dLists += PLAYER_SHIELD_MAX * 4; } - } else if (!LINK_IS_ADULT && ((this->sheathType == PLAYER_MODELTYPE_SHEATH_16) || (this->sheathType == PLAYER_MODELTYPE_SHEATH_17)) && - (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)) { - dLists = &sSheathWithSwordDLs[PLAYER_SHIELD_MAX * 4]; + } else if (!CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { + if (!LINK_IS_ADULT && ((this->sheathType == PLAYER_MODELTYPE_SHEATH_16) || (this->sheathType == PLAYER_MODELTYPE_SHEATH_17)) && + (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)) { + dLists = &sSheathWithSwordDLs[PLAYER_SHIELD_MAX * 4]; + } } if (dLists[sDListsLodOffset] != NULL) { @@ -1345,7 +1438,7 @@ s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, G *dList = sFirstPersonLeftForearmDLs[gSaveContext.linkAge]; } else if (limbIndex == PLAYER_LIMB_L_HAND) { s32 handOutDlIndex = gSaveContext.linkAge; - if (CVarGetInteger("gBowSlingShotAmmoFix", 0) && LINK_IS_ADULT && Player_HoldsSlingshot(this)) { + if ((CVarGetInteger("gBowSlingShotAmmoFix", 0) || CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && LINK_IS_ADULT && Player_HoldsSlingshot(this)) { handOutDlIndex = 1; } *dList = sFirstPersonLeftHandDLs[handOutDlIndex]; @@ -1355,7 +1448,7 @@ s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, G *dList = sFirstPersonForearmDLs[gSaveContext.linkAge]; } else if (limbIndex == PLAYER_LIMB_R_HAND) { s32 firstPersonWeaponIndex = gSaveContext.linkAge; - if (CVarGetInteger("gBowSlingShotAmmoFix", 0)) { + if (CVarGetInteger("gBowSlingShotAmmoFix", 0) || CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { if (Player_HoldsBow(this)) { firstPersonWeaponIndex = 0; } else if (Player_HoldsSlingshot(this)) { @@ -1755,7 +1848,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve Matrix_Get(&this->shieldMf); } else if ((this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT) || (this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT_2)) { s32 stringModelToUse = gSaveContext.linkAge; - if(CVarGetInteger("gBowSlingShotAmmoFix", 0)){ + if (CVarGetInteger("gBowSlingShotAmmoFix", 0) || CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { stringModelToUse = Player_HoldsSlingshot(this); } BowStringData* stringData = &sBowStringData[stringModelToUse]; -- cgit v1.2.3