peasant: update peasantry to new drawing/erasing code

This commit is contained in:
Vince Weaver 2021-12-28 16:45:19 -05:00
parent f0e730a1f0
commit b9a3f2ac3a
13 changed files with 158 additions and 283 deletions

View File

@ -254,7 +254,7 @@ cliff.o: cliff.s zp.inc inventory.inc \
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s
move_peasant.s score.s
ca65 -o cliff.o cliff.s -l cliff.lst
###
@ -269,7 +269,7 @@ archery.o: archery.s zp.inc inventory.inc \
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s
move_peasant.s score.s
ca65 -o archery.o archery.s -l archery.lst
###
@ -284,7 +284,7 @@ map.o: map.s zp.inc inventory.inc \
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s
move_peasant.s score.s
ca65 -o map.o map.s -l map.lst
@ -302,7 +302,7 @@ game_over.o: game_over.s zp.inc \
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s
move_peasant.s score.s
ca65 -o game_over.o game_over.s -l game_over.lst
@ -326,7 +326,7 @@ peasant1.o: peasant1.s zp.inc inventory.inc \
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s
move_peasant.s score.s
ca65 -o peasant1.o peasant1.s -l peasant1.lst
###
@ -345,7 +345,7 @@ peasant2.o: peasant2.s zp.inc inventory.inc \
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s inventory.s loadsave_menu.s
move_peasant.s score.s inventory.s loadsave_menu.s
ca65 -o peasant2.o peasant2.s -l peasant2.lst
###
@ -363,7 +363,7 @@ peasant3.o: peasant3.s zp.inc inventory.inc \
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s
move_peasant.s score.s
ca65 -o peasant3.o peasant3.s -l peasant3.lst
###
@ -383,7 +383,7 @@ peasant4.o: peasant4.s zp.inc inventory.inc \
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s
move_peasant.s score.s
ca65 -o peasant4.o peasant4.s -l peasant4.lst
###
@ -401,7 +401,7 @@ trogdor.o: trogdor.s zp.inc \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
draw_peasant_tiny.s \
keyboard.s new_map_location.s \
peasant_move_tiny.s score.s inventory.s \
move_peasant_tiny.s score.s inventory.s \
trogdor_actions.s
ca65 -o trogdor.o trogdor.s -l trogdor.lst
@ -419,7 +419,7 @@ ending.o: ending.s zp.inc qload.inc music.inc \
hgr_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s inventory.s
move_peasant.s score.s inventory.s
ca65 -o ending.o ending.s -l ending.lst
@ -450,7 +450,7 @@ inside.o: inside.s zp.inc inventory.inc \
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s inventory.s loadsave_menu.s
move_peasant.s score.s inventory.s loadsave_menu.s
ca65 -o inside.o inside.s -l inside.lst
###
@ -468,7 +468,7 @@ inn.o: inn.s zp.inc inventory.inc \
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s new_map_location.s \
peasant_move.s score.s inventory.s loadsave_menu.s
move_peasant.s score.s inventory.s loadsave_menu.s
ca65 -o inn.o inn.s -l inn.lst

View File

@ -232,18 +232,14 @@ level_over:
.include "draw_peasant.s"
.include "move_peasant.s"
.include "gr_copy.s"
.include "new_map_location.s"
.include "peasant_move.s"
;.include "parse_input.s"
;.include "inventory.s"
;.include "score.s"
.include "keyboard.s"
@ -253,25 +249,7 @@ level_over:
.include "version.inc"
; Moved to qload
;.include "decompress_fast_v2.s"
;.include "hgr_font.s"
;.include "draw_box.s"
;.include "hgr_rectangle.s"
;.include "hgr_1x28_sprite_mask.s"
;.include "hgr_1x5_sprite.s"
;.include "hgr_partial_save.s"
;.include "hgr_input.s"
;.include "hgr_tables.s"
;.include "hgr_text_box.s"
;.include "clear_bottom.s"
;.include "hgr_hgr2.s"
;.include "loadsave_menu.s"
;.include "wait_keypress.s"
.include "graphics_cliff/cliff_graphics.inc"
.include "graphics_cliff/priority_cliff.inc"
map_backgrounds_low:

View File

