From 8ee9fb2c32e3472376477b9a38c10c18a1618008 Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Sat, 22 Jun 2024 02:14:51 +1000 Subject: [PATCH] make remote players disappear into paintings (#76) --- src/game/level_update.c | 9 +-------- src/game/level_update.h | 5 +++++ src/game/mario.c | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/game/level_update.c b/src/game/level_update.c index 697934e9..14126c98 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -760,11 +760,6 @@ void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3) { sWarpDest.arg = arg3; } -// From Surface 0xD3 to 0xFC -#define PAINTING_WARP_INDEX_START 0x00 // Value greater than or equal to Surface 0xD3 -#define PAINTING_WARP_INDEX_FA 0x2A // THI Huge Painting index left -#define PAINTING_WARP_INDEX_END 0x2D // Value less than Surface 0xFD - /** * Check if Mario is above and close to a painting warp floor, and return the * corresponding warp node. @@ -1220,9 +1215,7 @@ static void start_demo(void) { gChangeLevel = gCurrLevelNum; } - if (sDemoNumber <= 6 && sDemoNumber > -1) { - gCurrDemoInput = NULL; - alloc_anim_dma_table(&gDemo, gDemoInputs, gDemoTargetAnim); + if (sDemoNumber >= 0 && sDemoNumber <= 6) { load_patchable_table(&gDemo, sDemoNumber, false); gCurrDemoInput = ((struct DemoInput *) gDemo.targetAnim); } else { diff --git a/src/game/level_update.h b/src/game/level_update.h index 2f4d16a9..fe37565d 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -74,6 +74,11 @@ #define PRESS_START_DEMO_TIMER 800 +// From Surface 0xD3 to 0xFC +#define PAINTING_WARP_INDEX_START 0x00 // Value greater than or equal to Surface 0xD3 +#define PAINTING_WARP_INDEX_FA 0x2A // THI Huge Painting index left +#define PAINTING_WARP_INDEX_END 0x2D // Value less than Surface 0xFD + struct CreditsEntry { /*0x00*/ u8 levelNum; diff --git a/src/game/mario.c b/src/game/mario.c index 2e49f535..87ce92b8 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -2145,6 +2145,21 @@ s32 execute_mario_action(UNUSED struct Object *o) { gMarioState->marioObj->oInteractStatus = 0; queue_particle_rumble(); + // Make remote players disappear when they enter a painting + // should use same logic as in get_painting_warp_node + if (gMarioState->playerIndex != 0) { + s32 paintingIndex = gMarioState->floor->type - SURFACE_PAINTING_WARP_D3; + if (paintingIndex >= PAINTING_WARP_INDEX_START && paintingIndex < PAINTING_WARP_INDEX_END) { + if (paintingIndex < PAINTING_WARP_INDEX_FA || gMarioState->pos[1] - gMarioState->floorHeight < 80.0f) { + struct WarpNode *warpNode = &gCurrentArea->paintingWarpNodes[paintingIndex]; + if (warpNode->id != 0) { + set_mario_action(gMarioState, ACT_DISAPPEARED, 0); + gMarioState->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; + } + } + } + } + return gMarioState->particleFlags; }