diff options
author | libjet <libj3t@gmail.com> | 2020-03-16 00:44:13 +0000 |
---|---|---|
committer | libjet <libj3t@gmail.com> | 2020-03-16 00:44:13 +0000 |
commit | 6231351906960364a5ad2f34efefd809cceb0eb8 (patch) | |
tree | 709f2f908d9e1c2f7a882d628ff09b80de3c9e8b /home/flag.asm | |
parent | 4ad17cc30e6b70be19badd175558c438fc9adaf6 (diff) |
Sync home/ with pokecrystal
Diffstat (limited to 'home/flag.asm')
-rw-r--r-- | home/flag.asm | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/home/flag.asm b/home/flag.asm index 5eef8fe1..95117377 100644 --- a/home/flag.asm +++ b/home/flag.asm @@ -1,27 +1,27 @@ -ResetMapBufferEventFlags:: ; 2f10 (0:2f10) +ResetMapBufferEventFlags:: xor a ld hl, wEventFlags ld [hli], a ret -ResetBikeFlags:: ; 2f16 (0:2f16) +ResetBikeFlags:: xor a ld hl, wBikeFlags ld [hli], a ld [hl], a ret -ResetFlashIfOutOfCave:: ; 2f1d (0:2f1d) +ResetFlashIfOutOfCave:: ld a, [wPermission] - cp $2 - jr z, .turn_off_lights - cp $1 - jr z, .turn_off_lights + cp ROUTE + jr z, .outdoors + cp TOWN + jr z, .outdoors ret -.turn_off_lights +.outdoors ld hl, wStatusFlags - res 2, [hl] ; FLASH + res STATUSFLAGS_FLASH_F, [hl] ret EventFlagAction:: @@ -29,28 +29,26 @@ EventFlagAction:: call FlagAction ret -FlagAction:: ; 2f36 (0:2f36) +FlagAction:: ; Perform action b on bit de in flag array hl. ; inputs: ; b: function -; 0 clear bit -; 1 set bit -; 2 check bit +; 0 RESET_FLAG clear bit +; 1 SET_FLAG set bit +; 2 CHECK_FLAG check bit ; de: bit number -; hl: index within bit table +; hl: pointer to the flag array ; get index within the byte ld a, e and 7 ; shift de right by three bits (get the index within memory) +rept 3 srl d rr e - srl d - rr e - srl d - rr e +endr add hl, de ; implement a decoder @@ -71,9 +69,9 @@ FlagAction:: ; 2f36 (0:2f36) ; check b's value: 0, 1, 2 ld a, b - cp 1 - jr c, .clearbit ; 0 - jr z, .setbit ; 1 + cp SET_FLAG + jr c, .clearbit ; RESET_FLAG + jr z, .setbit ; SET_FLAG ; check bit ld a, [hl] @@ -108,11 +106,11 @@ Unreferenced_CheckBPressedDebug:: ; Used in debug ROMs to walk through walls and avoid encounters. ld a, [wDebugFlags] - bit 1, a + bit DEBUG_FIELD_F, a ret z - + ldh a, [hJoyDown] - bit 1, a + bit B_BUTTON_F, a ret xor_a:: @@ -129,4 +127,4 @@ Unreferenced_CheckFieldDebug:: ld hl, wDebugFlags bit DEBUG_FIELD_F, [hl] pop hl - ret
\ No newline at end of file + ret |