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
3 changes: 2 additions & 1 deletion src/core2/ch/honeycomb.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ void chHoneycomb_update(Actor *this){
if( this->marker->id == MARKER_53_EMPTY_HONEYCOMB){
if(local->uid == 0)
local->uid = (!this->unk44_2)? D_8037DDC0 : func_802C9C40(this);
if( honeycombscore_get(local->uid)
// if( honeycombscore_get(local->uid)
if( EventSystem_Should(VB_COLLECTABLE_ALREADY_HELD, honeycombscore_get(local->uid), this)
|| volatileFlag_get(VOLATILE_FLAG_1)
|| volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME)
){
Expand Down
7 changes: 5 additions & 2 deletions src/core2/ch/jiggy.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ void chjiggy_update(Actor *this) {
local->id = getJiggyId(this);
}

if (jiggyscore_isCollected(local->id)) {
// if (jiggyscore_isCollected(local->id)) {
if (EventSystem_Should(VB_COLLECTABLE_ALREADY_HELD, jiggyscore_isCollected(local->id), this)) {
marker_despawn(this->marker);
} else {
subaddie_set_state(this, JIGGY_STATE_2_IDLE);
Expand Down Expand Up @@ -198,7 +199,9 @@ void chjiggy_update(Actor *this) {
break;

case JIGGY_2F_FP_XMAS_TREE:
if (levelSpecificFlags_get(LEVEL_FLAG_29_FP_XMAS_TREE_COMPLETE)) {
// if (levelSpecificFlags_get(LEVEL_FLAG_29_FP_XMAS_TREE_COMPLETE)) {
if (EventSystem_Should(VB_XMAS_TREE_JIGGY_COLLIDABLE,
levelSpecificFlags_get(LEVEL_FLAG_29_FP_XMAS_TREE_COMPLETE), this)) {
actor_collisionOn(this);
} else {
actor_collisionOff(this);
Expand Down
6 changes: 6 additions & 0 deletions src/core2/gameSelect.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ void setGameInformationZoombox(s32 gamenum){
gczoombox_setStrings(chGameSelectBottomZoombox, 2, (char **)sp20);
gczoombox_maximize(chGameSelectBottomZoombox);
gczoombox_resolve_minimize(chGameSelectBottomZoombox);
CALL_EVENT(OnFileSelectPortrait, gamenum, chGameSelectBottomZoombox);
}

void eraseGame(s32 arg0){
Expand Down Expand Up @@ -356,6 +357,11 @@ void gameSelect_update(Actor *this){
// language changed (it gates on the language generation + the selected slot).
CALL_EVENT(OnFileSelectLanguageRefresh, sp84, sp80);

// [port] Backstop for the swap in setGameInformationZoombox.
if(sp80){
CALL_EVENT(OnFileSelectPortrait, sp84, chGameSelectBottomZoombox);
}

if(!this->initialized){
__spawnQueue_add_1((GenFunction_1)spawnGameSelectProps, (uintptr_t)this->marker);
func_802C7318(this);
Expand Down
6 changes: 6 additions & 0 deletions src/core2/honeycombscore.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ s32 honeycombscore_get_level_total(enum level_e level_id){
s32 s2;
int i;
s32 total;
s32 override_total = 0;

// [port] Listeners can supply the whole per-level tally.
if (!EventSystem_Should(VB_HONEYCOMBSCORE_LEVEL_TOTAL, true, level_id, &override_total)) {
return override_total;
}

if(level_id <= 0 || level_id == LEVEL_6_LAIR || level_id >= 0xC)
return 0;
Expand Down
3 changes: 3 additions & 0 deletions src/port/Enhancements/Events/Hooks/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ typedef enum VBehaviorID {
VB_OVERRIDE_TIMED_DIALOGUE,
VB_UPDATE_JINJO_HUD,
VB_SET_JINJO_COUNT,
VB_COLLECTABLE_ALREADY_HELD,
VB_XMAS_TREE_JIGGY_COLLIDABLE,

// Dialog and localization
VB_RESET_DIALOG_LANGUAGE,
Expand Down Expand Up @@ -97,6 +99,7 @@ typedef enum VBehaviorID {

// Romhack port gates
VB_JIGGYSCORE_LEVEL_TOTAL,
VB_HONEYCOMBSCORE_LEVEL_TOTAL,
VB_PAUSEMENU_LEVEL_TO_PAGE,
VB_PAUSEMENU_SET_NEXT_PAGE,
VB_PAUSEMENU_DRAW_JOYSTICKS,
Expand Down
1 change: 1 addition & 0 deletions src/port/Enhancements/Events/Hooks/List/EngineEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ DEFINE_EVENT(ResolveSpriteHdPath, const void* chunkAddr; const char** path;);
DEFINE_EVENT(OnFileSelectInfoBuild, int32_t gamenum; char* upper; char* lower;);
DEFINE_EVENT(LocalizeFileSelectPrompt, int32_t promptId; void* zoombox;);
DEFINE_EVENT(OnFileSelectLanguageRefresh, int32_t gamenum; int32_t isSelected;);
DEFINE_EVENT(OnFileSelectPortrait, int32_t gamenum; void* zoombox;);
DEFINE_EVENT(LocalizeParade, int32_t paradeId; void** table; uint8_t * count;);
DEFINE_EVENT(ParadeCreditDialogId, int32_t index; int32_t * dialogId;);
DEFINE_EVENT(ResolveBoldFontSlot, int32_t* slot; int32_t * letterId;);
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 @@ -38,6 +38,7 @@ void PortEnhancements_Register() {
// Register localization events
REGISTER_EVENT(LocalizeFileSelectPrompt);
REGISTER_EVENT(OnFileSelectLanguageRefresh);
REGISTER_EVENT(OnFileSelectPortrait);
REGISTER_EVENT(LocalizeParade);
REGISTER_EVENT(ParadeCreditDialogId);
REGISTER_EVENT(ResolveBoldFontSlot);
Expand Down
30 changes: 14 additions & 16 deletions src/port/Enhancements/Gameplay/SkipSMTutorial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,26 @@ constexpr ability_used kSpiralMountainUsedMoves[] = {

void RegisterSkipSMTutorial_Init() {
COND_HOOK(OnNewGame, EVENT_PRIORITY_NORMAL, CVarGetInteger(CVAR_NAME, 0), [](IEvent* event) {
if (port_isRomhack()) {
if (port_isRomhack() || IS_RANDO) {
return;
}
auto* ev = reinterpret_cast<OnNewGame*>(event);

if (!IS_RANDO) {
for (ability_e ability : kSpiralMountainAbilities) {
ability_unlock(ability);
}

for (ability_used move : kSpiralMountainUsedMoves) {
ability_setHasUsed(static_cast<ability_e>(move));
}

for (int honeycomb = HONEYCOMB_13_SM_STUMP; honeycomb <= HONEYCOMB_18_SM_QUARRIES; honeycomb++) {
honeycombscore_set((honeycomb_e)honeycomb, true);
}
func_8034789C();
item_adjustByDiffWithoutHud(ITEM_14_HEALTH,
item_getCount(ITEM_15_HEALTH_TOTAL) - item_getCount(ITEM_14_HEALTH));
for (ability_e ability : kSpiralMountainAbilities) {
ability_unlock(ability);
}

for (ability_used move : kSpiralMountainUsedMoves) {
ability_setHasUsed(static_cast<ability_e>(move));
}

for (int honeycomb = HONEYCOMB_13_SM_STUMP; honeycomb <= HONEYCOMB_18_SM_QUARRIES; honeycomb++) {
honeycombscore_set((honeycomb_e)honeycomb, true);
}
func_8034789C();
item_adjustByDiffWithoutHud(ITEM_14_HEALTH,
item_getCount(ITEM_15_HEALTH_TOTAL) - item_getCount(ITEM_14_HEALTH));

fileProgressFlag_set(FILEPROG_BD_ENTER_LAIR_CUTSCENE, 1);
D_80386000[LEVEL_B_SPIRAL_MOUNTAIN] = 122.0f; // Average speedrun time for SM completion (2:02)

Expand Down
5 changes: 3 additions & 2 deletions src/port/Network/Anchor/Packets/CollectItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "port/UI/Notification.h"

#include "functions.h"
#include "port/ShipUtils.h"

static const char* const kJiggyLevelNames[10] = {
"Mumbo's Mountain", "Treasure Trove Cove", "Clanker's Cavern", "Bubblegloop Swamp", "Freezeezy Peak",
Expand Down Expand Up @@ -44,7 +45,7 @@ void Anchor::HandlePacket_CollectItem(nlohmann::json& payload) {

switch (kind) {
case ANCHOR_COLLECTIBLE_JIGGY:
if (!jiggyscore_isCollected((enum jiggy_e)id)) {
if (!port_jiggyscore_isCollectedRaw((enum jiggy_e)id)) {
jiggyscore_setCollected(id, true);
func_8034798C(); // recompute the current-level jiggy HUD count
if ((s32)map_getLevel((enum map_e)map) == (s32)level_get()) {
Expand Down Expand Up @@ -74,7 +75,7 @@ void Anchor::HandlePacket_CollectItem(nlohmann::json& payload) {
}
break;
case ANCHOR_COLLECTIBLE_HONEYCOMB:
if (!honeycombscore_get((enum honeycomb_e)id)) {
if (!port_honeycombscore_getRaw((enum honeycomb_e)id)) {
honeycombscore_set((enum honeycomb_e)id, 1);
item_inc(ITEM_13_EMPTY_HONEYCOMB);
if (!(item_getCount(ITEM_13_EMPTY_HONEYCOMB) < 6)) {
Expand Down
4 changes: 3 additions & 1 deletion src/port/Network/Anchor/Packets/SpawnHoneycomb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <libultraship/libultraship.h>

#include "functions.h"
#include "port/ShipUtils.h"

extern "C" {
void chHoneycomb_netSpawnDropAt(s32 uid, s32 bundleId, f32 x, f32 y, f32 z);
}
Expand Down Expand Up @@ -34,7 +36,7 @@ void Anchor::HandlePacket_SpawnHoneycomb(nlohmann::json& payload) {
if ((s32)gsworld_getMap() != payload.at("ctx").get<s32>()) {
return;
}
if (honeycombscore_get((enum honeycomb_e)honeycombId)) {
if (port_honeycombscore_getRaw((enum honeycomb_e)honeycombId)) {
return;
}
// Already present locally, nothing to add.
Expand Down
20 changes: 11 additions & 9 deletions src/port/Rando/Logic/GlitchlessLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "port/UI/Notification.h"

extern "C" f32 itemPrintValues[0x2C];
extern "C" s32 D_80385F30[0x2C];

typedef struct {
int32_t actorId;
Expand Down Expand Up @@ -80,9 +81,10 @@ int32_t prevProgressionIndex = -1;
std::vector<RandoCheckId> jinjoCheckIds;

void UpdateSaveDataItemCounts(PlacedItemCounts itemCounts) {
item_adjustByDiffWithoutHud(ITEM_C_NOTE, (itemCounts.noteCount - item_getCount(ITEM_C_NOTE)));
item_adjustByDiffWithoutHud(ITEM_E_JIGGY, (itemCounts.jiggyCount - item_getCount(ITEM_E_JIGGY)));
item_adjustByDiffWithoutHud(ITEM_1C_MUMBO_TOKEN, (itemCounts.mumboTokenCount - item_getCount(ITEM_1C_MUMBO_TOKEN)));
D_80385F30[ITEM_C_NOTE] = itemCounts.noteCount;
D_80385F30[ITEM_E_JIGGY] = itemCounts.jiggyCount;
D_80385F30[ITEM_1C_MUMBO_TOKEN] = itemCounts.mumboTokenCount;
D_80385F30[ITEM_25_MUMBO_TOKEN_TOTAL] = itemCounts.mumboTokenCount;

switch (itemCounts.mumboTokenCount) {
case 5:
Expand Down Expand Up @@ -251,15 +253,15 @@ void ResetSaveData() {
ability_setLearned((ability_e)a, false);
}

for (int f = FILEPROG_90_PAID_TERMITE_COST; f < FILEPROG_94_PAID_BEE_COST; f++) {
for (int f = FILEPROG_90_PAID_TERMITE_COST; f <= FILEPROG_94_PAID_BEE_COST; f++) {
fileProgressFlag_set((file_progress_e)f, 0);
}

item_adjustByDiffWithoutHud(ITEM_C_NOTE, -item_getCount(ITEM_C_NOTE));
item_adjustByDiffWithoutHud(ITEM_E_JIGGY, -item_getCount(ITEM_26_JIGGY_TOTAL));
item_adjustByDiffWithoutHud(ITEM_26_JIGGY_TOTAL, -item_getCount(ITEM_26_JIGGY_TOTAL));
item_adjustByDiffWithoutHud(ITEM_1C_MUMBO_TOKEN, -item_getCount(ITEM_1C_MUMBO_TOKEN));
item_adjustByDiffWithoutHud(ITEM_25_MUMBO_TOKEN_TOTAL, -item_getCount(ITEM_25_MUMBO_TOKEN_TOTAL));
D_80385F30[ITEM_C_NOTE] = 0;
D_80385F30[ITEM_E_JIGGY] = 0;
D_80385F30[ITEM_26_JIGGY_TOTAL] = 0;
D_80385F30[ITEM_1C_MUMBO_TOKEN] = 0;
D_80385F30[ITEM_25_MUMBO_TOKEN_TOTAL] = 0;

itemscore_noteScores_clear();
}
Expand Down
38 changes: 38 additions & 0 deletions src/port/Rando/MiscBehavior/FileSelect.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "MiscBehavior.h"
#include "port/Enhancements/Events/Hooks/Events.h"

#include "save.h"

extern "C" {
#include "core2/gc/zoombox.h"

extern s8 gameFile_GameIdToFileIdMap[4];
void func_803152C4(GcZoombox* self);
}

static void FinishPortraitCrossfade(GcZoombox* zoombox) {
func_803152C4(zoombox);
zoombox->unk1A4_14 = 0;
zoombox->unk1A4_13 = 0;
zoombox->unk17C = 0.0f;
}

void Rando::MiscBehavior::InitFileSelectBehavior() {
REGISTER_LISTENER(OnFileSelectPortrait, EVENT_PRIORITY_NORMAL, [](IEvent* event) {
OnFileSelectPortrait* ev = (OnFileSelectPortrait*)event;

Comment on lines +20 to +23

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is following rando's structure that already exists, but this needs to be converted by registering with ShipInit down the line. Just like the port_ functions, this probably shouldn't block the PR, but noting it here so we have reference later.

if (ev->zoombox == nullptr || ev->gamenum < 0 || ev->gamenum >= 3) {
return;
}

int32_t fileNum = gameFile_GameIdToFileIdMap[ev->gamenum];
bool isRando = fileNum >= 0 && fileNum < 4 && gameFile_saveData[fileNum].magic != 0 &&
gameFile_saveData[fileNum].shipSaveData.fileType == FILE_TYPE_SAVE_RANDO;

// Cheato zoombox sprite for Rando files, otherwise Vanilla
GcZoomboxSprite wanted = isRando ? ZOOMBOX_SPRITE_5B_CHEATO : ZOOMBOX_SPRITE_C_BANJO_2;
if (gczoombox_loadSprite((GcZoombox*)ev->zoombox, wanted)) {
FinishPortraitCrossfade((GcZoombox*)ev->zoombox);
}
})
}
1 change: 1 addition & 0 deletions src/port/Rando/MiscBehavior/MiscBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Entry point for the module, run once on game boot
void Rando::MiscBehavior::Init() {
Rando::MiscBehavior::InitWorldStateBehavior();
Rando::MiscBehavior::InitFileSelectBehavior();
Rando::MiscBehavior::OnFileLoad();
// Rando::MiscBehavior::OnFileSave();
}
1 change: 1 addition & 0 deletions src/port/Rando/MiscBehavior/MiscBehavior.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace MiscBehavior {

void Init();
void InitWorldStateBehavior();
void InitFileSelectBehavior();
void OnFileLoad();
void OnFileSave();

Expand Down
1 change: 0 additions & 1 deletion src/port/Rando/MiscBehavior/OnFileLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ void Rando::MiscBehavior::OnFileLoad() {
Rando::Logic::GenerateShufflePool(saveData);
Rando::Logic::GrantStartingLoadout();
Rando::Logic::GrantFileProgressFlags();
Rando::Logic::GrantSpiralMountainChecks();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are you applying the Spiral Mountain checks with this function removed? I don't see its new workflow to give those checks if SkipSpiralMountain is enabled.

@JeodC JeodC Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SkipSpiralMountain is disabled for rando modes.

  • Skip Spiral Mountain Tutorial disabled under rando (DISABLE_FOR_RANDO); its rando-side grant of 12 SM checks removed. Rationale: under Rando, Spiral Mountain is part of the challenge. Also prevents potential future bugs. Stay away from Tutorial Bottles and Tutorial Bottles can't hurt you.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally don't think it should be disabled since we already know it can work, just needed an iteration. We also shouldn't assume on behalf of the player?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-enable it with v2? When I tested this branch with it still turned on it would grant me all of the vanilla tutorial abilities instead of the checks, and I just didn't feel like chasing it down right now given how much tutorial bottles has bit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non blocking for the PR but this being disabled for Rando will be a blocker for Rando V2 as a whole.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the milestone for v2 is live I'll create an issue to attach to it as a follow-up, then. The whole idea of this was to create less problems for v2 after all.

std::string spoilerName = std::to_string(saveData->shipSaveData.randoSaveData.seedId).c_str();
std::erase(spoilerName, '-');
spoilerName += ".json";
Expand Down
Loading
Loading