diff --git a/games/peasant/Makefile b/games/peasant/Makefile index ed750f87..5ac88145 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -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 diff --git a/games/peasant/ending.s b/games/peasant/ending.s index 4406e4b6..eecd44dd 100644 --- a/games/peasant/ending.s +++ b/games/peasant/ending.s @@ -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 sta INH - jsr hgr_draw_sprite_42x31 + jsr hgr_draw_sprite - jsr wait_until_keypress + lda #2 + jsr wait_a_bit 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 + + update_top: ; put peasant text diff --git a/games/peasant/graphics_end/lake_e_boat.png b/games/peasant/graphics_end/lake_e_boat.png index bdda6614..a00c845f 100644 Binary files a/games/peasant/graphics_end/lake_e_boat.png and b/games/peasant/graphics_end/lake_e_boat.png differ diff --git a/games/peasant/hgr_42x31_sprite.s b/games/peasant/hgr_sprite.s similarity index 55% rename from games/peasant/hgr_42x31_sprite.s rename to games/peasant/hgr_sprite.s index 0aaaee31..033118e4 100644 --- a/games/peasant/hgr_42x31_sprite.s +++ b/games/peasant/hgr_sprite.s @@ -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 diff --git a/games/peasant/sprites/Makefile b/games/peasant/sprites/Makefile index b89dbc51..c50ece01 100644 --- a/games/peasant/sprites/Makefile +++ b/games/peasant/sprites/Makefile @@ -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 diff --git a/games/peasant/sprites/boat_sprites.png b/games/peasant/sprites/boat_sprites.png index 735cef6a..581fd96d 100644 Binary files a/games/peasant/sprites/boat_sprites.png and b/games/peasant/sprites/boat_sprites.png differ diff --git a/utils/hgr-utils/hgr_make_sprite.c b/utils/hgr-utils/hgr_make_sprite.c index 1296466f..3edbb828 100644 --- a/utils/hgr-utils/hgr_make_sprite.c +++ b/utils/hgr-utils/hgr_make_sprite.c @@ -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