From 948b270a83dce5f985cf347e88cd3ed0b110e1c1 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Thu, 12 Sep 2019 12:29:47 -0400 Subject: Script reversing --- src/engine/home.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 15778ca..5acb742 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -11091,9 +11091,9 @@ Func_3a5e: ; 3a5e (0:3a5e) ld a, [hli] ld [wd0cb], a ld a, [hli] - ld [wd0c8], a + ld [wCurrentNPCNameTx], a ld a, [hli] - ld [wd0c9], a + ld [wCurrentNPCNameTx+1], a pop hl pop bc pop af -- cgit v1.2.3 From 751b28d4fee472af4d0de83ef22a1f11ec6fade6 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Sun, 15 Sep 2019 21:55:11 -0400 Subject: Lots of NPC data, some temp. comments on mapdatapointers --- src/engine/home.asm | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 5acb742..450d9c1 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -1537,37 +1537,39 @@ UpdateRNGSources: ; 089b (0:089b) pop hl ret +; ld d, a ; de = wd4c4/5 + 5 +; ld b, $c0 ; b = c0 Func_08bf: ; 08bf (0:08bf) ld hl, wcad6 ld [hl], e inc hl - ld [hl], d + ld [hl], d ; load wcad6/7 with [wd4c4]+5 ld hl, wcad8 ld [hl], $1 - inc hl + inc hl ; wcad8 is 1, a bunch of things after it are 0 xor a ld [hli], a ld [hli], a ld [hli], a ld [hli], a - ld [hl], b + ld [hl], b ; then wcad i think is set to c0 inc hl - ld [hli], a - ld [hl], $ef + ld [hli], a ; 0 + ld [hl], $ef ; and ef ld h, b - ld l, $0 + ld l, $0 ; hl is now c000, first byte of wram, first card collection or no name xor a .asm_8d9 - ld [hl], a - inc l + ld [hl], a ; 0 out ff bytes + inc l ; inc the first ff bytes of wram (was an arg so could be other stuff) jr nz, .asm_8d9 ret Func_08de: ; 08de (0:08de) - push hl - push de + push hl ; wd23e + 40 i think? + push de ; 6 mdp bytes .asm_8e0 - push bc + push bc ; as of first run, bc is the width call Func_08ef ld [de], a inc de @@ -1584,7 +1586,7 @@ Func_08ef: ; 08ef (0:08ef) ld hl, wcadc ld a, [hl] or a - jr z, .asm_902 + jr z, .asm_902 ; for the purpose of this, we made it 0 earlier dec [hl] inc hl .asm_8f8 @@ -1603,9 +1605,9 @@ Func_08ef: ; 08ef (0:08ef) ld c, [hl] inc hl ld b, [hl] - inc hl - dec [hl] - inc hl + inc hl ; get pointer from wcad6/7 + dec [hl] ; dec wcad8 (was 1) + inc hl ; wcad9 jr nz, .asm_914 dec hl ld [hl], $8 @@ -11329,7 +11331,8 @@ Func_3be4: ; 3be4 (0:3be4) ret ; 0x3bf5 -Func_3bf5: ; 3bf5 (0:3bf5) +; Copies bc bytes from [wd4c4] to de +CopyBankedDataToDE: ; 3bf5 (0:3bf5) ldh a, [hBankROM] push af push hl -- cgit v1.2.3 From f3f374e6b7e26bc93c8428c8cb7b8c210223b2f4 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Mon, 23 Sep 2019 12:27:12 -0400 Subject: Fleshed out flags a lot --- src/engine/home.asm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 450d9c1..62eaa62 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -1586,7 +1586,7 @@ Func_08ef: ; 08ef (0:08ef) ld hl, wcadc ld a, [hl] or a - jr z, .asm_902 ; for the purpose of this, we made it 0 earlier + jr z, .asm_902 dec [hl] inc hl .asm_8f8 @@ -1605,9 +1605,9 @@ Func_08ef: ; 08ef (0:08ef) ld c, [hl] inc hl ld b, [hl] - inc hl ; get pointer from wcad6/7 - dec [hl] ; dec wcad8 (was 1) - inc hl ; wcad9 + inc hl + dec [hl] + inc hl jr nz, .asm_914 dec hl ld [hl], $8 @@ -10803,7 +10803,7 @@ GameEvent_Credits: ; 3911 (0:3911) Func_3917: ; 3917 (0:3917) ld a, $22 - farcall CheckIfEventFlagSet + farcall GetEventFlagValue call EnableSRAM ld [s0a00a], a call DisableSRAM -- cgit v1.2.3 From 1b2d7cbaa7aba718b8ef1e9ae0cbe1f349d673be Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Mon, 23 Sep 2019 12:37:41 -0400 Subject: Fix style, remove excess comments --- src/engine/home.asm | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 62eaa62..8545b3d 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -1537,39 +1537,37 @@ UpdateRNGSources: ; 089b (0:089b) pop hl ret -; ld d, a ; de = wd4c4/5 + 5 -; ld b, $c0 ; b = c0 Func_08bf: ; 08bf (0:08bf) ld hl, wcad6 ld [hl], e inc hl - ld [hl], d ; load wcad6/7 with [wd4c4]+5 + ld [hl], d ld hl, wcad8 ld [hl], $1 - inc hl ; wcad8 is 1, a bunch of things after it are 0 + inc hl xor a ld [hli], a ld [hli], a ld [hli], a ld [hli], a - ld [hl], b ; then wcad i think is set to c0 + ld [hl], b inc hl ld [hli], a ; 0 - ld [hl], $ef ; and ef + ld [hl], $ef ld h, b - ld l, $0 ; hl is now c000, first byte of wram, first card collection or no name + ld l, $0 xor a .asm_8d9 - ld [hl], a ; 0 out ff bytes - inc l ; inc the first ff bytes of wram (was an arg so could be other stuff) + ld [hl], a + inc l jr nz, .asm_8d9 ret Func_08de: ; 08de (0:08de) - push hl ; wd23e + 40 i think? - push de ; 6 mdp bytes + push hl + push de .asm_8e0 - push bc ; as of first run, bc is the width + push bc call Func_08ef ld [de], a inc de -- cgit v1.2.3 From fda59356c20813bb57d59de8d9b2b100f0fe275d Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Sun, 6 Oct 2019 11:24:18 -0400 Subject: Uncovered a lot of NPC map data and loading functions. --- src/engine/home.asm | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 8545b3d..adcbabd 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -10865,7 +10865,7 @@ GetPermissionByteOfMapPosition: ; 3946 (0:3946) Func_395a: ; 395a (0:395a) ldh a, [hBankROM] push af - ld a, [wd4c6] + ld a, [wTempPointerBank] call BankswitchROM call CopyGfxData pop af @@ -10934,6 +10934,9 @@ Func_39ad: ; 39ad (0:39ad) pop bc ret +; Finds the index on wd34a table of the npc in wTempNPC +; returns it in a and puts it into wd3aa +; c flag set if no npc found Func_39c3: ; 39c3 (0:39c3) push hl push bc @@ -10944,21 +10947,21 @@ Func_39c3: ; 39c3 (0:39c3) ld c, $8 ld de, $000c ld hl, wd34a - ld a, [wd3ab] -.asm_39d6 + ld a, [wTempNPC] +.findNPCLoop cp [hl] - jr z, .asm_39e1 + jr z, .foundNPCMatch add hl, de inc b dec c - jr nz, .asm_39d6 + jr nz, .findNPCLoop scf - jr z, .asm_39e6 -.asm_39e1 + jr z, .exit +.foundNPCMatch ld a, b ld [wd3aa], a or a -.asm_39e6 +.exit pop de pop bc pop hl @@ -11059,7 +11062,7 @@ Func_3a5e: ; 3a5e (0:3a5e) ldh a, [hBankROM] push af ld l, $4 - call Func_3abd + call GetMapScriptPointer jr nc, .asm_3ab3 ld a, BANK(Func_c653) call BankswitchROM @@ -11113,7 +11116,10 @@ Func_3a5e: ; 3a5e (0:3a5e) call $49c2 ret -Func_3abd: ; 3abd (0:3abd) +; returns a map script pointer in hl given +; current map in wCurMap and which sub-script in l +; sets c if pointer is found +GetMapScriptPointer: ; 3abd (0:3abd) push bc push hl ld a, [wCurMap] @@ -11321,7 +11327,7 @@ ResetDoFrameFunction: ; 3bdb (0:3bdb) Func_3be4: ; 3be4 (0:3be4) ldh a, [hBankROM] push af - ld a, [wd4c6] + ld a, [wTempPointerBank] call BankswitchROM call Func_08de pop af @@ -11329,16 +11335,16 @@ Func_3be4: ; 3be4 (0:3be4) ret ; 0x3bf5 -; Copies bc bytes from [wd4c4] to de +; Copies bc bytes from [wTempPointer] to de CopyBankedDataToDE: ; 3bf5 (0:3bf5) ldh a, [hBankROM] push af push hl - ld a, [wd4c6] + ld a, [wTempPointerBank] call BankswitchROM - ld a, [wd4c4] + ld a, [wTempPointer] ld l, a - ld a, [wd4c5] + ld a, [wTempPointer + 1] ld h, a call CopyDataHLtoDE_SaveRegisters pop hl @@ -11635,11 +11641,11 @@ Func_3d72: ; 3d72 (0:3d72) xor a jr .asm_3da1 .asm_3d84 - ld a, [wd4c4] + ld a, [wTempPointer] ld l, a - ld a, [wd4c5] + ld a, [wTempPointer + 1] ld h, a - ld a, [wd4c6] + ld a, [wTempPointerBank] call BankswitchROM ld a, [hli] push af @@ -11670,7 +11676,7 @@ Func_3d72: ; 3d72 (0:3d72) call BankswitchROM ret -Func_3db7: ; 3db7 (0:3db7) +GetFirstSpriteAnimBufferProperty: ; 3db7 (0:3db7) push bc ld c, SPRITE_ANIM_FIELD_00 call GetSpriteAnimBufferProperty -- cgit v1.2.3 From a44f17b9a15cf1a572d5e8056a69c368265729f2 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Sun, 6 Oct 2019 23:00:27 -0400 Subject: Fixed a few macros that were giving weird code. Updated tcgdisasm --- src/engine/home.asm | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index adcbabd..4135afa 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -10908,15 +10908,16 @@ Func_3997: ; 3997 (0:3997) call BankswitchROM ret -Func_39a7: ; 39a7 (0:39a7) - ld l, $0 - call Func_39ad +; returns in hl a pointer to the first element for the a'th NPC +GetLoadedNPCID: ; 39a7 (0:39a7) + ld l, LOADED_NPC_ID + call GetItemInLoadedNPCIndex ret -; return hl = wd34a + a * $c + l, with a < $8 -Func_39ad: ; 39ad (0:39ad) +; return in hl a pointer to the a'th items element l +GetItemInLoadedNPCIndex: ; 39ad (0:39ad) push bc - cp $8 + cp LOADED_NPC_MAX jr c, .asm_39b4 debug_ret xor a @@ -10929,24 +10930,24 @@ Func_39ad: ; 39ad (0:39ad) add l ld l, a ld h, $0 - ld bc, wd34a + ld bc, wLoadedNPCs add hl, bc pop bc ret -; Finds the index on wd34a table of the npc in wTempNPC -; returns it in a and puts it into wd3aa +; Finds the index on wLoadedNPCs table of the npc in wTempNPC +; returns it in a and puts it into wLoadedNPCTempIndex ; c flag set if no npc found -Func_39c3: ; 39c3 (0:39c3) +FindLoadedNPC: ; 39c3 (0:39c3) push hl push bc push de xor a - ld [wd3aa], a + ld [wLoadedNPCTempIndex], a ld b, a - ld c, $8 - ld de, $000c - ld hl, wd34a + ld c, LOADED_NPC_MAX + ld de, LOADED_NPC_LENGTH + ld hl, wLoadedNPCs ld a, [wTempNPC] .findNPCLoop cp [hl] @@ -10959,7 +10960,7 @@ Func_39c3: ; 39c3 (0:39c3) jr z, .exit .foundNPCMatch ld a, b - ld [wd3aa], a + ld [wLoadedNPCTempIndex], a or a .exit pop de @@ -11069,7 +11070,7 @@ Func_3a5e: ; 3a5e (0:3a5e) call Func_c653 ld a, $4 call BankswitchROM - ld a, [wd334] + ld a, [wPlayerDirection] ld d, a .asm_3a79 ld a, [hli] @@ -11086,9 +11087,9 @@ Func_3a5e: ; 3a5e (0:3a5e) cp c jr nz, .asm_3aab ld a, [hli] - ld [wd0c6], a + ld [wNextOWSequence], a ld a, [hli] - ld [wd0c7], a + ld [wNextOWSequence+1], a ld a, [hli] ld [wd0ca], a ld a, [hli] -- cgit v1.2.3 From 299f013b8b14184b9f06da3b89ba87ce2ba9e0f3 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Sun, 13 Oct 2019 19:39:13 -0400 Subject: More scripts, start to figure out mapscripts --- src/engine/home.asm | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 4135afa..681069d 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -10800,7 +10800,7 @@ GameEvent_Credits: ; 3911 (0:3911) ret Func_3917: ; 3917 (0:3917) - ld a, $22 + ld a, EVENT_FLAG_22 farcall GetEventFlagValue call EnableSRAM ld [s0a00a], a @@ -10875,8 +10875,8 @@ Func_395a: ; 395a (0:395a) Unknown_396b: ; 396b (0:396b) db $00, -$01, $01, $00, $00, $01, -$01, $00 -; Movement offsets for scripted movements -ScriptedMovementOffsetTable: ; 3973 (0:3973) +; Movement offsets for player movements +PlayerMovementOffsetTable: ; 3973 (0:3973) db 0, -2 ; move 2 tiles up db 2, 0 ; move 2 tiles right db 0, 2 ; move 2 tiles down @@ -11062,30 +11062,30 @@ Func_3a4f: ; 3a4f (0:3a4f) Func_3a5e: ; 3a5e (0:3a5e) ldh a, [hBankROM] push af - ld l, $4 + ld l, MAP_SCRIPT_PRESSED_A_1 call GetMapScriptPointer - jr nc, .asm_3ab3 - ld a, BANK(Func_c653) + jr nc, .handleSecondAPressScript + ld a, BANK(FindPlayerMovementFromDirection) call BankswitchROM - call Func_c653 + call FindPlayerMovementFromDirection ld a, $4 call BankswitchROM ld a, [wPlayerDirection] ld d, a -.asm_3a79 +.findAPressMatchLoop ld a, [hli] bit 7, a - jr nz, .asm_3ab3 + jr nz, .handleSecondAPressScript push bc push hl cp d - jr nz, .asm_3aab + jr nz, .noMatch ld a, [hli] cp b - jr nz, .asm_3aab + jr nz, .noMatch ld a, [hli] cp c - jr nz, .asm_3aab + jr nz, .noMatch ld a, [hli] ld [wNextOWSequence], a ld a, [hli] @@ -11104,17 +11104,17 @@ Func_3a5e: ; 3a5e (0:3a5e) call BankswitchROM scf ret -.asm_3aab +.noMatch pop hl ld bc, $0008 add hl, bc pop bc - jr .asm_3a79 -.asm_3ab3 + jr .findAPressMatchLoop +.handleSecondAPressScript pop af call BankswitchROM - ld l, $6 - call $49c2 + ld l, MAP_SCRIPT_PRESSED_A_2 + call CallMapScriptPointerIfExists ret ; returns a map script pointer in hl given @@ -11415,9 +11415,8 @@ CallHL2: ; 3c45 (0:3c45) jp hl ; 0x3c46 -PushBC_Ret: ; 3c46 (0:3c46) - push bc - ret +CallBC: ; 3c46 (0:3c46) + retbc ; 0x3c48 DoFrameIfLCDEnabled: ; 3c48 (0:3c48) @@ -11468,7 +11467,7 @@ DivideBCbyDE: ; 3c5a (0:3c5a) jr nz, .asm_3c63 ret -Func_3c83: ; 3c83 (0:3c83) +CallPlaySong: ; 3c83 (0:3c83) call PlaySong ret ; 0x3c87 @@ -11478,18 +11477,19 @@ Func_3c87: ; 3c87 (0:3c87) call PauseSong pop af call PlaySong - call Func_3c96 + call WaitForSongToFinish call ResumeSong ret ; 0x3c96 -Func_3c96: ; 3c96 (0:3c96) +WaitForSongToFinish: ; 3c96 (0:3c96) call DoFrameIfLCDEnabled call AssertSongFinished or a - jr nz, Func_3c96 + jr nz, WaitForSongToFinish ret +; clear [SOMETHING] - something relating to animations Func_3ca0: ; 3ca0 (0:3ca0) xor a ld [wd5d7], a -- cgit v1.2.3 From 3ac91a513dc9351734927182e46b0acd010053cf Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Thu, 24 Oct 2019 17:45:50 -0400 Subject: Uncovered NPC Movement and named OWObjects --- src/engine/home.asm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 681069d..ca0eb19 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -10800,7 +10800,7 @@ GameEvent_Credits: ; 3911 (0:3911) ret Func_3917: ; 3917 (0:3917) - ld a, EVENT_FLAG_22 + ld a, EVENT_RECEIVED_LEGEND_CARDS farcall GetEventFlagValue call EnableSRAM ld [s0a00a], a @@ -11059,16 +11059,16 @@ Func_3a4f: ; 3a4f (0:3a4f) ret ; 0x3a5e -Func_3a5e: ; 3a5e (0:3a5e) +HandleMoveModeAPress: ; 3a5e (0:3a5e) ldh a, [hBankROM] push af - ld l, MAP_SCRIPT_PRESSED_A_1 + ld l, MAP_SCRIPT_OBJECTS call GetMapScriptPointer jr nc, .handleSecondAPressScript ld a, BANK(FindPlayerMovementFromDirection) call BankswitchROM call FindPlayerMovementFromDirection - ld a, $4 + ld a, BANK(MapScripts) call BankswitchROM ld a, [wPlayerDirection] ld d, a @@ -11091,9 +11091,9 @@ Func_3a5e: ; 3a5e (0:3a5e) ld a, [hli] ld [wNextOWSequence+1], a ld a, [hli] - ld [wd0ca], a + ld [wDefaultObjectText], a ld a, [hli] - ld [wd0cb], a + ld [wDefaultObjectText+1], a ld a, [hli] ld [wCurrentNPCNameTx], a ld a, [hli] @@ -11106,14 +11106,14 @@ Func_3a5e: ; 3a5e (0:3a5e) ret .noMatch pop hl - ld bc, $0008 + ld bc, LEVEL_OBJECT_SIZE - 1 add hl, bc pop bc jr .findAPressMatchLoop .handleSecondAPressScript pop af call BankswitchROM - ld l, MAP_SCRIPT_PRESSED_A_2 + ld l, MAP_SCRIPT_PRESSED_A call CallMapScriptPointerIfExists ret -- cgit v1.2.3 From e38d9f1de3abe1cdb54e7292ead677151348bd4e Mon Sep 17 00:00:00 2001 From: ElectroDeoxys Date: Sat, 25 Apr 2020 17:45:32 +0100 Subject: Terror Strike effect command and related routines --- src/engine/home.asm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 545995a..4f9fc31 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -8301,34 +8301,44 @@ Func_2bcf: ; 2bcf (0:2bcf) Func_2bd7: ; 2bd7 (0:2bd7) ld a, $5 - jr Func_2bdb + jr Func_2bdb ; this line is not needed Func_2bdb: ; 2bdb (0:2bdb) ld c, a + +; load bank for Opponent Deck pointer table ldh a, [hBankROM] push af ld a, BANK(PointerTable_14000) call BankswitchROM + +; load hl with the corresponding pointer ld a, [wOpponentDeckID] ld l, a ld h, $0 - add hl, hl + add hl, hl ; two bytes per deck ld de, PointerTable_14000 add hl, de ld a, [hli] ld h, [hl] ld l, a + ld a, c or a - jr nz, .asm_2bfe + jr nz, .not_zero + +; if input was 0, copy deck data of turn player ld e, [hl] inc hl ld d, [hl] call CopyDeckData - jr .asm_2c01 -.asm_2bfe + jr .done + +; jump to corresponding AI routine related to input +.not_zero call JumpToFunctionInTable -.asm_2c01 + +.done ld c, a pop af call BankswitchROM -- cgit v1.2.3 From 7d9ea8a30d19fae6a39bb36981e27db6edbea5e7 Mon Sep 17 00:00:00 2001 From: ElectroDeoxys Date: Tue, 28 Apr 2020 20:20:20 +0100 Subject: AI routines and Energy Trans logic --- src/engine/home.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 4f9fc31..338dbb0 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -5218,7 +5218,7 @@ Func_1bca: ; 1bca (0:1bca) ret ; 0x1c05 -; return in a the retreat cost of the turn holder's arena or benchx Pokemon +; return in a the retreat cost of the turn holder's arena or bench Pokemon ; given the PLAY_AREA_* value in hTempPlayAreaLocation_ff9d GetPlayAreaCardRetreatCost: ; 1c05 (0:1c05) ldh a, [hTempPlayAreaLocation_ff9d] -- cgit v1.2.3 From d53e2db59a1562abf1b198602123672becfccda8 Mon Sep 17 00:00:00 2001 From: ElectroDeoxys Date: Wed, 29 Apr 2020 16:43:44 +0100 Subject: Disassemble AI Pkmn Power routines --- src/engine/home.asm | 1 + 1 file changed, 1 insertion(+) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 338dbb0..c56e0c6 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -3419,6 +3419,7 @@ CreateArenaOrBenchEnergyCardList: ; 120a (0:120a) ; fill wDuelTempList with the turn holder's hand cards (their 0-59 deck indexes) ; return carry if the turn holder has no cards in hand +; and outputs in a number of cards. CreateHandCardList: ; 123b (0:123b) call FindLastCardInHand inc b -- cgit v1.2.3 From 085660d0799a85e18fa6a25f251875ce7c0db5d4 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Tue, 5 May 2020 21:29:47 -0400 Subject: Added NPC_ Prefix, Changed Level to Map in some places --- src/engine/home.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 1ec17fb..094127e 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -11106,7 +11106,7 @@ HandleMoveModeAPress: ; 3a5e (0:3a5e) ret .noMatch pop hl - ld bc, LEVEL_OBJECT_SIZE - 1 + ld bc, MAP_OBJECT_SIZE - 1 add hl, bc pop bc jr .findAPressMatchLoop -- cgit v1.2.3 From a1f9dca9f563e6bc82c533f8e3a82edb954b8842 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Tue, 5 May 2020 22:45:50 -0400 Subject: changed wording when it comes to the legendary card sprite --- src/engine/home.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 094127e..24cb61d 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -10800,7 +10800,7 @@ GameEvent_Credits: ; 3911 (0:3911) ret Func_3917: ; 3917 (0:3917) - ld a, EVENT_RECEIVED_LEGEND_CARDS + ld a, EVENT_RECEIVED_LEGENDARY_CARD farcall GetEventFlagValue call EnableSRAM ld [s0a00a], a -- cgit v1.2.3 From 86d8cfb0fd86326e4534fc33c7bb384d515bbe0e Mon Sep 17 00:00:00 2001 From: ElectroDeoxys Date: Sat, 9 May 2020 12:11:05 +0100 Subject: Separate AI constants and new AIACTION_* --- src/engine/home.asm | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index c56e0c6..a9d28d6 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -8280,37 +8280,41 @@ LoadOpponentDeck: ; 2b78 (0:2b78) ld [hl], a ret -Func_2bbf: ; 2bbf (0:2bbf) - ld a, $1 - jr Func_2bdb +AIDoAction_Turn: ; 2bbf (0:2bbf) + ld a, AIACTION_DO_TURN + jr AIDoAction -Func_2bc3: ; 2bc3 (0:2bc3) - ld a, $2 - jr Func_2bdb +AIDoAction_StartDuel: ; 2bc3 (0:2bc3) + ld a, AIACTION_START_DUEL + jr AIDoAction -Func_2bc7: ; 2bc7 (0:2bc7) - ld a, $3 - call Func_2bdb +AIDoAction_ForcedSwitch: ; 2bc7 (0:2bc7) + ld a, AIACTION_FORCED_SWITCH + call AIDoAction ldh [hTempPlayAreaLocation_ff9d], a ret -Func_2bcf: ; 2bcf (0:2bcf) - ld a, $4 - call Func_2bdb +AIDoAction_KOSwitch: ; 2bcf (0:2bcf) + ld a, AIACTION_KO_SWITCH + call AIDoAction ldh [hTemp_ffa0], a ret -Func_2bd7: ; 2bd7 (0:2bd7) - ld a, $5 - jr Func_2bdb ; this line is not needed +AIDoAction_TakePrize: ; 2bd7 (0:2bd7) + ld a, AIACTION_TAKE_PRIZE + jr AIDoAction ; this line is not needed -Func_2bdb: ; 2bdb (0:2bdb) +; calls the appropriate AI routine to handle action, +; depending on the deck ID (see engine/deck_ai/deck_ai.asm) +; input: +; - a = AIACTION_* constant +AIDoAction: ; 2bdb (0:2bdb) ld c, a ; load bank for Opponent Deck pointer table ldh a, [hBankROM] push af - ld a, BANK(PointerTable_14000) + ld a, BANK(DeckAIPointerTable) call BankswitchROM ; load hl with the corresponding pointer @@ -8318,7 +8322,7 @@ Func_2bdb: ; 2bdb (0:2bdb) ld l, a ld h, $0 add hl, hl ; two bytes per deck - ld de, PointerTable_14000 + ld de, DeckAIPointerTable add hl, de ld a, [hli] ld h, [hl] -- cgit v1.2.3 From e02184fbcd4426fd0774d0dd80268c515d8aadd1 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Sat, 9 May 2020 15:36:16 -0400 Subject: changed OWScript to ScriptCommand and OWSequence to Script --- src/engine/home.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/engine/home.asm') diff --git a/src/engine/home.asm b/src/engine/home.asm index 24cb61d..478aa39 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -11087,9 +11087,9 @@ HandleMoveModeAPress: ; 3a5e (0:3a5e) cp c jr nz, .noMatch ld a, [hli] - ld [wNextOWSequence], a + ld [wNextScript], a ld a, [hli] - ld [wNextOWSequence+1], a + ld [wNextScript+1], a ld a, [hli] ld [wDefaultObjectText], a ld a, [hli] @@ -11159,9 +11159,9 @@ Func_3ae8: ; 3ae8 (0:3ae8) ret ; 0x3aed -; finds an OWScript from the first byte and puts the next two bytes (usually arguments?) into cb +; finds a Script from the first byte and puts the next two bytes (usually arguments?) into cb RunOverworldScript: ; 3aed (0:3aed) - ld hl, wOWScriptPointer + ld hl, wScriptPointer ld a, [hli] ld h, [hl] ld l, a -- cgit v1.2.3