Browse Source

Simplify player initialization

master
Forest Belton 3 years ago
parent
commit
f8f5860b35
1 changed files with 4 additions and 14 deletions
  1. +4
    -14
      src/player.s

+ 4
- 14
src/player.s View File

@ -31,7 +31,7 @@ DEF GRAVITY EQU (0 << 8) | 8
DEF INIT_VY EQU (2 << 8) | 40 DEF INIT_VY EQU (2 << 8) | 40
Player_Init:: Player_Init::
; clear player data
; Clear player data
ld hl, PLAYER_X ld hl, PLAYER_X
ld [hl], 0 ld [hl], 0
inc hl inc hl
@ -45,24 +45,14 @@ Player_Init::
inc hl inc hl
ld [hl], 0 ld [hl], 0
ld a, 8
ld hl, _OAM + 1
ld [hl], a
; Copy sprite to VRAM
ld bc, _VRAM8000 + SPRITE_IDX * 16 ld bc, _VRAM8000 + SPRITE_IDX * 16
ld hl, spriteData ld hl, spriteData
ld d, 16 * (SPRITE_WIDTH * SPRITE_HEIGHT) ld d, 16 * (SPRITE_WIDTH * SPRITE_HEIGHT)
call memcpy 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 ret

Loading…
Cancel
Save