mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-24 20:30:18 +01:00
Merge pull request #180 from DizzyEggg/decompile_mystery_event_script
Decompile mystery event script
This commit is contained in:
commit
f4455bb2a5
@ -18556,7 +18556,7 @@ _081A4202:
|
||||
thumb_func_start sub_81A4224
|
||||
sub_81A4224: @ 81A4224
|
||||
push {lr}
|
||||
bl sub_81652B4
|
||||
bl ValidateEReaderTrainer
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_81A4224
|
||||
|
@ -5898,8 +5898,8 @@ _08165294:
|
||||
.pool
|
||||
thumb_func_end GetEreaderTrainerName
|
||||
|
||||
thumb_func_start sub_81652B4
|
||||
sub_81652B4: @ 81652B4
|
||||
thumb_func_start ValidateEReaderTrainer
|
||||
ValidateEReaderTrainer: @ 81652B4
|
||||
push {r4-r6,lr}
|
||||
ldr r2, =gSpecialVar_Result
|
||||
movs r0, 0
|
||||
@ -5951,7 +5951,7 @@ _08165316:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81652B4
|
||||
thumb_func_end ValidateEReaderTrainer
|
||||
|
||||
thumb_func_start sub_8165328
|
||||
sub_8165328: @ 8165328
|
||||
|
@ -38868,7 +38868,7 @@ _0801D7D0:
|
||||
ldr r1, [r4, 0x18]
|
||||
movs r2, 0xBC
|
||||
bl memcpy
|
||||
bl sub_81652B4
|
||||
bl ValidateEReaderTrainer
|
||||
b _0801D804
|
||||
.pool
|
||||
_0801D7F0:
|
||||
|
@ -262,6 +262,13 @@
|
||||
.2byte \output
|
||||
.2byte SPECIAL_\function
|
||||
.endm
|
||||
|
||||
@ temporary solution
|
||||
.macro specialvar_ output, functionId
|
||||
.byte 0x26
|
||||
.2byte \output
|
||||
.2byte \functionId
|
||||
.endm
|
||||
|
||||
@ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock state, the script will remain blocked indefinitely (essentially a hang).
|
||||
.macro waitstate
|
||||
|
@ -468,7 +468,7 @@ _08178D74:
|
||||
bne _08178E58
|
||||
ldr r5, =0x0201c000
|
||||
adds r0, r5, 0
|
||||
bl sub_81538A0
|
||||
bl RunMysteryEventScript
|
||||
adds r4, r0, 0
|
||||
lsls r4, 16
|
||||
lsrs r4, 16
|
||||
|
@ -1,870 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_81537CC
|
||||
sub_81537CC: @ 81537CC
|
||||
push {r4,lr}
|
||||
adds r4, r3, 0
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
lsls r2, 16
|
||||
lsrs r2, 16
|
||||
movs r3, 0x1
|
||||
ands r0, r3
|
||||
cmp r0, 0
|
||||
beq _081537FC
|
||||
ands r1, r3
|
||||
cmp r1, 0
|
||||
beq _081537FC
|
||||
movs r0, 0x4
|
||||
ands r2, r0
|
||||
cmp r2, 0
|
||||
beq _081537FC
|
||||
movs r0, 0x80
|
||||
lsls r0, 2
|
||||
ands r0, r4
|
||||
cmp r0, 0
|
||||
beq _081537FC
|
||||
movs r0, 0x1
|
||||
b _081537FE
|
||||
_081537FC:
|
||||
movs r0, 0
|
||||
_081537FE:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81537CC
|
||||
|
||||
thumb_func_start sub_8153804
|
||||
sub_8153804: @ 8153804
|
||||
push {lr}
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_MysteryGiftCantBeUsed
|
||||
bl StringExpandPlaceholders
|
||||
movs r0, 0x3
|
||||
bl SetMysteryEventScriptStatus
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8153804
|
||||
|
||||
thumb_func_start sub_8153820
|
||||
sub_8153820: @ 8153820
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
ldr r1, =gUnknown_082DED2C
|
||||
ldr r2, =gUnknown_082DED2C + 0x44
|
||||
bl InitScriptContext
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl SetupBytecodeScript
|
||||
str r5, [r4, 0x64]
|
||||
movs r0, 0
|
||||
str r0, [r4, 0x68]
|
||||
str r0, [r4, 0x6C]
|
||||
str r0, [r4, 0x70]
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8153820
|
||||
|
||||
thumb_func_start sub_8153850
|
||||
sub_8153850: @ 8153850
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
bl RunScriptCommand
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08153868
|
||||
ldr r0, [r4, 0x70]
|
||||
cmp r0, 0
|
||||
beq _08153868
|
||||
movs r0, 0x1
|
||||
b _0815386A
|
||||
_08153868:
|
||||
movs r0, 0
|
||||
_0815386A:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8153850
|
||||
|
||||
thumb_func_start sub_8153870
|
||||
sub_8153870: @ 8153870
|
||||
push {lr}
|
||||
adds r1, r0, 0
|
||||
ldr r0, =gUnknown_0203BBC0
|
||||
bl sub_8153820
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8153870
|
||||
|
||||
thumb_func_start sub_8153884
|
||||
sub_8153884: @ 8153884
|
||||
push {r4,r5,lr}
|
||||
adds r5, r0, 0
|
||||
ldr r4, =gUnknown_0203BBC0
|
||||
adds r0, r4, 0
|
||||
bl sub_8153850
|
||||
ldr r1, [r4, 0x6C]
|
||||
str r1, [r5]
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8153884
|
||||
|
||||
thumb_func_start sub_81538A0
|
||||
sub_81538A0: @ 81538A0
|
||||
push {r4,lr}
|
||||
adds r1, r0, 0
|
||||
ldr r4, =gUnknown_0203BBC0
|
||||
adds r0, r4, 0
|
||||
bl sub_8153820
|
||||
_081538AC:
|
||||
adds r0, r4, 0
|
||||
bl sub_8153850
|
||||
cmp r0, 0
|
||||
bne _081538AC
|
||||
ldr r0, [r4, 0x6C]
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_81538A0
|
||||
|
||||
thumb_func_start SetMysteryEventScriptStatus
|
||||
SetMysteryEventScriptStatus: @ 81538C4
|
||||
ldr r1, =gUnknown_0203BBC0
|
||||
str r0, [r1, 0x6C]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end SetMysteryEventScriptStatus
|
||||
|
||||
thumb_func_start sub_81538D0
|
||||
sub_81538D0: @ 81538D0
|
||||
push {lr}
|
||||
movs r2, 0
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00003b18
|
||||
adds r3, r0, r1
|
||||
movs r1, 0
|
||||
_081538DE:
|
||||
adds r0, r3, r1
|
||||
ldrb r0, [r0]
|
||||
adds r2, r0
|
||||
adds r1, 0x1
|
||||
cmp r1, 0xB
|
||||
bls _081538DE
|
||||
adds r0, r2, 0
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_81538D0
|
||||
|
||||
thumb_func_start sub_81538F8
|
||||
sub_81538F8: @ 81538F8
|
||||
push {r4,r5,lr}
|
||||
ldr r5, =gSaveBlock1Ptr
|
||||
ldr r0, [r5]
|
||||
ldr r1, =0x00003b18
|
||||
adds r4, r0, r1
|
||||
bl sub_81538D0
|
||||
adds r1, r0, 0
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0
|
||||
beq _0815392A
|
||||
ldrb r0, [r4, 0x1]
|
||||
cmp r0, 0
|
||||
beq _0815392A
|
||||
ldrh r0, [r4, 0x2]
|
||||
cmp r0, 0
|
||||
beq _0815392A
|
||||
cmp r1, 0
|
||||
beq _0815392A
|
||||
ldr r0, [r5]
|
||||
ldr r2, =0x00003b14
|
||||
adds r0, r2
|
||||
ldr r0, [r0]
|
||||
cmp r1, r0
|
||||
beq _0815393C
|
||||
_0815392A:
|
||||
movs r0, 0
|
||||
b _0815393E
|
||||
.pool
|
||||
_0815393C:
|
||||
movs r0, 0x1
|
||||
_0815393E:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81538F8
|
||||
|
||||
thumb_func_start sub_8153944
|
||||
sub_8153944: @ 8153944
|
||||
push {lr}
|
||||
sub sp, 0x4
|
||||
mov r1, sp
|
||||
movs r0, 0
|
||||
strh r0, [r1]
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r1, [r0]
|
||||
ldr r0, =0x00003b14
|
||||
adds r1, r0
|
||||
ldr r2, =0x01000008
|
||||
mov r0, sp
|
||||
bl CpuSet
|
||||
add sp, 0x4
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8153944
|
||||
|
||||
thumb_func_start sub_8153970
|
||||
sub_8153970: @ 8153970
|
||||
push {r4-r6,lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r3, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
adds r5, r1, 0
|
||||
lsls r2, 16
|
||||
lsrs r2, 16
|
||||
adds r6, r2, 0
|
||||
cmp r3, 0
|
||||
beq _08153990
|
||||
cmp r1, 0
|
||||
beq _08153990
|
||||
cmp r2, 0
|
||||
bne _08153996
|
||||
_08153990:
|
||||
bl sub_8153944
|
||||
b _081539BC
|
||||
_08153996:
|
||||
ldr r4, =gSaveBlock1Ptr
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003b18
|
||||
adds r0, r1
|
||||
strb r3, [r0]
|
||||
ldr r0, [r4]
|
||||
ldr r2, =0x00003b19
|
||||
adds r0, r2
|
||||
strb r5, [r0]
|
||||
ldr r0, [r4]
|
||||
adds r1, 0x2
|
||||
adds r0, r1
|
||||
strh r6, [r0]
|
||||
bl sub_81538D0
|
||||
ldr r1, [r4]
|
||||
ldr r2, =0x00003b14
|
||||
adds r1, r2
|
||||
str r0, [r1]
|
||||
_081539BC:
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8153970
|
||||
|
||||
thumb_func_start sub_81539D4
|
||||
sub_81539D4: @ 81539D4
|
||||
push {r4-r6,lr}
|
||||
ldr r6, =gSaveBlock1Ptr
|
||||
ldr r0, [r6]
|
||||
ldr r1, =0x00003b18
|
||||
adds r4, r0, r1
|
||||
bl sub_81538F8
|
||||
cmp r0, 0
|
||||
bne _081539F8
|
||||
bl sub_8153944
|
||||
movs r0, 0
|
||||
b _08153A1A
|
||||
.pool
|
||||
_081539F8:
|
||||
ldrh r5, [r4, 0x2]
|
||||
ldrb r0, [r4, 0x1]
|
||||
subs r0, 0x1
|
||||
strb r0, [r4, 0x1]
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08153A0C
|
||||
bl sub_8153944
|
||||
b _08153A18
|
||||
_08153A0C:
|
||||
bl sub_81538D0
|
||||
ldr r1, [r6]
|
||||
ldr r2, =0x00003b14
|
||||
adds r1, r2
|
||||
str r0, [r1]
|
||||
_08153A18:
|
||||
adds r0, r5, 0
|
||||
_08153A1A:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_81539D4
|
||||
|
||||
thumb_func_start script_status_stop_and_ret_1
|
||||
script_status_stop_and_ret_1: @ 8153A24
|
||||
push {lr}
|
||||
bl StopScript
|
||||
movs r0, 0x1
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end script_status_stop_and_ret_1
|
||||
|
||||
thumb_func_start sub_8153A30
|
||||
sub_8153A30: @ 8153A30
|
||||
push {r4-r7,lr}
|
||||
adds r7, r0, 0
|
||||
bl ScriptReadWord
|
||||
str r0, [r7, 0x68]
|
||||
adds r0, r7, 0
|
||||
bl ScriptReadHalfword
|
||||
adds r5, r0, 0
|
||||
lsls r5, 16
|
||||
lsrs r5, 16
|
||||
adds r0, r7, 0
|
||||
bl ScriptReadWord
|
||||
adds r6, r0, 0
|
||||
adds r0, r7, 0
|
||||
bl ScriptReadHalfword
|
||||
adds r4, r0, 0
|
||||
lsls r4, 16
|
||||
lsrs r4, 16
|
||||
adds r0, r7, 0
|
||||
bl ScriptReadWord
|
||||
adds r3, r0, 0
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
adds r2, r4, 0
|
||||
bl sub_81537CC
|
||||
cmp r0, 0x1
|
||||
bne _08153A74
|
||||
str r0, [r7, 0x70]
|
||||
b _08153A78
|
||||
_08153A74:
|
||||
bl sub_8153804
|
||||
_08153A78:
|
||||
movs r0, 0x1
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8153A30
|
||||
|
||||
thumb_func_start sub_8153A80
|
||||
sub_8153A80: @ 8153A80
|
||||
movs r0, 0
|
||||
bx lr
|
||||
thumb_func_end sub_8153A80
|
||||
|
||||
thumb_func_start sub_8153A84
|
||||
sub_8153A84: @ 8153A84
|
||||
ldr r1, [r0, 0x8]
|
||||
ldrb r2, [r1]
|
||||
adds r1, 0x1
|
||||
str r1, [r0, 0x8]
|
||||
str r2, [r0, 0x6C]
|
||||
movs r0, 0
|
||||
bx lr
|
||||
thumb_func_end sub_8153A84
|
||||
|
||||
thumb_func_start sub_8153A94
|
||||
sub_8153A94: @ 8153A94
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r0, [r4, 0x8]
|
||||
ldrb r5, [r0]
|
||||
adds r0, 0x1
|
||||
str r0, [r4, 0x8]
|
||||
adds r0, r4, 0
|
||||
bl ScriptReadWord
|
||||
ldr r1, [r4, 0x68]
|
||||
subs r0, r1
|
||||
ldr r1, [r4, 0x64]
|
||||
adds r1, r0, r1
|
||||
cmp r5, 0xFF
|
||||
beq _08153AB8
|
||||
ldr r0, [r4, 0x6C]
|
||||
cmp r5, r0
|
||||
bne _08153ABE
|
||||
_08153AB8:
|
||||
ldr r0, =gStringVar4
|
||||
bl StringExpandPlaceholders
|
||||
_08153ABE:
|
||||
movs r0, 0
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8153A94
|
||||
|
||||
thumb_func_start sub_8153ACC
|
||||
sub_8153ACC: @ 8153ACC
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
bl ScriptReadWord
|
||||
ldr r1, [r4, 0x68]
|
||||
subs r0, r1
|
||||
ldr r1, [r4, 0x64]
|
||||
adds r0, r1
|
||||
bl ScriptContext2_RunNewScript
|
||||
movs r0, 0
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8153ACC
|
||||
|
||||
thumb_func_start sub_8153AE8
|
||||
sub_8153AE8: @ 8153AE8
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
adds r7, r0, 0
|
||||
bl IsEnigmaBerryValid
|
||||
mov r8, r0
|
||||
adds r0, r7, 0
|
||||
bl ScriptReadWord
|
||||
adds r4, r0, 0
|
||||
ldr r0, [r7, 0x68]
|
||||
subs r4, r0
|
||||
ldr r0, [r7, 0x64]
|
||||
adds r4, r0
|
||||
ldr r0, =gStringVar1
|
||||
mov r9, r0
|
||||
ldr r6, =gSaveBlock1Ptr
|
||||
ldr r1, [r6]
|
||||
ldr r5, =0x000031f8
|
||||
adds r1, r5
|
||||
movs r2, 0x7
|
||||
bl StringCopyN
|
||||
adds r0, r4, 0
|
||||
bl SetEnigmaBerry
|
||||
ldr r4, =gStringVar2
|
||||
ldr r1, [r6]
|
||||
adds r1, r5
|
||||
adds r0, r4, 0
|
||||
movs r2, 0x7
|
||||
bl StringCopyN
|
||||
mov r0, r8
|
||||
cmp r0, 0
|
||||
bne _08153B54
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_MysteryGiftBerry
|
||||
b _08153B74
|
||||
.pool
|
||||
_08153B54:
|
||||
mov r0, r9
|
||||
adds r1, r4, 0
|
||||
bl StringCompare
|
||||
cmp r0, 0
|
||||
beq _08153B70
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_MysteryGiftBerryTransform
|
||||
b _08153B74
|
||||
.pool
|
||||
_08153B70:
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_MysteryGiftBerryObtained
|
||||
_08153B74:
|
||||
bl StringExpandPlaceholders
|
||||
movs r0, 0x2
|
||||
str r0, [r7, 0x6C]
|
||||
bl IsEnigmaBerryValid
|
||||
cmp r0, 0x1
|
||||
bne _08153B9C
|
||||
ldr r0, =0x0000402d
|
||||
movs r1, 0x1
|
||||
bl VarSet
|
||||
b _08153BA0
|
||||
.pool
|
||||
_08153B9C:
|
||||
movs r0, 0x1
|
||||
str r0, [r7, 0x6C]
|
||||
_08153BA0:
|
||||
movs r0, 0
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8153AE8
|
||||
|
||||
thumb_func_start sub_8153BB0
|
||||
sub_8153BB0: @ 8153BB0
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r2, [r4, 0x8]
|
||||
ldrb r0, [r2]
|
||||
adds r2, 0x1
|
||||
str r2, [r4, 0x8]
|
||||
ldrb r1, [r2]
|
||||
adds r2, 0x1
|
||||
str r2, [r4, 0x8]
|
||||
bl GiveGiftRibbonToParty
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_MysteryGiftSpecialRibbon
|
||||
bl StringExpandPlaceholders
|
||||
movs r0, 0x2
|
||||
str r0, [r4, 0x6C]
|
||||
movs r0, 0
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8153BB0
|
||||
|
||||
thumb_func_start sub_8153BE4
|
||||
sub_8153BE4: @ 8153BE4
|
||||
push {r4-r6,lr}
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5,r6}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
ldr r0, [r4, 0x8]
|
||||
ldrb r1, [r0]
|
||||
mov r9, r1
|
||||
adds r0, 0x1
|
||||
str r0, [r4, 0x8]
|
||||
ldrb r1, [r0]
|
||||
mov r8, r1
|
||||
adds r1, r0, 0x1
|
||||
str r1, [r4, 0x8]
|
||||
ldrb r6, [r0, 0x1]
|
||||
adds r1, 0x1
|
||||
str r1, [r4, 0x8]
|
||||
adds r0, r4, 0
|
||||
bl ScriptReadWord
|
||||
adds r5, r0, 0
|
||||
ldr r0, [r4, 0x68]
|
||||
subs r5, r0
|
||||
ldr r0, [r4, 0x64]
|
||||
adds r5, r0
|
||||
adds r0, r4, 0
|
||||
bl ScriptReadWord
|
||||
adds r1, r0, 0
|
||||
ldr r0, [r4, 0x68]
|
||||
subs r1, r0
|
||||
ldr r0, [r4, 0x64]
|
||||
adds r1, r0
|
||||
subs r1, r5
|
||||
lsls r1, 16
|
||||
lsrs r1, 16
|
||||
str r6, [sp]
|
||||
adds r0, r5, 0
|
||||
mov r2, r9
|
||||
mov r3, r8
|
||||
bl InitRamScript
|
||||
movs r0, 0
|
||||
add sp, 0x4
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8153BE4
|
||||
|
||||
thumb_func_start sub_8153C4C
|
||||
sub_8153C4C: @ 8153C4C
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
bl EnableNationalPokedex
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_MysteryGiftNationalDex
|
||||
bl StringExpandPlaceholders
|
||||
movs r0, 0x2
|
||||
str r0, [r4, 0x6C]
|
||||
movs r0, 0
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8153C4C
|
||||
|
||||
thumb_func_start sub_8153C70
|
||||
sub_8153C70: @ 8153C70
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r1, [r4, 0x8]
|
||||
ldrb r0, [r1]
|
||||
adds r1, 0x1
|
||||
str r1, [r4, 0x8]
|
||||
bl sub_811EFC0
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_MysteryGiftRareWord
|
||||
bl StringExpandPlaceholders
|
||||
movs r0, 0x2
|
||||
str r0, [r4, 0x6C]
|
||||
movs r0, 0
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8153C70
|
||||
|
||||
thumb_func_start sub_8153C9C
|
||||
sub_8153C9C: @ 8153C9C
|
||||
push {r4,r5,lr}
|
||||
ldr r1, [r0, 0x8]
|
||||
ldrb r5, [r1]
|
||||
adds r1, 0x1
|
||||
str r1, [r0, 0x8]
|
||||
ldrb r4, [r1]
|
||||
adds r1, 0x1
|
||||
str r1, [r0, 0x8]
|
||||
bl ScriptReadHalfword
|
||||
adds r2, r0, 0
|
||||
lsls r2, 16
|
||||
lsrs r2, 16
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl sub_8153970
|
||||
movs r0, 0
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8153C9C
|
||||
|
||||
thumb_func_start sub_8153CC8
|
||||
sub_8153CC8: @ 8153CC8
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x88
|
||||
adds r6, r0, 0
|
||||
bl ScriptReadWord
|
||||
ldr r1, [r6, 0x68]
|
||||
subs r0, r1
|
||||
ldr r1, [r6, 0x64]
|
||||
adds r5, r0, r1
|
||||
movs r0, 0x64
|
||||
adds r0, r5
|
||||
mov r8, r0
|
||||
add r4, sp, 0x24
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0x64
|
||||
bl memcpy
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x41
|
||||
bl GetMonData
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
movs r0, 0xCE
|
||||
lsls r0, 1
|
||||
cmp r4, r0
|
||||
bne _08153D18
|
||||
ldr r0, =gStringVar1
|
||||
ldr r1, =gText_EggNickname
|
||||
movs r2, 0xB
|
||||
bl StringCopyN
|
||||
b _08153D22
|
||||
.pool
|
||||
_08153D18:
|
||||
ldr r0, =gStringVar1
|
||||
ldr r1, =gText_Pokemon
|
||||
movs r2, 0xB
|
||||
bl StringCopyN
|
||||
_08153D22:
|
||||
ldr r0, =gPlayerPartyCount
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x6
|
||||
bne _08153D4C
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_MysteryGiftFullParty
|
||||
bl StringExpandPlaceholders
|
||||
movs r0, 0x3
|
||||
b _08153DB6
|
||||
.pool
|
||||
_08153D4C:
|
||||
ldr r7, =gPlayerParty + 500
|
||||
adds r0, r7, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0x64
|
||||
bl memcpy
|
||||
mov r0, sp
|
||||
mov r1, r8
|
||||
movs r2, 0x24
|
||||
bl memcpy
|
||||
movs r0, 0xCE
|
||||
lsls r0, 1
|
||||
cmp r4, r0
|
||||
beq _08153D86
|
||||
adds r0, r4, 0
|
||||
bl SpeciesToNationalPokedexNum
|
||||
adds r4, r0, 0
|
||||
lsls r4, 16
|
||||
lsrs r4, 16
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x2
|
||||
bl GetSetPokedexFlag
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x3
|
||||
bl GetSetPokedexFlag
|
||||
_08153D86:
|
||||
adds r0, r7, 0
|
||||
movs r1, 0xC
|
||||
bl GetMonData
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
bl ItemIsMail
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08153DA4
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl GiveMailToMon2
|
||||
_08153DA4:
|
||||
bl CompactPartySlots
|
||||
bl CalculatePlayerPartyCount
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_MysteryGiftSentOver
|
||||
bl StringExpandPlaceholders
|
||||
movs r0, 0x2
|
||||
_08153DB6:
|
||||
str r0, [r6, 0x6C]
|
||||
movs r0, 0
|
||||
add sp, 0x88
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8153CC8
|
||||
|
||||
thumb_func_start sub_8153DD4
|
||||
sub_8153DD4: @ 8153DD4
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
bl ScriptReadWord
|
||||
adds r1, r0, 0
|
||||
ldr r0, [r4, 0x68]
|
||||
subs r1, r0
|
||||
ldr r0, [r4, 0x64]
|
||||
adds r1, r0
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r2, =0x00000bec
|
||||
adds r0, r2
|
||||
movs r2, 0xBC
|
||||
bl memcpy
|
||||
bl sub_81652B4
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_MysteryGiftNewTrainer
|
||||
bl StringExpandPlaceholders
|
||||
movs r0, 0x2
|
||||
str r0, [r4, 0x6C]
|
||||
movs r0, 0
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8153DD4
|
||||
|
||||
thumb_func_start sub_8153E1C
|
||||
sub_8153E1C: @ 8153E1C
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
bl EnableResetRTC
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gText_InGameClockUsable
|
||||
bl StringExpandPlaceholders
|
||||
movs r0, 0x2
|
||||
str r0, [r4, 0x6C]
|
||||
movs r0, 0
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8153E1C
|
||||
|
||||
thumb_func_start sub_8153E40
|
||||
sub_8153E40: @ 8153E40
|
||||
push {r4-r6,lr}
|
||||
adds r6, r0, 0
|
||||
bl ScriptReadWord
|
||||
adds r5, r0, 0
|
||||
adds r0, r6, 0
|
||||
bl ScriptReadWord
|
||||
adds r4, r0, 0
|
||||
ldr r0, [r6, 0x68]
|
||||
subs r4, r0
|
||||
ldr r0, [r6, 0x64]
|
||||
adds r4, r0
|
||||
adds r0, r6, 0
|
||||
bl ScriptReadWord
|
||||
adds r1, r0, 0
|
||||
ldr r0, [r6, 0x68]
|
||||
subs r1, r0
|
||||
ldr r0, [r6, 0x64]
|
||||
adds r1, r0
|
||||
subs r1, r4
|
||||
adds r0, r4, 0
|
||||
bl CalcByteArraySum
|
||||
cmp r5, r0
|
||||
beq _08153E7E
|
||||
movs r0, 0
|
||||
str r0, [r6, 0x70]
|
||||
movs r0, 0x1
|
||||
str r0, [r6, 0x6C]
|
||||
_08153E7E:
|
||||
movs r0, 0x1
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8153E40
|
||||
|
||||
thumb_func_start sub_8153E88
|
||||
sub_8153E88: @ 8153E88
|
||||
push {r4-r6,lr}
|
||||
adds r6, r0, 0
|
||||
bl ScriptReadWord
|
||||
adds r5, r0, 0
|
||||
adds r0, r6, 0
|
||||
bl ScriptReadWord
|
||||
adds r4, r0, 0
|
||||
ldr r0, [r6, 0x68]
|
||||
subs r4, r0
|
||||
ldr r0, [r6, 0x64]
|
||||
adds r4, r0
|
||||
adds r0, r6, 0
|
||||
bl ScriptReadWord
|
||||
adds r1, r0, 0
|
||||
ldr r0, [r6, 0x68]
|
||||
subs r1, r0
|
||||
ldr r0, [r6, 0x64]
|
||||
adds r1, r0
|
||||
subs r1, r4
|
||||
adds r0, r4, 0
|
||||
bl CalcCRC16
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
cmp r5, r0
|
||||
beq _08153ECA
|
||||
movs r0, 0
|
||||
str r0, [r6, 0x70]
|
||||
movs r0, 0x1
|
||||
str r0, [r6, 0x6C]
|
||||
_08153ECA:
|
||||
movs r0, 0x1
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8153E88
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
@ -114,7 +114,7 @@ sub_80E6CA0: @ 80E6CA0
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080E6D1C
|
||||
bl sub_81539D4
|
||||
bl GetRecordMixingGift
|
||||
ldr r2, =0x000011c8
|
||||
adds r1, r5, r2
|
||||
strh r0, [r1]
|
||||
@ -186,7 +186,7 @@ sub_80E6D54: @ 80E6D54
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080E6DEE
|
||||
bl sub_81539D4
|
||||
bl GetRecordMixingGift
|
||||
ldr r2, =0x000011c8
|
||||
adds r1, r5, r2
|
||||
strh r0, [r1]
|
||||
@ -282,7 +282,7 @@ _080E6E60:
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080E6EFA
|
||||
bl sub_81539D4
|
||||
bl GetRecordMixingGift
|
||||
ldr r1, [r5]
|
||||
ldr r2, =0x00001210
|
||||
adds r1, r2
|
||||
|
@ -8,368 +8,335 @@
|
||||
.include "asm/macros/event.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
|
||||
.section .rodata
|
||||
|
||||
gText_MysteryGiftBerry:: @ 8674AE4
|
||||
.string "Obtained a {STR_VAR_2} BERRY!\nDad has it at PETALBURG GYM.$"
|
||||
|
||||
gText_MysteryGiftBerryTransform:: @ 8674B16
|
||||
.string "The {STR_VAR_1} BERRY transformed into\none {STR_VAR_2} BERRY.$"
|
||||
|
||||
gText_MysteryGiftBerryObtained:: @ 8674B42
|
||||
.string "The {STR_VAR_1} BERRY has already been\nobtained.$"
|
||||
|
||||
gText_MysteryGiftSpecialRibbon:: @ 8674B6A
|
||||
.string "A special RIBBON was awarded to\nyour party POKéMON.$"
|
||||
|
||||
gText_MysteryGiftNationalDex:: @ 8674B9E
|
||||
.string "The POKéDEX has been upgraded\nwith the NATIONAL MODE.$"
|
||||
|
||||
gText_MysteryGiftRareWord:: @ 8674BD4
|
||||
.string "A rare word has been added.$"
|
||||
|
||||
gText_MysteryGiftSentOver:: @ 8674BF0
|
||||
.string "{STR_VAR_1} was sent over!$"
|
||||
|
||||
gText_MysteryGiftFullParty:: @ 8674C02
|
||||
.string "Your party is full.\n{STR_VAR_1} could not be sent over.$"
|
||||
|
||||
gText_MysteryGiftNewTrainer:: @ 8674C31
|
||||
.string "A new TRAINER has arrived in\nHOENN.$"
|
||||
.string "A new adversary has arrived in the\nBATTLE TOWER.$"
|
||||
|
||||
gText_MysteryGiftCantBeUsed:: @ 8674C86
|
||||
.string "This data can’t be used in\nthis version.$"
|
||||
|
||||
.align 2
|
||||
gUnknown_08674CB0:: @ 8674CB0
|
||||
setvaddress gUnknown_08674CB0
|
||||
setorcopyvar 0x800D, 1
|
||||
specialvar 0x8008, sub_813986C
|
||||
setorcopyvar 0x800D, 0
|
||||
specialvar 0x8009, sub_813986C
|
||||
subvar 0x8008, 32777
|
||||
buffernumberstring 0, 0x8008
|
||||
|
||||
MysteryEventScript_StampCard:: @ 8674CB0
|
||||
setvaddress MysteryEventScript_StampCard
|
||||
setorcopyvar VAR_RESULT, 1
|
||||
specialvar VAR_0x8008, sub_813986C
|
||||
setorcopyvar VAR_RESULT, 0
|
||||
specialvar VAR_0x8009, sub_813986C
|
||||
subvar VAR_0x8008, 32777
|
||||
buffernumberstring 0, VAR_0x8008
|
||||
lock
|
||||
faceplayer
|
||||
vmessage gText_MysteryGiftStampCard
|
||||
vmessage sText_MysteryGiftStampCard
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
gText_MysteryGiftStampCard::
|
||||
sText_MysteryGiftStampCard:
|
||||
.string "Thank you for using the STAMP CARD\nSystem.\pYou have {STR_VAR_1} more to collect to\nfill your STAMP CARD.$"
|
||||
|
||||
gUnknown_08674D3D:: @ 8674D3D
|
||||
setvaddress gUnknown_08674D3D
|
||||
checkflag 0x1E4
|
||||
vgoto_if 0, EventScript_674D4C
|
||||
MysteryEventScript_SurfPichu:: @ 8674D3D
|
||||
setvaddress MysteryEventScript_SurfPichu
|
||||
checkflag FLAG_MYSTERY_EVENT_DONE
|
||||
vgoto_if 0, SurfPichu_GiveIfPossible
|
||||
gotoram
|
||||
|
||||
EventScript_674D4C:: @ 8674D4C
|
||||
specialvar 0x40DD, CalculatePlayerPartyCount
|
||||
compare_var_to_value 0x40DD, 6
|
||||
vgoto_if 1, EventScript_674D73
|
||||
setflag 0x1E4
|
||||
vcall EventScript_674D7E
|
||||
SurfPichu_GiveIfPossible: @ 8674D4C
|
||||
specialvar VAR_EVENT_PICHU_SLOT, CalculatePlayerPartyCount
|
||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 6
|
||||
vgoto_if 1, SurfPichu_FullParty
|
||||
setflag FLAG_MYSTERY_EVENT_DONE
|
||||
vcall SurfPichu_GiveEgg
|
||||
lock
|
||||
faceplayer
|
||||
vmessage gText_MysteryGiftEgg
|
||||
vmessage sText_MysteryGiftEgg
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
playfanfare 370
|
||||
playfanfare MUS_FANFA4
|
||||
waitfanfare
|
||||
release
|
||||
end
|
||||
|
||||
EventScript_674D73:: @ 8674D73
|
||||
SurfPichu_FullParty: @ 8674D73
|
||||
lock
|
||||
faceplayer
|
||||
vmessage gText_MysteryGiftEgg_2
|
||||
vmessage sText_FullParty
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
EventScript_674D7E:: @ 8674D7E
|
||||
SurfPichu_GiveEgg: @ 8674D7E
|
||||
giveegg SPECIES_PICHU
|
||||
setmonobedient 0x40DD
|
||||
setmonmetlocation 0x40DD, 255
|
||||
compare_var_to_value 0x40DD, 1
|
||||
vgoto_if 1, EventScript_674DC0
|
||||
compare_var_to_value 0x40DD, 2
|
||||
vgoto_if 1, EventScript_674DC6
|
||||
compare_var_to_value 0x40DD, 3
|
||||
vgoto_if 1, EventScript_674DCC
|
||||
compare_var_to_value 0x40DD, 4
|
||||
vgoto_if 1, EventScript_674DD2
|
||||
compare_var_to_value 0x40DD, 5
|
||||
vgoto_if 1, EventScript_674DD8
|
||||
setmonobedient VAR_EVENT_PICHU_SLOT
|
||||
setmonmetlocation VAR_EVENT_PICHU_SLOT, 255
|
||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 1
|
||||
vgoto_if 1, SurfPichu_Slot1
|
||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 2
|
||||
vgoto_if 1, SurfPichu_Slot2
|
||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 3
|
||||
vgoto_if 1, SurfPichu_Slot3
|
||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 4
|
||||
vgoto_if 1, SurfPichu_Slot4
|
||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 5
|
||||
vgoto_if 1, SurfPichu_Slot5
|
||||
return
|
||||
|
||||
EventScript_674DC0:: @ 8674DC0
|
||||
setmonmove 1, 2, 57
|
||||
SurfPichu_Slot1: @ 8674DC0
|
||||
setmonmove 1, 2, MOVE_SURF
|
||||
return
|
||||
|
||||
EventScript_674DC6:: @ 8674DC6
|
||||
setmonmove 2, 2, 57
|
||||
SurfPichu_Slot2:: @ 8674DC6
|
||||
setmonmove 2, 2, MOVE_SURF
|
||||
return
|
||||
|
||||
EventScript_674DCC:: @ 8674DCC
|
||||
setmonmove 3, 2, 57
|
||||
SurfPichu_Slot3: @ 8674DCC
|
||||
setmonmove 3, 2, MOVE_SURF
|
||||
return
|
||||
|
||||
EventScript_674DD2:: @ 8674DD2
|
||||
setmonmove 4, 2, 57
|
||||
SurfPichu_Slot4: @ 8674DD2
|
||||
setmonmove 4, 2, MOVE_SURF
|
||||
return
|
||||
|
||||
EventScript_674DD8:: @ 8674DD8
|
||||
setmonmove 5, 2, 57
|
||||
SurfPichu_Slot5: @ 8674DD8
|
||||
setmonmove 5, 2, MOVE_SURF
|
||||
return
|
||||
|
||||
gText_MysteryGiftEgg::
|
||||
sText_MysteryGiftEgg:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.\pFrom the POKéMON CENTER we\nhave a gift--a POKéMON EGG!\pPlease raise it with love and\nkindness.$"
|
||||
|
||||
gText_MysteryGiftEgg_2::
|
||||
sText_FullParty:
|
||||
.string "Oh, your party appears to be full.\pPlease come see me after storing\na POKéMON on a PC.$"
|
||||
|
||||
gUnknown_08674EC1:: @ 8674EC1
|
||||
setvaddress gUnknown_08674EC1
|
||||
special sub_81652B4
|
||||
compare_var_to_value 0x800D, 0
|
||||
vgoto_if 1, EventScript_674EDF
|
||||
MysteryEventScript_VisitingTrainer:: @ 8674EC1
|
||||
setvaddress MysteryEventScript_VisitingTrainer
|
||||
special ValidateEReaderTrainer
|
||||
compare_var_to_value VAR_RESULT, 0
|
||||
vgoto_if 1, MysteryEventScript_VisitingTrainerArrived
|
||||
lock
|
||||
faceplayer
|
||||
vmessage gText_MysteryGiftVisitingTrainer
|
||||
vmessage sText_MysteryGiftVisitingTrainer
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
EventScript_674EDF:: @ 8674EDF
|
||||
MysteryEventScript_VisitingTrainerArrived: @ 8674EDF
|
||||
lock
|
||||
faceplayer
|
||||
vmessage gText_MysteryGiftVisitingTrainer_2
|
||||
vmessage sText_MysteryGiftVisitingTrainer_2
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
gText_MysteryGiftVisitingTrainer::
|
||||
sText_MysteryGiftVisitingTrainer:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.\pBy holding this WONDER CARD, you\nmay take part in a survey at a\lPOKéMON MART.\pUse these surveys to invite\nTRAINERS to SOOTOPOLIS CITY.\p…Let me give you a secret\npassword for a survey:\p“GIVE ME\nAWESOME TRAINER”\pWrite that in on a survey and send\nit to the WIRELESS\lCOMMUNICATION SYSTEM.$"
|
||||
|
||||
gText_MysteryGiftVisitingTrainer_2::
|
||||
|
||||
sText_MysteryGiftVisitingTrainer_2:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.\pA TRAINER has arrived in\nSOOTOPOLIS CITY looking for you.\pWe hope you will enjoy\nbattling the visiting TRAINER.\pYou may invite other TRAINERS by\nentering other passwords.\pTry looking for other passwords\nthat may work.$"
|
||||
|
||||
gUnknown_0867513C:: @ 867513C
|
||||
setvaddress gUnknown_0867513C
|
||||
checkflag 0x1E4
|
||||
vgoto_if 1, EventScript_675179
|
||||
setorcopyvar 0x800D, 2
|
||||
specialvar 0x8008, sub_813986C
|
||||
compare_var_to_value 0x8008, 3
|
||||
vgoto_if 0, EventScript_675179
|
||||
MysteryEventScript_BattleCard:: @ 867513C
|
||||
setvaddress MysteryEventScript_BattleCard
|
||||
checkflag FLAG_MYSTERY_EVENT_DONE
|
||||
vgoto_if 1, MysteryEventScript_BattleCardInfo
|
||||
setorcopyvar VAR_RESULT, 2
|
||||
specialvar VAR_0x8008, sub_813986C
|
||||
compare_var_to_value VAR_0x8008, 3
|
||||
vgoto_if 0, MysteryEventScript_BattleCardInfo
|
||||
lock
|
||||
faceplayer
|
||||
vmessage gText_MysteryGiftBattleCountCard_2
|
||||
vmessage sText_MysteryGiftBattleCountCard_2
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
giveitem_std 13
|
||||
giveitem_std ITEM_POTION
|
||||
release
|
||||
setflag 0x1E4
|
||||
setflag FLAG_MYSTERY_EVENT_DONE
|
||||
end
|
||||
|
||||
EventScript_675179:: @ 8675179
|
||||
MysteryEventScript_BattleCardInfo: @ 8675179
|
||||
lock
|
||||
faceplayer
|
||||
vmessage gText_MysteryGiftBattleCountCard
|
||||
vmessage sText_MysteryGiftBattleCountCard
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
gText_MysteryGiftBattleCountCard::
|
||||
sText_MysteryGiftBattleCountCard:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.\pYour BATTLE COUNT CARD keeps\ntrack of your battle record against\lTRAINERS with the same CARD.\pLook for and battle TRAINERS who\nhave the same CARD as you.\pYou may check the overall rankings\nby reading the NEWS.\pPlease do give it a try!$"
|
||||
|
||||
gText_MysteryGiftBattleCountCard_2::
|
||||
sText_MysteryGiftBattleCountCard_2:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.\pCongratulations!\pYou have won a prize for winning\nthree battles!\pWe hope you will be inspired to\nbattle some more.$"
|
||||
|
||||
gUnknown_0867533C:: @ 867533C
|
||||
setvaddress gUnknown_0867533C
|
||||
MysteryEventScript_AuroraTicket:: @ 867533C
|
||||
setvaddress MysteryEventScript_AuroraTicket
|
||||
lock
|
||||
faceplayer
|
||||
checkflag 0x13A
|
||||
vgoto_if 1, EventScript_6753A0
|
||||
checkflag 0x1AD
|
||||
vgoto_if 1, EventScript_6753A0
|
||||
checkitem 371, 1
|
||||
compare_var_to_value 0x800D, 1
|
||||
vgoto_if 1, EventScript_6753A0
|
||||
vmessage gText_MysteryGiftTicket1
|
||||
checkflag FLAG_0x13A
|
||||
vgoto_if 1, AuroraTicket_Obtained
|
||||
checkflag FLAG_0x1AD
|
||||
vgoto_if 1, AuroraTicket_Obtained
|
||||
checkitem ITEM_AURORA_TICKET, 1
|
||||
compare_var_to_value VAR_RESULT, 1
|
||||
vgoto_if 1, AuroraTicket_Obtained
|
||||
vmessage sText_AuroraTicket1
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
checkitemspace 371, 1
|
||||
compare_var_to_value 0x800D, 0
|
||||
vgoto_if 1, EventScript_675397
|
||||
giveitem_std 371
|
||||
setflag 0x8D5
|
||||
setflag 0x13A
|
||||
vmessage gText_MysteryGiftTicket1_1
|
||||
checkitemspace ITEM_AURORA_TICKET, 1
|
||||
compare_var_to_value VAR_RESULT, 0
|
||||
vgoto_if 1, AuroraTicket_NoBagSpace
|
||||
giveitem_std ITEM_AURORA_TICKET
|
||||
setflag FLAG_0x8D5
|
||||
setflag FLAG_0x13A
|
||||
vmessage sText_AuroraTicket2
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
EventScript_675397:: @ 8675397
|
||||
vmessage gText_MysteryGiftTicket1_3
|
||||
AuroraTicket_NoBagSpace: @ 8675397
|
||||
vmessage sText_AuroraTicketNoPlace
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
EventScript_6753A0:: @ 86753A0
|
||||
vmessage gText_MysteryGiftTicket1_2
|
||||
AuroraTicket_Obtained: @ 86753A0
|
||||
vmessage sText_AuroraTicketGot
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
gText_MysteryGiftTicket1::
|
||||
sText_AuroraTicket1:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.\pYou must be {PLAYER}.\nThere is a ticket here for you.$"
|
||||
|
||||
gText_MysteryGiftTicket1_1::
|
||||
sText_AuroraTicket2:
|
||||
.string "It appears to be for use at the\nLILYCOVE CITY port.\pWhy not give it a try and see what\nit is about?$"
|
||||
|
||||
gText_MysteryGiftTicket1_2::
|
||||
sText_AuroraTicketGot:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.$"
|
||||
|
||||
gText_MysteryGiftTicket1_3::
|
||||
sText_AuroraTicketNoPlace:
|
||||
.string "Oh, I’m sorry, {PLAYER}.\nYour BAG’s KEY ITEMS POCKET is full.\pPlease store something on your PC,\nthen come back for this.$"
|
||||
|
||||
gUnknown_0867550B:: @ 867550B
|
||||
setvaddress gUnknown_0867550B
|
||||
MysteryEventScript_MysticTicket:: @ 867550B
|
||||
setvaddress MysteryEventScript_MysticTicket
|
||||
lock
|
||||
faceplayer
|
||||
checkflag 0x13B
|
||||
vgoto_if 1, EventScript_675578
|
||||
checkflag 0x91
|
||||
vgoto_if 1, EventScript_675578
|
||||
checkflag 0x92
|
||||
vgoto_if 1, EventScript_675578
|
||||
checkitem 370, 1
|
||||
compare_var_to_value 0x800D, 1
|
||||
vgoto_if 1, EventScript_675578
|
||||
vmessage gText_MysteryGiftTicket2
|
||||
checkflag FLAG_0x13B
|
||||
vgoto_if 1, MysticTicket_Obtained
|
||||
checkflag FLAG_0x091
|
||||
vgoto_if 1, MysticTicket_Obtained
|
||||
checkflag FLAG_0x092
|
||||
vgoto_if 1, MysticTicket_Obtained
|
||||
checkitem ITEM_MYSTIC_TICKET, 1
|
||||
compare_var_to_value VAR_RESULT, 1
|
||||
vgoto_if 1, MysticTicket_Obtained
|
||||
vmessage sText_MysticTicket2
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
checkitemspace 370, 1
|
||||
compare_var_to_value 0x800D, 0
|
||||
vgoto_if 1, EventScript_67556F
|
||||
giveitem_std 370
|
||||
setflag 0x8E0
|
||||
setflag 0x13B
|
||||
vmessage gText_MysteryGiftTicket2_1
|
||||
checkitemspace ITEM_MYSTIC_TICKET, 1
|
||||
compare_var_to_value VAR_RESULT, 0
|
||||
vgoto_if 1, MysticTicket_NoBagSpace
|
||||
giveitem_std ITEM_MYSTIC_TICKET
|
||||
setflag FLAG_0x8E0
|
||||
setflag FLAG_0x13B
|
||||
vmessage sText_MysticTicket1
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
EventScript_67556F:: @ 867556F
|
||||
vmessage gText_MysteryGiftTicket2_3
|
||||
MysticTicket_NoBagSpace: @ 867556F
|
||||
vmessage sText_MysticTicketNoPlace
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
EventScript_675578:: @ 8675578
|
||||
vmessage gText_MysteryGiftTicket2_2
|
||||
MysticTicket_Obtained: @ 8675578
|
||||
vmessage sText_MysticTicketGot
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
gText_MysteryGiftTicket2::
|
||||
sText_MysticTicket2:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.\pYou must be {PLAYER}.\nThere is a ticket here for you.$"
|
||||
|
||||
gText_MysteryGiftTicket2_1::
|
||||
sText_MysticTicket1:
|
||||
.string "It appears to be for use at the\nLILYCOVE CITY port.\pWhy not give it a try and see what\nit is about?$"
|
||||
|
||||
gText_MysteryGiftTicket2_2::
|
||||
sText_MysticTicketGot:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.$"
|
||||
|
||||
gText_MysteryGiftTicket2_3::
|
||||
sText_MysticTicketNoPlace:
|
||||
.string "Oh, I’m sorry, {PLAYER}.\nYour BAG’s KEY ITEMS POCKET is full.\pPlease store something on your PC,\nthen come back for this.$"
|
||||
|
||||
gUnknown_086756E3:: @ 86756E3
|
||||
setvaddress gUnknown_086756E3
|
||||
addvar 0x403E, 1
|
||||
compare_var_to_value 0x403E, 10
|
||||
vgoto_if 0, EventScript_6756FD
|
||||
setvar 0x403E, 0
|
||||
|
||||
EventScript_6756FD:: @ 86756FD
|
||||
MysteryEventScript_AlteringCave:: @ 86756E3
|
||||
setvaddress MysteryEventScript_AlteringCave
|
||||
addvar VAR_ALTERING_CAVE_WILD_SET, 1
|
||||
compare_var_to_value VAR_ALTERING_CAVE_WILD_SET, 10
|
||||
vgoto_if 0, MysteryEventScript_AlteringCave_
|
||||
setvar VAR_ALTERING_CAVE_WILD_SET, 0
|
||||
MysteryEventScript_AlteringCave_: @ 86756FD
|
||||
lock
|
||||
faceplayer
|
||||
vmessage gText_MysteryGiftAlteringCave
|
||||
vmessage sText_MysteryGiftAlteringCave
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
gText_MysteryGiftAlteringCave::
|
||||
sText_MysteryGiftAlteringCave::
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.\pThere appears to be a rumor about\nrare POKéMON sightings.\pThe sightings reportedly came from\nthe ALTERING CAVE on ROUTE 103.\pPerhaps it would be worthwhile for\nyou to investigate this rumor.$"
|
||||
|
||||
gUnknown_086757F4:: @ 86757F4
|
||||
setvaddress gUnknown_086757F4
|
||||
MysteryEventScript_OldSeaMap:: @ 86757F4
|
||||
setvaddress MysteryEventScript_OldSeaMap
|
||||
lock
|
||||
faceplayer
|
||||
checkflag 0x13C
|
||||
vgoto_if 1, EventScript_675858
|
||||
checkflag 0x1CA
|
||||
vgoto_if 1, EventScript_675858
|
||||
checkitem 376, 1
|
||||
compare_var_to_value 0x800D, 1
|
||||
vgoto_if 1, EventScript_675858
|
||||
vmessage gText_MysteryGiftOldSeaMap
|
||||
checkflag FLAG_0x13C
|
||||
vgoto_if 1, OldSeaMap_Obtained
|
||||
checkflag FLAG_0x1CA
|
||||
vgoto_if 1, OldSeaMap_Obtained
|
||||
checkitem ITEM_OLD_SEA_MAP, 1
|
||||
compare_var_to_value VAR_RESULT, 1
|
||||
vgoto_if 1, OldSeaMap_Obtained
|
||||
vmessage sText_MysteryGiftOldSeaMap
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
checkitemspace 376, 1
|
||||
compare_var_to_value 0x800D, 0
|
||||
vgoto_if 1, EventScript_67584F
|
||||
giveitem_std 376
|
||||
setflag 0x8D6
|
||||
setflag 0x13C
|
||||
vmessage gText_MysteryGiftOldSeaMap_1
|
||||
checkitemspace ITEM_OLD_SEA_MAP, 1
|
||||
compare_var_to_value VAR_RESULT, 0
|
||||
vgoto_if 1, OldSeaMap_NoBagSpace
|
||||
giveitem_std ITEM_OLD_SEA_MAP
|
||||
setflag FLAG_0x8D6
|
||||
setflag FLAG_0x13C
|
||||
vmessage sText_MysteryGiftOldSeaMap_1
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
EventScript_67584F:: @ 867584F
|
||||
vmessage gText_MysteryGiftOldSeaMap_3
|
||||
OldSeaMap_NoBagSpace: @ 867584F
|
||||
vmessage sText_MysteryGiftOldSeaMap_3
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
EventScript_675858:: @ 8675858
|
||||
vmessage gText_MysteryGiftOldSeaMap_2
|
||||
OldSeaMap_Obtained: @ 8675858
|
||||
vmessage sText_MysteryGiftOldSeaMap_2
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
release
|
||||
end
|
||||
|
||||
gText_MysteryGiftOldSeaMap::
|
||||
sText_MysteryGiftOldSeaMap:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.\pLet me confirm--you are {PLAYER}?\pWe received this OLD SEA MAP\naddressed to you.$"
|
||||
|
||||
gText_MysteryGiftOldSeaMap_1::
|
||||
|
||||
sText_MysteryGiftOldSeaMap_1:
|
||||
.string "It appears to be for use at the\nLILYCOVE CITY port.\pWhy not give it a try and see what\nit is about?$"
|
||||
|
||||
gText_MysteryGiftOldSeaMap_2::
|
||||
|
||||
sText_MysteryGiftOldSeaMap_2:
|
||||
.string "Thank you for using the MYSTERY\nGIFT System.$"
|
||||
|
||||
gText_MysteryGiftOldSeaMap_3::
|
||||
|
||||
sText_MysteryGiftOldSeaMap_3:
|
||||
.string "Oh, I’m sorry, {PLAYER}.\nYour BAG’s KEY ITEMS POCKET is full.\pPlease store something on your PC,\nthen come back for this.$"
|
||||
.align 2
|
||||
|
22
data/mystery_event_script_cmd_table.s
Normal file
22
data/mystery_event_script_cmd_table.s
Normal file
@ -0,0 +1,22 @@
|
||||
.section script_data, "aw", %progbits
|
||||
|
||||
.align 2
|
||||
gMysteryEventScriptCmdTable:: @ 82DED2C
|
||||
.4byte MEScrCmd_nop
|
||||
.4byte MEScrCmd_checkcompat
|
||||
.4byte MEScrCmd_end
|
||||
.4byte MEScrCmd_setmsg
|
||||
.4byte MEScrCmd_setstatus
|
||||
.4byte MEScrCmd_runscript
|
||||
.4byte MEScrCmd_initramscript
|
||||
.4byte MEScrCmd_setenigmaberry
|
||||
.4byte MEScrCmd_giveribbon
|
||||
.4byte MEScrCmd_givenationaldex
|
||||
.4byte MEScrCmd_addrareword
|
||||
.4byte MEScrCmd_setrecordmixinggift
|
||||
.4byte MEScrCmd_givepokemon
|
||||
.4byte MEScrCmd_addtrainer
|
||||
.4byte MEScrCmd_enableresetrtc
|
||||
.4byte MEScrCmd_checksum
|
||||
.4byte MEScrCmd_crc
|
||||
gMysteryEventScriptCmdTableEnd::
|
@ -1,21 +0,0 @@
|
||||
.section script_data, "aw", %progbits
|
||||
|
||||
.align 2
|
||||
gUnknown_082DED2C:: @ 82DED2C
|
||||
.4byte sub_8153A80
|
||||
.4byte sub_8153A30
|
||||
.4byte script_status_stop_and_ret_1
|
||||
.4byte sub_8153A94
|
||||
.4byte sub_8153A84
|
||||
.4byte sub_8153ACC
|
||||
.4byte sub_8153BE4
|
||||
.4byte sub_8153AE8
|
||||
.4byte sub_8153BB0
|
||||
.4byte sub_8153C4C
|
||||
.4byte sub_8153C70
|
||||
.4byte sub_8153C9C
|
||||
.4byte sub_8153CC8
|
||||
.4byte sub_8153DD4
|
||||
.4byte sub_8153E1C
|
||||
.4byte sub_8153E40
|
||||
.4byte sub_8153E88
|
@ -393,7 +393,7 @@ PetalburgCity_Gym_EventScript_204DCE:: @ 8204DCE
|
||||
checkpcitem ITEM_ENIGMA_BERRY, 1
|
||||
compare VAR_RESULT, 1
|
||||
goto_eq PetalburgCity_Gym_EventScript_204E17
|
||||
compare VAR_0x402D, 0
|
||||
compare VAR_ENIGMA_BERRY_AVAILABLE, 0
|
||||
goto_eq PetalburgCity_Gym_EventScript_204E17
|
||||
msgbox PetalburgCity_Gym_Text_2A6D3D, 4
|
||||
setvar VAR_RESULT, 1
|
||||
@ -407,7 +407,7 @@ PetalburgCity_Gym_EventScript_204E1D:: @ 8204E1D
|
||||
giveitem_std ITEM_ENIGMA_BERRY
|
||||
compare VAR_RESULT, 0
|
||||
goto_eq PetalburgCity_Gym_EventScript_272054
|
||||
setvar VAR_0x402D, 0
|
||||
setvar VAR_ENIGMA_BERRY_AVAILABLE, 0
|
||||
release
|
||||
end
|
||||
|
||||
|
@ -257,7 +257,7 @@ gSpecials:: @ 81DBA64
|
||||
def_special sub_81B9B80
|
||||
def_special sub_81B9D08
|
||||
def_special sub_80F9490
|
||||
def_special sub_81652B4
|
||||
def_special ValidateEReaderTrainer
|
||||
def_special sub_8139228
|
||||
def_special sub_80F94E8
|
||||
def_special sub_816AE58
|
||||
|
@ -484,7 +484,7 @@
|
||||
#define FLAG_0x1E1 0x1E1
|
||||
#define FLAG_0x1E2 0x1E2
|
||||
#define FLAG_0x1E3 0x1E3
|
||||
#define FLAG_0x1E4 0x1E4
|
||||
#define FLAG_MYSTERY_EVENT_DONE 0x1E4
|
||||
#define FLAG_0x1E5 0x1E5
|
||||
#define FLAG_0x1E6 0x1E6
|
||||
#define FLAG_0x1E7 0x1E7
|
||||
|
@ -48,7 +48,7 @@
|
||||
#define VAR_HAPPINESS_STEP_COUNTER 0x402A
|
||||
#define VAR_POISON_STEP_COUNTER 0x402B
|
||||
#define VAR_RESET_RTC_ENABLE 0x402C
|
||||
#define VAR_0x402D 0x402D
|
||||
#define VAR_ENIGMA_BERRY_AVAILABLE 0x402D
|
||||
#define VAR_0x402E 0x402E
|
||||
|
||||
#define VAR_FRONTIER_MANIAC_FACILITY 0x402F
|
||||
@ -226,7 +226,7 @@
|
||||
#define VAR_0x40DA 0x40DA
|
||||
#define VAR_0x40DB 0x40DB
|
||||
#define VAR_0x40DC 0x40DC
|
||||
#define VAR_0x40DD 0x40DD
|
||||
#define VAR_EVENT_PICHU_SLOT 0x40DD
|
||||
#define VAR_0x40DE 0x40DE
|
||||
#define VAR_0x40DF 0x40DF
|
||||
#define VAR_0x40E0 0x40E0
|
||||
|
16
include/mystery_event_msg.h
Normal file
16
include/mystery_event_msg.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef GUARD_MYSTERY_EVENT_MSG_H
|
||||
#define GUARD_MYSTERY_EVENT_MSG_H
|
||||
|
||||
extern const u8 gText_MysteryGiftBerry[];
|
||||
extern const u8 gText_MysteryGiftBerryTransform[];
|
||||
extern const u8 gText_MysteryGiftBerryObtained[];
|
||||
extern const u8 gText_MysteryGiftSpecialRibbon[];
|
||||
extern const u8 gText_MysteryGiftNationalDex[];
|
||||
extern const u8 gText_MysteryGiftRareWord[];
|
||||
extern const u8 gText_MysteryGiftSentOver[];
|
||||
extern const u8 gText_MysteryGiftFullParty[];
|
||||
extern const u8 gText_MysteryGiftNewTrainer[];
|
||||
extern const u8 gText_MysteryGiftNewAdversaryInBattleTower[];
|
||||
extern const u8 gText_MysteryGiftCantBeUsed[];
|
||||
|
||||
#endif // GUARD_MYSTERY_EVENT_MSG_H
|
@ -1,7 +1,9 @@
|
||||
#ifndef GUARD_MYSTERY_EVENT_SCRIPT_H
|
||||
#define GUARD_MYSTERY_EVENT_SCRIPT_H
|
||||
|
||||
u32 RunMysteryEventScript(u8 *);
|
||||
void sub_8153870(u8 *script);
|
||||
bool32 sub_8153884(u32 *a0);
|
||||
u32 RunMysteryEventScript(u8 *script);
|
||||
void SetMysteryEventScriptStatus(u32 val);
|
||||
u16 GetRecordMixingGift(void);
|
||||
|
||||
|
@ -148,6 +148,10 @@ extern const u8 gText_MoveItemsDescription[];
|
||||
extern const u8 gText_SeeYa[];
|
||||
extern const u8 gText_SeeYaDescription[];
|
||||
|
||||
extern const u8 gText_EggNickname[];
|
||||
extern const u8 gText_Pokemon[];
|
||||
extern const u8 gText_InGameClockUsable[];
|
||||
|
||||
// menu texts
|
||||
extern const u8 gText_MenuPokedex[];
|
||||
extern const u8 gText_MenuPokemon[];
|
||||
|
@ -205,7 +205,7 @@ SECTIONS {
|
||||
asm/roulette_util.o(.text);
|
||||
asm/cable_car_util.o(.text);
|
||||
src/save.o(.text);
|
||||
asm/mystery_event_script.o(.text);
|
||||
src/mystery_event_script.o(.text);
|
||||
asm/field_effect_helpers.o(.text);
|
||||
asm/contest_ai.o(.text);
|
||||
asm/battle_anim_sound_tasks.o(.text);
|
||||
@ -288,7 +288,7 @@ SECTIONS {
|
||||
data/battle_scripts_2.o(script_data);
|
||||
data/battle_ai_scripts.o(script_data);
|
||||
data/contest_ai_scripts.o(script_data);
|
||||
data/script_funcs.o(script_data);
|
||||
data/mystery_event_script_cmd_table.o(script_data);
|
||||
} =0
|
||||
|
||||
lib_text :
|
||||
@ -542,6 +542,7 @@ SECTIONS {
|
||||
src/unk_transition.o(.rodata);
|
||||
data/link_strings.o(.rodata);
|
||||
data/fonts.o(.rodata);
|
||||
src/mystery_event_msg.o(.rodata);
|
||||
data/mystery_event_msg.o(.rodata);
|
||||
src/m4a_tables.o(.rodata);
|
||||
data/sound_data.o(.rodata);
|
||||
|
13
src/mystery_event_msg.c
Normal file
13
src/mystery_event_msg.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include "global.h"
|
||||
|
||||
const u8 gText_MysteryGiftBerry[] = _("Obtained a {STR_VAR_2} BERRY!\nDad has it at PETALBURG GYM.");
|
||||
const u8 gText_MysteryGiftBerryTransform[] = _("The {STR_VAR_1} BERRY transformed into\none {STR_VAR_2} BERRY.");
|
||||
const u8 gText_MysteryGiftBerryObtained[] = _("The {STR_VAR_1} BERRY has already been\nobtained.");
|
||||
const u8 gText_MysteryGiftSpecialRibbon[] = _("A special RIBBON was awarded to\nyour party POKéMON.");
|
||||
const u8 gText_MysteryGiftNationalDex[] = _("The POKéDEX has been upgraded\nwith the NATIONAL MODE.");
|
||||
const u8 gText_MysteryGiftRareWord[] = _("A rare word has been added.");
|
||||
const u8 gText_MysteryGiftSentOver[] = _("{STR_VAR_1} was sent over!");
|
||||
const u8 gText_MysteryGiftFullParty[] = _("Your party is full.\n{STR_VAR_1} could not be sent over.");
|
||||
const u8 gText_MysteryGiftNewTrainer[] = _("A new TRAINER has arrived in\nHOENN.");
|
||||
const u8 gText_MysteryGiftNewAdversaryInBattleTower[] = _("A new adversary has arrived in the\nBATTLE TOWER.");
|
||||
const u8 gText_MysteryGiftCantBeUsed[] = _("This data can’t be used in\nthis version.");
|
396
src/mystery_event_script.c
Normal file
396
src/mystery_event_script.c
Normal file
@ -0,0 +1,396 @@
|
||||
#include "global.h"
|
||||
#include "berry.h"
|
||||
#include "battle_tower.h"
|
||||
#include "easy_chat.h"
|
||||
#include "event_data.h"
|
||||
#include "mail.h"
|
||||
#include "mystery_event_script.h"
|
||||
#include "pokedex.h"
|
||||
#include "pokemon.h"
|
||||
#include "pokemon_size_record.h"
|
||||
#include "script.h"
|
||||
#include "constants/species.h"
|
||||
#include "strings.h"
|
||||
#include "string_util.h"
|
||||
#include "text.h"
|
||||
#include "util.h"
|
||||
#include "mystery_event_msg.h"
|
||||
#include "pokemon_storage_system.h"
|
||||
|
||||
extern void sub_811EFC0(u8);
|
||||
extern void ValidateEReaderTrainer(void);
|
||||
|
||||
extern ScrCmdFunc gMysteryEventScriptCmdTable[];
|
||||
extern ScrCmdFunc gMysteryEventScriptCmdTableEnd[];
|
||||
|
||||
#define LANGUAGE_MASK 0x1
|
||||
#define VERSION_MASK 0x200
|
||||
|
||||
EWRAM_DATA static struct ScriptContext sMysteryEventScriptContext = {0};
|
||||
|
||||
static bool32 CheckCompatibility(u16 a1, u32 a2, u16 a3, u32 a4)
|
||||
{
|
||||
if (!(a1 & LANGUAGE_MASK))
|
||||
return FALSE;
|
||||
|
||||
if (!(a2 & LANGUAGE_MASK))
|
||||
return FALSE;
|
||||
|
||||
if (!(a3 & 0x4))
|
||||
return FALSE;
|
||||
|
||||
if (!(a4 & VERSION_MASK))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void SetIncompatible(void)
|
||||
{
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryGiftCantBeUsed);
|
||||
SetMysteryEventScriptStatus(3);
|
||||
}
|
||||
|
||||
static void InitMysteryEventScript(struct ScriptContext *ctx, u8 *script)
|
||||
{
|
||||
InitScriptContext(ctx, gMysteryEventScriptCmdTable, gMysteryEventScriptCmdTableEnd);
|
||||
SetupBytecodeScript(ctx, script);
|
||||
ctx->data[0] = (u32)script;
|
||||
ctx->data[1] = 0;
|
||||
ctx->data[2] = 0;
|
||||
ctx->data[3] = 0;
|
||||
}
|
||||
|
||||
static bool32 RunMysteryEventScriptCommand(struct ScriptContext *ctx)
|
||||
{
|
||||
if (RunScriptCommand(ctx) && ctx->data[3])
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_8153870(u8 *script)
|
||||
{
|
||||
InitMysteryEventScript(&sMysteryEventScriptContext, script);
|
||||
}
|
||||
|
||||
bool32 sub_8153884(u32 *a0)
|
||||
{
|
||||
bool32 ret = RunMysteryEventScriptCommand(&sMysteryEventScriptContext);
|
||||
*a0 = sMysteryEventScriptContext.data[2];
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 RunMysteryEventScript(u8 *script)
|
||||
{
|
||||
struct ScriptContext *ctx = &sMysteryEventScriptContext;
|
||||
InitMysteryEventScript(ctx, script);
|
||||
while (RunMysteryEventScriptCommand(ctx));
|
||||
|
||||
return ctx->data[2];
|
||||
}
|
||||
|
||||
void SetMysteryEventScriptStatus(u32 val)
|
||||
{
|
||||
sMysteryEventScriptContext.data[2] = val;
|
||||
}
|
||||
|
||||
static int CalcRecordMixingGiftChecksum(void)
|
||||
{
|
||||
unsigned int i;
|
||||
int sum = 0;
|
||||
u8 *data = (u8*)(&gSaveBlock1Ptr->recordMixingGift.data);
|
||||
|
||||
for (i = 0; i < sizeof(gSaveBlock1Ptr->recordMixingGift.data); i++)
|
||||
sum += data[i];
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
static bool32 IsRecordMixingGiftValid(void)
|
||||
{
|
||||
struct RecordMixingGiftData *data = &gSaveBlock1Ptr->recordMixingGift.data;
|
||||
int checksum = CalcRecordMixingGiftChecksum();
|
||||
|
||||
if (data->unk0 == 0
|
||||
|| data->quantity == 0
|
||||
|| data->itemId == 0
|
||||
|| checksum == 0
|
||||
|| checksum != gSaveBlock1Ptr->recordMixingGift.checksum)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void ClearRecordMixingGift(void)
|
||||
{
|
||||
CpuFill16(0, &gSaveBlock1Ptr->recordMixingGift, sizeof(gSaveBlock1Ptr->recordMixingGift));
|
||||
}
|
||||
|
||||
static void SetRecordMixingGift(u8 unk, u8 quantity, u16 itemId)
|
||||
{
|
||||
if (!unk || !quantity || !itemId)
|
||||
{
|
||||
ClearRecordMixingGift();
|
||||
}
|
||||
else
|
||||
{
|
||||
gSaveBlock1Ptr->recordMixingGift.data.unk0 = unk;
|
||||
gSaveBlock1Ptr->recordMixingGift.data.quantity = quantity;
|
||||
gSaveBlock1Ptr->recordMixingGift.data.itemId = itemId;
|
||||
gSaveBlock1Ptr->recordMixingGift.checksum = CalcRecordMixingGiftChecksum();
|
||||
}
|
||||
}
|
||||
|
||||
u16 GetRecordMixingGift(void)
|
||||
{
|
||||
struct RecordMixingGiftData *data = &gSaveBlock1Ptr->recordMixingGift.data;
|
||||
|
||||
if (!IsRecordMixingGiftValid())
|
||||
{
|
||||
ClearRecordMixingGift();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
u16 itemId = data->itemId;
|
||||
data->quantity--;
|
||||
if (data->quantity == 0)
|
||||
ClearRecordMixingGift();
|
||||
else
|
||||
gSaveBlock1Ptr->recordMixingGift.checksum = CalcRecordMixingGiftChecksum();
|
||||
|
||||
return itemId;
|
||||
}
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_end(struct ScriptContext *ctx)
|
||||
{
|
||||
StopScript(ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_checkcompat(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 v1;
|
||||
u32 v2;
|
||||
u16 v3;
|
||||
u32 v4;
|
||||
|
||||
ctx->data[1] = ScriptReadWord(ctx);
|
||||
v1 = ScriptReadHalfword(ctx);
|
||||
v2 = ScriptReadWord(ctx);
|
||||
v3 = ScriptReadHalfword(ctx);
|
||||
v4 = ScriptReadWord(ctx);
|
||||
|
||||
if (CheckCompatibility(v1, v2, v3, v4) == TRUE)
|
||||
ctx->data[3] = 1;
|
||||
else
|
||||
SetIncompatible();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_nop(struct ScriptContext *ctx)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_setstatus(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 value = ScriptReadByte(ctx);
|
||||
ctx->data[2] = value;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_setmsg(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 value = ScriptReadByte(ctx);
|
||||
u8 *str = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
if (value == 0xFF || value == ctx->data[2])
|
||||
StringExpandPlaceholders(gStringVar4, str);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_runscript(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
ScriptContext2_RunNewScript(script);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_setenigmaberry(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 *str;
|
||||
const u8 *message;
|
||||
bool32 haveBerry = IsEnigmaBerryValid();
|
||||
u8 *berry = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
StringCopyN(gStringVar1, gSaveBlock1Ptr->enigmaBerry.berry.name, BERRY_NAME_COUNT);
|
||||
SetEnigmaBerry(berry);
|
||||
StringCopyN(gStringVar2, gSaveBlock1Ptr->enigmaBerry.berry.name, BERRY_NAME_COUNT);
|
||||
|
||||
if (!haveBerry)
|
||||
{
|
||||
str = gStringVar4;
|
||||
message = gText_MysteryGiftBerry;
|
||||
}
|
||||
else if (StringCompare(gStringVar1, gStringVar2))
|
||||
{
|
||||
str = gStringVar4;
|
||||
message = gText_MysteryGiftBerryTransform;
|
||||
}
|
||||
else
|
||||
{
|
||||
str = gStringVar4;
|
||||
message = gText_MysteryGiftBerryObtained;
|
||||
}
|
||||
|
||||
StringExpandPlaceholders(str, message);
|
||||
|
||||
ctx->data[2] = 2;
|
||||
|
||||
if (IsEnigmaBerryValid() == TRUE)
|
||||
VarSet(VAR_ENIGMA_BERRY_AVAILABLE, 1);
|
||||
else
|
||||
ctx->data[2] = 1;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_giveribbon(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 index = ScriptReadByte(ctx);
|
||||
u8 ribbonId = ScriptReadByte(ctx);
|
||||
GiveGiftRibbonToParty(index, ribbonId);
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryGiftSpecialRibbon);
|
||||
ctx->data[2] = 2;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_initramscript(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 mapGroup = ScriptReadByte(ctx);
|
||||
u8 mapNum = ScriptReadByte(ctx);
|
||||
u8 objectId = ScriptReadByte(ctx);
|
||||
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
u8 *scriptEnd = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
InitRamScript(script, scriptEnd - script, mapGroup, mapNum, objectId);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_givenationaldex(struct ScriptContext *ctx)
|
||||
{
|
||||
EnableNationalPokedex();
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryGiftNationalDex);
|
||||
ctx->data[2] = 2;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_addrareword(struct ScriptContext *ctx)
|
||||
{
|
||||
sub_811EFC0(ScriptReadByte(ctx));
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryGiftRareWord);
|
||||
ctx->data[2] = 2;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_setrecordmixinggift(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 unk = ScriptReadByte(ctx);
|
||||
u8 quantity = ScriptReadByte(ctx);
|
||||
u16 itemId = ScriptReadHalfword(ctx);
|
||||
SetRecordMixingGift(unk, quantity, itemId);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
|
||||
{
|
||||
struct MailStruct mail;
|
||||
struct Pokemon pokemon;
|
||||
u16 species;
|
||||
u16 heldItem;
|
||||
u32 data = ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0];
|
||||
void *pokemonPtr = (void *)data;
|
||||
void *mailPtr = (void *)(data + sizeof(struct Pokemon));
|
||||
|
||||
pokemon = *(struct Pokemon *)pokemonPtr;
|
||||
species = GetMonData(&pokemon, MON_DATA_SPECIES2);
|
||||
|
||||
if (species == SPECIES_EGG)
|
||||
StringCopyN(gStringVar1, gText_EggNickname, POKEMON_NAME_LENGTH + 1);
|
||||
else
|
||||
StringCopyN(gStringVar1, gText_Pokemon, POKEMON_NAME_LENGTH + 1);
|
||||
|
||||
if (gPlayerPartyCount == PARTY_SIZE)
|
||||
{
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryGiftFullParty);
|
||||
ctx->data[2] = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&gPlayerParty[5], pokemonPtr, sizeof(struct Pokemon));
|
||||
memcpy(&mail, mailPtr, sizeof(struct MailStruct));
|
||||
|
||||
if (species != SPECIES_EGG)
|
||||
{
|
||||
u16 pokedexNum = SpeciesToNationalPokedexNum(species);
|
||||
GetSetPokedexFlag(pokedexNum, FLAG_SET_SEEN);
|
||||
GetSetPokedexFlag(pokedexNum, FLAG_SET_CAUGHT);
|
||||
}
|
||||
|
||||
heldItem = GetMonData(&gPlayerParty[5], MON_DATA_HELD_ITEM);
|
||||
if (ItemIsMail(heldItem))
|
||||
GiveMailToMon2(&gPlayerParty[5], &mail);
|
||||
CompactPartySlots();
|
||||
CalculatePlayerPartyCount();
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryGiftSentOver);
|
||||
ctx->data[2] = 2;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_addtrainer(struct ScriptContext *ctx)
|
||||
{
|
||||
u32 data = ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0];
|
||||
memcpy((void*)(gSaveBlock2Ptr) + 0xBEC, (void *)data, 0xBC);
|
||||
ValidateEReaderTrainer();
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryGiftNewTrainer);
|
||||
ctx->data[2] = 2;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_enableresetrtc(struct ScriptContext *ctx)
|
||||
{
|
||||
EnableResetRTC();
|
||||
StringExpandPlaceholders(gStringVar4, gText_InGameClockUsable);
|
||||
ctx->data[2] = 2;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_checksum(struct ScriptContext *ctx)
|
||||
{
|
||||
int checksum = ScriptReadWord(ctx);
|
||||
u8 *data = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
u8 *dataEnd = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
if (checksum != CalcByteArraySum(data, dataEnd - data))
|
||||
{
|
||||
ctx->data[3] = 0;
|
||||
ctx->data[2] = 1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_crc(struct ScriptContext *ctx)
|
||||
{
|
||||
int crc = ScriptReadWord(ctx);
|
||||
u8 *data = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
u8 *dataEnd = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
if (crc != CalcCRC16(data, dataEnd - data))
|
||||
{
|
||||
ctx->data[3] = 0;
|
||||
ctx->data[2] = 1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
@ -1230,8 +1230,7 @@ gUnknown_0203ABB8: @ 203ABB8
|
||||
|
||||
.space 0x4 /*unused var?*/
|
||||
|
||||
gUnknown_0203BBC0: @ 203BBC0
|
||||
.space 0x74
|
||||
.include "src/mystery_event_script.o"
|
||||
|
||||
gUnknown_0203BC34: @ 203BC34
|
||||
.space 0x4
|
||||
|
Loading…
x
Reference in New Issue
Block a user