Make warp surfaces use the force parameter if set (#525)

This commit is contained in:
Reonu
2022-11-03 00:25:24 +01:00
committed by GitHub
parent ab94fd7f63
commit 088dbbdd2b
3 changed files with 16 additions and 11 deletions

View File

@@ -17,6 +17,7 @@
/**
* Allows all surfaces types to have force, (doesn't require setting force, just allows it to be optional).
* Also allows you to pass a warp node to warp floors (SURFACE_WARP, SURFACE_DEATH_PLANE, SURFACE_VERTICAL_WIND) via the second byte of the force parameter.
*/
#define ALL_SURFACES_HAVE_FORCE

View File

@@ -16,7 +16,7 @@ enum SurfaceTypes {
SURFACE_0007, // 0x0007 // Unused
SURFACE_0008, // 0x0008 // Unused
SURFACE_SLOW, // 0x0009 // Slow down Mario, unused
SURFACE_DEATH_PLANE, // 0x000A // Death floor
SURFACE_DEATH_PLANE, // 0x000A // Death floor. Warps to ID of force parameter's second byte if set, otherwise warps to 0xF3 if it exists, otherwise defaults to ID 0xF1.
SURFACE_CLOSE_CAMERA, // 0x000B // Close camera
SURFACE_000C, // 0x000C // unused
SURFACE_WATER, // 0x000D // Water, has no action, used on some waterboxes below
@@ -56,13 +56,13 @@ enum SurfaceTypes {
SURFACE_LOOK_UP_WARP, // 0x002F // Look up and warp (Wing cap entrance)
SURFACE_HARD, // 0x0030 // Hard floor (Always has fall damage)
SURFACE_0031, // 0x0031 // Unused
SURFACE_WARP, // 0x0032 // Surface warp
SURFACE_WARP, // 0x0032 // Surface warp. Warps to ID of force parameter's second byte if set, otherwise defaults to ID 0xF3.
SURFACE_TIMER_START, // 0x0033 // Timer start (Peach's secret slide)
SURFACE_TIMER_END, // 0x0034 // Timer stop (Peach's secret slide)
SURFACE_HARD_SLIPPERY, // 0x0035 // Hard and slippery (Always has fall damage)
SURFACE_HARD_VERY_SLIPPERY, // 0x0036 // Hard and very slippery (Always has fall damage)
SURFACE_HARD_NOT_SLIPPERY, // 0x0037 // Hard and Non-slippery (Always has fall damage)
SURFACE_VERTICAL_WIND, // 0x0038 // Death at bottom with vertical wind
SURFACE_VERTICAL_WIND, // 0x0038 // Death at bottom with vertical wind. Warps to ID of force parameter's second byte if set, otherwise warps to 0xF3 if it exists, otherwise defaults to ID 0xF1.
SURFACE_0039, // 0x0039 // Unused
SURFACE_003A, // 0x003A // Unused
SURFACE_003B, // 0x003B // Unused

View File

@@ -743,17 +743,21 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) {
break;
case WARP_OP_WARP_FLOOR:
sSourceWarpNodeId = WARP_NODE_WARP_FLOOR;
if (area_get_warp_node(sSourceWarpNodeId) == NULL) {
if ((m->floor) && (m->floor->force & 0xFF)) {
sSourceWarpNodeId = m->floor->force & 0xFF;
} else {
sSourceWarpNodeId = WARP_NODE_WARP_FLOOR;
if (area_get_warp_node(sSourceWarpNodeId) == NULL) {
#ifdef ENABLE_LIVES
if (m->numLives == 0) {
sDelayedWarpOp = WARP_OP_GAME_OVER;
} else {
sSourceWarpNodeId = WARP_NODE_DEATH;
}
if (m->numLives == 0) {
sDelayedWarpOp = WARP_OP_GAME_OVER;
} else {
sSourceWarpNodeId = WARP_NODE_DEATH;
}
#else
sSourceWarpNodeId = WARP_NODE_DEATH;
sSourceWarpNodeId = WARP_NODE_DEATH;
#endif
}
}
sDelayedWarpTimer = 20;