@ -3,6 +3,13 @@
; draw peasant
;============================
draw_peasant:
; skip if room over, as otherwise we'll draw at the
; wrong edge of screen
lda LEVEL_OVER
bne done_draw_peasant
lda PEASANT_X
sta CURSOR_X
lda PEASANT_Y
@ -22,11 +29,10 @@ draw_peasant:
; up up up up
peasant_up:
lda FRAME
and #1
lda PEASANT_Y
and #4
beq peasant_up1
peasant_up2:
lda #<peasant_up2_sprite
sta INL
@ -43,11 +49,10 @@ peasant_up1:
; down down down
peasant_down:
lda FRAME
and #1
lda PEASANT_Y
and #4
beq peasant_down1
peasant_down2:
lda #<peasant_down2_sprite
sta INL
@ -102,7 +107,10 @@ done_pick_draw:
jsr hgr_draw_sprite_1x28
done_draw_peasant:
rts
.include "sprites/peasant_sprites.inc"
;.include "sprites/peasant_sprites.inc"
.include "sprites/peasant_robe_sprites.inc"

View File

@ -564,26 +564,11 @@ stuck_forever:
; moved to qload
;.include "decompress_fast_v2.s"
;.include "hgr_font.s"
;.include "draw_box.s"
;.include "hgr_rectangle.s"
;.include "hgr_1x5_sprite.s"
;.include "hgr_partial_save.s"
;.include "hgr_input.s"
;.include "hgr_tables.s"
;.include "hgr_text_box.s"
;.include "wait_keypress.s"
;.include "hgr_hgr2.s"
.include "hgr_2x14_sprite_mask.s"
.include "hgr_sprite.s"
;.include "score.s"
.include "wait.s"
.include "wait_a_bit.s"

View File

@ -234,15 +234,12 @@ level_over:
rts
.include "move_peasant.s"
.include "draw_peasant.s"
.include "gr_copy.s"
.include "new_map_location.s"
.include "peasant_move.s"
;.include "parse_input.s"
.include "keyboard.s"
@ -252,30 +249,7 @@ level_over:
.include "graphics_inn/graphics_inn.inc"
.include "graphics_inn/priority_inn.inc"
.include "version.inc"
;.include "inventory.s"
; moved to QLOAD
;.include "decompress_fast_v2.s"
;.include "hgr_font.s"
;.include "draw_box.s"
;.include "hgr_rectangle.s"
;.include "hgr_1x28_sprite_mask.s"
;.include "hgr_1x5_sprite.s"
;.include "hgr_partial_save.s"
;.include "hgr_input.s"
;.include "hgr_tables.s"
;.include "hgr_text_box.s"
;.include "clear_bottom.s"
;.include "hgr_hgr2.s"
;.include "wait_keypress.s"
;.include "loadsave_menu.s"
;.include "score.s"

View File

@ -331,16 +331,13 @@ to_left:
rts
.include "move_peasant.s"
.include "draw_peasant.s"
.include "gr_copy.s"
.include "new_map_location.s"
.include "peasant_move.s"
;.include "parse_input.s"
.include "keyboard.s"
@ -350,30 +347,7 @@ to_left:
.include "graphics_inside/graphics_inside.inc"
.include "graphics_inside/priority_inside.inc"
.include "version.inc"
;.include "inventory.s"
; moved to QLOAD
;.include "decompress_fast_v2.s"
;.include "hgr_font.s"
;.include "draw_box.s"
;.include "hgr_rectangle.s"
;.include "hgr_1x28_sprite_mask.s"
;.include "hgr_1x5_sprite.s"
;.include "hgr_partial_save.s"
;.include "hgr_input.s"
;.include "hgr_tables.s"
;.include "hgr_text_box.s"
;.include "clear_bottom.s"
;.include "hgr_hgr2.s"
;.include "wait_keypress.s"
;.include "loadsave_menu.s"
;.include "score.s"
map_backgrounds_low:

View File

@ -14,6 +14,21 @@ really_move_peasant:
; restore bg behind peasant
lda PEASANT_Y
sta SAVED_Y1
clc
adc #28
sta SAVED_Y2
ldx PEASANT_X
txa
inx
jsr hgr_partial_restore
.if 0
lda PEASANT_X
sta CURSOR_X
@ -21,6 +36,7 @@ really_move_peasant:
sta CURSOR_Y
jsr restore_bg_1x28
.endif
; move peasant
@ -129,7 +145,7 @@ done_movey:
sta PEASANT_Y
; if we moved off screen, don't re-draw peasant
.if 0
lda LEVEL_OVER
bne peasant_the_same
@ -146,7 +162,7 @@ done_movey:
; draw peasant
jsr draw_peasant
.endif
peasant_the_same:
rts

View File

