Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lair/jigsawpicture.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "jigsawpicture.h"
#include "port/Romhack/RomhackConfig.h"
#include "port/Network/Anchor/JigsawPedestal.h"
#include "port/Enhancements/Events/Hooks/Events.h"
extern void player_walkToPosition(f32[3], f32, void(*)(ActorMarker *), ActorMarker *);
extern void func_80324CFC(f32, enum comusic_e, s32);
extern void rand_seed(s32);
Expand Down Expand Up @@ -565,6 +566,7 @@ void updateJigsawPictureActor(Actor *this) {
break;

case 4: //L8038FE28
{ CALL_EVENT(OnJigsawPodiumInput, this->actorTypeSpecificField); }
if ((gcdialog_getCurrentTextId() != 0xF7C) && (gcdialog_getCurrentTextId() != 0xF7D)) {
if (sp7C[FACE_BUTTON(BUTTON_A)] == 1) {
addPieces(this, 5);
Expand Down
20 changes: 18 additions & 2 deletions src/port/Controller/ControlSchemes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include "port/UI/cvar_prefixes.h"
#include "port/Enhancements/Camera/FreeLookCamera.h"
#include "port/Enhancements/Events/Hooks/Events.h"
#include "port/ShipInit.hpp"
#include "port/ShipUtils.h"
#include "ControlSchemes.h"

Expand Down Expand Up @@ -225,6 +227,15 @@ void ControlSchemes_Apply(int scheme) {
}
}

// Frames of C-Down passthrough left for a jigsaw podium.
static int32_t sJigsawPodiumTTL = 0;

void RegisterControlSchemes_Init() {
COND_HOOK(OnJigsawPodiumInput, EVENT_PRIORITY_NORMAL, true, [](IEvent*) { sJigsawPodiumTTL = 4; });
}

static RegisterShipInitFunc initControlSchemes(RegisterControlSchemes_Init);

extern "C" void port_shapeControllerInput(void* contPad) {
auto* pad = static_cast<OSContPad*>(contPad);
if (pad == nullptr) {
Expand Down Expand Up @@ -262,8 +273,13 @@ extern "C" void port_shapeControllerInput(void* contPad) {
int32_t arx = (rx < 0) ? -rx : rx;
int32_t ary = (ry < 0) ? -ry : ry;

const bool onJigsawPodium = (sJigsawPodiumTTL > 0);
if (sJigsawPodiumTTL > 0) {
sJigsawPodiumTTL--;
}

if (modern) {
if (!crouched && !eggPooping) {
if (!crouched && !eggPooping && !onJigsawPodium) {
pad->button &= ~BTN_CDOWN;
}

Expand Down Expand Up @@ -297,7 +313,7 @@ extern "C" void port_shapeControllerInput(void* contPad) {
static uint16_t sLatchDir = 0;
static int32_t sLatchTTL = 0;

if (port_freeLook_isEnabled()) {
if (port_freeLook_isEnabled() && !onJigsawPodium) {
uint16_t stickBits = 0;
if (arx * arx + ary * ary > 24 * 24) {
if (arx >= ary) {
Expand Down
1 change: 1 addition & 0 deletions src/port/Enhancements/Events/Hooks/List/BehaviorEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DEFINE_EVENT(OnGruntyJinjonatorComplete)
DEFINE_EVENT(OnIntroCutsceneCheck, bool* skipIntro;)
DEFINE_EVENT(OnMiscCutscenesCheck, bool* skipMiscCutscenes;)
DEFINE_EVENT(OnTooieJiggyCollect, f32* position;)
DEFINE_EVENT(OnJigsawPodiumInput, s32 podiumId;)
DEFINE_EVENT(OnMumboTokenUpdate, Actor* actor;)
DEFINE_EVENT(OnMumboTokenIdResolve, s32* tokenId; s32 * position; s32 mapId;)
DEFINE_EVENT(OnPlayerAnimChange, AssetID anim_id; f32 duration; AnimControl control; f32 start_position;
Expand Down
1 change: 1 addition & 0 deletions src/port/Enhancements/Events/PortEnhancements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void PortEnhancements_Register() {
REGISTER_EVENT(OnIntroCutsceneCheck);
REGISTER_EVENT(OnMiscCutscenesCheck);
REGISTER_EVENT(OnTooieJiggyCollect);
REGISTER_EVENT(OnJigsawPodiumInput);
REGISTER_EVENT(OnMumboTokenUpdate);
REGISTER_EVENT(OnMumboTokenIdResolve);
REGISTER_EVENT(OnNametagDraw);
Expand Down
Loading