tfv: hookup magic

This commit is contained in:
Vince Weaver 2018-07-03 00:37:15 -04:00
parent a8619d1993
commit 74f6226fe7
6 changed files with 163 additions and 7 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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[]={
//};

View File

@ -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[];

View File

@ -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<tfv_y+8;i+=2) {
limit=22+(i/4);
tree_limit=22+(i/4);
color_equals(COLOR_DARKGREEN);
hlin_double(ram[DRAW_PAGE],0,limit,i);
hlin_double(ram[DRAW_PAGE],0,tree_limit,i);
}
}
@ -482,9 +482,9 @@ done_entry:
/* Draw Below Forest */
for(i=tfv_y+8;i<36;i+=2) {
limit=22+(i/4);
tree_limit=22+(i/4);
color_equals(COLOR_DARKGREEN);
hlin_double(ram[DRAW_PAGE],0,limit,i);
hlin_double(ram[DRAW_PAGE],0,tree_limit,i);
}
int f;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB