Skip to content

Commit

Permalink
Add N64 weird frames and OOB Bombchus cvars (HarbourMasters#602)
Browse files Browse the repository at this point in the history
* Add gN64WeirdFrames and gBombchuOOB cvars

* Rename gBombchuOOB to gBombchusOOB

* Fix pipeline
  • Loading branch information
briaguya committed Jul 7, 2022
1 parent 2658c7a commit 4ab8f8a
Show file tree
Hide file tree
Showing 7 changed files with 682 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libultraship/libultraship/ImGuiImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,10 @@ namespace SohImGui {
Tooltip("Restore the original red blood from NTSC 1.0/1.1. Disable for green blood");
EnhancementCheckbox("Fish while hovering", "gHoverFishing");
Tooltip("Restore a bug from NTSC 1.0 that allows casting the Fishing Rod while using the Hover Boots");
EnhancementCheckbox("N64 Weird Frames", "gN64WeirdFrames");
Tooltip("Restores N64 Weird Frames allowing weirdshots to behave the same as N64");
EnhancementCheckbox("Bombchus out of bounds", "gBombchusOOB");
Tooltip("Allows bombchus to explode out of bounds similar to GameCube and Wii VC");

ImGui::EndMenu();
}
Expand Down
2 changes: 2 additions & 0 deletions soh/soh/Enhancements/bootcommands.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ void BootCommands_Init()
CVar_RegisterS32("gMinimalUI", 0);
CVar_RegisterS32("gRedGanonBlood", 0);
CVar_RegisterS32("gHoverFishing", 0);
CVar_RegisterS32("gN64WeirdFrames", 0);
CVar_RegisterS32("gBombchusOOB", 0);
CVar_RegisterS32("gRumbleEnabled", 0);
CVar_RegisterS32("gUniformLR", 0);
CVar_RegisterS32("gTwoHandedIdle", 0);
Expand Down
658 changes: 658 additions & 0 deletions soh/soh/Enhancements/n64_weird_frame_data.inc

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions soh/soh/OTRGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "Enhancements/debugger/debugger.h"
#include "Enhancements/randomizer/randomizer.h"
#include <soh/Enhancements/randomizer/randomizer_item_tracker.h>
#include "Enhancements/n64_weird_frame_data.inc"
#include "soh/frame_interpolation.h"
#include "Utils/BitConverter.h"
#include "variables.h"
Expand Down Expand Up @@ -1572,3 +1573,8 @@ extern "C" s32 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams,
extern "C" s32 GetRandomizedItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId) {
return OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId);
}

extern "C" void* getN64WeirdFrame(s32 i) {
char* weirdFrameBytes = reinterpret_cast<char*>(n64WeirdFrames);
return &weirdFrameBytes[i + sizeof(n64WeirdFrames)];
}
1 change: 1 addition & 0 deletions soh/soh/OTRGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ int AudioPlayer_GetDesiredBuffered(void);
void AudioPlayer_Play(const uint8_t* buf, uint32_t len);
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
int Controller_ShouldRumble(size_t i);
void* getN64WeirdFrame(s32 i);
Sprite* GetSeedTexture(uint8_t index);
void LoadRandomizerSettings(const char* spoilerFileName);
u8 GetRandoSettingValue(RandomizerSettingKey randoSettingKey);
Expand Down
6 changes: 6 additions & 0 deletions soh/src/code/z_skelanime.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,12 @@ AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, Animat
*/
void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader* animation, s32 frame, s32 limbCount,
Vec3s* frameTable) {
if (CVar_GetS32("gN64WeirdFrames", 0) && frame < 0) {
Vec3s* src = (Vec3s*)getN64WeirdFrame((sizeof(Vec3s) * limbCount + 2) * frame);
memcpy(frameTable, src, sizeof(Vec3s) * limbCount + 2);
return;
}

AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_LOADFRAME);

if (entry != NULL)
Expand Down
5 changes: 5 additions & 0 deletions soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalCo
f32 normDotUp;
MtxF mf;

if (CVar_GetS32("gBombchusOOB", 0) && floorPoly == NULL) {
EnBomChu_Explode(this, globalCtx);
return;
}

this->actor.floorPoly = floorPoly;

normal.x = COLPOLY_GET_NORMAL(floorPoly->normal.x);
Expand Down

0 comments on commit 4ab8f8a

Please sign in to comment.