Changeset 186 for ttyvaders/trunk/src/weapons.c
 Timestamp:
 Nov 16, 2003, 1:33:35 AM (17 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

ttyvaders/trunk/src/weapons.c
r174 r186 32 32 static void draw_fragbomb(int x, int y, int frame); 33 33 34 struct ee_sprite *bomb_sprite;35 struct ee_sprite *fragbomb_sprite;34 struct caca_sprite *bomb_sprite; 35 struct caca_sprite *fragbomb_sprite; 36 36 37 37 void init_weapons(game *g, weapons *wp) … … 44 44 } 45 45 46 bomb_sprite = ee_load_sprite("data/wpnbomb.txt");47 fragbomb_sprite = ee_load_sprite("data/wpnfrag.txt");46 bomb_sprite = caca_load_sprite("data/wpnbomb.txt"); 47 fragbomb_sprite = caca_load_sprite("data/wpnfrag.txt"); 48 48 } 49 49 … … 57 57 { 58 58 case WEAPON_LASER: 59 ee_set_color(EE_WHITE);60 ee_putchar(wp>x[i] >> 4, wp>y[i] >> 4, '');61 ee_set_color(EE_CYAN);62 ee_putchar(wp>x[i] >> 4, (wp>y[i] >> 4) + 1, '');59 caca_set_color(EE_WHITE); 60 caca_putchar(wp>x[i] >> 4, wp>y[i] >> 4, ''); 61 caca_set_color(EE_CYAN); 62 caca_putchar(wp>x[i] >> 4, (wp>y[i] >> 4) + 1, ''); 63 63 break; 64 64 case WEAPON_SEEKER: 65 ee_set_color(EE_CYAN);66 ee_putchar(wp>x3[i] >> 4, wp>y3[i] >> 4, '.');67 ee_putchar(wp>x2[i] >> 4, wp>y2[i] >> 4, 'o');68 ee_set_color(EE_WHITE);69 ee_putchar(wp>x[i] >> 4, wp>y[i] >> 4, '@');65 caca_set_color(EE_CYAN); 66 caca_putchar(wp>x3[i] >> 4, wp>y3[i] >> 4, '.'); 67 caca_putchar(wp>x2[i] >> 4, wp>y2[i] >> 4, 'o'); 68 caca_set_color(EE_WHITE); 69 caca_putchar(wp>x[i] >> 4, wp>y[i] >> 4, '@'); 70 70 break; 71 71 case WEAPON_BOMB: 72 ee_set_color(EE_DARKGRAY);73 ee_putchar((wp>x[i]  wp>vx[i]) >> 4, (wp>y[i]  wp>vy[i]) >> 4, '.');74 ee_putchar((wp>x3[i]  wp>vx[i]) >> 4, (wp>y3[i]  wp>vy[i]) >> 4, '.');75 ee_putchar((wp>x2[i]  wp>vx[i]) >> 4, (wp>y2[i]  wp>vy[i]) >> 4, '.');76 ee_putchar(wp>x3[i] >> 4, wp>y3[i] >> 4, '.');77 ee_putchar(wp>x2[i] >> 4, wp>y2[i] >> 4, '.');72 caca_set_color(EE_DARKGRAY); 73 caca_putchar((wp>x[i]  wp>vx[i]) >> 4, (wp>y[i]  wp>vy[i]) >> 4, '.'); 74 caca_putchar((wp>x3[i]  wp>vx[i]) >> 4, (wp>y3[i]  wp>vy[i]) >> 4, '.'); 75 caca_putchar((wp>x2[i]  wp>vx[i]) >> 4, (wp>y2[i]  wp>vy[i]) >> 4, '.'); 76 caca_putchar(wp>x3[i] >> 4, wp>y3[i] >> 4, '.'); 77 caca_putchar(wp>x2[i] >> 4, wp>y2[i] >> 4, '.'); 78 78 draw_bomb(wp>x[i] >> 4, wp>y[i] >> 4, wp>vx[i], wp>vy[i]); 79 79 break; … … 170 170 if(dx  dy) 171 171 { 172 unsigned int norm = ee_sqrt(dx * dx + 4 * dy * dy);172 unsigned int norm = caca_sqrt(dx * dx + 4 * dy * dy); 173 173 dx = dx * 32 / norm; 174 174 dy = dy * 32 / norm; … … 182 182 if(dx  dy) 183 183 { 184 unsigned int norm = ee_sqrt(dx * dx + 4 * dy * dy);184 unsigned int norm = caca_sqrt(dx * dx + 4 * dy * dy); 185 185 wp>vx[i] = dx * 32 / norm; 186 186 wp>vy[i] = dy * 32 / norm; … … 334 334 } 335 335 336 ee_draw_sprite(x, y, bomb_sprite, frame);336 caca_draw_sprite(x, y, bomb_sprite, frame); 337 337 } 338 338 … … 340 340 { 341 341 /* Draw the head */ 342 ee_draw_sprite(x, y, fragbomb_sprite, frame & 1);342 caca_draw_sprite(x, y, fragbomb_sprite, frame & 1); 343 343 344 344 /* Draw the tail */ 345 ee_draw_sprite(x, y, fragbomb_sprite, 2 + (frame % 4));345 caca_draw_sprite(x, y, fragbomb_sprite, 2 + (frame % 4)); 346 346 } 347 347 … … 354 354 { 355 355 case 24: 356 ee_set_color(EE_WHITE);357 ee_putstr(x, y3, "__");358 ee_putchar(x1, y2, '\'');359 ee_putchar(x+2, y2, '`');356 caca_set_color(EE_WHITE); 357 caca_putstr(x, y3, "__"); 358 caca_putchar(x1, y2, '\''); 359 caca_putchar(x+2, y2, '`'); 360 360 break; 361 361 case 23: 362 ee_set_color(EE_CYAN);363 ee_putstr(x, y3, "__");364 ee_set_color(EE_WHITE);365 ee_putstr(x2, y2, "'");366 ee_putstr(x+2, y2, "`");362 caca_set_color(EE_CYAN); 363 caca_putstr(x, y3, "__"); 364 caca_set_color(EE_WHITE); 365 caca_putstr(x2, y2, "'"); 366 caca_putstr(x+2, y2, "`"); 367 367 break; 368 368 case 22: 369 ee_set_color(EE_CYAN);370 ee_putstr(x, y3, "__");371 ee_putchar(x1, y2, '\'');372 ee_putchar(x+2, y2, '`');373 ee_set_color(EE_WHITE);374 ee_putstr(x3, y2, ",");375 ee_putstr(x+3, y2, ".");369 caca_set_color(EE_CYAN); 370 caca_putstr(x, y3, "__"); 371 caca_putchar(x1, y2, '\''); 372 caca_putchar(x+2, y2, '`'); 373 caca_set_color(EE_WHITE); 374 caca_putstr(x3, y2, ","); 375 caca_putstr(x+3, y2, "."); 376 376 break; 377 377 case 21: 378 ee_set_color(EE_CYAN);379 ee_putstr(x1, y3, "____");380 ee_putchar(x2, y2, '\'');381 ee_putchar(x+3, y2, '`');382 ee_set_color(EE_WHITE);383 ee_putstr(x4, y2, ",");384 ee_putstr(x+4, y2, ".");378 caca_set_color(EE_CYAN); 379 caca_putstr(x1, y3, "____"); 380 caca_putchar(x2, y2, '\''); 381 caca_putchar(x+3, y2, '`'); 382 caca_set_color(EE_WHITE); 383 caca_putstr(x4, y2, ","); 384 caca_putstr(x+4, y2, "."); 385 385 break; 386 386 case 20: 387 ee_set_color(EE_WHITE);388 ee_putstr(x, y3, "%%");389 ee_putchar(x4, y2, ',');390 ee_putchar(x+5, y2, '.');391 ee_set_color(EE_CYAN);392 ee_putchar(x1, y3, ':');393 ee_putchar(x+2, y3, ':');394 ee_putstr(x3, y2, "'");395 ee_putstr(x+3, y2, "`");387 caca_set_color(EE_WHITE); 388 caca_putstr(x, y3, "%%"); 389 caca_putchar(x4, y2, ','); 390 caca_putchar(x+5, y2, '.'); 391 caca_set_color(EE_CYAN); 392 caca_putchar(x1, y3, ':'); 393 caca_putchar(x+2, y3, ':'); 394 caca_putstr(x3, y2, "'"); 395 caca_putstr(x+3, y2, "`"); 396 396 break; 397 397 case 19: 398 ee_set_color(EE_WHITE);399 ee_putstr(x, y4, "%%");400 ee_putstr(x, y3, "##");401 ee_set_color(EE_CYAN);402 ee_putchar(x1, y4, ':');403 ee_putchar(x+2, y4, ':');404 ee_putchar(x1, y3, '%');405 ee_putchar(x+2, y3, '%');406 ee_putstr(x4, y2, ",'");407 ee_putstr(x+3, y2, "`.");408 ee_set_color(EE_BLUE);409 ee_putchar(x2, y3, ':');410 ee_putchar(x+3, y3, ':');398 caca_set_color(EE_WHITE); 399 caca_putstr(x, y4, "%%"); 400 caca_putstr(x, y3, "##"); 401 caca_set_color(EE_CYAN); 402 caca_putchar(x1, y4, ':'); 403 caca_putchar(x+2, y4, ':'); 404 caca_putchar(x1, y3, '%'); 405 caca_putchar(x+2, y3, '%'); 406 caca_putstr(x4, y2, ",'"); 407 caca_putstr(x+3, y2, "`."); 408 caca_set_color(EE_BLUE); 409 caca_putchar(x2, y3, ':'); 410 caca_putchar(x+3, y3, ':'); 411 411 break; 412 412 case 18: 413 413 default: 414 414 r = (18  frame) * (18  frame); 415 ee_set_color(EE_WHITE);416 ee_putstr(x1, y5r, ":%%:");417 ee_putstr(x1, y4r, "%##%");418 ee_set_color(EE_CYAN);419 ee_putchar(x2, y4r, ':');420 ee_putchar(x+3, y4r, ':');421 ee_putchar(x2, y2, '\'');422 ee_putchar(x+3, y2, '`');423 ee_set_color(EE_BLUE);424 ee_putchar(x3, y2, ':');425 ee_putchar(x+4, y2, ':');415 caca_set_color(EE_WHITE); 416 caca_putstr(x1, y5r, ":%%:"); 417 caca_putstr(x1, y4r, "%##%"); 418 caca_set_color(EE_CYAN); 419 caca_putchar(x2, y4r, ':'); 420 caca_putchar(x+3, y4r, ':'); 421 caca_putchar(x2, y2, '\''); 422 caca_putchar(x+3, y2, '`'); 423 caca_set_color(EE_BLUE); 424 caca_putchar(x3, y2, ':'); 425 caca_putchar(x+4, y2, ':'); 426 426 for(i = 0; i <= r; i++) 427 427 { 428 ee_set_color(EE_WHITE);429 ee_putstr(x1, y3i, ((i+frame) % 5) ? "####" : "%%%%");430 ee_set_color(EE_CYAN);431 ee_putchar(x2, y3i, '%');432 ee_putchar(x+3, y3i, '%');433 ee_set_color(EE_BLUE);434 ee_putchar(x3, y3i, ':');435 ee_putchar(x+4, y3i, ':');428 caca_set_color(EE_WHITE); 429 caca_putstr(x1, y3i, ((i+frame) % 5) ? "####" : "%%%%"); 430 caca_set_color(EE_CYAN); 431 caca_putchar(x2, y3i, '%'); 432 caca_putchar(x+3, y3i, '%'); 433 caca_set_color(EE_BLUE); 434 caca_putchar(x3, y3i, ':'); 435 caca_putchar(x+4, y3i, ':'); 436 436 } 437 437 break; … … 444 444 445 445 /* Lots of duplicate pixels, but we don't care */ 446 ee_set_color(EE_BLUE);447 ee_draw_ellipse(x, y, r, r / 2, ':');448 ee_draw_ellipse(x, y, r + 1, r / 2, ':');449 ee_draw_ellipse(x, y, r + 2, r / 2, ':');450 ee_set_color(EE_CYAN);451 ee_draw_ellipse(x, y, r + 2, r / 2 + 1, '%');452 ee_draw_ellipse(x, y, r + 3, r / 2 + 1, '%');453 ee_set_color(EE_WHITE);454 ee_draw_ellipse(x, y, r + 3, r / 2 + 2, '#');455 ee_draw_ellipse(x, y, r + 4, r / 2 + 2, '#');456 ee_draw_ellipse(x, y, r + 4, r / 2 + 3, '#');457 } 458 446 caca_set_color(EE_BLUE); 447 caca_draw_ellipse(x, y, r, r / 2, ':'); 448 caca_draw_ellipse(x, y, r + 1, r / 2, ':'); 449 caca_draw_ellipse(x, y, r + 2, r / 2, ':'); 450 caca_set_color(EE_CYAN); 451 caca_draw_ellipse(x, y, r + 2, r / 2 + 1, '%'); 452 caca_draw_ellipse(x, y, r + 3, r / 2 + 1, '%'); 453 caca_set_color(EE_WHITE); 454 caca_draw_ellipse(x, y, r + 3, r / 2 + 2, '#'); 455 caca_draw_ellipse(x, y, r + 4, r / 2 + 2, '#'); 456 caca_draw_ellipse(x, y, r + 4, r / 2 + 3, '#'); 457 } 458
Note: See TracChangeset
for help on using the changeset viewer.