[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus data/ccl/missiles.ccl data/ccl/spells...
From: |
Crestez Leonard |
Subject: |
[Stratagus-CVS] stratagus data/ccl/missiles.ccl data/ccl/spells... |
Date: |
Mon, 20 Oct 2003 07:08:57 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Crestez Leonard <address@hidden> 03/10/20 07:08:56
Modified files:
data/ccl : missiles.ccl spells.ccl
doc : ChangeLog.html
doc/ccl : magic.html
src/clone : ccl_spell.c spells.c
src/include : missile.h
src/missile : ccl_missile.c missile.c
Log message:
Made lots of missile changes. Removed Missile::Controller.
Patches:
Index: stratagus/data/ccl/missiles.ccl
diff -u stratagus/data/ccl/missiles.ccl:1.35
stratagus/data/ccl/missiles.ccl:1.36
--- stratagus/data/ccl/missiles.ccl:1.35 Mon Oct 13 07:21:05 2003
+++ stratagus/data/ccl/missiles.ccl Mon Oct 20 07:08:52 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: missiles.ccl,v 1.35 2003/10/13 11:21:05 n0body Exp $
+;; $Id: missiles.ccl,v 1.36 2003/10/20 11:08:52 n0body Exp $
;; NOTE: the missiles could be sorted for races, but did this make sense?
@@ -39,147 +39,147 @@
;;
(define-missile-type 'missile-lightning
- 'file "missiles/lightning.png" 'size '(32 32) 'frames 30
+ 'file "missiles/lightning.png" 'size '(32 32) 'frames 30 'num-directions 5
'class 'missile-class-point-to-point-with-hit 'sleep 1 'speed 16 'range 1
'draw-level 50)
(define-missile-type 'missile-griffon-hammer
- 'file "missiles/gryphon_hammer.png" 'size '(32 32) 'frames 15
+ 'file "missiles/gryphon_hammer.png" 'size '(32 32) 'frames 15
'num-directions 5
'impact-sound "fireball hit"
- 'class 'missile-class-point-to-point-3bounces 'sleep 1 'speed 16 'range 2
+ 'class 'missile-class-point-to-point-bounce 'num-bounces 3 'sleep 1 'speed
16 'range 2
'draw-level 50 'impact-missile 'missile-explosion)
(define-missile-type 'missile-dragon-breath
- 'file "missiles/dragon_breath.png" 'size '(32 32) 'frames 5
+ 'file "missiles/dragon_breath.png" 'size '(32 32) 'frames 5 'num-directions 5
'impact-sound "fireball hit"
- 'class 'missile-class-point-to-point-3bounces 'sleep 1 'speed 16 'range 2
+ 'class 'missile-class-point-to-point-bounce 'num-bounces 3 'sleep 1 'speed
16 'range 2
'draw-level 70 'impact-missile 'missile-explosion)
(define-missile-type 'missile-fireball
- 'file "missiles/fireball.png" 'size '(32 32) 'frames 5
+ 'file "missiles/fireball.png" 'size '(32 32) 'frames 5 'num-directions 5
'impact-sound "fireball hit"
- 'draw-level 50 'class 'missile-class-point-to-point 'sleep 1 'speed 16
'range 1
+ 'draw-level 50 'class 'missile-class-point-to-point-bounce 'num-bounces 5
'sleep 1 'speed 16 'range 1
'impact-missile 'missile-explosion)
(define-missile-type 'missile-flame-shield
- 'file "missiles/flame_shield.png" 'size '(32 48) 'frames 6
+ 'file "missiles/flame_shield.png" 'size '(32 48) 'frames 6 'num-directions 1
'draw-level 50 'class 'missile-class-flame-shield 'sleep 2 'speed 4 'range 1)
(define-missile-type 'missile-blizzard
- 'file "missiles/blizzard.png" 'size '(32 32) 'frames 4
- 'class 'missile-class-blizzard 'sleep 2 'speed 8 'range 1
- 'draw-level 100 'impact-missile 'missile-blizzard-hit)
+ 'file "missiles/blizzard.png" 'size '(32 32) 'frames 4 'num-directions 1
+ 'class 'missile-class-point-to-point-with-hit 'sleep 2 'speed 8 'range 1
+ 'draw-level 100)
(define-missile-type 'missile-death-and-decay
- 'file "missiles/death_and_decay.png" 'size '(32 32) 'frames 8
- 'draw-level 100 'class 'missile-class-death-decay 'sleep 1 'speed 0 'range 1)
+ 'file "missiles/death_and_decay.png" 'size '(32 32) 'frames 8
'num-directions 1
+ 'draw-level 100 'class 'missile-class-stay 'sleep 1 'speed 0 'range 1)
(define-missile-type 'missile-big-cannon
- 'file "missiles/big_cannon.png" 'size '(16 16) 'frames 20
+ 'file "missiles/big_cannon.png" 'size '(16 16) 'frames 20 'num-directions 5
'draw-level 50 'impact-sound "explosion"
'class 'missile-class-point-to-point 'sleep 1 'speed 16 'range 2
'impact-missile 'missile-cannon-tower-explosion)
(define-missile-type 'missile-exorcism
- 'file "missiles/exorcism.png" 'size '(48 48) 'frames 10
+ 'file "missiles/exorcism.png" 'size '(48 48) 'frames 10 'num-directions 1
'draw-level 50 'class 'missile-class-point-to-point 'sleep 1 'speed 16
'range 1)
(define-missile-type 'missile-heal-effect
- 'file "missiles/heal_effect.png" 'size '(48 48) 'frames 10
- 'draw-level 50 'class 'missile-class-stay-with-delay 'sleep 1 'speed 16
'range 1)
+ 'file "missiles/heal_effect.png" 'size '(48 48) 'frames 10 'num-directions 1
+ 'draw-level 50 'class 'missile-class-stay 'sleep 1 'speed 16 'range 1)
(define-missile-type 'missile-touch-of-death
- 'file "missiles/touch_of_death.png" 'size '(32 32) 'frames 30
+ 'file "missiles/touch_of_death.png" 'size '(32 32) 'frames 30
'num-directions 5
'draw-level 50 'class 'missile-class-point-to-point-with-hit 'sleep 1 'speed
16 'range 1)
(define-missile-type 'missile-rune
- 'file "missiles/rune.png" 'size '(16 16) 'frames 4
+ 'file "missiles/rune.png" 'size '(16 16) 'frames 4 'num-directions 1
'draw-level 20 'class 'missile-class-land-mine 'sleep 5 'speed 16 'range 1
- 'impact-missile 'missile-explosion)
+ 'impact-missile 'missile-explosion 'can-hit-owner #t)
(define-missile-type 'missile-whirlwind
- 'file "missiles/tornado.png" 'size '(56 56) 'frames 4
- 'draw-level 50 'class 'missile-class-whirlwind 'sleep 2 'speed 2 'range 1)
+ 'file "missiles/tornado.png" 'size '(56 56) 'frames 4 'num-directions 1
+ 'draw-level 50 'class 'missile-class-whirlwind 'sleep 1 'speed 2 'range 1)
(define-missile-type 'missile-catapult-rock
- 'file "missiles/catapult_rock.png" 'size '(32 32) 'frames 15
+ 'file "missiles/catapult_rock.png" 'size '(32 32) 'frames 15 'num-directions
5
'impact-sound "explosion"
'draw-level 50 'class 'missile-class-parabolic 'sleep 1 'speed 16 'range 2
'impact-missile 'missile-impact)
(define-missile-type 'missile-ballista-bolt
- 'file "missiles/ballista_bolt.png" 'size '(64 64) 'frames 5
+ 'file "missiles/ballista_bolt.png" 'size '(64 64) 'frames 5 'num-directions 5
'draw-level 50 'impact-sound "explosion"
'class 'missile-class-parabolic 'sleep 1 'speed 16 'range 2
'impact-missile 'missile-impact)
(define-missile-type 'missile-arrow
- 'file "missiles/arrow.png" 'size '(40 40) 'frames 5
+ 'file "missiles/arrow.png" 'size '(40 40) 'frames 5 'num-directions 5
'draw-level 50 'impact-sound "bow hit"
'class 'missile-class-point-to-point 'sleep 1 'speed 32 'range 0)
(define-missile-type 'missile-axe
- 'file "missiles/axe.png" 'size '(32 32) 'frames 15
+ 'file "missiles/axe.png" 'size '(32 32) 'frames 15 'num-directions 5
'impact-sound "bow hit"
'draw-level 50 'class 'missile-class-point-to-point 'sleep 1 'speed 32
'range 0)
(define-missile-type 'missile-submarine-missile
- 'file "missiles/submarine_missile.png" 'size '(40 40) 'frames 5
+ 'file "missiles/submarine_missile.png" 'size '(40 40) 'frames 5
'num-directions 5
'impact-sound "explosion"
'draw-level 50 'class 'missile-class-point-to-point 'sleep 1 'speed 16
'range 1
'impact-missile 'missile-impact)
(define-missile-type 'missile-turtle-missile
- 'file "missiles/turtle_missile.png" 'size '(40 40) 'frames 5
+ 'file "missiles/turtle_missile.png" 'size '(40 40) 'frames 5 'num-directions
5
'draw-level 50 'impact-sound "explosion"
'class 'missile-class-point-to-point 'sleep 1 'speed 16 'range 1
'impact-missile 'missile-impact)
(define-missile-type 'missile-small-fire
- 'file "missiles/small_fire.png" 'size '(32 48) 'frames 6
+ 'file "missiles/small_fire.png" 'size '(32 48) 'frames 6 'num-directions 1
'draw-level 45 'class 'missile-class-fire 'sleep 8 'speed 16 'range 1)
(define-missile-type 'missile-big-fire
- 'file "missiles/big_fire.png" 'size '(48 48) 'frames 10
+ 'file "missiles/big_fire.png" 'size '(48 48) 'frames 10 'num-directions 1
'draw-level 45 'class 'missile-class-fire 'sleep 8 'speed 16 'range 1)
(define-missile-type 'missile-impact
- 'file "missiles/ballista-catapult_impact.png" 'size '(48 48) 'frames 10
- 'draw-level 50 'class 'missile-class-stay-with-delay 'sleep 1 'speed 16
'range 1)
+ 'file "missiles/ballista-catapult_impact.png" 'size '(48 48) 'frames 10
'num-directions 1
+ 'draw-level 50 'class 'missile-class-stay 'sleep 1 'speed 16 'range 1)
(define-missile-type 'missile-normal-spell
- 'file "missiles/normal_spell.png" 'size '(32 32) 'frames 6
- 'draw-level 50 'class 'missile-class-stay-with-delay 'sleep 5 'speed 0
'range 1)
+ 'file "missiles/normal_spell.png" 'size '(32 32) 'frames 6 'num-directions 1
+ 'draw-level 50 'class 'missile-class-stay 'sleep 5 'speed 0 'range 1)
(define-missile-type 'missile-explosion
- 'file "missiles/explosion.png" 'size '(64 64) 'frames 20
- 'draw-level 50 'class 'missile-class-stay-with-delay 'sleep 1 'speed 16
'range 1)
+ 'file "missiles/explosion.png" 'size '(64 64) 'frames 20 'num-directions 1
+ 'draw-level 50 'class 'missile-class-stay 'sleep 1 'speed 16 'range 1)
(define-missile-type 'missile-small-cannon
- 'file "missiles/cannon.png" 'size '(32 32) 'frames 15
+ 'file "missiles/cannon.png" 'size '(32 32) 'frames 15 'num-directions 5
'draw-level 50 'impact-sound "explosion"
'class 'missile-class-parabolic 'sleep 1 'speed 16 'range 1
'impact-missile 'missile-cannon-explosion)
(define-missile-type 'missile-cannon-explosion
- 'file "missiles/cannon_explosion.png" 'size '(32 32) 'frames 4
- 'draw-level 50 'class 'missile-class-stay-with-delay 'sleep 1 'speed 16
'range 1)
+ 'file "missiles/cannon_explosion.png" 'size '(32 32) 'frames 4
'num-directions 1
+ 'draw-level 50 'class 'missile-class-stay 'sleep 1 'speed 16 'range 1)
(define-missile-type 'missile-cannon-tower-explosion
- 'file "missiles/cannon-tower_explosion.png" 'size '(32 32) 'frames 4
- 'draw-level 50 'class 'missile-class-stay-with-delay 'sleep 1 'speed 16
'range 1)
+ 'file "missiles/cannon-tower_explosion.png" 'size '(32 32) 'frames 4
'num-directions 1
+ 'draw-level 50 'class 'missile-class-stay 'sleep 1 'speed 16 'range 1)
(define-missile-type 'missile-daemon-fire
- 'file "missiles/daemon_fire.png" 'size '(32 32) 'frames 15
+ 'file "missiles/daemon_fire.png" 'size '(32 32) 'frames 15 'num-directions 5
'draw-level 70 'impact-sound "fireball hit"
'class 'missile-class-point-to-point 'sleep 1 'speed 16 'range 1)
(define-missile-type 'missile-green-cross
- 'file "missiles/green_cross.png" 'size '(32 32) 'frames 4
+ 'file "missiles/green_cross.png" 'size '(32 32) 'frames 4 'num-directions 1
'draw-level 150 'class 'missile-class-cycle-once 'sleep 1 'speed 16 'range 1)
(define-missile-type 'missile-red-cross
- 'file "missiles/red_cross.png" 'size '(32 32) 'frames 4
+ 'file "missiles/red_cross.png" 'size '(32 32) 'frames 4 'num-directions 1
'draw-level 5 'class 'missile-class-cycle-once 'sleep 1 'speed 16 'range 1)
(define-missile-type 'missile-none
@@ -187,23 +187,19 @@
'class 'missile-class-none 'sleep 1 'speed 16 'range 1)
(define-missile-type 'missile-blizzard-hit
- 'file "missiles/blizzard.png" 'size '(32 32) 'frames 4
- 'draw-level 60 'class 'missile-class-stay-with-delay 'sleep 2 'speed 8
'range 1)
+ 'file "missiles/blizzard.png" 'size '(32 32) 'frames 4 'num-directions 1
+ 'draw-level 60 'class 'missile-class-stay 'sleep 2 'speed 8 'range 1)
(define-missile-type 'missile-death-coil
- 'file "missiles/touch_of_death.png" 'size '(32 32) 'frames 30
- 'draw-level 50 'class 'missile-class-point-to-point 'sleep 1 'speed 16
'range 1)
+ 'file "missiles/touch_of_death.png" 'size '(32 32) 'frames 30
'num-directions 5
+ 'draw-level 50 'class 'missile-class-death-coil 'sleep 1 'speed 16 'range 1)
(define-missile-type 'missile-hit
'size '(15 15) 'draw-level 150
'class 'missile-class-hit 'sleep 1 'speed 1 'range 16)
-(define-missile-type 'missile-custom
- 'size '(32 32) 'draw-level 50
- 'class 'missile-class-custom 'sleep 1 'speed 16 'range 1)
-
(define-missile-type 'missile-critter-explosion
- 'file "missiles/catapult_rock.png" 'size '(32 32) 'frames 15
+ 'file "missiles/catapult_rock.png" 'size '(32 32) 'frames 15 'num-directions
5
'impact-sound "explosion" 'draw-level 50
'class 'missile-class-hit 'sleep 1 'speed 16 'range 2
'impact-missile 'missile-impact 'can-hit-owner #t)
Index: stratagus/data/ccl/spells.ccl
diff -u stratagus/data/ccl/spells.ccl:1.9 stratagus/data/ccl/spells.ccl:1.10
--- stratagus/data/ccl/spells.ccl:1.9 Mon Oct 13 07:21:06 2003
+++ stratagus/data/ccl/spells.ccl Mon Oct 20 07:08:53 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: spells.ccl,v 1.9 2003/10/13 11:21:06 n0body Exp $
+;; $Id: spells.ccl,v 1.10 2003/10/20 11:08:53 n0body Exp $
;; For documentation see stratagus/doc/ccl/ccl.html ;; FIXME write and move
doc.
@@ -306,7 +306,7 @@
'manacost 100
'range 10
'target 'position ;; FIXME position or organic target
- 'action '(fireball ttl 10000 damage 10000 )
+ 'action '(death-coil damage 50)
; 'condition '(UnitTypeflag (true organic))
'sound-when-cast "death coil"
'missile-when-cast "missile-death-coil"
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.555 stratagus/doc/ChangeLog.html:1.556
--- stratagus/doc/ChangeLog.html:1.555 Fri Oct 17 02:04:27 2003
+++ stratagus/doc/ChangeLog.html Mon Oct 20 07:08:54 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.555 2003/10/17 06:04:27 mr-russ Exp $
+---- $Id: ChangeLog.html,v 1.556 2003/10/20 11:08:54 n0body Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,7 @@
<li>Future 2.00 Release<p>
<ul>
<li>++
+ <li>Made lots of missile changes, removed Missile::Controller.
<li>Fixed Bug #6006: Crash saving building not built yet (from Russell
Smith).
<li>Fixed Bug: Failed Building Crashes Engine (from Russell Smith).
<li>Remove old Master Server Code, began implementing a new one (from
Russell Smith).
Index: stratagus/doc/ccl/magic.html
diff -u stratagus/doc/ccl/magic.html:1.1 stratagus/doc/ccl/magic.html:1.2
--- stratagus/doc/ccl/magic.html:1.1 Sun Oct 12 12:25:17 2003
+++ stratagus/doc/ccl/magic.html Mon Oct 20 07:08:55 2003
@@ -98,25 +98,59 @@
<dt>class</dt>
<dd>Various missiles can have wierd behaviours. This tag is followed by an
identifier that specifies some of that behaviour. Here is a list of currently
-supported missile classes:
-<ul>
- <li>missile-class-none
- <li>missile-class-point-to-point
- <li>missile-class-point-to-point-with-delay
- <li>missile-class-stay-with-delay
- <li>missile-class-point-to-point-3bounces
- <li>missile-class-fireball
- <li>missile-class-flame-shield
- <li>missile-class-blizzard
- <li>missile-class-death-decay
- <li>missile-class-whirlwind
- <li>missile-class-cycle-once
- <li>missile-class-point-to-point-with-hit
- <li>missile-class-fire
- <li>missile-class-custom
- <li>missile-class-hit
-</ul>
-FIXME: add documentation for each missile behaviour
+supported missile classes:<p>
+<dl>
+ <dt>missile-class-none</dt>
+ <dd>Missile does nothing. Shouldn't really be used.
+ </dd>
+ <dt>missile-class-point-to-point </dt>
+ <dd>Missile flies straight to destination animating on the way
+ </dd>
+ <dt>missile-class-point-to-point-with-hit </dt>
+ <dd>Missile flies straight to destination keeping the first frame and
+ the finishes the animation when hitting
+ </dd>
+ <dt>missile-class-point-to-point-cycle-once </dt>
+ <dd>Missile flies straight to destination and animates ONCE from first
+ to last and back again. To be used for catapult and the like to make a
+ projectile bigger mid-way to the target
+ </dd>
+ <dt>missile-class-point-to-point-bounce</dt>
+ <dl>Missile flies straight to destination, and the "bounces" by hitting
+ every other tile on the path onward. This will also add one aditional
flag:
+ <dt>num-bounces</dt>
+ <dd>This if folowed by an integer, representing the number of
bounces(hits)</dd>
+ </dl>
+ <dt>missile-class-stay</dt>
+ <dd>Missile will just go through it's animation once and vanish. booooring.
+ </dd>
+ <dt>missile-class-cycle-once </dt>
+ <dd>Missile will just go through it's animation from start to and and back
+ again, then vanish.
+ </dd>
+ <dt>missile-class-fire </dt>
+ <dd>Missile is used for fire. More documentation?
+ </dd>
+ <dt>missile-class-parabolic</dt>
+ <dd>Missile flies to destination with a parabolic path. It used the same
+ animation as cycle-once
+ </dd>
+ <dt>missile-class-land-mine</dt>
+ <dd>Missile is a landmine, it will sit quietly and wait for someone to step
+ on it. You can use time-to-live as a timeout.<b>FIXME more configurable</b>
+ </dd>
+ <dt>missile-class-whirlwind </dt>
+ <dd>Missile for the whirlwind effect <b>FIXME more configurable</b>
+ </dd>
+ <dt>missile-class-flame-shield </dt>
+ <dd>Missile rotates around target unit and damages everything it touches
+ <b>FIXME more configurable</b>
+ </dd>
+ <dt>missile-class-death-coil</dt>
+ <dd>Missile is death coil, will drain health from target or enemy units
+ in the area and feed it to the caster.<b>FIXME more configurable</b>
+ </dd>
+</dl>
</dd>
<a name="delay-define-missile-type"></a>
<dt>delay</dt>
@@ -391,7 +425,7 @@
<hr>
-Last changed: $Id: magic.html,v 1.1 2003/10/12 16:25:17 n0body Exp $<br>
+Last changed: $Id: magic.html,v 1.2 2003/10/20 11:08:55 n0body 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/clone/ccl_spell.c
diff -u stratagus/src/clone/ccl_spell.c:1.16
stratagus/src/clone/ccl_spell.c:1.17
--- stratagus/src/clone/ccl_spell.c:1.16 Mon Oct 13 07:21:06 2003
+++ stratagus/src/clone/ccl_spell.c Mon Oct 20 07:08:55 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_spell.c,v 1.16 2003/10/13 11:21:06 n0body Exp $
+// $Id: ccl_spell.c,v 1.17 2003/10/20 11:08:55 n0body Exp $
//@{
/*----------------------------------------------------------------------------
@@ -122,6 +122,19 @@
errl("Unsupported fireball tag", value);
}
}
+ } else if (gh_eq_p(value, gh_symbol2scm("death-coil"))) {
+ spellaction->CastFunction = CastDeathCoil;
+ while (!gh_null_p(list)) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ if (gh_eq_p(value, gh_symbol2scm("damage"))) {
+ spellaction->Data.Fireball.Damage = gh_scm2int(gh_car(list));
+ list = gh_cdr(list);
+ } else {
+ errl("Unsupported death-coil tag", value);
+ }
+ }
+
} else if (gh_eq_p(value, gh_symbol2scm("runes"))) {
spellaction->CastFunction = CastRunes;
while (!gh_null_p(list)) {
Index: stratagus/src/clone/spells.c
diff -u stratagus/src/clone/spells.c:1.109 stratagus/src/clone/spells.c:1.110
--- stratagus/src/clone/spells.c:1.109 Mon Oct 13 07:21:07 2003
+++ stratagus/src/clone/spells.c Mon Oct 20 07:08:56 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: spells.c,v 1.109 2003/10/13 11:21:07 n0body Exp $
+// $Id: spells.c,v 1.110 2003/10/20 11:08:56 n0body Exp $
/*
** And when we cast our final spell
@@ -238,6 +238,7 @@
sx * TileSizeX + TileSizeX / 2, sy * TileSizeY + TileSizeY / 2,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
mis->SourceUnit = caster;
+ mis->Damage = spell->Action->Data.Fireball.Damage;
RefsDebugCheck(!caster->Refs || caster->Destroyed);
caster->Refs++;
if (target) {
@@ -245,7 +246,6 @@
RefsDebugCheck(!target->Refs || target->Destroyed);
target->Refs++;
}
- mis->Controller = SpellDeathCoilController;
return 0;
}
@@ -266,7 +266,6 @@
Missile* missile;
int sx;
int sy;
- int dist;
DebugCheck(!caster);
DebugCheck(!spell);
@@ -276,23 +275,15 @@
missile = NULL;
// NOTE: fireball can be casted on spot
- sx = caster->X;
- sy = caster->Y;
- dist = MapDistance(sx, sy, x, y);
- DebugCheck(!dist);
- x += ((x - sx) * 10) / dist;
- y += ((y - sy) * 10) / dist;
- sx = sx * TileSizeX + TileSizeX / 2;
- sy = sy * TileSizeY + TileSizeY / 2;
+ sx = caster->X * TileSizeX + TileSizeX / 2;
+ sy = caster->Y * TileSizeY + TileSizeY / 2;
x = x * TileSizeX + TileSizeX / 2;
y = y * TileSizeY + TileSizeY / 2;
caster->Mana -= spell->ManaCost;
PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
missile = MakeMissile(spell->Missile, sx, sy, x, y);
- missile->State = spell->Action->Data.Fireball.TTL - (dist - 1) * 2;
- missile->TTL = spell->Action->Data.Fireball.TTL;
+// missile->TTL = spell->Action->Data.Fireball.TTL;
missile->Damage = spell->Action->Data.Fireball.Damage;
- missile->Controller = SpellFireballController;
missile->SourceUnit = caster;
RefsDebugCheck(!caster->Refs || caster->Destroyed);
caster->Refs++;
@@ -303,7 +294,7 @@
** Cast flame shield.
**
** @param caster Unit that casts the spell
-** @param spell Spell-type pointer
+* @param spell Spell-type pointer
** @param target Target unit that spell is addressed to
** @param x X coord of target spot when/if target does not exist
** @param y Y coord of target spot when/if target does not exist
@@ -333,7 +324,6 @@
mis = MakeMissile(spell->Missile, 0, 0, 0, 0);
mis->TTL = spell->Action->Data.FlameShield.TTL + i * 7;
mis->TargetUnit = target;
- mis->Controller = SpellFlameShieldController;
mis->Damage = spell->Action->Data.FlameShield.Damage;
RefsDebugCheck(!target->Refs || target->Destroyed);
target->Refs++;
@@ -703,7 +693,6 @@
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
mis->TTL = spell->Action->Data.Whirlwind.TTL;
- mis->Controller = SpellWhirlwindController;
return 0;
}
Index: stratagus/src/include/missile.h
diff -u stratagus/src/include/missile.h:1.68
stratagus/src/include/missile.h:1.69
--- stratagus/src/include/missile.h:1.68 Mon Oct 13 07:21:08 2003
+++ stratagus/src/include/missile.h Mon Oct 20 07:08:56 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.h,v 1.68 2003/10/13 11:21:08 n0body Exp $
+// $Id: missile.h,v 1.69 2003/10/20 11:08:56 n0body Exp $
#ifndef __MISSILE_H__
#define __MISSILE_H__
@@ -119,8 +119,12 @@
** Class of the missile-type, defines the basic effects of the
** missile. Look at the different class identifiers for more
** informations (::_missile_class_, ::MissileClassNone, ...).
-** This isn't used if the missile is handled by
-** Missile::Controller.
+**
+** MissileType::NumBounces
+**
+** This is the number of bounces, and it is only valid with
+** MissileClassBounce. The missile will hit this many times in
+** a row.
**
** MissileType::StartDelay
**
@@ -144,7 +148,7 @@
** move, 1 is the slowest speed and 32 s the fastest supported
** speed. This is how many pixels the missiles moves with each
** animation step. The real use of this member depends on the
-** MissileType::Class or Missile::Controller.
+** MissileType::Class
** @note This is currently only used by the point-to-point
** missiles (::MissileClassPointToPoint, ...). Perhaps we should
** later allow animation scripts for more complex animations.
@@ -207,7 +211,7 @@
** Missile destination on the map in pixels. If
** Missile::X==Missile::DX and Missile::Y==Missile::DY the missile
** stays at its position. But the movement also depends on
-** the Missile::Controller or MissileType::Class.
+** MissileType::Class.
**
** Missile::Type
**
@@ -220,8 +224,7 @@
** to MissileType::SpriteFrames-1. The topmost bit (128) is
** used as flag to mirror the sprites in X direction.
** Animation scripts aren't currently supported for missiles,
-** everything is handled by the MissileType::Class or
-** Missile::Controller.
+** everything is handled by MissileType::Class
** @note If wanted, we can add animation scripts support to the
** engine.
**
@@ -229,6 +232,11 @@
**
** Current state of the missile. Used for a simple state machine.
**
+** Missile::AnimWait
+**
+** Animation wait. Used internally by missile actions, to run the
+** animation in paralel with the rest.
+**
** Missile::Wait
**
** Wait this number of game cycles until the next state or
@@ -240,8 +248,8 @@
** Number of game cycles the missile isn't shown on the map.
** This counts down from MissileType::StartDelay to 0, before this
** happens the missile isn't shown and has no effects.
-** @note This can also be used by MissileType::Class or
-** Missile::Controller for temporary removement of the missile.
+** @note This can also be used by MissileType::Class
+** for temporary removement of the missile.
**
** Missile::SourceUnit
**
@@ -265,7 +273,7 @@
** Time to live in game cycles of the missile, if it reaches zero
** the missile is automatic removed from the map. If -1 the
** missile lives for ever and the lifetime is handled by
-** Missile::Type:MissileType::Class or Missile::Controller.
+** Missile::Type:MissileType::Class
**
** Missile::Controller
**
@@ -342,75 +350,34 @@
** FIXME: We need no class or no controller.
*/
enum _missile_class_ {
- /**
- ** Missile does nothing
- */
+ // Missile does nothing
MissileClassNone,
- /**
- ** Missile flies from x,y to x1,y1
- */
+ // Missile flies from x,y to x1,y1
MissileClassPointToPoint,
- /**
- ** Missile flies from x,y to x1,y1 and stays there for a moment
- */
- MissileClassPointToPointWithDelay,
- /**
- ** Missile don't move, than disappears
- */
- MissileClassStayWithDelay,
- /**
- ** Missile flies from x,y to x1,y1 than bounces three times.
- */
- MissileClassPointToPoint3Bounces,
- /**
- ** Missile flies from x,y to x1,y1 than changes into flame shield
- */
- MissileClassFireball,
- /**
- ** Missile surround x,y
- */
- MissileClassFlameShield,
- /**
- ** Missile appears at x,y, is blizzard
- */
- MissileClassBlizzard,
- /**
- ** Missile appears at x,y, is death and decay
- */
- MissileClassDeathDecay,
- /**
- ** Missile appears at x,y, is whirlwind
- */
- MissileClassWhirlwind,
- /**
- ** Missile appears at x,y, than cycle through the frames up and
- ** down.
- */
- MissileClassCycleOnce,
- /**
- ** Missile flies from x,y to x1,y1 than shows hit animation.
- */
+ // Missile flies from x,y to x1,y1 than shows hit animation.
MissileClassPointToPointWithHit,
- /**
- ** Missile don't move, than checks the source unit for HP.
- */
+ // Missile flies from x,y to x1,y1 and animates ONCE from start to
finish and back
+ MissileClassPointToPointCycleOnce,
+ // Missile flies from x,y to x1,y1 than bounces three times.
+ MissileClassPointToPointBounce,
+ // Missile appears at x,y, does it's anim and vanishes.
+ MissileClassStay,
+ // Missile appears at x,y, then cycle through the frames once.
+ MissileClassCycleOnce,
+ // Missile doesn't move, than checks the source unit for HP.
MissileClassFire,
- /**
- ** Missile is controlled completely by Controller() function.
- */
- MissileClassCustom,
- /**
- ** Missile shows the hit points.
- */
+ // Missile shows the hit points.
MissileClassHit,
- /**
- ** Missile flies from x,y to x1,y1 using a parabolic path
- */
+ // Missile flies from x,y to x1,y1 using a parabolic path
MissileClassParabolic,
- /**
- ** Missile wait on x,1 until a non-air unit comes by, the explodes.
- */
+ // Missile wait on x,y until a non-air unit comes by, the explodes.
MissileClassLandMine,
+ // Missile appears at x,y, is whirlwind
+ MissileClassWhirlwind,
+ // Missile surround x,y
+ MissileClassFlameShield,
+ // Missile is death coil.
+ MissileClassDeathCoil
};
/// Base structure of missile-types
@@ -434,6 +401,7 @@
unsigned FriendlyFire : 1; /// missile can't hit own units
MissileClass Class; /// missile class
+ int NumBounces; /// number of bounces
int StartDelay; /// missile start delay
int Sleep; /// missile sleep
int Speed; /// missile speed
@@ -465,6 +433,7 @@
MissileType*Type; /// missile-type pointer
int SpriteFrame; /// sprite frame counter
int State; /// state
+ int AnimWait; /// Animation wait.
int Wait; /// delay between frames
int Delay; /// delay to showup
@@ -474,7 +443,6 @@
int Damage; /// direct damage that missile
applies
int TTL; /// time to live (ticks) used
for spells
- FuncController *Controller; /// used to controll spells
// Internal use:
int D; /// for point to point missiles
@@ -562,23 +530,20 @@
/// Clean missiles
extern void CleanMissiles(void);
-FuncController SpellDeathCoilController;
-FuncController SpellFireballController;
-FuncController SpellFlameShieldController;
-FuncController SpellRunesController;
-FuncController SpellWhirlwindController;
-
FuncController MissileActionNone;
FuncController MissileActionPointToPoint;
-FuncController MissileActionPointToPointWithDelay;
-FuncController MissileActionStayWithDelay;
-FuncController MissileActionPointToPoint3Bounces;
-FuncController MissileActionCycleOnce;
FuncController MissileActionPointToPointWithHit;
+FuncController MissileActionPointToPointCycleOnce;
+FuncController MissileActionPointToPointBounce;
+FuncController MissileActionStay;
+FuncController MissileActionCycleOnce;
FuncController MissileActionFire;
FuncController MissileActionHit;
FuncController MissileActionParabolic;
FuncController MissileActionLandMine;
+FuncController MissileActionWhirlwind;
+FuncController MissileActionFlameShield;
+FuncController MissileActionDeathCoil;
//@}
Index: stratagus/src/missile/ccl_missile.c
diff -u stratagus/src/missile/ccl_missile.c:1.33
stratagus/src/missile/ccl_missile.c:1.34
--- stratagus/src/missile/ccl_missile.c:1.33 Sun Sep 28 21:16:50 2003
+++ stratagus/src/missile/ccl_missile.c Mon Oct 20 07:08:56 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_missile.c,v 1.33 2003/09/29 01:16:50 jsalmon3 Exp $
+// $Id: ccl_missile.c,v 1.34 2003/10/20 11:08:56 n0body Exp $
//@{
@@ -125,6 +125,8 @@
// FIXME: this leaves a half initialized missile-type
errl("Unsupported class", value);
}
+ } else if (gh_eq_p(value, gh_symbol2scm("num-bounces"))) {
+ mtype->NumBounces = gh_scm2int(gh_car(list));
} else if (gh_eq_p(value, gh_symbol2scm("delay"))) {
mtype->StartDelay = gh_scm2int(gh_car(list));
} else if (gh_eq_p(value, gh_symbol2scm("sleep")) ) {
@@ -257,6 +259,10 @@
DebugCheck(!missile);
missile->State = gh_scm2int(gh_car(list));
list = gh_cdr(list);
+ } else if (gh_eq_p(value, gh_symbol2scm("anim-wait"))) {
+ DebugCheck(!missile);
+ missile->AnimWait = gh_scm2int(gh_car(list));
+ list = gh_cdr(list);
} else if (gh_eq_p(value, gh_symbol2scm("wait"))) {
DebugCheck(!missile);
missile->Wait = gh_scm2int(gh_car(list));
@@ -288,12 +294,6 @@
} else if (gh_eq_p(value, gh_symbol2scm("ttl"))) {
DebugCheck(!missile);
missile->TTL = gh_scm2int(gh_car(list));
- list = gh_cdr(list);
- } else if (gh_eq_p(value, gh_symbol2scm("controller"))) {
- DebugCheck(!missile);
- DebugLevel0Fn("FIXME: no point in reading a pointer value from a
saved game!!\n");
- //missile->Controller = gh_scm2int(gh_car(list));
- missile->Controller = NULL;
list = gh_cdr(list);
} else if (gh_eq_p(value, gh_symbol2scm("data"))) {
SCM sublist;
Index: stratagus/src/missile/missile.c
diff -u stratagus/src/missile/missile.c:1.96
stratagus/src/missile/missile.c:1.97
--- stratagus/src/missile/missile.c:1.96 Sat Oct 18 11:04:26 2003
+++ stratagus/src/missile/missile.c Mon Oct 20 07:08:56 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.c,v 1.96 2003/10/18 15:04:26 jsalmon3 Exp $
+// $Id: missile.c,v 1.97 2003/10/20 11:08:56 n0body Exp $
//@{
@@ -72,24 +72,38 @@
global const char* MissileClassNames[] = {
"missile-class-none",
"missile-class-point-to-point",
- "missile-class-point-to-point-with-delay",
- "missile-class-stay-with-delay",
- "missile-class-point-to-point-3bounces",
- "missile-class-fireball",
- "missile-class-flame-shield",
- "missile-class-blizzard",
- "missile-class-death-decay",
- "missile-class-whirlwind",
- "missile-class-cycle-once",
"missile-class-point-to-point-with-hit",
+ "missile-class-point-to-point-cycle-once",
+ "missile-class-point-to-point-bounce",
+ "missile-class-stay",
+ "missile-class-cycle-once",
"missile-class-fire",
- "missile-class-custom",
"missile-class-hit",
"missile-class-parabolic",
"missile-class-land-mine",
+ "missile-class-whirlwind",
+ "missile-class-flame-shield",
+ "missile-class-death-coil",
NULL
};
+local void (*MissileClassFunctions[])(Missile*) = {
+ MissileActionNone,
+ MissileActionPointToPoint,
+ MissileActionPointToPointWithHit,
+ MissileActionPointToPointCycleOnce,
+ MissileActionPointToPointBounce,
+ MissileActionStay,
+ MissileActionCycleOnce,
+ MissileActionFire,
+ MissileActionHit,
+ MissileActionParabolic,
+ MissileActionLandMine,
+ MissileActionWhirlwind,
+ MissileActionFlameShield,
+ MissileActionDeathCoil
+};
+
/**
** Missile type type definition
*/
@@ -114,7 +128,7 @@
local Missile* GlobalMissiles[MAX_MISSILES]; /// all global missiles on map
local int NumGlobalMissiles; /// currently used missiles
-local Missile* LocalMissiles[MAX_MISSILES * 8]; /// all local missiles
on map
+local Missile* LocalMissiles[MAX_MISSILES*8]; /// all local missiles on map
local int NumLocalMissiles; /// currently used missiles
#ifdef DOXYGEN // no real code, only for document
@@ -222,7 +236,7 @@
// Rehash.
//
for (i = 0; i < NumMissileTypes; ++i) {
- *(MissileType**)hash_add(MissileTypeHash, MissileTypes[i].Ident) =
&MissileTypes[i];
+ *(MissileType**)hash_add(MissileTypeHash,MissileTypes[i].Ident) =
&MissileTypes[i];
}
mtype->CanHitOwner = 0; // defaults
@@ -302,6 +316,7 @@
missile->Type = mtype;
missile->SpriteFrame = 0;
missile->State = 0;
+ missile->AnimWait = 0;
missile->Wait = mtype->Sleep; // initial wait = sleep
missile->Delay = mtype->StartDelay; // initial delay
@@ -310,7 +325,6 @@
missile->Damage = 0;
missile->TargetUnit = NULL;
missile->TTL = -1;
- missile->Controller = NULL;
return missile;
}
@@ -326,7 +340,7 @@
**
** @return created missile.
*/
-global Missile* MakeMissile(MissileType* mtype, int sx, int sy, int dx, int dy)
+global Missile* MakeMissile(MissileType* mtype,int sx,int sy,int dx,int dy)
{
Missile* missile;
@@ -750,7 +764,7 @@
DebugCheck(vp == NULL);
DebugCheck(table == NULL);
//
- // Loop through global missiles, than through locals.
+ // Loop through global missiles, then through locals.
//
flag = 1;
missiles = GlobalMissiles;
@@ -759,9 +773,6 @@
do {
for (; missiles < missiles_end; ++missiles) {
missile = *missiles;
- if (missile->Type->Class == MissileClassCustom) {
- continue; // custom are handled by Controller() only
- }
if (missile->Delay) {
continue; // delayed aren't shown
}
@@ -801,7 +812,7 @@
nextdir = 256 / missile->Type->NumDirections;
dir = ((DirectionToHeading(dx, dy) + nextdir / 2) & 0xFF) / nextdir;
- if (dir <= LookingS / nextdir) { // north->east->south
+ if (dir <= LookingS / nextdir ) { // north->east->south
missile->SpriteFrame += dir;
} else {
missile->SpriteFrame += 256 / nextdir - dir;
@@ -843,9 +854,7 @@
if (missile->Type->Class == MissileClassWhirlwind ||
missile->Type->Class == MissileClassFlameShield) {
// must not call MissileNewHeading nor frame change
- } else if (missile->Type->Class == MissileClassBlizzard) {
- missile->SpriteFrame = 0;
- } else if (missile->Type->Class == MissileClassPointToPoint3Bounces) {
+ } else if (missile->Type->Class == MissileClassPointToPointBounce) {
missile->DX -= xstep * TileSizeX / 2;
missile->DY -= ystep * TileSizeY / 2;
} else {
@@ -1033,7 +1042,7 @@
// Move missile
//
if (missile->Dy == 0) { // horizontal line
- for (i = 0; i < missile->Type->Speed; ++i) {
+ for (i = 0; i<missile->Type->Speed; ++i) {
if (missile->X == missile->DX) {
return 1;
}
@@ -1172,7 +1181,7 @@
x /= TileSizeX;
y /= TileSizeY;
- if (x < 0 || y < 0 || x >= TheMap.Width || y >= TheMap.Height) {
+ if (x < 0 || y < 0 || x >= TheMap.Width || y >= TheMap.Height ) {
// FIXME: this should handled by caller?
DebugLevel0Fn("Missile gone outside of map!\n");
return; // outside the map.
@@ -1217,7 +1226,7 @@
// 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) {
+ y >= goal->Y + goal->Type->TileHeight ) {
MissileHitsGoal(missile, goal, 2);
} else {
MissileHitsGoal(missile, goal, 1);
@@ -1243,16 +1252,14 @@
}
}
-
-/**
+/*
** Pass to the next frame for animation.
**
** @param missile : missile to animate.
-** @param SpriteFrame : number of frame for a row : must be remove
+**
** @return 1 if animation is finished, 0 else.
-** @todo remove SpriteFrame, and use number of frames per row (frames pro
row)
*/
-local int NextMissileFrame(Missile* missile, int SpriteFrame)
+local int NextMissileFrame(Missile* missile)
{
int neg;
int AnimationIsFinished;
@@ -1267,7 +1274,7 @@
neg = 1;
missile->SpriteFrame = -missile->SpriteFrame;
}
- missile->SpriteFrame += SpriteFrame; // FIXME: frames pro row
+ missile->SpriteFrame += missile->Type->NumDirections;
if (missile->SpriteFrame >= VideoGraphicFrames(missile->Type->Sprite)) {
missile->SpriteFrame -= VideoGraphicFrames(missile->Type->Sprite);
AnimationIsFinished = 1;
@@ -1280,68 +1287,48 @@
return AnimationIsFinished;
}
-
-/**
-** Handle action for a missile.
+/*
+** Pass the next frame of the animation.
+** This animation goes from start to finish ONCE on the way
**
** @param missile Missile pointer.
*/
-local void MissileAction(Missile* missile)
+local void NextMissileFrameCycle(Missile* missile)
{
- DebugCheck(missile == NULL);
- // Mark missile area on screen to be drawn, if missile moves or disappears.
- CheckMissileToBeDrawn(missile);
- missile->Wait = missile->Type->Sleep;
+ int neg;
+ int totalx;
+ int dx;
+ int f;
+ int i;
+ int j;
- switch (missile->Type->Class) {
- //
- // Missile flies from x,y to x1,y1
- //
- case MissileClassPointToPoint:
- MissileActionPointToPoint(missile);
- break;
- case MissileClassPointToPointWithDelay:
- MissileActionPointToPointWithDelay(missile);
- break;
- case MissileClassPointToPoint3Bounces:
- MissileActionPointToPoint3Bounces(missile);
- break;
- case MissileClassPointToPointWithHit:
- MissileActionPointToPointWithHit(missile);
- case MissileClassBlizzard:
- MissileActionPointToPointWithHit(missile);
- break;
- case MissileClassDeathDecay:
- MissileActionStayWithDelay(missile);
- break;
- case MissileClassWhirlwind:
- if (NextMissileFrame(missile, 1)) {
- missile->SpriteFrame = 0;
- PointToPointMissile(missile);
+ neg = 0;
+ if (missile->SpriteFrame < 0) {
+ neg = 1;
+ missile->SpriteFrame = -missile->SpriteFrame;
+ }
+ totalx = abs(missile->DX - missile->SourceX);
+ dx = abs(missile->X - missile->SourceX);
+ f = VideoGraphicFrames(missile->Type->Sprite) /
missile->Type->NumDirections;
+ f = 2 * f - 1;
+ for (i = 1, j = 1; i <= f; ++i) {
+ if (dx * f / i < totalx) {
+ if ((i - 1) * 2 < f) {
+ j = i - 1;
+ } else {
+ j = f - i;
}
+ missile->SpriteFrame = missile->SpriteFrame % 5 +
+ j * 5; // FIXME: frames per row
break;
- case MissileClassStayWithDelay:
- MissileActionStayWithDelay(missile);
- break;
- case MissileClassCycleOnce:
- MissileActionCycleOnce(missile);
- break;
- case MissileClassFire:
- MissileActionFire(missile);
- break;
- case MissileClassHit:
- MissileActionHit(missile);
- break;
- case MissileClassParabolic:
- MissileActionParabolic(missile);
- break;
- case MissileClassLandMine:
- MissileActionLandMine(missile);
- break;
+ }
+ }
+ if (neg) {
+ missile->SpriteFrame = -missile->SpriteFrame;
}
}
-/**
+/*
** Handle all missile actions of global/local missiles.
**
** @param missiles Table of missiles.
@@ -1365,13 +1352,6 @@
missile->TTL--; // overall time to live if specified
}
- if (missile->Controller) {
- missile->Controller(missile);
- if (*missiles != missile) { // Missile is destroyed
- continue;
- }
- }
-
if (!missile->TTL) {
FreeMissile(missile);
continue;
@@ -1382,13 +1362,11 @@
continue;
}
- if (missile->Type->Class == MissileClassCustom) {
- missile->Wait = missile->Type->Sleep;
- ++missiles;
- continue; // custom missiles are handled by Controller() only
- }
+ // Mark missile area on screen to be drawn, if missile moves or
disappears.
+ CheckMissileToBeDrawn(missile);
+
+ MissileClassFunctions[missile->Type->Class](missile);
- MissileAction(missile);
if (*missiles == missile) { // Missile not destroyed
++missiles;
@@ -1458,8 +1436,8 @@
char** sp;
int i;
- CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.96 2003/10/18
15:04:26 jsalmon3 Exp $\n\n");
+ CLprintf(file,"\n;;; -----------------------------------------\n");
+ CLprintf(file,";;; MODULE: missile-types $Id: missile.c,v 1.97 2003/10/20
11:08:56 n0body Exp $\n\n");
//
// Original number to internal missile-type name.
@@ -1483,7 +1461,7 @@
}
CLprintf(file, " 'size '(%d %d)", mtype->Width, mtype->Height);
if (mtype->Sprite) {
- CLprintf(file, " 'frames %d", mtype->SpriteFrames);
+ CLprintf(file," 'frames %d", mtype->SpriteFrames);
}
CLprintf(file, "\n 'num-directions %d", mtype->NumDirections);
CLprintf(file, "\n ");
@@ -1497,6 +1475,10 @@
CLprintf(file, "\n ");
}
CLprintf(file, " 'class '%s", MissileClassNames[mtype->Class]);
+ if (mtype->Class==MissileClassPointToPointBounce) {
+ CLprintf(file," 'num-bounces %d",mtype->NumBounces);
+ }
+ CLprintf(file, " 'class '%s", MissileClassNames[mtype->Class]);
CLprintf(file, " 'draw-level %d ", mtype->DrawLevel);
if (mtype->StartDelay) {
CLprintf(file, " 'delay %d", mtype->StartDelay);
@@ -1524,9 +1506,9 @@
CLprintf(file, "(missile 'type '%s",missile->Type->Ident);
CLprintf(file, " 'pos '(%d %d) 'goal '(%d %d)",
missile->X, missile->Y, missile->DX, missile->DY);
- CLprintf(file, " '%s", missile->Local ? "local" : "global");
- CLprintf(file, "\n 'frame %d 'state %d 'wait %d 'delay %d\n ",
- missile->SpriteFrame, missile->State, missile->Wait, missile->Delay);
+ CLprintf(file," '%s", missile->Local ? "local" : "global");
+ CLprintf(file,"\n 'frame %d 'state %d 'anim-wait %d 'wait %d 'delay %d\n
",
+ missile->SpriteFrame, missile->State, missile->AnimWait, missile->Wait,
missile->Delay);
if (missile->SourceUnit) {
CLprintf(file, " 'source '%s", s1 = UnitReference(missile->SourceUnit));
free(s1);
@@ -1537,8 +1519,7 @@
}
CLprintf(file, " 'damage %d", missile->Damage);
// FIXME: need symbolic names for controller
- CLprintf(file, " 'ttl %d 'controller %ld",
- missile->TTL, (long)missile->Controller);
+ CLprintf(file, " 'ttl %d", missile->TTL);
CLprintf(file, " 'data '(%d %d %d %d %d)",
missile->D, missile->Dx, missile->Dy, missile->Xstep, missile->Ystep);
CLprintf(file, ")\n");
@@ -1553,8 +1534,8 @@
{
Missile* const* missiles;
- CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: missiles $Id: missile.c,v 1.96 2003/10/18
15:04:26 jsalmon3 Exp $\n\n");
+ CLprintf(file,"\n;;; -----------------------------------------\n");
+ CLprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.97 2003/10/20
11:08:56 n0body Exp $\n\n");
for (missiles = GlobalMissiles; *missiles; ++missiles) {
SaveMissile(*missiles, file);
@@ -1674,66 +1655,56 @@
*/
void MissileActionNone(Missile* missile)
{
+ missile->Wait = missile->Type->Sleep;
return;// Busy doing nothing.
}
/*
-** Missile flies from x,y to x1,y1
+** Missile flies from x,y to x1,y1 aniation on the way
**
** @param missile pointer to missile
*/
void MissileActionPointToPoint(Missile* missile)
{
+ missile->Wait = missile->Type->Sleep;
if (PointToPointMissile(missile)) {
MissileHit(missile);
FreeMissile(missile);
} else {
- NextMissileFrame(missile, 5);
+ NextMissileFrame(missile);
}
}
/*
+** Missile flies from x,y to x1,y1 showing the first frame
+** and then shows a hit animation.
+**
+** @param missile pointer to missile
+*/
+void MissileActionPointToPointWithHit(Missile* missile)
+{
+ missile->Wait = missile->Type->Sleep;
+ if (PointToPointMissile(missile)) {
+ if (NextMissileFrame(missile)) {
+ MissileHit(missile);
+ FreeMissile(missile);
+ }
+ }
+}
+
+/*
** Missile flies from x,y to x1,y1 and stays there for a moment
**
** @param missile pointer to missile
*/
-void MissileActionPointToPointWithDelay(Missile* missile)
+void MissileActionPointToPointCycleOnce(Missile* missile)
{
- int neg;
- int totalx;
- int dx;
- int f;
- int i;
- int j;
-
+ missile->Wait = missile->Type->Sleep;
if (PointToPointMissile(missile)) {
MissileHit(missile);
FreeMissile(missile);
} else {
- neg = 0;
- if (missile->SpriteFrame < 0) {
- neg = 1;
- missile->SpriteFrame = -missile->SpriteFrame;
- }
- totalx = abs(missile->DX - missile->SourceX);
- dx = abs(missile->X - missile->SourceX);
- f = VideoGraphicFrames(missile->Type->Sprite) / 5; // FIXME: frames per
row
- f = 2 * f - 1;
- for (i = 1, j = 1; i <= f; ++i) {
- if (dx * f / i < totalx) {
- if ((i - 1) * 2 < f) {
- j = i - 1;
- } else {
- j = f - i;
- }
- missile->SpriteFrame = missile->SpriteFrame % 5 +
- j * 5; // FIXME: frames per row
- break;
- }
- }
- if (neg) {
- missile->SpriteFrame = -missile->SpriteFrame;
- }
+ NextMissileFrameCycle(missile);
}
}
@@ -1742,47 +1713,44 @@
**
** @param missile pointer to missile
*/
-void MissileActionStayWithDelay(Missile* missile)
+void MissileActionStay(Missile* missile)
{
- if (NextMissileFrame(missile, 1)) {
+ missile->Wait = missile->Type->Sleep;
+ if (NextMissileFrame(missile)) {
MissileHit(missile);
FreeMissile(missile);
}
}
-/**
-** Missile flies from x,y to x1,y1 than bounces three times.
+/*
+** Missile flies from x,y to x1,y1 than bounces three times
**
** @param missile pointer to missile
*/
-void MissileActionPointToPoint3Bounces(Missile* missile)
+void MissileActionPointToPointBounce(Missile* missile)
{
+ missile->Wait = missile->Type->Sleep;
if (PointToPointMissile(missile)) {
- // 3 Bounces.
- switch (missile->State) {
- case 1:
- case 3:
- case 5:
- missile->State += 2;
- missile->DX += missile->Xstep * TileSizeX * 3 / 2;
- missile->DY += missile->Ystep * TileSizeY * 3 / 2;
- MissileHit(missile);
- // FIXME: hits to left and right
- // FIXME: reduce damage effects on later impacts
- break;
- default:
- FreeMissile(missile);
- missile = NULL;
- break;
+ if (missile->State<2*missile->Type->NumBounces) {
+ missile->State += 2;
+ missile->DX += missile->Xstep * TileSizeX * 3 / 2;
+ missile->DY += missile->Ystep * TileSizeY * 3 / 2;
+ MissileHit(missile);
+ // FIXME: hits to left and right
+ // FIXME: reduce damage effects on later impacts
+ } else {
+ FreeMissile(missile);
+ missile = NULL;
}
} else {
- NextMissileFrame(missile, 5);
+ NextMissileFrame(missile);
}
}
-/**
-** FIXME: docu
-**
+/*
+** Missile doesn't move, it will just cycle once and vanish.
+** Used for ui missiles (cross shown when you give and order)
+**
** @param missile pointer to missile
*/
void MissileActionCycleOnce(Missile* missile)
@@ -1790,6 +1758,7 @@
int neg;
neg = 0;
+ missile->Wait = missile->Type->Sleep;
if (missile->SpriteFrame < 0) {
neg = 1;
missile->SpriteFrame = -missile->SpriteFrame;
@@ -1819,21 +1788,6 @@
}
/*
-** Missile flies from x,y to x1,y1 than shows hit animation.
-**
-** @param missile pointer to missile
-*/
-void MissileActionPointToPointWithHit(Missile* missile)
-{
- if (PointToPointMissile(missile)) {
- if (NextMissileFrame(missile, 4)) {
- MissileHit(missile);
- FreeMissile(missile);
- }
- }
-}
-
-/*
** Missile don't move, than checks the source unit for HP.
**
** @param missile pointer to missile
@@ -1843,11 +1797,12 @@
Unit* unit;
unit = missile->SourceUnit;
+ missile->Wait = missile->Type->Sleep;
if (unit->Destroyed || !unit->HP) {
FreeMissile(missile);
return;
}
- if (NextMissileFrame(missile, 1)) {
+ if (NextMissileFrame(missile)) {
int f;
MissileType* fire;
@@ -1870,13 +1825,12 @@
}
}
-/**
-** FIXME: docu
-**
-** @param missile pointer to missile
-*/
+//
+// Missile shows hit points?
+//
void MissileActionHit(Missile* missile)
{
+ missile->Wait = missile->Type->Sleep;
if (PointToPointMissile(missile)) {
MissileHit(missile);
FreeMissile(missile);
@@ -1884,183 +1838,18 @@
}
/*
-** Missile flies from x,y to x1,y1 using a parabolic path
+** Missile flies from x,y to x1,y1 using a parabolic path
**
** @param missile pointer to missile
*/
void MissileActionParabolic(Missile* missile)
{
- int neg;
-
+ missile->Wait = missile->Type->Sleep;
if (ParabolicMissile(missile)) {
MissileHit(missile);
FreeMissile(missile);
- missile = NULL;
} else {
- int totalx;
- int dx;
- int f;
- int i;
- int j;
-
- neg = 0;
- if (missile->SpriteFrame < 0) {
- neg = 1;
- missile->SpriteFrame = -missile->SpriteFrame;
- }
- totalx = abs(missile->DX - missile->SourceX);
- dx = abs(missile->X - missile->SourceX);
- f = VideoGraphicFrames(missile->Type->Sprite) / 5; // FIXME: frames per
row
- f = 2 * f - 1;
- for (i = 1, j = 1; i <= f; ++i) {
- if (dx * f / i < totalx) {
- if ((i - 1) * 2 < f) {
- j = i - 1;
- } else {
- j = f - i;
- }
- missile->SpriteFrame = missile->SpriteFrame % 5 +
- j * 5; // FIXME: frames per row
- break;
- }
- }
- if (neg) {
- missile->SpriteFrame = -missile->SpriteFrame;
- }
- }
-}
-
-/**
-** Death-Coil controller
-**
-** @param missile Controlled missile
-*/
-global void SpellDeathCoilController(Missile *missile)
-{
- Unit *table[UnitMax];
- int i;
- int n;
- Unit *source;
-
- DebugCheck(missile == NULL);
- //
- // missile has not reached target unit/spot
- //
- if (!(missile->X == missile->DX && missile->Y == missile->DY)) {
- return ;
- }
- source = missile->SourceUnit;
- if (source->Destroyed) {
- return ;
- }
- // source unit still exists
- //
- // Target unit still exists and casted on a special target
- //
- if (missile->TargetUnit && !missile->TargetUnit->Destroyed
- && missile->TargetUnit->HP) {
- if (missile->TargetUnit->HP <= 50) {// 50 should be parametrable
- source->Player->Score += missile->TargetUnit->Type->Points;
- if (missile->TargetUnit->Type->Building) {
- source->Player->TotalRazings++;
- } else {
- source->Player->TotalKills++;
- }
-#ifdef USE_HP_FOR_XP
- source->XP += missile->TargetUnit->HP;
-#else
- source->XP += missile->TargetUnit->Type->Points;
-#endif
- ++source->Kills;
- missile->TargetUnit->HP = 0;
- LetUnitDie(missile->TargetUnit);
- } else {
-#ifdef USE_HP_FOR_XP
- source->XP += 50;
-#endif
- missile->TargetUnit->HP -= 50;
- }
- if (source->Orders[0].Action != UnitActionDie) {
- source->HP += 50;
- if (source->HP > source->Stats->HitPoints) {
- source->HP = source->Stats->HitPoints;
- }
- }
- } else {
- //
- // No target unit -- try enemies in range 5x5 // Must be parametrable
- //
- int ec; // enemy count
- int x;
- int y;
-
- ec = 0;
- x = missile->DX / TileSizeX;
- y = missile->DY / TileSizeY;
-
- n = SelectUnits(x - 2, y - 2, x + 2, y + 2, table);
- if (n == 0) {
- return ;
- }
- // calculate organic enemy count
- for (i = 0; i < n; ++i) {
- ec += (IsEnemy(source->Player, table[i])
- && table[i]->Type->Organic != 0);
- }
- if (ec > 0) {
- // yes organic enemies found
- for (i = 0; i < n; ++i) {
- if (IsEnemy(source->Player, table[i]) &&
table[i]->Type->Organic != 0) {
- // disperse damage between them
- //NOTE: 1 is the minimal damage
- if (table[i]->HP <= 50 / ec) {
- source->Player->Score += table[i]->Type->Points;
- if (table[i]->Type->Building) {
- source->Player->TotalRazings++;
- } else {
- source->Player->TotalKills++;
- }
-#ifdef USE_HP_FOR_XP
- source->XP += table[i]->HP;
-#else
- source->XP += table[i]->Type->Points;
-#endif
- ++source->Kills;
- table[i]->HP = 0;
- LetUnitDie(table[i]); // too much damage
- } else {
-#ifdef USE_HP_FOR_XP
- source->XP += 50/ec;
-#endif
- table[i]->HP -= 50 / ec;
- }
- }
- }
- if (source->Orders[0].Action!=UnitActionDie) {
- source->HP += 50;
- if (source->HP > source->Stats->HitPoints) {
- source->HP = source->Stats->HitPoints;
- }
- }
- }
- }
-}
-
-/**
-** Fireball controller
-**
-** @param missile Controlled missile
-*/
-global void SpellFireballController(Missile *missile)
-{
- DebugCheck(missile == NULL);
- //NOTE: vladi: TTL is used as counter for explosions
- // explosions start at target and continue (10 tiles) beyond
- // explosions are on each tile on the way
-
- // approx
- if (missile->TTL <= missile->State && missile->TTL % 4 == 0) {
- MissileHit(missile);
+ NextMissileFrameCycle(missile);
}
}
@@ -2069,7 +1858,7 @@
**
** @param missile Controlled missile
*/
-global void SpellFlameShieldController(Missile *missile)
+global void MissileActionFlameShield(Missile *missile)
{
static int fs_dc[] = {
0, 32, 5, 31, 10, 30, 16, 27, 20, 24, 24, 20, 27, 15, 30, 10, 31,
@@ -2090,6 +1879,7 @@
int uh;
DebugCheck(missile == NULL);
+ missile->Wait = missile->Type->Sleep;
i = missile->TTL % 36; // 36 positions on the circle
dx = fs_dc[i * 2];
dy = fs_dc[i * 2 + 1];
@@ -2127,7 +1917,9 @@
}
/**
-** Runes controller
+** Land mine controller.
+** @todo: start-finish-start cyclic animation.(anim scripts!)
+** @todo: missile should dissapear for a while.
**
** @param missile Controlled missile
*/
@@ -2150,15 +1942,21 @@
for (i = 0; i < n; ++i) {
if (table[i]->Type->UnitType != UnitTypeFly &&
table[i]->HP &&
- table[i]!=missile->SourceUnit) {
- DebugLevel0("Landmine explosion.\n");
+
!(table[i]==missile->SourceUnit&&!(missile->Type->CanHitOwner))) {
+ DebugLevel0("Landmine explosion at %d,%d.\n" _C_ x _C_ y);
MissileHit(missile);
missile->TTL = 0;
return;
}
}
- NextMissileFrame(missile, 1);
+ if (!missile->AnimWait) {
+ NextMissileFrame(missile);
+ missile->AnimWait = missile->Type->Sleep;
+ } else {
+ missile->AnimWait--;
+ }
+ missile->Wait=1;
}
/**
@@ -2166,7 +1964,7 @@
**
** @param missile Controlled missile
*/
-global void SpellWhirlwindController(Missile *missile)
+global void MissileActionWhirlwind(Missile *missile)
{
Unit *table[UnitMax];
int i;
@@ -2175,6 +1973,22 @@
int y;
DebugCheck(missile == NULL);
+
+ //
+ // Animate, move.
+ //
+ if (!missile->AnimWait) {
+ DebugLevel0Fn("?\n");
+ if (NextMissileFrame(missile)) {
+ missile->SpriteFrame = 0;
+ PointToPointMissile(missile);
+ }
+ missile->AnimWait = missile->Type->Sleep;
+ } else {
+ missile->AnimWait--;
+ }
+ missile->Wait=1;
+
//
// Center of the tornado
//
@@ -2199,13 +2013,13 @@
n = SelectUnits(x - 1, y - 1, x + 1, y + 1, table);
DebugLevel3Fn("Damage on %d,%d-%d,%d = %d\n" _C_ x-1 _C_ y-1 _C_ x+1
_C_ y+1 _C_ n);
for (i = 0; i < n; ++i) {
- if ((table[i]->X != x || table[i]->Y != y) && table[i]->HP) {
+ if( (table[i]->X != x || table[i]->Y != y) && table[i]->HP) {
HitUnit(missile->SourceUnit,table[i], WHIRLWIND_DAMAGE2); //
should be in missile
}
}
}
- DebugLevel3Fn("Whirlwind: %d, %d, TTL: %d\n" _C_
- missile->X _C_ missile->Y _C_ missile->TTL);
+ DebugLevel0Fn( "Whirlwind: %d, %d, TTL: %d state: %d\n" _C_
+ missile->X _C_ missile->Y _C_ missile->TTL _C_ missile->State);
//
// Changes direction every 3 seconds (approx.)
@@ -2222,8 +2036,88 @@
missile->DX = nx * TileSizeX + TileSizeX / 2;
missile->DY = ny * TileSizeY + TileSizeY / 2;
missile->State=0;
- DebugLevel3Fn("Whirlwind new direction: %d, %d, TTL: %d\n" _C_
- missile->X _C_ missile->Y _C_ missile->TTL);
+ DebugLevel0Fn( "Whirlwind new direction: %d, %d, TTL: %d\n" _C_
+ missile->X _C_ missile->Y _C_ missile->TTL );
+ }
+}
+
+/**
+** Death-Coil class. Damages organic units and gives to the caster.
+**
+** @param missile Controlled missile
+*/
+global void MissileActionDeathCoil(Missile *missile)
+{
+ Unit *table[UnitMax];
+ int i;
+ int n;
+ Unit *source;
+
+ DebugCheck(missile == NULL);
+ missile->Wait = missile->Type->Sleep;
+ if (PointToPointMissile(missile)) {
+ //
+ // missile has not reached target unit/spot
+ //
+ if (!(missile->X == missile->DX && missile->Y == missile->DY)) {
+ return ;
+ }
+ source = missile->SourceUnit;
+ if (source->Destroyed) {
+ return ;
+ }
+ // source unit still exists
+ //
+ // Target unit still exists and casted on a special target
+ //
+ if (missile->TargetUnit && !missile->TargetUnit->Destroyed
+ && missile->TargetUnit->HP) {
+ HitUnit(source,missile->TargetUnit,missile->Damage);
+ if (source->Orders[0].Action != UnitActionDie) {
+ source->HP += missile->Damage;
+ if (source->HP > source->Stats->HitPoints) {
+ source->HP = source->Stats->HitPoints;
+ }
+ }
+ } else {
+ //
+ // No target unit -- try enemies in range 5x5 // Must be
parametrable
+ //
+ int ec; // enemy count
+ int x;
+ int y;
+
+ ec = 0;
+ x = missile->DX / TileSizeX;
+ y = missile->DY / TileSizeY;
+
+ n = SelectUnits(x - 2, y - 2, x + 2, y + 2, table);
+ if (n == 0) {
+ return ;
+ }
+ // calculate organic enemy count
+ for (i = 0; i < n; ++i) {
+ ec += (IsEnemy(source->Player, table[i])
+ && table[i]->Type->Organic != 0);
+ }
+ if (ec > 0) {
+ // yes organic enemies found
+ for (i = 0; i < n; ++i) {
+ if (IsEnemy(source->Player, table[i]) &&
table[i]->Type->Organic != 0) {
+ // disperse damage between them
+ //NOTE: 1 is the minimal damage
+ HitUnit(source,table[i], missile->Damage / ec);
+ }
+ }
+ if (source->Orders[0].Action!=UnitActionDie) {
+ source->HP += missile->Damage;
+ if (source->HP > source->Stats->HitPoints) {
+ source->HP = source->Stats->HitPoints;
+ }
+ }
+ }
+ }
+ FreeMissile(missile);
}
}