2021-01-05 20:32:11 +00:00
|
|
|
;================================
|
|
|
|
; do battle
|
|
|
|
;================================
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
do_battle:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
2021-01-12 05:44:03 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
lda #0
|
|
|
|
sta HERO_STATE
|
2021-01-12 05:44:03 +00:00
|
|
|
sta MENU_STATE
|
|
|
|
sta MENU_POSITION
|
2021-01-11 20:20:43 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
lda #3
|
|
|
|
sta HERO_LIMIT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
jsr rotate_intro
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
lda #20
|
|
|
|
sta BATTLE_COUNT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;=============================
|
|
|
|
; Init Enemy
|
|
|
|
;=============================
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
jsr init_enemy
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
;==========================
|
|
|
|
; Draw background
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
;==========================
|
|
|
|
; Draw sky
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
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
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
; Draw some background images for variety?
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; update bottom of screen
|
2021-01-11 20:20:43 +00:00
|
|
|
jsr draw_battle_bottom
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
main_battle_loop:
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
jsr gr_copy_to_current
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
;========================================
|
|
|
|
; draw our hero
|
|
|
|
;========================================
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
lda HERO_HP
|
|
|
|
beq battle_draw_hero_down
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
lda HERO_STATE
|
|
|
|
and #HERO_STATE_RUNNING
|
|
|
|
bne battle_draw_hero_running
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
jmp battle_draw_normal_hero
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
battle_draw_hero_down:
|
|
|
|
; grsim_put_sprite(tfv_defeat,ax-2,24);
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
lda HERO_X
|
|
|
|
sec
|
|
|
|
sbc #2
|
|
|
|
sta XPOS
|
|
|
|
lda #24
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda #<tfv_defeat_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_defeat_sprite
|
2021-01-13 20:17:15 +00:00
|
|
|
sta INH
|
|
|
|
jsr put_sprite_crop
|
|
|
|
jmp battle_done_draw_hero
|
2021-01-11 20:20:43 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
lda BATTLE_COUNT
|
2021-01-11 20:20:43 +00:00
|
|
|
and #$8
|
|
|
|
beq battle_draw_running_walk
|
|
|
|
|
|
|
|
battle_draw_running_stand:
|
|
|
|
lda #<tfv_stand_right_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_stand_right_sprite
|
2021-01-13 20:17:15 +00:00
|
|
|
sta INH
|
|
|
|
jsr put_sprite_crop
|
|
|
|
jmp battle_done_draw_hero
|
2021-01-11 20:20:43 +00:00
|
|
|
|
|
|
|
battle_draw_running_walk:
|
|
|
|
lda #<tfv_walk_right_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_walk_right_sprite
|
2021-01-12 05:44:03 +00:00
|
|
|
sta INH
|
|
|
|
jsr put_sprite_crop
|
2021-01-13 20:17:15 +00:00
|
|
|
jmp battle_done_draw_hero
|
2021-01-11 20:20:43 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
battle_draw_normal_hero:
|
|
|
|
; grsim_put_sprite(tfv_stand_left,ax,20);
|
2021-01-11 20:20:43 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
lda #20
|
|
|
|
sta HERO_Y
|
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr draw_hero_and_sword
|
2021-01-11 20:20:43 +00:00
|
|
|
|
|
|
|
battle_done_draw_hero:
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;===========================
|
|
|
|
; draw enemy
|
|
|
|
;===========================
|
|
|
|
battle_draw_enemy:
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20);
|
2021-01-11 20:20:43 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
jsr draw_enemy
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
battle_done_draw_enemy:
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;=======================================
|
|
|
|
; draw bottom status
|
|
|
|
|
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
;=======================================
|
|
|
|
; page_flip
|
|
|
|
|
|
|
|
jsr page_flip
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
; pause if dead
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
; if (hp==0) {
|
|
|
|
; for(i=0;i<15;i++) usleep(100000);
|
|
|
|
; break;
|
|
|
|
; }
|
|
|
|
|
|
|
|
; delay for framerate
|
|
|
|
; usleep(100000);
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;=======================
|
|
|
|
; handle keypresses
|
2021-01-11 20:20:43 +00:00
|
|
|
|
|
|
|
jsr get_keypress
|
2021-01-12 05:44:03 +00:00
|
|
|
sta LAST_KEY
|
2021-01-11 20:20:43 +00:00
|
|
|
cmp #'Q'
|
|
|
|
beq done_battle
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;========================
|
|
|
|
; handle enemy attacks
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
lda ENEMY_COUNT
|
|
|
|
bne battle_no_enemy_attack
|
|
|
|
battle_start_enemy_attack:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; attack and decrement HP
|
|
|
|
jsr enemy_attack
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; update limit count
|
|
|
|
; max out at 4
|
|
|
|
lda HERO_LIMIT
|
|
|
|
cmp #4
|
|
|
|
beq battle_no_inc_limit
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
inc HERO_LIMIT
|
|
|
|
battle_no_inc_limit:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; reset enemy time. FIXME: variable?
|
|
|
|
lda #50
|
|
|
|
sta ENEMY_COUNT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
battle_no_enemy_attack:
|
|
|
|
dec ENEMY_COUNT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;===============================
|
|
|
|
; handle battle counter
|
|
|
|
update_battle_counter:
|
|
|
|
lda BATTLE_COUNT
|
|
|
|
cmp #64
|
|
|
|
bcc inc_battle_count ; blt
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; battle timer expired, take action
|
|
|
|
|
|
|
|
; If running, escape
|
|
|
|
; TODO: randomly fail at running? */
|
|
|
|
lda HERO_STATE
|
|
|
|
and #HERO_STATE_RUNNING
|
|
|
|
beq battle_no_escape
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; we bravely ran away
|
|
|
|
jmp done_battle
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
battle_no_escape:
|
|
|
|
|
|
|
|
; activate menu
|
|
|
|
|
|
|
|
lda MENU_STATE
|
|
|
|
cmp #MENU_NONE
|
|
|
|
bne menu_activated
|
|
|
|
|
|
|
|
; move to main menu
|
|
|
|
lda #MENU_MAIN
|
|
|
|
sta MENU_STATE
|
|
|
|
|
|
|
|
menu_activated:
|
|
|
|
|
|
|
|
jsr battle_menu_keypress
|
|
|
|
|
|
|
|
jmp done_battle_count
|
|
|
|
|
|
|
|
inc_battle_count:
|
|
|
|
inc BATTLE_COUNT
|
|
|
|
|
|
|
|
done_battle_count:
|
|
|
|
|
|
|
|
;========================
|
|
|
|
; check enemy defeated
|
|
|
|
|
|
|
|
lda ENEMY_HP
|
|
|
|
bne end_battle_loop
|
|
|
|
|
|
|
|
jsr victory_dance
|
|
|
|
jmp done_battle
|
|
|
|
|
|
|
|
|
|
|
|
end_battle_loop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
jmp main_battle_loop
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
done_battle:
|
|
|
|
|
|
|
|
jsr clear_bottoms
|
|
|
|
|
|
|
|
; running=0; ?
|
2021-01-05 20:32:11 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
; Metrocat (summon?)
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
; Environment: grass, beach, forest, ice
|
2021-01-05 20:32:11 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
; Enemies: HP ATTACK WEAKNESS RESIST
|
2021-01-05 20:32:11 +00:00
|
|
|
; Killer Crab RND-32 PINCH MALAISE FIRE
|
|
|
|
; Plain Fish BUBBLE FIRE ICE
|
|
|
|
|
|
|
|
; Evil Tree RND-16 LEAVE FIRE ICE
|
|
|
|
; Wood Elf SING MALAISE BOLT
|
|
|
|
|
|
|
|
; Giant Bee RND-64 BUZZSAW ICE NONE
|
|
|
|
; Procrastinon RND-32 PUTOFF NONE MALAISE
|
|
|
|
|
|
|
|
; Ice Fish RND-32 AUGER FIRE ICE
|
|
|
|
; EvilPenguin WADDLE FIRE ICE
|
|
|
|
|
|
|
|
; Battle.
|
|
|
|
; Forest? Grassland? Artic? Ocean?
|
|
|
|
; ATTACK REST
|
|
|
|
; MAGIC LIMIT
|
|
|
|
; SUMMON RUN
|
|
|
|
;
|
|
|
|
; SUMMONS -> METROCAT VORTEXCN
|
|
|
|
; MAGIC -> HEAL FIRE
|
|
|
|
; ICE MALAISE
|
|
|
|
; BOLT
|
|
|
|
; LIMIT -> SLICE ZAP
|
|
|
|
; DROP
|
|
|
|
;
|
|
|
|
; 1 2 3
|
|
|
|
;0123456789012345678901234567890123456789|
|
|
|
|
;----------------------------------------|
|
|
|
|
; | HP LIMIT | -> FIGHT/LIMIT 21
|
|
|
|
;KILLER CRAB | DEATER 128/255 128 | ZAP 22
|
|
|
|
; | | REST 23
|
|
|
|
; | | RUN AWAY 24
|
|
|
|
;
|
|
|
|
;Sound effects?
|
|
|
|
;
|
|
|
|
;List hits
|
|
|
|
;
|
|
|
|
;****** ** **** **** ** ** ****** **** ****** ****** ******
|
|
|
|
;** ** **** ** ** ** ** ** ** ** ** ** ** **
|
|
|
|
;** ** ** **** **** ****** **** ****** ** ****** ******
|
|
|
|
;** ** ** ** ** ** ** ** ** ** ** ** **
|
|
|
|
;****** ****** ****** **** ** **** ****** ** ****** **
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
; Background depend on map location?
|
|
|
|
; Room for guinea pig in party?
|
|
|
|
|
|
|
|
; Attacks -> HIT, ZAP, HEAL, RUNAWAY
|
|
|
|
;#define MAGIC_NONE 0
|
|
|
|
;#define MAGIC_FIRE 1
|
|
|
|
;#define MAGIC_ICE 2
|
|
|
|
;#define MAGIC_MALAISE 4
|
|
|
|
;#define MAGIC_BOLT 8
|
|
|
|
;#define MAGIC_HEAL 16
|
|
|
|
|
|
|
|
; struct enemy_type {
|
|
|
|
; char *name;
|
|
|
|
; int hp_base,hp_mask;
|
|
|
|
; char *attack_name;
|
|
|
|
; int weakness,resist;
|
|
|
|
; unsigned char *sprite;
|
|
|
|
;};
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
|
|
|
|
;=============================
|
|
|
|
; Init Enemy
|
|
|
|
;=============================
|
|
|
|
init_enemy:
|
|
|
|
|
|
|
|
; select type
|
|
|
|
|
|
|
|
; random, with weight toward proper terrain
|
|
|
|
; 50% completely random, 50% terrain based?
|
|
|
|
|
|
|
|
; enemy_type=random_8()%0x7;
|
|
|
|
; enemy_hp=enemies[enemy_type].hp_base+
|
|
|
|
; (rand()&enemies[enemy_type].hp_mask);
|
|
|
|
|
|
|
|
lda #0 ; hardcode crab for now
|
|
|
|
sta ENEMY_TYPE
|
|
|
|
sta ENEMY_X
|
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
lda #$30 ; BCD
|
2021-01-12 05:44:03 +00:00
|
|
|
sta ENEMY_HP
|
|
|
|
|
|
|
|
lda #30
|
|
|
|
sta ENEMY_COUNT
|
|
|
|
|
|
|
|
lda #<killer_crab_sprite
|
|
|
|
sta draw_enemy_smc1+1
|
|
|
|
lda #>killer_crab_sprite
|
|
|
|
sta draw_enemy_smc2+1
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
;static struct enemy_type enemies[9]={
|
|
|
|
; [0]= {
|
|
|
|
; .name="Killer Crab",
|
|
|
|
; .hp_base=50,
|
|
|
|
; .hp_mask=0x1f,
|
|
|
|
; .attack_name="Pinch",
|
|
|
|
; .weakness=MAGIC_MALAISE,
|
|
|
|
; .resist=MAGIC_FIRE,
|
|
|
|
; .sprite=killer_crab,
|
|
|
|
; },
|
|
|
|
; [1]= {
|
|
|
|
; .name="Plain Fish",
|
|
|
|
; .hp_base=10,
|
|
|
|
; .hp_mask=0x1f,
|
|
|
|
; .attack_name="Bubble",
|
|
|
|
; .weakness=MAGIC_FIRE,
|
|
|
|
; .resist=MAGIC_ICE,
|
|
|
|
; .sprite=plain_fish,
|
|
|
|
; },
|
|
|
|
; [2]= {
|
|
|
|
; .name="Evil Tree",
|
|
|
|
; .hp_base=10,
|
|
|
|
; .hp_mask=0x1f,
|
|
|
|
; .attack_name="Leaves",
|
|
|
|
; .weakness=MAGIC_FIRE,
|
|
|
|
; .resist=MAGIC_ICE,
|
|
|
|
; .sprite=evil_tree,
|
|
|
|
; },
|
|
|
|
; [3]= {
|
|
|
|
; .name="Wood Elf",
|
|
|
|
; .hp_base=10,
|
|
|
|
; .hp_mask=0x1f,
|
|
|
|
; .attack_name="Song",
|
|
|
|
; .weakness=MAGIC_MALAISE,
|
|
|
|
; .resist=MAGIC_BOLT|MAGIC_HEAL,
|
|
|
|
; .sprite=wood_elf,
|
|
|
|
; },
|
|
|
|
; [4]= {
|
|
|
|
; .name="Giant Bee",
|
|
|
|
; .hp_base=10,
|
|
|
|
; .hp_mask=0x1f,
|
|
|
|
; .attack_name="Buzzsaw",
|
|
|
|
; .weakness=MAGIC_ICE,
|
|
|
|
; .resist=MAGIC_NONE,
|
|
|
|
; .sprite=giant_bee,
|
|
|
|
; },
|
|
|
|
; [5]= {
|
|
|
|
; .name="Procrastinon",
|
|
|
|
; .hp_base=10,
|
|
|
|
; .hp_mask=0x1f,
|
|
|
|
; .attack_name="Putoff",
|
|
|
|
; .weakness=MAGIC_NONE,
|
|
|
|
; .resist=MAGIC_MALAISE,
|
|
|
|
; .sprite=procrastinon,
|
|
|
|
; },
|
|
|
|
; [6]= {
|
|
|
|
; .name="Ice Fish",
|
|
|
|
; .hp_base=10,
|
|
|
|
; .hp_mask=0x1f,
|
|
|
|
; .attack_name="Auger",
|
|
|
|
; .weakness=MAGIC_FIRE,
|
|
|
|
; .resist=MAGIC_ICE,
|
|
|
|
; .sprite=ice_fish,
|
|
|
|
; },
|
|
|
|
; [7]= {
|
|
|
|
; .name="Evil Penguin",
|
|
|
|
; .hp_base=10,
|
|
|
|
; .hp_mask=0x1f,
|
|
|
|
; .attack_name="Waddle",
|
|
|
|
; .weakness=MAGIC_FIRE,
|
|
|
|
; .resist=MAGIC_ICE,
|
|
|
|
; .sprite=evil_penguin,
|
|
|
|
; },
|
|
|
|
; [8]= {
|
|
|
|
; .name="Act.Principl",
|
|
|
|
; .hp_base=10,
|
|
|
|
; .hp_mask=0x1f,
|
|
|
|
; .attack_name="BIRDIE",
|
|
|
|
; .weakness=MAGIC_NONE,
|
|
|
|
; .resist=MAGIC_ICE|MAGIC_FIRE,
|
|
|
|
; .sprite=roboknee1,
|
|
|
|
; },
|
|
|
|
;};
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
;===========================
|
|
|
|
; gr put num
|
|
|
|
;===========================
|
|
|
|
; damage in DAMAGE_VAL (BCD)
|
|
|
|
; location in XPOS,YPOS
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
gr_put_num:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
; digit=number/100;
|
|
|
|
; if ((digit) && (digit<10)) {
|
|
|
|
; grsim_put_sprite(numbers[digit],xt,yy);
|
|
|
|
; xt+=4;
|
|
|
|
; }
|
|
|
|
; hundreds=digit;
|
|
|
|
; left=number%100;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
gr_put_num_tens:
|
|
|
|
; print tens digit
|
|
|
|
lda DAMAGE_VAL
|
|
|
|
lsr
|
|
|
|
lsr
|
|
|
|
lsr
|
|
|
|
lsr
|
|
|
|
|
|
|
|
; leading zero suppression
|
|
|
|
beq gr_put_num_ones
|
|
|
|
|
|
|
|
asl
|
|
|
|
tay
|
|
|
|
lda number_sprites,Y
|
|
|
|
sta INL
|
|
|
|
lda number_sprites+1,Y
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
; point to next
|
|
|
|
lda XPOS
|
|
|
|
clc
|
|
|
|
adc #4
|
|
|
|
sta XPOS
|
|
|
|
|
|
|
|
gr_put_num_ones:
|
|
|
|
|
|
|
|
; print tens digit
|
|
|
|
lda DAMAGE_VAL
|
|
|
|
and #$f
|
|
|
|
|
|
|
|
asl
|
|
|
|
tay
|
|
|
|
lda number_sprites,Y
|
|
|
|
sta INL
|
|
|
|
lda number_sprites+1,Y
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
;
|
|
|
|
; ATTACK SKIP
|
|
|
|
; MAGIC LIMIT
|
|
|
|
; SUMMON ESCAPE
|
|
|
|
;
|
|
|
|
; SUMMONS -> METROCAT VORTEXCN
|
|
|
|
; MAGIC -> HEAL FIRE
|
2021-01-13 17:16:20 +00:00
|
|
|
; ICE MALAISE
|
2021-01-05 20:32:11 +00:00
|
|
|
; BOLT
|
|
|
|
; LIMIT -> SLICE ZAP
|
2021-01-13 17:16:20 +00:00
|
|
|
; DROP
|
2021-01-05 20:32:11 +00:00
|
|
|
;
|
|
|
|
; State Machine
|
|
|
|
;
|
|
|
|
; time
|
|
|
|
; BOTTOM -------> MAIN_MENU ----->ATTACK
|
|
|
|
; ------->SKIP
|
|
|
|
; ------->MAGIC_MENU
|
|
|
|
; ------->LIMIT_MENU
|
|
|
|
; ------->SUMMON_MENU
|
|
|
|
; ------->ESCAPE
|
|
|
|
;
|
|
|
|
;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
; static int enemy_attacking=0;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
battle_enemy_string:
|
|
|
|
.byte 0,21,"KILLER CRAB",0
|
|
|
|
battle_enemy_attack_string:
|
|
|
|
.byte 1,23,"PINCHING",0
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
battle_name_string:
|
|
|
|
.byte 14,21,"DEATER",0
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
|
|
|
|
battle_menu_none:
|
|
|
|
.byte 24,20,"HP",0
|
|
|
|
.byte 27,20,"MP",0
|
|
|
|
.byte 30,20,"TIME",0
|
|
|
|
.byte 35,20,"LIMIT",0
|
|
|
|
hp_string:
|
|
|
|
.byte 23,21,"100",0
|
|
|
|
mp_string:
|
|
|
|
.byte 26,21," 50",0
|
|
|
|
|
|
|
|
|
|
|
|
battle_menu_main:
|
|
|
|
.byte 23,20,"ATTACK",0
|
|
|
|
.byte 23,21,"MAGIC",0
|
|
|
|
.byte 23,22,"SUMMON",0
|
|
|
|
.byte 31,20,"SKIP",0
|
|
|
|
.byte 31,21,"ESCAPE",0
|
|
|
|
.byte 31,22,"LIMIT",0
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
battle_menu_summons:
|
|
|
|
.byte 23,20,"SUMMONS:",0
|
|
|
|
.byte 24,21,"METROCAT",0 ; 0
|
|
|
|
.byte 24,22,"VORTEXCN",0 ; 1
|
|
|
|
|
|
|
|
battle_menu_magic:
|
|
|
|
.byte 23,20,"MAGIC:",0
|
|
|
|
.byte 24,21,"HEAL",0 ; 0
|
|
|
|
.byte 24,22,"ICE",0 ; 2
|
|
|
|
.byte 24,23,"BOLT",0 ; 4
|
|
|
|
.byte 31,21,"FIRE",0 ; 1
|
|
|
|
.byte 31,22,"MALAISE",0 ; 3
|
|
|
|
|
|
|
|
battle_menu_limit:
|
|
|
|
.byte 23,20,"LIMIT BREAKS:",0
|
|
|
|
.byte 24,21,"SLICE",0 ; 0
|
|
|
|
.byte 24,22,"DROP",0 ; 2
|
|
|
|
.byte 31,21,"ZAP",0 ; 1
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;========================
|
|
|
|
; draw_battle_bottom
|
|
|
|
;========================
|
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
; static int draw_battle_bottom(int enemy_type) {
|
|
|
|
draw_battle_bottom:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
jsr clear_bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
jsr normal_text
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
; print(enemies[enemy_type].name);
|
|
|
|
lda #<battle_enemy_string
|
|
|
|
sta OUTL
|
|
|
|
lda #>battle_enemy_string
|
|
|
|
sta OUTH
|
|
|
|
jsr move_and_print
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
; if (enemy_attacking) {
|
|
|
|
; print_inverse(enemies[enemy_type].attack_name);
|
|
|
|
; }
|
|
|
|
|
|
|
|
; 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");
|
|
|
|
; }
|
|
|
|
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
; jump to current menu
|
|
|
|
|
|
|
|
; set up jump table fakery
|
|
|
|
handle_special:
|
|
|
|
ldy MENU_STATE
|
|
|
|
lda battle_menu_jump_table_h,Y
|
|
|
|
pha
|
|
|
|
lda battle_menu_jump_table_l,Y
|
|
|
|
pha
|
|
|
|
rts
|
|
|
|
|
|
|
|
battle_menu_jump_table_l:
|
|
|
|
.byte <(draw_battle_menu_none-1)
|
|
|
|
.byte <(draw_battle_menu_main-1)
|
|
|
|
.byte <(draw_battle_menu_magic-1)
|
|
|
|
.byte <(draw_battle_menu_summon-1)
|
|
|
|
.byte <(draw_battle_menu_limit-1)
|
2021-01-11 20:20:43 +00:00
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
battle_menu_jump_table_h:
|
|
|
|
.byte >(draw_battle_menu_none-1)
|
|
|
|
.byte >(draw_battle_menu_main-1)
|
|
|
|
.byte >(draw_battle_menu_magic-1)
|
|
|
|
.byte >(draw_battle_menu_summon-1)
|
|
|
|
.byte >(draw_battle_menu_limit-1)
|
2021-01-11 20:20:43 +00:00
|
|
|
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
draw_battle_menu_none:
|
|
|
|
;======================
|
|
|
|
; TFV Stats
|
2021-01-11 20:20:43 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
lda #<battle_menu_none
|
|
|
|
sta OUTL
|
|
|
|
lda #>battle_menu_none
|
|
|
|
sta OUTH
|
|
|
|
jsr move_and_print
|
|
|
|
jsr move_and_print
|
|
|
|
jsr move_and_print
|
2021-01-11 20:20:43 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; make limit label flash if at limit break
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
lda HERO_LIMIT
|
|
|
|
cmp #4
|
|
|
|
bcc plain_limit
|
|
|
|
jsr flash_text
|
|
|
|
plain_limit:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
jsr move_and_print ; HP
|
|
|
|
jsr move_and_print ; MP
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; Draw Time bargraph
|
|
|
|
; start at 30,42 go to battle_bar
|
|
|
|
; Y in X, X in A, max in CH
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; hlin_double(ram[DRAW_PAGE],30,30+(battle_bar-1),42);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
lda BATTLE_COUNT
|
|
|
|
lsr
|
|
|
|
lsr
|
|
|
|
lsr
|
|
|
|
lsr
|
|
|
|
sta CH
|
|
|
|
|
|
|
|
ldx #42
|
|
|
|
lda #30
|
|
|
|
|
|
|
|
jsr draw_bargraph
|
|
|
|
|
|
|
|
|
|
|
|
; Draw Limit bargraph
|
|
|
|
; start at 30,42 go to battle_bar
|
|
|
|
; Y in X, X in A, max in CH
|
|
|
|
; if (limit) hlin_double(ram[DRAW_PAGE],35,35+limit,42);
|
|
|
|
|
|
|
|
lda HERO_LIMIT
|
|
|
|
sta CH
|
|
|
|
|
|
|
|
ldx #42
|
|
|
|
lda #35
|
|
|
|
|
|
|
|
jsr draw_bargraph
|
|
|
|
|
|
|
|
; ; Susie Stats
|
|
|
|
; if (susie_out) {
|
|
|
|
; vtab(23);
|
|
|
|
; htab(24);
|
|
|
|
; move_cursor();
|
|
|
|
; print_byte(255);
|
2021-01-11 20:20:43 +00:00
|
|
|
;
|
2021-01-12 05:44:03 +00:00
|
|
|
; vtab(23);
|
|
|
|
; htab(27);
|
|
|
|
; move_cursor();
|
|
|
|
; print_byte(0);
|
2021-01-11 20:20:43 +00:00
|
|
|
;
|
2021-01-12 05:44:03 +00:00
|
|
|
; ; 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);
|
|
|
|
; }
|
2021-01-11 20:20:43 +00:00
|
|
|
;
|
2021-01-12 05:44:03 +00:00
|
|
|
; ; Draw Limit break bargraph
|
|
|
|
; ram[COLOR]=0xa0;
|
|
|
|
; hlin_double(ram[DRAW_PAGE],35,39,42);
|
2021-01-11 20:20:43 +00:00
|
|
|
;
|
2021-01-12 05:44:03 +00:00
|
|
|
; ram[COLOR]=0x20;
|
|
|
|
; if (limit) hlin_double(ram[DRAW_PAGE],35,35+limit,42);
|
|
|
|
|
|
|
|
jmp done_draw_battle_menu
|
|
|
|
|
|
|
|
;======================
|
|
|
|
; draw main battle menu
|
|
|
|
draw_battle_menu_main:
|
|
|
|
|
|
|
|
; wrap location
|
|
|
|
lda HERO_LIMIT
|
|
|
|
cmp #3
|
|
|
|
bcs limit3_wrap ; bge
|
|
|
|
limit4_wrap:
|
|
|
|
lda MENU_POSITION
|
|
|
|
cmp #4
|
|
|
|
bcc done_menu_wrap
|
|
|
|
lda #4
|
|
|
|
sta MENU_POSITION
|
|
|
|
bne done_menu_wrap ; bra
|
|
|
|
|
|
|
|
limit3_wrap:
|
|
|
|
lda MENU_POSITION
|
|
|
|
cmp #5
|
|
|
|
bcc done_menu_wrap
|
|
|
|
lda #5
|
|
|
|
sta MENU_POSITION
|
|
|
|
bne done_menu_wrap ; bra
|
|
|
|
|
|
|
|
done_menu_wrap:
|
|
|
|
|
|
|
|
lda #<battle_menu_main
|
|
|
|
sta OUTL
|
|
|
|
lda #>battle_menu_main
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
ldx MENU_POSITION
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
cpx #MENU_MAIN_ATTACK
|
2021-01-12 05:44:03 +00:00
|
|
|
bne print_menu_attack ; print ATTACK
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_attack:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
cpx #MENU_MAIN_MAGIC
|
2021-01-12 05:44:03 +00:00
|
|
|
bne print_menu_magic ; print MAGIC
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_magic:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
cpx #MENU_MAIN_SUMMON
|
2021-01-12 05:44:03 +00:00
|
|
|
bne print_menu_summon ; print SUMMON
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_summon:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
cpx #MENU_MAIN_SKIP
|
2021-01-12 05:44:03 +00:00
|
|
|
bne print_menu_skip ; print SKIP
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_skip:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
cpx #MENU_MAIN_ESCAPE
|
2021-01-12 05:44:03 +00:00
|
|
|
bne print_menu_escape ; print ESCAPE
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_escape:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
|
|
|
|
lda HERO_LIMIT
|
|
|
|
cmp #4
|
|
|
|
bcc done_battle_draw_menu_main ; only draw if limit >=4
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
cpx #MENU_MAIN_LIMIT
|
2021-01-12 05:44:03 +00:00
|
|
|
bne print_menu_limit ; print LIMIT
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_limit:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
|
|
|
|
done_battle_draw_menu_main:
|
|
|
|
jmp done_draw_battle_menu
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
;=========================
|
|
|
|
; menu summon
|
2021-01-12 05:44:03 +00:00
|
|
|
draw_battle_menu_summon:
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
lda #<battle_menu_summons
|
|
|
|
sta OUTL
|
|
|
|
lda #>battle_menu_summons
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
; make sure it is 1 or 0
|
|
|
|
ldx MENU_POSITION
|
|
|
|
cpx #2
|
|
|
|
bcc wrap_menu_summon ; blt
|
|
|
|
ldx #1
|
|
|
|
stx MENU_POSITION
|
|
|
|
wrap_menu_summon:
|
|
|
|
|
|
|
|
jsr move_and_print ; print SUMMONS:
|
|
|
|
|
|
|
|
cpx #MENU_SUMMON_METROCAT
|
|
|
|
bne print_menu_metrocat ; print METROCAT
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_metrocat:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
cpx #MENU_SUMMON_VORTEX
|
|
|
|
bne print_menu_vortex ; print VORTEXCN
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_vortex:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
jmp done_draw_battle_menu
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
;=======================
|
|
|
|
; menu magic
|
2021-01-12 05:44:03 +00:00
|
|
|
draw_battle_menu_magic:
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
lda #<battle_menu_magic
|
|
|
|
sta OUTL
|
|
|
|
lda #>battle_menu_magic
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
|
|
|
|
; make sure it is less than 5
|
|
|
|
ldx MENU_POSITION
|
|
|
|
cpx #5
|
|
|
|
bcc wrap_menu_magic
|
|
|
|
ldx #4
|
|
|
|
stx MENU_POSITION
|
|
|
|
wrap_menu_magic:
|
|
|
|
|
|
|
|
jsr move_and_print ; print MAGIC:
|
|
|
|
|
|
|
|
cpx #MENU_MAGIC_HEAL
|
|
|
|
bne print_menu_heal ; print HEAL
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_heal:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
cpx #MENU_MAGIC_ICE
|
|
|
|
bne print_menu_ice ; print ICE
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_ice:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
cpx #MENU_MAGIC_BOLT
|
|
|
|
bne print_menu_bolt ; print BOLT
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_bolt:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
cpx #MENU_MAGIC_FIRE
|
|
|
|
bne print_menu_fire ; print FIRE
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_fire:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
cpx #MENU_MAGIC_MALAISE
|
|
|
|
bne print_menu_malaise ; print MALAISE
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_malaise:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
jmp done_draw_battle_menu
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
;===============================
|
|
|
|
; menu limit
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
draw_battle_menu_limit:
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
lda #<battle_menu_limit
|
|
|
|
sta OUTL
|
|
|
|
lda #>battle_menu_limit
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
|
|
|
|
; make sure it is less than 3
|
|
|
|
ldx MENU_POSITION
|
|
|
|
cpx #3
|
|
|
|
bcc wrap_limit_magic
|
|
|
|
ldx #2
|
|
|
|
stx MENU_POSITION
|
|
|
|
wrap_limit_magic:
|
|
|
|
|
|
|
|
jsr move_and_print ; print LIMIT BREAKS:
|
|
|
|
|
|
|
|
cpx #MENU_LIMIT_SLICE
|
|
|
|
bne print_menu_slice ; print SLICE
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_slice:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
cpx #MENU_LIMIT_DROP
|
|
|
|
bne print_menu_drop ; print DROP
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_drop:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
cpx #MENU_LIMIT_ZAP
|
|
|
|
bne print_menu_zap ; print ZAP
|
|
|
|
jsr inverse_text
|
|
|
|
print_menu_zap:
|
|
|
|
jsr move_and_print
|
|
|
|
jsr normal_text
|
|
|
|
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
done_draw_battle_menu:
|
2021-01-13 05:43:21 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;========================
|
|
|
|
; Draw inverse separator
|
|
|
|
|
|
|
|
lda DRAW_PAGE
|
|
|
|
bne draw_separator_page1
|
|
|
|
draw_separator_page0:
|
|
|
|
lda #$20
|
|
|
|
sta $650+12
|
|
|
|
sta $6d0+12
|
|
|
|
sta $750+12
|
|
|
|
sta $7d0+12
|
|
|
|
bne done_draw_separator ; bra
|
|
|
|
|
|
|
|
draw_separator_page1:
|
|
|
|
|
|
|
|
lda #$20
|
|
|
|
sta $a50+12
|
|
|
|
sta $ad0+12
|
|
|
|
sta $b50+12
|
|
|
|
sta $bd0+12
|
|
|
|
|
|
|
|
done_draw_separator:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-11 20:20:43 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;===========================
|
|
|
|
; draw bargraph
|
|
|
|
;===========================
|
|
|
|
; draw text-mode bargraph
|
|
|
|
;
|
|
|
|
; limit is 0..4
|
|
|
|
; battle_bar is battle_count/16 = 0..4
|
|
|
|
; at 30, 35 both line 42
|
|
|
|
|
|
|
|
; Y in X
|
|
|
|
; X in A
|
|
|
|
; max in CH
|
|
|
|
draw_bargraph:
|
|
|
|
clc
|
|
|
|
adc gr_offsets,X
|
|
|
|
sta GBASL
|
|
|
|
lda gr_offsets+1,X
|
|
|
|
clc
|
|
|
|
adc DRAW_PAGE
|
|
|
|
sta GBASH
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
draw_bargraph_loop:
|
|
|
|
cpy CH
|
|
|
|
bcc bar_on
|
|
|
|
lda #' '|$80 ; '_' ?
|
|
|
|
bne done_bar
|
|
|
|
bar_on:
|
|
|
|
lda #' '
|
|
|
|
done_bar:
|
|
|
|
sta (GBASL),Y
|
|
|
|
|
|
|
|
iny
|
|
|
|
cpy #5
|
|
|
|
bne draw_bargraph_loop
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
;=========================
|
|
|
|
; damage enemy
|
|
|
|
;=========================
|
|
|
|
; amount to damage in DAMAGE_VAL
|
|
|
|
damage_enemy:
|
|
|
|
lda DAMAGE_VAL
|
|
|
|
cmp ENEMY_HP
|
|
|
|
bcs damage_enemy_too_much ; bge
|
2021-01-12 05:44:03 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
; enemy hp is BCD
|
|
|
|
sed
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
sec
|
|
|
|
lda ENEMY_HP
|
|
|
|
sbc DAMAGE_VAL
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
cld
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
jmp damage_enemy_update
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
damage_enemy_too_much:
|
|
|
|
lda #0
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
damage_enemy_update:
|
|
|
|
sta ENEMY_HP
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
;===================
|
|
|
|
; heal self
|
|
|
|
;===================
|
|
|
|
; heal amount in DAMAGE_VAL (yes, I know)
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
heal_self:
|
|
|
|
clc
|
|
|
|
lda HERO_HP
|
|
|
|
adc DAMAGE_VAL
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
; check if HP went down, if so we wrapped
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
cmp HERO_HP
|
|
|
|
bcc heal_self_max ; blt
|
|
|
|
bcs heal_self_update
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
heal_self_max:
|
|
|
|
lda HERO_HP_MAX
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
heal_self_update:
|
|
|
|
sta HERO_HP
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
;========================
|
|
|
|
; damage TFV
|
|
|
|
;========================
|
|
|
|
; value in DAMAGE_VAL
|
|
|
|
damage_tfv:
|
|
|
|
lda DAMAGE_VAL
|
|
|
|
cmp HERO_HP
|
|
|
|
bcs damage_hero_too_much ; bge
|
|
|
|
|
|
|
|
sec
|
|
|
|
lda HERO_HP
|
|
|
|
sbc DAMAGE_VAL
|
|
|
|
jmp damage_hero_update
|
|
|
|
|
|
|
|
damage_hero_too_much:
|
|
|
|
lda #0
|
|
|
|
|
|
|
|
damage_hero_update:
|
|
|
|
sta HERO_HP
|
|
|
|
|
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
;=========================
|
|
|
|
; attack
|
|
|
|
;=========================
|
|
|
|
attack:
|
2021-01-13 17:16:20 +00:00
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
lda #$10
|
|
|
|
sta DAMAGE_VAL
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
attack_loop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
; copy over background
|
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
; draw hero
|
|
|
|
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda HERO_X
|
|
|
|
sta XPOS
|
|
|
|
|
|
|
|
lsr
|
|
|
|
bcc attack_draw_walk
|
|
|
|
|
|
|
|
attack_draw_stand:
|
|
|
|
lda #<tfv_stand_left_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_stand_left_sprite
|
|
|
|
jmp attack_actually_draw
|
|
|
|
|
|
|
|
attack_draw_walk:
|
|
|
|
lda #<tfv_walk_left_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_walk_left_sprite
|
|
|
|
|
|
|
|
attack_actually_draw:
|
|
|
|
sta INH
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
;=========================
|
|
|
|
; draw sword
|
|
|
|
|
|
|
|
lda HERO_X
|
|
|
|
sec
|
|
|
|
sbc #5
|
|
|
|
sta XPOS
|
|
|
|
; ypos already 20?
|
|
|
|
|
|
|
|
lda #<tfv_led_sword_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_led_sword_sprite
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
|
|
|
|
;=========================
|
|
|
|
; draw enemy
|
|
|
|
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
; ypos already 20?
|
|
|
|
|
|
|
|
jsr draw_enemy
|
|
|
|
|
|
|
|
;===========================
|
|
|
|
; draw battle bottom
|
|
|
|
|
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
;===========================
|
|
|
|
; page flip
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
dec HERO_X
|
|
|
|
lda HERO_X
|
|
|
|
cmp #10 ; repeat until 10
|
|
|
|
bne attack_loop
|
|
|
|
|
|
|
|
;======================
|
|
|
|
; attack done
|
|
|
|
|
|
|
|
;===================
|
|
|
|
; damage the enemy
|
|
|
|
|
|
|
|
jsr damage_enemy
|
|
|
|
|
|
|
|
; display damage
|
|
|
|
|
|
|
|
lda #2
|
|
|
|
sta XPOS
|
|
|
|
lda #10
|
|
|
|
sta YPOS
|
|
|
|
jsr gr_put_num
|
|
|
|
|
|
|
|
;===================
|
|
|
|
; page flip
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
; delay
|
|
|
|
lda #255
|
|
|
|
jsr WAIT
|
|
|
|
|
|
|
|
; restore X value
|
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;===============================
|
|
|
|
; enemy attack
|
|
|
|
;===============================
|
|
|
|
enemy_attack:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; int ax=enemy_x;
|
|
|
|
; int damage=10;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; enemy_attacking=1;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; while(ax<30) {
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; put attack name on
|
|
|
|
; occasionally attack with that enemy's power?
|
|
|
|
; occasionally heal self?
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; gr_copy_to_current(0xc00);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; draw first so behind enemy
|
2021-01-12 05:44:03 +00:00
|
|
|
; grsim_put_sprite(tfv_stand_left,tfv_x,20);
|
|
|
|
; grsim_put_sprite(tfv_led_sword,tfv_x-5,20);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; if (ax&1) {
|
2021-01-05 20:32:11 +00:00
|
|
|
; grsim_put_sprite(enemies[enemy_type].sprite,ax,20);
|
2021-01-12 05:44:03 +00:00
|
|
|
; }
|
|
|
|
; else {
|
2021-01-05 20:32:11 +00:00
|
|
|
; grsim_put_sprite(enemies[enemy_type].sprite,ax,20);
|
2021-01-12 05:44:03 +00:00
|
|
|
; }
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; draw_battle_bottom(enemy_type);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; page_flip();
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; ax+=1;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; usleep(20000);
|
|
|
|
; }
|
|
|
|
; enemy_attacking=0;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; damage_tfv(damage);
|
|
|
|
; gr_put_num(25,10,damage);
|
|
|
|
; draw_battle_bottom(enemy_type);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; page_flip();
|
|
|
|
; usleep(250000);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
; return damage;
|
|
|
|
;}
|
|
|
|
|
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
victory_string:
|
|
|
|
.byte 13,21,"EXPERIENCE +2",0
|
|
|
|
.byte 16,22,"MONEY +1",0
|
|
|
|
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;====================================
|
|
|
|
; victory dance
|
|
|
|
;====================================
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
victory_dance:
|
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
; update XP and money
|
|
|
|
|
|
|
|
inc HERO_XP
|
|
|
|
inc HERO_XP
|
|
|
|
|
|
|
|
inc HERO_MONEY
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
ldx #25
|
|
|
|
stx ANIMATE_LOOP
|
|
|
|
victory_dance_loop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
jsr clear_bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
lda #<victory_string
|
|
|
|
sta OUTL
|
|
|
|
lda #>victory_string
|
|
|
|
sta OUTH
|
|
|
|
jsr move_and_print
|
|
|
|
jsr move_and_print
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
txa
|
|
|
|
and #1
|
|
|
|
beq victory_wave
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
victory_stand:
|
|
|
|
lda HERO_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
lda #<tfv_stand_left_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_stand_left_sprite
|
|
|
|
sta INH
|
|
|
|
jsr put_sprite_crop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
lda HERO_X
|
|
|
|
sec
|
|
|
|
sbc #5
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
lda #<tfv_led_sword_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_led_sword_sprite
|
|
|
|
jmp victory_draw_done
|
|
|
|
|
|
|
|
victory_wave:
|
|
|
|
|
|
|
|
lda HERO_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda #<tfv_victory_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_victory_sprite
|
|
|
|
sta INH
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
lda HERO_X
|
|
|
|
sec
|
|
|
|
sbc #2
|
|
|
|
sta XPOS
|
|
|
|
lda #14
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda #<tfv_led_sword_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_led_sword_sprite
|
|
|
|
|
|
|
|
|
|
|
|
victory_draw_done:
|
|
|
|
sta INH
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
|
|
|
|
; delay
|
|
|
|
lda #255
|
|
|
|
jsr WAIT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 17:45:24 +00:00
|
|
|
dec ANIMATE_LOOP
|
|
|
|
bne victory_dance_loop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
;===========================
|
|
|
|
; magic attack
|
|
|
|
;===========================
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
magic_attack:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda #$15
|
|
|
|
sta DAMAGE_VAL
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda MENU_POSITION
|
|
|
|
cmp #MENU_MAGIC_HEAL
|
|
|
|
beq do_magic_heal
|
|
|
|
cmp #MENU_MAGIC_FIRE
|
|
|
|
beq do_magic_fire
|
|
|
|
cmp #MENU_MAGIC_ICE
|
|
|
|
beq do_magic_ice
|
|
|
|
cmp #MENU_MAGIC_BOLT
|
|
|
|
beq do_magic_bolt
|
|
|
|
cmp #MENU_MAGIC_MALAISE
|
|
|
|
beq do_magic_malaise
|
|
|
|
|
|
|
|
do_magic_heal: ; MENU_MAGIC_HEAL
|
|
|
|
lda #33
|
|
|
|
sta MAGIC_X
|
|
|
|
lda #20
|
|
|
|
sta MAGIC_Y
|
|
|
|
|
|
|
|
jmp done_magic_setup
|
|
|
|
|
|
|
|
do_magic_fire: ; MENU_MAGIC_FIRE
|
|
|
|
lda #2
|
|
|
|
sta MAGIC_X
|
|
|
|
lda #20
|
|
|
|
sta MAGIC_Y
|
|
|
|
|
|
|
|
jmp done_magic_setup
|
|
|
|
|
|
|
|
do_magic_ice: ; MENU_MAGIC_ICE
|
|
|
|
lda #2
|
|
|
|
sta MAGIC_X
|
|
|
|
lda #20
|
|
|
|
sta MAGIC_Y
|
|
|
|
|
|
|
|
jmp done_magic_setup
|
|
|
|
|
|
|
|
do_magic_bolt: ; MENU_MAGIC_BOLT
|
|
|
|
lda #2
|
|
|
|
sta MAGIC_X
|
|
|
|
lda #20
|
|
|
|
sta MAGIC_Y
|
|
|
|
|
|
|
|
jmp done_magic_setup
|
|
|
|
|
|
|
|
do_magic_malaise: ; MENU_MAGIC_MALAISE
|
|
|
|
lda #2
|
|
|
|
sta MAGIC_X
|
|
|
|
lda #20
|
|
|
|
sta MAGIC_Y
|
|
|
|
|
|
|
|
jmp done_magic_setup
|
|
|
|
|
|
|
|
done_magic_setup:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
|
|
|
|
;=========================================
|
|
|
|
; cast the magic
|
2021-01-05 20:32:11 +00:00
|
|
|
; FIXME: damage based on weakness of enemy
|
|
|
|
; FIXME: disallow if not enough MP
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
cast_the_magic:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda MENU_POSITION
|
|
|
|
sta MAGIC_TYPE
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda #10
|
|
|
|
sta ANIMATE_LOOP
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
cast_magic_loop:
|
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; sprite with hands up
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda HERO_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda #<tfv_victory_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_victory_sprite
|
|
|
|
sta INH
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
jsr put_sprite_crop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
jsr draw_battle_bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
jsr page_flip
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; delay a bit
|
|
|
|
lda #50
|
|
|
|
jsr WAIT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
dec ANIMATE_LOOP
|
|
|
|
bne cast_magic_loop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
;========================
|
|
|
|
; Actually do the magic
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda #20
|
|
|
|
sta ANIMATE_LOOP
|
|
|
|
magic_happens_loop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; draw hero
|
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
2021-01-15 04:26:24 +00:00
|
|
|
lda #20
|
|
|
|
sta HERO_Y
|
2021-01-15 02:42:26 +00:00
|
|
|
jsr draw_hero_and_sword
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda ANIMATE_LOOP
|
|
|
|
and #$1
|
|
|
|
clc
|
|
|
|
adc MAGIC_X
|
|
|
|
sta XPOS
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda MAGIC_Y
|
|
|
|
sta YPOS
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
lda MAGIC_TYPE
|
|
|
|
asl
|
|
|
|
tay
|
|
|
|
lda magic_sprites,Y
|
|
|
|
sta INL
|
|
|
|
lda magic_sprites+1,Y
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
; delay a bit
|
|
|
|
lda #50
|
|
|
|
jsr WAIT
|
|
|
|
|
|
|
|
dec ANIMATE_LOOP
|
|
|
|
bne magic_happens_loop
|
|
|
|
|
|
|
|
|
|
|
|
;=============================
|
|
|
|
|
|
|
|
|
|
|
|
; decrease magic points
|
|
|
|
; mp-=5;
|
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
|
|
|
|
; draw hero
|
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
2021-01-15 04:26:24 +00:00
|
|
|
lda #20
|
|
|
|
sta HERO_Y
|
2021-01-15 02:42:26 +00:00
|
|
|
jsr draw_hero_and_sword
|
|
|
|
|
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
|
|
|
|
|
|
|
lda MAGIC_TYPE
|
|
|
|
cmp #MENU_MAGIC_HEAL
|
|
|
|
beq was_heal_magic
|
|
|
|
|
|
|
|
jsr damage_enemy
|
|
|
|
lda #2
|
|
|
|
sta XPOS
|
|
|
|
lda #10
|
|
|
|
sta YPOS
|
|
|
|
jsr gr_put_num
|
|
|
|
jmp done_magic_damage
|
|
|
|
|
|
|
|
was_heal_magic:
|
|
|
|
jsr heal_self
|
|
|
|
done_magic_damage:
|
|
|
|
|
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
; wait 2s
|
|
|
|
ldx #200
|
|
|
|
jsr long_wait
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
;======================
|
|
|
|
;======================
|
|
|
|
; Limit Break "Drop"
|
|
|
|
; Jump into sky, drop down and slice enemy in half
|
|
|
|
;======================
|
|
|
|
;======================
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
limit_break_drop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
lda #$99
|
|
|
|
sta DAMAGE_VAL
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
|
|
|
lda #20
|
|
|
|
sta HERO_Y
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
drop_jump_loop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
; while(ay>0) {
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr draw_hero_and_sword
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr draw_battle_bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr page_flip
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
lda #75
|
|
|
|
jsr WAIT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
; must be even
|
|
|
|
dec HERO_Y
|
|
|
|
dec HERO_Y
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
lda HERO_Y
|
|
|
|
cmp #$f6
|
|
|
|
bne drop_jump_loop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
lda #10
|
|
|
|
sta HERO_X
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
;===============
|
|
|
|
; Falling
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
drop_falling_loop:
|
|
|
|
; while(ay<=20) {
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr draw_hero_and_sword
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr draw_battle_bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
; draw line
|
|
|
|
; only if HERO_Y>0
|
|
|
|
lda #$dd ; yellow
|
|
|
|
sta COLOR
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
ldx HERO_Y
|
|
|
|
bmi done_drop_vlin
|
|
|
|
stx V2
|
|
|
|
ldx #0
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
lda HERO_X
|
|
|
|
sec
|
|
|
|
sbc #5
|
|
|
|
tay
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr vlin ; X,V2 at Y vlin(0,ay,ax-5);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
done_drop_vlin:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr page_flip
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
lda #100
|
|
|
|
jsr WAIT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
inc HERO_Y
|
|
|
|
inc HERO_Y
|
|
|
|
lda HERO_Y
|
|
|
|
cmp #20
|
|
|
|
bne drop_falling_loop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
lda #0
|
|
|
|
sta ANIMATE_LOOP
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
more_drop_loop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr draw_hero_and_sword
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
; draw cut line
|
|
|
|
lda #$CC
|
|
|
|
sta COLOR
|
|
|
|
|
|
|
|
lda HERO_Y
|
|
|
|
clc
|
|
|
|
adc ANIMATE_LOOP
|
|
|
|
sta V2
|
|
|
|
|
|
|
|
ldx HERO_Y
|
|
|
|
|
|
|
|
lda HERO_X
|
|
|
|
sec
|
|
|
|
sbc #5
|
|
|
|
tay
|
|
|
|
|
|
|
|
jsr vlin ; x,v2 at Y vlin(ay,ay+i,ax-5);
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
lda #75
|
|
|
|
jsr WAIT
|
|
|
|
|
|
|
|
inc ANIMATE_LOOP
|
|
|
|
lda ANIMATE_LOOP
|
|
|
|
cmp #13
|
|
|
|
bne more_drop_loop
|
|
|
|
|
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
|
|
|
|
|
|
|
; draw hero
|
|
|
|
|
|
|
|
jsr draw_hero_and_sword
|
|
|
|
|
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
; slice
|
|
|
|
; FIXME: should this be ground color?
|
|
|
|
|
|
|
|
lda #$cc ; lightgreen
|
|
|
|
sta COLOR
|
|
|
|
|
|
|
|
ldx #33
|
|
|
|
stx V2
|
|
|
|
ldx #20
|
|
|
|
lda #5
|
|
|
|
tay
|
|
|
|
|
|
|
|
jsr vlin ; x,v2 at Y
|
|
|
|
|
|
|
|
jsr damage_enemy
|
|
|
|
|
|
|
|
lda #2
|
|
|
|
sta XPOS
|
|
|
|
lda #10
|
|
|
|
sta YPOS
|
|
|
|
jsr gr_put_num
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
; wait 2s
|
|
|
|
ldx #200
|
|
|
|
jsr long_wait
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
;=========================
|
|
|
|
;=========================
|
|
|
|
; Limit Break "Slice"
|
|
|
|
; Run up and slap a bunch with sword
|
|
|
|
; TODO: cause damage value to bounce around more?
|
|
|
|
;=========================
|
|
|
|
;=========================
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
limit_break_slice:
|
|
|
|
.if 0
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
int tx=34,ty=20;
|
|
|
|
int damage=5;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
while(tx>10) {
|
|
|
|
|
|
|
|
gr_copy_to_current(0xc00);
|
|
|
|
|
|
|
|
grsim_put_sprite(tfv_stand_left,tx,ty);
|
|
|
|
grsim_put_sprite(tfv_led_sword,tx-5,ty);
|
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
draw_battle_bottom(enemy_type);
|
|
|
|
|
|
|
|
page_flip();
|
|
|
|
|
|
|
|
tx-=1;
|
|
|
|
|
|
|
|
usleep(20000);
|
|
|
|
}
|
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; Slicing */
|
2021-01-04 16:53:13 +00:00
|
|
|
for(i=0;i<20;i++) {
|
|
|
|
|
|
|
|
gr_copy_to_current(0xc00);
|
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
if (i&1) {
|
|
|
|
grsim_put_sprite(tfv_stand_left,tx,20);
|
|
|
|
grsim_put_sprite(tfv_led_sword,tx-5,20);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
grsim_put_sprite(tfv_victory,tx,20);
|
|
|
|
grsim_put_sprite(tfv_led_sword,tx-2,14);
|
|
|
|
}
|
|
|
|
|
|
|
|
damage_enemy(damage);
|
2021-01-05 20:32:11 +00:00
|
|
|
; gr_put_num(2+(i%2),10+((i%2)*2),damage);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
draw_battle_bottom(enemy_type);
|
|
|
|
|
|
|
|
page_flip();
|
|
|
|
|
|
|
|
usleep(100000);
|
|
|
|
}
|
|
|
|
|
|
|
|
tx=34;
|
|
|
|
ty=20;
|
|
|
|
|
|
|
|
gr_copy_to_current(0xc00);
|
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
|
|
|
|
|
|
|
; draw hero
|
|
|
|
|
|
|
|
jsr draw_hero_and_sword
|
|
|
|
|
2021-01-04 16:53:13 +00:00
|
|
|
grsim_put_sprite(tfv_stand_left,tx,ty);
|
|
|
|
grsim_put_sprite(tfv_led_sword,tx-5,ty);
|
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
.endif
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
; wait 2s
|
|
|
|
ldx #20
|
|
|
|
jsr long_wait
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
;=========================
|
|
|
|
;========================
|
|
|
|
; Limit Break "Zap"
|
|
|
|
; Zap with a laser out of the LED sword */
|
|
|
|
;=========================
|
|
|
|
;=========================
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
limit_break_zap:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
.if 0
|
2021-01-04 16:53:13 +00:00
|
|
|
int tx=34,ty=20;
|
|
|
|
int damage=100;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
gr_copy_to_current(0xc00);
|
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; Draw background */
|
2021-01-04 16:53:13 +00:00
|
|
|
color_equals(COLOR_AQUA);
|
|
|
|
vlin(12,24,34);
|
|
|
|
hlin_double(ram[DRAW_PAGE],28,38,18);
|
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; Sword in air */
|
2021-01-04 16:53:13 +00:00
|
|
|
grsim_put_sprite(tfv_victory,tx,20);
|
|
|
|
grsim_put_sprite(tfv_led_sword,tx-2,14);
|
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
draw_battle_bottom(enemy_type);
|
|
|
|
|
|
|
|
page_flip();
|
|
|
|
|
|
|
|
usleep(500000);
|
|
|
|
|
|
|
|
for(i=0;i<32;i++) {
|
|
|
|
|
|
|
|
gr_copy_to_current(0xc00);
|
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
color_equals(i%16);
|
|
|
|
hlin_double(ram[DRAW_PAGE],5,30,22);
|
|
|
|
|
|
|
|
grsim_put_sprite(tfv_stand_left,tx,ty);
|
|
|
|
grsim_put_sprite(tfv_led_sword,tx-5,ty);
|
|
|
|
|
|
|
|
draw_battle_bottom(enemy_type);
|
|
|
|
|
|
|
|
page_flip();
|
|
|
|
|
|
|
|
usleep(100000);
|
|
|
|
}
|
|
|
|
|
|
|
|
gr_copy_to_current(0xc00);
|
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
|
|
|
|
|
|
|
|
|
|
|
; draw hero
|
|
|
|
|
|
|
|
jsr draw_hero_and_sword
|
|
|
|
|
2021-01-04 16:53:13 +00:00
|
|
|
grsim_put_sprite(tfv_stand_left,tx,ty);
|
|
|
|
grsim_put_sprite(tfv_led_sword,tx-5,ty);
|
2021-01-15 04:26:24 +00:00
|
|
|
.endif
|
|
|
|
jsr draw_battle_bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
jsr damage_enemy
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 04:26:24 +00:00
|
|
|
lda #2
|
|
|
|
sta XPOS
|
|
|
|
lda #10
|
|
|
|
sta YPOS
|
|
|
|
jsr gr_put_num
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
; wait 2s
|
|
|
|
ldx #20
|
|
|
|
jsr long_wait
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
;==========================
|
|
|
|
; limit break
|
|
|
|
;==========================
|
|
|
|
limit_break:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
; reset limit counter
|
|
|
|
lda #0
|
|
|
|
sta HERO_LIMIT
|
2021-01-15 02:42:26 +00:00
|
|
|
|
|
|
|
; TODO: replace with jump table?
|
|
|
|
|
|
|
|
lda MENU_POSITION
|
|
|
|
cmp #MENU_LIMIT_DROP
|
|
|
|
beq do_limit_drop
|
|
|
|
cmp #MENU_LIMIT_SLICE
|
|
|
|
beq do_limit_slice
|
|
|
|
cmp #MENU_LIMIT_ZAP
|
|
|
|
beq do_limit_zap
|
|
|
|
|
|
|
|
do_limit_drop:
|
|
|
|
jmp limit_break_drop
|
|
|
|
do_limit_slice:
|
|
|
|
jmp limit_break_slice
|
|
|
|
do_limit_zap:
|
|
|
|
jmp limit_break_zap
|
|
|
|
|
|
|
|
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
;========================
|
|
|
|
; summon metrocat
|
|
|
|
;========================
|
|
|
|
summon_metrocat:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda #$17
|
|
|
|
sta DAMAGE_VAL
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda #28
|
|
|
|
sta MAGIC_X
|
|
|
|
lda #2
|
|
|
|
sta MAGIC_Y
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
;===========================
|
|
|
|
; draw looming metrocat head
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda #30
|
|
|
|
sta ANIMATE_LOOP
|
|
|
|
looming_metrocat_loop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
; draw hero
|
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
|
|
|
jsr draw_hero_and_sword
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
; draw metrocat's head
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda MAGIC_X
|
|
|
|
sta XPOS
|
|
|
|
lda MAGIC_Y
|
|
|
|
sta YPOS
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda #<metrocat_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>metrocat_sprite
|
|
|
|
sta INH
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr put_sprite_crop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
; draw battle bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr draw_battle_bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr page_flip
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda #75
|
|
|
|
jsr WAIT ; delay a bit
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
dec ANIMATE_LOOP
|
|
|
|
bne looming_metrocat_loop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
move_metrocat_loop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr draw_hero_and_sword
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
; draw metrocat's head
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda MAGIC_X
|
|
|
|
sta XPOS
|
|
|
|
lda MAGIC_Y
|
|
|
|
sta YPOS
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda #<metrocat_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>metrocat_sprite
|
|
|
|
sta INH
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr put_sprite_crop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
; draw battle bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr draw_battle_bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr page_flip
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda #50 ; delay
|
|
|
|
jsr WAIT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
dec MAGIC_X
|
|
|
|
lda MAGIC_X
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
cmp #15
|
|
|
|
bcs metrocat_no_move_y
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
; have to keep even
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
and #1
|
|
|
|
bne metrocat_no_move_y
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
inc MAGIC_Y
|
|
|
|
inc MAGIC_Y
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
metrocat_no_move_y:
|
|
|
|
lda MAGIC_X
|
|
|
|
cmp #5 ; move until X=5
|
|
|
|
bcs move_metrocat_loop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda #30
|
|
|
|
sta ANIMATE_LOOP
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
metrocat_damage_loop:
|
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
jsr draw_hero_and_sword
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
; draw metrocat's head
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
lda MAGIC_X
|
|
|
|
sta XPOS
|
|
|
|
lda MAGIC_Y
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda #<metrocat_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>metrocat_sprite
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
lda #50
|
|
|
|
jsr WAIT
|
|
|
|
|
|
|
|
dec ANIMATE_LOOP
|
|
|
|
bne metrocat_damage_loop
|
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
; draw enemy
|
|
|
|
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
|
|
|
|
|
|
|
; draw hero
|
|
|
|
|
|
|
|
jsr draw_hero_and_sword
|
|
|
|
|
|
|
|
; draw bottom
|
|
|
|
|
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
jsr damage_enemy
|
|
|
|
|
|
|
|
lda #2
|
|
|
|
sta XPOS
|
|
|
|
lda #10
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
jsr gr_put_num
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
; long wait (2s?)
|
|
|
|
ldx #200
|
|
|
|
jsr long_wait
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;=========================
|
|
|
|
; Vortex Cannon
|
|
|
|
;=========================
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
summon_vortex_cannon:
|
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
lda #5
|
|
|
|
sta DAMAGE_VAL
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
lda #20
|
|
|
|
sta MAGIC_X
|
|
|
|
sta MAGIC_Y
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
; draw the cannon
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
lda #30
|
|
|
|
sta ANIMATE_LOOP
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
vortex_setup_loop:
|
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
; draw hero
|
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
|
|
|
jsr draw_hero_and_sword
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
; grsim_put_sprite(vortex_cannon,ax,ay);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
; draw vortex_cannon
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
lda #20
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
lda #<vortex_cannon_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>vortex_cannon_sprite
|
|
|
|
sta INH
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
jsr put_sprite_crop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
; draw bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
jsr draw_battle_bottom
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
jsr page_flip
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
lda #50
|
|
|
|
jsr WAIT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
dec ANIMATE_LOOP
|
|
|
|
bne vortex_setup_loop
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
; Fire vortices
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
lda #5
|
|
|
|
sta ANIMATE_LOOP
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
vortex_cannon_fire_loop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
lda #20
|
|
|
|
sta MAGIC_X
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
vortex_cannon_move_loop:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
jsr gr_copy_to_current
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
; draw hero
|
|
|
|
jsr draw_hero_and_sword
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-14 04:28:43 +00:00
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
|
|
|
|
|
|
|
; draw vortex_cannon
|
|
|
|
|
|
|
|
lda #20
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda #<vortex_cannon_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>vortex_cannon_sprite
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
; draw vortex
|
|
|
|
|
|
|
|
lda MAGIC_X
|
|
|
|
sta XPOS
|
|
|
|
lda #24
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda #<vortex_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>vortex_sprite
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
|
|
|
|
; print damage if < 10
|
|
|
|
lda MAGIC_X
|
|
|
|
cmp #10
|
|
|
|
bcs vortex_no_print_damage
|
|
|
|
|
|
|
|
lda #2
|
|
|
|
sta XPOS
|
|
|
|
lda #10
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
jsr gr_put_num
|
|
|
|
|
|
|
|
vortex_no_print_damage:
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
lda #100
|
|
|
|
jsr WAIT
|
|
|
|
|
|
|
|
dec MAGIC_X
|
|
|
|
|
|
|
|
lda MAGIC_X
|
|
|
|
cmp #5
|
|
|
|
bcs vortex_cannon_move_loop
|
|
|
|
|
|
|
|
; damage enemy
|
|
|
|
jsr damage_enemy
|
|
|
|
|
|
|
|
dec ANIMATE_LOOP
|
|
|
|
bne vortex_cannon_fire_loop
|
|
|
|
|
|
|
|
|
|
|
|
; end of summon
|
|
|
|
|
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
; draw enemy
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
lda #20
|
|
|
|
sta YPOS
|
|
|
|
jsr draw_enemy
|
|
|
|
|
|
|
|
; draw hero
|
|
|
|
jsr draw_hero_and_sword
|
|
|
|
|
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
; wait 2s
|
2021-01-15 02:42:26 +00:00
|
|
|
ldx #200
|
2021-01-14 04:28:43 +00:00
|
|
|
jsr long_wait
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
;=========================
|
|
|
|
; summon
|
2021-01-13 20:17:15 +00:00
|
|
|
;=========================
|
2021-01-13 05:43:21 +00:00
|
|
|
summon:
|
2021-01-13 20:17:15 +00:00
|
|
|
lda MENU_POSITION
|
|
|
|
beq do_summon_metrocat
|
|
|
|
bne do_summon_vortex_cannon
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
do_summon_metrocat:
|
|
|
|
jmp summon_metrocat
|
|
|
|
do_summon_vortex_cannon:
|
|
|
|
jmp summon_vortex_cannon
|
2021-01-13 05:43:21 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;=============================
|
|
|
|
; done attack
|
|
|
|
;=============================
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
done_attack:
|
|
|
|
lda #0
|
|
|
|
sta BATTLE_COUNT
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
lda #MENU_NONE
|
|
|
|
sta MENU_STATE
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-13 05:43:21 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
;=========================
|
|
|
|
; battle menu keypress
|
|
|
|
;=========================
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
battle_menu_keypress:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
lda LAST_KEY
|
|
|
|
cmp #27
|
|
|
|
beq keypress_escape
|
|
|
|
cmp #'W'
|
|
|
|
beq keypress_up
|
|
|
|
cmp #'S'
|
|
|
|
beq keypress_down
|
|
|
|
cmp #'A'
|
|
|
|
beq keypress_left
|
|
|
|
cmp #'D'
|
|
|
|
beq keypress_right
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
cmp #' '
|
|
|
|
beq keypress_action
|
|
|
|
cmp #13
|
|
|
|
beq keypress_action
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
keypress_escape:
|
|
|
|
lda #MENU_MAIN
|
|
|
|
sta MENU_STATE
|
|
|
|
lda #0
|
|
|
|
sta MENU_POSITION
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_up:
|
2021-01-13 05:43:21 +00:00
|
|
|
lda MENU_STATE
|
|
|
|
cmp #MENU_SUMMON
|
|
|
|
bne up_the_rest
|
|
|
|
up_for_summons:
|
|
|
|
lda MENU_POSITION
|
|
|
|
cmp #1
|
|
|
|
bcc done_keypress_up ; blt
|
|
|
|
bcs up_dec_menu
|
|
|
|
|
|
|
|
up_the_rest:
|
2021-01-12 05:44:03 +00:00
|
|
|
lda MENU_POSITION
|
|
|
|
cmp #2
|
|
|
|
bcc done_keypress_up ; blt
|
|
|
|
dec MENU_POSITION
|
2021-01-13 05:43:21 +00:00
|
|
|
up_dec_menu:
|
2021-01-12 05:44:03 +00:00
|
|
|
dec MENU_POSITION
|
|
|
|
done_keypress_up:
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_down:
|
|
|
|
inc MENU_POSITION
|
|
|
|
inc MENU_POSITION
|
|
|
|
rts
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
keypress_right:
|
|
|
|
inc MENU_POSITION
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_left:
|
|
|
|
lda MENU_POSITION
|
|
|
|
beq done_keypress_left
|
|
|
|
dec MENU_POSITION
|
|
|
|
done_keypress_left:
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_action:
|
2021-01-13 05:43:21 +00:00
|
|
|
|
|
|
|
lda MENU_STATE
|
|
|
|
cmp #MENU_MAIN
|
|
|
|
beq keypress_main_action
|
|
|
|
cmp #MENU_MAGIC
|
|
|
|
beq keypress_magic_action
|
|
|
|
cmp #MENU_LIMIT
|
|
|
|
beq keypress_limit_action
|
|
|
|
cmp #MENU_SUMMON
|
|
|
|
beq keypress_summon_action
|
|
|
|
|
|
|
|
keypress_main_action:
|
|
|
|
lda MENU_POSITION
|
|
|
|
cmp #MENU_MAIN_ATTACK
|
|
|
|
beq keypress_main_attack
|
|
|
|
cmp #MENU_MAIN_SKIP
|
|
|
|
beq keypress_main_skip
|
|
|
|
cmp #MENU_MAIN_MAGIC
|
|
|
|
beq keypress_main_magic
|
|
|
|
cmp #MENU_MAIN_LIMIT
|
|
|
|
beq keypress_main_limit
|
|
|
|
cmp #MENU_MAIN_SUMMON
|
|
|
|
beq keypress_main_summon
|
|
|
|
cmp #MENU_MAIN_ESCAPE
|
|
|
|
beq keypress_main_escape
|
|
|
|
|
|
|
|
keypress_main_attack:
|
|
|
|
; attack and decrement HP
|
|
|
|
jsr attack
|
|
|
|
jsr done_attack
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_main_skip:
|
|
|
|
jsr done_attack
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_main_magic:
|
|
|
|
lda #MENU_MAGIC
|
|
|
|
sta MENU_STATE
|
|
|
|
lda #0
|
|
|
|
sta MENU_POSITION
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_main_limit:
|
|
|
|
lda #MENU_LIMIT
|
|
|
|
sta MENU_STATE
|
|
|
|
lda #0
|
|
|
|
sta MENU_POSITION
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_main_summon:
|
|
|
|
lda #MENU_SUMMON
|
|
|
|
sta MENU_STATE
|
|
|
|
lda #0
|
|
|
|
sta MENU_POSITION
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_main_escape:
|
|
|
|
lda #HERO_STATE_RUNNING
|
|
|
|
ora HERO_STATE
|
|
|
|
sta HERO_STATE
|
|
|
|
|
|
|
|
jsr done_attack
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_magic_action:
|
|
|
|
jsr magic_attack
|
|
|
|
jsr done_attack
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_limit_action:
|
|
|
|
jsr limit_break
|
|
|
|
jsr done_attack
|
|
|
|
rts
|
|
|
|
|
|
|
|
keypress_summon_action:
|
|
|
|
jsr summon
|
|
|
|
jsr done_attack
|
2021-01-12 05:44:03 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
2021-01-13 17:16:20 +00:00
|
|
|
;================================
|
|
|
|
; draw enemy
|
|
|
|
; relies on self-modifying code
|
|
|
|
; position in XPOS,YPOS
|
|
|
|
|
|
|
|
draw_enemy:
|
|
|
|
|
|
|
|
draw_enemy_smc1:
|
|
|
|
lda #$a5
|
|
|
|
sta INL
|
|
|
|
draw_enemy_smc2:
|
|
|
|
lda #$a5
|
|
|
|
|
|
|
|
battle_actual_draw_enemy:
|
|
|
|
sta INH
|
|
|
|
jmp put_sprite_crop ; tail call
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
|
2021-01-13 20:17:15 +00:00
|
|
|
;============================
|
|
|
|
; draw hero and sword
|
|
|
|
;============================
|
2021-01-15 04:26:24 +00:00
|
|
|
; draws at HERO_X,HERO_Y
|
2021-01-13 20:17:15 +00:00
|
|
|
|
|
|
|
draw_hero_and_sword:
|
|
|
|
|
|
|
|
lda HERO_X
|
|
|
|
sta XPOS
|
2021-01-15 04:26:24 +00:00
|
|
|
lda HERO_Y
|
2021-01-13 20:17:15 +00:00
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda #<tfv_stand_left_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_stand_left_sprite
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
; grsim_put_sprite(tfv_led_sword,ax-5,20);
|
|
|
|
lda HERO_X
|
|
|
|
sec
|
|
|
|
sbc #5
|
|
|
|
sta XPOS
|
2021-01-15 04:26:24 +00:00
|
|
|
lda HERO_Y
|
2021-01-13 20:17:15 +00:00
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda #<tfv_led_sword_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>tfv_led_sword_sprite
|
|
|
|
sta INH
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
;=====================
|
2021-01-13 20:17:15 +00:00
|
|
|
;=====================
|
|
|
|
; long(er) wait
|
|
|
|
; waits approximately 10ms * X
|
2021-01-15 02:42:26 +00:00
|
|
|
;=====================
|
|
|
|
;=====================
|
2021-01-13 20:17:15 +00:00
|
|
|
long_wait:
|
|
|
|
lda #64
|
|
|
|
jsr WAIT ; delay 1/2(26+27A+5A^2) us, 11,117
|
|
|
|
dex
|
|
|
|
bne long_wait
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2021-01-12 05:44:03 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
;====================
|
|
|
|
;====================
|
|
|
|
; Boss Battle
|
|
|
|
;====================
|
|
|
|
;====================
|
2021-01-12 05:44:03 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
boss_battle:
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; int i,ch;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; int saved_drawpage;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; int ax=34;
|
|
|
|
; int enemy_count=30;
|
|
|
|
; int old;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; susie_out=1;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; rotate_intro();
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; battle_count=20;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; enemy_type=8;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; enemy_hp=255;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; saved_drawpage=ram[DRAW_PAGE];
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; ram[DRAW_PAGE]=PAGE2;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
;=====================
|
|
|
|
; Draw background
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; Draw sky */
|
2021-01-15 02:42:26 +00:00
|
|
|
; color_equals(COLOR_BLACK);
|
|
|
|
; for(i=0;i<20;i++) {
|
|
|
|
; hlin_double(ram[DRAW_PAGE],0,39,i);
|
|
|
|
; }
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; color_equals(COLOR_ORANGE);
|
|
|
|
; for(i=20;i<39;i++) {
|
|
|
|
; hlin_double(ram[DRAW_PAGE],0,39,i);
|
|
|
|
; }
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
; Draw horizon */
|
|
|
|
; color_equals(COLOR_GREY);
|
|
|
|
; hlin_double(ram[DRAW_PAGE],0,39,10);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; ram[DRAW_PAGE]=saved_drawpage;
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; draw_battle_bottom(enemy_type);
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; while(1) {
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-15 02:42:26 +00:00
|
|
|
; gr_copy_to_current(0xc00);
|
|
|
|
;
|
|
|
|
; if (hp==0) {
|
|
|
|
; grsim_put_sprite(tfv_defeat,ax-2,24);
|
|
|
|
; }
|
|
|
|
; else if (running) {
|
2021-01-05 20:32:11 +00:00
|
|
|
; if (battle_count%2) {
|
2021-01-15 02:42:26 +00:00
|
|
|
; 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);
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; grsim_put_sprite(susie_left,28,30);
|
|
|
|
;
|
|
|
|
; if ((enemy_count&0xf)<4) {
|
|
|
|
; grsim_put_sprite(roboknee1,enemy_x,16);
|
|
|
|
; }
|
|
|
|
; else {
|
|
|
|
; grsim_put_sprite(roboknee2,enemy_x,16);
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; draw_battle_bottom(enemy_type);
|
|
|
|
;
|
|
|
|
; page_flip();
|
|
|
|
;
|
|
|
|
; if (hp==0) {
|
|
|
|
; for(i=0;i<15;i++) usleep(100000);
|
|
|
|
; break;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; usleep(100000);
|
|
|
|
;
|
|
|
|
; ch=grsim_input();
|
|
|
|
; if (ch=='q') return 0;
|
|
|
|
;
|
|
|
|
; if (enemy_count==0) {
|
|
|
|
; ; attack and decrement HP
|
|
|
|
; enemy_attack(ax);
|
|
|
|
; ; update limit count
|
|
|
|
; if (limit<4) limit++;
|
|
|
|
;
|
|
|
|
; ; reset enemy time. FIXME: variable?
|
|
|
|
; enemy_count=50;
|
|
|
|
; }
|
|
|
|
; else {
|
|
|
|
; enemy_count--;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; if (battle_count>=64) {
|
|
|
|
;
|
|
|
|
; ; TODO: randomly fail at running? */
|
|
|
|
; if (running) {
|
|
|
|
; break;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; if (menu_state==MENU_NONE) menu_state=MENU_MAIN;
|
|
|
|
; menu_keypress(ch);
|
|
|
|
;
|
|
|
|
; } else {
|
|
|
|
; battle_count++;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; old=battle_bar;
|
|
|
|
; battle_bar=(battle_count/16);
|
|
|
|
; if (battle_bar!=old) draw_battle_bottom(enemy_type);
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; if (enemy_hp==0) {
|
|
|
|
; ; FIXME?
|
|
|
|
; victory_dance();
|
|
|
|
; break;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; ram[DRAW_PAGE]=PAGE0;
|
|
|
|
; clear_bottom();
|
|
|
|
; ram[DRAW_PAGE]=PAGE1;
|
|
|
|
; clear_bottom();
|
|
|
|
;
|
|
|
|
; running=0;
|
|
|
|
;
|
|
|
|
; return 0;
|
|
|
|
;}
|
2021-01-04 16:53:13 +00:00
|
|
|
|
2021-01-05 20:32:11 +00:00
|
|
|
|