tfv: more work on battle

This commit is contained in:
Vince Weaver 2021-01-11 15:20:43 -05:00
parent 278dfb9c3f
commit cd67c4e4da
8 changed files with 875 additions and 417 deletions

View File

@ -31,7 +31,7 @@ HELLO: hello.bas
LOADER: loader.o
ld65 -o LOADER loader.o -C ../../linker_scripts/apple2_1000.inc
loader.o: loader.s init_vars.s common_defines.inc
loader.o: loader.s init_vars.s common_defines.inc zp.inc
ca65 -o loader.o loader.s -l loader.lst
###
@ -39,7 +39,7 @@ loader.o: loader.s init_vars.s common_defines.inc
TFV_TITLE: tfv_title.o
ld65 -o TFV_TITLE tfv_title.o -C ../../linker_scripts/apple2_2000.inc
tfv_title.o: tfv_title.s \
tfv_title.o: tfv_title.s zp.inc \
gr_vlin.s tfv_opener.s \
draw_menu.s keyboard.s joystick.s \
graphics_title/tfv_title.inc
@ -52,8 +52,7 @@ tfv_title.o: tfv_title.s \
TFV_FLYING: tfv_flying.o
ld65 -o TFV_FLYING tfv_flying.o -C ../../linker_scripts/apple2_2000.inc
tfv_flying.o: tfv_flying.s \
zp.inc \
tfv_flying.o: tfv_flying.s zp.inc \
gr_putsprite.s \
help_flying.s \
flying_mode7.s flying_sprites.inc
@ -64,10 +63,10 @@ tfv_flying.o: tfv_flying.s \
TFV_WORLD: tfv_world.o
ld65 -o TFV_WORLD tfv_world.o -C ../../linker_scripts/apple2_2000.inc
tfv_world.o: tfv_world.s \
tfv_world.o: tfv_world.s zp.inc \
tfv_overworld.s tfv_drawmap.s tfv_battle.s \
help_overworld.s rotate_intro.s \
graphics_map/tfv_backgrounds.inc tfv_sprites.inc zp.inc
graphics_map/tfv_backgrounds.inc tfv_sprites.inc
ca65 -o tfv_world.o tfv_world.s -l tfv_world.lst
graphics_map/tfv_backgrounds.inc:

View File

