From 80153b820ad017b09b7f896f0fb17beaf49faa95 Mon Sep 17 00:00:00 2001 From: libjet Date: Tue, 18 Feb 2020 03:32:24 +0000 Subject: Add clear_sprites.asm --- engine/overworld/map_object_action.asm | 2 +- engine/variables.asm | 2 +- home.asm | 30 +++++------------------------- home/clear_sprites.asm | 23 +++++++++++++++++++++++ 4 files changed, 30 insertions(+), 27 deletions(-) create mode 100755 home/clear_sprites.asm 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 diff --git a/home.asm b/home.asm index 0ddd8f15..93eadf05 100644 --- a/home.asm +++ b/home.asm @@ -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 -- cgit v1.2.3