stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src/clone ccl.c unit.c


From: Jimmy Salmon
Subject: [Stratagus-CVS] stratagus/src/clone ccl.c unit.c
Date: Mon, 27 Oct 2003 22:48:49 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Jimmy Salmon <address@hidden>   03/10/27 22:48:48

Modified files:
        src/clone      : ccl.c unit.c 

Log message:
        Fixed HelpMe sound if attacking in the upper left corner in the first 
two minutes or playing multiple games

Patches:
Index: stratagus/src/clone/ccl.c
diff -u stratagus/src/clone/ccl.c:1.118 stratagus/src/clone/ccl.c:1.119
--- stratagus/src/clone/ccl.c:1.118     Thu Oct 23 14:38:34 2003
+++ stratagus/src/clone/ccl.c   Mon Oct 27 22:48:48 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl.c,v 1.118 2003/10/23 18:38:34 n0body Exp $
+//     $Id: ccl.c,v 1.119 2003/10/28 03:48:48 jsalmon3 Exp $
 
 //@{
 
@@ -840,7 +840,7 @@
     sargv[0] = "Stratagus";
     sargv[1] = "-v1";
     sargv[2] = "-g0";
-    sargv[3] = "-h800000:10";
+    sargv[3] = "-h2000000:1";
     buf = malloc(strlen(StratagusLibPath) + 4);
     sprintf(buf, "-l%s", StratagusLibPath);
     sargv[4] = buf;                    // never freed
@@ -1050,7 +1050,7 @@
     }
 
     fprintf(fd, ";;; -----------------------------------------\n");
-    fprintf(fd, ";;; $Id: ccl.c,v 1.118 2003/10/23 18:38:34 n0body Exp $\n");
+    fprintf(fd, ";;; $Id: ccl.c,v 1.119 2003/10/28 03:48:48 jsalmon3 Exp $\n");
 
     fprintf(fd, "(set-video-resolution! %d %d)\n", VideoWidth, VideoHeight);
     
@@ -1075,7 +1075,7 @@
     }
 
     fprintf(fd, ";;; -----------------------------------------\n");
-    fprintf(fd, ";;; $Id: ccl.c,v 1.118 2003/10/23 18:38:34 n0body Exp $\n");
+    fprintf(fd, ";;; $Id: ccl.c,v 1.119 2003/10/28 03:48:48 jsalmon3 Exp $\n");
 
     // Global options
     if (OriginalFogOfWar) {
@@ -1186,7 +1186,7 @@
     extern SCM oblistvar;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.118 2003/10/23 18:38:34 
n0body Exp $\n\n");
+    CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.119 2003/10/28 03:48:48 
jsalmon3 Exp $\n\n");
 
     for (list = oblistvar; gh_list_p(list); list = gh_cdr(list)) {
        SCM sym;
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.318 stratagus/src/clone/unit.c:1.319
--- stratagus/src/clone/unit.c:1.318    Mon Oct 27 00:39:35 2003
+++ stratagus/src/clone/unit.c  Mon Oct 27 22:48:48 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.c,v 1.318 2003/10/27 05:39:35 mr-russ Exp $
+//     $Id: unit.c,v 1.319 2003/10/28 03:48:48 jsalmon3 Exp $
 
 //@{
 
@@ -84,6 +84,10 @@
 global char EnableBuildingCapture;     /// Config: capture buildings enabled
 global char RevealAttacker;            /// Config: reveal attacker enabled
 
+local unsigned long HelpMeLastCycle;   /// Last cycle HelpMe sound played
+local int HelpMeLastX;                 /// Last X coordinate HelpMe sound 
played
+local int HelpMeLastY;                 /// Last Y coordinate HelpMe sound 
played
+
 /*----------------------------------------------------------------------------
   --   Functions
   
----------------------------------------------------------------------------*/
@@ -2951,22 +2955,22 @@
     if (!target->Attacked) {
        // NOTE: perhaps this should also be moved into the notify?
        if (target->Player == ThisPlayer) {
-           // FIXME: Problem with load+save and restart.
-           static unsigned long LastCycle;
-           static int LastX;
-           static int LastY;
+           // FIXME: Problem with load+save.
 
            //
            //  One help cry each 2 second is enough
            //  If on same area ignore it for 2 minutes.
            //
-           if (LastCycle < GameCycle) {
-               if (LastCycle + CYCLES_PER_SECOND * 120 < GameCycle ||
-                       target->X < LastX - 14 || target->X > LastX + 14 ||
-                       target->Y < LastY - 14 || target->Y > LastY + 14) {
-                   LastCycle = GameCycle + CYCLES_PER_SECOND * 2;
-                   LastX = target->X;
-                   LastY = target->Y;
+           if (HelpMeLastCycle < GameCycle) {
+               if (!HelpMeLastCycle ||
+                       HelpMeLastCycle + CYCLES_PER_SECOND * 120 < GameCycle ||
+                       target->X < HelpMeLastX - 14 ||
+                       target->X > HelpMeLastX + 14 ||
+                       target->Y < HelpMeLastY - 14 ||
+                       target->Y > HelpMeLastY + 14) {
+                   HelpMeLastCycle = GameCycle + CYCLES_PER_SECOND * 2;
+                   HelpMeLastX = target->X;
+                   HelpMeLastY = target->Y;
                    PlayUnitSound(target, VoiceHelpMe);
                }
            }
@@ -3738,7 +3742,7 @@
     int RunStart;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.318 2003/10/27 05:39:35 
mr-russ Exp $\n\n");
+    CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.319 2003/10/28 03:48:48 
jsalmon3 Exp $\n\n");
 
     //
     // Local variables
@@ -3835,6 +3839,7 @@
 
     XpDamage = 0;
     FancyBuildings = 0;
+    HelpMeLastCycle = 0;
 }
 
 //@}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]