mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-05 21:34:30 +00:00
peasant: have tiny peasant in the cave
This commit is contained in:
parent
ab923d0871
commit
fe2daa882c
@ -396,10 +396,11 @@ trogdor.o: trogdor.s zp.inc \
|
||||
DIALOG_TROGDOR.LZSA dialog_trogdor.inc \
|
||||
ssi263_simple_speech.s \
|
||||
draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \
|
||||
hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
|
||||
hgr_1x5_save_bg.s hgr_1x5_sprite.s hgr_save_restore.s \
|
||||
wait_a_bit.s draw_peasant.s hgr_text_box.s \
|
||||
draw_peasant_tiny.s \
|
||||
keyboard.s new_map_location.s \
|
||||
peasant_move.s score.s inventory.s \
|
||||
peasant_move_tiny.s score.s inventory.s \
|
||||
trogdor_actions.s
|
||||
|
||||
ca65 -o trogdor.o trogdor.s -l trogdor.lst
|
||||
|
@ -214,7 +214,17 @@ just_go_there:
|
||||
;************************
|
||||
level_over:
|
||||
|
||||
; new location, different file
|
||||
; new location
|
||||
; in theory this can only be TROGDOR
|
||||
|
||||
lda #4
|
||||
sta PEASANT_X
|
||||
lda #170
|
||||
sta PEASANT_Y
|
||||
|
||||
lda #0
|
||||
sta PEASANT_XADD
|
||||
sta PEASANT_YADD
|
||||
|
||||
rts
|
||||
|
||||
|
73
games/peasant/draw_peasant_tiny.s
Normal file
73
games/peasant/draw_peasant_tiny.s
Normal file
@ -0,0 +1,73 @@
|
||||
|
||||
;============================
|
||||
; draw peasant
|
||||
;============================
|
||||
draw_peasant:
|
||||
lda PEASANT_X
|
||||
sta CURSOR_X
|
||||
lda PEASANT_Y
|
||||
sta CURSOR_Y
|
||||
|
||||
; urgh hack
|
||||
; for up/down always face right
|
||||
|
||||
lda PEASANT_DIR
|
||||
cmp #PEASANT_DIR_RIGHT
|
||||
beq peasant_right
|
||||
cmp #PEASANT_DIR_LEFT
|
||||
beq peasant_left
|
||||
cmp #PEASANT_DIR_DOWN
|
||||
beq peasant_right
|
||||
|
||||
;=====================
|
||||
; right right right
|
||||
|
||||
peasant_right:
|
||||
lda CURSOR_X
|
||||
and #1
|
||||
bne draw_right1
|
||||
|
||||
draw_right2:
|
||||
lda #<tiny_r2_sprite
|
||||
sta INL
|
||||
lda #>tiny_r2_sprite
|
||||
jmp done_pick_draw
|
||||
|
||||
draw_right1:
|
||||
lda #<tiny_r1_sprite
|
||||
sta INL
|
||||
lda #>tiny_r1_sprite
|
||||
jmp done_pick_draw
|
||||
|
||||
;=====================
|
||||
; left left left
|
||||
|
||||
peasant_left:
|
||||
lda CURSOR_X
|
||||
and #1
|
||||
bne draw_left1
|
||||
|
||||
draw_left2:
|
||||
lda #<tiny_l2_sprite
|
||||
sta INL
|
||||
lda #>tiny_l2_sprite
|
||||
jmp done_pick_draw
|
||||
|
||||
draw_left1:
|
||||
lda #<tiny_l1_sprite
|
||||
sta INL
|
||||
lda #>tiny_l1_sprite
|
||||
jmp done_pick_draw
|
||||
|
||||
|
||||
|
||||
|
||||
done_pick_draw:
|
||||
sta INH
|
||||
|
||||
jsr hgr_draw_sprite
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 886 B After Width: | Height: | Size: 6.3 KiB |
80
games/peasant/hgr_1x5_save_bg.s
Normal file
80
games/peasant/hgr_1x5_save_bg.s
Normal file
@ -0,0 +1,80 @@
|
||||
;======================
|
||||
; save bg 1x5
|
||||
;======================
|
||||
|
||||
save_bg_1x5:
|
||||
|
||||
ldx #0
|
||||
save_yloop:
|
||||
txa
|
||||
pha
|
||||
|
||||
clc
|
||||
adc CURSOR_Y
|
||||
|
||||
|
||||
; calc GBASL/GBASH
|
||||
|
||||
tax
|
||||
lda hposn_low,X
|
||||
sta GBASL
|
||||
lda hposn_high,X
|
||||
sta GBASH
|
||||
|
||||
pla
|
||||
tax
|
||||
|
||||
ldy CURSOR_X
|
||||
|
||||
lda (GBASL),Y
|
||||
sta save_sprite_1x5,X
|
||||
|
||||
inx
|
||||
cpx #5
|
||||
bne save_yloop
|
||||
|
||||
rts
|
||||
|
||||
;======================
|
||||
; restore bg 1x5
|
||||
;======================
|
||||
|
||||
restore_bg_1x5:
|
||||
|
||||
ldx #0
|
||||
restore_yloop:
|
||||
txa ; current row
|
||||
clc
|
||||
adc CURSOR_Y ; add in y start point
|
||||
|
||||
; calc GBASL/GBASH using lookup table
|
||||
|
||||
tay
|
||||
lda hposn_low,Y
|
||||
sta GBASL
|
||||
lda hposn_high,Y
|
||||
sta GBASH
|
||||
|
||||
ldy CURSOR_X
|
||||
|
||||
lda save_sprite_1x5,X
|
||||
sta (GBASL),Y
|
||||
|
||||
inx
|
||||
cpx #5
|
||||
bne restore_yloop
|
||||
|
||||
rts
|
||||
|
||||
|
||||
;====================
|
||||
; save area
|
||||
;====================
|
||||
|
||||
save_sprite_1x5:
|
||||
.byte $00,$00,$00,$00,$00
|
||||
|
||||
;ysave:
|
||||
;.byte $00
|
||||
;xsave:
|
||||
;.byte $00
|
207
games/peasant/peasant_move_tiny.s
Normal file
207
games/peasant/peasant_move_tiny.s
Normal file
@ -0,0 +1,207 @@
|
||||
; Move that Peasant!
|
||||
|
||||
move_peasant_tiny:
|
||||
|
||||
; redraw peasant if moved
|
||||
|
||||
lda PEASANT_XADD
|
||||
ora PEASANT_YADD
|
||||
bne really_move_peasant
|
||||
|
||||
jmp peasant_the_same
|
||||
|
||||
really_move_peasant:
|
||||
|
||||
; restore bg behind peasant
|
||||
|
||||
lda PEASANT_X
|
||||
sta CURSOR_X
|
||||
|
||||
lda PEASANT_Y
|
||||
sta CURSOR_Y
|
||||
|
||||
jsr restore_bg_1x5
|
||||
|
||||
; move peasant
|
||||
|
||||
clc
|
||||
lda PEASANT_X
|
||||
adc PEASANT_XADD ; A = new X
|
||||
|
||||
bmi peasant_x_negative ; if newx <0, handle
|
||||
|
||||
cmp #40
|
||||
bcs peasant_x_toobig ; if newx>=40, hanfle (bge)
|
||||
|
||||
pha
|
||||
|
||||
tay
|
||||
clc
|
||||
lda PEASANT_Y
|
||||
adc PEASANT_YADD
|
||||
tax
|
||||
jsr peasant_collide
|
||||
|
||||
pla
|
||||
|
||||
bcc done_movex ; no collide
|
||||
|
||||
jsr stop_peasant ; stop moving
|
||||
|
||||
lda PEASANT_X ; leave same
|
||||
|
||||
jmp done_movex
|
||||
|
||||
;============================
|
||||
peasant_x_toobig:
|
||||
peasant_x_negative:
|
||||
|
||||
done_movex:
|
||||
sta PEASANT_X
|
||||
|
||||
|
||||
; Move Peasant Y
|
||||
|
||||
clc
|
||||
lda PEASANT_Y
|
||||
adc PEASANT_YADD ; newy in A
|
||||
|
||||
cmp #45 ; if <45 then off screen
|
||||
bcc peasant_y_negative ; blt
|
||||
|
||||
cmp #160 ; if >=150 then off screen
|
||||
bcs peasant_y_toobig ; bge
|
||||
|
||||
; check collide
|
||||
|
||||
pha
|
||||
|
||||
ldy PEASANT_X
|
||||
tax ; newy
|
||||
jsr peasant_collide
|
||||
|
||||
pla
|
||||
|
||||
bcc done_movey ; no collide
|
||||
|
||||
jsr stop_peasant ; stop moving
|
||||
|
||||
lda PEASANT_Y ; leave same
|
||||
|
||||
jmp done_movey
|
||||
|
||||
|
||||
;============================
|
||||
peasant_y_toobig:
|
||||
peasant_y_negative:
|
||||
|
||||
jmp done_movey
|
||||
|
||||
; check edge of screen
|
||||
done_movey:
|
||||
sta PEASANT_Y
|
||||
|
||||
; if we moved off screen, don't re-draw peasant
|
||||
|
||||
lda LEVEL_OVER
|
||||
bne peasant_the_same
|
||||
|
||||
; save behind new position
|
||||
|
||||
lda PEASANT_X
|
||||
sta CURSOR_X
|
||||
|
||||
lda PEASANT_Y
|
||||
sta CURSOR_Y
|
||||
|
||||
jsr save_bg_1x5
|
||||
|
||||
; draw peasant
|
||||
|
||||
jsr draw_peasant
|
||||
|
||||
peasant_the_same:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
; when peasants collide
|
||||
|
||||
; at B2 = 178
|
||||
; 178 - 4 = 174
|
||||
; check for collide 174+5 = 179 = $B3 1011 0011
|
||||
|
||||
;===================
|
||||
; peasant_collide
|
||||
;===================
|
||||
; newx/7 in Y
|
||||
; newy in X
|
||||
; returns C=0 if no collide
|
||||
; C=1 if collide
|
||||
peasant_collide:
|
||||
; rrrr rtii top 5 bits row, bit 2 top/bottom
|
||||
|
||||
; add 5 to collide with feet
|
||||
txa
|
||||
clc
|
||||
adc #5
|
||||
tax
|
||||
|
||||
txa
|
||||
and #$04 ; see if odd/even
|
||||
beq peasant_collide_even
|
||||
|
||||
peasant_collide_odd:
|
||||
lda #$f0
|
||||
bne peasant_collide_mask ; bra
|
||||
|
||||
peasant_collide_even:
|
||||
lda #$0f
|
||||
peasant_collide_mask:
|
||||
|
||||
sta MASK
|
||||
|
||||
txa
|
||||
lsr
|
||||
lsr ; need to divide by 8 then * 2
|
||||
lsr ; can't just div by 4 as we need to mask bottom bit
|
||||
asl
|
||||
tax
|
||||
|
||||
lda gr_offsets,X
|
||||
sta INL
|
||||
lda gr_offsets+1,X
|
||||
sta INH
|
||||
|
||||
lda (INL),Y ; get value
|
||||
|
||||
and MASK
|
||||
|
||||
; ldy MASK
|
||||
; cpy #$f0
|
||||
; beq in_top
|
||||
;in_bottom:
|
||||
; and #$0f
|
||||
; jmp done_feet
|
||||
;in_top:
|
||||
; lsr
|
||||
; lsr
|
||||
; lsr
|
||||
; lsr
|
||||
;done_feet:
|
||||
|
||||
beq collide_true ; true if color 0
|
||||
;bne collide_false
|
||||
|
||||
collide_false:
|
||||
clc
|
||||
rts
|
||||
|
||||
collide_true:
|
||||
sec
|
||||
rts
|
||||
|
||||
|
||||
|
||||
.include "gr_offsets.s"
|
@ -1,7 +1,8 @@
|
||||
HGR_SPRITE = ../../../utils/hgr-utils/hgr_make_sprite
|
||||
|
||||
all: inventory_sprites.inc ending_sprites.inc trogdor_sprites.inc \
|
||||
boat_sprites.inc peasant_sprites.inc ned_sprites.inc
|
||||
boat_sprites.inc peasant_sprites.inc ned_sprites.inc \
|
||||
peasant_robe_sprites.inc
|
||||
|
||||
peasant_sprites.inc: peasant_sprites.png
|
||||
$(HGR_SPRITE) -l peasant_right1_sprite peasant_sprites.png 35 1 35 29 > peasant_sprites.inc
|
||||
@ -21,6 +22,25 @@ peasant_sprites.inc: peasant_sprites.png
|
||||
$(HGR_SPRITE) -l peasant_down2_sprite peasant_sprites.png 84 102 90 130 >> peasant_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_down2_mask peasant_sprites.png 70 102 76 130 >> peasant_sprites.inc
|
||||
|
||||
peasant_robe_sprites.inc: peasant_sprites.png
|
||||
$(HGR_SPRITE) -l peasant_right1_sprite peasant_sprites.png 133 1 133 29 > peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_right1_mask peasant_sprites.png 119 1 119 29 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_right2_sprite peasant_sprites.png 133 34 133 62 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_right2_mask peasant_sprites.png 119 34 119 62 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_up1_sprite peasant_sprites.png 133 68 133 96 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_up1_mask peasant_sprites.png 119 68 119 96 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_up2_sprite peasant_sprites.png 133 102 133 130 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_up2_mask peasant_sprites.png 119 102 119 130 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_left1_sprite peasant_sprites.png 182 1 188 29 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_left1_mask peasant_sprites.png 168 1 174 29 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_left2_sprite peasant_sprites.png 182 34 188 62 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_left2_mask peasant_sprites.png 168 34 174 62 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_down1_sprite peasant_sprites.png 182 68 188 96 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_down1_mask peasant_sprites.png 168 68 174 96 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_down2_sprite peasant_sprites.png 182 102 188 130 >> peasant_robe_sprites.inc
|
||||
$(HGR_SPRITE) -l peasant_down2_mask peasant_sprites.png 168 102 174 130 >> peasant_robe_sprites.inc
|
||||
|
||||
|
||||
|
||||
|
||||
boat_sprites.inc: boat_sprites.png
|
||||
@ -105,7 +125,20 @@ trogdor_sprites.inc: trogdor_sprites.png
|
||||
$(HGR_SPRITE) -s -l dashing6_sprite trogdor_sprites.png 98 6 104 45 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l dashing7_sprite trogdor_sprites.png 112 6 118 45 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l dashing8_sprite trogdor_sprites.png 126 6 132 45 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l tiny_r1_sprite trogdor_sprites.png 14 49 20 54 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l tiny_r2_sprite trogdor_sprites.png 28 49 34 54 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l tiny_l1_sprite trogdor_sprites.png 14 57 20 61 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l tiny_l2_sprite trogdor_sprites.png 28 57 34 61 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l sword1_sprite trogdor_sprites.png 42 48 48 53 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l sword2_sprite trogdor_sprites.png 49 48 55 53 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l sword3_sprite trogdor_sprites.png 56 48 62 53 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l sword4_sprite trogdor_sprites.png 63 48 69 53 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l sword5_sprite trogdor_sprites.png 70 48 76 53 >> trogdor_sprites.inc
|
||||
$(HGR_SPRITE) -s -l sword6_sprite trogdor_sprites.png 77 48 83 53 >> trogdor_sprites.inc
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *~ peasant_sprites.inc inventory_sprites.inc \
|
||||
ending_sprites.inc trogdor_sprites.inc ned_sprites.inc
|
||||
ending_sprites.inc trogdor_sprites.inc ned_sprites.inc \
|
||||
peasant_robe_sprites.inc
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 9.9 KiB |
@ -1,6 +1,6 @@
|
||||
; Peasant's Quest Trgodor scene
|
||||
|
||||
; From when the sword hits Trogdor on
|
||||
; The inner sanctum
|
||||
|
||||
; by Vince `deater` Weaver vince@deater.net
|
||||
|
||||
@ -108,6 +108,21 @@ new_location:
|
||||
|
||||
jsr update_top
|
||||
|
||||
;====================
|
||||
; save background
|
||||
|
||||
lda PEASANT_X
|
||||
sta CURSOR_X
|
||||
lda PEASANT_Y
|
||||
sta CURSOR_Y
|
||||
|
||||
;=======================
|
||||
; draw initial peasant
|
||||
|
||||
jsr save_bg_1x5
|
||||
|
||||
jsr draw_peasant
|
||||
|
||||
|
||||
;===========================
|
||||
; intro message
|
||||
@ -117,7 +132,7 @@ new_location:
|
||||
jsr finish_parse_message
|
||||
|
||||
game_loop:
|
||||
; jsr move_peasant
|
||||
jsr move_peasant_tiny
|
||||
|
||||
inc FRAME
|
||||
|
||||
@ -147,6 +162,9 @@ level_over:
|
||||
rts
|
||||
|
||||
|
||||
.include "peasant_move_tiny.s"
|
||||
.include "draw_peasant_tiny.s"
|
||||
.include "hgr_1x5_save_bg.s"
|
||||
|
||||
;.include "decompress_fast_v2.s"
|
||||
;.include "wait_keypress.s"
|
||||
@ -187,29 +205,6 @@ level_over:
|
||||
|
||||
.include "sprites/trogdor_sprites.inc"
|
||||
|
||||
;trogdor_string:
|
||||
; .byte 0,43,32, 0,253,82
|
||||
; .byte 8,41
|
||||
; .byte 34,"I can honestly say it'll",13
|
||||
; .byte "be a pleasure and an honor",13
|
||||
; .byte "to burninate you, Rather",13
|
||||
; .byte "Dashing.",34,0
|
||||
|
||||
;trogdor_string2:
|
||||
; .byte 0,43,32, 0,253,66
|
||||
; .byte 8,41
|
||||
; .byte "Aw that sure was nice of",13
|
||||
; .byte "him!",0
|
||||
|
||||
;trogdor_string3:
|
||||
; .byte 0,43,32, 0,253,90
|
||||
; .byte 8,41
|
||||
; .byte "Congratulations! You've",13
|
||||
; .byte "won! No one can kill",13
|
||||
; .byte "Trogdor but you came closer",13
|
||||
; .byte "than anybody ever! Way to",13
|
||||
; .byte "go!",0
|
||||
|
||||
|
||||
update_top:
|
||||
; put peasant text
|
||||
|
Loading…
x
Reference in New Issue
Block a user