Skip to content

Commit

Permalink
Fix several bugs relating to Respawning
Browse files Browse the repository at this point in the history
- Fixed an issue where RestartArea could change your checkpoint even after leaving the level
- Fixed an issue where Zone Overrides were not working correctly
- Fixed #133
  • Loading branch information
SuperHackio committed Jan 29, 2024
1 parent 97d3ded commit 8886e2c
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Source/ObjectEngine/NPC/NPC_Utility.s
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ mr r4, r30
bl isJMapEntryProgressComplete
b .BranchFunc_Return


.BranchFunc_Case_8:

.BranchFunc_Case_9:
Expand Down Expand Up @@ -1178,6 +1177,7 @@ b .Penguin_RegisterGlobals_Return


.GLE ADDRESS .MINI_COMET_CONNECTOR

#====== PenguinCoach ======
.GLE ADDRESS init__12PenguinCoachFRC12JMapInfoIter +0x18C
#Can't reuse the Bob-omb Buddy 'cause different registers
Expand Down
5 changes: 5 additions & 0 deletions Source/ObjectEngine/RestartArea.s
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ lbz r3, 0x1C(r31)
cmpwi r3, 0
beq .RestartArea_Movement_Return

#WHY DOES THIS NEED TO BE HERE????
bl isScenarioSelecting__2MRFv
cmpwi r3, 0
bne .RestartArea_Movement_Return

bl getPlayerPos__2MRFv
mr r4, r3
mr r3, r31
Expand Down
2 changes: 1 addition & 1 deletion Source/ObjectEngine/SceneChangeArea.s
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ mtlr r0
addi r1, r1, 0x10
blr


.GLE PRINTADDRESS
SceneChangeArea_Movement:
stwu r1, -0x40(r1)
mflr r0
Expand Down
3 changes: 2 additions & 1 deletion Source/ObjectEngine/StaffRollDemoObj.s
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ addi r4, r13, .StaffRollDemoObj_NrvRun_sInstance - STATIC_R13
bl setNerve__9LiveActorFPC5Nerve

mr r3, r31
bl startStarPointerModeEnding__2MRFPv
#bl startStarPointerModeEnding__2MRFPv
nop

lwz r0, 0x14(r1)
lwz r31, 0x0C(r1)
Expand Down
9 changes: 5 additions & 4 deletions Source/SceneEngine/GameScene.s
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ addi r3, r3, AllCompleteMessage@l
li r4, 1
bl .MR_GetGameSetting
cmpwi r3, 0
beq .NoWC24
nop #beq .NoWC24


li r3, 0x98 # WiiMessageBoardEmailSender
bl createSceneObj__2MRFi
Expand Down Expand Up @@ -470,8 +471,8 @@ blr


.requestGalaxyMove_Ex:
bl .GetSceneStartID
bl setRestartMarioNo__2MRFRC10JMapIdInfo
# bl .GetSceneStartID
# bl setRestartMarioNo__2MRFRC10JMapIdInfo
addi r11, r1, 0x20
b .requestGalaxyMove_Ex_Return

Expand Down Expand Up @@ -515,7 +516,7 @@ b .requestGalaxyMove_Ex
.GLE ENDADDRESS

.GLE ADDRESS init__18ScenePlayingResultFv +0x64
bl .GetSceneStartID
#bl .GetSceneStartID
.GLE ENDADDRESS


Expand Down
5 changes: 5 additions & 0 deletions Source/SceneEngine/SavePoints.s
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,9 @@ b GameDataWorldMapStorage_Extension_Return
EntireLevelFlag:
.string "EntireLevelFlag" AUTO

.GLE ENDADDRESS

.GLE ADDRESS isView120StarsEnding__8UserFileCFv
li r3, 1
blr
.GLE ENDADDRESS
40 changes: 34 additions & 6 deletions Source/SceneEngine/SceneUtility.s
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ bl getStageDataHolder__2MRFv
mr r4, r31
bl getStageDataHolderFromZoneId__15StageDataHolderFi

cmpwi r3, 0
beq .StageDataHolder_GetListJMapInfo_Return

addi r4, r3, 0xF8
mr r5, r30
bl findJmpInfoFromArray__15StageDataHolderCFPCQ22MR26AssignableArray<8JMapInfo>PCc
#Returns 0 if BCSV is not found

.StageDataHolder_GetListJMapInfo_Return:
lwz r31, 0x0C(r1)
lwz r30, 0x08(r1)
lwz r0, 0x14(r1)
Expand All @@ -45,7 +48,8 @@ addi r1, r1, 0x10
blr



.GLE PRINTMESSAGE == GLE::RequestMoveStageFromJMapInfo ==
.GLE PRINTADDRESS
#Note for Aurum or someone with symbol map access, address 0x8004C860 is the wrong function. It should be "getValue_Ul___8JMapInfoCFiPCcPl_Cb"
.MR_RequestMoveStageFromJMapInfo:
#Reads a BCSV Entry and warps the player there
Expand Down Expand Up @@ -154,6 +158,8 @@ mtlr r0
addi r1, r1, 0x60
blr

