-/* $Id: conf.h,v 1.5 2014/06/25 15:05:47 mmondor Exp $ */
+/* $Id: conf.h,v 1.6 2014/06/26 03:46:37 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
* Various hardcoded configuration parameters.
*/
-#define SERVER_HOST "mmondor.pulsar-zone.net"
+//#define SERVER_HOST "mmondor.pulsar-zone.net"
+#define SERVER_HOST "192.168.1.15"
#define SERVER_PORT 7777
#define CLIENT_VERSION 1
-/* $Id: main.c,v 1.8 2014/06/25 14:25:42 mmondor Exp $ */
+/* $Id: main.c,v 1.9 2014/06/26 03:46:37 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
void
collision_draw(int x, int y, int r)
{
+ static const uint8_t torp_colors[3][3] = {
+ { 0xff, 0xff, 0x00 }, /* 90% */
+ { 0xff, 0x30, 0x00 }, /* 5% */
+ { 0x00, 0x30, 0xff } /* 5% */
+ };
+ int rnd, c;
- /* XXX Should be fancier */
- filledCircleRGBA(screen_surface, x, y, r, 0xff, 0xff, 0xff, 0xa0);
+ rnd = rand() % 100;
+ if (rnd < 5)
+ c = 2;
+ else if (rnd < 10)
+ c = 1;
+ else
+ c = 0;
+
+ filledCircleRGBA(screen_surface, x, y, r,
+ torp_colors[c][0], torp_colors[c][1], torp_colors[c][2],
+ 0xa0 + (rand() % 0xa0));
+ if (r > 10)
+ (void) Mix_PlayChannel(-1, (r >= 20 ? snd_explode : snd_hit),
+ 0);
}
static SDL_Surface *
-/* $Id: conf.h,v 1.2 2014/06/19 19:53:34 mmondor Exp $ */
+/* $Id: conf.h,v 1.3 2014/06/26 03:46:37 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
#define FPS 20
#define FPS_MS (1000 / FPS)
-#define TIMEOUT_SECONDS 180
+#define TIMEOUT_SECONDS 900
#define WORLD_X_MAX 1024
#define WORLD_Y_MAX 768
-/* $Id: packets.c,v 1.6 2014/06/25 15:05:47 mmondor Exp $ */
+/* $Id: packets.c,v 1.7 2014/06/26 03:46:37 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
if (square_intersect(x1, y1, r1, x2, y2, r2) &&
circle_intersect(x1, y1, r1, x2, y2, r2)) {
- collision_create((int)(r1 + r2),
- x1, y1);
- collision_create((int)(r1 + r2),
- x2, y2);
if (ship_hit_ship(s1, s2)) {
+ collision_create(
+ (int)(r1 + r2) * 2, x1, y1);
+ collision_create(
+ (int)(r1 + r2) * 2, x2, y2);
ship_reset(&c->ship);
ship_reset(&c2->ship);
}
-/* $Id: torp.c,v 1.4 2014/06/25 15:05:47 mmondor Exp $ */
+/* $Id: torp.c,v 1.5 2014/06/26 03:46:37 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
if (square_intersect(tx, ty, tr, sx, sy, sr) &&
circle_intersect(tx, ty, tr, sx, sy, sr)) {
- collision_create((int)(tsd->torp_damage / 5),
+ collision_create((int)(tsd->torp_damage / 2),
tx, ty);
if (ship_hit_torp(s, tsd)) {
- collision_create(sr, sx, sy);
+ collision_create(sr * 2, sx, sy);
ship_reset(&c->ship);
}
torp_destroyed = 1;