diff options
author | libjet <libj3t@gmail.com> | 2020-02-18 03:32:24 +0000 |
---|---|---|
committer | libjet <libj3t@gmail.com> | 2020-02-18 03:32:24 +0000 |
commit | 80153b820ad017b09b7f896f0fb17beaf49faa95 (patch) | |
tree | f81c1bc319c400af110e226dd6a2d472568be07d | |
parent | 3379187ef4d3e3d545cd31cfe74452359169e1ad (diff) |
Add clear_sprites.asm
-rwxr-xr-x | engine/overworld/map_object_action.asm | 2 | ||||
-rwxr-xr-x | engine/variables.asm | 2 | ||||
-rw-r--r-- | home.asm | 30 | ||||
-rwxr-xr-x | home/clear_sprites.asm | 23 |
4 files changed, 30 insertions, 27 deletions
diff --git a/engine/overworld/map_object_action.asm b/engine/overworld/map_object_action.asm index 40499b50..553243c4 100755 --- a/engine/overworld/map_object_action.asm +++ b/engine/overworld/map_object_action.asm @@ -9,7 +9,7 @@ ld a, [hli] ld h, [hl] ld l, a - call jp_hl + call _hl_ ret Pointers4460: diff --git a/engine/variables.asm b/engine/variables.asm index e2a399f0..7e6906ee 100755 --- a/engine/variables.asm +++ b/engine/variables.asm @@ -25,7 +25,7 @@ GetVarAction_:: jr .loadstringbuffer2 .call - call jp_de + call _de_ ret .loadstringbuffer2 @@ -143,35 +143,15 @@ INCLUDE "home/item.asm" INCLUDE "home/random.asm" INCLUDE "home/sram.asm" -jp_hl:: +; Register aliases +_hl_:: jp hl -jp_de:: +_de_:: push de ret -ClearSprites:: ; 30ff (0:30ff) - ld hl, wVirtualOAM - ld b, $a0 - xor a -.asm_3105 - ld [hli], a - dec b - jr nz, .asm_3105 - ret - -HideSprites:: - ld hl, wVirtualOAM - ld de, $4 - ld b, $28 - ld a, $a0 -.asm_3114 - ld [hl], a - add hl, de - dec b - jr nz, .asm_3114 - ret - +INCLUDE "home/clear_sprites.asm" INCLUDE "home/copy2.asm" BackUpTilesToBuffer:: @@ -619,7 +599,7 @@ Function3414:: ld a, [hli] ld h, [hl] ld l, a - call jp_hl + call _hl_ pop hl ld a, h rst Bankswitch diff --git a/home/clear_sprites.asm b/home/clear_sprites.asm new file mode 100755 index 00000000..cbf6e78b --- /dev/null +++ b/home/clear_sprites.asm @@ -0,0 +1,23 @@ +ClearSprites:: +; Erase OAM data + ld hl, wVirtualOAM + ld b, wVirtualOAMEnd - wVirtualOAM + xor a +.loop + ld [hli], a + dec b + jr nz, .loop + ret + +HideSprites:: +; Set all OAM y-positions to 160 to hide them offscreen + ld hl, wVirtualOAMSprite00YCoord + ld de, SPRITEOAMSTRUCT_LENGTH + ld b, NUM_SPRITE_OAM_STRUCTS + ld a, SCREEN_WIDTH_PX +.loop + ld [hl], a ; y + add hl, de + dec b + jr nz, .loop + ret
\ No newline at end of file |