From: Lukas Krickl Date: Fri, 21 Feb 2025 17:19:06 +0000 (+0100) Subject: actors rework: cleanup X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=24498b2c326c4872365d989fbc41a506195d012e;p=gbrg%2F.git actors rework: cleanup --- diff --git a/src/actor.s b/src/actor.s index 29357d6..300733c 100644 --- a/src/actor.s +++ b/src/actor.s @@ -172,15 +172,6 @@ actor_anim_verify: call anim_clear pop af ret - - ; truncates the position - ; to only use the high nibble - ; inputs: - ; hl: ptr to y/x - ; returns: - ; hl: trunacted y/x -anim_truncate_pos: - ret ; macro version of actor_tile_update_rf_flag ; inputs: @@ -266,7 +257,6 @@ actor_tile_update_rf_flags: actor_update_table: dw actor_update_null dw actor_update_bat - dw actor_update_rock actor_update_null: actor_check_who @@ -373,39 +363,6 @@ actor_update_bat: ret - ; rock actor -actor_update_rock: - actor_check_who - jr nz, @skip REL - - actor_end_turn - -@skip: - - ; load oam ptr - ld a, [actor_soam_ptr] - ld h, a - ld a, [actor_soam_ptr+1] - ld l, a - - inc bc ; bc = actor_y - - ld a, [bc] ; a = y - ld [hl+], a ; set y - inc bc - - ld a, [bc] ; a = x - ld [hl+], a ; set x - - ld a, PLAYER_TILE_IDLE1 - ld [hl+], a - - xor a, a - ld [hl+], a - - actor_store_soam_ptr - - ret ; updates all active actors from ; the current actor table diff --git a/src/defs.s b/src/defs.s index c94acac..a5e1194 100644 --- a/src/defs.s +++ b/src/defs.s @@ -64,7 +64,6 @@ ; null actor type = nop .de ACTOR_TYPE_NULL, 1 .de ACTOR_TYPE_BAT, 1 -.de ACTOR_TYPE_ROCK, 1 ; struct actor diff --git a/src/state.s b/src/state.s index b0f0a30..dabc908 100644 --- a/src/state.s +++ b/src/state.s @@ -116,24 +116,38 @@ sm_player_poll_inputs: ; after verifying collision ; otherwise -> end turn sm_bat_pick_direction: + push bc ; move bat in random direction call rand and a, 0b11 ; rnadom direction 0-3 ; call correct movement setup cp a, NORTH - call z, actor_up + jr nz, @not_north REL + +@not_north: + cp a, SOUTH - call z, actor_down + jr nz, @not_south REL + +@not_south: + cp a, WEST - call z, actor_left + jr nz, @not_west REL + +@not_west: + cp a, EAST - call z, actor_right + jr nz, @not_east REL + +@not_east: ; verify collision - + ; transition + pop bc + ret ; loads initial state if