stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus data/ccl/stratagus.ccl src/action/act...


From: Russell Smith
Subject: [Stratagus-CVS] stratagus data/ccl/stratagus.ccl src/action/act...
Date: Sat, 27 Sep 2003 02:16:37 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Russell Smith <address@hidden>  03/09/27 02:16:37

Modified files:
        data/ccl       : stratagus.ccl 
        src/action     : actions.c 
        src/clone      : mainloop.c unit.c 
        src/editor     : editloop.c 
        src/include    : actions.h unit.h 
        src/map        : ccl_map.c minimap.c 
        doc/ccl        : config.html 

Log message:
        Moved Health/Mana/Spell Regeneration code around
        Increased configuration of burning buildings
        Began Configuration of Health/Mana/Spell speed configuration

Patches:
Index: stratagus/data/ccl/stratagus.ccl
diff -u stratagus/data/ccl/stratagus.ccl:1.16 
stratagus/data/ccl/stratagus.ccl:1.17
--- stratagus/data/ccl/stratagus.ccl:1.16       Mon Sep 22 06:39:11 2003
+++ stratagus/data/ccl/stratagus.ccl    Sat Sep 27 02:16:36 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: stratagus.ccl,v 1.16 2003/09/22 10:39:11 n0body Exp $
+;;     $Id: stratagus.ccl,v 1.17 2003/09/27 06:16:36 mr-russ Exp $
 
 ;; For documentation see stratagus/doc/ccl/ccl.html
 
@@ -235,8 +235,8 @@
 ;(set-goldmine-depleted! 5)
 
 ;;     Set burning building percent and rate. (n percent, h HP/second)