@ -0,0 +1,359 @@
;=============================================
; put_sprite_crop
;=============================================
; Sprite to display in INH,INL
; Location is XPOS,YPOS
; Note, only works if YPOS is multiple of two
; transparent color is $A (grey #2)
; this means we can have black ($0) in a sprite
; FIXME: force YPOS to be even?
put_sprite_crop:
ldy #0 ; byte 0 is xsize ; 2
lda (INL),Y ; 5
sta CH ; xsize is in CH ; 3
iny ; 2
clc
adc XPOS
sta XMAX
lda (INL),Y ; byte 1 is ysize ; 5
sta CV ; ysize is in CV ; 3
iny ; 2
lda YPOS ; make a copy of ypos ; 3
sta TEMPY ; as we modify it ; 3
;===========
; 28
put_sprite_crop_loop:
sty TEMP ; save sprite pointer ; 3
ldy TEMPY ; 3
bpl put_sprite_crop_pos ; if < 0, skip to next
clc ; skip line in sprite too
lda TEMP
adc CH
tay
bne crop_increment_y
put_sprite_crop_pos:
psc_smc1:
cpy #48 ; bge if >= 48, done sprite
bcs crop_sprite_done
lda gr_offsets,Y ; lookup low-res memory address ; 4
clc ; 2
adc XPOS ; add in xpos ; 3
sta OUTL ; store out low byte of addy ; 3
clc ; never wraps, handle negative
lda gr_offsets+1,Y ; look up high byte ; 4
adc DRAW_PAGE ; ; 3
sta OUTH ; and store it out ; 3
ldy TEMP ; restore sprite pointer ; 3
; OUTH:OUTL now points at right place
ldx XPOS ; load xposition into x ; 3
;===========
; 34
crop_put_sprite_pixel:
lda (INL),Y ; get sprite colors ; 5
iny ; increment sprite pointer ; 2
sty TEMP ; save sprite pointer ; 3
cpx #0 ; if off-screen left, skip draw
bmi skip_drawing
cpx #40
bcs skip_drawing ; if off-screen right, skip draw
ldy #$0 ; 2
; check if completely transparent
; if so, skip
cmp #$aa ; if all zero, transparent ; 2
beq crop_put_sprite_done_draw ; don't draw it ; 2nt/3
;==============
; 16/17
sta COLOR ; save color for later ; 3
; check if top pixel transparent
and #$f0 ; check if top nibble zero ; 2
cmp #$a0
bne crop_put_sprite_bottom ; if not skip ahead ; 2nt/3
;==============
; 7/8
lda COLOR
and #$0f
sta COLOR
lda #$f0 ; setup mask ; 2
sta MASK ; 3
bmi crop_put_sprite_mask ; always? ; 3
;=============
; 8
crop_put_sprite_bottom:
lda COLOR ; re-load color ; 3
and #$0f ; check if bottom nibble zero ; 2
cmp #$0a
bne crop_put_sprite_all ; if not, skip ahead ; 2nt/3
;=============
; 7/8
lda COLOR
and #$f0
sta COLOR
lda #$0f ; 2
sta MASK ; setup mask ; 3
;===========
; 5
crop_put_sprite_mask:
lda (OUTL),Y ; get color at output ; 5
and MASK ; mask off unneeded part ; 3
ora COLOR ; or the color in ; 3
sta (OUTL),Y ; store it back ; 6
jmp crop_put_sprite_done_draw ; we are done ; 3
;===========
; 20
crop_put_sprite_all:
lda COLOR ; load color ; 3
sta (OUTL),Y ; and write it out ; 6
;============
; 9
crop_put_sprite_done_draw:
skip_drawing:
ldy TEMP ; restore sprite pointer ; 3
inc OUTL ; increment output pointer ; 5
inx ; increment x counter ; 2
cpx XMAX
bne crop_put_sprite_pixel ; if not done, keep looping ; 2nt/3
;==============
; 12/13
crop_increment_y:
inc TEMPY ; each line has two y vars ; 5
inc TEMPY ; 5
dec CV ; decemenet total y count ; 5
bne put_sprite_crop_loop ; loop if not done ; 2nt/3
;==============
; 17/18
crop_sprite_done:
rts ; return ; 6
; 0,0 = 400+0
; -1,0 = 400+ff=4ff, inc=400
; sprite: 5x4
;
; -2,0 Xstart=0, sprite_offset=2, xsize=3
; -1,0, Xstart=0, sprite_offset=1, xsize=4
; 0,0, Xstrat=0, sprite_offset=0, xsize=5
; 1,0, Xstart=1, sprite_offset=0, xsize=5
;
; 39,0 Xstart=39, sprite_offset=0, xsize=1
;
;
;
;
.if 0
;=============================================
; put_sprite_flipped_crop
;=============================================
; Sprite to display in INH,INL
; Location is XPOS,YPOS
; Note, only works if YPOS is multiple of two
; transparent color is $A (grey #2)
; this means we can have black ($0) in a sprite
put_sprite_flipped_crop:
ldy #0 ; byte 0 is xsize ; 2
lda (INL),Y ; 5
sta CH ; xsize is in CH ; 3
iny ; 2
lda (INL),Y ; byte 1 is ysize ; 5
sta CV ; ysize is in CV ; 3
dey ; make Y zero again ; 2
lda INH ; ???
sta ppfc_smc+2
clc
lda INL
adc #1 ; add one (not two) because X counts
; from CH to 1 (not CH-1 to 0)
sta ppfc_smc+1
bcc psfc16
inc ppfc_smc+2
psfc16:
lda YPOS ; make a copy of ypos ; 3
sta TEMPY ; as we modify it ; 3
;===========
; 28
put_spritefc_loop:
; sty TEMP ; save sprite pointer ; 3
ldy TEMPY ; 3
bmi fcrop_increment_y ; if < 0, skip to next
psc_smc2:
cpy #48 ; bge if >= 48, done sprite
bcs fcrop_sprite_done
lda gr_offsets,Y ; lookup low-res memory address ; 4
clc ; 2
adc XPOS ; add in xpos ; 3
sta OUTL ; store out low byte of addy ; 3
lda gr_offsets+1,Y ; look up high byte ; 4
clc
adc DRAW_PAGE ; ; 3
sta OUTH ; and store it out ; 3
; ldy TEMP ; restore sprite pointer ; 3
; OUTH:OUTL now points at right place
ldx CH ; load xsize into x ; 3
;===========
; 34
put_spritefc_pixel:
clc
txa ; want (CH-X-1)+XPOS
eor #$ff
adc CH
adc XPOS
bmi cskip_drawing
cmp #40
bcs cskip_drawing ; if off-screen right, skip draw
ppfc_smc:
lda $C000,X ; get sprite colors ; 5
; iny ; increment sprite pointer ; 2
; sty TEMP ; save sprite pointer ; 3
ldy #$0 ; 2
; check if completely transparent
; if so, skip
cmp #$aa ; if all zero, transparent ; 2
beq put_spritefc_done_draw ; don't draw it ; 2nt/3
;==============
; 16/17
sta COLOR ; save color for later ; 3
; check if top pixel transparent
and #$f0 ; check if top nibble zero ; 2
cmp #$a0
bne put_spritefc_bottom ; if not skip ahead ; 2nt/3
;==============
; 7/8
lda COLOR
and #$0f
sta COLOR
lda #$f0 ; setup mask ; 2
sta MASK ; 3
bmi put_spritefc_mask ; always? ; 3
;=============
; 8
put_spritefc_bottom:
lda COLOR ; re-load color ; 3
and #$0f ; check if bottom nibble zero ; 2
cmp #$0a
bne put_spritefc_all ; if not, skip ahead ; 2nt/3
;=============
; 7/8
lda COLOR
and #$f0
sta COLOR
lda #$0f ; 2
sta MASK ; setup mask ; 3
;===========
; 5
put_spritefc_mask:
lda (OUTL),Y ; get color at output ; 5
and MASK ; mask off unneeded part ; 3
ora COLOR ; or the color in ; 3
sta (OUTL),Y ; store it back ; 6
jmp put_spritefc_done_draw ; we are done ; 3
;===========
; 20
put_spritefc_all:
lda COLOR ; load color ; 3
sta (OUTL),Y ; and write it out ; 6
;============
; 9
put_spritefc_done_draw:
cskip_drawing:
; ldy TEMP ; restore sprite pointer ; 3
inc OUTL ; increment output pointer ; 5
dex ; decrement x counter ; 2
bne put_spritefc_pixel ; if not done, keep looping ; 2nt/3
;==============
; 12/13
fcrop_increment_y:
inc TEMPY ; each line has two y vars ; 5
inc TEMPY ; 5
lda CH
clc
adc ppfc_smc+1
sta ppfc_smc+1
bcc psfco
inc ppfc_smc+2
psfco:
dec CV ; decemenet total y count ; 5
beq fcrop_sprite_done ; loop if not done ; 2nt/3
jmp put_spritefc_loop
;==============
; 17/18
fcrop_sprite_done:
rts ; return ; 6
.endif

View File

@ -4,9 +4,13 @@
do_battle:
lda #34
sta HERO_X
lda #0
sta HERO_STATE
; int i,ch;
; int saved_drawpage;
; int ax=34;
; int enemy_count=30;
; int old;
@ -25,69 +29,184 @@ do_battle:
; enemy_hp=enemies[enemy_type].hp_base+
; (rand()&enemies[enemy_type].hp_mask);
.endif
saved_drawpage=ram[DRAW_PAGE];
;==========================
; Draw background
ram[DRAW_PAGE]=PAGE2;
;==========================
; Draw sky
ldx #0 ; blue from 0 .. 10
battle_sky_loop:
lda gr_offsets,X
sta GBASL
lda gr_offsets+1,X
clc
adc #$8 ; store to $C00
sta GBASH
lda #$66 ; COLOR_MEDIUMBLUE
ldy #0
battle_sky_inner:
sta (GBASL),Y
iny
cpy #40
bne battle_sky_inner
inx
inx
cpx #10
bne battle_sky_loop
; green from 10 .. 40
battle_ground_loop:
lda gr_offsets,X
sta GBASL
lda gr_offsets+1,X
clc
adc #$8 ; store to $C00
sta GBASH
lda #$CC ; COLOR_LIGHTGREEN
; FIXME: should be GROUNDCOLOR
ldy #0
battle_ground_inner:
sta (GBASL),Y
iny
cpy #40
bne battle_ground_inner
inx
inx
cpx #40
bne battle_ground_loop
; Draw some background images for variety?
jsr draw_battle_bottom
main_battle_loop:
jsr gr_copy_to_current
;========================================
; draw our hero
;========================================
lda HERO_HP
beq battle_draw_hero_down
lda HERO_STATE
and #HERO_STATE_RUNNING
bne battle_draw_hero_running
jmp battle_draw_normal_hero
battle_draw_hero_down:
; grsim_put_sprite(tfv_defeat,ax-2,24);
lda HERO_X
sec
sbc #2
sta XPOS
lda #24
sta YPOS
lda #<tfv_defeat_sprite
sta INL
lda #>tfv_defeat_sprite
jmp battle_actual_draw_hero
battle_draw_hero_running:
; grsim_put_sprite(tfv_stand_right,ax,20);
; grsim_put_sprite(tfv_walk_right,ax,20);
lda HERO_X
sta XPOS
lda #20
sta YPOS
lda FRAMEL
and #$8
beq battle_draw_running_walk
battle_draw_running_stand:
lda #<tfv_stand_right_sprite
sta INL
lda #>tfv_stand_right_sprite
jmp battle_actual_draw_hero
battle_draw_running_walk:
lda #<tfv_walk_right_sprite
sta INL
lda #>tfv_walk_right_sprite
jmp battle_actual_draw_hero
battle_draw_normal_hero:
; grsim_put_sprite(tfv_stand_left,ax,20);
lda HERO_X
sta XPOS
lda #20
sta YPOS
lda #<tfv_stand_left_sprite
sta INL
lda #>tfv_stand_left_sprite
sta INH
jsr put_sprite_crop
battle_draw_normal_sword:
; grsim_put_sprite(tfv_led_sword,ax-5,20);
lda HERO_X
sec
sbc #5
sta XPOS
lda #20
sta YPOS
lda #<tfv_led_sword_sprite
sta INL
lda #>tfv_led_sword_sprite
battle_actual_draw_hero:
sta INH
jsr put_sprite_crop
;******************/
; Draw background */
; Draw sky */
color_equals(COLOR_MEDIUMBLUE);
for(i=0;i<10;i++) {
hlin_double(ram[DRAW_PAGE],0,39,i);
}
; Draw ground */
color_equals(ground_color);
for(i=10;i<40;i++) {
hlin_double(ram[DRAW_PAGE],0,39,i);
}
; Draw some background images for variety? */
ram[DRAW_PAGE]=saved_drawpage;
draw_battle_bottom(enemy_type);
while(1) {
gr_copy_to_current(0xc00);
if (hp==0) {
grsim_put_sprite(tfv_defeat,ax-2,24);
}
else if (running) {
; if (battle_count%2) {
grsim_put_sprite(tfv_stand_right,ax,20);
}
else {
grsim_put_sprite(tfv_walk_right,ax,20);
}
}
else {
grsim_put_sprite(tfv_stand_left,ax,20);
grsim_put_sprite(tfv_led_sword,ax-5,20);
}
battle_done_draw_hero:
; grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20);
draw_battle_bottom(enemy_type);
jsr draw_battle_bottom
page_flip();
jsr page_flip
if (hp==0) {
for(i=0;i<15;i++) usleep(100000);
break;
}
usleep(100000);
ch=grsim_input();
if (ch=='q') return 0;
; pause if dead
; if (hp==0) {
; for(i=0;i<15;i++) usleep(100000);
; break;
; }
; delay for framerate
; usleep(100000);
; check keypress
jsr get_keypress
cmp #'Q'
beq done_battle
.if 0
if (enemy_count==0) {
; attack and decrement HP
@ -128,15 +247,16 @@ do_battle:
}
ram[DRAW_PAGE]=PAGE0;
clear_bottom();
ram[DRAW_PAGE]=PAGE1;
clear_bottom();
running=0;
.endif
jmp main_battle_loop
done_battle:
jsr clear_bottoms
; running=0; ?
rts
.if 0
@ -359,277 +479,290 @@ static int menu_state=MENU_NONE;
static int menu_position=0;
static int battle_count=0;
static int draw_battle_bottom(int enemy_type) {
int i;
.endif
clear_bottom();
battle_enemy_string:
.byte 0,21,"KILLER CRAB",0
battle_enemy_attack_string:
.byte 1,23,"PINCHING",0
vtab(22);
htab(1);
move_cursor();
; print(enemies[enemy_type].name);
battle_name_string:
.byte 14,21,"DEATER",0
if (enemy_attacking) {
vtab(24);
htab(2);
move_cursor();
; static int draw_battle_bottom(int enemy_type) {
draw_battle_bottom:
jsr clear_bottom
; print(enemies[enemy_type].name);
lda #<battle_enemy_string
sta OUTL
lda #>battle_enemy_string
sta OUTH
jsr move_and_print
; if (enemy_attacking) {
; print_inverse(enemies[enemy_type].attack_name);
}
; }
vtab(22);
htab(15);
move_cursor();
; should print "NAMEO"
; print("DEATER");
print(nameo);
; print name string
lda #<battle_name_string
sta OUTL
lda #>battle_name_string
sta OUTH
jsr move_and_print
if (susie_out) {
vtab(23);
htab(15);
move_cursor();
print("SUSIE");
}
; if (susie_out) {
; vtab(23);
; htab(15);
; move_cursor();
; print("SUSIE");
; }
if (menu_state==MENU_NONE) {
; if (menu_state==MENU_NONE) {
;
; ; TFV Stats */
;
; vtab(21);
; htab(25);
; move_cursor();
; print("HP");
;
; vtab(21);
; htab(28);
; move_cursor();
; print("MP");
; TFV Stats */
; vtab(21);
; htab(31);
; move_cursor();
; print("TIME");
vtab(21);
htab(25);
move_cursor();
print("HP");
vtab(21);
htab(28);
move_cursor();
print("MP");
vtab(21);
htab(31);
move_cursor();
print("TIME");
vtab(21);
htab(36);
move_cursor();
if (limit<4) {
print("LIMIT");
}
else {
; Make if flash? set bit 0x40 */
print_flash("LIMIT");
}
; vtab(21);
; htab(36);
; move_cursor();
; if (limit<4) {
; print("LIMIT");
; }
; else {
; ; Make if flash? set bit 0x40 */
; print_flash("LIMIT");
; }
vtab(22);
htab(24);
move_cursor();
print_byte(hp);
; vtab(22);
; htab(24);
; move_cursor();
; print_byte(hp);
vtab(22);
htab(27);
move_cursor();
print_byte(mp);
; vtab(22);
; htab(27);
; move_cursor();
; print_byte(mp);
; Draw Time bargraph */
; printf("Battle_bar=%d Limit=%d\n",battle_bar,limit);
ram[COLOR]=0xa0;
hlin_double(ram[DRAW_PAGE],30,34,42);
ram[COLOR]=0x20;
if (battle_bar) {
hlin_double(ram[DRAW_PAGE],30,30+(battle_bar-1),42);
}
; ram[COLOR]=0xa0;
; hlin_double(ram[DRAW_PAGE],30,34,42);
; ram[COLOR]=0x20;
; if (battle_bar) {
; hlin_double(ram[DRAW_PAGE],30,30+(battle_bar-1),42);
; }
; Draw Limit break bargraph */
ram[COLOR]=0xa0;
hlin_double(ram[DRAW_PAGE],35,39,42);
; ; Draw Limit break bargraph */
; ram[COLOR]=0xa0;
; hlin_double(ram[DRAW_PAGE],35,39,42);
ram[COLOR]=0x20;
if (limit) hlin_double(ram[DRAW_PAGE],35,35+limit,42);
; ram[COLOR]=0x20;
; if (limit) hlin_double(ram[DRAW_PAGE],35,35+limit,42);
; Susie Stats */
if (susie_out) {
; ; Susie Stats */
; if (susie_out) {
;
; vtab(23);
; htab(24);
; move_cursor();
; print_byte(255);
;
; vtab(23);
; htab(27);
; move_cursor();
; print_byte(0);
;#if 0
; ; Draw Time bargraph */
; ram[COLOR]=0xa0;
; hlin_double(ram[DRAW_PAGE],30,34,42);
; ram[COLOR]=0x20;
; if (battle_bar) {
; hlin_double(ram[DRAW_PAGE],30,30+(battle_bar-1),42);
; }
;
; ; Draw Limit break bargraph */
; ram[COLOR]=0xa0;
; hlin_double(ram[DRAW_PAGE],35,39,42);
;
; ram[COLOR]=0x20;
; if (limit) hlin_double(ram[DRAW_PAGE],35,35+limit,42);
;#endif
; }
; }
vtab(23);
htab(24);
move_cursor();
print_byte(255);
vtab(23);
htab(27);
move_cursor();
print_byte(0);
#if 0
; Draw Time bargraph */
ram[COLOR]=0xa0;
hlin_double(ram[DRAW_PAGE],30,34,42);
ram[COLOR]=0x20;
if (battle_bar) {
hlin_double(ram[DRAW_PAGE],30,30+(battle_bar-1),42);
}
; Draw Limit break bargraph */
ram[COLOR]=0xa0;
hlin_double(ram[DRAW_PAGE],35,39,42);
ram[COLOR]=0x20;
if (limit) hlin_double(ram[DRAW_PAGE],35,35+limit,42);
#endif
}
}
if (menu_state==MENU_MAIN) {
if (limit>3) {
if (menu_position>5) menu_position=5;
}
else {
if (menu_position>4) menu_position=4;
}
vtab(21);
htab(24);
move_cursor();
if (menu_position==0) print_inverse("ATTACK");
else print("ATTACK");
vtab(22);
htab(24);
move_cursor();
if (menu_position==2) print_inverse("MAGIC");
else print("MAGIC");
vtab(23);
htab(24);
move_cursor();
if (menu_position==4) print_inverse("SUMMON");
else print("SUMMON");
vtab(21);
htab(32);
move_cursor();
if (menu_position==1) print_inverse("SKIP");
else print("SKIP");
vtab(22);
htab(32);
move_cursor();
if (menu_position==3) print_inverse("ESCAPE");
else print("ESCAPE");
if (limit>3) {
vtab(23);
htab(32);
move_cursor();
if (menu_position==5) print_inverse("LIMIT");
else print("LIMIT");
}
; if (menu_state==MENU_MAIN) {
;
; if (limit>3) {
; if (menu_position>5) menu_position=5;
; }
; else {
; if (menu_position>4) menu_position=4;
; }
;
; vtab(21);
; htab(24);
; move_cursor();
; if (menu_position==0) print_inverse("ATTACK");
; else print("ATTACK");
;
; vtab(22);
; htab(24);
; move_cursor();
; if (menu_position==2) print_inverse("MAGIC");
; else print("MAGIC");
;
; vtab(23);
; htab(24);
; move_cursor();
; if (menu_position==4) print_inverse("SUMMON");
; else print("SUMMON");
;
; vtab(21);
; htab(32);
; move_cursor();
; if (menu_position==1) print_inverse("SKIP");
; else print("SKIP");
;
; vtab(22);
; htab(32);
; move_cursor();
; if (menu_position==3) print_inverse("ESCAPE");
; else print("ESCAPE");
;
; if (limit>3) {
; vtab(23);
; htab(32);
; move_cursor();
; if (menu_position==5) print_inverse("LIMIT");
; else print("LIMIT");
; }
;
;
; }
; if (menu_state==MENU_SUMMON) {
;
; if (menu_position>1) menu_position=1;
;
; vtab(21);
; htab(25);
; move_cursor();
; print("SUMMONS:");
;
; vtab(22);
; htab(25);
; move_cursor();
; if (menu_position==0) print_inverse("METROCAT");
; else print("METROCAT");
;
; vtab(23);
; htab(25);
; move_cursor();
; if (menu_position==1) print_inverse("VORTEXCN");
; else print("VORTEXCN");
; }
; if (menu_state==MENU_MAGIC) {
;
; if (menu_position>4) menu_position=4;
;
; vtab(21);
; htab(24);
; move_cursor();
; print("MAGIC:");
;
; vtab(22);
; htab(25);
; move_cursor();
; if (menu_position==0) print_inverse("HEAL");
; else print("HEAL");
;
; vtab(23);
; htab(25);
; move_cursor();
; if (menu_position==2) print_inverse("ICE");
; else print("ICE");
;
; vtab(24);
; htab(25);
; move_cursor();
; if (menu_position==4) print_inverse("BOLT");
; else print("BOLT");
;
; vtab(22);
; htab(32);
; move_cursor();
; if (menu_position==1) print_inverse("FIRE");
; else print("FIRE");
;
; vtab(23);
; htab(32);
; move_cursor();
; if (menu_position==3) print_inverse("MALAISE");
; else print("MALAISE");
;
; }
;
; if (menu_state==MENU_LIMIT) {
;
; if (menu_position>2) menu_position=2;
;
; vtab(21);
; htab(24);
; move_cursor();
; print("LIMIT BREAKS:");
;
; vtab(22);
; htab(25);
; move_cursor();
; if (menu_position==0) print_inverse("SLICE");
; else print("SLICE");
;
; vtab(23);
; htab(25);
; move_cursor();
; if (menu_position==2) print_inverse("DROP");
; else print("DROP");
;
; vtab(22);
; htab(32);
; move_cursor();
; if (menu_position==1) print_inverse("ZAP");
; else print("ZAP");
; }
;
; ; Draw inverse separator */
; ram[COLOR]=0x20;
; for(i=40;i<50;i+=2) {
; hlin_double(ram[DRAW_PAGE],12,12,i);
; }
;
}
if (menu_state==MENU_SUMMON) {
if (menu_position>1) menu_position=1;
rts
.if 0
vtab(21);
htab(25);
move_cursor();
print("SUMMONS:");
vtab(22);
htab(25);
move_cursor();
if (menu_position==0) print_inverse("METROCAT");
else print("METROCAT");
vtab(23);
htab(25);
move_cursor();
if (menu_position==1) print_inverse("VORTEXCN");
else print("VORTEXCN");
}
if (menu_state==MENU_MAGIC) {
if (menu_position>4) menu_position=4;
vtab(21);
htab(24);
move_cursor();
print("MAGIC:");
vtab(22);
htab(25);
move_cursor();
if (menu_position==0) print_inverse("HEAL");
else print("HEAL");
vtab(23);
htab(25);
move_cursor();
if (menu_position==2) print_inverse("ICE");
else print("ICE");
vtab(24);
htab(25);
move_cursor();
if (menu_position==4) print_inverse("BOLT");
else print("BOLT");
vtab(22);
htab(32);
move_cursor();
if (menu_position==1) print_inverse("FIRE");
else print("FIRE");
vtab(23);
htab(32);
move_cursor();
if (menu_position==3) print_inverse("MALAISE");
else print("MALAISE");
}
if (menu_state==MENU_LIMIT) {
if (menu_position>2) menu_position=2;
vtab(21);
htab(24);
move_cursor();
print("LIMIT BREAKS:");
vtab(22);
htab(25);
move_cursor();
if (menu_position==0) print_inverse("SLICE");
else print("SLICE");
vtab(23);
htab(25);
move_cursor();
if (menu_position==2) print_inverse("DROP");
else print("DROP");
vtab(22);
htab(32);
move_cursor();
if (menu_position==1) print_inverse("ZAP");
else print("ZAP");
}
; Draw inverse separator */
ram[COLOR]=0x20;
for(i=40;i<50;i+=2) {
hlin_double(ram[DRAW_PAGE],12,12,i);
}
; ram[DRAW_PAGE]=saved_page;
return 0;
}
static int enemy_hp=0,enemy_type=0,enemy_x=0;

View File

@ -429,16 +429,16 @@ walking:
bne walking_right ; if(!0) walk right
walking_left:
lda #>tfv_walk_left
lda #>tfv_walk_left_sprite
sta INH
lda #<tfv_walk_left
lda #<tfv_walk_left_sprite
sta INL
bcc done_walking
walking_right:
lda #>tfv_walk_right
lda #>tfv_walk_right_sprite
sta INH
lda #<tfv_walk_right
lda #<tfv_walk_right_sprite
sta INL
bcc done_walking
@ -446,16 +446,16 @@ standing:
lda DIRECTION
bne standing_right
standing_left:
lda #>tfv_stand_left
lda #>tfv_stand_left_sprite
sta INH
lda #<tfv_stand_left
lda #<tfv_stand_left_sprite
sta INL
bcc done_walking
standing_right:
lda #>tfv_stand_right
lda #>tfv_stand_right_sprite
sta INH
lda #<tfv_stand_right
lda #<tfv_stand_right_sprite
sta INL
done_walking:

View File

@ -1,126 +1,71 @@
; Hand generated as I'm too lazy to automate this
tb1_sprite:
.byte $8,$4
.byte $55,$50,$00,$00,$00,$00,$00,$00
.byte $55,$55,$55,$00,$00,$00,$00,$00
.byte $ff,$1f,$4f,$2f,$ff,$22,$20,$00
.byte $5f,$5f,$5f,$5f,$ff,$f2,$f2,$f2
;tb1_sprite:
; .byte $8,$4
; .byte $55,$50,$00,$00,$00,$00,$00,$00
; .byte $55,$55,$55,$00,$00,$00,$00,$00
; .byte $ff,$1f,$4f,$2f,$ff,$22,$20,$00
; .byte $5f,$5f,$5f,$5f,$ff,$f2,$f2,$f2
;===============
; TFV Sprites
;===============
tfv_stand_right:
tfv_stand_right_sprite:
.byte $4,$6
.byte $00,$DD,$BD,$00
.byte $00,$DD,$DB,$0B
.byte $00,$22,$00,$00
.byte $00,$22,$02,$0B
.byte $00,$22,$00,$00
.byte $00,$82,$80,$00
.byte $AA,$DD,$BD,$AA
.byte $AA,$DD,$DB,$AB
.byte $AA,$22,$AA,$AA
.byte $AA,$22,$A2,$AB
.byte $AA,$22,$AA,$AA
.byte $AA,$82,$8A,$AA
tfv_walk_right:
tfv_walk_right_sprite:
.byte $4,$6
.byte $00,$DD,$BD,$00
.byte $00,$DD,$DB,$0B
.byte $00,$22,$00,$00
.byte $00,$22,$02,$B0
.byte $22,$02,$20,$00
.byte $82,$00,$82,$00
.byte $AA,$DD,$BD,$AA
.byte $AA,$DD,$DB,$AB
.byte $AA,$22,$AA,$AA
.byte $AA,$22,$A2,$BA
.byte $22,$A2,$2A,$AA
.byte $82,$AA,$82,$AA
tfv_stand_left:
tfv_stand_left_sprite:
.byte $4,$6
.byte $00,$BD,$DD,$00
.byte $0B,$DB,$DD,$00
.byte $00,$00,$22,$00
.byte $0B,$02,$22,$00
.byte $00,$00,$22,$00
.byte $00,$80,$82,$00
.byte $AA,$BD,$DD,$AA
.byte $AB,$DB,$DD,$AA
.byte $AA,$AA,$22,$AA
.byte $AB,$A2,$22,$AA
.byte $AA,$AA,$22,$AA
.byte $AA,$8A,$82,$AA
tfv_walk_left:
tfv_walk_left_sprite:
.byte $4,$6
.byte $00,$BD,$DD,$00
.byte $0B,$DB,$DD,$00
.byte $00,$00,$22,$00
.byte $B0,$02,$22,$00
.byte $00,$20,$02,$22
.byte $00,$82,$00,$82
.byte $AA,$BD,$DD,$AA
.byte $AB,$DB,$DD,$AA
.byte $AA,$AA,$22,$AA
.byte $BA,$A2,$22,$AA
.byte $AA,$2A,$A2,$22
.byte $AA,$82,$AA,$82
tfv_led_sword:
tfv_led_sword_sprite:
.byte $5,$3
.byte $10,$00,$10,$00,$00
.byte $10,$01,$10,$10,$10
.byte $00,$00,$11,$01,$10
.byte $1A,$AA,$1A,$AA,$AA
.byte $1A,$A1,$1A,$1A,$1A
.byte $AA,$AA,$11,$A1,$1A
tfv_defeat_sprite:
.byte $7,$3
.byte $AA,$AA,$AA,$2b,$AA,$AA,$AA
.byte $88,$AA,$AA,$22,$bA,$bA,$dA
.byte $88,$22,$22,$22,$dd,$db,$dd
;================
; Bird Sprites
;================
;================
; Ship Sprites
;================
splash_forward:
.byte $7,$2
.byte $00,$ee,$00,$00,$00,$ee,$00
.byte $ee,$00,$00,$00,$00,$00,$ee
splash_right:
.byte $7,$2
.byte $00,$00,$00,$00,$00,$ee,$00
.byte $00,$00,$00,$00,$00,$00,$ee
splash_left:
.byte $7,$2
.byte $00,$ee,$00,$00,$00,$00,$00
.byte $ee,$00,$00,$00,$00,$00,$00
shadow_forward:
.byte $3,$2
.byte $00,$aa,$00
.byte $a0,$aa,$a0
shadow_right:
.byte $3,$2
.byte $a0,$00,$aa
.byte $00,$0a,$a0
shadow_left:
.byte $3,$2
.byte $aa,$00,$a0
.byte $a0,$0a,$00
ship_forward:
.byte $9,$5
.byte $00,$00,$00,$00,$ff,$00,$00,$00,$00
.byte $00,$00,$00,$66,$ff,$66,$00,$00,$00
.byte $00,$00,$70,$2f,$12,$2f,$70,$00,$00
.byte $f0,$f7,$f7,$f2,$d9,$f2,$f7,$f7,$f0
.byte $00,$00,$00,$00,$0d,$00,$00,$00,$00
ship_right:
.byte $9,$5
.byte $00,$00,$00,$00,$00,$60,$60,$f0,$00
.byte $00,$f0,$70,$70,$f6,$f6,$6f,$66,$00
.byte $00,$07,$ff,$2f,$12,$27,$f6,$00,$00
.byte $00,$00,$00,$dd,$d9,$f2,$77,$00,$00
.byte $00,$00,$00,$00,$00,$0f,$ff,$70,$00
ship_left:
.byte $9,$5
.byte $00,$f0,$60,$60,$00,$00,$00,$00,$00
.byte $00,$66,$6f,$f6,$f6,$70,$70,$f0,$00
.byte $00,$00,$f6,$27,$12,$2f,$ff,$07,$00
.byte $00,$00,$77,$f2,$d9,$dd,$00,$00,$00
.byte $00,$70,$ff,$0f,$00,$00,$00,$00,$00
;=========
; Enemies

View File

@ -123,6 +123,15 @@ title_new_game:
; load game! for now, debugging
;=================================
title_load_game:
; this should go in new game, not load
lda #200
sta HERO_HP_MAX
lda #200
sta HERO_HP
lda #100
sta HERO_MP
lda #LOAD_FLYING
sta WHICH_LOAD

View File

@ -45,6 +45,7 @@
.include "keyboard.s"
.include "joystick.s"
.include "gr_putsprite.s"
.include "gr_putsprite_crop.s"
.include "text_print.s"
.include "gr_copy.s"
.include "decompress_fast_v2.s"

View File

@ -22,6 +22,8 @@ INVFLG = $32
; More zero-page addresses
; we try not to conflict with anything DOS, MONITOR or BASIC related
XMAX = $50 ; used by putsprite_crop
;; Flying Routine Only
TURNING = $60
@ -80,12 +82,18 @@ NEWY = $84
MAP_X = $85
GROUND_COLOR = $86
;==================GLOBAL STATE, STORED IN SAVE GAME==========
WHICH_LOAD = $90 ; current level
HERO_HP = $91 ; hero's hit points
HERO_HP_MAX = $92 ; hero's max hit points
HERO_MP = $93 ; hero's magic points
;==================GAME STATE (not in save game)==============
LEVEL_OVER = $A0
JOYSTICK_ENABLED= $A1
FRAMEL = $A2
FRAMEH = $A3
WHICH_LOAD = $A4
MENU_RESULT = $A5
SOUND_STATUS = $A6
SOUND_DISABLED = $80
@ -93,6 +101,10 @@ SOUND_STATUS = $A6
SOUND_MOCKINGBOARD = $02 ; mockingboard detected
JS_BUTTON_STATE = $A7
HERO_X = $B0 ; used in battle
HERO_STATE = $B1 ; used in battle
HERO_STATE_RUNNING = $01 ; running from battle
COLOR1 = $E0
COLOR2 = $E1
MATCH = $E2