peasant: boat mostly working

This commit is contained in:
Vince Weaver 2021-09-16 22:51:55 -04:00
parent a76c2d49d9
commit f8ff9ce708
7 changed files with 114 additions and 28 deletions

View File

@ -181,7 +181,7 @@ ending.o: ending.s zp.inc \
sprites/ending_sprites.inc \
draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \
hgr_14x14_sprite_mask.s hgr_1x5_sprite.s \
hgr_42x31_sprite.s hgr_save_restore.s \
hgr_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s parse_input.s new_map_location.s \
peasant_move.s score.s inventory.s

View File

@ -10,8 +10,6 @@
.include "qload.inc"
ending:
; lda #0
; sta GAME_OVER
jsr hgr_make_tables
@ -64,7 +62,7 @@ boat:
lda #12
sta VGI_RX1
lda #38
lda #98
sta VGI_RY1
lda #202
sta VGI_RXRUN
@ -74,7 +72,7 @@ boat:
lda #214
sta VGI_RX1
lda #38
lda #98
sta VGI_RY1
lda #45
sta VGI_RXRUN
@ -95,8 +93,31 @@ boat:
; animate catching fish
jsr wait_until_keypress
lda #1
sta CURSOR_X
lda #52
sta CURSOR_Y
lda #0
sta BABY_COUNT
boat_loop:
ldy BABY_COUNT
lda boat_progress_l,Y
sta INL
lda boat_progress_h,Y
sta INH
jsr hgr_draw_sprite
lda #4
jsr wait_a_bit
; jsr wait_until_keypress
inc BABY_COUNT
lda BABY_COUNT
cmp #14
bne boat_loop
;=======================
;=======================
@ -262,11 +283,16 @@ jhonka:
;=================
; animate jhonka
; repeats 12 times
lda #19
sta CURSOR_X
lda #83
sta CURSOR_Y
lda #13
sta BABY_COUNT
animation_loop:
lda #<jhonka1
@ -274,20 +300,25 @@ animation_loop:
lda #>jhonka1
sta INH
jsr hgr_draw_sprite_42x31
jsr hgr_draw_sprite
jsr wait_until_keypress
lda #2
jsr wait_a_bit
lda #<jhonka2
sta INL
lda #>jhonka2
sta INH
jsr hgr_draw_sprite_42x31
jsr hgr_draw_sprite
jsr wait_until_keypress
lda #2
jsr wait_a_bit
jmp animation_loop
dec BABY_COUNT
bne animation_loop
;========================
;========================
@ -420,7 +451,7 @@ peasant_text:
;.include "version.inc"
.include "hgr_14x14_sprite_mask.s"
.include "hgr_42x31_sprite.s"
.include "hgr_sprite.s"
.include "score.s"
@ -431,7 +462,7 @@ peasant_text:
.include "sprites/ending_sprites.inc"
boat_string:
.byte 2,40
.byte 2,100
.byte " Peasant's Quest",13
.byte "Written by Matt, Jonathan, and Mike",0
@ -518,6 +549,21 @@ baby_progress:
.byte $FF,$FF,0,0
boat_progress_l:
.byte <boat0,<boat1
.byte <boat0,<boat1
.byte <boat0,<boat1
.byte <boat2,<boat3,<boat3
.byte <boat4,<boat5,<boat6,<boat7,<boat7
boat_progress_h:
.byte >boat0,>boat1
.byte >boat0,>boat1
.byte >boat0,>boat1
.byte >boat2,>boat3,>boat3
.byte >boat4,>boat5,>boat6,>boat7,>boat7
update_top:
; put peasant text

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,17 +1,31 @@
;===============================
; hgr 42x31 draw sprite
;===============================
;===========================================
; hgr draw sprite (only at 7-bit boundaries)
;===========================================
; SPRITE in INL/INH
; Location at CURSOR_X CURSOR_Y
; xsize, ysize in first two bytes
; sprite AT INL/INH
hgr_draw_sprite_42x31:
hgr_draw_sprite:
ldy #0
lda (INL),Y
clc
adc CURSOR_X
sta h4231_width_end_smc+1 ; self modify for end of output
iny
lda (INL),Y
sta h4231_ysize_smc+1
; set up sprite pointers
clc
lda INL
adc #2
sta h4231_smc1+1
lda INH
adc #0
sta h4231_smc1+2
ldx #0 ; X is pointer offset
@ -34,21 +48,24 @@ hgr_42x31_sprite_yloop:
sta GBASH
ldy CURSOR_X
tya
clc
adc #6
sta h4231_width_smc+1
h3231_inner_loop:
h4231_smc1:
lda $d000,X ; or in sprite
lda $d000 ; get sprite pattern
sta (GBASL),Y ; store out
inx
iny
h4231_width_smc:
inc h4231_smc1+1
bne h4231_noflo
inc h4231_smc1+2
h4231_noflo:
h4231_width_end_smc:
cpy #6
bne h3231_inner_loop
@ -56,6 +73,7 @@ h4231_width_smc:
inc MASK ; row
lda MASK ; row
h4231_ysize_smc:
cmp #31
bne hgr_42x31_sprite_yloop

