lemm: add miner support, move some things around

This commit is contained in:
Vince Weaver 2022-03-27 15:40:20 -04:00
parent 6e1acc7e87
commit ee41a5ee78
10 changed files with 149 additions and 30 deletions

View File

@ -48,7 +48,8 @@ QLOAD: qload.o
qload.o: qload.s qboot.inc \
audio.s decompress_fast_v2.s gr_offsets.s \
wait.s wait_a_bit.s
wait.s wait_a_bit.s \
hgr_hlin.s hgr_vlin.s hgr_box.s hgr_tables.s
ca65 -o qload.o qload.s -l qload.lst
###
@ -61,6 +62,12 @@ qload.inc: generate_common QLOAD
./generate_common -a 0x1200 -s gr_offsets qload.lst >> qload.inc
./generate_common -a 0x1200 -s wait qload.lst >> qload.inc
./generate_common -a 0x1200 -s wait_a_bit qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_hlin qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_vlin qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_box qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_hlin_page_toggle qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_vlin_page_toggle qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_box_page_toggle qload.lst >> qload.inc
###
@ -87,7 +94,7 @@ lemm.o: lemm.s zp.inc hardware.inc qload.inc \
graphics/sprites.inc \
intro_level.s update_time.s hgr_sprite.s draw_flames.s \
draw_door.s move_lemming.s draw_lemming.s \
hgr_hlin.s hgr_vlin.s update_menu.s init_level.s \
update_menu.s init_level.s \
interrupt_handler.s keyboard.s draw_pointer.s \
pointer_sprites.inc particle_hgr.s release_lemming.s \
title.s audio.s letsgo.s load_music.s

View File

@ -262,23 +262,23 @@ sprites.inc: sprites.png
$(HGR_SPRITE) -s -l lemming_shrug7_sprite sprites.png 224 80 230 89 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_shrug8_sprite sprites.png 238 80 244 89 >> sprites.inc
#
$(HGR_SPRITE) -s -l lemming_lmine1_sprite sprites.png 252 54 258 66 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine2_sprite sprites.png 252 68 258 80 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine3_sprite sprites.png 252 82 258 94 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine4_sprite sprites.png 252 96 258 108 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine5_sprite sprites.png 252 110 258 122 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine6_sprite sprites.png 252 124 258 136 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine7_sprite sprites.png 252 138 258 150 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine8_sprite sprites.png 252 152 258 164 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine1_sprite sprites.png 252 54 258 66 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine2_sprite sprites.png 252 68 258 80 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine3_sprite sprites.png 252 82 258 94 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine4_sprite sprites.png 252 96 258 108 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine5_sprite sprites.png 252 110 258 122 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine6_sprite sprites.png 252 124 258 136 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine7_sprite sprites.png 252 138 258 150 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine8_sprite sprites.png 252 152 258 164 >> sprites.inc
#
$(HGR_SPRITE) -s -l lemming_rmine1_sprite sprites.png 266 54 272 66 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine2_sprite sprites.png 266 68 272 80 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine3_sprite sprites.png 266 82 272 94 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine4_sprite sprites.png 266 96 272 108 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine5_sprite sprites.png 266 110 272 122 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine6_sprite sprites.png 266 124 272 136 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine7_sprite sprites.png 266 138 272 150 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_rmine8_sprite sprites.png 266 152 272 164 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine1_sprite sprites.png 266 54 272 66 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine2_sprite sprites.png 266 68 272 80 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine3_sprite sprites.png 266 82 272 94 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine4_sprite sprites.png 266 96 272 108 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine5_sprite sprites.png 266 110 272 122 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine6_sprite sprites.png 266 124 272 136 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine7_sprite sprites.png 266 138 272 150 >> sprites.inc
$(HGR_SPRITE) -s -l lemming_lmine8_sprite sprites.png 266 152 272 164 >> sprites.inc

54
games/lemm/hgr_box.s Normal file
View File

