- Timestamp:
- Dec 23, 2002, 4:06:13 PM (20 years ago)
- Location:
- ttyvaders/trunk/src
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
ttyvaders/trunk/src/Makefile.am
r52 r62 23 23 bonus.c \ 24 24 ceo.c \ 25 collide.c \ 25 26 common.h \ 26 27 explosions.c \ 28 graphics.c \ 27 29 main.c \ 28 30 math.c \ 31 overlay.c \ 32 player.c \ 29 33 starfield.c \ 34 tunnel.c \ 30 35 weapons.c \ 31 collide.c \32 graphics.c \33 player.c \34 tunnel.c \35 36 $(NULL) 36 37 -
ttyvaders/trunk/src/common.h
r60 r62 4 4 * All Rights Reserved 5 5 * 6 * $Id: common.h,v 1.1 3 2002/12/23 13:46:27sam Exp $6 * $Id: common.h,v 1.14 2002/12/23 15:06:13 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 21 21 */ 22 22 23 #define MAX_LIFE 1000 24 23 /* 24 * Compile-time limits 25 */ 25 26 #define STARS 50 26 27 #define WEAPONS 200 … … 29 30 #define EXPLOSIONS 200 30 31 32 /* 33 * Game defines 34 */ 35 #define MAX_LIFE 1000 36 #define MAX_SPECIAL 200 37 38 #define COST_NUKE (100*MAX_SPECIAL/100) 39 #define COST_BEAM (75*MAX_SPECIAL/100) 40 #define COST_FRAGBOMB (50*MAX_SPECIAL/100) 41 42 /* 43 * Graphics primitives 44 */ 31 45 #ifdef USE_SLANG 32 46 # include <slang.h> … … 50 64 #define gfx_putcharTO(x,y,c) do{ gfx_goto(x,y); gfx_putchar(c); }while(0) 51 65 66 /* 67 * Useful macros 68 */ 52 69 #define GET_RAND(p,q) ((p)+(int)((1.0*((q)-(p)))*rand()/(RAND_MAX+1.0))) 53 70 #define GET_MAX(a,b) ((a)>(b)?(a):(b)) 54 71 #define GET_MIN(a,b) ((a)<(b)?(a):(b)) 55 72 73 /* 74 * Game structures 75 */ 56 76 typedef struct 57 77 { … … 106 126 int x, y; 107 127 int vx, vy; 108 int weapon, nuke;128 int weapon, special; 109 129 int life, dead; 110 130 … … 146 166 #define MAGENTA 10 147 167 148 void collide_weapons_tunnel( game *g, weapons *wp, tunnel *t, explosions *ex ); 149 void collide_weapons_aliens( game *g, weapons *wp, aliens *al, explosions *ex ); 150 void collide_player_tunnel( game *g, player *p, tunnel *t, explosions *ex ); 151 168 /* 169 * From aliens.c 170 */ 152 171 void init_aliens( game *g, aliens *al ); 153 172 void draw_aliens( game *g, aliens *al ); … … 155 174 void add_alien( game *g, aliens *al, int x, int y, int type ); 156 175 176 /* 177 * From bonus.c 178 */ 179 void init_bonus( game *g, bonus *bo ); 180 void draw_bonus( game *g, bonus *bo ); 181 void update_bonus( game *g, bonus *bo ); 182 void add_bonus( game *g, bonus *bo, int x, int y, int type ); 183 184 /* 185 * From ceo.c 186 */ 187 void ceo_alert( void ); 188 189 /* 190 * From collide.c 191 */ 192 void collide_weapons_tunnel( game *g, weapons *wp, tunnel *t, explosions *ex ); 193 void collide_weapons_aliens( game *g, weapons *wp, aliens *al, explosions *ex ); 194 void collide_player_tunnel( game *g, player *p, tunnel *t, explosions *ex ); 195 196 /* 197 * From explosions.c 198 */ 199 void init_explosions( game *g, explosions *ex ); 200 void add_explosion( game *g, explosions *ex, int x, int y, int vx, int vy, int type ); 201 void draw_explosions( game *g, explosions *ex ); 202 void update_explosions( game *g, explosions *ex ); 203 204 /* 205 * From graphics.c 206 */ 157 207 int init_graphics( void ); 158 208 void init_game( game *g ); … … 162 212 void end_graphics( void ); 163 213 214 /* 215 * From math.c 216 */ 217 int r00t( int a ); 218 219 /* 220 * From overlay.c 221 */ 222 void draw_overlay( game *g ); 223 224 /* 225 * From player.c 226 */ 164 227 player * create_player( game *g ); 165 228 void free_player( player *p ); … … 167 230 void update_player( game *g, player *p ); 168 231 232 /* 233 * From starfield.c 234 */ 235 starfield * create_starfield( game *g ); 236 void draw_starfield( game *g, starfield *s ); 237 void update_starfield( game *g, starfield *s ); 238 void free_starfield( game *g, starfield *s ); 239 240 /* 241 * From tunnel.c 242 */ 243 tunnel * create_tunnel( game *g, int w, int h ); 244 void free_tunnel( tunnel *t ); 245 void draw_tunnel( game *g, tunnel *t ); 246 void update_tunnel( game *g, tunnel *t ); 247 248 /* 249 * From weapons.c 250 */ 169 251 void init_weapons( game *g, weapons *wp ); 170 252 void draw_weapons( game *g, weapons *wp ); … … 172 254 void add_weapon( game *g, weapons *wp, int x, int y, int vx, int vy, int type ); 173 255 174 void init_bonus( game *g, bonus *bo );175 void draw_bonus( game *g, bonus *bo );176 void update_bonus( game *g, bonus *bo );177 void add_bonus( game *g, bonus *bo, int x, int y, int type );178 179 starfield * create_starfield( game *g );180 void draw_starfield( game *g, starfield *s );181 void update_starfield( game *g, starfield *s );182 void free_starfield( game *g, starfield *s );183 184 tunnel * create_tunnel( game *g, int w, int h );185 void free_tunnel( tunnel *t );186 void draw_tunnel( game *g, tunnel *t );187 void update_tunnel( game *g, tunnel *t );188 189 void init_explosions( game *g, explosions *ex );190 void add_explosion( game *g, explosions *ex, int x, int y, int vx, int vy, int type );191 void draw_explosions( game *g, explosions *ex );192 void update_explosions( game *g, explosions *ex );193 194 void ceo_alert( void );195 196 int r00t( int a );197 -
ttyvaders/trunk/src/main.c
r60 r62 4 4 * All Rights Reserved 5 5 * 6 * $Id: main.c,v 1.1 4 2002/12/23 13:46:27sam Exp $6 * $Id: main.c,v 1.15 2002/12/23 15:06:13 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 85 85 switch( key ) 86 86 { 87 case 'q': 88 quit = 1; 89 break; 90 case 'p': 91 poz = !poz; 92 break; 93 case '\t': 94 ceo_alert(); 95 poz = 1; 96 break; 97 case 's': 98 skip = 1; 99 break; 87 case 'q': 88 quit = 1; 89 break; 90 case 'p': 91 poz = !poz; 92 break; 93 case '\t': 94 ceo_alert(); 95 poz = 1; 96 break; 97 case 's': 98 skip = 1; 99 break; 100 default: 101 if( g->p->dead ) 102 { 103 break; 104 } 105 106 switch( key ) 107 { 100 108 case 'h': 101 109 g->p->vx = -2; … … 111 119 break; 112 120 case 'n': 113 if( g->p-> nuke == 0)114 { 115 g->p-> nuke = 40;121 if( g->p->special >= COST_NUKE ) 122 { 123 g->p->special -= COST_NUKE; 116 124 add_weapon( g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, 0, WEAPON_NUKE ); 117 125 } 118 126 break; 119 case '\r': 120 if( g->p->nuke == 0 ) 121 { 122 g->p->nuke = 40; 127 case 'f': 128 if( g->p->special >= COST_FRAGBOMB ) 129 { 130 g->p->special -= COST_FRAGBOMB; 131 add_weapon( g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, -16, WEAPON_FRAGBOMB ); 132 } 133 break; 134 case 'b': 135 if( g->p->special >= COST_BEAM ) 136 { 137 g->p->special -= COST_BEAM; 123 138 add_weapon( g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, 0, WEAPON_BEAM ); 124 139 } 125 140 break; 126 case 'f':127 if( g->p->nuke == 0 )128 {129 g->p->nuke = 40;130 add_weapon( g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, -16, WEAPON_FRAGBOMB );131 }132 break;133 case 'b':134 if( g->p->weapon == 0 )135 {136 g->p->weapon = 4;137 add_weapon( g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, -16, WEAPON_BOMB );138 }139 141 case ' ': 140 142 if( g->p->weapon == 0 ) … … 143 145 add_weapon( g, g->wp, g->p->x << 4, g->p->y << 4, 0, -32, WEAPON_LASER ); 144 146 add_weapon( g, g->wp, (g->p->x + 5) << 4, g->p->y << 4, 0, -32, WEAPON_LASER ); 145 /* Extra s htuph */147 /* Extra schtuph */ 146 148 add_weapon( g, g->wp, g->p->x << 4, g->p->y << 4, -24, -16, WEAPON_SEEKER ); 147 149 add_weapon( g, g->wp, (g->p->x + 5) << 4, g->p->y << 4, 24, -16, WEAPON_SEEKER ); 148 /* More s htuph */150 /* More schtuph */ 149 151 add_weapon( g, g->wp, (g->p->x + 1) << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER ); 150 152 add_weapon( g, g->wp, (g->p->x + 4) << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER ); 151 /* Even more s htuph */153 /* Even more schtuph */ 152 154 add_weapon( g, g->wp, (g->p->x + 2) << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER ); 153 155 add_weapon( g, g->wp, (g->p->x + 3) << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER ); 154 /* Extra s htuph */156 /* Extra schtuph */ 155 157 add_weapon( g, g->wp, g->p->x << 4, g->p->y << 4, -32, 0, WEAPON_SEEKER ); 156 158 add_weapon( g, g->wp, (g->p->x + 5) << 4, g->p->y << 4, 32, 0, WEAPON_SEEKER ); 157 } 158 break; 159 /* MORE SCHTUPH! */ 160 add_weapon( g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, -16, WEAPON_BOMB ); 161 } 162 break; 163 } 159 164 } 160 165 } … … 210 215 draw_weapons( g, g->wp ); 211 216 draw_player( g, g->p ); 217 draw_overlay( g ); 212 218 213 219 /* Refresh */ -
ttyvaders/trunk/src/player.c
r60 r62 4 4 * All Rights Reserved 5 5 * 6 * $Id: player.c,v 1. 6 2002/12/23 13:46:27sam Exp $6 * $Id: player.c,v 1.7 2002/12/23 15:06:13 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 35 35 p->vy = 0; 36 36 p->weapon = 0; 37 p-> nuke = 0;37 p->special = MAX_SPECIAL; 38 38 p->life = MAX_LIFE; 39 39 … … 87 87 } 88 88 89 if( p-> nuke)89 if( p->special < MAX_SPECIAL ) 90 90 { 91 p-> nuke--;91 p->special++; 92 92 } 93 93
Note: See TracChangeset
for help on using the changeset viewer.