Minor esthetic changes
authorMatthew Mondor <mmondor@pulsar-zone.net>
Thu, 26 Jun 2014 03:46:37 +0000 (03:46 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Thu, 26 Jun 2014 03:46:37 +0000 (03:46 +0000)
mmsoftware/mystic_ships/client/src/conf.h
mmsoftware/mystic_ships/client/src/main.c
mmsoftware/mystic_ships/server/src/conf.h
mmsoftware/mystic_ships/server/src/packets.c
mmsoftware/mystic_ships/server/src/torp.c

index 758b9b9..2738e0b 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
@@ -14,7 +14,8 @@
  * 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
index 33cc8d4..8ac6d5e 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
@@ -679,9 +679,27 @@ torp_draw(int x, int y, int r)
 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 *
index 8e8d121..9786aea 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
@@ -19,7 +19,7 @@
 
 #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
index 14d0de8..83e181f 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
@@ -120,11 +120,11 @@ packets_update(void)
 
                                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);
                                        }
index 553a930..5ea5bb2 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
@@ -114,10 +114,10 @@ torps_update(void)
 
                        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;