Skip to content

Commit

Permalink
Add N64 weird frames and OOB Bombchus cvars (#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
Sirius902 authored Jul 6, 2022
1 parent 537722d commit e8bfa61
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 @@ -1115,6 +1115,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 @@ -35,6 +35,7 @@
#include "Enhancements/cosmetics/CosmeticsEditor.h"
#include "Enhancements/debugconsole.h"
#include "Enhancements/debugger/debugger.h"
#include "Enhancements/n64_weird_frame_data.inc"
#include "soh/frame_interpolation.h"
#include "Utils/BitConverter.h"
#include "variables.h"
Expand Down Expand Up @@ -1417,3 +1418,8 @@ extern "C" int Controller_ShouldRumble(size_t i) {

return 0;
}

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 @@ -87,6 +87,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);
#endif

#endif
6 changes: 6 additions & 0 deletions soh/src/code/z_skelanime.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,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 e8bfa61

Please sign in to comment.