From 8e5708fc293aebbd1092845243f8c69d2402e1f4 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 30 Jun 2018 13:44:51 -0400 Subject: [PATCH] battle: add spin intro --- gr-sim/tfv/tfv_battle.c | 55 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/gr-sim/tfv/tfv_battle.c b/gr-sim/tfv/tfv_battle.c index 441a745f..d0e51cc4 100644 --- a/gr-sim/tfv/tfv_battle.c +++ b/gr-sim/tfv/tfv_battle.c @@ -3,6 +3,8 @@ #include #include +#include + #include "gr-sim.h" #include "tfv_utils.h" #include "tfv_zp.h" @@ -325,6 +327,55 @@ static int draw_battle_bottom(int enemy_type) { } +static int rotate_intro(void) { + + int xx,yy,color,x2,y2; + double h,theta,dx,dy,theta2,thetadiff,nx,ny; + int i; + + gr_copy(0x400,0xc00); + +// gr_copy_to_current(0xc00); +// page_flip(); +// gr_copy_to_current(0xc00); +// page_flip(); + + thetadiff=0; + + for(i=0;i<8;i++) { + + grsim_update(); + + for(yy=0;yy<40;yy++) { + for(xx=0;xx<40;xx++) { + dx=(xx-20); + dy=(yy-20); + h=sqrt((dx*dx)+(dy*dy)); + theta=atan2(dy,dx); + + theta2=theta+thetadiff; + nx=h*cos(theta2); + ny=h*sin(theta2); + + x2=nx+20; + y2=ny+20; + if ((x2<0) || (x2>39)) color=0; + else if ((y2<0) || (y2>39)) color=0; + else color=scrn_page(x2,y2,PAGE2); + + color_equals(color); + plot(xx,yy); + } + } + thetadiff-=(6.28/16.0); + page_flip(); + + usleep(100000); + } + + return 0; +} + int do_battle(void) { @@ -343,6 +394,8 @@ int do_battle(void) { // enemy_type=X // random, with weight toward proper terrain + rotate_intro(); + /* Setup Enemy HP */ enemy_hp=enemies[enemy_type].hp_base+ (rand()&enemies[enemy_type].hp_mask); @@ -419,5 +472,3 @@ int do_battle(void) { return 0; } - -