From 39d8a965ee83ba38448804205695cf5a9e5f3930 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 27 Jun 2018 08:14:27 -0400 Subject: [PATCH 1/2] split: more hgr code --- split_screen/rainbow.s | 45 +++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/split_screen/rainbow.s b/split_screen/rainbow.s index 949bc17b..8cb4dd36 100644 --- a/split_screen/rainbow.s +++ b/split_screen/rainbow.s @@ -5,6 +5,8 @@ TEMPY = $FB HGR = $F3E2 + HPLOT0 = $F457 + HCOLOR = $F6EC HLINE = $F819 VLINE = $F828 COLOR = $F864 @@ -14,24 +16,43 @@ jsr TEXT jsr HOME -;30 HPLOT 0,Y TO X,Y:RETURN - jsr HGR lda #0 sta $C052 ; POKE - 16302,0 -;X=279 -;80 HCOLOR= 4:HPLOT 0,0 + + ldx #4 + jsr HCOLOR ; HCOLOR= 4 + ldx #0 + ldy #0 + lda #0 + jsr HPLOT0 ; HPLOT 0,0 + jsr $F3F6 ; CALL 62454 ; BGND, fill screen with color -;90 HCOLOR= 2:Y=63:GOSUB 30:Y=62:GOSUB 30 -;100 HCOLOR= 6:Y=61:GOSUB 30:Y=60:GOSUB 30 -;110 HCOLOR= 1:Y=59:GOSUB 30:Y=58:GOSUB 30 -;120 HCOLOR= 5:Y=55:GOSUB 30:Y=54:GOSUB 30 -;C=100 -;130 HCOLOR= 0:X=C -;140 Y=123:GOSUB 30:Y=122:GOSUB 30 -;150 Y=119:GOSUB 30:Y=118:GOSUB 30 + ldx #2 + jsr HCOLOR ; HCOLOR= 2 +;HPLOT 0,63 TO 279,63:RETURN +;HPLOT 0,62 TO 279,62:RETURN + ldx #6 + jsr HCOLOR ; HCOLOR= 6 +;HPLOT 0,61 TO 279,61:RETURN +;HPLOT 0,60 TO 279,60:RETURN + ldx #1 + jsr HCOLOR ; HCOLOR= 1 +;HPLOT 0,59 TO 279,59:RETURN +;HPLOT 0,58 TO 279,58:RETURN + ldx #5 + jsr HCOLOR ; HCOLOR= 5 +;HPLOT 0,55 TO 279,55:RETURN +;HPLOT 0,54 TO 279,54:RETURN + ldx #0 + jsr HCOLOR ; HCOLOR= 0 +;HPLOT 0,123 TO 100,123:RETURN +;HPLOT 0,122 TO 100,122:RETURN +;HPLOT 0,119 TO 100,119:RETURN +;HPLOT 0,118 TO 100,118:RETURN + lda #0 jsr COLOR ; COLOR= 0 From e9150857c20dcec9c180fa38559caef9affbdca0 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 28 Jun 2018 00:19:06 -0400 Subject: [PATCH 2/2] tfv: can actually win battles now --- gr-sim/tfv/tfv_battle.c | 181 +++++++++++++++++++++++++++++++++------- 1 file changed, 152 insertions(+), 29 deletions(-) diff --git a/gr-sim/tfv/tfv_battle.c b/gr-sim/tfv/tfv_battle.c index 945c1c39..dce1e7de 100644 --- a/gr-sim/tfv/tfv_battle.c +++ b/gr-sim/tfv/tfv_battle.c @@ -16,13 +16,34 @@ /* Metrocat Easter Egg (summon?) */ -/* Enemies: */ -/* Killer Crab, Evil Tree, Deadly Bees, Big Fish, Procrastinon */ +/* Environment: grass, beach, forest, ice */ + +/* Enemies: HP ATTACK WEAKNESS RESIST */ +/* Killer Crab RND-32 PINCH MALAISE FIRE + Plain Fish BUBBLE FIRE ICE + + Evil Tree RND-16 LEAVE FIRE ICE + Wood Elf SING MALAISE FIRE + + 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 + MAGIC -> HEAL FIRE + ICE MALAISE + LIMIT -> SLICE ZAP + DROP 1 2 3 0123456789012345678901234567890123456789| @@ -50,21 +71,125 @@ List hits /* 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 +struct enemy_type { + char *name; + int hp_base,hp_mask; + char *attack_name; + int weakness,resist; + unsigned char *sprite; +}; + +static struct enemy_type enemies[8]={ + [0]= { + .name="Killer Crab", + .hp_base=10, + .hp_mask=0x1f, + .attack_name="Pinch", + .weakness=MAGIC_MALAISE, + .resist=MAGIC_FIRE, + .sprite=killer_crab, + }, +}; + + +static int attack(int enemy_x,int enemy_type) { + + int ax=34; + + while(ax>10) { + + gr_copy_to_current(0xc00); + + if (ax&1) { + grsim_put_sprite(tfv_stand_left,ax,20); + } + else { + grsim_put_sprite(tfv_walk_left,ax,20); + } + grsim_put_sprite(tfv_led_sword,ax-5,20); + + grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20); + + page_flip(); + + ax-=1; + + usleep(20000); + } + + return 10; +} + + + +static int victory_dance(void) { + + int ax=34; + int i; + int saved_drawpage; + + saved_drawpage=ram[DRAW_PAGE]; + + ram[DRAW_PAGE]=PAGE2; // 0xc00 + + clear_bottom(); + + vtab(21); + htab(10); + move_cursor(); + print("EXPERIENCE +2"); + experience+=2; + + vtab(22); + htab(10); + move_cursor(); + print("MONEY +1"); + money+=1; + + ram[DRAW_PAGE]=saved_drawpage; + + for(i=0;i<50;i++) { + + gr_copy_to_current(0xc00); + + if (i&1) { + grsim_put_sprite(tfv_stand_left,ax,20); + } + else { + grsim_put_sprite(tfv_walk_left,ax,20); + } + + page_flip(); + + usleep(100000); + } + + return 0; +} int do_battle(void) { int i,ch; int enemy_x=2; + int enemy_type=0; int saved_drawpage; - //int enemy_hp=20; + int enemy_hp=0; - int tfv_x=34; + int ax=34; -// home(); -// gr(); + /* Setup Enemy */ + // enemy_type=X + // ranom, with weight toward proper terrain + /* Setup Enemy HP */ + enemy_hp=enemies[enemy_type].hp_base+ + (rand()&enemies[enemy_type].hp_mask); saved_drawpage=ram[DRAW_PAGE]; @@ -75,7 +200,7 @@ int do_battle(void) { vtab(22); htab(1); move_cursor(); - print("KILLER CRAB"); + print(enemies[enemy_type].name); vtab(21); htab(27); @@ -99,38 +224,29 @@ int do_battle(void) { print("/"); print_byte(max_hp); + /* Draw Limit break bargraph */ ram[COLOR]=0x20; hlin_double(ram[DRAW_PAGE],33,33+limit,42); - -// basic_htab(34); -// basic_vtab(22); -// basic_inverse(); -// for(i=0;i