[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus data/ccl/human/units.ccl src/clone/cc...
From: |
Crestez Leonard |
Subject: |
[Stratagus-CVS] stratagus data/ccl/human/units.ccl src/clone/cc... |
Date: |
Mon, 22 Sep 2003 15:13:08 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Crestez Leonard <address@hidden> 03/09/22 15:13:08
Modified files:
data/ccl/human : units.ccl
src/clone : ccl_spell.c spells.c
src/include : spells.h
Added files:
data/ccl : spells.ccl
Log message:
Small stuff in spells, and forgot to add spells.ccl
Patches:
Index: stratagus/data/ccl/human/units.ccl
diff -u stratagus/data/ccl/human/units.ccl:1.38
stratagus/data/ccl/human/units.ccl:1.39
--- stratagus/data/ccl/human/units.ccl:1.38 Mon Sep 22 06:39:11 2003
+++ stratagus/data/ccl/human/units.ccl Mon Sep 22 15:13:08 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: units.ccl,v 1.38 2003/09/22 10:39:11 n0body Exp $
+;; $Id: units.ccl,v 1.39 2003/09/22 19:13:08 n0body Exp $
;;=============================================================================
;; Define unit-types.
@@ -230,6 +230,13 @@
'right-attack
'can-attack
'can-target-land 'can-target-sea 'can-target-air
+ 'can-cast-spell '(
+ spell-fireball
+ spell-slow
+ spell-flame-shield
+ spell-invisibility
+ spell-polymorph
+ spell-blizzard)
'land-unit
'coward
'organic
Index: stratagus/src/clone/ccl_spell.c
diff -u stratagus/src/clone/ccl_spell.c:1.1 stratagus/src/clone/ccl_spell.c:1.2
--- stratagus/src/clone/ccl_spell.c:1.1 Mon Sep 22 10:54:30 2003
+++ stratagus/src/clone/ccl_spell.c Mon Sep 22 15:13:08 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_spell.c,v 1.1 2003/09/22 14:54:30 n0body Exp $
+// $Id: ccl_spell.c,v 1.2 2003/09/22 19:13:08 n0body Exp $
//@{
/*----------------------------------------------------------------------------
@@ -87,8 +87,8 @@
;; Summon "UnitType",
;; Whirlwind (ttl #n)
;; } )
-;; 'SoundWhenCasted "SoundConfig"
-;; 'MissileWhenCasted "MissileType"
+;; 'sound-when-casted "SoundConfig"
+;; 'missile-when-casted "MissileType"
;; 'condition '( {
;; Enemypresence (#t range #n), //
enemy in range
;; DurationEffect (#t flag #f_flag value #n), //
"f_flag" < #n
@@ -123,124 +123,6 @@
// **************************************************************************
/**
-** Parse the New Showname for spell.
-** list = "ShowName"
-*/
-local void ccl_spell_showname(const char *id, SCM list, SpellType *spelltype)
-{
- char *str = NULL;
-
- assert (id != NULL);
- assert (spelltype != NULL);
-
- str = gh_scm2newstr(list, NULL);
- if (spelltype->Name != NULL && strcmp(spelltype->Name, str)) {
- // warn user
- DebugLevel3Fn("Redefinition in spell-type '%s' : %s : '%s' -> '%s'\n"
- _C_ spelltype->IdentName _C_ id _C_ spelltype->Name _C_ str);
- }
- free(spelltype->Name);
- spelltype->Name = str;
-}
-
-/**
-** Parse the New Manacost for spell.
-** list = #n
-*/
-local void ccl_spell_manacost(const char *id, SCM list, SpellType *spelltype)
-{
- int manacost;
-
- assert (id != NULL);
- assert (spelltype != NULL);
-
- manacost = gh_scm2int(list);
- if (spelltype->ManaCost != -1 && spelltype->ManaCost != manacost)
- {// warning user
- DebugLevel3Fn("Redefinition in spell-type '%s' : %s : '%d' -> '%d'\n"
- _C_ spelltype->IdentName _C_ id _C_
spelltype->ManaCost _C_ manacost);
- }
- spelltype->ManaCost = manacost;
-}
-
-/**
-** Parse the New range for spell.
-** list = #n
-*/
-local void ccl_spell_range(const char *id, SCM list, SpellType *spelltype)
-{
- int range;
-
- assert (id != NULL);
- assert (spelltype != NULL);
-
- range = gh_scm2int(list);
- if (spelltype->Range != 0 && spelltype->Range != range) {
- DebugLevel3Fn("Redefinition in spell-type '%s' : %s : '%d' -> '%d'\n"
- _C_ spelltype->IdentName _C_ id _C_ spelltype->Range _C_ range);
- }
- spelltype->Range = range;
-}
-
-/**
-** Parse the target for spell.
-** list = #target
-** @note FIXME : Usefull ? depend of Spell Action, yes for self...
-*/
-local void ccl_spell_target(const char *id, SCM list, SpellType *spelltype)
-{
- struct {
- const char *ident;
- TargetType e;
- } correspondance[] = {
- {"none", TargetNone},
- {"self", TargetSelf},
- {"unit", TargetUnit},
- {"position", TargetPosition},
- { NULL, 0}};
- TargetType which_sort_of_target;
- int i;
-
- assert (id != NULL);
- assert (spelltype != NULL);
-
- which_sort_of_target = spelltype->which_sort_of_target;
- for (i = 0; correspondance[i].ident != NULL; i++) {
- if (gh_eq_p(list, gh_symbol2scm((char *) correspondance[i].ident))) {
- spelltype->which_sort_of_target = correspondance[i].e;
- break;
- }
- }
-
- if (correspondance[i].ident == NULL) {
- errl("Unsupported tag", list);
- spelltype->which_sort_of_target = -1;
- return ;
- }
-// Redefinition.
- if (which_sort_of_target != spelltype->which_sort_of_target
- && which_sort_of_target != TargetNone) {
- const char *s1 = NULL;
- const char *s2 = NULL;
-
- for (i = 0; correspondance[i].ident != NULL; i++) {
- if (which_sort_of_target == correspondance[i].e) {
- s1 = correspondance[i].ident;
- continue;
- }
- if (spelltype->which_sort_of_target == correspondance[i].e) {
- s2 = correspondance[i].ident;
- continue;
- }
- }
- if (s1 != NULL) {
- DebugLevel3Fn("Redefinition in spell-type '%s' : %s : '%s' ->
'%s'\n"
- _C_ spelltype->IdentName _C_ id _C_ s1 _C_ s2);
- }
- }
-}
-
-/**
** Parse the sound for spell.
** list = "soundname"
*/
@@ -253,7 +135,7 @@
assert (spell != NULL);
NewSoundName = gh_scm2newstr(list,NULL);
- OldSoundName = spell->SoundWhenCasted.Name;
+ OldSoundName = spell->SoundWhenCast.Name;
if (OldSoundName && strcmp(NewSoundName,OldSoundName)) {
DebugLevel3Fn("Redefinition of sound when casted for '%s' : %s : '%s'
-> '%s'\n"
@@ -261,17 +143,17 @@
}
//Free the old stuff.
- free(spell->SoundWhenCasted.Sound);
+ free(spell->SoundWhenCast.Sound);
free(OldSoundName);
- spell->SoundWhenCasted.Sound = SoundIdForName(NewSoundName);
- if (spell->SoundWhenCasted.Sound == NULL) {
+ spell->SoundWhenCast.Sound = SoundIdForName(NewSoundName);
+ if (spell->SoundWhenCast.Sound == NULL) {
DebugLevel3Fn("in spell-type '%s' : %s : sound '%s' does not exist\n"
_C_ spell->IdentName _C_ id _C_ NewSoundName);
free(NewSoundName);
NewSoundName=NULL;
}
- spell->SoundWhenCasted.Name=NewSoundName;
+ spell->SoundWhenCast.Name=NewSoundName;
}
/*
@@ -308,7 +190,7 @@
** For blizzard and DeathAndDecay.
** list = fields #n shards #n damage #n
*/
-local char ccl_spell_action_blizzard(const char *SpellName, SCM list,
t_SpellAction *spellaction)
+local char ccl_spell_action_blizzard(const char *SpellName, SCM list,
SpellActionType *spellaction)
{
int fields;
int shards;
@@ -350,9 +232,9 @@
"fields <= 0 or shards <= 0 have no sense");
return 0;
}
- spellaction->blizzard.fields = fields;
- spellaction->blizzard.shards = shards;
- spellaction->blizzard.damage = damage;
+ spellaction->Blizzard.Fields = fields;
+ spellaction->Blizzard.Shards = shards;
+ spellaction->Blizzard.Damage = damage;
return 1;
}
@@ -360,7 +242,7 @@
** For fireball and Runes.
** list = 'ttl #n 'damage #n
*/
-local char ccl_spell_action_fireball(const char *SpellName, SCM list,
t_SpellAction *spellaction)
+local char ccl_spell_action_fireball(const char *SpellName, SCM list,
SpellActionType *spellaction)
{
int ttl;
int damage;
@@ -397,8 +279,8 @@
"TTL <= 0 have no sense");
return 0;
}
- spellaction->fireball.TTL = ttl;
- spellaction->fireball.damage = damage;
+ spellaction->Fireball.TTL = ttl;
+ spellaction->Fireball.Damage = damage;
return 1;
}
@@ -406,7 +288,7 @@
** For flameshield and whirlwind.
** list = 'ttl #n
*/
-local char ccl_spell_action_flameshield(const char *SpellName, SCM list,
t_SpellAction *spellaction)
+local char ccl_spell_action_flameshield(const char *SpellName, SCM list,
SpellActionType *spellaction)
{
int ttl;
SCM value;
@@ -432,7 +314,7 @@
"ttl <= 0 have no sense");// ttl must be positive.
return 0;
}
- spellaction->flameshield.TTL = ttl;
+ spellaction->FlameShield.TTL = ttl;
return 1;
}
@@ -442,7 +324,7 @@
** One or more.
** @todo Free when an error occurs. Do a function to do this.
*/
-local char ccl_spell_action_haste(const char *SpellName, SCM list,
t_SpellAction *spellaction)
+local char ccl_spell_action_haste(const char *SpellName, SCM list,
SpellActionType *spellaction)
{
struct {
const char *id;
@@ -509,7 +391,7 @@
** HP positive for healing, negative for dealing damage.
** list = (HP #n)
*/
-local char ccl_spell_action_healing(const char *SpellName, SCM list,
t_SpellAction *spellaction)
+local char ccl_spell_action_healing(const char *SpellName, SCM list,
SpellActionType *spellaction)
{
assert(SpellName);
assert(spellaction != NULL);
@@ -546,7 +428,7 @@
** For invisibility and unholyarmor.
** list = flag #f_inv value #n missile "missile-name"
*/
-local char ccl_spell_action_invisibility(const char *SpellName, SCM list,
t_SpellAction *spellaction)
+local char ccl_spell_action_invisibility(const char *SpellName, SCM list,
SpellActionType *spellaction)
{
const struct {
const char *id;
@@ -630,7 +512,7 @@
** list = ("unittypename")
** @note WARNING, use for other functions than summon, see
ccl_spell_action.
*/
-local char ccl_spell_action_summon(const char *SpellName, SCM list,
t_SpellAction *spellaction)
+local char ccl_spell_action_summon(const char *SpellName, SCM list,
SpellActionType *spellaction)
{
assert(SpellName);
assert(spellaction != NULL);
@@ -661,7 +543,7 @@
** @param list : argument for spell.
** @param spellaction : What we want modify.
*/
-typedef char f_ccl_action(const char *spellname, SCM list, t_SpellAction
*spellaction);
+typedef char f_ccl_action(const char *spellname, SCM list, SpellActionType
*spellaction);
/*
** Parse the action for spell.
@@ -706,7 +588,7 @@
DebugLevel3Fn("%s %d\n" _C_ parser[i].id _C_
sizeof(*spell->SpellAction));
list = gh_cdr(list);
free(spell->SpellAction);// FIXME : Use a destructor : free
pointer, list..
- spell->SpellAction = (t_SpellAction *) malloc(sizeof
(*spell->SpellAction));
+ spell->SpellAction = (SpellActionType *) malloc(sizeof
(*spell->SpellAction));
memset(spell->SpellAction, 0, sizeof(*spell->SpellAction));
if (parser[i].f(spell->IdentName, gh_car(list),
spell->SpellAction) == 0) {
// Error in function : it is to the function to warn..
@@ -1067,32 +949,6 @@
&spell->AutoCast->Condition_generic,&spell->AutoCast->Condition_specific);
}
-/*
-** Constructor of SpellType.
-*/
-local SpellType * NewSpellType(char *identname)
-{
- assert(identname != NULL);
-
- SpellType *spell = (SpellType *) malloc(sizeof(*spell));
-
- spell->Ident = SpellTypeCount++;
- spell->IdentName = strdup(identname);
- spell->Name = NULL;
- spell->which_sort_of_target = -1;
- spell->f = NULL;
- spell->SpellAction = NULL;
- spell->Range = 0;
- spell->ManaCost = (unsigned int) -1;
- spell->Condition_generic = NULL;
- spell->Condition_specific = NULL;
- spell->AutoCast = NULL;
- spell->SoundWhenCasted.Name = NULL;
- spell->SoundWhenCasted.Sound = NULL;
- spell->Missile = NULL;
- return spell;
-}
-
/**
** Parse Spell.
**
@@ -1101,53 +957,70 @@
local SCM CclDefineSpell(SCM list)
{
char *identname;
- SpellType *spelltype;
+ SpellType *spell;
SCM value;
- int i;
- static struct {
- const char *ident;
- f_ccl_spell *f;
- } parser[] = {
- {"showname", ccl_spell_showname},
- {"manacost", ccl_spell_manacost},
- {"range", ccl_spell_range},
- {"target", ccl_spell_target},
- {"action", ccl_spell_action},
- {"condition", ccl_spell_condition},
- {"autocast", ccl_spell_autocast},
- {"SoundWhenCasted", ccl_spell_soundwhencast},
- {"MissileWhenCasted", ccl_spell_missilewhencast},
- {NULL, NULL}
- };
identname = gh_scm2newstr(gh_car(list), NULL);
list = gh_cdr(list);
- spelltype = SpellTypeByIdent(identname);
- if (spelltype != NULL) {
+ spell = SpellTypeByIdent(identname);
+ if (spell != NULL) {
DebugLevel0Fn("Redefining spell-type `%s'\n" _C_ identname);
free(identname);
} else {
- spelltype = NewSpellType(identname);
- free(identname);
- SpellTypeTable =
realloc(SpellTypeTable,(1+SpellTypeCount)*sizeof(SpellType)); // FIXME
- SpellTypeTable[spelltype->Ident] = *spelltype;
- spelltype = &SpellTypeTable[spelltype->Ident];
+ SpellTypeTable =
realloc(SpellTypeTable,(1+SpellTypeCount)*sizeof(SpellType));
+ spell = &SpellTypeTable[SpellTypeCount++];
+ memset(spell,0,sizeof(SpellType));
+ spell->Ident=SpellTypeCount-1;
+ spell->IdentName=identname;
}
while (!gh_null_p(list)) {
value = gh_car(list);
list = gh_cdr(list);
- for (i = 0; parser[i].ident != NULL; i++) {
- if (gh_eq_p(value, gh_symbol2scm((char *) parser[i].ident))) {
- parser[i].f(parser[i].ident, gh_car(list), spelltype);
- list = gh_cdr(list);
- break;
+ if (gh_eq_p(value,gh_symbol2scm("showname"))) {
+ if (spell->Name) {
+ free(spell->Name);
}
- }
- if (parser[i].ident == NULL) {
+ spell->Name=gh_scm2newstr(gh_car(list), NULL);
+ list=gh_cdr(list);
+ } else if (gh_eq_p(value,gh_symbol2scm("manacost"))) {
+ spell->ManaCost=gh_scm2int(gh_car(list));
+ list=gh_cdr(list);
+ } else if (gh_eq_p(value,gh_symbol2scm("range"))) {
+ spell->Range=gh_scm2int(gh_car(list));
+ list=gh_cdr(list);
+ } else if (gh_eq_p(value,gh_symbol2scm("target"))) {
+ value=gh_car(list);
+ if (gh_eq_p(value,gh_symbol2scm("none"))) {
+ spell->Target=TargetNone;
+ } else if (gh_eq_p(value,gh_symbol2scm("self"))) {
+ spell->Target=TargetSelf;
+ } else if (gh_eq_p(value,gh_symbol2scm("unit"))) {
+ spell->Target=TargetSelf;
+ } else if (gh_eq_p(value,gh_symbol2scm("position"))) {
+ spell->Target=TargetPosition;
+ } else {
+ errl("Unsupported spell target type tag",value);
+ }
+ list=gh_cdr(list);
+ } else if (gh_eq_p(value,gh_symbol2scm("action"))) {
+ ccl_spell_action("action",gh_car(list),spell);
+ list=gh_cdr(list);
+ } else if (gh_eq_p(value,gh_symbol2scm("condition"))) {
+ ccl_spell_condition("condition",gh_car(list),spell);
+ list=gh_cdr(list);
+ } else if (gh_eq_p(value,gh_symbol2scm("autocast"))) {
+ ccl_spell_autocast("autocast",gh_car(list),spell);
+ list=gh_cdr(list);
+ } else if (gh_eq_p(value,gh_symbol2scm("sound-when-cast"))) {
+ ccl_spell_soundwhencast("sound-when-cast",gh_car(list),spell);
+ list=gh_cdr(list);
+ } else if (gh_eq_p(value,gh_symbol2scm("missile-when-cast"))) {
+ ccl_spell_missilewhencast("missile-when-cast",gh_car(list),spell);
+ list=gh_cdr(list);
+ } else {
errl("Unsupported tag", value);
}
}
-// FIXME : Verify spell is completed.
return SCM_UNSPECIFIED;
}
@@ -1180,17 +1053,17 @@
CLprintf(file," 'showname \"%s\"\n",spell->Name);
CLprintf(file," 'manacost %d\n",spell->ManaCost);
CLprintf(file," 'range %d\n",spell->Range);
- if (spell->SoundWhenCasted.Name) {
- CLprintf(file," 'SoundWhenCasted
\"%s\"\n",spell->SoundWhenCasted.Name);
+ if (spell->SoundWhenCast.Name) {
+ CLprintf(file," 'sound-when-cast
\"%s\"\n",spell->SoundWhenCast.Name);
}
if (spell->Missile) {
- CLprintf(file," 'MissileWhenCasted
\"%s\"\n",spell->Missile->Ident);
+ CLprintf(file," 'missile-when-casted
\"%s\"\n",spell->Missile->Ident);
}
//
// Target type.
//
CLprintf(file," 'target '");
- switch (spell->which_sort_of_target) {
+ switch (spell->Target) {
case TargetSelf:
CLprintf(file,"self\n");
break;
@@ -1213,13 +1086,13 @@
CLprintf(file," 'action");
if (spell->f==CastBlizzard) {
CLprintf(file," '(Blizzard (fields %d shards %d damage %d) )\n",
- spell->SpellAction->blizzard.fields,
- spell->SpellAction->blizzard.shards,
- spell->SpellAction->blizzard.damage);
+ spell->SpellAction->Blizzard.Fields,
+ spell->SpellAction->Blizzard.Shards,
+ spell->SpellAction->Blizzard.Damage);
} else if (spell->f==CastFireball) {
CLprintf(file," '(FireBall (ttl %d damage %d) )\n",
- spell->SpellAction->fireball.TTL,
- spell->SpellAction->fireball.damage);
+ spell->SpellAction->Fireball.TTL,
+ spell->SpellAction->Fireball.Damage);
} else if (spell->f==CastHolyVision) {
CLprintf(file," '(HolyVision \"%s\"
)\n",spell->SpellAction->holyvision.revealer->Ident);
} else if (spell->f==CastHealing) {
@@ -1281,14 +1154,14 @@
spell->SpellAction->raisedead.skeleton->Ident);
} else if (spell->f==CastFlameShield) {
CLprintf(file," '(FlameShield (ttl %d) )\n",
- spell->SpellAction->flameshield.TTL);
+ spell->SpellAction->FlameShield.TTL);
} else if (spell->f==CastRunes) {
CLprintf(file," '(Runes (ttl %d damage %d) )\n",
spell->SpellAction->runes.TTL,
spell->SpellAction->runes.damage);
} else if (spell->f==CastCircleOfPower) {
CLprintf(file," '(CircleOfPower \"%s\")\n",
- spell->SpellAction->circleofpower.goal->Ident);
+ spell->SpellAction->SpawnPortal.PortalType->Ident);
} else if (spell->f==CastDeathCoil) {
CLprintf(file," '(DeathCoil)\n");
// FIXME: more?
@@ -1300,6 +1173,7 @@
//
// FIXME: Save conditions
//
+
//
// FIXME: Save autocast and AI info
//
Index: stratagus/src/clone/spells.c
diff -u stratagus/src/clone/spells.c:1.95 stratagus/src/clone/spells.c:1.96
--- stratagus/src/clone/spells.c:1.95 Mon Sep 22 06:40:51 2003
+++ stratagus/src/clone/spells.c Mon Sep 22 15:13:08 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: spells.c,v 1.95 2003/09/22 10:40:51 n0body Exp $
+// $Id: spells.c,v 1.96 2003/09/22 19:13:08 n0body Exp $
/*
** And when we cast our final spell
@@ -505,9 +505,9 @@
int dy;
int i;
- fields = spell->SpellAction->blizzard.fields;
- shards = spell->SpellAction->blizzard.shards;
- damage = spell->SpellAction->blizzard.damage;
+ fields = spell->SpellAction->Blizzard.Fields;
+ shards = spell->SpellAction->Blizzard.Shards;
+ damage = spell->SpellAction->Blizzard.Damage;
while (fields--)
{
// FIXME : radius configurable...
@@ -543,7 +543,7 @@
caster->Refs++;
}
}
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
caster->Mana -= spell->ManaCost;
return caster->Mana > spell->ManaCost;
}
@@ -562,15 +562,15 @@
global int CastCircleOfPower(Unit* caster, const SpellType* spell
__attribute__((unused)),
Unit* target __attribute__((unused)), int x, int y)
{
- assert(caster);
- assert(spell);
- assert(spell->SpellAction);
- assert(spell->SpellAction->circleofpower.goal);
+ assert(caster);
+ assert(spell);
+ assert(spell->SpellAction);
+ assert(spell->SpellAction->SpawnPortal.PortalType);
// assert(x in range, y in range);
// FIXME: vladi: cop should be placed only on explored land
Unit *cop = NULL;
- UnitType *ucop = spell->SpellAction->circleofpower.goal;
+ UnitType *ucop = spell->SpellAction->SpawnPortal.PortalType;
cop = caster->Goal;
if (cop)
@@ -622,9 +622,9 @@
int dy;
int i;
- fields = spell->SpellAction->deathanddecay.fields;
- shards = spell->SpellAction->deathanddecay.shards;
- damage = spell->SpellAction->deathanddecay.damage;
+ fields = spell->SpellAction->DeathAndDecay.Fields;
+ shards = spell->SpellAction->DeathAndDecay.Shards;
+ damage = spell->SpellAction->DeathAndDecay.Damage;
while (fields--)
{
do {
@@ -648,7 +648,7 @@
caster->Refs++;
}
}
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
caster->Mana -= spell->ManaCost;
return (caster->Mana > spell->ManaCost);
}
@@ -679,7 +679,7 @@
caster->Mana -= spell->ManaCost;
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
mis = MakeMissile(spell->Missile,
sx * TileSizeX + TileSizeX / 2, sy * TileSizeY + TileSizeY / 2,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
@@ -734,10 +734,10 @@
x = x * TileSizeX + TileSizeX / 2;
y = y * TileSizeY + TileSizeY / 2;
caster->Mana -= spell->ManaCost;
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
missile = MakeMissile(spell->Missile, sx, sy, x, y);
- missile->State = spell->SpellAction->fireball.TTL - (dist - 1) * 2;
- missile->TTL = spell->SpellAction->fireball.TTL;
+ missile->State = spell->SpellAction->Fireball.TTL - (dist - 1) * 2;
+ missile->TTL = spell->SpellAction->Fireball.TTL;
missile->Controller = SpellFireballController;
missile->SourceUnit = caster;
RefsDebugCheck(!caster->Refs || caster->Destroyed);
@@ -771,12 +771,12 @@
// get mana cost
caster->Mana -= spell->ManaCost;
- target->FlameShield = spell->SpellAction->flameshield.TTL;
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ target->FlameShield = spell->SpellAction->FlameShield.TTL;
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
for (i = 0; i < 5; i++)
{
mis = MakeMissile(spell->Missile, 0, 0, 0, 0);
- mis->TTL = spell->SpellAction->flameshield.TTL + i * 7;
+ mis->TTL = spell->SpellAction->FlameShield.TTL + i * 7;
mis->TargetUnit = target;
mis->Controller = SpellFlameShieldController;
RefsDebugCheck(!target->Refs || target->Destroyed);
@@ -880,7 +880,7 @@
}
}
CheckUnitToBeDrawn(target);
- PlayGameSound(spell->SoundWhenCasted.Sound,MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound,MaxSampleVolume);
MakeMissile(spell->Missile,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2 );
@@ -942,7 +942,7 @@
LetUnitDie(target);
}
}
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
MakeMissile(spell->Missile,
x * TileSizeX + TileSizeX / 2, y * TileSizeY +
TileSizeY / 2,
x * TileSizeX + TileSizeX / 2, y * TileSizeY +
TileSizeY / 2);
@@ -981,7 +981,7 @@
MapMarkUnitSight(target);
target->TTL = GameCycle + target->Type->DecayRate * 6 * CYCLES_PER_SECOND;
CheckUnitToBeDrawn(target);
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
return 0;
}
@@ -1039,7 +1039,7 @@
}
CheckUnitToBeDrawn(target);
}
- PlayGameSound(spell->SoundWhenCasted.Sound,MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound,MaxSampleVolume);
MakeMissile(spell->Missile,
x * TileSizeX + TileSizeX / 2, y * TileSizeY +
TileSizeY / 2,
x * TileSizeX + TileSizeX / 2, y * TileSizeY +
TileSizeY / 2 );
@@ -1093,7 +1093,7 @@
MakeUnitAndPlace(x, y, type, Players + PlayerNumNeutral);
}
caster->Mana -= spell->ManaCost;
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
MakeMissile(spell->Missile,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2 );
@@ -1151,7 +1151,7 @@
corpses = &(*corpses)->Next;
}
}
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
MakeMissile(spell->Missile,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2 );
@@ -1185,7 +1185,7 @@
int oldy = y;
int i;
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
for (i = 0; i < 5; i++)
{
x = oldx + xx[i];
@@ -1237,7 +1237,7 @@
target->TTL = GameCycle + target->Type->DecayRate * 6 * CYCLES_PER_SECOND;
CheckUnitToBeDrawn(target);
- PlayGameSound(spell->SoundWhenCasted.Sound,MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound,MaxSampleVolume);
MakeMissile(spell->Missile,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2 );
@@ -1266,7 +1266,7 @@
Missile *mis = NULL;
caster->Mana -= spell->ManaCost;
- PlayGameSound(spell->SoundWhenCasted.Sound, MaxSampleVolume);
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
mis = MakeMissile(spell->Missile,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
@@ -1567,7 +1567,7 @@
assert(spell->AutoCast != NULL);
assert(caster != NULL);
- switch (spell->which_sort_of_target)
+ switch (spell->Target)
{
case TargetSelf :
{
@@ -1777,7 +1777,7 @@
if (!caster->Type->CanCastSpell
|| !caster->Type->CanCastSpell[spell->Ident]
- || (spell->which_sort_of_target == TargetUnit && target == NULL)) {
+ || (spell->Target == TargetUnit && target == NULL)) {
return 0;
}
Index: stratagus/src/include/spells.h
diff -u stratagus/src/include/spells.h:1.20 stratagus/src/include/spells.h:1.21
--- stratagus/src/include/spells.h:1.20 Mon Sep 22 06:40:52 2003
+++ stratagus/src/include/spells.h Mon Sep 22 15:13:08 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: spells.h,v 1.20 2003/09/22 10:40:52 n0body Exp $
+// $Id: spells.h,v 1.21 2003/09/22 19:13:08 n0body Exp $
#ifndef __SPELLS_H__
#define __SPELLS_H__
@@ -96,74 +96,74 @@
{
// FIXME rename structure more properly.
// TTL's below are in ticks: approx: 500=13sec, 1000=25sec, 2000=50sec
-// FIXME use TTL or nb_of_second ?
- struct {
- int fields; /// FIXME doc
- int shards; /// FIXME doc
- int damage; /// damage
- } blizzard;
-
- struct {
- UnitType *goal; /// FIXME: compact to Summon
- } circleofpower;
-
- struct {
- int fields; /// FIXME doc
- int shards; /// FIXME doc
- int damage; /// damage
- } deathanddecay;
-
- struct {
- int TTL; /// time to live (ticks)
- int damage; /// Damage.
- } fireball;
-
- struct {
- int TTL; /// time to live (ticks)
- } flameshield;
-
- struct s_haste {
- int flag; /// flag for know what variable to set.
- int value; /// the set value. (nb sec).
- struct s_haste *next; /// Other variable to set ?
- } haste;
-
- struct {
- int HP; /// HP gain for manacost.(negative for
exorcism)
- } healing;
-
- struct {
- UnitType *revealer; /// Type of unit to be summoned:
(unit-revealer).
- } holyvision;
-
- struct {
- int flag; /// unholyarmor or invisibility.
- int value; /// the set value. (nb sec).
- MissileType *missile; /// missile for the target.
- } invisibility;
-
- struct {
- UnitType *unit; /// The new form :)
- } polymorph;
-
- struct {
- UnitType *skeleton; /// The unit to spwan from corpses
- } raisedead;
-
- struct {
- int TTL; /// time to live (ticks)
- int damage; /// Damage.
- } runes;
-
- struct {
- UnitType *unittype; /// Type of unit to be summoned.
- } summon;
-
- struct {
- int TTL; /// time to live (ticks)
- // FIXME: more configurations
- } whirlwind;
-} t_SpellAction;
+// FIXME use TTL, as in TICKS to live
+ struct {
+ int Fields; /// FIXME doc
+ int Shards; /// FIXME doc
+ int Damage; /// damage
+ } Blizzard;
+
+ struct {
+ UnitType *PortalType; /// The unit type spawned
+ } SpawnPortal;
+
+ struct {
+ int Fields; /// FIXME doc
+ int Shards; /// FIXME doc
+ int Damage; /// damage
+ } DeathAndDecay;
+
+ struct {
+ int TTL; /// time to live (ticks)
+ int Damage; /// Damage.
+ } Fireball;
+
+ struct {
+ int TTL; /// time to live (ticks)
+ } FlameShield;
+
+ struct s_haste {
+ int flag; /// flag for know what variable to set.
+ int value; /// the set value. (nb sec).
+ struct s_haste *next; /// Other variable to set ?
+ } haste;
+
+ struct {
+ int HP; /// HP gain for manacost.(negative for exorcism)
+ } healing;
+
+ struct {
+ UnitType *revealer; /// Type of unit to be summoned:
(unit-revealer).
+ } holyvision;
+
+ struct {
+ int flag; /// unholyarmor or invisibility.
+ int value; /// the set value. (nb sec).
+ MissileType *missile; /// missile for the target.
+ } invisibility;
+
+ struct {
+ UnitType *unit; /// The new form :)
+ } polymorph;
+
+ struct {
+ UnitType *skeleton; /// The unit to spwan from corpses
+ } raisedead;
+
+ struct {
+ int TTL; /// time to live (ticks)
+ int damage; /// Damage.
+ } runes;
+
+ struct {
+ UnitType *unittype; /// Type of unit to be summoned.
+ } summon;
+
+ struct {
+ int TTL; /// time to live (ticks)
+ // FIXME: more configurations
+ } whirlwind;
+} SpellActionType;
/*
** *******************
@@ -194,12 +194,10 @@
/*
** Specific conditions.
*/
-typedef int f_specific_condition(const struct s_Conditions
*condition,
-
const Unit* caster,
-
const Unit* target, int x, int y);
+typedef int f_specific_condition(const struct s_Conditions *condition,
+ const Unit* caster,const Unit* target,int x,int y);
-typedef int f_generic_condition(const struct s_Conditions
*condition,
- const
Unit* caster);
+typedef int f_generic_condition(const struct s_Conditions
*condition,const Unit* caster);
/**
@@ -208,24 +206,24 @@
** @todo Move more parameters into this structure.
*/
typedef struct s_Conditions {
- int expectvalue; ///<
Value expected (condition is true or false)
- union {
- f_specific_condition *specific; ///<
Fonction that evaluate the condition.
- f_generic_condition *generic;
///< Fonction that evaluate the condition.
- } f;
- union {
- int range; ///< range
-// struct {
-// t_SpecificConditions c1;
-// t_SpecificConditions c2;
-// } or; //
- unsigned int flag; ///< flag
- struct {
- unsigned int flag;
- unsigned int ttl;
- } durationeffect; ///< durationeffect
- } u;
- struct s_Conditions *next; ///< for list.
+ int expectvalue; /// Value expected (function
expected result, true or false)
+ union {
+ f_specific_condition *specific; /// Evaluation Function for the
condition.
+ f_generic_condition *generic; /// Evaluation Function for the
condition.
+ } f;
+ union {
+ int range; /// range
+// struct {
+// t_SpecificConditions c1;
+// t_SpecificConditions c2;
+// } or; //
+ unsigned int flag; ///< flag
+ struct {
+ unsigned int flag;
+ unsigned int ttl;
+ } durationeffect; ///< durationeffect
+ } u;
+ struct s_Conditions *next; ///< for list.
} t_Conditions;
@@ -261,10 +259,10 @@
char *Name; /// Spell name shown by the
engine
// Spell Specifications
- TargetType which_sort_of_target; /// for identify what sort of target is
valid.
- f_spell *f; /// function to cast the spell.
- t_SpellAction *SpellAction; /// More arguments for spell (damage,
delay, additional sounds...).
- int Range; /// Max range of the target.
+ TargetType Target; /// Targetting information. See
TargetType.
+ f_spell *f; /// function to cast the spell.
+ SpellActionType *SpellAction; /// More arguments for spell (damage,
delay, additional sounds...).
+ int Range; /// Max range of the target.
unsigned int ManaCost; /// required mana for each cast
t_Conditions *Condition_generic; /// Conditions to cast the spell.
(generic (no test for each target))
@@ -273,8 +271,8 @@
t_AutoCast *AutoCast; /// AutoCast
information
// Uses for graphics and sounds
- SoundConfig SoundWhenCasted; /// sound played if casted
- MissileType *Missile; /// missile fired on cast
+ SoundConfig SoundWhenCast; /// sound played if cast
+ MissileType *Missile; /// missile fired on cast
} SpellType;
/*----------------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus data/ccl/human/units.ccl src/clone/cc...,
Crestez Leonard <=