stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus doc/ccl/magic.html doc/ChangeLog.html...


From: Russell Smith
Subject: [Stratagus-CVS] stratagus doc/ccl/magic.html doc/ChangeLog.html...
Date: Fri, 05 Dec 2003 23:47:46 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Russell Smith <address@hidden>  03/12/05 23:47:45

Modified files:
        doc/ccl        : magic.html 
        doc            : ChangeLog.html 
        src/include    : missile.h 
        src/missile    : ccl_missile.c missile.c 

Log message:
        Made splash damage for missiles configurable.

Patches:
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.589 stratagus/doc/ChangeLog.html:1.590
--- stratagus/doc/ChangeLog.html:1.589  Tue Dec  2 19:20:54 2003
+++ stratagus/doc/ChangeLog.html        Fri Dec  5 23:47:45 2003
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-----   $Id: ChangeLog.html,v 1.589 2003/12/03 00:20:54 mr-russ Exp $
+----   $Id: ChangeLog.html,v 1.590 2003/12/06 04:47:45 mr-russ Exp $
 
 ----   (c) Copyright 1998-2003 by Lutz Sammer
 
@@ -36,6 +36,7 @@
 <li>Future 2.00 Release<p>
     <ul>
     <li>++
+    <li>Splash Damage Configurable (from Russell Smith).
     <li>Fixed Bug #6924: missile cast near map border (from Russell Smith).
     <li>Rewrote video using SDL_Surface, enable with -DUSE_SDL_SURFACE (from 
Nehal Mistry).
     <li>Per UnitType limits (from François Beerten)
Index: stratagus/doc/ccl/magic.html
diff -u stratagus/doc/ccl/magic.html:1.8 stratagus/doc/ccl/magic.html:1.9
--- stratagus/doc/ccl/magic.html:1.8    Thu Oct 30 15:22:47 2003
+++ stratagus/doc/ccl/magic.html        Fri Dec  5 23:47:45 2003
@@ -177,7 +177,11 @@
 you shot a missile at a unit, it would only damage that unit.  A value of 1 
only
 affects the field where the missile hits.  A value of 2  would mean that the
 damage for that particular missile would be dealt for a range of 1 around the
-impact spot. All fields that aren't the center get only 50% of the damage.
+impact spot. All fields that aren't the center get only 1/SpashFactor of the 
damage.
+Fields 2 away get 1/(SplashFactor*2), and following...
+</dd>
+<dt>splash-factor</dt>
+<dd>The Splash divisor for damage done with range
 </dd>
 <dt>impact-missile</dt>
 <dd>You can use this to spawn another missile on impact. F.E. 'impact-missile 
'missile-explosion
@@ -187,11 +191,11 @@
 can be used to generate a chain of missiles.
 </dd>
 <dt>can-hit-owner</dt>
