Ignore:
Timestamp:
Dec 15, 2002, 4:41:32 AM (19 years ago)
Author:
Sam Hocevar
Message:
  • real Debian package files.
  • two new types of aliens. only one rules.
  • removed gfx_write in favor of gfx_putchar and gfx_putstr.
  • added bonuses at alien death. they do nothing yet.
  • seeker missiles. 'b' to test.
  • weapon resolution is now 16*char. needs to be generalized.
  • fixed the supernova bugs. center could collide with the tunnel, and the last frame was badly displayed.
  • lots of cleanups everywhere.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ttyvaders/trunk/src/common.h

    r18 r20  
    22#define STARS 50
    33#define WEAPONS 50
    4 #define ROCKS 10
    5 #define ALIENS 10
     4#define BONUS 30
     5#define ALIENS 30
    66#define EXPLOSIONS 20
    77
    88#ifdef USE_SLANG
    99#   include <slang.h>
    10 #   define GFX_COLOR(x) SLsmg_set_color(x)
    11 #   define GFX_GOTO(x,y) SLsmg_gotorc(y,x)
    12 #   define GFX_WRITE(x) SLsmg_write_char(x)
     10#   define gfx_color(x) SLsmg_set_color(x)
     11#   define gfx_goto(x,y) SLsmg_gotorc(y,x)
     12#   define gfx_putchar(x) SLsmg_write_char(x)
     13#   define gfx_putstr(x) SLsmg_write_string(x)
    1314#else
    1415#   include <curses.h>
    15 #   define GFX_COLOR(x) attrset(COLOR_PAIR(x))
    16 #   define GFX_GOTO(x,y) move(y,x)
    17 #   define GFX_WRITE(x) addch(x)
     16#   define gfx_color(x) attrset(COLOR_PAIR(x))
     17#   define gfx_goto(x,y) move(y,x)
     18#   define gfx_putchar(x) addch(x)
     19#   define gfx_putstr(x) addstr(x)
    1820#endif
    1921
    20 #define GFX_WRITETO(x,y,c) do{ GFX_GOTO(x,y); GFX_WRITE(c); }while(0)
     22#define gfx_putcharTO(x,y,c) do{ gfx_goto(x,y); gfx_putchar(c); }while(0)
    2123
    2224#define GET_RAND(p,q) ((p)+(int)((1.0*((q)-(p)))*rand()/(RAND_MAX+1.0)))
    23 
    24 typedef struct
    25 {
    26     int w, h;
    27 
    28 } game;
    2925
    3026typedef struct
     
    4642typedef struct
    4743{
     44    enum { EXPLOSION_NONE, EXPLOSION_SMALL, EXPLOSION_MEDIUM } type[EXPLOSIONS];
    4845    int x[EXPLOSIONS];
    4946    int y[EXPLOSIONS];
    5047    int vx[EXPLOSIONS];
    5148    int vy[EXPLOSIONS];
    52     int type[EXPLOSIONS];
    5349    int n[EXPLOSIONS];
    5450
     
    5753typedef struct
    5854{
     55    enum { WEAPON_NONE, WEAPON_LASER, WEAPON_SEEKER, WEAPON_NUKE } type[WEAPONS];
    5956    int x[WEAPONS];
    6057    int y[WEAPONS];
    61     int v[WEAPONS];
     58    int x2[WEAPONS];
     59    int y2[WEAPONS];
     60    int x3[WEAPONS];
     61    int y3[WEAPONS];
     62    int vx[WEAPONS];
     63    int vy[WEAPONS];
    6264    int n[WEAPONS];
    63     int type[WEAPONS];
    6465
    6566} weapons;
     67
     68typedef struct
     69{
     70    enum { BONUS_NONE, BONUS_LIFE, BONUS_GREEN } type[BONUS];
     71    int x[BONUS];
     72    int y[BONUS];
     73    int n[BONUS];
     74
     75} bonus;
    6676
    6777typedef struct
     
    7585typedef struct
    7686{
     87    enum { ALIEN_NONE, ALIEN_POOLP, ALIEN_BOOL, ALIEN_BRAH } type[ALIENS];
    7788    int x[ALIENS];
    7889    int y[ALIENS];
     
    8192
    8293} aliens;
     94
     95typedef struct
     96{
     97    int w, h;
     98
     99    starfield *sf;
     100    weapons *wp;
     101    explosions *ex;
     102    tunnel *t;
     103    player *p;
     104    aliens *al;
     105    bonus *bo;
     106
     107} game;
    83108
    84109#define BLACK 1
     
    100125void draw_aliens( game *g, aliens *al );
    101126void update_aliens( game *g, aliens *al );
    102 void add_alien( game *g, aliens *al, int x, int y );
     127void add_alien( game *g, aliens *al, int x, int y, int type );
    103128
    104129int init_graphics( void );
     
    117142void draw_weapons( game *g, weapons *wp );
    118143void update_weapons( game *g, weapons *wp );
    119 void add_weapon( game *g, weapons *wp, int x, int y, int type );
     144void add_weapon( game *g, weapons *wp, int x, int y, int vx, int vy, int type );
     145
     146void init_bonus( game *g, bonus *bo );
     147void draw_bonus( game *g, bonus *bo );
     148void update_bonus( game *g, bonus *bo );
     149void add_bonus( game *g, bonus *bo, int x, int y, int type );
    120150
    121151void init_starfield( game *g, starfield *s );
Note: See TracChangeset for help on using the changeset viewer.