-;;     Buildings with less than n% HP lose h HP every second.
-;(set-burn-buildings! 25 2)
+;;     Buildings with less than n% HP lose h HP every wait cycles.
+;(set-burn-buildings! 25 2 6)
 
 ;;     Edit this to enable/disable the reveal of the attacker.
 ;(set-reveal-attacker! #t)
Index: stratagus/doc/ccl/config.html
diff -u stratagus/doc/ccl/config.html:1.27 stratagus/doc/ccl/config.html:1.28
--- stratagus/doc/ccl/config.html:1.27  Sun Sep 21 06:03:55 2003
+++ stratagus/doc/ccl/config.html       Sat Sep 27 02:16:37 2003
@@ -419,23 +419,26 @@
 <a href="../../data/ccl/stratagus.ccl"> $LIBARYPATH/ccl/stratagus.ccl </a>
 
 <a name="set-burn-buildings!"></a>
-<h3>(set-burn-buildings! percent rate)</h3>
+<h3>(set-burn-buildings! percent rate wait)</h3>
 
 .
 
 
 <dl>
 <dt>percent</dt>
-<dd>.
+<dd>percentage to start burning at.
 <dt>rate</dt>
-<dd>.
+<dd>HP per wait period to lose
+</dd>
+<dt>wait</dt>
+<dd>Number of cycles to wait before running each burn
 </dd>
 </dl>
 
 <h4>Example</h4>
 
 <pre>
-    (set-burn-buildings! 25 2)
+    (set-burn-buildings! 25 2 6)
 </pre>
 
 <h4>Used</h4>
@@ -1617,7 +1620,7 @@
 <a href="../../data/ccl/stratagus.ccl"> $LIBARYPATH/ccl/stratagus.ccl </a>
 
 <hr>
-Last changed: $Id: config.html,v 1.27 2003/09/21 10:03:55 mr-russ Exp $<br>
+Last changed: $Id: config.html,v 1.28 2003/09/27 06:16:37 mr-russ Exp $<br>
 All trademarks and copyrights on this page are owned by their respective 
owners.
 <address>(c) 2002-2003 by <a href="http://stratagus.org";>
 The Stratagus Project</a></address></body></html>
Index: stratagus/src/action/actions.c
diff -u stratagus/src/action/actions.c:1.93 stratagus/src/action/actions.c:1.94
--- stratagus/src/action/actions.c:1.93 Wed Sep 10 04:44:36 2003
+++ stratagus/src/action/actions.c      Sat Sep 27 02:16:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: actions.c,v 1.93 2003/09/10 08:44:36 n0body Exp $
+//     $Id: actions.c,v 1.94 2003/09/27 06:16:36 mr-russ Exp $
 
 //@{
 
@@ -55,6 +55,7 @@
 global unsigned SyncHash;          /// Hash calculated to find sync failures
 global int BurnBuildingPercent;            /// Max percent to burn buildings
 global int BurnBuildingDamageRate;  /// HP per second to damage buildings
+global int BurnBuildingWait;       /// Cycles to Wait for each burn
 
 /*----------------------------------------------------------------------------
 --     Functions
@@ -261,6 +262,171 @@
 };
 
 /**
+ **    Do the runestone work each second.
+ **
+ **    @param  unit    unit that heals an area
+*/
+local void IncrementAreaHealthMana(Unit* unit)
+{
+    Unit* units[UnitMax];
+    int nunits;
+    int j;
+
+    // Get all the units around the unit
+    nunits = SelectUnits(unit->X - unit->Stats->SightRange,
+               unit->Y - unit->Stats->SightRange,
+               unit->X + unit->Stats->SightRange+unit->Type->Width,
+               unit->Y + unit->Stats->SightRange+unit->Type->Height,
+               units);
+    // Mana and HP on units, 2 every time
+    for (j = 0; j < nunits; ++j) {
+       if (units[j] == unit) {
+           continue;
+       }
+
+       // Restore HP in everything but buildings (even in other player's units)
+       if (units[j]->Type->Organic && units[j]->HP < 
units[j]->Stats->HitPoints ) {
+           units[j]->HP++;
+       }
+
+       // Restore mana in all magical units
+       if(units[j]->Type->CanCastSpell && units[j]->Mana < 
units[j]->Type->_MaxMana)  {        
+           units[j]->Mana++;
+       }
+    }
+}
+
+/**
+**     Increment a unit's health
+**
+**     @param  unit    the unit to operate on
+*/
+local void IncrementUnitHealth(Unit* unit)
+{
+    // Unit may not have stats assigned to it
+    if (unit->Stats) {
+       if (HitPointRegeneration && unit->HP<unit->Stats->HitPoints) {
+           ++unit->HP;
+
+           if( unit->Selected ) {
+               MustRedraw|=RedrawInfoPanel;
+           }
+       }
+       
+       if( unit->Stats->RegenerationRate && unit->HP<unit->Stats->HitPoints ) {
+           unit->HP+=unit->Stats->RegenerationRate;
+           if( unit->HP > unit->Stats->HitPoints ) {
+               unit->HP = unit->Stats->HitPoints;
+           }
+
+           if( unit->Selected ) {
+               MustRedraw|=RedrawInfoPanel;
+           }
+       }
+    }
+}
+
+/**
+**     Handle things about the unit that decay over time
+**
+**     @param  unit    the unit that the decay is handled for
+**
+**     @return 1 for dead unit, 0 otherwise
+*/
+local int HandleDecay(Unit* unit)
+{
+    int deadunit;
+    int flag;
+
+    if( unit->Type->CanCastSpell && unit->Mana!=unit->Type->_MaxMana ) {
+       unit->Mana++;
+
+       if( unit->Selected ) {
+           MustRedraw|=RedrawInfoPanel;
+       }
+    }
+
+    deadunit=0;
+    //
+    // Look if the time to live is over.
+    //
+    if( unit->TTL && unit->TTL<(GameCycle-unit->HP) ) {
+       DebugLevel0Fn("Unit must die %lu %lu!\n" _C_ unit->TTL
+               _C_ GameCycle);
+       if( !--unit->HP ) {
+           LetUnitDie(unit);
+           deadunit|=1;
+       }
+       if( unit->Selected ) {
+           MustRedraw|=RedrawInfoPanel;
+       }
+    }
+
+    // some frames delayed done my color cycling
+    flag=1;
+    //
+    // decrease spells effects time, if end redraw unit.
+    //
+    if ( unit->Bloodlust ) {
+       unit->Bloodlust--;
+       if( !flag && !unit->Bloodlust ) {
+           flag=CheckUnitToBeDrawn(unit);
+       }
+    }
+    if ( unit->Haste ) {
+       unit->Haste--;
+       if( !flag && !unit->Haste ) {
+           flag=CheckUnitToBeDrawn(unit);
+       }
+    }
+    if ( unit->Slow ) {
+       unit->Slow--;
+       if( !flag && !unit->Slow ) {
+           flag=CheckUnitToBeDrawn(unit);
+       }
+    }
+    if ( unit->Invisible ) {
+       unit->Invisible--;
+       if( !flag && !unit->Invisible ) {
+           flag=CheckUnitToBeDrawn(unit);
+       }
+    }
+    if ( unit->UnholyArmor ) {
+       unit->UnholyArmor--;
+       if( !flag && !unit->UnholyArmor ) {
+           flag=CheckUnitToBeDrawn(unit);
+       }
+    }
+    DebugLevel3Fn("%d:%d,%d,%d,%d,%d\n" _C_ UnitNumber(unit) _C_
+           unit->Bloodlust _C_ unit->Haste _C_ unit->Slow _C_
+           unit->Invisible _C_ unit->UnholyArmor);
+
+    return deadunit;
+}
+
+/**
+**     Handle burning buildings
+**
+**     @param  unit    unit to burn
+*/
+local void BurnBuilding(Unit* unit)
+{
+    int f;
+
+    if( !unit->Type->Building || unit->Removed || unit->Destroyed ) {
+       return;
+    }
+
+    // don't burn buildings under construction
+    if( unit->Stats->HitPoints && unit->Orders[0].Action!=UnitActionBuilded ) {
+       f = (100 * unit->HP) / unit->Stats->HitPoints;
+       if( f <= BurnBuildingPercent ) {
+           HitUnit(NoUnitP, unit, BurnBuildingDamageRate);
+       }
+    }
+}
+
+/**
 **     Handle the action of an unit.
 **
 **     @param unit     Pointer to handled unit.
@@ -355,6 +521,20 @@
     Unit** tpos;
     Unit** tend;
     Unit* unit;
+    int burnthiscycle;
+    int healthiscycle;
+    int manathiscycle;
+    int blinkthiscycle;
+
+    if( BurnBuildingPercent ) {
+       burnthiscycle=!(GameCycle%BurnBuildingWait);
+    } else {
+       burnthiscycle=0;
+    }
+    // FIXME: Make configurable from CCL;
+    healthiscycle=!(GameCycle%CYCLES_PER_SECOND);
+    manathiscycle=!(GameCycle%CYCLES_PER_SECOND);
+    blinkthiscycle=!(GameCycle%CYCLES_PER_SECOND);
 
     //
     // Must copy table, units could be removed.
@@ -408,6 +588,29 @@
        if( --unit->Wait ) {            // Wait until counter reached
            continue;
        }
+
+       if( blinkthiscycle && unit->Blink ) {   // clear blink flag
+           --unit->Blink;
+       }
+
+       if (manathiscycle) {
+           if (HandleDecay(unit)) {
+               // Unit Died
+               continue;
+           }
+       }
+
+       //FIXME: Need to configure this to work
+       if( 0 ) { //Condition for Area Heal
+           IncrementAreaHealthMana(unit);
+       }
+       if( healthiscycle ) {
+           IncrementUnitHealth(unit);
+       }
+       if( burnthiscycle ) {
+           BurnBuilding(unit);
+       }
+
        HandleUnitAction(unit);
        DebugCheck( *tpos!=unit );      // Removed is evil.
 
@@ -457,31 +660,30 @@
 }
 
 /**
-**     Handle burning buildings
+**     Handle Marking and Unmarking of Cloak
+**
+**     @note Must be handled outside the drawing fucntions and
+**     @note all at once.
 */
-global void BurnBuildings(void)
+global void HandleCloak(void)
 {
     Unit* unit;
     int i;
-    int f;
-
-    if( !BurnBuildingPercent ) {
-       return;
-    }
 
-    for( i=0; i<NumUnits; ++i) {
-       unit = Units[i];
-
-       if( !unit->Type->Building || unit->Removed || unit->Destroyed ) {
-           continue;
-       }
-
-       // don't burn buildings under construction
-       if( unit->Stats->HitPoints && unit->Orders[0].Action!=UnitActionBuilded 
) {
-           f = (100 * unit->HP) / unit->Stats->HitPoints;
-           if( f <= BurnBuildingPercent ) {
-               HitUnit(NoUnitP, unit, BurnBuildingDamageRate);
+    for (i=0; i<NumUnits; i++) {
+       unit=Units[i]; 
+       if (  unit->Type->PermanentCloak ) {
+           if( (unit->Visible&(1<<ThisPlayer->Player)) ) {
+               CheckUnitToBeDrawn(unit);
            }
+           unit->Visible=0;
+       }
+    }
+    for (i=0; i<NumUnits; ++i) {
+       unit=Units[i];
+       if( unit->Type->DetectCloak && !unit->Removed &&
+           unit->Orders[0].Action!=UnitActionBuilded ) {
+           MapDetectCloakedUnits(unit);
        }
     }
 }
Index: stratagus/src/clone/mainloop.c
diff -u stratagus/src/clone/mainloop.c:1.142 
stratagus/src/clone/mainloop.c:1.143
--- stratagus/src/clone/mainloop.c:1.142        Thu Sep 18 13:56:03 2003
+++ stratagus/src/clone/mainloop.c      Sat Sep 27 02:16:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: mainloop.c,v 1.142 2003/09/18 17:56:03 n0body Exp $
+//     $Id: mainloop.c,v 1.143 2003/09/27 06:16:36 mr-russ Exp $
 
 //@{
 
@@ -824,11 +824,9 @@
            //
            switch( GameCycle%CYCLES_PER_SECOND ) {
                case 0:
-                   UnitIncrementMana();        // magic units
-                   DoRunestones();             // runestones
+                   HandleCloak();
                    break;
                case 1:
-                   UnitIncrementHealth();      // berserker healing
                    break;
                case 2:                         // minimap update
                    UpdateMinimap();
@@ -844,7 +842,6 @@
                    RescueUnits();
                    break;
                case 6:
-                   BurnBuildings();            // burn buildings
                    break;
            }
 
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.305 stratagus/src/clone/unit.c:1.306
--- stratagus/src/clone/unit.c:1.305    Fri Sep 26 16:32:00 2003
+++ stratagus/src/clone/unit.c  Sat Sep 27 02:16:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.c,v 1.305 2003/09/26 20:32:00 jsalmon3 Exp $
+//     $Id: unit.c,v 1.306 2003/09/27 06:16:36 mr-russ Exp $
 
 //@{
 
@@ -1428,213 +1428,6 @@
 #endif // } HIERARCHIC_PATHFINDER
 
 /**
- **    Do the runestone work each second.
- */
-global void DoRunestones(void)
-{
-    Unit* units[UnitMax];
-    Unit* stones[UnitMax];
-    int nstones;
-    int nunits;
-    int i;
-    int j;
-    unsigned tmp;
-
-    // FIXME: Don't use UnitTypeByIdent during runtime
-    nstones = FindUnitsByType(UnitTypeByIdent("unit-runestone"),stones);
-    for (i = 0; i < nstones; ++i) {
-       // Get all the units around the runestone
-       nunits = SelectUnits(stones[i]->X - stones[i]->Stats->SightRange,
-               stones[i]->Y - stones[i]->Stats->SightRange,
-               stones[i]->X + stones[i]->Stats->SightRange+1,
-               stones[i]->Y + stones[i]->Stats->SightRange+1,
-               units);
-       // Runestone Mana and HP on units, 2 every time
-       for (j = 0; j < nunits; ++j) {
-           if (units[j] == stones[i]) {
-               continue;
-           }
-
-           // Restore HP in everything but buildings (even in other player's 
units)
-           if (!units[j]->Type->Building && units[j]->Type->Organic && 
-                   units[j]->HP != units[j]->Stats->HitPoints ) {
-               tmp = units[j]->Stats->HitPoints - units[j]->HP;
-               if (tmp > 2) {
-                   tmp = 2;
-               }
-               units[j]->HP += tmp;
-           }
-
-           // Restore mana in all magical units
-           if(units[j]->Type->CanCastSpell && units[j]->Mana != 
units[j]->Type->_MaxMana)  {   
-               tmp = units[j]->Type->_MaxMana - units[j]->Mana;
-               if (tmp > 2) {
-                   tmp = 2;
-               }
-               units[j]->Mana += tmp;
-           }
-       }
-    }
-}
-
-// FIXME: perhaps I should write a function UnitSelectable?
-
-/**
- **    Increment mana of all magic units. Called each second.
- **    Also clears the blink flag and handles submarines.
- **
- **    @note   we could build a table of all magic units reducing cpu use.
- **
- **    @todo FIXME: Split this into more functions, to make the use clearer
- **            or rename the function.
- */
-//FIXME: vladi: the doc says incrementing mana is done by 1 per second
-//       the spells effect can be decremented at the same time and this
-//       will reduse calls to this function to one time per second only!
-//     johns: We must also walk through all units = also overhead.
-global void UnitIncrementMana(void)
-{
-    Unit** table;
-    Unit* unit;
-    int flag;
-
-    for( table=Units; table<Units+NumUnits; table++ ) {
-       unit=*table;
-       // FIXME: This isn't the correct position or the correct function name
-       if( unit->Blink ) {             // clear blink flag
-           --unit->Blink;
-       }
-
-       if( unit->Type->CanCastSpell && unit->Mana!=unit->Type->_MaxMana ) {
-           unit->Mana++;
-
-           // some frames delayed done my color cycling
-           if( 0 ) {
-               CheckUnitToBeDrawn(unit);
-           }
-           if( unit->Selected ) {
-               MustRedraw|=RedrawInfoPanel;
-           }
-       }
-
-       //
-       //      Look if the time to live is over.
-       //
-       if( unit->TTL && unit->TTL<GameCycle ) {
-           DebugLevel0Fn("Unit must die %lu %lu!\n" _C_ unit->TTL
-                   _C_ GameCycle);
-           //if( !--unit->HP ) { FIXME: must reduce hp the last seconds of life
-           LetUnitDie(unit);
-           //}
-           // FIXME: this can modify my table, some units are than skipped!
-           continue;
-       }
-
-       // some frames delayed done my color cycling
-       flag=1;
-       //
-       // decrease spells effects time, if end redraw unit.
-       //
-       if ( unit->Bloodlust ) {
-           unit->Bloodlust--;
-           if( !flag && !unit->Bloodlust ) {
-               flag=CheckUnitToBeDrawn(unit);
-           }
-       }
-       if ( unit->Haste ) {
-           unit->Haste--;
-           if( !flag && !unit->Haste ) {
-               flag=CheckUnitToBeDrawn(unit);
-           }
-       }
-       if ( unit->Slow ) {
-           unit->Slow--;
-           if( !flag && !unit->Slow ) {
-               flag=CheckUnitToBeDrawn(unit);
-           }
-       }
-       if ( unit->Invisible ) {
-           unit->Invisible--;
-           if( !flag && !unit->Invisible ) {
-               flag=CheckUnitToBeDrawn(unit);
-           }
-       }
-       if ( unit->UnholyArmor ) {
-           unit->UnholyArmor--;
-           if( !flag && !unit->UnholyArmor ) {
-               flag=CheckUnitToBeDrawn(unit);
-           }
-       }
-       DebugLevel3Fn("%d:%d,%d,%d,%d,%d\n" _C_ UnitNumber(unit) _C_
-               unit->Bloodlust _C_ unit->Haste _C_ unit->Slow _C_
-               unit->Invisible _C_ unit->UnholyArmor);
-
-       if (  unit->Type->PermanentCloak ) {
-           if( !flag && (unit->Visible&(1<<ThisPlayer->Player)) ) {
-               flag=CheckUnitToBeDrawn(unit);
-           }
-           unit->Visible=0;
-       }
-    }
-
-    //
-    // Step 2) Mark all submarines that could be seen.
-    //         Take units that can see sub marines, aren't under construction
-    //         and are on the map.
-    //
-    for( table=Units; table<Units+NumUnits; table++ ) {
-       unit=*table;
-       if( unit->Type->DetectCloak && !unit->Removed &&
-               unit->Orders[0].Action!=UnitActionBuilded ) {
-           MapDetectCloakedUnits(unit);
-       }
-    }
-}
-
-/**
- **    Increment health of all regenerating units. Called each second.
- **
- **    @note:  We could build a table of all regenerating units reducing cpu
- **            use.
- */
-global void UnitIncrementHealth(void)
-{
-    Unit** table;
-    Unit* unit;
-
-    for( table=Units; table<Units+NumUnits; table++ ) {
-       unit=*table;
-       //Unit may not have stats assigned to it
-       if (unit->Stats) {
-           if (HitPointRegeneration && unit->HP<unit->Stats->HitPoints) {
-               ++unit->HP;
-
-               if( 0 ) {       // some frames delayed done my color cycling
-                   CheckUnitToBeDrawn(unit);
-               }
-               if( unit->Selected ) {
-                   MustRedraw|=RedrawInfoPanel;
-               }
-           }
-           if( unit->Stats->RegenerationRate && 
unit->HP<unit->Stats->HitPoints ) {
-               unit->HP+=unit->Stats->RegenerationRate;
-               if( unit->HP > unit->Stats->HitPoints ) {
-                   unit->HP = unit->Stats->HitPoints;
-               }
-
-           // some frames delayed done my color cycling
-               if( 0 ) {
-                   CheckUnitToBeDrawn(unit);
-               }
-               if( unit->Selected ) {
-                   MustRedraw|=RedrawInfoPanel;
-               }
-           }
-       }
-    }
-}
-
-/**
  **    Change the unit's owner
  **
  **    @param unit             Unit which should be consigned.
@@ -3953,7 +3746,7 @@
     int InRun, RunStart;
 
     CLprintf(file,"\n;;; -----------------------------------------\n");
-    CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.305 2003/09/26 20:32:00 
jsalmon3 Exp $\n\n");
+    CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.306 2003/09/27 06:16:36 
mr-russ Exp $\n\n");
 
     //
     // Local variables
Index: stratagus/src/editor/editloop.c
diff -u stratagus/src/editor/editloop.c:1.129 
stratagus/src/editor/editloop.c:1.130
--- stratagus/src/editor/editloop.c:1.129       Mon Sep 22 06:40:52 2003
+++ stratagus/src/editor/editloop.c     Sat Sep 27 02:16:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: editloop.c,v 1.129 2003/09/22 10:40:52 n0body Exp $
+//     $Id: editloop.c,v 1.130 2003/09/27 06:16:36 mr-russ Exp $
 
 //@{
 
@@ -1889,6 +1889,7 @@
            if (SelectedPlayer == 15) {
                SelectedPlayer = i;
            }
+#if 0
            // FIXME: must support more races
            switch (TheMap.Info->PlayerSide[i]) {
                case PlayerRaceHuman:
@@ -1902,6 +1903,7 @@
                        Players + i);
                    break;
            }
+#endif
        } else if (Players[i].StartX | Players[i].StartY) {
            DebugLevel0Fn("Player nobody has a start position\n");
        }
Index: stratagus/src/include/actions.h
diff -u stratagus/src/include/actions.h:1.54 
stratagus/src/include/actions.h:1.55
--- stratagus/src/include/actions.h:1.54        Fri Sep  5 14:10:55 2003
+++ stratagus/src/include/actions.h     Sat Sep 27 02:16:37 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: actions.h,v 1.54 2003/09/05 18:10:55 n0body Exp $
+//     $Id: actions.h,v 1.55 2003/09/27 06:16:37 mr-russ Exp $
 
 #ifndef __ACTIONS_H__
 #define __ACTIONS_H__
@@ -60,6 +60,7 @@
 extern unsigned        SyncHash;           /// Hash calculated to find sync 
failures
 extern int BurnBuildingPercent;            /// Max percent to burn buildings
 extern int BurnBuildingDamageRate;  /// HP per second to damage buildings
+extern int BurnBuildingWait;       /// Number of cycles to wait for burning
 
 /*----------------------------------------------------------------------------
 --     Functions
@@ -191,9 +192,8 @@
 extern int UnitShowAnimation(Unit* unit,const Animation* animation);
     /// Handle the actions of all units each game cycle
 extern void UnitActions(void);
-    /// Handle burning buildings
-extern void BurnBuildings(void);
-
+    /// Handle Cloaked Unit's Visible
+extern void HandleCloak(void);
 //@}
 
 #endif // !__ACTIONS_H__
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.216 stratagus/src/include/unit.h:1.217
--- stratagus/src/include/unit.h:1.216  Fri Sep 26 05:15:22 2003
+++ stratagus/src/include/unit.h        Sat Sep 27 02:16:37 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.h,v 1.216 2003/09/26 09:15:22 mr-russ Exp $
+//     $Id: unit.h,v 1.217 2003/09/27 06:16:37 mr-russ Exp $
 
 #ifndef __UNIT_H__
 #define __UNIT_H__
@@ -785,12 +785,6 @@
     /// FIXME: more docu
 extern int UnitGetNextPathSegment (const Unit * , int * , int * );
 #endif
-    /// Increment mana of all magic units each second
-extern void UnitIncrementMana(void);
-    /// Do the runestone's work each second 
-extern void DoRunestones(void);
-    /// Increment health of all regenerating units each second
-extern void UnitIncrementHealth(void);
     /// Check for rescue each second
 extern void RescueUnits(void);
     /// Change owner of unit
Index: stratagus/src/map/ccl_map.c
diff -u stratagus/src/map/ccl_map.c:1.38 stratagus/src/map/ccl_map.c:1.39
--- stratagus/src/map/ccl_map.c:1.38    Sat Sep 27 00:24:42 2003
+++ stratagus/src/map/ccl_map.c Sat Sep 27 02:16:37 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_map.c,v 1.38 2003/09/27 04:24:42 jsalmon3 Exp $
+//     $Id: ccl_map.c,v 1.39 2003/09/27 06:16:37 mr-russ Exp $
 
 //@{
 
@@ -505,15 +505,18 @@
 **     Set burning buildings percent and rate.
 **
 **     @param percent      Max percent needed to burn buildings
-**     @param rate         HP per second to damage buildings
+**     @param rate         HP per cycle to damage buildings
+**     @param wait         Number of cycles to wail
 */
-local SCM CclSetBurnBuildings(SCM percent, SCM rate)
+local SCM CclSetBurnBuildings(SCM percent, SCM rate, SCM wait)
 {
     int p;
     int r;
+    int w;
 
-    p = gh_scm2int(percent);
-    r = gh_scm2int(rate);
+    p=gh_scm2int(percent);
+    r=gh_scm2int(rate);
+    w=gh_scm2int(wait);
     if (p < 0 || p > 100) {
        PrintFunction();
        fprintf(stdout, "Burn percent should be 0-100\n");
@@ -524,8 +527,14 @@
        fprintf(stderr, "Burn rate should be greater than 0\n");
        p = 0;
     }
-    BurnBuildingPercent = p;
-    BurnBuildingDamageRate = r;
+    if (w <= 0) {
+       PrintFunction();
+       fprintf(stderr, "Wait Cycles must be greater than 0\n");
+       w=CYCLES_PER_SECOND;
+    }
+    BurnBuildingPercent=p;
+    BurnBuildingDamageRate=r;
+    BurnBuildingWait=w;
 
     return SCM_UNSPECIFIED;
 }
@@ -554,7 +563,7 @@
     gh_new_procedure1_0("set-forest-regeneration!", CclSetForestRegeneration);
     gh_new_procedure1_0("set-goldmine-depleted!", CclSetGoldmineDepleted);
 
-    gh_new_procedure2_0("set-burn-buildings!", CclSetBurnBuildings);
+    gh_new_procedure3_0("set-burn-buildings!", CclSetBurnBuildings);
 }
 
 //@}
Index: stratagus/src/map/minimap.c
diff -u stratagus/src/map/minimap.c:1.64 stratagus/src/map/minimap.c:1.65
--- stratagus/src/map/minimap.c:1.64    Thu Sep 18 13:56:04 2003
+++ stratagus/src/map/minimap.c Sat Sep 27 02:16:37 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: minimap.c,v 1.64 2003/09/18 17:56:04 n0body Exp $
+//     $Id: minimap.c,v 1.65 2003/09/27 06:16:37 mr-russ Exp $
 
 //@{
 
@@ -290,7 +290,6 @@
     // FIXME: and other changes
     //
 
-#ifdef BUILDING_DESTROYED
     // Draw Destroyed Buildings On Map
     table = &DestroyedBuildings;
     while( *table ) {
@@ -332,7 +331,7 @@
        }
        table=&(*table)->Next;
     }
-#endif
+
     for( table=Units; table<Units+NumUnits; ++table ) {
        SysColors color;
 




reply via email to

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