Decomp ScenarioFlagRestore and ScenarioFlagBackup

This commit is contained in:
slaw-22 2025-12-05 17:50:07 +00:00 committed by slaw-22
parent c8de68261a
commit 0e4a65668b
47 changed files with 250 additions and 314 deletions

View File

@ -333,7 +333,7 @@
.public GetNameString
.public GetNbFloors
.public GetNbFloorsPlusOne
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetStringFromFileVeneer
.public GetTeamMember
.public GetTypeStringId

View File

@ -248,7 +248,7 @@
.public GetNextIqSkill
.public GetPartner
.public GetPartnerMemberIdx
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetPpIncrease
.public GetPressedButtons
.public GetRank

View File

@ -1,6 +1,6 @@
#pragma once
.public _0209DFC8
.public _0209DFE8
.public SCENARIO_FLAG_RESUME_DEBUG_MSG
.public SCENARIO_FLAG_BACKUP_DEBUG_MSG
.public _0209E008
.public _0209E010
.public _0209E011

View File

@ -55,7 +55,7 @@
.public GetNameString
.public GetNbItemsInBag
.public GetPartyMembers
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetRankUpEntry
.public GetSosMailCount
.public GetStringFromFileVeneer
@ -88,7 +88,7 @@
.public sub_02048CB8
.public sub_0204ABB8
.public sub_0204ACDC
.public sub_0204CB2C
.public SetResolvedPerformanceProgressFlag
.public sub_0204CEE0
.public sub_0204DB08
.public sub_020515C4

View File

@ -1,7 +1,7 @@
#pragma once
.public CanLearnIqSkill
.public GetIqGroup
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public IQ_GROUP_SKILLS
.public IQ_SKILL_RESTRICTIONS
.public IqSkillFlagTest

View File

@ -233,7 +233,7 @@
.public GetPartner
.public GetPartnerMemberIdx
.public GetPartyMembers
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetRank
.public GetScenarioBalance
.public GetSecondFormIfValid

View File

@ -64,7 +64,7 @@
.public GetNbPokemonJoined
.public GetNbRecycled
.public GetNbSkyGiftsSent
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetPressedButtons
.public GetReleasedStylus
.public GetSimpleMenuResult__0202AEA4

View File

@ -69,7 +69,7 @@
.public GetNameRaw
.public GetPartner
.public GetPartyMembers
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetPressedButtons
.public GetRank
.public GetReleasedStylus
@ -640,7 +640,7 @@
.public sub_0204AE80
.public sub_0204AEE0
.public sub_0204B3D0
.public sub_0204CB2C
.public SetResolvedPerformanceProgressFlag
.public sub_0204CDE8
.public sub_0204CE48
.public sub_0204D018

View File

@ -97,7 +97,7 @@
.public GetNameWithGender
.public GetNbItemsInBag
.public GetPartner
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetPressedButtons
.public GetRank
.public GetRankupPoints

View File

@ -21,7 +21,7 @@
.public GetGameMode
.public GetMainCharacter1MemberIdx
.public GetPartnerMemberIdx
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetPressedButtons
.public GetSimpleMenuResult__0202B870
.public GetTeamMember

View File

@ -29,7 +29,7 @@
.public GetItemAtIdx
.public GetLearnableIqSkills
.public GetMaxReachedFloor
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetPressedButtons
.public GetScenarioBalance
.public GetSecondFormIfValid

View File

@ -27,7 +27,7 @@
.public GetItemMoveId16
.public GetMoveBasePower
.public GetMoveMaxGinsengBoost
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetWeatherColorTable
.public GINSENG_CHANCE_3
.public GUMMI_BELLY_RESTORE_TABLE

View File

@ -20,7 +20,7 @@
.public GetOutlawLeaderLevel
.public GetOutlawLevel
.public GetOutlawMinionLevel
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetSpecialTargetItem
.public GetTileSafe
.public HandleSir0Translation

View File

@ -8,7 +8,7 @@
.public GetItemCategoryVeneer
.public GetLeader
.public GetMessageLogPreprocessorArgs
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetPlayerGender
.public GetRandomExplorerMazeMonster
.public IsFullFloorFixedRoom

View File

@ -22,7 +22,7 @@
.public GetDungeonMode
.public GetKeyboardStatus
.public GetKeyboardStringResult
.public GetPerformanceFlagWithChecks
.public GetResolvedPerformanceProgressFlag
.public GetSimpleMenuResult__0202AEA4
.public GetWindowIdSelectedItemOnPage
.public InitMenu

View File

@ -20454,7 +20454,7 @@ _02024CAC:
cmp r0, r1
bne _02024CC8
mov r0, #1
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _02024CE8
_02024CC8:

View File