@ -149,17 +149,17 @@ not_kerrek:
;====================
; save background
lda PEASANT_X
sta CURSOR_X
lda PEASANT_Y
sta CURSOR_Y
; lda PEASANT_X
; sta CURSOR_X
; lda PEASANT_Y
; sta CURSOR_Y
;=======================
; draw initial peasant
jsr save_bg_1x28
; jsr save_bg_1x28
jsr draw_peasant
; jsr draw_peasant
;===================
; check hay
@ -223,14 +223,27 @@ erase_waterfall:
leave_waterfall_alone:
;======================
; move peasant
jsr move_peasant
;======================
; always draw peasant
jsr draw_peasant
;=======================
; next frame
inc FRAME
;=======================
; check keyboard
jsr check_keyboard
; FIXME: draw kerrek before peasant if behind him
; FIXME: draw kerrek before peasant if behind him?
jsr kerrek_draw
@ -290,45 +303,20 @@ game_over:
rts
.include "peasant_common.s"
;.include "inventory.s"
.include "move_peasant.s"
.include "draw_peasant.s"
.include "gr_copy.s"
.include "new_map_location.s"
.include "peasant_move.s"
;.include "parse_input.s"
;.include "score.s"
.include "keyboard.s"
.include "wait.s"
.include "wait_a_bit.s"
.include "version.inc"
.include "hgr_sprite.s"
; Moved to qload
;.include "decompress_fast_v2.s"
;.include "hgr_font.s"
;.include "draw_box.s"
;.include "hgr_rectangle.s"
;.include "hgr_1x28_sprite_mask.s"
;.include "hgr_1x5_sprite.s"
;.include "hgr_partial_save.s"
;.include "hgr_input.s"
;.include "hgr_tables.s"
;.include "hgr_text_box.s"
;.include "clear_bottom.s"
;.include "hgr_hgr2.s"
;.include "wait_keypress.s"
;.include "loadsave_menu.s"
.include "hgr_copy.s"
;.include "text/peasant1.inc"

View File

@ -38,10 +38,6 @@ peasantry2:
jsr decompress_lzsa2_fast
; update map location
; jsr update_map_location
; update score
jsr update_score
@ -139,17 +135,17 @@ new_location:
;====================
; save background
lda PEASANT_X
sta CURSOR_X
lda PEASANT_Y
sta CURSOR_Y
; lda PEASANT_X
; sta CURSOR_X
; lda PEASANT_Y
; sta CURSOR_Y
;=======================
; draw initial peasant
jsr save_bg_1x28
; jsr save_bg_1x28
jsr draw_peasant
; jsr draw_peasant
;======================
; check if in hay
@ -229,12 +225,33 @@ arrow_game_lose_common:
jsr partial_message_step
;================================
;================================
;================================
; main loop
;================================
;================================
;================================
game_loop:
;====================
; move peasant
jsr move_peasant
;====================
; always draw peasant
jsr draw_peasant
;====================
; increment frame
inc FRAME
;====================
; check keyboard
jsr check_keyboard
;=====================
@ -372,14 +389,12 @@ to_left_of_inn:
.include "peasant_common.s"
.include "move_peasant.s"
.include "draw_peasant.s"
.include "gr_copy.s"
.include "new_map_location.s"
.include "peasant_move.s"
;.include "parse_input.s"
@ -392,31 +407,6 @@ to_left_of_inn:
.include "graphics_peasantry/graphics_peasant2.inc"
.include "graphics_peasantry/priority_peasant2.inc"
.include "version.inc"
;.include "inventory.s"
; moved to QLOAD
;.include "decompress_fast_v2.s"
;.include "hgr_font.s"
;.include "draw_box.s"
;.include "hgr_rectangle.s"
;.include "hgr_1x28_sprite_mask.s"
;.include "hgr_1x5_sprite.s"
;.include "hgr_partial_save.s"
;.include "hgr_input.s"
;.include "hgr_tables.s"
;.include "hgr_text_box.s"
;.include "clear_bottom.s"
;.include "hgr_hgr2.s"
;.include "wait_keypress.s"
;.include "loadsave_menu.s"
;.include "score.s"
.include "hgr_copy.s"
map_backgrounds_low:

View File

