fix battle setup conflicts

This commit is contained in:
DizzyEggg 2017-12-17 20:26:13 +01:00
commit 7517f6a030
46 changed files with 1365 additions and 1826 deletions

View File

@ -1,175 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_809E778
sub_809E778: @ 809E778
push {lr}
ldr r0, =0x00000895
bl FlagSet
bl RtcCalcLocalTime
ldr r0, =gSaveBlock2Ptr
ldr r2, [r0]
adds r2, 0xA0
ldr r3, =gLocalTime
ldr r0, [r3]
ldr r1, [r3, 0x4]
str r0, [r2]
str r1, [r2, 0x4]
ldr r0, =0x00004040
ldrh r1, [r3]
bl VarSet
pop {r0}
bx r0
.pool
thumb_func_end sub_809E778
thumb_func_start DoTimeBasedEvents
DoTimeBasedEvents: @ 809E7B0
push {r4,lr}
ldr r0, =0x00000895
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _0809E7DA
bl sub_813B9C0
lsls r0, 24
cmp r0, 0
bne _0809E7DA
bl RtcCalcLocalTime
ldr r4, =gLocalTime
adds r0, r4, 0
bl sub_809E7E8
adds r0, r4, 0
bl sub_809E858
_0809E7DA:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end DoTimeBasedEvents
thumb_func_start sub_809E7E8
sub_809E7E8: @ 809E7E8
push {r4-r6,lr}
adds r5, r0, 0
ldr r0, =0x00004040
bl GetVarPointer
adds r6, r0, 0
ldrh r0, [r6]
movs r2, 0
ldrsh r1, [r5, r2]
cmp r0, r1
beq _0809E84E
cmp r0, r1
bgt _0809E84E
ldrh r4, [r5]
subs r4, r0
lsls r4, 16
lsrs r4, 16
bl ClearUpperFlags
adds r0, r4, 0
bl sub_8122580
adds r0, r4, 0
bl sub_80ED888
adds r0, r4, 0
bl sub_80AEFBC
adds r0, r4, 0
bl UpdatePartyPokerusTime
adds r0, r4, 0
bl sub_8137904
adds r0, r4, 0
bl sub_8137A20
adds r0, r4, 0
bl sub_8139EF4
adds r0, r4, 0
bl sub_813A7F4
adds r0, r4, 0
bl sub_813945C
adds r0, r4, 0
bl SetRandomLotteryNumber
ldrh r0, [r5]
strh r0, [r6]
_0809E84E:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_809E7E8
thumb_func_start sub_809E858
sub_809E858: @ 809E858
push {r4-r6,lr}
sub sp, 0x8
adds r5, r0, 0
mov r4, sp
ldr r6, =gSaveBlock2Ptr
ldr r1, [r6]
adds r1, 0xA0
mov r0, sp
adds r2, r5, 0
bl CalcTimeDifference
mov r0, sp
movs r2, 0
ldrsh r1, [r0, r2]
lsls r0, r1, 1
adds r0, r1
lsls r1, r0, 4
subs r1, r0
lsls r1, 5
movs r2, 0x2
ldrsb r2, [r4, r2]
lsls r0, r2, 4
subs r0, r2
lsls r0, 2
adds r1, r0
movs r0, 0x3
ldrsb r0, [r4, r0]
adds r0, r1, r0
cmp r0, 0
beq _0809E8A8
cmp r0, 0
blt _0809E8A8
bl BerryTreeTimeUpdate
ldr r2, [r6]
adds r2, 0xA0
ldr r0, [r5]
ldr r1, [r5, 0x4]
str r0, [r2]
str r1, [r2, 0x4]
_0809E8A8:
add sp, 0x8
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_809E858
thumb_func_start sub_809E8B4
sub_809E8B4: @ 809E8B4
push {lr}
bl sub_809E778
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
bl SetMainCallback2
pop {r0}
bx r0
.pool
thumb_func_end sub_809E8B4
thumb_func_start Special_StartWallClock
Special_StartWallClock: @ 809E8C8
push {lr}
ldr r0, =Cb2_StartWallClock
bl SetMainCallback2
ldr r1, =gMain
ldr r0, =sub_809E8B4
str r0, [r1, 0x8]
pop {r0}
bx r0
.pool
thumb_func_end Special_StartWallClock
.align 2, 0 @ Don't pad with nop.

View File