View File

@ -23,7 +23,7 @@ inventory_sprites.inc: inventory.png
$(HGR_SPRITE) -l tshirt_sprite inventory.png 42 139 55 155 >> inventory_sprites.inc
ending_sprites.inc: end_sprites.png
ending_sprites.inc: end_sprites.png boat_sprites.png
$(HGR_SPRITE) -l baby0_sprite end_sprites.png 14 3 27 17 > ending_sprites.inc
$(HGR_SPRITE) -l baby0_mask end_sprites.png 42 3 55 17 >> ending_sprites.inc
$(HGR_SPRITE) -l baby1_sprite end_sprites.png 14 20 27 34 >> ending_sprites.inc
@ -46,8 +46,17 @@ ending_sprites.inc: end_sprites.png
$(HGR_SPRITE) -l baby9_mask end_sprites.png 42 156 55 170 >> ending_sprites.inc
$(HGR_SPRITE) -l baby10_sprite end_sprites.png 14 173 27 187 >> ending_sprites.inc
$(HGR_SPRITE) -l baby10_mask end_sprites.png 42 173 55 187 >> ending_sprites.inc
$(HGR_SPRITE) -l jhonka1 end_sprites.png 105 84 145 115 >> ending_sprites.inc
$(HGR_SPRITE) -l jhonka2 end_sprites.png 105 121 145 152 >> ending_sprites.inc
$(HGR_SPRITE) -s -l jhonka1 end_sprites.png 105 84 145 115 >> ending_sprites.inc
$(HGR_SPRITE) -s -l jhonka2 end_sprites.png 105 121 145 152 >> ending_sprites.inc
$(HGR_SPRITE) -s -l boat0 boat_sprites.png 7 1 81 45 >> ending_sprites.inc
$(HGR_SPRITE) -s -l boat1 boat_sprites.png 7 47 81 91 >> ending_sprites.inc
$(HGR_SPRITE) -s -l boat2 boat_sprites.png 7 93 81 137 >> ending_sprites.inc
$(HGR_SPRITE) -s -l boat3 boat_sprites.png 7 139 81 183 >> ending_sprites.inc
$(HGR_SPRITE) -s -l boat4 boat_sprites.png 91 1 165 45 >> ending_sprites.inc
$(HGR_SPRITE) -s -l boat5 boat_sprites.png 91 47 165 91 >> ending_sprites.inc
$(HGR_SPRITE) -s -l boat6 boat_sprites.png 91 93 165 137 >> ending_sprites.inc
$(HGR_SPRITE) -s -l boat7 boat_sprites.png 91 139 165 183 >> ending_sprites.inc
clean:
rm -f *~ inventory_sprites.inc ending_sprites.inc

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -380,6 +380,7 @@ static unsigned char apple2_image[8192];
int main(int argc, char **argv) {
int xsize=0,ysize=0,error;
int printsize=0;
int c,x,y,z,color1;
unsigned char *image;
unsigned char byte1,byte2,colors[14];
@ -387,13 +388,15 @@ int main(int argc, char **argv) {
int x1,y1,x2,y2;
int xs;
char *filename;
strncpy(label_string,"sprite",BUFSIZ);
/* Parse command line arguments */
while ( (c=getopt(argc, argv, "hvdl:") ) != -1) {
while ( (c=getopt(argc, argv, "hvdsl:") ) != -1) {
switch(c) {
@ -403,9 +406,12 @@ int main(int argc, char **argv) {
case 'v':
print_help(argv[0],1);
break;
case 'd':
case 'd':
debug=1;
break;
case 's':
printsize=1;
break;
case 'l':
strncpy(label_string,optarg,BUFSIZ-1);
break;
@ -468,6 +474,13 @@ int main(int argc, char **argv) {
printf("; %d %d %d %d\n",x1,y1,x2,y2);
printf("%s:\n",label_string);
if (printsize) {
xs=(x2/7-x1/7);
if (!((x2%7==0)&&(x1%7==0))) xs++;
printf("\t.byte $%02X,$%02X\n",
xs,y2-y1);
}
for(y=y1;y<y2;y++) {
printf("\t.byte ");
for(x=x1/7;x<=x2/7;x++) {