[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus src/action/action_repair.c src/clone/...
From: |
Russell Smith |
Subject: |
[Stratagus-CVS] stratagus src/action/action_repair.c src/clone/... |
Date: |
Sun, 21 Sep 2003 08:13:43 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Russell Smith <address@hidden> 03/09/21 08:13:43
Modified files:
src/action : action_repair.c
src/clone : clone.c unit.c
src/include : unittype.h upgrade_structs.h
src/unit : ccl_unittype.c unittype.c upgrade.c
data/ccl/orc : upgrade.ccl
doc : ChangeLog.html
doc/ccl : research.html unittype.html
Log message:
Made regeneration configurable for all units
Small fix to _RepairCosts. Has correct name for its use.
Small fix to Use backgrounds from first race as well.
Patches:
Index: stratagus/data/ccl/orc/upgrade.ccl
diff -u stratagus/data/ccl/orc/upgrade.ccl:1.16
stratagus/data/ccl/orc/upgrade.ccl:1.17
--- stratagus/data/ccl/orc/upgrade.ccl:1.16 Wed Sep 10 09:53:46 2003
+++ stratagus/data/ccl/orc/upgrade.ccl Sun Sep 21 08:13:42 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: upgrade.ccl,v 1.16 2003/09/10 13:53:46 martinxyz Exp $
+;; $Id: upgrade.ccl,v 1.17 2003/09/21 12:13:42 mr-russ Exp $
;; NOTE: Save can generate this table.
@@ -165,6 +165,7 @@
'(apply-to unit-axethrower) '(apply-to unit-berserker))
(define-modifier 'upgrade-berserker-regeneration
+ '(regeneration-rate 1)
'(apply-to unit-axethrower) '(apply-to unit-berserker))
(define-modifier 'upgrade-ogre-mage
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.541 stratagus/doc/ChangeLog.html:1.542
--- stratagus/doc/ChangeLog.html:1.541 Sun Sep 21 06:03:54 2003
+++ stratagus/doc/ChangeLog.html Sun Sep 21 08:13:42 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.541 2003/09/21 10:03:54 mr-russ Exp $
+---- $Id: ChangeLog.html,v 1.542 2003/09/21 12:13:42 mr-russ Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,7 @@
<li>Future 1.19 Release<p>
<ul>
<li>++
+ <li>Made regeneration available to all units (from Russell Smith).
<li>Made damage display missile configurable in ccl (from Russell Smith).
<li>Made explode-when-killed define a missile (from Russell Smith).
<li>Fixed bug: did not save improve-production (from Russell Smith).
Index: stratagus/doc/ccl/research.html
diff -u stratagus/doc/ccl/research.html:1.13
stratagus/doc/ccl/research.html:1.14
--- stratagus/doc/ccl/research.html:1.13 Wed Sep 10 11:33:43 2003
+++ stratagus/doc/ccl/research.html Sun Sep 21 08:13:42 2003
@@ -219,6 +219,8 @@
<dd>Change the hit points of all units of the unit-types given with
'(apply-to ...).
</dd>
+ <dt>'(regeneration-rate N)</dt>
+ <dd>amount of HP a unit gains per seconds</dt>
<dt>'(time-cost N)</dt>
<dd>Change the time costs (research time or build time) of all unit-types
or upgrade-ids given with '(apply-to ...).
@@ -372,7 +374,7 @@
<a href="../../data/ccl/orc/upgrade.ccl"> $LIBARYPATH/ccl/orc/upgrade.ccl</a>
<hr>
-Last changed: $Id: research.html,v 1.13 2003/09/10 15:33:43 martinxyz Exp $<br>
+Last changed: $Id: research.html,v 1.14 2003/09/21 12:13:42 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/doc/ccl/unittype.html
diff -u stratagus/doc/ccl/unittype.html:1.31
stratagus/doc/ccl/unittype.html:1.32
--- stratagus/doc/ccl/unittype.html:1.31 Sun Sep 21 05:31:52 2003
+++ stratagus/doc/ccl/unittype.html Sun Sep 21 08:13:42 2003
@@ -151,6 +151,8 @@
<dt>hp</dt>
<dd>.
</dd>
+<dt>regeneration-rate</dt>
+<dd>amount of HP a unit gains per seconds</dt>
<dt>costs</dt>
<dd>.
</dd>
@@ -368,6 +370,8 @@
<dd></dd>
<dt>points</dt>
<dd></dd>
+<dt>regeneration-rate</dt>
+<dd>amount of HP a unit gains per seconds</dt>
<dt>missile</dt>
<dd></dd>
<dt>corpse</dt>
@@ -610,7 +614,7 @@
<h4>Not Used</h4>
<hr>
-Last changed: $Id: unittype.html,v 1.31 2003/09/21 09:31:52 mr-russ Exp $<br>
+Last changed: $Id: unittype.html,v 1.32 2003/09/21 12:13:42 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/action_repair.c
diff -u stratagus/src/action/action_repair.c:1.53
stratagus/src/action/action_repair.c:1.54
--- stratagus/src/action/action_repair.c:1.53 Sun Sep 14 00:45:52 2003
+++ stratagus/src/action/action_repair.c Sun Sep 21 08:13:41 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_repair.c,v 1.53 2003/09/14 04:45:52 mr-russ Exp $
+// $Id: action_repair.c,v 1.54 2003/09/21 12:13:41 mr-russ Exp $
//@{
@@ -106,7 +106,7 @@
// Check if enough resources are available
//
for (i = 1; i < MaxCosts; ++i) {
- if (player->Resources[i] < goal->Type->_RepairCosts[i]) {
+ if (player->Resources[i] < goal->Type->RepairCosts[i]) {
snprintf(buf,100,"We need more %s for
repair!",DefaultResourceNames[i]);
NotifyPlayer(player, NotifyYellow, unit->X, unit->Y,buf);
if( player->Ai ) {
@@ -129,7 +129,7 @@
//
// Subtract the resources
//
- PlayerSubCosts(player, goal->Type->_RepairCosts);
+ PlayerSubCosts(player, goal->Type->RepairCosts);
}
//
Index: stratagus/src/clone/clone.c
diff -u stratagus/src/clone/clone.c:1.201 stratagus/src/clone/clone.c:1.202
--- stratagus/src/clone/clone.c:1.201 Sat Sep 20 07:00:19 2003
+++ stratagus/src/clone/clone.c Sun Sep 21 08:13:42 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: clone.c,v 1.201 2003/09/20 11:00:19 mr-russ Exp $
+// $Id: clone.c,v 1.202 2003/09/21 12:13:42 mr-russ Exp $
//@{
@@ -1040,8 +1040,7 @@
LoadCursors(PlayerRaces.Name[0]);
InitSettings();
- InitUserInterface(PlayerRaces.Count>1 ? PlayerRaces.Name[1] :
- PlayerRaces.Name[0]);
+ InitUserInterface(PlayerRaces.Name[0]);
LoadUserInterface();
}
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.301 stratagus/src/clone/unit.c:1.302
--- stratagus/src/clone/unit.c:1.301 Sun Sep 21 06:03:56 2003
+++ stratagus/src/clone/unit.c Sun Sep 21 08:13:42 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.301 2003/09/21 10:03:56 mr-russ Exp $
+// $Id: unit.c,v 1.302 2003/09/21 12:13:42 mr-russ Exp $
//@{
@@ -1596,21 +1596,15 @@
**
** @note: We could build a table of all regenerating units reducing cpu
** use.
- ** Any idea how to handle this more general? It whould be nice
- ** to have more units that could regenerate.
*/
global void UnitIncrementHealth(void)
{
Unit** table;
Unit* unit;
- int regeneration;
-
- // FIXME: move to init code! (Can't be done here, load/save!)
- regeneration=UpgradeIdByIdent("upgrade-berserker-regeneration");
for( table=Units; table<Units+NumUnits; table++ ) {
unit=*table;
- if (HitPointRegeneration && unit->HP<unit->Stats->HitPoints) {
+ if (HitPointRegeneration && unit->HP<unit->Stats->HitPoints) {
++unit->HP;
if( 0 ) { // some frames delayed done my color cycling
@@ -1620,10 +1614,11 @@
MustRedraw|=RedrawInfoPanel;
}
}
- if( unit->Type==UnitTypeBerserker
- && unit->HP<unit->Stats->HitPoints
- && UpgradeIdAllowed(unit->Player,regeneration)=='R' ) {
- ++unit->HP; // FIXME: how fast do we regenerate
+ 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 ) {
@@ -3964,7 +3959,7 @@
int InRun, RunStart;
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.301 2003/09/21 10:03:56
mr-russ Exp $\n\n");
+ CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.302 2003/09/21 12:13:42
mr-russ Exp $\n\n");
//
// Local variables
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.110
stratagus/src/include/unittype.h:1.111
--- stratagus/src/include/unittype.h:1.110 Sun Sep 21 05:31:52 2003
+++ stratagus/src/include/unittype.h Sun Sep 21 08:13:42 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.h,v 1.110 2003/09/21 09:31:52 mr-russ Exp $
+// $Id: unittype.h,v 1.111 2003/09/21 12:13:42 mr-russ Exp $
#ifndef __UNITTYPE_H__
#define __UNITTYPE_H__
@@ -172,7 +172,7 @@
** The HP given to a unit each cycle it's repaired.
** If zero, unit cannot be repaired
**
-** UnitType::_RepairCosts[::MaxCosts]
+** UnitType::RepairCosts[::MaxCosts]
**
** Costs per repair cycle to fix a unit.
**
@@ -229,6 +229,10 @@
**
** Piercing damage dealt
**
+** UnitType::_RegenerationRate
+**
+** Regeneration rate in HP per second
+**
** UnitType::WeaponsUpgradable
**
** Weapons could be upgraded
@@ -709,7 +713,7 @@
int _Costs[MaxCosts]; /// How many resources needed
int RepairHP; /// Amount of HP per repair
- int _RepairCosts[MaxCosts]; /// How much it costs to repair
+ int RepairCosts[MaxCosts]; /// How much it costs to repair
int TileWidth; /// Tile size on map width
int TileHeight; /// Tile size on map height
@@ -724,6 +728,7 @@
int Priority; /// Priority value / AI
Treatment
int _BasicDamage; /// Basic damage dealt
int _PiercingDamage; /// Piercing damage dealt
+ int _RegenerationRate; /// HP regeneration HP per sec
int WeaponsUpgradable; /// Weapons could be upgraded
int ArmorUpgradable; /// Armor could be upgraded
// FIXME: original only visual effect, we do more with this!
Index: stratagus/src/include/upgrade_structs.h
diff -u stratagus/src/include/upgrade_structs.h:1.25
stratagus/src/include/upgrade_structs.h:1.26
--- stratagus/src/include/upgrade_structs.h:1.25 Sat Aug 9 16:32:52 2003
+++ stratagus/src/include/upgrade_structs.h Sun Sep 21 08:13:42 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: upgrade_structs.h,v 1.25 2003/08/09 20:32:52 n0body Exp $
+// $Id: upgrade_structs.h,v 1.26 2003/09/21 12:13:42 mr-russ Exp $
#ifndef __UPGRADE_STRUCTS_H__
#define __UPGRADE_STRUCTS_H__
@@ -125,6 +125,7 @@
int PiercingDamage; /// weapon piercing damage
int Speed; /// movement speed
int HitPoints; /// hit points
+ int RegenerationRate; /// HP regeration rate in HP
int Costs[MaxCosts]; /// current costs of the unit
int Level; /// unit level (upgrades)
} UnitStats;
@@ -157,6 +158,7 @@
int Armor; /// armor modifier
int Speed; /// speed modifier (FIXME: not
working)
int HitPoints; /// hit points modifier
+ int RegenerationRate; /// HP regeneration rate modifier
int Costs[MaxCosts]; /// costs modifier
} Modifiers;
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.86
stratagus/src/unit/ccl_unittype.c:1.87
--- stratagus/src/unit/ccl_unittype.c:1.86 Sun Sep 21 05:31:52 2003
+++ stratagus/src/unit/ccl_unittype.c Sun Sep 21 08:13:42 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_unittype.c,v 1.86 2003/09/21 09:31:52 mr-russ Exp $
+// $Id: ccl_unittype.c,v 1.87 2003/09/21 12:13:42 mr-russ Exp $
//@{
@@ -117,6 +117,8 @@
DebugLevel3Fn("Defining unit-type `%s'\n" _C_ str);
type=NewUnitTypeSlot(str);
redefine = 0;
+ //Set some default values
+ type->_RegenerationRate=0;
}
type->NumDirections=8;
@@ -252,6 +254,9 @@
} else if( gh_eq_p(value,gh_symbol2scm("hit-points")) ) {
type->_HitPoints=gh_scm2int(gh_car(list));
list=gh_cdr(list);
+ } else if( gh_eq_p(value,gh_symbol2scm("regeneration-rate")) ) {
+ type->_RegenerationRate=gh_scm2int(gh_car(list));
+ list=gh_cdr(list);
} else if( gh_eq_p(value,gh_symbol2scm("max-mana")) ) {
type->_MaxMana=gh_scm2int(gh_car(list));
if( type->_MaxMana>MaxMana ) {
@@ -395,7 +400,7 @@
while( !gh_null_p(sublist) ) {
value=gh_car(sublist);
sublist=gh_cdr(sublist);
-
type->_RepairCosts[CclGetResourceByName(value)]=gh_scm2int(gh_car(sublist));
+
type->RepairCosts[CclGetResourceByName(value)]=gh_scm2int(gh_car(sublist));
sublist=gh_cdr(sublist);
}
} else if( gh_eq_p(value,gh_symbol2scm("can-target-land")) ) {
@@ -660,6 +665,9 @@
list=gh_cdr(list);
} else if( gh_eq_p(value,gh_symbol2scm("hit-points")) ) {
stats->HitPoints=gh_scm2int(gh_car(list));
+ list=gh_cdr(list);
+ } else if( gh_eq_p(value,gh_symbol2scm("regeneration-rate")) ) {
+ stats->RegenerationRate=gh_scm2int(gh_car(list));
list=gh_cdr(list);
} else if( gh_eq_p(value,gh_symbol2scm("costs")) ) {
sublist=gh_car(list);
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.101 stratagus/src/unit/unittype.c:1.102
--- stratagus/src/unit/unittype.c:1.101 Sun Sep 21 05:34:23 2003
+++ stratagus/src/unit/unittype.c Sun Sep 21 08:13:42 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.c,v 1.101 2003/09/21 09:34:23 mr-russ Exp $
+// $Id: unittype.c,v 1.102 2003/09/21 12:13:42 mr-russ Exp $
//@{
@@ -720,7 +720,7 @@
} else {
CLprintf(file," ");
}
- CLprintf(file,"%s
%d",DefaultResourceNames[i],type->_RepairCosts[i]);
+ CLprintf(file,"%s
%d",DefaultResourceNames[i],type->RepairCosts[i]);
}
}
}
@@ -737,6 +737,7 @@
}
CLprintf(file," 'speed %d\n",type->_Speed);
CLprintf(file," 'hit-points %d\n",type->_HitPoints);
+ CLprintf(file," 'regeneration-rate %d\n",type->_RegenerationRate);
if( all || type->_MaxMana ) {
CLprintf(file," 'max-mana %d\n",type->_MaxMana);
}
@@ -1085,6 +1086,7 @@
CLprintf(file,"'basic-damage %d ",stats->BasicDamage);
CLprintf(file,"'piercing-damage %d ",stats->PiercingDamage);
CLprintf(file,"'hit-points %d\n ",stats->HitPoints);
+ CLprintf(file," 'regeneration-rate %d\n",stats->RegenerationRate);
CLprintf(file,"'costs '(");
for( j=0; j<MaxCosts; ++j ) {
if( j ) {
@@ -1112,7 +1114,7 @@
char **sp;
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.101 2003/09/21
09:34:23 mr-russ Exp $\n\n");
+ CLprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.102 2003/09/21
12:13:42 mr-russ Exp $\n\n");
// Original number to internal unit-type name.
Index: stratagus/src/unit/upgrade.c
diff -u stratagus/src/unit/upgrade.c:1.59 stratagus/src/unit/upgrade.c:1.60
--- stratagus/src/unit/upgrade.c:1.59 Mon Aug 25 07:21:18 2003
+++ stratagus/src/unit/upgrade.c Sun Sep 21 08:13:42 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: upgrade.c,v 1.59 2003/08/25 11:21:18 mr-russ Exp $
+// $Id: upgrade.c,v 1.60 2003/09/21 12:13:42 mr-russ Exp $
//@{
@@ -51,7 +51,7 @@
#include "etlib/hash.h"
-local int AddUpgradeModifierBase(int,int,int,int,int,int,int,int,int*,
+local int AddUpgradeModifierBase(int,int,int,int,int,int,int,int,int,int*,
const char*,const char*,const char*,UnitType*);
local int AddUpgradeModifier(int,int,int,int,int,int,int,int,int*,
const char*,const char*,const char*);
@@ -550,7 +550,7 @@
int p;
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: upgrades $Id: upgrade.c,v 1.59 2003/08/25
11:21:18 mr-russ Exp $\n\n");
+ CLprintf(file,";;; MODULE: upgrades $Id: upgrade.c,v 1.60 2003/09/21
12:13:42 mr-russ Exp $\n\n");
/* remove?
//
@@ -618,6 +618,10 @@
CLprintf(file,"\n '(hit-points %d)"
,UpgradeModifiers[i]->Modifier.HitPoints );
}
+ if( UpgradeModifiers[i]->Modifier.RegenerationRate ) {
+ CLprintf(file,"\n '(regeneration-rate %d)"
+ ,UpgradeModifiers[i]->Modifier.RegenerationRate );
+ }
for( j=0; j<MaxCosts; ++j ) {
if( UpgradeModifiers[i]->Modifier.Costs[j] ) {
@@ -721,6 +725,7 @@
int piercing_damage;
int armor;
int speed;
+ int regeneration_rate;
int hit_points;
int costs[MaxCosts];
char units[UnitTypeMax];
@@ -735,6 +740,7 @@
armor=0;
speed=0;
hit_points=0;
+ regeneration_rate=0;
memset(costs,0,sizeof(costs));
memset(units,'?',sizeof(units));
memset(upgrades,'?',sizeof(upgrades));
@@ -770,6 +776,8 @@
speed=gh_scm2int(gh_cadr(value));
} else if( gh_eq_p(temp,gh_symbol2scm("hit-points")) ) {
hit_points=gh_scm2int(gh_cadr(value));
+ } else if( gh_eq_p(temp,gh_symbol2scm("regeneration-rate")) ) {
+ regeneration_rate=gh_scm2int(gh_cadr(value));
} else if( gh_eq_p(temp,gh_symbol2scm("time-cost")) ) {
costs[0]=gh_scm2int(gh_cadr(value));
} else if( gh_eq_p(temp,gh_symbol2scm("gold-cost")) ) {
@@ -815,7 +823,7 @@
}
AddUpgradeModifierBase(uid,attack_range,sight_range,
- basic_damage,piercing_damage,armor,speed,hit_points,costs,
+
basic_damage,piercing_damage,armor,speed,hit_points,regeneration_rate,costs,
units,upgrades,apply_to,convert_to);
return SCM_UNSPECIFIED;
@@ -1027,7 +1035,7 @@
*/
local int AddUpgradeModifierBase(int uid,int attack_range,int sight_range,
int basic_damage,int piercing_damage,int armor,int speed,
- int hit_points,int* costs,const char* af_units,
+ int hit_points,int regeneration_rate, int* costs,const char* af_units,
const char* af_upgrades,const char* apply_to,UnitType* convert_to)
{
int i;
@@ -1048,6 +1056,7 @@
um->Modifier.Armor = armor;
um->Modifier.Speed = speed;
um->Modifier.HitPoints = hit_points;
+ um->Modifier.RegenerationRate = regeneration_rate;
for( i=0; i<MaxCosts; ++i ) {
um->Modifier.Costs[i] = costs[i];
@@ -1424,6 +1433,7 @@
UnitTypes[z]->Stats[pn].Armor += um->Modifier.Armor;
UnitTypes[z]->Stats[pn].Speed += um->Modifier.Speed;
UnitTypes[z]->Stats[pn].HitPoints += um->Modifier.HitPoints;
+ UnitTypes[z]->Stats[pn].RegenerationRate +=
um->Modifier.RegenerationRate;
// upgrade costs :)
for (j = 0; j < MaxCosts; ++j) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus src/action/action_repair.c src/clone/...,
Russell Smith <=