@ -1162,7 +1162,7 @@ _0203D68C:
cmp r0, #0
bne _0203D6B4
mov r0, #0x1e
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _0203D73C
_0203D6B4:
@ -1183,7 +1183,7 @@ _0203D6E4:
cmp r0, #0
beq _0203D73C
mov r0, #0x1d
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _0203D718
ldr r0, _0203E4B0 ; =_020AFE74
@ -1209,7 +1209,7 @@ _0203D73C:
tst r0, #0x10
bne _0203D7C0
mov r0, #0x1f
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _0203D7C0
mov r5, #0
@ -6813,7 +6813,7 @@ GetCheckIqMenuSkillString: ; 0x0204213C
cmp r5, #0x18
bne _02042174
mov r0, #3
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
b _0204217C
_02042174:
mov r1, r5

View File

@ -1,84 +0,0 @@
.include "asm/macros.inc"
.include "main_0204CA94.inc"
.text
arm_func_start GetPerformanceFlagWithChecks
GetPerformanceFlagWithChecks: ; 0x0204CA94
stmdb sp!, {r4, lr}
mov r4, r0
cmp r4, #7
addls pc, pc, r4, lsl #2
b _0204CB10
_0204CAA8: ; jump table
b _0204CAC8 ; case 0
b _0204CB00 ; case 1
b _0204CB00 ; case 2
b _0204CAEC ; case 3
b _0204CAEC ; case 4
b _0204CAEC ; case 5
b _0204CAEC ; case 6
b _0204CAEC ; case 7
_0204CAC8:
mov r0, #0
mov r2, r0
mov r1, #3
bl LoadScriptVariableValueAtIndex
cmp r0, #0x35
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
ldmia sp!, {r4, pc}
_0204CAEC:
bl GetGameMode
cmp r0, #3
bne _0204CB10
mov r0, #0
ldmia sp!, {r4, pc}
_0204CB00:
bl GetGameMode
cmp r0, #3
moveq r0, #1
ldmeqia sp!, {r4, pc}
_0204CB10:
mov r0, r4, lsl #0x10
mov r2, r0, lsr #0x10
mov r0, #0
mov r1, #0x4e
bl LoadScriptVariableValueAtIndex
and r0, r0, #0xff
ldmia sp!, {r4, pc}
arm_func_end GetPerformanceFlagWithChecks
arm_func_start sub_0204CB2C
sub_0204CB2C: ; 0x0204CB2C
stmdb sp!, {r3, r4, r5, lr}
mov r5, r0
mov r4, r1
cmp r5, #7
addls pc, pc, r5, lsl #2
b _0204CB70
_0204CB44: ; jump table
b _0204CB70 ; case 0
b _0204CB64 ; case 1
b _0204CB64 ; case 2
b _0204CB64 ; case 3
b _0204CB64 ; case 4
b _0204CB64 ; case 5
b _0204CB64 ; case 6
b _0204CB64 ; case 7
_0204CB64:
bl GetGameMode
cmp r0, #3
ldmeqia sp!, {r3, r4, r5, pc}
_0204CB70:
cmp r4, #0
movne r3, #1
mov r0, r5, lsl #0x10
mov r2, r0, lsr #0x10
moveq r3, #0
mov r0, #0
mov r1, #0x4e
bl SaveScriptVariableValueAtIndex
ldmia sp!, {r3, r4, r5, pc}
arm_func_end sub_0204CB2C

View File

@ -1,124 +1,8 @@
.include "asm/macros.inc"
.include "main_0204CBE8.inc"
.include "main_0204CD88.inc"
.text
arm_func_start sub_0204CBE8
sub_0204CBE8: ; 0x0204CBE8
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr}
bl GetGameMode
cmp r0, #1
ldmlsia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
sub r4, r0, #2
ldr r0, _0204CCB4 ; =_0209DFC8
mov r1, r4
bl Debug_Print0
mov r0, r4, lsl #0x10
mov r2, r0, lsr #0x10
mov r0, #0
mov r1, #0x1a
bl LoadScriptVariableValueAtIndex
mov r3, r0
mov r0, #0
mov r2, r0
mov r1, #2
bl SaveScriptVariableValueAtIndex
add r2, r4, #4
mov r2, r2, lsl #0x10
mov r0, #0
mov r1, #0x1a
mov r2, r2, lsr #0x10
bl LoadScriptVariableValueAtIndex
mov r3, r0
mov r0, #0
mov r1, #2
mov r2, #1
bl SaveScriptVariableValueAtIndex
mov r8, #0
mov sb, r4, lsl #7
mov r7, r8
mov r6, #0x1b
mov r5, r8
mov r4, #0x11
_0204CC74:
mov r2, sb, lsl #0x10
mov r0, r7
mov r1, r6
mov r2, r2, lsr #0x10
bl LoadScriptVariableValueAtIndex
mov r2, r8, lsl #0x10
mov r3, r0
mov r0, r5
mov r1, r4
mov r2, r2, lsr #0x10
bl SaveScriptVariableValueAtIndex
add r8, r8, #1
cmp r8, #0x80
add sb, sb, #1
blt _0204CC74
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
.align 2, 0
_0204CCB4: .word _0209DFC8
arm_func_end sub_0204CBE8
arm_func_start ScenarioFlagBackup
ScenarioFlagBackup: ; 0x0204CCB8
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr}
bl GetGameMode
cmp r0, #1
ldmlsia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
sub r4, r0, #2
ldr r0, _0204CD84 ; =_0209DFE8
mov r1, r4
bl Debug_Print0
mov r0, #0
mov r2, r0
mov r1, #2
bl LoadScriptVariableValueAtIndex
mov r1, r4, lsl #0x10
mov r3, r0
mov r2, r1, lsr #0x10
mov r0, #0
mov r1, #0x1a
bl SaveScriptVariableValueAtIndex
mov r0, #0
mov r1, #2
mov r2, #1
bl LoadScriptVariableValueAtIndex
add r2, r4, #4
mov r2, r2, lsl #0x10
mov r3, r0
mov r0, #0
mov r1, #0x1a
mov r2, r2, lsr #0x10
bl SaveScriptVariableValueAtIndex
mov r8, #0
mov sb, r4, lsl #7
mov r7, r8
mov r6, #0x11
mov r5, r8
mov r4, #0x1b
_0204CD44:
mov r2, r8, lsl #0x10
mov r0, r7
mov r1, r6
mov r2, r2, lsr #0x10
bl LoadScriptVariableValueAtIndex
mov r2, sb, lsl #0x10
mov r3, r0
mov r0, r5
mov r1, r4
mov r2, r2, lsr #0x10
bl SaveScriptVariableValueAtIndex
add r8, r8, #1
cmp r8, #0x80
add sb, sb, #1
blt _0204CD44
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
.align 2, 0
_0204CD84: .word _0209DFE8
arm_func_end ScenarioFlagBackup
arm_func_start InitWorldMapScriptVars
InitWorldMapScriptVars: ; 0x0204CD88
stmdb sp!, {r3, lr}

View File