@ -134,17 +134,17 @@ new_location:
;====================
; save background
lda PEASANT_X
sta CURSOR_X
lda PEASANT_Y
sta CURSOR_Y
; lda PEASANT_X
; sta CURSOR_X
; lda PEASANT_Y
; sta CURSOR_Y
;=======================
; draw initial peasant
jsr save_bg_1x28
; jsr save_bg_1x28
jsr draw_peasant
; jsr draw_peasant
;=======================
; check if in hay
@ -206,19 +206,40 @@ before_jhonka_cave:
no_before_game_text:
;=================================
;=================================
;=================================
; main loop
;=================================
;=================================
;=================================
game_loop:
;==============
; move peasant
jsr move_peasant
;=====================
; always draw peasant
jsr draw_peasant
;==================
; increment frame
inc FRAME
;====================
; check keyboard
jsr check_keyboard
lda LEVEL_OVER
bmi oops_new_location
bne game_over
; delay
lda #200
@ -238,48 +259,19 @@ game_over:
.include "peasant_common.s"
.include "move_peasant.s"
.include "draw_peasant.s"
; Moved to qload
;.include "decompress_fast_v2.s"
;.include "hgr_font.s"
;.include "draw_box.s"
;.include "hgr_rectangle.s"
;.include "hgr_1x28_sprite_mask.s"
;.include "hgr_1x5_sprite.s"
;.include "hgr_partial_save.s"
;.include "hgr_input.s"
;.include "hgr_tables.s"
;.include "hgr_text_box.s"
;.include "clear_bottom.s"
;.include "hgr_hgr2.s"
;.include "loadsave_menu.s"
;.include "wait_keypress.s"
;.include "score.s"
.include "gr_copy.s"
.include "hgr_copy.s"
.include "new_map_location.s"
.include "peasant_move.s"
;.include "parse_input.s"
;.include "inventory.s"
.include "keyboard.s"
.include "wait.s"
.include "wait_a_bit.s"
.include "version.inc"
.include "graphics_peasantry/graphics_peasant3.inc"
;.include "sprites/boat_sprites.inc"

View File

@ -37,11 +37,6 @@ peasantry4:
jsr decompress_lzsa2_fast
; update map location
; jsr update_map_location
; update score
jsr update_score
@ -147,10 +142,6 @@ new_location:
not_necessary_cottage:
; put peasant text
lda #<peasant_text
@ -188,17 +179,17 @@ not_kerrek:
;====================
; save background
lda PEASANT_X
sta CURSOR_X
lda PEASANT_Y
sta CURSOR_Y
; lda PEASANT_X
; sta CURSOR_X
; lda PEASANT_Y
; sta CURSOR_Y
;=======================
; draw initial peasant
jsr save_bg_1x28
; jsr save_bg_1x28
jsr draw_peasant
; jsr draw_peasant
;======================
@ -207,12 +198,35 @@ not_kerrek:
jsr check_haystack_exit
;===============================
;===============================
;===============================
; main loop
;===============================
;===============================
;===============================
game_loop:
;===================
; move peasant
jsr move_peasant
;=====================
; always draw peasant
jsr draw_peasant
;====================
; increment frame
inc FRAME
;=====================
; check keyboard
jsr check_keyboard
;==========================
@ -344,38 +358,14 @@ game_over:
.include "peasant_common.s"
.include "move_peasant.s"
.include "draw_peasant.s"
; moved to qload
;.include "decompress_fast_v2.s"
;.include "hgr_font.s"
;.include "draw_box.s"
;.include "hgr_rectangle.s"
;.include "hgr_1x28_sprite_mask.s"
;.include "hgr_1x5_sprite.s"
;.include "hgr_partial_save.s"
;.include "hgr_input.s"
;.include "hgr_tables.s"
;.include "hgr_text_box.s"
;.include "clear_bottom.s"
;.include "hgr_hgr2.s"
;.include "wait_keypress.s"
;.include "loadsave_menu.s"
;.include "score.s"
.include "gr_copy.s"
.include "hgr_copy.s"
.include "peasant_move.s"
.include "new_map_location.s"
;.include "parse_input.s"
;.include "inventory.s"
.include "keyboard.s"
.include "wait.s"
@ -384,8 +374,6 @@ game_over:
.include "graphics_peasantry/graphics_peasant4.inc"
.include "graphics_peasantry/priority_peasant4.inc"
.include "version.inc"

View File

@ -267,28 +267,10 @@ draw_sprite_h:
.byte >smoke5_sprite
.include "peasant_move_tiny.s"
.include "move_peasant_tiny.s"
.include "draw_peasant_tiny.s"
.include "hgr_1x5_save_bg.s"
;.include "decompress_fast_v2.s"
;.include "wait_keypress.s"
;.include "hgr_font.s"
;.include "draw_box.s"
;.include "hgr_rectangle.s"
;.include "hgr_1x5_sprite.s"
;.include "draw_peasant.s"
;.include "hgr_7x28_sprite_mask.s"
;.include "hgr_save_restore.s"
;.include "hgr_partial_save.s"
;.include "hgr_input.s"
;.include "hgr_tables.s"
;.include "hgr_text_box.s"
;.include "clear_bottom.s"
;.include "gr_offsets.s"
;.include "hgr_hgr2.s"
;.include "score.s"
.include "gr_copy.s"
.include "keyboard.s"