Changeset 42 for ttyvaders/trunk/src/weapons.c
 Timestamp:
 Dec 22, 2002, 11:17:41 PM (20 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

ttyvaders/trunk/src/weapons.c
r38 r42 4 4 * All Rights Reserved 5 5 * 6 * $Id: weapons.c,v 1. 7 2002/12/22 18:44:12sam Exp $6 * $Id: weapons.c,v 1.8 2002/12/22 22:17:41 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 30 30 static void draw_beam( int x, int y, int frame ); 31 31 static void draw_circle( int x, int y, int r, char c ); 32 static void draw_fragbomb( int x, int y, int frame ); 32 33 33 34 void init_weapons( game *g, weapons *wp ) … … 81 82 draw_bomb( wp>x[i] >> 4, wp>y[i] >> 4, wp>vx[i], wp>vy[i] ); 82 83 break; 84 case WEAPON_FRAGBOMB: 85 draw_fragbomb( wp>x[i] >> 4, wp>y[i] >> 4, wp>n[i] ); 86 break; 83 87 case WEAPON_BEAM: 84 88 draw_beam( wp>x[i] >> 4, wp>y[i] >> 4, wp>n[i] ); … … 87 91 draw_nuke( wp>x[i] >> 4, wp>y[i] >> 4, wp>n[i] ); 88 92 break; 93 case WEAPON_LIGHTNING: 89 94 case WEAPON_NONE: 90 95 break; … … 173 178 174 179 break; 180 case WEAPON_FRAGBOMB: 181 /* If n was set to 1, the fragbomb exploded */ 182 if( wp>n[i] == 1 ) 183 { 184 add_weapon( g, g>wp, wp>x[i] + 24, wp>y[i], 24, 0, WEAPON_SEEKER ); 185 add_weapon( g, g>wp, wp>x[i]  24, wp>y[i], 24, 0, WEAPON_SEEKER ); 186 add_weapon( g, g>wp, wp>x[i], wp>y[i] + 24, 0, 24, WEAPON_SEEKER ); 187 add_weapon( g, g>wp, wp>x[i], wp>y[i]  24, 0, 24, WEAPON_SEEKER ); 188 add_weapon( g, g>wp, wp>x[i] + 24, wp>y[i] + 8, 24, 8, WEAPON_SEEKER ); 189 add_weapon( g, g>wp, wp>x[i]  24, wp>y[i] + 8, 24, 8, WEAPON_SEEKER ); 190 add_weapon( g, g>wp, wp>x[i] + 24, wp>y[i]  8, 24, 8, WEAPON_SEEKER ); 191 add_weapon( g, g>wp, wp>x[i]  24, wp>y[i]  8, 24, 8, WEAPON_SEEKER ); 192 add_weapon( g, g>wp, wp>x[i] + 16, wp>y[i] + 16, 16, 16, WEAPON_SEEKER ); 193 add_weapon( g, g>wp, wp>x[i]  16, wp>y[i] + 16, 16, 16, WEAPON_SEEKER ); 194 add_weapon( g, g>wp, wp>x[i] + 16, wp>y[i]  16, 16, 16, WEAPON_SEEKER ); 195 add_weapon( g, g>wp, wp>x[i]  16, wp>y[i]  16, 16, 16, WEAPON_SEEKER ); 196 wp>type[i] = WEAPON_NONE; 197 } 198 199 wp>x[i] += wp>vx[i]; 200 wp>y[i] += wp>vy[i]; 201 wp>n[i]++; 202 if( wp>y[i] < 0 ) 203 { 204 wp>type[i] = WEAPON_NONE; 205 } 206 break; 175 207 case WEAPON_BEAM: 176 208 wp>x[i] = (g>p>x + 2) << 4; … … 189 221 } 190 222 break; 223 case WEAPON_LIGHTNING: 191 224 case WEAPON_NONE: 192 225 break; … … 208 241 wp>vy[i] = vy; 209 242 wp>type[i] = type; 243 wp>n[i] = 0; 210 244 switch( type ) 211 245 { 212 246 case WEAPON_LASER: 247 break; 248 case WEAPON_FRAGBOMB: 213 249 break; 214 250 case WEAPON_SEEKER: … … 410 446 } 411 447 } 448 } 449 } 450 451 static void draw_fragbomb( int x, int y, int frame ) 452 { 453 gfx_color( WHITE ); 454 455 gfx_color( frame & 1 ? CYAN : WHITE ); 456 gfx_goto( x2, y ); 457 gfx_putstr( "( )" ); 458 gfx_goto( x1, y+1 ); 459 gfx_putstr( "`'" ); 460 461 gfx_color( frame & 1 ? WHITE : CYAN ); 462 gfx_goto( x1, y1 ); 463 gfx_putstr( ",." ); 464 gfx_goto( x, y ); 465 gfx_putstr( "'," ); 466 467 switch( frame % 4 ) 468 { 469 case 0: 470 gfx_color( CYAN ); 471 gfx_goto( x, y + 2 ); 472 gfx_putchar( 'O' ); 473 gfx_goto( x + 2, y + 2 ); 474 gfx_putchar( 'o' ); 475 gfx_goto( x + 1, y + 3 ); 476 gfx_putchar( 'o' ); 477 gfx_color( GRAY ); 478 gfx_goto( x  1, y + 3 ); 479 gfx_putchar( '°' ); 480 gfx_goto( x + 2, y + 4 ); 481 gfx_putchar( '°' ); 482 gfx_goto( x, y + 4 ); 483 gfx_putchar( '.' ); 484 gfx_goto( x + 1, y + 5 ); 485 gfx_putchar( '.' ); 486 break; 487 case 1: 488 gfx_color( CYAN ); 489 //gfx_goto( x, y + 1 ); 490 //gfx_putchar( 'O' ); 491 gfx_goto( x + 1, y + 2 ); 492 gfx_putchar( 'O' ); 493 gfx_goto( x, y + 3 ); 494 gfx_putchar( 'o' ); 495 gfx_color( GRAY ); 496 gfx_goto( x + 2, y + 3 ); 497 gfx_putchar( '°' ); 498 gfx_goto( x + 1, y + 4 ); 499 gfx_putchar( '°' ); 500 gfx_goto( x  1, y + 4 ); 501 gfx_putchar( '.' ); 502 gfx_goto( x + 2, y + 5 ); 503 gfx_putchar( '.' ); 504 break; 505 case 2: 506 gfx_color( CYAN ); 507 //gfx_goto( x  1, y + 1 ); 508 //gfx_putchar( 'O' ); 509 gfx_goto( x + 2, y + 2 ); 510 gfx_putchar( 'O' ); 511 gfx_goto( x, y + 2 ); 512 gfx_putchar( 'o' ); 513 gfx_goto( x + 1, y + 3 ); 514 gfx_putchar( 'o' ); 515 gfx_color( GRAY ); 516 gfx_goto( x, y + 4 ); 517 gfx_putchar( '°' ); 518 gfx_goto( x + 2, y + 4 ); 519 gfx_putchar( '.' ); 520 gfx_goto( x + 1, y + 5 ); 521 gfx_putchar( '.' ); 522 break; 523 case 3: 524 gfx_color( CYAN ); 525 //gfx_goto( x + 2, y + 1 ); 526 //gfx_putchar( 'O' ); 527 gfx_goto( x + 1, y + 2 ); 528 gfx_putchar( 'O' ); 529 gfx_goto( x  1, y + 2 ); 530 gfx_putchar( 'o' ); 531 gfx_goto( x + 2, y + 3 ); 532 gfx_putchar( 'o' ); 533 gfx_color( GRAY ); 534 gfx_goto( x, y + 3 ); 535 gfx_putchar( '°' ); 536 gfx_goto( x + 1, y + 4 ); 537 gfx_putchar( '°' ); 538 gfx_goto( x, y + 5 ); 539 gfx_putchar( '.' ); 540 break; 412 541 } 413 542 }
Note: See TracChangeset
for help on using the changeset viewer.