@ -0,0 +1,54 @@
;=================================
; Simple HGR box
;=================================
; only 1 7-bit block wide
; (X,A) to (X,A+Y) where X is xcoord/7
hgr_box:
; don't handle run of 0
cpy #0
beq done_hgr_box
; get initial ROW into (GBASL)
sta box_row_smc+1 ; save current A
stx box_x1_smc+1
ldx HGR_COLOR ; get colors
lda hgr_colortbl,X
sta HGR_BITS
tya
tax ; put line count into X
hgr_box_loop:
box_row_smc:
ldy #$dd ; get row info for Y1 into GBASL/GBASH
lda hposn_high,Y
hgr_box_page_smc:
eor #$00
sta GBASH
lda hposn_low,Y
sta GBASL
lda HGR_BITS
box_x1_smc:
ldy #$dd
sta (GBASL),Y
inc box_row_smc+1
dex
bne hgr_box_loop
done_hgr_box:
rts
hgr_box_page_toggle:
lda hgr_box_page_smc+1
eor #$60
sta hgr_box_page_smc+1
rts

View File

@ -343,8 +343,6 @@ level_continue:
.include "draw_flames.s"
.include "draw_door.s"
.include "hgr_hlin.s"
.include "hgr_vlin.s"
.include "update_menu.s"
.include "title.s"
@ -362,6 +360,9 @@ level_continue:
; .include "audio.s"
; .include "decompress_fast_v2.s"
; .include "gr_offsets.s"
; .include "hgr_hlin.s"
; .include "hgr_vlin.s"
; .include "hgr_box.s"
; pt3 player

View File

@ -41,7 +41,7 @@ do_level1:
lda #35
sta exit_x2_smc+1
lda #116
lda #100
sta exit_y1_smc+1
lda #127
sta exit_y2_smc+1

View File

@ -41,7 +41,7 @@ do_level2:
lda #33
sta exit_x2_smc+1
lda #121
lda #119
sta exit_y1_smc+1
lda #144
sta exit_y2_smc+1

View File

@ -40,7 +40,7 @@ do_level3:
lda #20
sta exit_x2_smc+1
lda #122
lda #119
sta exit_y1_smc+1
lda #144
sta exit_y2_smc+1

View File

@ -40,7 +40,7 @@ do_level4:
lda #33
sta exit_x2_smc+1
lda #21
lda #20
sta exit_y1_smc+1
lda #45
sta exit_y2_smc+1

View File

@ -228,10 +228,6 @@ walking_done:
jmp done_move_lemming
;=====================
; digging
;=====================
@ -276,6 +272,65 @@ done_digging:
;=====================
; mining
;=====================
do_lemming_mining:
lda lemming_y,Y
clc
adc #9
tax
lda hposn_high,X ; set up collision check underfoot
clc
adc #$20
sta GBASH
lda hposn_low,X
sta GBASL
lda lemming_x,Y ; if fell through,then fall
tay
lda (GBASL),Y
and #$7f
beq mining_falling
mining_mining:
ldy CURRENT_LEMMING
lda lemming_frame,Y
and #$f
bne no_mining_this_frame
ldy CURRENT_LEMMING
lda lemming_x,Y
tay
lda #$0 ; clear out dirt (FIXME: block?)
sta (GBASL),Y
ldx CURRENT_LEMMING
inc lemming_y,X
inc lemming_y,X
inc lemming_y,X
lda lemming_x,X
clc
adc lemming_direction,X
sta lemming_x,X
no_mining_this_frame:
jmp done_mining
mining_falling:
ldy CURRENT_LEMMING
lda #LEMMING_FALLING
sta lemming_status,Y
done_mining:
jmp done_move_lemming
;=====================
; do nothing
;=====================
@ -285,7 +340,6 @@ do_lemming_exploding:
do_lemming_pullup:
do_lemming_shrugging:
do_lemming_building:
do_lemming_mining:
do_lemming_stopping:
do_lemming_bashing:
do_lemming_climbing:

View File

@ -190,7 +190,10 @@ length_array:
.include "audio.s"
.include "decompress_fast_v2.s"
.include "gr_offsets.s"
.include "hgr_hlin.s"
.include "hgr_vlin.s"
.include "hgr_box.s"
.include "hgr_tables.s"
qload_end: