diff options
-rw-r--r-- | asm/unk_debug_menu_3.s | 25 | ||||
-rw-r--r-- | data/debug_menu_3.s | 316 | ||||
-rw-r--r-- | data/scripts/maps/LilycoveCity_Harbor.inc | 2 | ||||
-rw-r--r-- | data/scripts/maps/SouthernIsland_Interior.inc | 4 | ||||
-rw-r--r-- | include/constants/flags.h | 2 | ||||
-rw-r--r-- | include/macros.inc | 1 | ||||
-rw-r--r-- | include/macros/event.inc | 1 | ||||
-rw-r--r-- | include/macros/me_script.inc | 88 | ||||
-rw-r--r-- | include/mystery_event_script.h | 4 | ||||
-rw-r--r-- | include/util.h | 2 | ||||
-rw-r--r-- | ld_script.txt | 2 | ||||
-rw-r--r-- | src/debug/unk_debug_menu_3.c | 18 | ||||
-rw-r--r-- | src/mystery_event_script.c | 6 | ||||
-rw-r--r-- | src/util.c | 2 |
14 files changed, 380 insertions, 93 deletions
diff --git a/asm/unk_debug_menu_3.s b/asm/unk_debug_menu_3.s index aa156a99b..968c53b11 100644 --- a/asm/unk_debug_menu_3.s +++ b/asm/unk_debug_menu_3.s @@ -5,31 +5,6 @@ .text - thumb_func_start debug_sub_813C404 -debug_sub_813C404: - push {r4, r5, r6, lr} - add r6, r0, #0 - ldr r5, ._1 @ gUnknown_Debug_845DDB2 - ldr r4, ._1 + 4 @ gUnknown_Debug_845DAE1 - sub r5, r5, r4 - add r1, r4, #0 - add r2, r5, #0 - bl memcpy - add r0, r6, #0 - add r1, r4, #0 - bl unref_sub_812620C - add r0, r5, #0 - pop {r4, r5, r6} - pop {r1} - bx r1 -._2: - .align 2, 0 -._1: - .word gUnknown_Debug_845DDB2 - .word gUnknown_Debug_845DAE1 - - thumb_func_end debug_sub_813C404 - thumb_func_start debug_sub_813C430 debug_sub_813C430: push {r4, r5, r6, lr} diff --git a/data/debug_menu_3.s b/data/debug_menu_3.s index ed4bb599b..3652b1dc6 100644 --- a/data/debug_menu_3.s +++ b/data/debug_menu_3.s @@ -1,106 +1,304 @@ .if DEBUG - +#include "constants/decorations.h" +#include "constants/flags.h" +#include "constants/game_stat.h" +#include "constants/items.h" +#include "constants/map_objects.h" +#include "constants/maps.h" +#include "constants/moves.h" +#include "constants/opponents.h" +#include "constants/songs.h" +#include "constants/species.h" +#include "constants/weather.h" +#include "constants/vars.h" .include "include/macros.inc" .include "constants/constants.inc" + .include "include/macros/event.inc" .section .rodata gUnknown_Debug_845DAE1:: - .byte 0x01, 0xe1, 0xda, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xff, 0xda, 0x45, 0x08, 0xb2, 0xdd, 0x45, 0x08, 0x06, 0x08 - .byte 0x01, 0x01, 0x56, 0xdb, 0x45, 0x08, 0x0d, 0xdd, 0x45, 0x08, 0x0b, 0x01, 0x05, 0x13, 0x01, 0x05, 0x0d, 0xdd, 0x45, 0x08, 0x02, 0xc6, 0xd5, 0xe9, 0xda, 0x00, 0xe9, 0xe2, 0xd8, 0x00, 0xd6, 0xd9 - .byte 0xe7, 0xe9, 0xd7, 0xdc, 0xd9, 0x00, 0xd8, 0xd9, 0xdd, 0xe2, 0xd9, 0xe2, 0x00, 0xd0, 0xd5, 0xe8, 0xd9, 0xe6, 0x00, 0xdd, 0xe2, 0x00, 0xd8, 0xd9, 0xe6, 0xfe, 0xbb, 0xcc, 0xbf, 0xc8, 0xbb, 0x00 - .byte 0xea, 0xe3, 0xe2, 0x00, 0xbc, 0xc6, 0xf3, 0xce, 0xbf, 0xc8, 0xbc, 0xcf, 0xcc, 0xc1, 0x00, 0xbd, 0xc3, 0xce, 0xd3, 0xad, 0xff, 0xb8, 0x56, 0xdb, 0x45, 0x08, 0x47, 0x13, 0x01, 0x01, 0x00, 0x21 - .byte 0x0d, 0x80, 0x01, 0x00, 0xbb, 0x01, 0xb4, 0xdb, 0x45, 0x08, 0x4a, 0x13, 0x01, 0x01, 0x00, 0x21, 0x0d, 0x80, 0x01, 0x00,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d9, 0xe0, 0xe8, 0x00, 0xeb, 0xd9, 0xe6, 0xd8, 0xd9, 0xe2, 0xad, 0xff, 0xbe, 0xd9, 0xdd, 0xe2, 0xd9, 0x00, 0xbc, 0xbb, 0xcd, 0xc3, 0xcd, 0xae - .byte 0xce, 0xbb, 0xcd, 0xbd, 0xc2, 0xbf, 0x00, 0xdd, 0xe7, 0xe8, 0x00, 0xea, 0xe3, 0xe0, 0xe0, 0xad, 0xff + me_checkcompat gUnknown_Debug_845DAE1, 0x4, 0x4, 0x4, 0x80 + me_crc 0x0, _0845DAFF, _0845DAFFEnd +_0845DAFF: + me_initramscript MAP_PETALBURG_CITY_GYM, 0x1, _845DB56, _845DB56End + me_setrecordmixinggift 0x1, 0x5, ITEM_EON_TICKET + me_runscript _0845DD0D + me_end + +_0845DB16: + .string "Lauf und besuche deinen Vater in der\n" + .string "ARENA von BLÜTENBURG CITY.$" + +_845DB56: + setvaddress _845DB56 + checkitem ITEM_EON_TICKET, 0x1 + compare RESULT, 0x1 + vgoto_if 0x1, _0845DBB4 + checkpcitem ITEM_EON_TICKET, 0x1 + compare RESULT, 0x1 + vgoto_if 0x1, _0845DBB4 + checkflag FLAG_ENCOUNTERED_LATIAS_OR_LATIOS + vgoto_if 0x1, _0845DBB4 + lock + faceplayer + vmessage _0845DBBE + waitmessage + waitbuttonpress + checkitemspace ITEM_EON_TICKET, 0x1 + compare RESULT, 0x0 + vgoto_if 0x1, _0845DBB5 + setorcopyvar VAR_SPECIAL_0, ITEM_EON_TICKET + setorcopyvar VAR_SPECIAL_1, 0x1 + callstd 0x0 + setflag FLAG_SYS_HAS_EON_TICKET + vmessage _0845DC00 + waitmessage + waitbuttonpress + release +_0845DBB4: + killscript +_0845DBB5: + vmessage _0845DC94 + waitmessage + waitbuttonpress + release + end + +_0845DBBE: + .string "VATER: {PLAYER}! Schön, dich zu sehen!\n" + .string "Hier ist ein Brief für dich, {PLAYER}.$" + +_0845DC00: + .string "VATER: Ich bin mir nicht sicher, es\n" + .string "könnte ein TICKET für eine Fähre sein.\p" + .string "Du solltest nach SEEGRASULB CITY gehen\n" + .string "und dich dort genauer erkundigen.$" + +_0845DC94: + .string "VATER: {PLAYER}, die BASIS-TASCHE\n" + .string "deines BEUTELS ist voll.\p" + .string "Lagere einige deiner Basis-Items in\n" + .string "deinem PC und komm dann wieder.$" +_845DB56End: + .size _845DB56, _845DB56End - _845DB56 + +_0845DD0D: + setvaddress _0845DD0D + checkitem ITEM_EON_TICKET, 0x1 + compare RESULT, 0x1 + vgoto_if 0x1, _0845DD53 + checkpcitem ITEM_EON_TICKET, 0x1 + compare RESULT, 0x1 + vgoto_if 0x1, _0845DD53 + checkflag FLAG_ENCOUNTERED_LATIAS_OR_LATIOS + vgoto_if 0x1, _0845DD53 + checkitemspace ITEM_EON_TICKET, 0x1 + compare RESULT, 0x0 + vgoto_if 0x1, _0845DD5B + vloadptr _0845DB16 + setmysteryeventstatus 0x2 + end + +_0845DD53: + vloadptr _0845DD63 + setmysteryeventstatus 0x3 + end + +_0845DD5B: + vloadptr _0845DD95 + setmysteryeventstatus 0x3 + end + +_0845DD63: + .string "Dieses GESCHEHEN kann nur einmal\n" + .string "gespielt werden.$" + +_0845DD95: + .string "Deine BASIS-TASCHE ist voll.$" +_0845DAFFEnd: + .size _0845DAFF, _0845DAFFEnd - _0845DAFF +gUnknown_Debug_845DAE1End:: gUnknown_Debug_845DDB2:: - .byte 0x01, 0xb2, 0xdd, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xdd, 0x45, 0x08, 0x06, 0xe3, 0x45, 0x08, 0x07, 0xd6 - .byte 0xdd, 0x45, 0x08, 0x02 + me_checkcompat gUnknown_Debug_845DDB2, 4, 4, 4, 0x80 + me_checksum 0x0, _0845DDD0, _0845DDD0End +_0845DDD0: + me_setenigmaberry gUnknown_Debug_845DDD6 + me_end gUnknown_Debug_845DDD6:: .space 0x530 +_0845DDD0End: + .size _0845DDD0, _0845DDD0End - _0845DDD0 gUnknown_Debug_845E306:: - .byte 0x01, 0x06, 0xe3, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x05, 0x29, 0xe3, 0x45, 0x08, 0x03, 0x02, 0x4f, 0xe3, 0x45, 0x08, 0x03, 0x03, 0x87, 0xe3 - .byte 0x45, 0x08, 0x02, 0xb8, 0x29, 0xe3, 0x45, 0x08, 0x43, 0x21, 0x0d, 0x80, 0x06, 0x00, 0xbb, 0x01, 0x4c, 0xe3, 0x45, 0x08, 0x79, 0x45, 0x01, 0x0f, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x0e, 0x02, 0x02, 0x0e, 0x03, 0x02, 0xbf, 0xdd, 0xe2, 0x00, 0xca, 0xc9, 0xc5, 0x1b, 0xc7, 0xc9, 0xc8, 0x00, 0xeb, 0xe9, 0xe6, 0xd8, 0xd9, 0x00, 0xdd, 0xe2, 0x00, 0xd8, 0xd5 - .byte 0xe7, 0x00, 0xce, 0xd9, 0xd5, 0xe1, 0x00, 0xd8, 0xd9, 0xe7, 0xfe, 0xcd, 0xe4, 0xdd, 0xd9, 0xe0, 0xd9, 0xe6, 0xe7, 0x00, 0xd5, 0xe9, 0xda, 0xdb, 0xd9, 0xe2, 0xe3, 0xe1, 0xe1, 0xd9, 0xe2, 0xad - .byte 0xff, 0xbe, 0xd5, 0xe7, 0x00, 0xce, 0xd9, 0xd5, 0xe1, 0x00, 0xd8, 0xd9, 0xe7, 0x00, 0xcd, 0xe4, 0xdd, 0xd9, 0xe0, 0xd9, 0xe6, 0xe7, 0x00, 0xdd, 0xe7, 0xe8, 0x00, 0xea, 0xe3, 0xe0, 0xe0, 0xe7 - .byte 0xe8, 0xf4, 0xe2, 0xd8, 0xdd, 0xdb, 0xad, 0xfe, 0xbf, 0xe7, 0x00, 0xdf, 0xd5, 0xe2, 0xe2, 0x00, 0xdf, 0xd9, 0xdd, 0xe2, 0x00, 0xeb, 0xd9, 0xdd, 0xe8, 0xd9, 0xe6, 0xd9, 0xe7, 0x00, 0xca, 0xc9 - .byte 0xc5, 0x1b, 0xc7, 0xc9, 0xc8, 0xfa, 0xd5, 0xe9, 0xda, 0xdb, 0xd9, 0xe2, 0xe3, 0xe1, 0xe1, 0xd9, 0xe2, 0x00, 0xeb, 0xd9, 0xe6, 0xd8, 0xd9, 0xe2, 0xad, 0xff + me_checkcompat gUnknown_Debug_845E306, 0x4, 0x4, 0x4, 0x80 + me_runscript _0845E329 + me_setmsg 0x2, _0845E34F + me_setmsg 0x3, _0845E387 + me_end + +_0845E329: + setvaddress _0845E329 + getpartysize + compare RESULT, 0x6 + vgoto_if 0x1, _0845E34C + givemon SPECIES_LUVDISC, 15, ITEM_BERRY_JUICE, 0x0, 0x0, 0x0 + setmysteryeventstatus 0x2 + end + +_0845E34C: + setmysteryeventstatus 0x3 + end + +_0845E34F: + .string "Ein POKéMON wurde in das Team des\n" + .string "Spielers aufgenommen.$" + +_0845E387: + .string "Das Team des Spielers ist vollständig.\n" + .string "Es kann kein weiteres POKéMON\l" + .string "aufgenommen werden.$" gUnknown_Debug_845E3E0:: - .byte 0x01, 0xe0, 0xe3, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xe3, 0x45, 0x08, 0x02, 0xe4, 0x45, 0x08, 0x08, 0x00 - .byte 0x01, 0x02 + me_checkcompat gUnknown_Debug_845E3E0, 0x4, 0x4, 0x4, 0x80 + me_crc 0x0, _0845E3FE, _0845E3FEEnd +_0845E3FE: + me_giveribbon 0x0, 0x1 + me_end +_0845E3FEEnd: + .size _0845E3FE, _0845E3FEEnd - _0845E3FE gUnknown_Debug_845E402:: - .byte 0x01, 0x02, 0xe4, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x20, 0xe4, 0x45, 0x08, 0x22, 0xe4, 0x45, 0x08, 0x09, 0x02 + me_checkcompat gUnknown_Debug_845E402, 0x4, 0x4, 0x4, 0x80 + me_crc 0x0, _0845E420, _0845E420End +_0845E420: + me_givenationaldex + me_end +_0845E420End: + .size _0845E420, _0845E420End - _0845E420 gUnknown_Debug_845E422:: - .byte 0x01, 0x22, 0xe4, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0xe4, 0x45, 0x08, 0x43, 0xe4, 0x45, 0x08, 0x0a, 0x01 - .byte 0x02 + me_checkcompat gUnknown_Debug_845E422, 0x4, 0x4, 0x4, 0x80 + me_crc 0x0, _0845E440, _0845E440End +_0845E440: + me_addrareword 0x1 + me_end +_0845E440End: + .size _0845E440, _0845E440End - _0845E440 gUnknown_Debug_845E443:: - .byte 0x01, 0x43, 0xe4, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x61, 0xe4, 0x45, 0x08, 0xef, 0xe4, 0x45, 0x08, 0x0c, 0x67 - .byte 0xe4, 0x45, 0x08, 0x02 + me_checkcompat gUnknown_Debug_845E443, 0x4, 0x4, 0x4, 0x80 + me_crc 0x0, _0845E461, _0845E461End +_0845E461: + me_givepokemon gUnknown_Debug_845E467 + me_end gUnknown_Debug_845E467:: .space 100 gUnknown_Debug_845E4CB:: .space 36 +_0845E461End: + .size _0845E461, _0845E461End - _0845E461 gUnknown_Debug_845E4EF:: - .byte 0x01, 0xef, 0xe4, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0d, 0x06, 0xe5, 0x45, 0x08, 0x02 + me_checkcompat gUnknown_Debug_845E4EF, 0x4, 0x4, 0x4, 0x80 + me_addtrainer gUnknown_Debug_845E506 + me_end gUnknown_Debug_845E506:: .space 256 gUnknown_Debug_845E606:: - .byte 0x01, 0x06, 0xe6, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0e, 0x02 + me_checkcompat gUnknown_Debug_845E606, 0x4, 0x4, 0x4, 0x80 + me_enableresetrtc + me_end gUnknown_Debug_845E619:: - .byte 0x01, 0x19, 0xe6, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x37, 0xe6, 0x45, 0x08, 0x12, 0xe7, 0x45, 0x08, 0x06, 0x08 - .byte 0x01, 0x01, 0x83, 0xe6, 0x45, 0x08, 0x12, 0xe7, 0x45, 0x08, 0x03, 0xff, 0x4c, 0xe6, 0x45, 0x08, 0x04, 0x02, 0x02, 0xbc, 0xd9, 0xe7, 0xe9, 0xd7, 0xdc, 0xd9, 0x00, 0xd8, 0xd9, 0xdd, 0xe2, 0xd9 - .byte 0xe2, 0x00, 0xd0, 0xd5, 0xe8, 0xd9, 0xe6, 0x00, 0xdd, 0xe2, 0x00, 0xd8, 0xd9, 0xe6, 0x00, 0xbb, 0xcc, 0xbf, 0xc8, 0xbb, 0xfe, 0xea, 0xe3, 0xe2, 0x00, 0xbc, 0xc6, 0xf3, 0xce, 0xbf, 0xc8, 0xbc - .byte 0xcf, 0xcc, 0xc1, 0x00, 0xbd, 0xc3, 0xce, 0xd3, 0xad, 0xff, 0xb8, 0x83, 0xe6, 0x45, 0x08, 0x47, 0xa9, 0x00, 0x01, 0x00, 0x21, 0x0d, 0x80, 0x01, 0x00, 0xbb, 0x01, 0xbf, 0xe6, 0x45, 0x08, 0x4a - .byte 0xa9, 0x00, 0x01, 0x00, 0x21, 0x0d, 0x80, 0x01, 0x00, 0xbb, 0x01, 0xbf, 0xe6, 0x45, 0x08, 0x6a, 0x5a, 0xbd, 0xc0, 0xe6, 0x45, 0x08, 0x66, 0x6d, 0x1a, 0x00, 0x80, 0xa9, 0x00, 0x1a, 0x01, 0x80 - .byte 0x01, 0x00, 0x09, 0x00, 0x6c, 0x0d, 0x0c, 0xd0, 0xbb, 0xce, 0xbf, 0xcc, 0xf0, 0x00, 0xc2, 0xdd, 0xb8, 0x00, 0xfd, 0x01, 0xab, 0xfb, 0xc3, 0xd7, 0xdc, 0x00, 0xdc, 0xd5, 0xd6, 0xd9, 0x00, 0xdb - .byte 0xd9, 0xe6, 0xd5, 0xd8, 0xd9, 0x00, 0xd8, 0xdd, 0xd9, 0xe7, 0xd9, 0x00, 0xe7, 0xd9, 0xe0, 0xe8, 0xd9, 0xe2, 0xd9, 0x00, 0xbc, 0xbf, 0xbf, 0xcc, 0xbf, 0xfe, 0xd9, 0xe6, 0xdc, 0xd5, 0xe0, 0xe8 - .byte 0xd9, 0xe2, 0xad, 0x00, 0xc3, 0xd7, 0xdc, 0x00, 0xe7, 0xd7, 0xdc, 0xd9, 0xe2, 0xdf, 0xd9, 0x00, 0xe7, 0xdd, 0xd9, 0x00, 0xd8, 0xdd, 0xe6, 0xab, 0xff + me_checkcompat gUnknown_Debug_845E619, 0x4, 0x4, 0x4, 0x80 + me_checksum 0x0, _0845E637, _0845E637End +_0845E637: + me_initramscript MAP_PETALBURG_CITY_GYM, 0x1, _0845E683, _0845E683End + me_setmsg 0xff, _0845E64C + me_setstatus 0x2 + me_end + +_0845E64C: + .string "Besuche deinen Vater in der ARENA\n" + .string "von BLÜTENBURG CITY.$" + +_0845E683: + setvaddress _0845E683 + checkitem ITEM_GANLON_BERRY, 0x1 + compare RESULT, 0x1 + vgoto_if 0x1, _0845E6BF + checkpcitem ITEM_GANLON_BERRY, 0x1 + compare RESULT, 0x1 + vgoto_if 0x1, _0845E6BF + lock + faceplayer + vmessage _0845E6C0 + waitmessage + waitbuttonpress + setorcopyvar VAR_SPECIAL_0, ITEM_GANLON_BERRY + setorcopyvar VAR_SPECIAL_1, 0x1 + callstd 0x0 + release + killscript +_0845E6BF: + gotoram + +_0845E6C0: + .string "VATER: Hi, {PLAYER}!\p" + .string "Ich habe gerade diese seltene BEERE\n" + .string "erhalten. Ich schenke sie dir!$" +_0845E637End: + .size _0845E637, _0845E637End - _0845E637 +_0845E683End: + .size _0845E683, _0845E683End - _0845E683 gUnknown_Debug_845E712:: - .byte 0x01, 0x12, 0xe7, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe7, 0x45, 0x08, 0x97, 0xe7, 0x45, 0x08, 0x05, 0x36 - .byte 0xe7, 0x45, 0x08, 0x02, 0xb8, 0x36, 0xe7, 0x45, 0x08, 0x81, 0x00, 0x78, 0x00, 0x4b, 0x78, 0x00, 0x21, 0x0d, 0x80, 0x00, 0x00, 0xbb, 0x01, 0x55, 0xe7, 0x45, 0x08, 0xbe, 0x5d, 0xe7, 0x45, 0x08 - .byte 0x0e, 0x02, 0x02, 0xbe, 0x71, 0xe7, 0x45, 0x08, 0x0e, 0x03, 0x02, 0xfd, 0x02, 0x00, 0xeb, 0xe9, 0xe6, 0xd8, 0xd9, 0x00, 0xf6, 0xd6, 0xd9, 0xe6, 0xdb, 0xd9, 0xd6, 0xd9, 0xe2, 0xad, 0xff, 0xbf - .byte 0xe7, 0x00, 0xdd, 0xe7, 0xe8, 0x00, 0xdf, 0xd9, 0xdd, 0xe2, 0x00, 0xca, 0xe0, 0xd5, 0xe8, 0xee, 0x00, 0xda, 0xf6, 0xe6, 0x00, 0xfd, 0x02, 0xfe, 0xea, 0xe3, 0xe6, 0xdc, 0xd5, 0xe2, 0xd8, 0xd9 - .byte 0xe2, 0xad, 0xad, 0xad, 0xff + me_checkcompat gUnknown_Debug_845E712, 0x4, 0x4, 0x4, 0x80 + me_crc 0x0, _0845E730, _0845E730End +_0845E730: + me_runscript _0845E736 + me_end +_0845E730End: + .size _0845E730, _0845E730End - _0845E730 -gUnknown_Debug_845E797:: - .byte 0x01, 0x97, 0xe7, 0x45, 0x08, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xe7, 0x45, 0x08, 0xbb, 0xe7, 0x45, 0x08 +_0845E736: + setvaddress _0845E736 + bufferdecorationname 0x0, DECOR_REGISTEEL_DOLL + givedecoration DECOR_REGISTEEL_DOLL + compare RESULT, 0x0 + vgoto_if 0x1, _0845E755 + vloadptr _0845E75D + setmysteryeventstatus 0x2 + end + +_0845E755: + vloadptr _0845E771 + setmysteryeventstatus 0x3 + end + +_0845E75D: + .string "{STR_VAR_1} wurde übergeben.$" +_0845E771: + .string "Es ist kein Platz für {STR_VAR_1}\n" + .string "vorhanden...$" +gUnknown_Debug_845E797:: + me_checkcompat gUnknown_Debug_845E797, 0x4, 0x4, 0x4, 0x80 + me_crc 0x0, gUnknown_Debug_845E7B5, gUnknown_Debug_845E7B5End gUnknown_Debug_845E7B5:: - .byte 0x0b, 0x01, 0x03, 0x0d, 0x00, 0x02 + me_setrecordmixinggift 0x1, 0x3, ITEM_POTION + me_end +gUnknown_Debug_845E7B5End: + .size gUnknown_Debug_845E7B5, gUnknown_Debug_845E7B5End - gUnknown_Debug_845E7B5 gUnknown_Debug_845E7BB:: .byte 0x00 .endif - diff --git a/data/scripts/maps/LilycoveCity_Harbor.inc b/data/scripts/maps/LilycoveCity_Harbor.inc index 5dc217585..d32107396 100644 --- a/data/scripts/maps/LilycoveCity_Harbor.inc +++ b/data/scripts/maps/LilycoveCity_Harbor.inc @@ -106,7 +106,7 @@ LilycoveCity_Harbor_EventScript_1599E4:: @ 81599E4 LilycoveCity_Harbor_EventScript_1599EE:: @ 81599EE goto_if_unset FLAG_SYS_GAME_CLEAR, LilycoveCity_Harbor_EventScript_1598BA - goto_if_set FLAG_ECOUNTERED_LATIAS_OR_LATIOS, LilycoveCity_Harbor_EventScript_1598BA + goto_if_set FLAG_ENCOUNTERED_LATIAS_OR_LATIOS, LilycoveCity_Harbor_EventScript_1598BA goto_if_unset FLAG_SYS_HAS_EON_TICKET, LilycoveCity_Harbor_EventScript_1598BA msgbox LilycoveCity_Harbor_Text_1C50F2, 4 closemessage diff --git a/data/scripts/maps/SouthernIsland_Interior.inc b/data/scripts/maps/SouthernIsland_Interior.inc index 5878a43d5..1a537cfb0 100644 --- a/data/scripts/maps/SouthernIsland_Interior.inc +++ b/data/scripts/maps/SouthernIsland_Interior.inc @@ -43,9 +43,9 @@ SouthernIsland_Interior_EventScript_160B9B:: @ 8160B9B end SouthernIsland_Interior_EventScript_160BA7:: @ 8160BA7 - goto_if_set FLAG_ECOUNTERED_LATIAS_OR_LATIOS, SouthernIsland_Interior_EventScript_160C08 + goto_if_set FLAG_ENCOUNTERED_LATIAS_OR_LATIOS, SouthernIsland_Interior_EventScript_160C08 goto_if_unset FLAG_SYS_HAS_EON_TICKET, SouthernIsland_Interior_EventScript_160C08 - setflag FLAG_ECOUNTERED_LATIAS_OR_LATIOS + setflag FLAG_ENCOUNTERED_LATIAS_OR_LATIOS special SpawnCameraDummy applymovement 127, SouthernIsland_Interior_Movement_160C12 waitmovement 0 diff --git a/include/constants/flags.h b/include/constants/flags.h index a8067f6ca..562741b93 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -158,7 +158,7 @@ #define FLAG_RECEIVED_GREEN_SCARF 0xCB #define FLAG_RECEIVED_YELLOW_SCARF 0xCC -#define FLAG_ECOUNTERED_LATIAS_OR_LATIOS 0xCE +#define FLAG_ENCOUNTERED_LATIAS_OR_LATIOS 0xCE #define FLAG_RECEIVED_BASEMENT_KEY 0xD0 #define FLAG_RECEIVED_TM24 0xD1 diff --git a/include/macros.inc b/include/macros.inc index f34353079..93a029cdd 100644 --- a/include/macros.inc +++ b/include/macros.inc @@ -4,6 +4,7 @@ .include "include/macros/pokemon_data.inc" .include "include/macros/ec.inc" .include "include/macros/map.inc" + .include "include/macros/me_script.inc" .macro region_map_location x, y, width, height, name .byte \x diff --git a/include/macros/event.inc b/include/macros/event.inc index fcbd3a055..a27e1da76 100644 --- a/include/macros/event.inc +++ b/include/macros/event.inc @@ -1236,7 +1236,6 @@ .macro setvaddress long, word .byte 0xb8 .4byte \long - .2byte \word .endm .macro vgoto pointer diff --git a/include/macros/me_script.inc b/include/macros/me_script.inc new file mode 100644 index 000000000..4d5f59d1b --- /dev/null +++ b/include/macros/me_script.inc @@ -0,0 +1,88 @@ + .macro me_nop + .byte 0 + .endm + + .macro me_checkcompat word, v1, v2, v3, v4 + .byte 1 + .4byte \word + .2byte \v1 + .4byte \v2 + .2byte \v3 + .4byte \v4 + .endm + + .macro me_end + .byte 2 + .endm + + .macro me_setmsg value, str + .byte 3 + .byte \value + .4byte \str + .endm + + .macro me_setstatus value + .byte 4 + .byte \value + .endm + + .macro me_runscript script + .byte 5 + .4byte \script + .endm + + .macro me_initramscript mapId, objId, script, end + .byte 6 + map \mapId + .byte \objId + .4byte \script, \end + .endm + + .macro me_setenigmaberry berry + .byte 7 + .4byte \berry + .endm + + .macro me_giveribbon index, ribbonId + .byte 8 + .byte \index, \ribbonId + .endm + + .macro me_givenationaldex + .byte 9 + .endm + + .macro me_addrareword word + .byte 10 + .byte \word + .endm + + .macro me_setrecordmixinggift unk, quantity, itemId + .byte 11 + .byte \unk, \quantity + .2byte \itemId + .endm + + .macro me_givepokemon data + .byte 12 + .4byte \data + .endm + + .macro me_addtrainer data + .byte 13 + .4byte \data + .endm + + .macro me_enableresetrtc + .byte 14 + .endm + + .macro me_checksum checksum, data, dataEnd + .byte 15 + .4byte \checksum, \data, \dataEnd + .endm + + .macro me_crc crc, data, dataEnd + .byte 16 + .4byte \crc, \data, \dataEnd + .endm diff --git a/include/mystery_event_script.h b/include/mystery_event_script.h index ab23a8d00..a92bb6667 100644 --- a/include/mystery_event_script.h +++ b/include/mystery_event_script.h @@ -4,5 +4,9 @@ u32 RunMysteryEventScript(u8 *); void SetMysteryEventScriptStatus(u32 val); u16 GetRecordMixingGift(void); +#if DEBUG +bool8 unref_sub_812620C(u8 *a1, const u8 * _a2); +bool8 unref_sub_81261B4(u8 *a1, const u8 * _a2); +#endif // DEBUG #endif // GUARD_MYSTERY_EVENT_SCRIPT_H diff --git a/include/util.h b/include/util.h index 676c3bd9b..02c503f75 100644 --- a/include/util.h +++ b/include/util.h @@ -9,7 +9,7 @@ extern const u32 gBitTable[]; u8 CreateInvisibleSpriteWithCallback(void (*)(struct Sprite *)); void StoreWordInTwoHalfwords(u16 *, u32); void LoadWordFromTwoHalfwords(u16 *, u32 *); -u16 CalcCRC16(u8 *data, int length); +u16 CalcCRC16(const u8 *data, int length); void DoBgAffineSet(struct BgAffineDstData *dest, u32 texX, u32 texY, s16 scrX, s16 scrY, s16 sx, s16 sy, u16 alpha); void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output); diff --git a/ld_script.txt b/ld_script.txt index c0fd24b80..56d1ac39f 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -363,6 +363,7 @@ SECTIONS { src/unused_8124F94.o(.text); src/save.o(.text); src/mystery_event_script.o(.text); + src/debug/unk_debug_menu_3.o(.text); asm/unk_debug_menu_3.o(.text); src/field_effect_helpers.o(.text); src/contest_ai.o(.text); @@ -647,6 +648,7 @@ SECTIONS { src/choose_party.o(.rodata); src/cable_car.o(.rodata); src/save.o(.rodata); + src/debug/unk_debug_menu_3.o(.rodata); data/unk_debug_menu_3.o(.rodata); src/field_effect_helpers.o(.rodata); src/contest_ai.o(.rodata); diff --git a/src/debug/unk_debug_menu_3.c b/src/debug/unk_debug_menu_3.c new file mode 100644 index 000000000..8603cb1e7 --- /dev/null +++ b/src/debug/unk_debug_menu_3.c @@ -0,0 +1,18 @@ +#if DEBUG + +#include "global.h" +#include "debug.h" +#include "mystery_event_script.h" + +extern const u8 gUnknown_Debug_845DAE1[]; +extern const u8 gUnknown_Debug_845DAE1End[]; + +size_t debug_sub_813C404(void * dest) +{ + size_t size = gUnknown_Debug_845DAE1End - gUnknown_Debug_845DAE1; + memcpy(dest, gUnknown_Debug_845DAE1, size); + unref_sub_812620C(dest, gUnknown_Debug_845DAE1); + return size; +} + +#endif // DEBUG diff --git a/src/mystery_event_script.c b/src/mystery_event_script.c index 6fcad66ac..83aa90102 100644 --- a/src/mystery_event_script.c +++ b/src/mystery_event_script.c @@ -114,8 +114,9 @@ static void SetWord(u8 *ptr, u32 val) ptr[3] = val >> 24; } -bool8 unref_sub_81261B4(u8 *a1, int a2) +bool8 unref_sub_81261B4(u8 *a1, const u8 * _a2) { + int a2 = (int)_a2; if (a1[0x0] == 1 && a1[0x11] == 15 && !GetWord(a1 + 0x12)) { int v4 = GetWord(a1 + 0x16) - a2 + (int)a1; @@ -128,8 +129,9 @@ bool8 unref_sub_81261B4(u8 *a1, int a2) return FALSE; } -bool8 unref_sub_812620C(u8 *a1, int a2) +bool8 unref_sub_812620C(u8 *a1, const u8 * _a2) { + int a2 = (int)_a2; if (a1[0x0] == 1 && a1[0x11] == 16 && !GetWord(a1 + 0x12)) { int v4 = GetWord(a1 + 0x16) - a2 + (int)a1; diff --git a/src/util.c b/src/util.c index 582b9f806..e14665a03 100644 --- a/src/util.c +++ b/src/util.c @@ -490,7 +490,7 @@ int CountTrailingZeroBits(u32 value) return 0; } -u16 CalcCRC16(u8 *data, int length) +u16 CalcCRC16(const u8 *data, int length) { u16 i, j; u16 crc = 0x1121; |