@ -637,7 +637,7 @@ _0204E63C:
sub_0204E644: ; 0x0204E644
stmdb sp!, {r3, lr}
mov r0, #4
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _0204E69C
bl sub_02048BFC
@ -931,17 +931,17 @@ sub_0204E974: ; 0x0204E974
strb r2, [r1, #4]
mov r0, #7
strb r2, [r1, #0x11]
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
ldr r1, _0204EA4C ; =PENDING_DUNGEON_ID
mov r2, #0
strb r0, [r1, #5]
mov r0, #6
strb r2, [r1, #6]
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
ldr r1, _0204EA4C ; =PENDING_DUNGEON_ID
strb r0, [r1, #8]
mov r0, #1
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
ldr r1, _0204EA4C ; =PENDING_DUNGEON_ID
mov r2, #0
strb r0, [r1, #9]
@ -996,16 +996,16 @@ InitDungeonInit: ; 0x0204EA5C
strneb r0, [r7, #8]
bne _0204EAF0
mov r0, #7
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
strb r0, [r7, #5]
mov r0, #5
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
strb r0, [r7, #6]
mov r0, #6
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
strb r0, [r7, #8]
mov r0, #1
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
_0204EAF0:
strb r0, [r7, #9]
mov r3, #0
@ -1246,7 +1246,7 @@ _0204EE10:
b _0204EF34
_0204EE24:
mov r0, #0x19
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _0204EF34
ldr r2, _0204EFB8 ; =_020A2A00
@ -2182,7 +2182,7 @@ GetGroundNameId: ; 0x0204F958
cmp r4, #6
bne _0204F980
mov r0, #0x1b
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _0204F99C
ldr r0, _0204F9B0 ; =0x000042B9
@ -2191,7 +2191,7 @@ _0204F980:
cmp r4, #0x15
bne _0204F99C
mov r0, #0x1c
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
#ifdef JAPAN
moveq r0, #0x1c4
@ -3075,7 +3075,7 @@ _0205036C:
beq _02050380
mov r0, #0x15
mov r1, #1
bl sub_0204CB2C
bl SetResolvedPerformanceProgressFlag
_02050380:
ldr r3, _020503C8 ; =ADVENTURE_LOG_PTR
mov r0, r4, asr #4
@ -3697,7 +3697,7 @@ GetMainTeamNameWithCheck: ; 0x02050B10
sub sp, sp, #0x40
mov r4, r0
mov r0, #1
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
ldrne r0, _02050B70 ; =TEAM_NAME
ldrneb r0, [r0]
@ -3777,7 +3777,7 @@ GetRankupPoints: ; 0x02050BB8
bl GetRank
mov r4, r0
mov r0, #0x16
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _02050BE4
cmp r4, #0xc
@ -3817,7 +3817,7 @@ sub_02050C10: ; 0x02050C10
add r2, r2, r0
mov r0, #0x16
str r2, [r1, SUB_02050C10_OFFSET]
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _02050C4C
ldr r0, _02050C6C ; =TEAM_NAME
@ -3864,7 +3864,7 @@ _02050CA4:
blo _02050C84
_02050CAC:
mov r0, #0x16
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _02050CC4
cmp r5, #8
@ -3916,7 +3916,7 @@ sub_02050CF8: ; 0x02050CF8
mov r2, #0x20
bl CopyBitsTo
mov r0, #1
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
ldr r1, _02050D78 ; =TEAM_NAME
tst r0, #0xff
#ifdef JAPAN

View File

@ -25,7 +25,7 @@ _02058D28:
cmp r7, #0x18
bne _02058D58
mov r0, #3
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
b _02058D64
_02058D58:
mov r0, r8

View File

@ -871,11 +871,11 @@ _02059B04: .word CopyBitsTo
arm_func_start sub_02059B08
sub_02059B08: ; 0x02059B08
ldr ip, _02059B14 ; =GetPerformanceFlagWithChecks
ldr ip, _02059B14 ; =GetResolvedPerformanceProgressFlag
mov r0, #0xa
bx ip
.align 2, 0
_02059B14: .word GetPerformanceFlagWithChecks
_02059B14: .word GetResolvedPerformanceProgressFlag
arm_func_end sub_02059B08
arm_func_start GetEvolutionPossibilities
@ -1401,7 +1401,7 @@ GetMonsterEvoStatus: ; 0x0205A210
beq _0205A26C
_0205A254:
mov r0, #0xa
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
movne r0, #1
moveq r0, #0
@ -2363,7 +2363,7 @@ _0205AE84:
strb r1, [sb, #0x42]
ldrb r1, [r4, #7]
strb r1, [sb, #0x43]
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
moveq r0, #3
beq _0205AFDC
@ -6456,7 +6456,7 @@ GenerateDailyMissions: ; 0x0205E5D0
bl RandRangeSafe
mov r8, r0
mov r0, #3
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
mov r2, #0
@ -8513,7 +8513,7 @@ _02060034:
cmp r0, #0xc
bne _02060070
mov r0, #9
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _02060060
ldr r0, _02060080 ; =_020A1958
@ -11201,7 +11201,7 @@ _020622E8:
cmp r0, #0
beq _02062324
mov r0, fp
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _0206233C
_02062324:
@ -11244,7 +11244,7 @@ _02062380:
cmp r0, #0
beq _020623BC
mov r0, fp
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _020623D4
_020623BC:
@ -11287,7 +11287,7 @@ _02062418:
cmp r0, #0
beq _02062454
mov r0, fp
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _0206246C
_02062454:
@ -11330,7 +11330,7 @@ _020624B0:
cmp r0, #0
beq _020624EC
mov r0, fp
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _02062504
_020624EC:
@ -11428,7 +11428,7 @@ _02062618:
cmp r0, #2
bne _02062638
mov r0, #6
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
moveq r0, #0
beq _02062754
@ -11448,7 +11448,7 @@ _02062660:
cmp r0, #2
bne _02062750
mov r0, #9
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _02062750
mov r0, #0
@ -11815,7 +11815,7 @@ IsMonsterMissionAllowedStory: ; 0x02062AE4
stmdb sp!, {r4, lr}
mov r4, r0
mov r0, #9
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _02062B58
mov r2, #0
@ -11903,7 +11903,7 @@ _02062BEC:
cmp r0, #1
bhi _02062C1C
mov r0, #9
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
@ -18227,7 +18227,7 @@ sub_02067C8C: ; 0x02067C8C
cmp r0, #0
beq _02067D7C
mov r0, #0x16
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _02067D7C
_02067D3C:
@ -18475,7 +18475,7 @@ _02068054:
cmp r0, #0
beq _020680D0
mov r0, #0x16
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _020680D0
_02068090:
@ -18557,7 +18557,7 @@ _02068158:
cmp r0, #0
beq _020681B4
mov r0, #0x16
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _020681BC
_020681B4:

View File

@ -866,13 +866,13 @@ SCENARIO_CALC_DEBUG_MSG:
.byte 0x41, 0x52, 0x49, 0x4F, 0x20, 0x43, 0x41, 0x4C, 0x43, 0x20, 0x5B, 0x25, 0x33, 0x64, 0x5D, 0x20
.byte 0x25, 0x34, 0x64, 0x20, 0x25, 0x34, 0x64, 0x20, 0x2D, 0x3E, 0x20, 0x25, 0x34, 0x64, 0x20, 0x25
.byte 0x34, 0x64, 0x00, 0x00
.global _0209DFC8
_0209DFC8:
.global SCENARIO_FLAG_RESUME_DEBUG_MSG
SCENARIO_FLAG_RESUME_DEBUG_MSG:
.byte 0x53, 0x63, 0x65, 0x6E, 0x61, 0x72, 0x69, 0x6F, 0x46, 0x6C, 0x61, 0x67
.byte 0x20, 0x52, 0x65, 0x73, 0x75, 0x6D, 0x65, 0x47, 0x61, 0x6D, 0x65, 0x4D, 0x6F, 0x64, 0x65, 0x20
.byte 0x25, 0x64, 0x0A, 0x00
.global _0209DFE8
_0209DFE8:
.global SCENARIO_FLAG_BACKUP_DEBUG_MSG
SCENARIO_FLAG_BACKUP_DEBUG_MSG:
.byte 0x53, 0x63, 0x65, 0x6E, 0x61, 0x72, 0x69, 0x6F, 0x46, 0x6C, 0x61, 0x67
.byte 0x20, 0x42, 0x61, 0x63, 0x6B, 0x75, 0x70, 0x47, 0x61, 0x6D, 0x65, 0x4D, 0x6F, 0x64, 0x65, 0x20
.byte 0x25, 0x64, 0x0A, 0x00

View File

@ -7826,7 +7826,7 @@ ov01_0232F830: ; 0x0232F830
add r3, sp, #0x54
bl DrawTextInWindow
mov r0, #0x16
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _0232F8F0
ldr r2, _0232F90C ; =0x00000226
@ -9817,7 +9817,7 @@ _02331304:
bl AddMainMenuOption
_0233131C:
mov r0, #4
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _02331338
mov r0, #0xf
@ -9825,7 +9825,7 @@ _0233131C:
bl AddMainMenuOption
_02331338:
mov r0, #3
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _02331354
mov r0, #0x12
@ -9833,7 +9833,7 @@ _02331338:
bl AddMainMenuOption
_02331354:
mov r0, #4
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _02331370
mov r0, #0x11
@ -9841,7 +9841,7 @@ _02331354:
bl AddMainMenuOption
_02331370:
mov r0, #8
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _0233138C
mov r0, #0x13
@ -9849,7 +9849,7 @@ _02331370:
bl AddMainMenuOption
_0233138C:
mov r0, #0x1a
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _023313A8
mov r0, #0x14
@ -9857,7 +9857,7 @@ _0233138C:
bl AddSubMenuOption
_023313A8:
mov r0, #1
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
mov r1, r0
mov r0, #8
bl AddSubMenuOption
@ -12375,7 +12375,7 @@ _02333534:
mvn r4, #1
_02333580:
ldr r0, [r6, r7, lsl #2]
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _023335B4
mov r0, r7

View File

@ -3266,7 +3266,7 @@ _022DEEDC: ; 0x022DEEDC
mov r1, r0
mov r0, r4
and r1, r1, #0xff
bl sub_0204CB2C
bl SetResolvedPerformanceProgressFlag
b _022E2474
_022DEF04: ; 0x022DEF04
mov r1, #0x27
@ -3534,7 +3534,7 @@ _022DF2D0:
bl ScriptParamToInt
mov r5, r0
mov r0, r7
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r5, r0
ldreqh r0, [r6, #4]
ldreq r1, [r4, #0x14]
@ -6511,7 +6511,7 @@ _022E1CF8:
moveq r0, #0x298
beq _022E1D5C
mov r0, #0
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
ldrne r0, _022E2294 ; =0x00000299
bne _022E1D5C
@ -14681,7 +14681,7 @@ _022E8A3C:
streqh r0, [sp, #2]
beq _022E8CD4
mov r0, #0
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
ldrne r0, _022E9218 ; =0x0000029F
strneh r0, [sp, #2]
@ -14727,7 +14727,7 @@ _022E8AE4:
cmpne r4, #3
beq _022E8B94
mov r0, #0
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
ldrne r0, _022E9228 ; =0x000002A5
strneh r0, [sp, #2]
@ -14758,7 +14758,7 @@ _022E8B94:
bl SetDungeonConquest
_022E8BC4:
mov r0, #0
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _022E8CD4
ldr r0, _022E91E8 ; =ov11_02324FA0

View File

@ -20495,7 +20495,7 @@ _022FEFFC:
add r3, sp, #0x54
bl DrawTextInWindow
mov r0, #0x16
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _022FF0AC
add r1, sp, #4

View File

@ -361,7 +361,7 @@ _0238AC1C:
moveq r5, #1
_0238AC28:
mov r0, #0x14
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _0238AC84
bl GetGameMode

View File

@ -1193,7 +1193,7 @@ _0238B178:
cmp r0, #0
bne _0238B204
mov r0, #0x1e
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _0238B204
bl GetRecruitableMonsterAll

View File

@ -1118,7 +1118,7 @@ ApplyGracideaEffect: ; 0x0231D9C0
stmdb sp!, {r3, r4, r5, lr}
mov r0, #0x1a
mov r5, r1
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _0231DA50
mov r0, r5

View File

@ -1625,7 +1625,7 @@ _023433B8:
cmpne r0, #3
beq _02343678
mov r0, #0x17
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
bne _02343678
ldr r1, [sl, #4]

View File

@ -535,7 +535,7 @@ _0234D148:
cmp r0, #0xe2
bne _0234D170
mov r0, #0x1a
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
beq _0234D170
ldrsh r0, [r5, #2]

View File

@ -923,7 +923,7 @@ _0234F7F8:
cmp r3, #8
blt _0234F7F8
mov r0, #0x1d
bl GetPerformanceFlagWithChecks
bl GetResolvedPerformanceProgressFlag
cmp r0, #0
ldreq r4, _0234F9CC ; =ov29_0235343C
beq _0234F840

View File

@ -1,8 +0,0 @@
#ifndef PMDSKY_DUNGEON_RECRUITMENT_3_H
#define PMDSKY_DUNGEON_RECRUITMENT_3_H
#include "util.h"
bool8 HasPlayedOldGame();
#endif //PMDSKY_DUNGEON_RECRUITMENT_3_H

View File

@ -3066,9 +3066,13 @@ enum script_var_id {
// Used to identify a cutscene save in a Special Episode. Acts very similar to
// COMPULSORY_SAVE_POINT.
VAR_COMPULSORY_SAVE_POINT_SIDE = 25,
// The backup version of SCENARIO_SELECT saved in the function ScenarioFlagBackup.
// Backup storage for two SCENARIO_SELECT values per game mode.
// When restoring, values for the current game mode are copied back into SCENARIO_SELECT.
// Layout (grouped by value then mode): Value1: modes 2-5; Value2: modes 2-5.
VAR_SCENARIO_SELECT_BACKUP = 26,
// The backup version of SCENARIO_MAIN_BIT_FLAG saved in the function ScenarioFlagBackup.
// Backup storage for SCENARIO_MAIN_BIT_FLAG each game mode.
// When restoring, values for the current game mode are copied back into SCENARIO_MAIN_BIT_FLAG.
// Layout (grouped by mode then value): Mode 2: 128 bits; Mode 3: 128 bits etc
VAR_SCENARIO_MAIN_BIT_FLAG_BACKUP = 27,
// The Level ID (see the version-dependent script_level_id_* enums) that the player is in in the
// overworld.

View File

@ -0,0 +1,8 @@
#ifndef PMDSKY_HAS_PLAYED_OLD_GAME_H
#define PMDSKY_HAS_PLAYED_OLD_GAME_H
#include "util.h"
bool8 HasPlayedOldGame();
#endif //PMDSKY_HAS_PLAYED_OLD_GAME_H

View File

@ -0,0 +1,9 @@
#ifndef PMDSKY_PERFORMANCE_PROGRESS_H
#define PMDSKY_PERFORMANCE_PROGRESS_H
#include "util.h"
bool8 GetResolvedPerformanceProgressFlag(u32 idx);
void SetResolvedPerformanceProgressFlag(u32 idx, s32 value);
#endif //PMDSKY_PERFORMANCE_PROGRESS_H

7
include/scenario_flag.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef PMDSKY_SCENARIO_FLAG_H
#define PMDSKY_SCENARIO_FLAG_H
void ScenarioFlagRestore();
void ScenarioFlagBackup();
#endif //PMDSKY_SCENARIO_FLAG_H

View File

@ -1,5 +1,5 @@
#ifndef PMDSKY_SCRIPTING_H
#define PMDSKY_SCRIPTING_H
#ifndef PMDSKY_SCRIPT_VARIABLE_H
#define PMDSKY_SCRIPT_VARIABLE_H
#include "enums.h"
#include "util.h"
@ -54,4 +54,4 @@ bool8 RestoreScriptVariableValues(u8* src);
void InitScenarioProgressScriptVars();
void LoadScriptVarValuePair(enum script_var_id script_var_id, s32* val_1, s32* val_2);
#endif //PMDSKY_SCRIPTING_H
#endif //PMDSKY_SCRIPT_VARIABLE_H

View File

@ -15,4 +15,4 @@ void SetSpecialEpisodeOpenOld(u32 idx, u32 val);
bool8 IsSpecialEpisodeBeaten(u32 idx);
void SetSpecialEpisodeBeaten(u32 idx, u32 special_ep_beaten);
#endif //PMDSKY_SCRIPTING_H
#endif //PMDSKY_SPECIAL_EPISODE_H

View File

@ -88,10 +88,11 @@ Static main
Object asm/main_rodata_020A18BC.o
Object src/story_progress.o
Object src/special_episode.o
Object src/dungeon_recruitment_3.o
Object asm/main_0204CA94.o
Object src/has_played_old_game.o
Object src/performance_progress.o
Object src/main_0204CB94.o
Object asm/main_0204CBE8.o
Object src/scenario_flag.o
Object asm/main_0204CD88.o
Object src/main_0204DA2C.o
Object asm/main_0204DB08.o
Object src/main_0204DD80.o

View File

@ -8,11 +8,11 @@
#include "main_02058E68.h"
#include "overlay_29_022FF898.h"
#include "overlay_29_023000E4.h"
#include "performance_progress.h"
#include "pokemon.h"
extern void DisableIqSkill(u32 *iq_skills_flags, enum iq_skill_id iq_id);
extern void EnableIqSkill(u32 *iq_skills_flags, enum iq_skill_id iq_id);
extern bool8 GetPerformanceFlagWithChecks(s32 flag_id);
bool8 CanSeeInvisibleMonsters(struct entity *entity)
{
@ -104,7 +104,7 @@ void UpdateIqSkills(struct monster *monster)
EnableIqSkill(monster->iq_skill_flags.flags, iq_skill);
}
if (GetPerformanceFlagWithChecks(PERFORMANCE_PROGRESS_FLAG_RANDOM_MISSION))
if (GetResolvedPerformanceProgressFlag(PERFORMANCE_PROGRESS_FLAG_RANDOM_MISSION))
{
EnableIqSkill(monster->iq_skill_menu_flags.flags, IQ_ESCAPIST);
EnableIqSkill(monster->iq_skill_flags.flags, IQ_ESCAPIST);

View File

@ -5,7 +5,7 @@
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_recruitment.h"
#include "dungeon_recruitment_2.h"
#include "dungeon_recruitment_3.h"
#include "has_played_old_game.h"
#include "dg_random.h"
#include "dungeon_visibility.h"
#include "enums.h"

View File

@ -1,4 +1,4 @@
#include "dungeon_recruitment_3.h"
#include "has_played_old_game.h"
#include "enums.h"
#include "script_variable.h"
#include "util.h"

View File

@ -2,19 +2,18 @@
#include "item.h"
#include "main_0204CB94.h"
#include "main_020517D4.h"
#include "performance_progress.h"
#include "script_variable.h"
#include "special_episode.h"
extern struct bag_items *BAG_ITEMS_PTR_MIRROR;
extern bool8 GetPerformanceFlagWithChecks(s32 flag_id);
s32 GetCurrentBagCapacity()
{
s32 special_episode_type = GetExecuteSpecialEpisodeType();
if (special_episode_type == EPISODE_NONE)
{
if (GetPerformanceFlagWithChecks(2) == 0)
if (GetResolvedPerformanceProgressFlag(2) == 0)
return 1;
return GetBagCapacity(GetScenarioBalance());

View File

@ -0,0 +1,57 @@
#include "enums.h"
#include "performance_progress.h"
#include "script_variable.h"
extern enum game_mode GetGameMode();
bool8 GetResolvedPerformanceProgressFlag(u32 idx) {
switch (idx) {
case 0:
if (LoadScriptVariableValueAtIndex(0, VAR_SCENARIO_MAIN, 0) == 0x35) {
return TRUE;
} else {
return FALSE;
}
case 3:
case 4:
case 5:
case 6:
case 7:
if (GetGameMode() == GAME_MODE_SPECIAL_EPISODE) {
return FALSE;
}
break;
case 1:
case 2:
if (GetGameMode() == GAME_MODE_SPECIAL_EPISODE) {
return TRUE;
}
break;
}
return LoadScriptVariableValueAtIndex(0, VAR_PERFORMANCE_PROGRESS_LIST, idx);
}
void SetResolvedPerformanceProgressFlag(u32 idx, s32 value) {
switch (idx) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
if (GetGameMode() == GAME_MODE_SPECIAL_EPISODE) {
return;
}
default:
case 0:
s32 new_val;
if (value != 0) {
new_val = 1;
} else {
new_val = 0;
}
SaveScriptVariableValueAtIndex(0, VAR_PERFORMANCE_PROGRESS_LIST, idx, new_val);
return;
}
}

61
src/scenario_flag.c Normal file
View File

@ -0,0 +1,61 @@
#include "debug.h"
#include "enums.h"
#include "scenario_flag.h"
#include "script_variable.h"
extern u32 GetGameMode();
extern u8 SCENARIO_FLAG_RESUME_DEBUG_MSG;
extern u8 SCENARIO_FLAG_BACKUP_DEBUG_MSG;
void ScenarioFlagRestore() {
u32 val;
u32 game_mode = GetGameMode();
if (game_mode <= GAME_MODE_1) {
return;
}
u32 game_mode_adjusted = game_mode - 2;
Debug_Print0(&SCENARIO_FLAG_RESUME_DEBUG_MSG, game_mode_adjusted);
val = LoadScriptVariableValueAtIndex(0, VAR_SCENARIO_SELECT_BACKUP, game_mode_adjusted);
SaveScriptVariableValueAtIndex(0, VAR_SCENARIO_SELECT, 0, val);
val = LoadScriptVariableValueAtIndex(0, VAR_SCENARIO_SELECT_BACKUP, game_mode_adjusted + 4);
SaveScriptVariableValueAtIndex(0, VAR_SCENARIO_SELECT, 1, val);
s32 restore_idx = 0;
s32 backup_idx = game_mode_adjusted << 7;
do {
val = LoadScriptVariableValueAtIndex(0, VAR_SCENARIO_MAIN_BIT_FLAG_BACKUP, backup_idx);
SaveScriptVariableValueAtIndex(0, VAR_SCENARIO_MAIN_BIT_FLAG, restore_idx, val);
backup_idx += 1;
restore_idx += 1;
} while (restore_idx < 128);
}
void ScenarioFlagBackup() {
u32 val;
u32 game_mode = GetGameMode();
if (game_mode <= GAME_MODE_1) {
return;
}
u32 game_mode_adjusted = game_mode - 2;
Debug_Print0(&SCENARIO_FLAG_BACKUP_DEBUG_MSG, game_mode_adjusted);
val = LoadScriptVariableValueAtIndex(0, VAR_SCENARIO_SELECT, 0);
SaveScriptVariableValueAtIndex(0, VAR_SCENARIO_SELECT_BACKUP, game_mode_adjusted, val);
val = LoadScriptVariableValueAtIndex(0, VAR_SCENARIO_SELECT, 1);
SaveScriptVariableValueAtIndex(0, VAR_SCENARIO_SELECT_BACKUP, game_mode_adjusted + 4, val);
s32 source_idx = 0;
s32 backup_idx = game_mode_adjusted << 7;
do {
val = LoadScriptVariableValueAtIndex(0, VAR_SCENARIO_MAIN_BIT_FLAG, source_idx);
SaveScriptVariableValueAtIndex(0, VAR_SCENARIO_MAIN_BIT_FLAG_BACKUP, backup_idx, val);
source_idx += 1;
backup_idx += 1;
} while (source_idx < 128);
}

View File

@ -1,6 +1,9 @@
#include "debug.h"
#include "enums.h"
#include "main_0200224C.h"
#include "main_0200330C.h"
#include "main_0200ECFC.h"
#include "scenario_flag.h"
#include "script_variable.h"
#include "special_episode.h"
#include "story_progress.h"
@ -28,19 +31,14 @@ const struct prog_pos_info EVENT_FLAG_PROG_POS_INFO_COMPARE_SCRIPT_VARIABLES = {
};
extern s32 GetPartyMembers(s32 param1);
extern s32 GetMoneyCarried();
extern s32 GetMoneyStored();
extern s32 GetLanguageType();
extern enum game_mode GetGameMode();
extern s32 GetSpecialEpisodeType();
extern s32 GetNotifyNote();
extern s32 AddMoneyCarried(s32 arg0);
extern s32 SetMoneyCarried(s32 arg0);
extern s32 SetMoneyStored(s32 arg0);
extern s32 SetNotifyNote(s32 arg0);
extern void sub_0204CBE8();
extern void ScenarioFlagBackup();
void MemcpySimple(u8* dest, u8* src, s32 n);
extern void ZinitScriptVariable(u32 param_1, u32 param_2);
void LoadScriptVariableRaw(struct script_var_raw* sv_raw,
@ -514,7 +512,7 @@ void EventFlagResume()
SaveScriptVariableValue(0, VAR_ATTENDANT1_KIND, LoadScriptVariableValueAtIndexInline(VAR_ATTENDANT1_KIND_BACKUP, idx));
SaveScriptVariableValue(0, VAR_ATTENDANT2_KIND, LoadScriptVariableValueAtIndexInline(VAR_ATTENDANT2_KIND_BACKUP, idx));
sub_0204CBE8();
ScenarioFlagRestore();
}
// This inline allows EventFlagBackup to match