mirror of
				https://github.com/coop-deluxe/sm64coopdx.git
				synced 2025-10-30 08:01:01 +00:00 
			
		
		
		
	Fix cap sequences not replaced/playing on dynos warp and level entry; Add gLevelValues.shellSequence
	
		
			
	
		
	
	
		
	
		
			Some checks are pending
		
		
	
	
		
			
				
	
				Build coop / build-linux (push) Waiting to run
				
			
		
			
				
	
				Build coop / build-steamos (push) Waiting to run
				
			
		
			
				
	
				Build coop / build-windows-opengl (push) Waiting to run
				
			
		
			
				
	
				Build coop / build-windows-directx (push) Waiting to run
				
			
		
			
				
	
				Build coop / build-macos-arm (push) Waiting to run
				
			
		
			
				
	
				Build coop / build-macos-intel (push) Waiting to run
				
			
		
		
	
	
				
					
				
			
		
			Some checks are pending
		
		
	
	Build coop / build-linux (push) Waiting to run
				
			Build coop / build-steamos (push) Waiting to run
				
			Build coop / build-windows-opengl (push) Waiting to run
				
			Build coop / build-windows-directx (push) Waiting to run
				
			Build coop / build-macos-arm (push) Waiting to run
				
			Build coop / build-macos-intel (push) Waiting to run
				
			This commit is contained in:
		
							parent
							
								
									6f9c83d3e4
								
							
						
					
					
						commit
						cee5957e11
					
				
					 8 changed files with 24 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -1122,6 +1122,7 @@
 | 
			
		|||
--- @field public wingCapSequence SeqId
 | 
			
		||||
--- @field public metalCapSequence SeqId
 | 
			
		||||
--- @field public vanishCapSequence SeqId
 | 
			
		||||
--- @field public shellSequence SeqId
 | 
			
		||||
--- @field public starPositions StarPositions
 | 
			
		||||
--- @field public cellHeightLimit integer
 | 
			
		||||
--- @field public floorLowerLimit integer
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@ extern "C" {
 | 
			
		|||
#include "audio/external.h"
 | 
			
		||||
#include "engine/surface_collision.h"
 | 
			
		||||
#include "game/mario.h"
 | 
			
		||||
#include "game/hardcoded.h"
 | 
			
		||||
#include "game/ingame_menu.h"
 | 
			
		||||
#include "game/level_update.h"
 | 
			
		||||
#include "game/sound_init.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -249,13 +250,13 @@ static void *DynOS_Warp_UpdateWarp(void *aCmd, bool aIsLevelInitDone) {
 | 
			
		|||
            }
 | 
			
		||||
 | 
			
		||||
            // Set music
 | 
			
		||||
            if (sWarpDest.type != WARP_TYPE_SAME_AREA && sWarpDest.type != WARP_TYPE_NOT_WARPING) {
 | 
			
		||||
            if (sDynosWarpNodeNum == -1 || (sWarpDest.type != WARP_TYPE_SAME_AREA && sWarpDest.type != WARP_TYPE_NOT_WARPING)) {
 | 
			
		||||
                if (gCurrentArea != NULL) {
 | 
			
		||||
                    set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0);
 | 
			
		||||
                }
 | 
			
		||||
                if (gMarioState->flags & MARIO_METAL_CAP)  play_cap_music(SEQUENCE_ARGS(4, SEQ_EVENT_METAL_CAP));
 | 
			
		||||
                if (gMarioState->flags & MARIO_VANISH_CAP) play_cap_music(SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP));
 | 
			
		||||
                if (gMarioState->flags & MARIO_WING_CAP)   play_cap_music(SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP));
 | 
			
		||||
                if (gMarioState->flags & MARIO_METAL_CAP)  play_cap_music(SEQUENCE_ARGS(4, gLevelValues.metalCapSequence));
 | 
			
		||||
                if (gMarioState->flags & MARIO_VANISH_CAP) play_cap_music(SEQUENCE_ARGS(4, gLevelValues.vanishCapSequence));
 | 
			
		||||
                if (gMarioState->flags & MARIO_WING_CAP)   play_cap_music(SEQUENCE_ARGS(4, gLevelValues.wingCapSequence));
 | 
			
		||||
                if (gCurrLevelNum == LEVEL_BOWSER_1 ||
 | 
			
		||||
                    gCurrLevelNum == LEVEL_BOWSER_2 ||
 | 
			
		||||
                    gCurrLevelNum == LEVEL_BOWSER_3) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1730,6 +1730,7 @@
 | 
			
		|||
