Changeset 16 for ttyvaders/trunk/explosions.c
 Timestamp:
 Dec 13, 2002, 8:27:16 PM (18 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

ttyvaders/trunk/explosions.c
r12 r16 1 1 2 2 #include <stdlib.h> 3 #include <math.h>4 3 5 4 #include "common.h" … … 7 6 static void draw_small_explosion( int x, int y, int frame ); 8 7 static void draw_big_explosion( int x, int y, int frame ); 9 static void draw_huge_explosion( int x, int y, int frame );10 8 11 9 void init_explosions( game *g, explosions *ex ) … … 86 84 switch( ex>type[i] ) 87 85 { 88 case 2:89 draw_huge_explosion( ex>x[i], ex>y[i], ex>n[i] );90 break;91 86 case 1: 92 87 draw_big_explosion( ex>x[i], ex>y[i], ex>n[i] ); … … 309 304 } 310 305 311 static void draw_circle( int x, int y, float r );312 313 static void draw_huge_explosion( int x, int y, int frame )314 {315 float r = 1.5 * (30  frame);316 317 GFX_COLOR( BLUE );318 draw_circle( x, y, r );319 320 r += 0.7;321 322 GFX_COLOR( CYAN );323 draw_circle( x, y, r );324 325 r += 0.7;326 327 GFX_COLOR( WHITE );328 draw_circle( x, y, r );329 }330 331 static void draw_circle( int x, int y, float r )332 {333 #if 1334 float c;335 336 for( c = 0 ; c <= 90 ; c += 1 )337 {338 float dx = 0.5 + r * 2.0 * sin( c * M_PI / 180.0 );339 float dy = 0.5 + r * cos( c * M_PI / 180.0 );340 341 GFX_GOTO( x + dx, y + dy );342 GFX_WRITE( '#' );343 GFX_GOTO( x  dx, y + dy );344 GFX_WRITE( '#' );345 GFX_GOTO( x + dx, y  dy );346 GFX_WRITE( '#' );347 GFX_GOTO( x  dx, y  dy );348 GFX_WRITE( '#' );349 }350 #endif351 352 #if 0353 int dx,dy,a2,b2, S, T;354 float a = r*8, b = r*2;355 356 a2 = a*a;357 b2 = b*b;358 dx = 0;359 dy = b;360 S = a2*(12*b) + 2*b2;361 T = b2  2*a2*(2*b1);362 GFX_GOTO( x + dx, y + dy );363 GFX_WRITE( '#' );364 GFX_GOTO( x  dx, y + dy );365 GFX_WRITE( '#' );366 GFX_GOTO( x + dx, y  dy );367 GFX_WRITE( '#' );368 GFX_GOTO( x  dx, y  dy );369 GFX_WRITE( '#' );370 371 do372 {373 if (S<0)374 {375 S += 2*b2*(2*x+3);376 T += 4*b2*(x+1);377 dx++;378 }379 else if (T<0)380 {381 S += 2*b2*(2*x+3)  4*a2*(dy1);382 T += 4*b2*(x+1)  2*a2*(2*dy3);383 dx++;384 dy;385 }386 else387 {388 S = 4*a2*(dy1);389 T = 2*a2*(2*dy3);390 dy;391 }392 GFX_GOTO( x + dx, y + dy );393 GFX_WRITE( '#' );394 GFX_GOTO( x  dx, y + dy );395 GFX_WRITE( '#' );396 GFX_GOTO( x + dx, y  dy );397 GFX_WRITE( '#' );398 GFX_GOTO( x  dx, y  dy );399 GFX_WRITE( '#' );400 }401 while (dy>0);402 #endif403 404 }405
Note: See TracChangeset
for help on using the changeset viewer.