Changeset 22 for ttyvaders/trunk/src
- Timestamp:
- Dec 15, 2002, 6:03:55 AM (18 years ago)
- Location:
- ttyvaders/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ttyvaders/trunk/src/common.h
r20 r22 53 53 typedef struct 54 54 { 55 enum { WEAPON_NONE, WEAPON_LASER, WEAPON_SEEKER, WEAPON_NUKE } type[WEAPONS];55 enum { WEAPON_NONE, WEAPON_LASER, WEAPON_SEEKER, WEAPON_NUKE, WEAPON_BEAM } type[WEAPONS]; 56 56 int x[WEAPONS]; 57 57 int y[WEAPONS]; -
ttyvaders/trunk/src/main.c
r20 r22 110 110 g->p->dir = 3; 111 111 break; 112 case 'n': 113 if( g->p->nuke == 0 ) 114 { 115 g->p->nuke = 40; 116 add_weapon( g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, 0, WEAPON_NUKE ); 117 } 118 break; 112 119 case '\r': 113 120 if( g->p->nuke == 0 ) 114 121 { 115 122 g->p->nuke = 40; 116 add_weapon( g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, 0, WEAPON_ NUKE);123 add_weapon( g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, 0, WEAPON_BEAM ); 117 124 } 118 125 break; -
ttyvaders/trunk/src/weapons.c
r20 r22 6 6 7 7 static void draw_nuke( int x, int y, int frame ); 8 static void draw_beam( int x, int y, int frame ); 8 9 static void draw_circle( int x, int y, int r, char c ); 9 10 … … 43 44 gfx_goto( wp->x[i] >> 4, wp->y[i] >> 4 ); 44 45 gfx_putchar( '@' ); 46 break; 47 case WEAPON_BEAM: 48 draw_beam( wp->x[i] >> 4, wp->y[i] >> 4, wp->n[i] ); 45 49 break; 46 50 case WEAPON_NUKE: … … 132 136 133 137 break; 138 case WEAPON_BEAM: 139 wp->x[i] = (g->p->x + 2) << 4; 140 wp->y[i] = g->p->y << 4; 141 wp->n[i]--; 142 if( wp->n[i] < 0 ) 143 { 144 wp->type[i] = WEAPON_NONE; 145 } 146 break; 134 147 case WEAPON_NUKE: 135 148 wp->n[i]--; … … 169 182 wp->n[i] = 10; 170 183 break; 184 case WEAPON_BEAM: 185 wp->n[i] = 25; 186 break; 171 187 case WEAPON_NUKE: 172 188 wp->n[i] = 25; … … 177 193 break; 178 194 } 195 } 196 } 197 198 static void draw_beam( int x, int y, int frame ) 199 { 200 int r = (29 - frame) * (29 - frame) / 8; 201 int i; 202 203 switch( frame ) 204 { 205 case 24: 206 gfx_color( WHITE ); 207 gfx_goto( x, y-3 ); 208 gfx_putstr( "__" ); 209 gfx_goto( x-1, y-2 ); 210 gfx_putchar( '\'' ); 211 gfx_goto( x+2, y-2 ); 212 gfx_putchar( '`' ); 213 break; 214 case 23: 215 gfx_color( CYAN ); 216 gfx_goto( x, y-3 ); 217 gfx_putstr( "__" ); 218 gfx_color( WHITE ); 219 gfx_goto( x-2, y-2 ); 220 gfx_putstr( "-'" ); 221 gfx_goto( x+2, y-2 ); 222 gfx_putstr( "`-" ); 223 break; 224 case 22: 225 gfx_color( CYAN ); 226 gfx_goto( x, y-3 ); 227 gfx_putstr( "__" ); 228 gfx_goto( x-1, y-2 ); 229 gfx_putchar( '\'' ); 230 gfx_goto( x+2, y-2 ); 231 gfx_putchar( '`' ); 232 gfx_color( WHITE ); 233 gfx_goto( x-3, y-2 ); 234 gfx_putstr( ",-" ); 235 gfx_goto( x+3, y-2 ); 236 gfx_putstr( "-." ); 237 break; 238 case 21: 239 gfx_color( CYAN ); 240 gfx_goto( x-1, y-3 ); 241 gfx_putstr( "____" ); 242 gfx_goto( x-2, y-2 ); 243 gfx_putchar( '\'' ); 244 gfx_goto( x+3, y-2 ); 245 gfx_putchar( '`' ); 246 gfx_color( WHITE ); 247 gfx_goto( x-4, y-2 ); 248 gfx_putstr( ",-" ); 249 gfx_goto( x+4, y-2 ); 250 gfx_putstr( "-." ); 251 break; 252 case 20: 253 gfx_color( WHITE ); 254 gfx_goto( x, y-3 ); 255 gfx_putstr( "%%" ); 256 gfx_goto( x-4, y-2 ); 257 gfx_putchar( ',' ); 258 gfx_goto( x+5, y-2 ); 259 gfx_putchar( '.' ); 260 gfx_color( CYAN ); 261 gfx_goto( x-1, y-3 ); 262 gfx_putchar( ':' ); 263 gfx_goto( x+2, y-3 ); 264 gfx_putchar( ':' ); 265 gfx_goto( x-3, y-2 ); 266 gfx_putstr( "-'" ); 267 gfx_goto( x+3, y-2 ); 268 gfx_putstr( "`-" ); 269 break; 270 case 19: 271 gfx_color( WHITE ); 272 gfx_goto( x, y-4 ); 273 gfx_putstr( "%%" ); 274 gfx_goto( x, y-3 ); 275 gfx_putstr( "##" ); 276 gfx_color( CYAN ); 277 gfx_goto( x-1, y-4 ); 278 gfx_putchar( ':' ); 279 gfx_goto( x+2, y-4 ); 280 gfx_putchar( ':' ); 281 gfx_goto( x-1, y-3 ); 282 gfx_putchar( '%' ); 283 gfx_goto( x+2, y-3 ); 284 gfx_putchar( '%' ); 285 gfx_goto( x-4, y-2 ); 286 gfx_putstr( ",-'" ); 287 gfx_goto( x+3, y-2 ); 288 gfx_putstr( "`-." ); 289 gfx_color( BLUE ); 290 gfx_goto( x-2, y-3 ); 291 gfx_putchar( ':' ); 292 gfx_goto( x+3, y-3 ); 293 gfx_putchar( ':' ); 294 break; 295 case 18: 296 default: 297 r = (18 - frame) * (18 - frame); 298 gfx_color( WHITE ); 299 gfx_goto( x-1, y-5-r ); 300 gfx_putstr( ":%%:" ); 301 gfx_goto( x-1, y-4-r ); 302 gfx_putstr( "%##%" ); 303 gfx_color( CYAN ); 304 gfx_goto( x-2, y-4-r ); 305 gfx_putchar( ':' ); 306 gfx_goto( x+3, y-4-r ); 307 gfx_putchar( ':' ); 308 gfx_goto( x-2, y-2 ); 309 gfx_putchar( '\'' ); 310 gfx_goto( x+3, y-2 ); 311 gfx_putchar( '`' ); 312 gfx_color( BLUE ); 313 gfx_goto( x-3, y-2 ); 314 gfx_putchar( ':' ); 315 gfx_goto( x+4, y-2 ); 316 gfx_putchar( ':' ); 317 for( i = 0; i <= r; i++ ) 318 { 319 gfx_color( WHITE ); 320 gfx_goto( x-1, y-3-i ); 321 gfx_putstr( "####" ); 322 gfx_color( CYAN ); 323 gfx_goto( x-2, y-3-i ); 324 gfx_putchar( '%' ); 325 gfx_goto( x+3, y-3-i ); 326 gfx_putchar( '%' ); 327 gfx_color( BLUE ); 328 gfx_goto( x-3, y-3-i ); 329 gfx_putchar( ':' ); 330 gfx_goto( x+4, y-3-i ); 331 gfx_putchar( ':' ); 332 } 333 break; 179 334 } 180 335 }
Note: See TracChangeset
for help on using the changeset viewer.