.GLE PRINTMESSAGE == GLE::RequestMoveStage ==
.GLE PRINTADDRESS
.MR_RequestMoveStage:
#Makes the game start the level change process
#r3 = Destination Stage Name
Expand All @@ -174,6 +180,7 @@ mr r30, r4
mr r29, r5
mr r28, r6
mr r24, r8
li r23, 0

#Always check for changing players
mr r3, r7
Expand All @@ -193,9 +200,7 @@ bne .MR_RequestMoveStage_NotScenarioSelect
#specifically to the ScenarioSelect of the galaxy

#2022-02-22: Oh wow you somehow listened before I even put this on github
mr r3, r31
bl requestChangeScenarioSelect__20GameSequenceFunctionFPCc
b .MR_RequestMoveStage_Return
li r23, 1


.MR_RequestMoveStage_NotScenarioSelect:
Expand All @@ -218,6 +223,25 @@ addi r3, r1, 0x0C
mr r4, r28
bl __ct__10JMapIdInfoFll

addi r3, r1, 0x0C
bl setRestartMarioNo__2MRFRC10JMapIdInfo

lwz r3, sInstance__29SingletonHolder_10GameSystem_ - STATIC_R13(r13)
lwz r3, 0x24(r3)
addi r3, r3, 0x8C
lwz r3, 0x88(r3)
addi r4, r1, 0x0C
bl __as__10JMapIdInfoFRC10JMapIdInfo

cmpwi r23, 0
beq .MR_RequestMoveStage_NoPleaseDont

mr r3, r31
bl requestChangeScenarioSelect__20GameSequenceFunctionFPCc
b .MR_RequestMoveStage_Return

.MR_RequestMoveStage_NoPleaseDont:

#Make corrections for hidden/seeker stars
li r23, -1

Expand Down Expand Up @@ -619,6 +643,9 @@ lwz r3, 0x08(r1)

cmpwi r3, -1
bne .CheckNotDefault
#do not save the default if it has already been saved
cmpwi r27, -1
bne .CheckNotDefault
mr r27, r28 #Save the default

.CheckNotDefault:
Expand Down Expand Up @@ -1990,7 +2017,8 @@ nop
.ResetForGameOver:

bl forceCloseSystemWipeFade__2MRFv
bl resetPlayResultInStageHolder__2MRFv
#THIS IS NO LONGER NEEDED due to the Restart Syncing that MoveStage does.
#bl resetPlayResultInStageHolder__2MRFv

lis r3, PlayerLeft_Setting@ha
addi r3, r3, PlayerLeft_Setting@l
Expand Down
1 change: 1 addition & 0 deletions Source/_Symbols_NTSC-J.s
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,5 @@
.set sub_804B4C90, 0x804B4C90
.set sub_8013A180, 0x8013A180
.set hasFaceShipEvent__2MRFv, 0x804D8320
.set cInitializeStartIdInfo__23_unnamed_SceneUtil_cpp_, 0x80727EB0
.GLE REGION END
1 change: 1 addition & 0 deletions Source/_Symbols_NTSC-K.s
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,5 @@
.set sub_804B4C90, 0x804B4D00
.set sub_8013A180, 0x8013A180
.set hasFaceShipEvent__2MRFv, 0x804D83B0
.set cInitializeStartIdInfo__23_unnamed_SceneUtil_cpp_, 0x8073B3F0
.GLE REGION END
4 changes: 1 addition & 3 deletions Source/_Symbols_NTSC-U.s
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,7 @@
.set sub_804B4C90, 0x804B4C90
.set sub_8013A180, 0x8013A180
.set hasFaceShipEvent__2MRFv, 0x804D8320



.set cInitializeStartIdInfo__23_unnamed_SceneUtil_cpp_, 0x807286F0


.GLE REGION END
1 change: 1 addition & 0 deletions Source/_Symbols_NTSC-W.s
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,5 @@
.set sub_804B4C90, 0x804B4D00
.set sub_8013A180, 0x8013A180
.set hasFaceShipEvent__2MRFv, 0x804D83B0
.set cInitializeStartIdInfo__23_unnamed_SceneUtil_cpp_, 0x8073C830
.GLE REGION END
1 change: 1 addition & 0 deletions Source/_Symbols_PAL.s
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,5 @@
.set sub_804B4C90, 0x804B4C90
.set sub_8013A180, 0x8013A180
.set hasFaceShipEvent__2MRFv, 0x804D8320
.set cInitializeStartIdInfo__23_unnamed_SceneUtil_cpp_, 0x8072DDF0
.GLE REGION END

0 comments on commit 8886e2c

Please sign in to comment.