@ -79,8 +79,8 @@ _08122522:
.pool
thumb_func_end InitDewfordTrend
thumb_func_start sub_8122580
sub_8122580: @ 8122580
thumb_func_start UpdateDewfordTrendPerDay
UpdateDewfordTrendPerDay: @ 8122580
push {r4-r7,lr}
mov r7, r10
mov r6, r9
@ -253,7 +253,7 @@ _081226BE:
pop {r0}
bx r0
.pool
thumb_func_end sub_8122580
thumb_func_end UpdateDewfordTrendPerDay
thumb_func_start sub_81226D8
sub_81226D8: @ 81226D8

View File

@ -1635,7 +1635,7 @@ _0811AF86:
thumb_func_start sub_811AF8C
sub_811AF8C: @ 811AF8C
push {lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -1684,7 +1684,7 @@ _0811AFE6:
thumb_func_start sub_811AFEC
sub_811AFEC: @ 811AFEC
push {r4,lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -1727,7 +1727,7 @@ _0811B03A:
thumb_func_start sub_811B040
sub_811B040: @ 811B040
push {lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -1832,7 +1832,7 @@ sub_811B0E8: @ 811B0E8
thumb_func_start sub_811B0F8
sub_811B0F8: @ 811B0F8
push {r4,lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0

View File

@ -7777,8 +7777,8 @@ _080AEFB6:
bx r1
thumb_func_end sub_80AEEE8
thumb_func_start sub_80AEFBC
sub_80AEFBC: @ 80AEFBC
thumb_func_start UpdateWeatherPerDay
UpdateWeatherPerDay: @ 80AEFBC
lsls r0, 16
ldr r1, =gSaveBlock1Ptr
ldr r2, [r1]
@ -7794,7 +7794,7 @@ sub_80AEFBC: @ 80AEFBC
strb r1, [r2]
bx lr
.pool
thumb_func_end sub_80AEFBC
thumb_func_end UpdateWeatherPerDay
thumb_func_start sub_80AEFDC
sub_80AEFDC: @ 80AEFDC

View File

@ -353,7 +353,7 @@ _08160994:
b _08160E88
.pool
_081609A8:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -433,7 +433,7 @@ _08160A50:
b _08160E88
.pool
_08160A64:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -493,7 +493,7 @@ _08160ADC:
b _08160E88
.pool
_08160AEC:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -551,7 +551,7 @@ _08160B6C:
b _08160E88
.pool
_08160B80:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0

View File

@ -26142,7 +26142,7 @@ _080170E0:
negs r0, r0
b _08017110
_080170F2:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
movs r2, 0x80
@ -29500,7 +29500,7 @@ _08018BD6:
b _08018C3E
.pool
_08018BE4:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r6, r0, 24
movs r1, 0x80
@ -52112,7 +52112,7 @@ _0802426A:
bl sub_8197930
b _080242D0
_08024270:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r4, r0, 24
movs r0, 0x2
@ -71033,7 +71033,7 @@ _0802DA84:
thumb_func_start sub_802DA8C
sub_802DA8C: @ 802DA8C
push {lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r0, 24
pop {r1}

View File

@ -3025,7 +3025,7 @@ task_new_game_prof_birch_speech_part2_4: @ 8031188
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0

View File

@ -2266,8 +2266,8 @@ sub_8198C34: @ 8198C34
bx r0
thumb_func_end sub_8198C34
thumb_func_start sub_8198C58
sub_8198C58: @ 8198C58
thumb_func_start ProcessMenuInputNoWrap_
ProcessMenuInputNoWrap_: @ 8198C58
push {r4,lr}
bl ProcessMenuInputNoWrapAround
lsls r0, 24
@ -2282,7 +2282,7 @@ _08198C6E:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8198C58
thumb_func_end ProcessMenuInputNoWrap_
thumb_func_start sub_8198C78
sub_8198C78: @ 8198C78

View File

@ -277,7 +277,7 @@ Task_CallYesOrNoCallback: @ 8121FDC
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0

View File

@ -2554,7 +2554,7 @@ sub_81B1708: @ 81B1708
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -4010,7 +4010,7 @@ sub_81B227C: @ 81B227C
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -7952,7 +7952,7 @@ sub_81B43DC: @ 81B43DC
push {r4-r6,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -8485,7 +8485,7 @@ sub_81B48DC: @ 81B48DC
muls r1, r0
ldr r0, =gPlayerParty
adds r4, r1, r0
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -8777,7 +8777,7 @@ sub_81B4BA0: @ 81B4BA0
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -8883,7 +8883,7 @@ sub_81B4C94: @ 81B4C94
push {r7}
lsls r0, 24
lsrs r5, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -9691,7 +9691,7 @@ sub_81B5430: @ 81B5430
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -9985,7 +9985,7 @@ sub_81B56D8: @ 81B56D8
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -12970,7 +12970,7 @@ sub_81B7028: @ 81B7028
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -13272,7 +13272,7 @@ sub_81B72C8: @ 81B72C8
muls r1, r0
ldr r0, =gPlayerParty
adds r4, r1, r0
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r5, r0, 24
cmp r5, 0
@ -15054,7 +15054,7 @@ sub_81B82D4: @ 81B82D4
push {r4-r7,lr}
lsls r0, 24
lsrs r5, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0

View File

@ -1378,7 +1378,7 @@ sub_816B9D8: @ 816B9D8
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r0, 24
movs r1, 0x1

View File

@ -3409,7 +3409,7 @@ _080C8F0C:
adds r0, 0x1
strb r0, [r1]
_080C8F22:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -4133,7 +4133,7 @@ _080C9584:
b _080C9664
.pool
_080C95A4:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -4927,7 +4927,7 @@ _080C9C78:
b _080C9CAA
.pool
_080C9C8C:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -5058,7 +5058,7 @@ _080C9DAC:
b _080C9DE0
.pool
_080C9DC0:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0

View File

@ -4188,6 +4188,8 @@ sp0C8_whiteout_maybe: @ 813787C
.pool
thumb_func_end sp0C8_whiteout_maybe
@ time_events.o
thumb_func_start sub_8137890
sub_8137890: @ 8137890
push {r4,lr}
@ -4244,8 +4246,8 @@ sub_81378E4: @ 81378E4
bx r0
thumb_func_end sub_81378E4
thumb_func_start sub_8137904
sub_8137904: @ 8137904
thumb_func_start UpdateMirageRnd
UpdateMirageRnd: @ 8137904
push {r4,lr}
lsls r0, 16
lsrs r4, r0, 16
@ -4271,7 +4273,7 @@ _08137928:
pop {r0}
bx r0
.pool
thumb_func_end sub_8137904
thumb_func_end UpdateMirageRnd
thumb_func_start sub_813793C
sub_813793C: @ 813793C
@ -4385,8 +4387,8 @@ sub_8137A0C: @ 8137A0C
.pool
thumb_func_end sub_8137A0C
thumb_func_start sub_8137A20
sub_8137A20: @ 8137A20
thumb_func_start UpdateBirchState
UpdateBirchState: @ 8137A20
push {r4,r5,lr}
adds r4, r0, 0
lsls r4, 16
@ -4405,7 +4407,9 @@ sub_8137A20: @ 8137A20
pop {r0}
bx r0
.pool
thumb_func_end sub_8137A20
thumb_func_end UpdateBirchState
@ birch_pc.o
thumb_func_start sub_8137A4C
sub_8137A4C: @ 8137A4C
@ -7605,15 +7609,15 @@ _08139456:
bx r1
thumb_func_end sub_81393FC
thumb_func_start sub_813945C
sub_813945C: @ 813945C
thumb_func_start SetShoalItemFlag
SetShoalItemFlag: @ 813945C
push {lr}
ldr r0, =0x000008bf
bl FlagSet
pop {r0}
bx r0
.pool
thumb_func_end sub_813945C
thumb_func_end SetShoalItemFlag
thumb_func_start sub_813946C
sub_813946C: @ 813946C
@ -8934,8 +8938,8 @@ _08139EEE:
bx r1
thumb_func_end sub_8139ED0
thumb_func_start sub_8139EF4
sub_8139EF4: @ 8139EF4
thumb_func_start UpdateFrontierManiac
UpdateFrontierManiac: @ 8139EF4
push {r4,r5,lr}
adds r4, r0, 0
lsls r4, 16
@ -8954,7 +8958,7 @@ sub_8139EF4: @ 8139EF4
pop {r0}
bx r0
.pool
thumb_func_end sub_8139EF4
thumb_func_end UpdateFrontierManiac
thumb_func_start sub_8139F20
sub_8139F20: @ 8139F20
@ -10002,8 +10006,8 @@ _0813A7C6:
.pool
thumb_func_end sub_813A7B8
thumb_func_start sub_813A7F4
sub_813A7F4: @ 813A7F4
thumb_func_start UpdateFrontierGambler
UpdateFrontierGambler: @ 813A7F4
push {r4,r5,lr}
adds r4, r0, 0
lsls r4, 16
@ -10022,7 +10026,7 @@ sub_813A7F4: @ 813A7F4
pop {r0}
bx r0
.pool
thumb_func_end sub_813A7F4
thumb_func_end UpdateFrontierGambler
thumb_func_start sub_813A820
sub_813A820: @ 813A820

View File

@ -444,7 +444,7 @@ task_yes_no_maybe: @ 80E215C
b _080E21C4
.pool
_080E2180:
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
movs r0, 0x1

View File

@ -1581,7 +1581,7 @@ sub_812B158: @ 812B158
thumb_func_start sub_812B1B0
sub_812B1B0: @ 812B1B0
push {lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0

View File

@ -1121,7 +1121,7 @@ sub_80A00EC: @ 80A00EC
thumb_func_start sub_80A0108
sub_80A0108: @ 80A0108
push {lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -1226,7 +1226,7 @@ sub_80A01D0: @ 80A01D0
thumb_func_start sub_80A01EC
sub_80A01EC: @ 80A01EC
push {lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -1441,7 +1441,7 @@ sub_80A0388: @ 80A0388
thumb_func_start sub_80A03A4
sub_80A03A4: @ 80A03A4
push {lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0

View File

@ -3696,7 +3696,7 @@ _0807920E:
thumb_func_start sub_8079218
sub_8079218: @ 8079218
push {lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
@ -3798,7 +3798,7 @@ _080792D8:
thumb_func_start sub_80792E4
sub_80792E4: @ 80792E4
push {lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0

View File

@ -1240,7 +1240,7 @@ sub_8166D44: @ 8166D44
thumb_func_start sub_8166DE4
sub_8166DE4: @ 8166DE4
push {r4,lr}
bl sub_8198C58
bl ProcessMenuInputNoWrap_
lsls r0, 24
lsrs r4, r0, 24
asrs r1, r0, 24

File diff suppressed because it is too large Load Diff

View File

@ -5,39 +5,6 @@
.section .rodata
gUnknown_085B21D4:: @ 85B21D4
.incbin "baserom.gba", 0x5b21d4, 0x8
gUnknown_085B21DC:: @ 85B21DC
.incbin "baserom.gba", 0x5b21dc, 0x18
gUnknown_085B21F4:: @ 85B21F4
.incbin "baserom.gba", 0x5b21f4, 0x8
gUnknown_085B21FC:: @ 85B21FC
.incbin "baserom.gba", 0x5b21fc, 0xc
gUnknown_085B2208:: @ 85B2208
.incbin "baserom.gba", 0x5b2208, 0x10
gUnknown_085B2218:: @ 85B2218
.incbin "baserom.gba", 0x5b2218, 0x38
gUnknown_085B2250:: @ 85B2250
.incbin "baserom.gba", 0x5b2250, 0x18
gUnknown_085B2268:: @ 85B2268
.incbin "baserom.gba", 0x5b2268, 0x38
gUnknown_085B22A0:: @ 85B22A0
.incbin "baserom.gba", 0x5b22a0, 0x18
gUnknown_085B22B8:: @ 85B22B8
.incbin "baserom.gba", 0x5b22b8, 0x18
gUnknown_085B22D0:: @ 85B22D0
.incbin "baserom.gba", 0x5b22d0, 0x2d0
gPokeblockFlavorCompatibilityTable:: @ 85B25A0
.incbin "baserom.gba", 0x5b25a0, 0x80

View File

@ -17,29 +17,29 @@ BattleFrontier_Lounge2_EventScript_26065F:: @ 826065F
end
BattleFrontier_Lounge2_EventScript_26066D:: @ 826066D
compare_var_to_value VAR_0x402F, 0
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 0
call_if 1, BattleFrontier_Lounge2_EventScript_26070A
compare_var_to_value VAR_0x402F, 1
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 1
call_if 1, BattleFrontier_Lounge2_EventScript_26070F
compare_var_to_value VAR_0x402F, 2
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 2
call_if 1, BattleFrontier_Lounge2_EventScript_260714
compare_var_to_value VAR_0x402F, 3
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 3
call_if 1, BattleFrontier_Lounge2_EventScript_260719
compare_var_to_value VAR_0x402F, 4
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 4
call_if 1, BattleFrontier_Lounge2_EventScript_26071E
compare_var_to_value VAR_0x402F, 5
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 5
call_if 1, BattleFrontier_Lounge2_EventScript_260723
compare_var_to_value VAR_0x402F, 6
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 6
call_if 1, BattleFrontier_Lounge2_EventScript_260728
compare_var_to_value VAR_0x402F, 7
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 7
call_if 1, BattleFrontier_Lounge2_EventScript_26072D
compare_var_to_value VAR_0x402F, 8
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 8
call_if 1, BattleFrontier_Lounge2_EventScript_260732
compare_var_to_value VAR_0x402F, 9
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 9
call_if 1, BattleFrontier_Lounge2_EventScript_260737
compare_var_to_value VAR_0x402F, 3
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 3
call_if 3, BattleFrontier_Lounge2_EventScript_2606F8
compare_var_to_value VAR_0x402F, 4
compare_var_to_value VAR_FRONTIER_MANIAC_FACILITY, 4
call_if 4, BattleFrontier_Lounge2_EventScript_260701
special sub_8139F20
waitmessage

View File

@ -32,7 +32,7 @@ BattleFrontier_Lounge3_EventScript_261DAF:: @ 8261DAF
BattleFrontier_Lounge3_EventScript_261DE9:: @ 8261DE9
multichoice 20, 4, 87, 0
copyvar VAR_0x4032, VAR_RESULT
copyvar VAR_FRONTIER_GAMBLER_AMOUNT_BET, VAR_RESULT
switch VAR_RESULT
case 0, BattleFrontier_Lounge3_EventScript_261E30
case 1, BattleFrontier_Lounge3_EventScript_261E3B
@ -69,7 +69,7 @@ BattleFrontier_Lounge3_EventScript_261E51:: @ 8261E51
BattleFrontier_Lounge3_EventScript_261E75:: @ 8261E75
copyvar VAR_0x8004, VAR_0x8008
special sub_813A9A4
setvar VAR_0x4033, 1
setvar VAR_FRONTIER_GAMBLER_PLACED_BET_F, 1
special sub_813A8FC
playse SE_REGI
msgbox BattleFrontier_Lounge3_Text_262BE0, 4
@ -113,37 +113,37 @@ BattleFrontier_Lounge3_EventScript_261EEB:: @ 8261EEB
BattleFrontier_Lounge3_EventScript_261EF9:: @ 8261EF9
msgbox BattleFrontier_Lounge3_Text_26346B, 4
compare_var_to_value VAR_0x4033, 1
compare_var_to_value VAR_FRONTIER_GAMBLER_PLACED_BET_F, 1
goto_if 4, BattleFrontier_Lounge3_EventScript_261F12
goto BattleFrontier_Lounge3_EventScript_261DAF
end
BattleFrontier_Lounge3_EventScript_261F12:: @ 8261F12
compare_var_to_value VAR_0x4033, 1
compare_var_to_value VAR_FRONTIER_GAMBLER_PLACED_BET_F, 1
goto_eq BattleFrontier_Lounge3_EventScript_261F9E
compare_var_to_value VAR_0x4033, 2
compare_var_to_value VAR_FRONTIER_GAMBLER_PLACED_BET_F, 2
goto_eq BattleFrontier_Lounge3_EventScript_261F2E
goto BattleFrontier_Lounge3_EventScript_261F71
end
BattleFrontier_Lounge3_EventScript_261F2E:: @ 8261F2E
msgbox BattleFrontier_Lounge3_Text_263334, 4
compare_var_to_value VAR_0x4032, 0
compare_var_to_value VAR_FRONTIER_GAMBLER_AMOUNT_BET, 0
call_if 1, BattleFrontier_Lounge3_EventScript_261F80
compare_var_to_value VAR_0x4032, 1
compare_var_to_value VAR_FRONTIER_GAMBLER_AMOUNT_BET, 1
call_if 1, BattleFrontier_Lounge3_EventScript_261F8A
compare_var_to_value VAR_0x4032, 2
compare_var_to_value VAR_FRONTIER_GAMBLER_AMOUNT_BET, 2
call_if 1, BattleFrontier_Lounge3_EventScript_261F94
msgbox BattleFrontier_Lounge3_Text_2633D4, 9
special sub_813A9D0
msgbox BattleFrontier_Lounge3_Text_2633F2, 4
setvar VAR_0x4033, 0
setvar VAR_FRONTIER_GAMBLER_PLACED_BET_F, 0
release
end
BattleFrontier_Lounge3_EventScript_261F71:: @ 8261F71
msgbox BattleFrontier_Lounge3_Text_263298, 4
setvar VAR_0x4033, 0
setvar VAR_FRONTIER_GAMBLER_PLACED_BET_F, 0
release
end

View File

@ -114,7 +114,7 @@ LittlerootTown_BrendansHouse_2F_EventScript_29283F:: @ 829283F
LittlerootTown_BrendansHouse_2F_EventScript_292849:: @ 8292849
fadescreen 1
special Special_StartWallClock
special StartWallClock
waitstate
return

View File

@ -164,7 +164,7 @@ gSpecials:: @ 81DBA64
def_special sub_8138B8C
def_special sub_814FC9C
def_special sub_8085784
def_special Special_StartWallClock
def_special StartWallClock
def_special Special_ViewWallClock
def_special ChooseStarter
def_special StartWallyTutorialBattle

View File

@ -63,5 +63,4 @@ sSpriteTemplate_PokeBall:: @ 85B1F28
.incbin "baserom.gba", 0x5b1f28, 0x18
gUnknown_085B1F40:: @ 85B1F40
.incbin "baserom.gba", 0x5b1f40, 0x294
.incbin "baserom.gba", 0x5b1f40, 0x18

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

View File

@ -0,0 +1,7 @@
JASC-PAL
0100
4
0 0 0
74 180 189
255 255 255
0 0 0

View File

@ -50,11 +50,14 @@
#define VAR_RESET_RTC_ENABLE 0x402C
#define VAR_0x402D 0x402D
#define VAR_0x402E 0x402E
#define VAR_0x402F 0x402F
#define VAR_0x4030 0x4030
#define VAR_0x4031 0x4031
#define VAR_0x4032 0x4032
#define VAR_0x4033 0x4033
#define VAR_FRONTIER_MANIAC_FACILITY 0x402F
#define VAR_FRONTIER_GAMBLER_FACILITY 0x4030
#define VAR_FRONTIER_GAMBLER_SET_FACILITY_F 0x4031
#define VAR_FRONTIER_GAMBLER_AMOUNT_BET 0x4032
#define VAR_FRONTIER_GAMBLER_PLACED_BET_F 0x4033
#define VAR_0x4034 0x4034
#define VAR_0x4035 0x4035
#define VAR_STORAGE_UNKNOWN 0x4036

View File

@ -3,5 +3,6 @@
void InitDewfordTrend(void);
void UpdateDewfordTrendPerDay(u16);
void UpdateDewfordTrendPerDay(u16 days);
#endif // GUARD_DEWFORDTREND_H

View File

@ -9,5 +9,6 @@
void pal_fill_black(void);
bool8 sub_80ABDFC(void);
void sub_80AF168(void);
void UpdateWeatherPerDay(u16 days);
#endif //GUARD_FIELD_SCREEN_H

View File

@ -78,6 +78,81 @@
#define DmaCopy16(dmaNum, src, dest, size) DMA_COPY(dmaNum, src, dest, size, 16)
#define DmaCopy32(dmaNum, src, dest, size) DMA_COPY(dmaNum, src, dest, size, 32)
#define DmaCopyLarge(dmaNum, src, dest, size, block, bit) \
{ \
const void *_src = src; \
void *_dest = dest; \
u32 _size = size; \
while (1) \
{ \
DmaCopy##bit(dmaNum, _src, _dest, (block)); \
_src += (block); \
_dest += (block); \
_size -= (block); \
if (_size <= (block)) \
{ \
DmaCopy##bit(dmaNum, _src, _dest, _size); \
break; \
} \
} \
}
#define DmaCopyLarge16(dmaNum, src, dest, size, block) DmaCopyLarge(dmaNum, src, dest, size, block, 16)
#define DmaCopyLarge32(dmaNum, src, dest, size, block) DmaCopyLarge(dmaNum, src, dest, size, block, 32)
#define DmaFillLarge(dmaNum, value, dest, size, block, bit) \
{ \
void *_dest = dest; \
u32 _size = size; \
while (1) \
{ \
DmaFill##bit(dmaNum, value, _dest, (block)); \
_dest += (block); \
_size -= (block); \
if (_size <= (block)) \
{ \
DmaFill##bit(dmaNum, value, _dest, _size); \
break; \
} \
} \
}
#define DmaFillLarge16(dmaNum, value, dest, size, block) DmaFillLarge(dmaNum, value, dest, size, block, 16)
#define DmaFillLarge32(dmaNum, value, dest, size, block) DmaFillLarge(dmaNum, value, dest, size, block, 32)
#define DmaCopyDefvars(dmaNum, src, dest, size, bit) \
{ \
const void *_src = src; \
void *_dest = dest; \
u32 _size = size; \
DmaCopy##bit(dmaNum, _src, _dest, _size); \
}
#define DmaCopy16Defvars(dmaNum, src, dest, size) DmaCopyDefvars(dmaNum, src, dest, size, 16)
#define DmaCopy32Defvars(dmaNum, src, dest, size) DmaCopyDefvars(dmaNum, src, dest, size, 32)
#define DmaFillDefvars(dmaNum, value, dest, size, bit) \
{ \
void *_dest = dest; \
u32 _size = size; \
DmaFill##bit(dmaNum, value, _dest, _size); \
}
#define DmaFill16Defvars(dmaNum, value, dest, size) DmaFillDefvars(dmaNum, value, dest, size, 16)
#define DmaFill32Defvars(dmaNum, value, dest, size) DmaFillDefvars(dmaNum, value, dest, size, 32)
#define DmaClearDefvars(dmaNum, dest, size, bit) \
{ \
void *_dest = dest; \
u32 _size = size; \
DmaClear##bit(dmaNum, _dest, _size); \
}
#define DmaClear16Defvars(dmaNum, dest, size) DmaClearDefvars(dmaNum, dest, size, 16)
#define DmaClear32Defvars(dmaNum, dest, size) DmaClearDefvars(dmaNum, dest, size, 32)
#define DmaStop(dmaNum) \
{ \
vu16 *dmaRegs = (vu16 *)REG_ADDR_DMA##dmaNum; \

View File

@ -117,6 +117,11 @@ extern const u8 gUnknown_08DB9F08[];
extern const u8 gUnknown_08DB9FFC[];
extern const u8 gUnknown_08DBA020[];
extern const u8 gUnknown_08DBA12C[];
extern const u8 gUnknown_08DCC05C[];
extern const u16 gUnknown_08DCC01C[];
extern const u16 gUnknown_08DCC03C[];
extern const u8 gUnknown_08DCC648[];
extern const u8 gUnknown_08DCC908[];
extern const u8 gUnknown_08DD87C0[];
extern const u8 gUnknown_08DD8EE0[];
extern const u16 gUnknown_08DD8780[];

View File

@ -29,7 +29,7 @@ int decompress_and_copy_tile_data_to_vram(u8 bg_id, const void *src, int size, u
bool8 free_temp_tile_data_buffers_if_possible(void);
u64 sub_8198A50(struct WindowTemplate*, u8, u8, u8, u8, u8, u8, u16); // returns something but it isn't used, fix when menu.s is decomp'd
void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos);
s8 sub_8198C58(void);
s8 ProcessMenuInputNoWrap_(void);
void do_scheduled_bg_tilemap_copies_to_vram(void);
void clear_scheduled_bg_copies_to_vram(void);
void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, s8 speed, const u8 *str);

View File

@ -5,5 +5,11 @@ void sub_81357FC(u8, void(void));
u8 GetLeadMonIndex(void);
u8 GetSSTidalLocation(u8 *grp, u8 *num, s16 *x, s16 *y);
void sub_813BADC(bool8);
bool8 sub_813B9C0(void);
void UpdateMirageRnd(u16 days);
void UpdateBirchState(u16 days);
void UpdateFrontierManiac(u16 days);
void UpdateFrontierGambler(u16 days);
void SetShoalItemFlag(u16 days);
#endif //GUARD_ROM6_H

View File

@ -83,6 +83,9 @@ extern const u8 gText_OkayToDeleteFromRegistry[];
extern const u8 gText_RegisteredDataDeleted[];
extern const u8 gUnknown_085EA79D[];
extern const u8 gText_EmptyString2[];
extern const u8 gText_Confirm3[];
extern const u8 gText_Cancel4[];
extern const u8 gText_IsThisTheCorrectTime[];
extern const u8 gText_PkmnFainted3[];
extern const u8 gText_Coins[];

View File

@ -15,5 +15,6 @@ void sub_80F14F8(TVShow *shows);
size_t sub_80EF370(int value);
bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language);
void SetPokemonAnglerSpecies(u16 species);
void UpdateTVShowsPerDay(u16 days);
#endif //GUARD_TV_H

6
include/wallclock.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef GUARD_WALLCLOCK_H
#define GUARD_WALLCLOCK_H
void Cb2_StartWallClock(void);
#endif //GUARD_WALLCLOCK_H

View File

@ -105,7 +105,7 @@ SECTIONS {
src/event_data.o(.text);
asm/coord_event_weather.o(.text);
asm/field_tasks.o(.text);
asm/clock.o(.text);
src/clock.o(.text);
asm/reset_rtc_screen.o(.text);
src/start_menu.o(.text);
asm/start_menu.o(.text);
@ -177,7 +177,7 @@ SECTIONS {
src/battle_ai_script_commands.o(.text);
asm/trader.o(.text);
src/starter_choose.o(.text);
asm/wallclock.o(.text);
src/wallclock.o(.text);
asm/rom6.o(.text);
asm/battle_records.o(.text);
asm/pokedex_area_screen.o(.text);
@ -423,6 +423,7 @@ SECTIONS {
src/battle_ai_script_commands.o(.rodata);
data/data4.o(.rodata);
data/starter_choose.o(.rodata);
src/wallclock.o(.rodata);
data/data4c.o(.rodata);
src/battle_controller_link_partner.o(.rodata);
src/battle_message.o(.rodata);

View File

@ -2444,7 +2444,7 @@ static void CB2_HandleBlenderEndGame(void)
sBerryBlenderData->gameEndState++;
break;
case 10:
switch (sub_8198C58())
switch (ProcessMenuInputNoWrap_())
{
case 1:
case -1:

View File

@ -88,7 +88,7 @@ static void Task_DoClearSaveDataScreenYesNo(u8 taskId)
static void Task_ClearSaveDataScreenYesNoChoice(u8 taskId)
{
switch(sub_8198C58())
switch(ProcessMenuInputNoWrap_())
{
case 0:
FillWindowPixelBuffer(0, 17);

93
src/clock.c Normal file
View File

@ -0,0 +1,93 @@
#include "global.h"
#include "rom6.h"
#include "event_data.h"
#include "rtc.h"
#include "lottery_corner.h"
#include "dewford_trend.h"
#include "tv.h"
#include "field_screen.h"
#include "berry.h"
#include "main.h"
#include "overworld.h"
#include "wallclock.h"
// static types
// static declarations
static void UpdatePerDay(struct Time *localTime);
static void UpdatePerMinute(struct Time *localTime);
// rodata
// text
static void InitTimeBasedEvents(void)
{
FlagSet(FLAG_SYS_CLOCK_SET);
RtcCalcLocalTime();
gSaveBlock2Ptr->lastBerryTreeUpdate = gLocalTime;
VarSet(VAR_DAYS, gLocalTime.days);
}
void DoTimeBasedEvents(void)
{
if (FlagGet(FLAG_SYS_CLOCK_SET) && !sub_813B9C0())
{
RtcCalcLocalTime();
UpdatePerDay(&gLocalTime);
UpdatePerMinute(&gLocalTime);
}
}
static void UpdatePerDay(struct Time *localTime)
{
u16 *days = GetVarPointer(VAR_DAYS);
u16 daysSince;
if (*days != localTime->days && *days <= localTime->days)
{
daysSince = localTime->days - *days;
ClearUpperFlags();
UpdateDewfordTrendPerDay(daysSince);
UpdateTVShowsPerDay(daysSince);
UpdateWeatherPerDay(daysSince);
UpdatePartyPokerusTime(daysSince);
UpdateMirageRnd(daysSince);
UpdateBirchState(daysSince);
UpdateFrontierManiac(daysSince);
UpdateFrontierGambler(daysSince);
SetShoalItemFlag(daysSince);
SetRandomLotteryNumber(daysSince);
*days = localTime->days;
}
}
static void UpdatePerMinute(struct Time *localTime)
{
struct Time difference;
int minutes;
CalcTimeDifference(&difference, &gSaveBlock2Ptr->lastBerryTreeUpdate, localTime);
minutes = 24 * 60 * difference.days + 60 * difference.hours + difference.minutes;
if (minutes != 0)
{
if (minutes >= 0)
{
BerryTreeTimeUpdate(minutes);
gSaveBlock2Ptr->lastBerryTreeUpdate = *localTime;
}
}
}
static void ReturnFromStartWallClock(void)
{
InitTimeBasedEvents();
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
}
void StartWallClock(void)
{
SetMainCallback2(Cb2_StartWallClock);
gMain.savedCallback = ReturnFromStartWallClock;
}

View File

@ -58,7 +58,7 @@ extern const u8 gText_HatchedFromEgg[];
extern const u8 gText_NickHatchPrompt[];
extern u8 sav1_map_get_name(void);
extern s8 sub_8198C58(void);
extern s8 ProcessMenuInputNoWrap_(void);
extern void TVShowConvertInternationalString(u8* str1, u8* str2, u8);
extern void sub_806A068(u16, u8);
extern void fade_screen(u8, u8);
@ -669,7 +669,7 @@ static void CB2_EggHatch_1(void)
}
break;
case 10:
switch (sub_8198C58())
switch (ProcessMenuInputNoWrap_())
{
case 0:
GetMonNick(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar3);

View File

@ -1168,7 +1168,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
}
break;
case 4:
switch (sub_8198C58())
switch (ProcessMenuInputNoWrap_())
{
case 0:
sEvoCursorPos = 0;

View File

@ -265,7 +265,7 @@ static void Task_StarterChoose5(u8 taskId)
{
u8 spriteId;
switch (sub_8198C58())
switch (ProcessMenuInputNoWrap_())
{
case 0: // YES
// Return the starter choice and exit.

View File

@ -1793,7 +1793,7 @@ void EndMassOutbreak(void)
gSaveBlock1Ptr->outbreakDaysLeft = 0;
}
void sub_80ED888(u16 days)
void UpdateTVShowsPerDay(u16 days)
{
sub_80ED8B4(days);

1057
src/wallclock.c Normal file

File diff suppressed because it is too large Load Diff