lemm: more adjustment of various jobs

use OR on lemmings so they overlap when drawn
*except* for stoppers as it just made them look sans clothes
This commit is contained in:
Vince Weaver 2022-03-31 00:10:00 -04:00
parent d180310504
commit 880c64a96f
5 changed files with 220 additions and 13 deletions

View File

@ -85,6 +85,7 @@ qload.inc: generate_common QLOAD
./generate_common -a 0x1200 -s hgr_sprite_page_toggle qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_draw_sprite qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_draw_sprite_autoshift qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_draw_sprite_or_autoshift qload.lst >> qload.inc
###

View File

@ -13,6 +13,12 @@ erase_lemming_loop:
lda lemming_out,Y
beq done_erase_lemming
; don't erase blockers?
lda lemming_status,Y
cmp #LEMMING_STOPPING
beq done_erase_lemming
lda lemming_y,Y
sec
sbc #6
@ -95,7 +101,7 @@ do_draw_lemming:
draw_lemming_common:
sta YPOS
jsr hgr_draw_sprite_autoshift
jsr hgr_draw_sprite_or_autoshift
done_draw_lemming:
@ -673,7 +679,14 @@ draw_stopping_sprite:
stx XPOS
lda lemming_y,Y
jmp draw_lemming_common
; jmp draw_lemming_common
; special case, don't or so we hide background spike
sta YPOS
jsr hgr_draw_sprite_autoshift
jmp done_draw_lemming
; sta YPOS

View File

@ -228,3 +228,146 @@ hgr_sprite_as_toggle:
eor #$60
sta hgr_sprite_smc_as+1
rts
;===========================================
; hgr draw sprite (only at 7-bit boundaries)
;===========================================
; autoshift version
; assumes sprite is drawn for even column
; and shifts it if in odd column
; ors with bg for lemming
; SPRITE in INL/INH
; Location at XPOS YPOS
; xsize, ysize in first two bytes
; sprite AT INL/INH
hgr_draw_sprite_or_autoshift:
; self modify to shift for odd start location
; SEC=$38 0b0011 1000 CLC=$18 0b0001 10000
lda XPOS
lsr
bcc make_it_even_or
make_it_odd_or:
lda #$18
bne make_it_so_or
make_it_even_or:
lda #$38
make_it_so_or:
sta odd_even_smc_or
ldy #0
lda (INL),Y ; load xsize
clc
adc XPOS
sta sprite_width_end_smc_as_or+1 ; self modify for end of line
iny ; load ysize
lda (INL),Y
sta sprite_ysize_smc_as_or+1 ; self modify
; skip the xsize/ysize and point to sprite
clc
lda INL ; 16-bit add
adc #2
sta sprite_smc1_as_or+1
lda INH
adc #0
sta sprite_smc1_as_or+2
ldx #0 ; X is pointer offset
stx MASK ; actual row
hgr_sprite_yloop_as_or:
lda MASK ; row
clc
adc YPOS ; add in cursor_y
; calc GBASL/GBASH
tay ; get output ROW into GBASL/H
lda hposn_low,Y
sta GBASL
lda hposn_high,Y
; eor #$00 draws on page2
; eor #$60 draws on page1
hgr_sprite_smc_as_or:
eor #$00
sta GBASH
ldy XPOS
sprite_inner_loop_as_or:
sprite_smc1_as_or:
lda $d000 ; get sprite pattern
; lsr
odd_even_smc_or:
sec
bcs no_adjust_or
asl
php
clc
lsr
plp
ror
no_adjust_or:
;? Xcababab
;X cababab?
;? X0cababa
; clc ; rol asl
; rol
ora (GBASL),Y
sta (GBASL),Y ; store out
inx
iny
inc sprite_smc1_as_or+1
bne sprite_noflo_as_or
inc sprite_smc1_as_or+2
sprite_noflo_as_or:
sprite_width_end_smc_as_or:
cpy #6
bne sprite_inner_loop_as_or
inc MASK ; row
lda MASK ; row
sprite_ysize_smc_as_or:
cmp #31
bne hgr_sprite_yloop_as_or
rts
hgr_sprite_as_or_toggle:
lda hgr_sprite_smc_as_or+1
eor #$60
sta hgr_sprite_smc_as_or+1
rts

View File

@ -333,9 +333,9 @@ make_stopper:
tax
lda lemming_y,Y
clc
adc #3
adc #1
ldy #7
ldy #8
jsr hgr_vlin

View File

@ -246,6 +246,8 @@ walking_done:
;=====================
do_lemming_digging:
; ldy #CURRENT_LEMMING
lda lemming_y,Y ; point to spot below us
clc
adc #9
@ -267,8 +269,11 @@ do_lemming_digging:
ldx CURRENT_LEMMING ; dig down
inc lemming_y,X
blurgh:
jsr collision_check_ground
jmp done_move_lemming
@ -313,9 +318,10 @@ do_lemming_mining:
adc lemming_direction,X
sta lemming_x,X
jsr collision_check_ground
no_mining_this_frame:
done_mining:
jsr collision_check_ground
jmp done_move_lemming
@ -362,9 +368,14 @@ do_lemming_bashing:
adc lemming_direction,Y
sta lemming_x,Y
; here?
jsr collision_check_side
no_bashing_this_frame:
jsr collision_check_ground
; jsr collision_check_ground
jmp done_move_lemming
@ -580,6 +591,45 @@ not_last_lemming:
rts
;=============================
; collision check side
;=============================
; for bashing
; maybe can also be used when building?
collision_check_side:
ldy CURRENT_LEMMING
lda lemming_y,Y
clc
adc #3
tax
lda hposn_high,X
clc
adc #$20 ; check bg, not fg
sta GBASH
lda hposn_low,X
sta GBASL
lda lemming_x,Y
clc
adc lemming_direction,Y
tay
lda (GBASL),Y
and #$7f
bne gotta_keep_going
broke_on_through_to_the_other_side:
ldy CURRENT_LEMMING
lda #LEMMING_WALKING
sta lemming_status,Y
gotta_keep_going:
rts
;=============================
; collision check above
@ -697,14 +747,14 @@ on_the_ground:
; otherwise do nothing
; ldy CURRENT_LEMMING
; lda lemming_status,Y
ldy CURRENT_LEMMING
lda lemming_status,Y
; cmp #LEMMING_FALLING
; beq hit_ground
; cmp #LEMMING_FLOATING
; beq hit_ground
; bne done_check_ground ; could rts here?
cmp #LEMMING_FALLING
beq hit_ground
cmp #LEMMING_FLOATING
beq hit_ground
bne done_check_ground ; could rts here?
hit_ground: