From f8f5860b3579f834a28dc4572b5396e09b61a155 Mon Sep 17 00:00:00 2001 From: Forest Belton <65484+forestbelton@users.noreply.github.com> Date: Mon, 5 Jul 2021 17:57:53 -0400 Subject: [PATCH] Simplify player initialization --- src/player.s | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/player.s b/src/player.s index d4540b1..9946141 100644 --- a/src/player.s +++ b/src/player.s @@ -31,7 +31,7 @@ DEF GRAVITY EQU (0 << 8) | 8 DEF INIT_VY EQU (2 << 8) | 40 Player_Init:: - ; clear player data + ; Clear player data ld hl, PLAYER_X ld [hl], 0 inc hl @@ -45,24 +45,14 @@ Player_Init:: inc hl ld [hl], 0 - ld a, 8 - ld hl, _OAM + 1 - ld [hl], a - + ; Copy sprite to VRAM ld bc, _VRAM8000 + SPRITE_IDX * 16 ld hl, spriteData ld d, 16 * (SPRITE_WIDTH * SPRITE_HEIGHT) call memcpy - OAM_set SPRITE_OAM_IDX + 0, 8, 144-8-8, SPRITE_IDX, 0 - OAM_set SPRITE_OAM_IDX + 1, 16, 144-8-8, SPRITE_IDX + 1, 0 - OAM_set SPRITE_OAM_IDX + 2, 8, 144-8, SPRITE_IDX + 2, 0 - OAM_set SPRITE_OAM_IDX + 3, 16, 144-8, SPRITE_IDX + 3, 0 - - ld bc, _OAMRAM - ld hl, _OAM - ld d, 4 * (SPRITE_WIDTH * SPRITE_HEIGHT) - call memcpy + ; Initialize OAM entries with player state + call update_oam ret