-<dd>This is a boolean value(#t or #f) that determines if the missile will 
affect
+<dd>Determines if the missile will affect
 the caster or not.
 </dd>
 <dt>firendly-fire</dt>
-<dd>This is a boolean value(#t or #f) that determines if the missile will 
damage
+<dd>Determines if the missile will damage
 units belonging to the same player of the caster or to an ally.
 </dd>
 </dl>
@@ -204,7 +208,7 @@
       'num-directions 8
       'impact-sound "fireball hit"
       'class 'missile-class-point-to-point 'draw-level 50  'sleep 1 'speed 16 
'range 1
-      'can-hit-owner #f 'friendly-fire #f)
+      'can-hit-owner)
 </pre>
 <h4>Used</h4>
 <a href="../../data/ccl/missiles.ccl"> $LIBARYPATH/ccl/missiles.ccl </a>
@@ -601,7 +605,7 @@
 
 
 <hr>
-Last changed: $Id: magic.html,v 1.8 2003/10/30 20:22:47 n0body Exp $<br>
+Last changed: $Id: magic.html,v 1.9 2003/12/06 04:47:45 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/include/missile.h
diff -u stratagus/src/include/missile.h:1.71 
stratagus/src/include/missile.h:1.72
--- stratagus/src/include/missile.h:1.71        Sat Oct 25 19:10:44 2003
+++ stratagus/src/include/missile.h     Fri Dec  5 23:47:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: missile.h,v 1.71 2003/10/25 23:10:44 n0body Exp $
+//     $Id: missile.h,v 1.72 2003/12/06 04:47:45 mr-russ Exp $
 
 #ifndef __MISSILE_H__
 #define __MISSILE_H__
@@ -162,9 +162,12 @@
 **             field where the missile hits.  A value of 2  would mean that
 **             the damage for that particular missile would be dealt for a 
range
 **             of 1 around the impact spot. All fields that aren't the center
-**             get only 50% of the damage.
-**             @note Can this value be higher? 3 (3x3 area with 25%),
-**             4 (4x4 area with 12.5%)! Yes, but is currently not written.
+**             get only 1/SpashFactor of the damage. Fields 2 away get
+**             1/(SplashFactor*2), and following...
+**
+**     MissileType::SplashFactor
+**
+**             Determines The Splash damage divisor, see Range
 **
 **     MissileType::ImpactName
 **
@@ -414,6 +417,7 @@
     int                Speed;                  /// missile speed
 
     int                Range;                  /// missile damage range
+    int                SplashFactor;           /// missile splash divisor
     char*      ImpactName;             /// impact missile-type name
     MissileType*ImpactMissile;         /// missile produces an impact
     char*      SmokeName;              /// impact missile-type name
Index: stratagus/src/missile/ccl_missile.c
diff -u stratagus/src/missile/ccl_missile.c:1.43 
stratagus/src/missile/ccl_missile.c:1.44
--- stratagus/src/missile/ccl_missile.c:1.43    Sun Nov 30 23:07:43 2003
+++ stratagus/src/missile/ccl_missile.c Fri Dec  5 23:47:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_missile.c,v 1.43 2003/12/01 04:07:43 jsalmon3 Exp $
+//     $Id: ccl_missile.c,v 1.44 2003/12/06 04:47:45 mr-russ Exp $
 
 //@{
 
@@ -91,6 +91,8 @@
     }
 
     mtype->NumDirections = 1;
+    // Ensure we don't divide by zero.
+    mtype->SplashFactor = 100;
     //
     // Parse the arguments, already the new tagged format.
     //
@@ -149,9 +151,11 @@
            free(mtype->ImpactName);
            mtype->SmokeName = gh_scm2newstr(gh_car(list), NULL);
        } else if (gh_eq_p(value, gh_symbol2scm("can-hit-owner"))) {
-           mtype->CanHitOwner = gh_scm2bool(gh_car(list));
+           mtype->CanHitOwner = 1;
        } else if (gh_eq_p(value, gh_symbol2scm("friendly-fire"))) {
-           mtype->FriendlyFire = gh_scm2bool(gh_car(list));
+           mtype->FriendlyFire = 1;
+       } else if (gh_eq_p(value, gh_symbol2scm("splash-factor"))) {
+           mtype->SplashFactor = gh_scm2int(gh_car(list));;
        } else {
            // FIXME: this leaves a half initialized missile-type
            errl("Unsupported tag", value);
@@ -256,9 +260,11 @@
            free(mtype->ImpactName);
            mtype->SmokeName = strdup(LuaToString(l, j + 1));
        } else if (!strcmp(value, "can-hit-owner")) {
-           mtype->CanHitOwner = LuaToBoolean(l, j + 1);
+           mtype->CanHitOwner = 1;
        } else if (!strcmp(value, "friendly-fire")) {
-           mtype->FriendlyFire = LuaToBoolean(l, j + 1);
+           mtype->FriendlyFire = 1;
+       } else if (!strcmp(value, "splash-factor")) {
+           mtype->SplashFactor = LuaToNumber(l, j + 1);
        } else {
            // FIXME: this leaves a half initialized missile-type
            lua_pushfstring(l, "Unsupported tag: %s", value);
Index: stratagus/src/missile/missile.c
diff -u stratagus/src/missile/missile.c:1.111 
stratagus/src/missile/missile.c:1.112
--- stratagus/src/missile/missile.c:1.111       Tue Dec  2 19:20:54 2003
+++ stratagus/src/missile/missile.c     Fri Dec  5 23:47:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: missile.c,v 1.111 2003/12/03 00:20:54 mr-russ Exp $
+//     $Id: missile.c,v 1.112 2003/12/06 04:47:45 mr-russ Exp $
 
 //@{
 
@@ -1007,6 +1007,7 @@
     Unit* table[UnitMax];
     int n;
     int i;
+    int splash;
 
     DebugCheck(missile == NULL);
     DebugCheck(missile->Type == NULL);
@@ -1084,14 +1085,13 @@
        //      NOTE: perhaps this should be come a property of the missile.
        //
        if (CanTarget(missile->SourceUnit->Type, goal->Type)) {
-           // We are attacking the nearest field of the unit
-           if (x < goal->X || y < goal->Y ||
-                   x >= goal->X + goal->Type->TileWidth ||
-                   y >= goal->Y + goal->Type->TileHeight) {
-               MissileHitsGoal(missile, goal, 2);
+           splash = MapDistanceToUnit(x, y, goal);
+           if (splash) {
+               splash *= missile->Type->SplashFactor;
            } else {
-               MissileHitsGoal(missile, goal, 1);
+               splash = 1;
            }
+           MissileHitsGoal(missile, goal, splash);
        }
     }
     //
@@ -1106,7 +1106,8 @@
                if (i == 0 && n == 0) {
                    MissileHitsWall(missile, x + i, y + n, 1);
                } else {
-                   MissileHitsWall(missile, x + i, y + n, 2);
+                   MissileHitsWall(missile, x + i, y + n, 
+                       MapDistance(x, y, i, n) * missile->Type->SplashFactor);
                }
            }
        }
@@ -1335,7 +1336,7 @@
 
     DebugCheck(file == NULL);
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.111 
2003/12/03 00:20:54 mr-russ Exp $\n\n");
+    CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.112 
2003/12/06 04:47:45 mr-russ Exp $\n\n");
 
     //
     // Original number to internal missile-type name.
@@ -1384,6 +1385,7 @@
        CLprintf(file, " 'sleep %d", mtype->Sleep);
        CLprintf(file, " 'speed %d", mtype->Speed);
        CLprintf(file, " 'range %d", mtype->Range);
+       CLprintf(file, " 'splash-factor", mtype->SplashFactor);
        if (mtype->ImpactMissile) {
            CLprintf(file, "\n  'impact-missile '%s", 
mtype->ImpactMissile->Ident);
        }
@@ -1391,8 +1393,12 @@
            CLprintf(file, "\n  'smoke-missile '%s", 
mtype->SmokeMissile->Ident);
        }
        CLprintf(file, "\n ");
-       CLprintf(file, " 'can-hit-owner #%c", mtype->CanHitOwner ? 't' : 'f');
-       CLprintf(file, " 'friendly-fire #%c", mtype->FriendlyFire ? 't' : 'f');
+       if (mtype->CanHitOwner) {
+           CLprintf(file, " 'can-hit-owner ");
+       }
+       if (mtype->FriendlyFire) {
+           CLprintf(file, " 'friendly-fire");
+       }
        CLprintf(file, ")\n");
     }
 }
@@ -1444,7 +1450,7 @@
 
     DebugCheck(file == NULL);
     CLprintf(file,"\n;;; -----------------------------------------\n");
-    CLprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.111 2003/12/03 
00:20:54 mr-russ Exp $\n\n");
+    CLprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.112 2003/12/06 
04:47:45 mr-russ Exp $\n\n");
 
     for (missiles = GlobalMissiles; *missiles; ++missiles) {
        SaveMissile(*missiles, file);




reply via email to

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