diff --git a/gr-sim/tfv/tfv.c b/gr-sim/tfv/tfv.c index 45927466..5c06f87a 100644 --- a/gr-sim/tfv/tfv.c +++ b/gr-sim/tfv/tfv.c @@ -14,7 +14,7 @@ unsigned char level=0; unsigned char hp=100,max_hp=100; unsigned char mp=50,max_mp=50; -unsigned char limit=2; +unsigned char limit=1; unsigned char money=0,experience=0; unsigned char time_hours=0,time_minutes=0; unsigned char items1=0xff,items2=0xff; diff --git a/gr-sim/tfv/tfv_battle.c b/gr-sim/tfv/tfv_battle.c index f5123080..d2ddaccc 100644 --- a/gr-sim/tfv/tfv_battle.c +++ b/gr-sim/tfv/tfv_battle.c @@ -93,7 +93,7 @@ struct enemy_type { static struct enemy_type enemies[8]={ [0]= { .name="Killer Crab", - .hp_base=10, + .hp_base=50, .hp_mask=0x1f, .attack_name="Pinch", .weakness=MAGIC_MALAISE, @@ -443,6 +443,16 @@ static int damage_enemy(int value) { } +static int heal_self(int value) { + + hp+=value; + if (hp>max_hp) hp=max_hp; + + return 0; + +} + + static int damage_tfv(int value) { if (hp>value) hp-=value; @@ -636,8 +646,111 @@ static int rotate_intro(void) { return 0; } +#define MENU_MAGIC_HEAL 0 +#define MENU_MAGIC_ICE 1 +#define MENU_MAGIC_FIRE 2 +#define MENU_MAGIC_MALAISE 3 +#define MENU_MAGIC_BOLT 4 + + static void magic_attack(int which) { + int ax=34,ay=20; + int mx,my; + int damage=20; + int i; + + unsigned char *sprite; + + if (which==MENU_MAGIC_HEAL) { + sprite=magic_health; + mx=34; + my=20; + } + if (which==MENU_MAGIC_FIRE) { + sprite=magic_fire; + mx=2; + my=20; + } + if (which==MENU_MAGIC_ICE) { + sprite=magic_ice; + mx=2; + my=20; + } + + + // FIXME: damage based on weakness of enemy + // FIXME: disallow if not enough MP + + /* cast the magic */ + i=0; + while(i<10) { + + gr_copy_to_current(0xc00); + + grsim_put_sprite(tfv_victory,34,20); + + grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20); + + draw_battle_bottom(enemy_type); + + page_flip(); + + i++; + + usleep(20000); + } + + ax=34; + ay=20; + i=0; + + /* Actually put the magic */ + + while(i<=20) { + + gr_copy_to_current(0xc00); + + grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20); + + grsim_put_sprite(tfv_stand_left,ax,ay); + grsim_put_sprite(tfv_led_sword,ax-5,ay); + + grsim_put_sprite(sprite,mx+(i&1),my); + + draw_battle_bottom(enemy_type); + + page_flip(); + + i++; + + usleep(100000); + } + + mp-=5; + + gr_copy_to_current(0xc00); + + grsim_put_sprite(enemies[enemy_type].sprite,enemy_x,20); + + grsim_put_sprite(tfv_stand_left,ax,ay); + grsim_put_sprite(tfv_led_sword,ax-5,ay); + + draw_battle_bottom(enemy_type); + + if (which!=MENU_MAGIC_HEAL) { + damage_enemy(damage); + gr_put_num(2,10,damage); + } + else { + heal_self(damage); + } + draw_battle_bottom(enemy_type); + page_flip(); + + for(i=0;i<20;i++) { + usleep(100000); + } } static void limit_break(int which) { diff --git a/gr-sim/tfv/tfv_sprites.c b/gr-sim/tfv/tfv_sprites.c index fc6f84cc..263ba2d3 100644 --- a/gr-sim/tfv/tfv_sprites.c +++ b/gr-sim/tfv/tfv_sprites.c @@ -418,3 +418,40 @@ unsigned char big_tree[]={ 0xc0,0xCC,0xCC,0xCC,0xc0, 0x00,0x00,0x88,0x00,0x00, }; + +unsigned char magic_health[]={ + 0x5,0x6, + 0x00,0x00,0x0E,0x00,0x0C, + 0x00,0x0e,0x00,0x0c,0x00, + 0x0e,0x00,0x0c,0x00,0x0e, + 0x00,0x0c,0x00,0x0e,0x00, + 0x0c,0x00,0x0e,0x00,0x0c, + 0x00,0x0e,0x00,0x0c,0x00, +}; + +unsigned char magic_fire[]={ + 0x5,0x6, + 0x00,0x00,0xf0,0x00,0x00, + 0xf0,0x00,0xff,0x00,0xf0, + 0x0f,0xf0,0xff,0xf0,0x0f, + 0x00,0xff,0xfe,0xff,0x00, + 0xff,0x00,0xff,0x00,0xff, + 0x00,0x00,0xff,0x00,0x00, +}; + +unsigned char magic_ice[]={ + 0x5,0x6, + 0x00,0x0d,0xd0,0x00,0x00, + 0x00,0xdd,0xdd,0xdd,0xd0, + 0xd0,0xdd,0x9d,0xdd,0xdd, + 0xdd,0xdd,0x99,0x99,0xdd, + 0x00,0x99,0x99,0x99,0xdd, + 0x00,0x0d,0x99,0x99,0x0d, +}; + +//unsigned char magic_bolt[]={ +//}; + +//unsigned char magic_malaise[]={ +//}; + diff --git a/gr-sim/tfv/tfv_sprites.h b/gr-sim/tfv/tfv_sprites.h index fb081a23..12603849 100644 --- a/gr-sim/tfv/tfv_sprites.h +++ b/gr-sim/tfv/tfv_sprites.h @@ -39,3 +39,9 @@ extern unsigned char numbers[10][11]; extern unsigned char small_tree[]; extern unsigned char medium_tree[]; extern unsigned char big_tree[]; + +extern unsigned char magic_health[]; +extern unsigned char magic_fire[]; +extern unsigned char magic_ice[]; +extern unsigned char magic_bolt[]; +extern unsigned char magic_malaise[]; diff --git a/gr-sim/tfv/tfv_worldmap.c b/gr-sim/tfv/tfv_worldmap.c index b1a03d85..89b68b87 100644 --- a/gr-sim/tfv/tfv_worldmap.c +++ b/gr-sim/tfv/tfv_worldmap.c @@ -135,7 +135,7 @@ int world_map(void) { int ch; int direction=1; - int i,limit; + int i,tree_limit; int newx=0,newy=0,moved; int special_destination=NOEXIT,destination_type=LOCATION_PLACE; @@ -400,9 +400,9 @@ done_entry: /* Draw Background Trees */ if (map_info[map_location].land_type&LAND_FOREST) { for(i=10;i