| wingCapSequence | [enum SeqId](constants.md#enum-SeqId) |  |
 | 
			
		||||
| metalCapSequence | [enum SeqId](constants.md#enum-SeqId) |  |
 | 
			
		||||
| vanishCapSequence | [enum SeqId](constants.md#enum-SeqId) |  |
 | 
			
		||||
| shellSequence | [enum SeqId](constants.md#enum-SeqId) |  |
 | 
			
		||||
| starPositions | [StarPositions](structs.md#StarPositions) | read-only |
 | 
			
		||||
| cellHeightLimit | `integer` |  |
 | 
			
		||||
| floorLowerLimit | `integer` |  |
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -84,6 +84,7 @@ struct LevelValues gDefaultLevelValues = {
 | 
			
		|||
    .wingCapSequence                  = SEQ_EVENT_POWERUP,
 | 
			
		||||
    .metalCapSequence                 = SEQ_EVENT_METAL_CAP,
 | 
			
		||||
    .vanishCapSequence                = SEQ_EVENT_POWERUP,
 | 
			
		||||
    .shellSequence                    = SEQ_EVENT_POWERUP | SEQ_VARIATION,
 | 
			
		||||
    .starPositions = {
 | 
			
		||||
        .KoopaBobStarPos              = {  3030.0f,  4500.0f, -4600.0f },
 | 
			
		||||
        .KoopaThiStarPos              = {  7100.0f, -1300.0f, -6000.0f },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,6 +82,7 @@ struct LevelValues {
 | 
			
		|||
    enum SeqId wingCapSequence;
 | 
			
		||||
    enum SeqId metalCapSequence;
 | 
			
		||||
    enum SeqId vanishCapSequence;
 | 
			
		||||
    enum SeqId shellSequence;
 | 
			
		||||
    struct StarPositions starPositions;
 | 
			
		||||
    s16 cellHeightLimit;
 | 
			
		||||
    s16 floorLowerLimit;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -505,11 +505,15 @@ void init_mario_after_warp(void) {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        if (gMarioState->flags & MARIO_METAL_CAP) {
 | 
			
		||||
            play_cap_music(SEQUENCE_ARGS(4, SEQ_EVENT_METAL_CAP));
 | 
			
		||||
            play_cap_music(SEQUENCE_ARGS(4, gLevelValues.metalCapSequence));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (gMarioState->flags & (MARIO_VANISH_CAP | MARIO_WING_CAP)) {
 | 
			
		||||
            play_cap_music(SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP));
 | 
			
		||||
        if (gMarioState->flags & MARIO_VANISH_CAP) {
 | 
			
		||||
            play_cap_music(SEQUENCE_ARGS(4, gLevelValues.vanishCapSequence));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (gMarioState->flags & MARIO_WING_CAP) {
 | 
			
		||||
            play_cap_music(SEQUENCE_ARGS(4, gLevelValues.wingCapSequence));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#ifndef VERSION_JP
 | 
			
		||||
| 
						 | 
				
			
			@ -713,8 +717,10 @@ s16 music_changed_through_warp(s16 arg) {
 | 
			
		|||
 | 
			
		||||
    if (levelNum == LEVEL_BOB && levelNum == gCurrLevelNum && destArea == gCurrAreaIndex) {
 | 
			
		||||
        sp2C = get_current_background_music();
 | 
			
		||||
        if (sp2C == SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP | SEQ_VARIATION)
 | 
			
		||||
            || sp2C == SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP)) {
 | 
			
		||||
        if (sp2C == SEQUENCE_ARGS(4, gLevelValues.wingCapSequence) ||
 | 
			
		||||
            sp2C == SEQUENCE_ARGS(4, gLevelValues.vanishCapSequence) ||
 | 
			
		||||
            sp2C == SEQUENCE_ARGS(4, gLevelValues.metalCapSequence) ||
 | 
			
		||||
            sp2C == SEQUENCE_ARGS(4, gLevelValues.shellSequence)) {
 | 
			
		||||
            val4 = 0;
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -298,8 +298,8 @@ void play_cutscene_music(u16 seqArgs) {
 | 
			
		|||
 * Called from threads: thread5_game_loop
 | 
			
		||||
 */
 | 
			
		||||
void play_shell_music(void) {
 | 
			
		||||
    play_music(SEQ_PLAYER_LEVEL, SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP | SEQ_VARIATION), 0);
 | 
			
		||||
    sCurrentShellMusic = SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP | SEQ_VARIATION);
 | 
			
		||||
    play_music(SEQ_PLAYER_LEVEL, SEQUENCE_ARGS(4, gLevelValues.shellSequence), 0);
 | 
			
		||||
    sCurrentShellMusic = SEQUENCE_ARGS(4, gLevelValues.shellSequence);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1392,7 +1392,7 @@ static struct LuaObjectField sLakituStateFields[LUA_LAKITU_STATE_FIELD_COUNT] =
 | 
			
		|||
    { "yaw",                              LVT_S16,     offsetof(struct LakituState, yaw),                              false, LOT_NONE,  1,  sizeof(s16)   },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define LUA_LEVEL_VALUES_FIELD_COUNT 55
 | 
			
		||||
#define LUA_LEVEL_VALUES_FIELD_COUNT 56
 | 
			
		||||
static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = {
 | 
			
		||||
    { "bubbleOnDeathBarrierInCapStages",  LVT_U8,      offsetof(struct LevelValues, bubbleOnDeathBarrierInCapStages),  false, LOT_NONE,          1, sizeof(u8)                   },
 | 
			
		||||
    { "ceilNormalMaxY",                   LVT_F32,     offsetof(struct LevelValues, ceilNormalMaxY),                   false, LOT_NONE,          1, sizeof(f32)                  },
 | 
			
		||||
| 
						 | 
				
			
			@ -1433,6 +1433,7 @@ static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] =
 | 
			
		|||
    { "pssSlideStarIndex",                LVT_U8,      offsetof(struct LevelValues, pssSlideStarIndex),                false, LOT_NONE,          1, sizeof(u8)                   },
 | 
			
		||||
    { "pssSlideStarTime",                 LVT_U16,     offsetof(struct LevelValues, pssSlideStarTime),                 false, LOT_NONE,          1, sizeof(u16)                  },
 | 
			
		||||
    { "respawnBlueCoinsSwitch",           LVT_U8,      offsetof(struct LevelValues, respawnBlueCoinsSwitch),           false, LOT_NONE,          1, sizeof(u8)                   },
 | 
			
		||||
    { "shellSequence",                    LVT_S32,     offsetof(struct LevelValues, shellSequence),                    false, LOT_NONE,          1, sizeof(enum SeqId)           },
 | 
			
		||||
    { "showStarNumber",                   LVT_U8,      offsetof(struct LevelValues, showStarNumber),                   false, LOT_NONE,          1, sizeof(u8)                   },
 | 
			
		||||
    { "skipCreditsAt",                    LVT_S32,     offsetof(struct LevelValues, skipCreditsAt),                    false, LOT_NONE,          1, sizeof(enum LevelNum)        },
 | 
			
		||||
    { "starHeal",                         LVT_U8,      offsetof(struct LevelValues, starHeal),                         false, LOT_NONE,          1, sizeof(u8)                   },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue