[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus src/ui/ccl_ui.c src/ui/menu_proc.c sr...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus src/ui/ccl_ui.c src/ui/menu_proc.c sr... |
Date: |
14 Dec 2003 07:54:22 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 03/12/14 07:54:19
Modified files:
src/ui : ccl_ui.c menu_proc.c menus.c
doc/ccl : magic.html ui.html
src/clone : ccl_spell.c mainloop.c spells.c
src/editor : editloop.c
src/game : intro.c
src/include : menus.h missile.h spells.h video.h
src/missile : ccl_missile.c missile.c
src/video : sprite.c
Log message:
Undo bad commit
Patches:
Index: stratagus/doc/ccl/magic.html
diff -u stratagus/doc/ccl/magic.html:1.10 stratagus/doc/ccl/magic.html:1.11
--- stratagus/doc/ccl/magic.html:1.10 Sun Dec 14 03:12:38 2003
+++ stratagus/doc/ccl/magic.html Sun Dec 14 07:54:10 2003
@@ -25,32 +25,32 @@
</head>
<body>
<h1>Stratagus Configuration Language Description: Magic</h1>
-<hr><pre width=80> _________ __
- __ / _____//
- |_____________ _/ |______ ____ __ __ ______ \_____ \\
- __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \|
- | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______
- /|__| |__| (____ /__| (____ /\___ /|____//____ >
+<hr><pre width=80>
+ _________ __ __
+ / _____// |_____________ _/ |______ ____ __ __ ______
+ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
+ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
+ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
</pre>
<p><b>(C) Copyright 1998-2003 by The Stratagus Project. Distributed under the
-<A href="../gpl.html">"GNU General Public License"</a></b>
+<a href="../gpl.html">"GNU General Public License"</a></b>
<hr>
-<A href="../stratagus.html">Stratagus</a>
-<A href="../readme.html">Readme</a>
-<A href="../faq.html">FAQ</a>
-<A href="ccl.html">CCL</a>
-<A href="icon.html">PREV</a>
-<A href="pud.html">NEXT</a>
-<A href="ccl-index.html">Index</a>
+<a href="../stratagus.html">Stratagus</a>
+<a href="../readme.html">Readme</a>
+<a href="../faq.html">FAQ</a>
+<a href="ccl.html">CCL</a>
+<a href="icon.html">PREV</a>
+<a href="pud.html">NEXT</a>
+<a href="ccl-index.html">Index</a>
<hr>
-<A href="#define-missile-type">define-missile-type</a>
-<A href="#define-spell">define-spell</a>
-<A href="pud.html#define-missiletype-wc-names">define-missiletype-wc-names</a>
-<A href="#missile">missile</a>
+<a href="#define-missile-type">define-missile-type</a>
+<a href="#define-spell">define-spell</a>
+<a href="pud.html#define-missiletype-wc-names">define-missiletype-wc-names</a>
+<a href="#missile">missile</a>
<hr>
<h2>Intro - Introduction to spells and missiles.</h2>
This containts everything around spells and missiles. Though it might not be
@@ -64,153 +64,137 @@
This is the function to define a missile type.
<dl>
-<dt>missile-name
-
+<dt>missile-name</dt>
<dd>This is the unique identifier of the missile.
</dd>
</dl>
Possible tags:
<dl>
-<dt>file
-
-<dd>This is followed by the path of the file with the
- missile graphics.
-
-<dt>size
-
-<dd>This if followed by a list of X and Y sizes of the
- missile sprite. F.E. 'size '(32 32)
+<dt>file</dt>
+<dd>This is followed by the path of the file with the missile graphics.
+</dd>
+<dt>size</dt>
+<dd>This if followed by a list of X and Y sizes of the missile sprite.
+F.E. 'size '(32 32)
+</dd>
<a name="frames-define-missile-type"></a>
-<dt>frames
-
-<dd>This is the number of frames in the file. Missiles
- lack complicated animation scripts and just have a bunch of frames with
equal
- duration.
-
-<dt>num-directions
-
-<dd>The number of directions in the file for the missile.
- Should be 8.
-
-<dt>draw-level
-
-<dd>The draw level of the missile. Missiles and units are
- sorted by this value to determine the draw order.
-
-<dt>fired-sound
-
-<dd>Name of the sound played when the missile is fired.
-
-<dt>impact-sound
-
-<dd>Name of the sound played when the missile hits it's
- target.
-
-<dt>class
-
+<dt>frames</dt>
+<dd>This is the number of frames in the file. Missiles lack complicated
+animation scripts and just have a bunch of frames with equal duration.
+</dd>
+<dt>num-directions</dt>
+<dd>The number of directions in the file for the missile. Should be 8.
+</dd>
+<dt>draw-level</dt>
+<dd>The draw level of the missile. Missiles and units are sorted by this
+value to determine the draw order.
+</dd>
+<dt>fired-sound</dt>
+<dd>Name of the sound played when the missile is fired.
+</dd>
+<dt>impact-sound</dt>
+<dd>Name of the sound played when the missile hits it's target.
+</dd>
+<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:<p>
<dl>
- <dt>missile-class-none
- <dd>Missile does nothing. Shouldn't really be used.
- <dt>missile-class-point-to-point
- <dd>Missile flies straight to destination animating on
- the way
- <dt>missile-class-point-to-point-with-hit
- <dd>Missile flies straight to destination keeping the
- first frame and the finishes the animation when hitting
- <dt>missile-class-point-to-point-cycle-once
- <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
- <dt>missile-class-point-to-point-bounce
+ <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>num-bounces</dt>
<dd>This if folowed by an integer, representing the number of
bounces(hits)</dd>
</dl>
- <dt>missile-class-stay
- <dd>Missile will just go through it's animation once
- and vanish. booooring.
- <dt>missile-class-cycle-once
- <dd>Missile will just go through it's animation from
- start to and and back again, then vanish.
- <dt>missile-class-fire
- <dd>Missile is used for fire. More documentation?
- <dt>missile-class-parabolic
- <dd>Missile flies to destination with a parabolic path.
- It used the same animation as cycle-once
- <dt>missile-class-land-mine
+ <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>
- <dt>missile-class-whirlwind
+ </dd>
+ <dt>missile-class-whirlwind </dt>
<dd>Missile for the whirlwind effect <b>FIXME more configurable</b>
- <dt>missile-class-flame-shield
+ </dd>
+ <dt>missile-class-flame-shield </dt>
<dd>Missile rotates around target unit and damages everything it touches
<b>FIXME more configurable</b>
- <dt>missile-class-death-coil
+ </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
-
-<dd>Delay in game cycles after the missile generation,
- until the missile animation and effects starts. Delay denotes the number of
- display cycles to skip before drawing the first sprite frame and only
happens
- once at start.
-
-<dt>sleep
-
-<dd>This are the number of game cycles to wait for the
- next animation or the sleeping between the animation steps. All animations
- steps use the same delay. 0 is the fastest and 255 the slowest animation.
- Perhaps we should later we will use animation scripts for more complex
- animations.
-
-<dt>speed
-
-<dd>The speed how fast the missile moves. 0 the missile
- didn't 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 missile class. This is currently only used by
- the point-to-point missiles.
-
-<dt>range
-
-<dd>Determines the range in which a projectile will deal
- its damage. A range of 0 will mean that the damage will be limited to the
- targetted unit only. So if you shot a missile at a unit, it would only
damage
- that unit. A value of 1 only affects the field where the missile hits. A
value
- of 2 would mean that the damage for that particular missile would be dealt
for
- a range of 1 around the impact spot. All fields that aren't the center get
- only 1/SpashFactor of the damage. Fields 2 away get 1/(SplashFactor*2), and
- following...
-
-<dt>splash-factor
-
-<dd>The Splash divisor for damage done with range
-
-<dt>impact-missile
-
-<dd>You can use this to spawn another missile on impact.
- F.E. 'impact-missile 'missile-explosion
-
-<dt>smoke-missile
-
-<dd>The name of the next (other) missile to generate a
- trailing smoke. So it can be used to generate a chain of missiles.
-
-<dt>can-hit-owner
-
-<dd>Determines if the missile will affect the caster or
- not.
-
-<dt>firendly-fire
-
+<dt>delay</dt>
+<dd>Delay in game cycles after the missile generation, until the missile
+animation and effects starts. Delay denotes the number of display cycles to
+skip before drawing the first sprite frame and only happens once at start.
+</dd>
+<dt>sleep</dt>
+<dd>This are the number of game cycles to wait for the next animation or the
+sleeping between the animation steps. All animations steps use the same delay.
+0 is the fastest and 255 the slowest animation. Perhaps we should later we
+will use animation scripts for more complex animations.
+</dd>
+<dt>speed</dt>
+<dd>The speed how fast the missile moves. 0 the missile didn't 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 missile class. This is currently only used by the point-to-point
+missiles.
+</dd>
+<dt>range</dt>
+<dd>Determines the range in which a projectile will deal its damage. A range of
+0 will mean that the damage will be limited to the targetted unit only. So if
+you shot a missile at a unit, it would only damage that unit. A value of 1
only
+affects the field where the missile hits. A value of 2 would mean that the
+damage for that particular missile would be dealt for a range of 1 around the
+impact spot. All fields that aren't the center get only 1/SpashFactor of the
damage.
+Fields 2 away get 1/(SplashFactor*2), and following...
+</dd>
+<dt>splash-factor</dt>
+<dd>The Splash divisor for damage done with range
+</dd>
+<dt>impact-missile</dt>
+<dd>You can use this to spawn another missile on impact. F.E. 'impact-missile
'missile-explosion
+</dd>
+<dt>smoke-missile</dt>
+<dd>The name of the next (other) missile to generate a trailing smoke. So it
+can be used to generate a chain of missiles.
+</dd>
+<dt>can-hit-owner</dt>
+<dd>Determines if the missile will affect
+the caster or not.
+</dd>
+<dt>firendly-fire</dt>
<dd>Determines if the missile will damage
units belonging to the same player of the caster or to an ally.
</dd>
@@ -227,7 +211,7 @@
'can-hit-owner)
</pre>
<h4>Used</h4>
-<A href="../../data/ccl/missiles.ccl"> $LIBARYPATH/ccl/missiles.ccl </a>
+<a href="../../data/ccl/missiles.ccl"> $LIBARYPATH/ccl/missiles.ccl </a>
<a name="define-spell"></a>
<h3>(define-spell spell-ident tag value ... )</h3>
@@ -235,42 +219,33 @@
conditions. Be very carefull, defining random flags will probably make the
game crash.
<dl>
-<dt>showname
-
-<dd>A neatly formatted string to be shown by the engine
- on the screen.
-
-<dt>manacost
-
-<dd>The mana cost of the spell. Maybe this should be set
- on a per-caster basis?
-
-<dt>repeat-cast
-
-<dd>If specified, the caster will cast it again. To be
- used with spells like area-bombardment to cast it again (area-bombardment is
- stackable)
-
-<dt>range
-
-<dd>The casting range of the spell, do not confuse this
- with area effect range. It's normally an integer value, but you can specify
a
- special value 'infinite to let the spell be casted on the entire map.
-
-<dt>target
-
+<dt>showname</dt>
+<dd>A neatly formatted string to be shown by the engine on the screen.
+</dd>
+<dt>manacost</dt>
+<dd>The mana cost of the spell. Maybe this should be set on a per-caster basis?
+</dd>
+<dt>repeat-cast</dt>
+<dd>If specified, the caster will cast it again. To be used with spells like
+area-bombardment to cast it again (area-bombardment is stackable)
+</dd>
+<dt>range</dt>
+<dd>The casting range of the spell, do not confuse this with area effect range.
+It's normally an integer value, but you can specify a special value 'infinite
to
+let the spell be casted on the entire map.
+</dd>
+<dt>target</dt>
<dd>Target type information. The following values are acceptable:
<ul>
<li>self: The spell will only affect the caster or the area around him, no
targetting at all.
<li>position: The unit will target a position.
- <li>unit: The unit will target an unit. The spell will
- be aborted if the target dies.</li>
-</ul>You can still use position spells on
- units, it will target the unit's position. If the unit dies however the
caster
- will stop. (Some spells get casted until there is no more mana left).
-
-<dt>conditions
-
+ <li>unit: The unit will target an unit. The spell will be aborted if the
target dies.
+</ul>
+You can still use position spells on units, it will target the unit's position.
+If the unit dies however the caster will stop. (Some spells get casted until
+there is no more mana left).
+</dd>
+<dt>conditions</dt>
<dd>This is the condition for being able to cast the spell. Think of it as a
function that takes an unit as a parameter and return either yes or no
depending
on the unit properties. Here is how a condition looks like:
@@ -279,68 +254,72 @@
max-slow-ticks 10)</pre>
Here are the supported parameters:<p>
<dl>
- <dt>building
+ <dt>building</dt>
<dd>This is one of the bool parameters (can't think of a better name). It
is
followed by true, false or only. Imagine this as a question, is the target
a
building? The answer is yes/no. A "true" parameter makes it always pass(and
it's the default.), "false" parameter passes when the answer is NO, and
"only"
passes only when the answer is yes.<br>
- It doesn't really makes sense to ever say true, since
- you might just as well ommit it. "building false" means the spell won't
work
- on buildings. "building only" will make a spell that works only on
buildings
- (can't think of any though). This syntax is used for more that "building"
- <dt>coward
- <dd>This is a bool parameter too, just like building. I
- specifies the behaviour for cowards, unit's that don't attack by
themselves.
- For example you should not cast an offensive buff (like bloodlust) on
- non-combat units.
- <dt>alliance
- <dd>This is a bool parameter too, just like building. I
- specifies the behaviour for allied units. Your own units are considered
- allied too. For instance you should only cast healing on your own units.
- <dt>self
+ It doesn't really makes sense to ever say true, since you might just as
well
+ ommit it. "building false" means the spell won't work on buildings.
"building
+ only" will make a spell that works only on buildings (can't think of any
though).
+ This syntax is used for more that "building"
+ </dd>
+ <dt>coward</dt>
+ <dd>This is a bool parameter too, just like building. I specifies the
behaviour
+ for cowards, unit's that don't attack by themselves. For example you
should not
+ cast an offensive buff (like bloodlust) on non-combat units.
+ </dd>
+ <dt>alliance</dt>
+ <dd>This is a bool parameter too, just like building. I specifies the
behaviour
+ for allied units. Your own units are considered allied too. For instance
you
+ should only cast healing on your own units.
+ </dd>
+ <dt>self</dt>
<dd>This is a bool parameter too, just like building. I it a bit more
special,
- since it specifies the behaviour for casting on yourself. <b>A LOT</b> of
spells specify "self false",
- to disallow casting on yourself.
- <dt>bool-flags
+ since it specifies the behaviour for casting on yourself. <b>A LOT</b> of
+ spells specify "self false", to disallow casting on yourself.
+ </dd>
+ <dt>bool-flags</dt>
<dd>There is no parameter called bool-flags. You can however use flags
defined
- by <A href="unittype.html#define-bool-flags">define-bool-flags</a> just
- like a bool parameter. For instance "organic only" will make a spell work
- only on units marked with the organic flag.
- <dt>min-hp-percent
- <dd>Minimum hp percent of the target. If not specified
- the minimum is around -10 You can use this to avoid casting damage spells
on
- enemies that are dying anyway.
- <dt>max-hp-percent
- <dd>Maximum hp percent of the target. If not specified
- the maximum is around 1000. For instance you can use this to avoid healing
- units that are not injured.
- <dt>min-mana-percent
- <dd>Minimum mana percent of the target. If not
- specified the minimum is around -10 You can use this to avoid spells like
- mana drain on units that are empty.
- <dt>max-mana-percent
- <dd>Maximum mana percent of the target. If not
- specified the maximum is around 1000 For instance you can use this to
avoid
- restoring mana to units that are full.
- <dt>max-slow-ticks
- <dd>Followed by a number, to avoid casting slow on an
- unit that is already slowed down.
- <dt>max-haste-ticks
- <dd>Followed by a number, to avoid casting haste on an
- unit that is already hasted.
- <dt>max-bloodlust-ticks
- <dd>Followed by a number, to avoid casting bloodlust on
- an unit that already has it.
- <dt>max-invisibility-ticks
- <dd>Followed by a number, to avoid casting invisibility
- on an unit that already has it.
- <dt>max-invincibility-ticks
+ by <a href="unittype.html#define-bool-flags">define-bool-flags</a> just
like a
+ bool parameter. For instance "organic only" will make a spell work only on
+ units marked with the organic flag.
+ </dd>
+ <dt>min-hp-percent</dt>
+ <dd>Minimum hp percent of the target. If not specified the minimum is
around -10
+ You can use this to avoid casting damage spells on enemies that are dying
anyway.
+ </dd>
+ <dt>max-hp-percent</dt>
+ <dd>Maximum hp percent of the target. If not specified the maximum is
around 1000.
+ For instance you can use this to avoid healing units that are not injured.
+ </dd>
+ <dt>min-mana-percent</dt>
+ <dd>Minimum mana percent of the target. If not specified the minimum is
around -10
+ You can use this to avoid spells like mana drain on units that are empty.
+ </dd>
+ <dt>max-mana-percent</dt>
+ <dd>Maximum mana percent of the target. If not specified the maximum is
around 1000
+ For instance you can use this to avoid restoring mana to units that are
full.
+ </dd>
+ <dt>max-slow-ticks</dt>
+ <dd>Followed by a number, to avoid casting slow on an unit that is already
slowed down.
+ </dd>
+ <dt>max-haste-ticks</dt>
+ <dd>Followed by a number, to avoid casting haste on an unit that is
already hasted.
+ </dd>
+ <dt>max-bloodlust-ticks</dt>
+ <dd>Followed by a number, to avoid casting bloodlust on an unit that
already has it.
+ </dd>
+ <dt>max-invisibility-ticks</dt>
+ <dd>Followed by a number, to avoid casting invisibility on an unit that
already has it.
+ </dd>
+ <dt>max-invincibility-ticks</dt>
<dd>Followed by a number, to avoid casting invincibility on an unit that
already has it.
</dd>
-</dl><p></p>
-<dt>autocast
-
+</dl>
+</dd><p>
+<dt>autocast</dt>
<dd>Autocast works very closely with conditions. Here is the syntax:
<pre>'autocast (range x condition(whatever) )</pre>
It functions by selecting every unit in range and trying to check of they fit
the
@@ -350,30 +329,30 @@
buffs on cowards). Autocasting position target spells is not supported, sorry.
Here is a formal list of parameters:
<dl>
- <dt>range
- <dd>The range in which autocast runs. I think it's
- square?
- <dt>combat
- <dd>This is a bool parameter, like in condition. It's
- autocast-specific and NOT part of conditions due to technical
- considerations. Combat is not unit-specific, it only depends on caster
- location. combat mode is when there are non-coward enemy units in range.
- most offensive spells obviousely only should be used in combat. (can you
say
- offensive buffs?)
- <dt>condition
+ <dt>range</dt>
+ <dd>The range in which autocast runs. I think it's square?
+ </dd>
+ <dt>combat</dt>
+ <dd>This is a bool parameter, like in condition. It's autocast-specific
and NOT
+ part of conditions due to technical considerations. Combat is not
unit-specific,
+ it only depends on caster location. combat mode is when there are
non-coward
+ enemy units in range. most offensive spells obviousely only should be used
in
+ combat. (can you say offensive buffs?)
+ </dd>
+ <dt>condition</dt>
<dd>This is followed by a list exactly like in 'condition. As it was said
before, this is evaluated for each and every unit in range, and if a unit
passes, the spell gets casted.
</dd>
</dl>
-<dt>ai-cast
-
-<dd>This is identical to autocast in syntax. It's used by
- the AI (computer controller player) rather then by a human players units. In
- general this should be a little better than autocast (and make human players
- think some more). There no reason to repeat the syntax of autocast
here.<p></p>
-<dt>action
-
+</dd>
+<dt>ai-cast</dt>
+<dd>This is identical to autocast in syntax. It's used by the AI (computer
controller
+player) rather then by a human players units. In general this should be a
little better
+than autocast (and make human players think some more). There no reason to
repeat the
+syntax of autocast here.
+</dd><p>
+<dt>action</dt>
<dd>The effect of the spells. You can add multiple actions, here is the syntax:
<pre>'action '((operation-name-1 parameters ... )
(operation-name-2 parameters ... )
@@ -382,76 +361,64 @@
</pre>
Here are the supported operations, their paramenters, and what they do.<p>
<dl>
- <dt>area-bombardment
+ <dt>area-bombardment</dt>
<dl>This will a number of missiles to be thrown in a square area. Here are
the available tags:
- <dt>fields
-
- <dd>The size of the affected square. This will get
- centered on the target It should really be an odd number, or it will
look
- wierd (not centered.)
-
- <dt>shards
-
- <dd>The amount of missiles to throw at random in the
- square.
-
- <dt>damage
-
- <dd>The damage of each individual missile.
- start-offset-x<dt>start-offset-y<dt>
+ <dt>fields</dt>
+ <dd>The size of the affected square. This will get centered on the
target
+ It should really be an odd number, or it will look wierd (not centered.)
+ </dd>
+ <dt>shards</dt>
+ <dd>The amount of missiles to throw at random in the square.
+ </dd>
+ <dt>damage</dt>
+ <dd>The damage of each individual missile.
+ </dd>
+ </dt>start-offset-x<dt>
+ </dt>start-offset-y<dt>
<dd>A missile hitting x,y will start at x+start-offset-x,
y+start-offset-y.
This value is in pixels, for better precision.
</dd>
</dl>
- <dt>adjust-buffs
+ <dt>adjust-buffs</dt>
<dl>This spell with set the time left for every buff. Buffs are temporary
bonuses or penalties for units, like better damage or reduced speed(on
enemies)
when setting buff-1-ticks 567 the unit will have 567 ticks of buff-1
left. 0 is
also a value, in fact acting like some sort of dispel magic.
Unfortunately
this is quite limited at the moment, here are the buffs provided and
what they do.
- <dt>haste-ticks
-
- <dd>The number of haste ticks. Haste gives the unit
- almost double speed for any activity.
-
- <dt>haste-ticks
-
- <dd>The number of slow ticks. Slow gives the unit
- double speed for all activities.
-
- <dt>bloodlust-ticks
-
- <dd>The number of bloodlust ticks. Bloodlust gives
- the unit double damage (both piercing and basic)
-
- <dt>invisibility-ticks
-
- <dd>The number of Invisibility ticks. Invisibility
- makes the unit completely dissapear for other players. It can still be
- affected by area effect spells though. The unit will appear when the
time
- is gone or when it will try to do anything except move. This has nothing
- to do with cloaking.
-
- <dt>invincibility-ticks
-
+ <dt>haste-ticks</dt>
+ <dd>The number of haste ticks. Haste gives the unit almost double speed
+ for any activity.
+ </dd>
+ <dt>haste-ticks</dt>
+ <dd>The number of slow ticks. Slow gives the unit double speed for all
+ activities.
+ </dd>
+ <dt>bloodlust-ticks</dt>
+ <dd>The number of bloodlust ticks. Bloodlust gives the unit double
damage
+ (both piercing and basic)
+ </dd>
+ <dt>invisibility-ticks</dt>
+ <dd>The number of Invisibility ticks. Invisibility makes the unit
completely
+ dissapear for other players. It can still be affected by area effect
spells
+ though. The unit will appear when the time is gone or when it will try
to do
+ anything except move. This has nothing to do with cloaking.
+ </dd>
+ <dt>invincibility-ticks</dt>
<dd>The number of invincibility ticks. This makes the unit completely
imune
to all forms of damage. Try using very low values for this :).
</dd>
</dl>
- <dt>adjust-vitals
+ <dt>adjust-vitals</dt>
<dl>This will adjust vitals of the unit. Vitals are health, mana, and on a
sunny
day maybe even shield. Possible tags:
- <dt>hit-points
-
- <dd>Unit hit-point gain, or loss if negative.
-
- <dt>mana
-
- <dd>Unit mana gain, or loss if negative.
-
- <dt>max-multi-cast
-
+ <dt>hit-points</dt>
+ <dd>Unit hit-point gain, or loss if negative.
+ </dd>
+ <dt>mana</dt>
+ <dd>Unit mana gain, or loss if negative.
+ </dd>
+ <dt>max-multi-cast</dt>
<dd>This spell usually has some very small limits (like heal 2
hit-points
for 1 caster mana), and will get casted multiple times at once, until
the
hp/mana limit for the unit is reached. You can set this to a reasonable
@@ -459,106 +426,87 @@
2 hit-points for 1 caster mana up to 20 hit-points/10 mana per cast
</dd>
</dl>
- <dt>demolish
+ <dt>demolish</dt>
<dl>This will remove any trees/rocks/walls in and inflict a fixed damage
to a fixed area. Possible tags:
- <dt>damage
-
- <dd>Each and every unit in range will receive that
- damage. FIXME: no support for dampening damage.
-
- <dt>range
-
+ <dt>damage</dt>
+ <dd>Each and every unit in range will receive that damage. FIXME: no
+ support for dampening damage.
+ </dd>
+ <dt>range</dt>
<dd>The range of the terrain and unit damage.
</dd>
</dl>
- <dt>summon
+ <dt>summon</dt>
<dl>This will summon a new unit. Possible tags:
- <dt>unit-type
-
- <dd>Type of the unit to summon. Must be already
- defined.
-
- <dt>ttl
-
- <dd>Time to live. The unit will only survive for that
- time, afterward it will receive 1 damage every game cycle, ending it's
- life. If this is 0 or ommited then the summoned unit is permanent
-
- <dt>require-corpse
-
- <dd>This flag does not take a value. When specified,
- the caster will summon an unit from a corpse, and consume the corpse in
- the process. You should make sure the summoned unit dies without a
corpse.
-
+ <dt>unit-type</dt>
+ <dd>Type of the unit to summon. Must be already defined.
+ </dd>
+ <dt>ttl</dt>
+ <dd>Time to live. The unit will only survive for that time, afterward it
+ will receive 1 damage every game cycle, ending it's life. If this is 0
+ or ommited then the summoned unit is permanent
+ </dd>
+ <dt>require-corpse</dt>
+ <dd>This flag does not take a value. When specified, the caster will
+ summon an unit from a corpse, and consume the corpse in the process.
+ You should make sure the summoned unit dies without a corpse.
+ </dd>
How to do a reveal-map spell: define a special unit, give it the
'revealer flag, and set the spell's range to 'infinite. Please see
- <A href="unittype.html#define-unit-type">(define-unit-type)</a>
-
-
- </dd></dl>
- <dt>polymorph
+ <a href="unittype.html#define-unit-type">(define-unit-type)</a>
+ </dd>
+ </dl>
+ <dt>polymorph</dt>
<dl>This will tranform the unit, giving it a new unit type. Before you
ask, temporary polymorphing is not supported, but it would be a nice
feature to add in the future. There is only one tag:
- <dt>unit-type
-
+ <dt>unit-type</dt>
<dd>Type of the unit to transform to. Must be already defined. This
spell
can be used as an instant-kill spell by polymorphing into a harmless
unit,
like a chicken.
</dd>
</dl>
- <dt>spawn-missile
+ <dt>spawn-missile</dt>
<dl>This will spawn a missile in the game. It's one of the most versatile
spell variants. Here are the paramenters:
- <dt>ttl
-
- <dd>Time to live for the missile. Usually means that
- the missile is gone after this time, but for some missile classes it
means
- something else.
-
- <dt>damage
-
- <dd>This is the damage for this missile, overriding
- the standard damage defined for the missile.
-
- <dt>delay
-
- <dd>This is the delay for the missile. it means the
- missile will only appear after this many ticks.
-
- <dt>start-point/end-point
-
+ <dt>ttl</dt>
+ <dd>Time to live for the missile. Usually means that the missile is
+ gone after this time, but for some missile classes it means something
else.
+ </dd>
+ <dt>damage</dt>
+ <dd>This is the damage for this missile, overriding the standard damage
+ defined for the missile.
+ </dd>
+ <dt>delay</dt>
+ <dd>This is the delay for the missile. it means the missile will only
+ appear after this many ticks.
+ </dd>
+ <dt>start-point/end-point</dt>
<dl>Point to point-ish missiles need a start and an end point for the
trajectory. it is defined like this:
<pre>start-point (base caster/target add-x add-y add-rand-x
add-rand-y)</pre>
The individual tags should be self-explanatory, but here goes:
- <dt>base
-
- <dd>The base for the location calculation. Can be
- either caster or target.
-
- <dt>add-x
-
- <dd>How much to add to the x coordinate, in pixels
-
- <dt>add-y
-
- <dd>How much to add to the y coordinate, in pixels
-
- <dt>add-rand-x
-
- <dd>Add a random from 0 to value-1 to the x
- coordinate, in pixels
-
- <dt>add-rand-y
-
+ <dt>base</dt>
+ <dd>The base for the location calculation. Can be either caster or
target.
+ </dd>
+ <dt>add-x</dt>
+ <dd>How much to add to the x coordinate, in pixels
+ </dd>
+ <dt>add-y</dt>
+ <dd>How much to add to the y coordinate, in pixels
+ </dd>
+ <dt>add-rand-x</dt>
+ <dd>Add a random from 0 to value-1 to the x coordinate, in pixels
+ </dd>
+ <dt>add-rand-y</dt>
<dd>Add a random from 0 to value-1 to the y coordinate, in pixels
</dd>
- </dl></dt>
- </dl></dt></dl>
- </dd>
+ </dl>
</dl>
+</dl>
+</dd>
+</dl>
<h4>Example</h4>
<pre>
@@ -573,105 +521,91 @@
)
</pre>
<h4>Used</h4>
-<A href="../../data/ccl/spells.ccl"> $LIBARYPATH/ccl/spells.ccl </a>
+<a href="../../data/ccl/spells.ccl"> $LIBARYPATH/ccl/spells.ccl </a>
<a name="missile"></a>
<h3>(missile tag 'value ... )</h3>
This function will define a mid-game missile, and it is mostly used in
savegames.
<dl>
-<dt>type
-
+<dt>type</dt>
<dd>The type of the missile. Declared with
-<A href="#define-missile-type" >(define-missile-type)</a>
-<dt>pos
-
-<dd>The current position of the missile. It's list of and
- y values. Coordinates are in pixels, not tiles. F.E 'pos (4500 3450)
-
-<dt>origin-pos
-
-<dd>The starting position of the missile. It's list of
- and y values. Coordinates are in pixels, not tiles. F.E 'pos (4505 3455)
-
-<dt>goal
-
-<dd>The position of the missile's destination. It's list
- of and y values. Coordinates are in pixels, not tiles. F.E 'gold (4510 3460)
-
-<dt>local
-
-<dd>This unit is marked as local, and it's visible only
- to the player. This is used for instance for cursor marks on the map. Either
- local or global must be specified.
-
-<dt>global
-
-<dd>This unit is marked as global, and it's visible to
- all players. Either local or global must be specified.
-
-<dt>frame
-
+<a href=#define-missile-type>(define-missile-type)</a>
+</dd>
+<dt>pos</dt>
+<dd>The current position of the missile. It's list of and y values.
Coordinates are
+in pixels, not tiles. F.E 'pos (4500 3450)
+</dd>
+<dt>origin-pos</dt>
+<dd>The starting position of the missile. It's list of and y values.
Coordinates are
+in pixels, not tiles. F.E 'pos (4505 3455)
+</dd>
+<dt>goal</dt>
+<dd>The position of the missile's destination. It's list of and y values.
Coordinates are
+in pixels, not tiles. F.E 'gold (4510 3460)
+</dd>
+<dt>local</dt>
+<dd>This unit is marked as local, and it's visible only to the player. This
+is used for instance for cursor marks on the map. Either local or global must
be specified.
+</dd>
+<dt>global</dt>
+<dd>This unit is marked as global, and it's visible to all players. Either
+local or global must be specified.
+</dd>
+<dt>frame</dt>
<dd>Current sprite frame of the missile. The range is from 0 to the
-<A href="#FRAMES-Define-missile-type">type:frames</a>-1 The topmost bit
- (128) is used as flag to mirror the sprites in the X direction.
-
-<dt>state
-
-<dd>Current state of the missile. Used for a simple state
- machine, dependand on the missile class.
-
-<dt>wait
-
-<dd>Wait this number of game cycles until the next state
- or animation of this missile is handled. This counts down from type:sleep to
- 0.
-
-<dt>delay
-
+<a href="#FRAMES-Define-missile-type">type:frames</a>-1
+The topmost bit (128) is used as flag to mirror the sprites in the X direction.
+</dd>
+<dt>state</dt>
+<dd>Current state of the missile. Used for a simple state machine, dependand
on
+the missile class.
+</dd>
+<dt>wait</dt>
+<dd>Wait this number of game cycles until the next state or animation of this
+missile is handled. This counts down from type:sleep to 0.
+</dd>
+<dt>delay</dt>
<dd>Number of game cycles left until the missile is first shown on the map.
-Please see <A href="#delay-define-missile-type">delay in
(define-missile-type)</a>
+Please see <a href="#delay-define-missile-type">delay in
(define-missile-type)</a>
+</dd>
<dt>source<dt>
-<dd>Number of the owner of the missile. Normally the one
- who fired the missile. Used to check units, to prevent hitting the owner.
Also
- used for kill and experience points, and for giving the owning player score.
-
+<dd>Number of the owner of the missile. Normally the one who fired the missile.
+Used to check units, to prevent hitting the owner. Also used for kill and
+experience points, and for giving the owning player score.
+</dd>
<dt>target<dt>
-<dd>Number of the missile's target. Normally the unit
- which should be hit by the missile.
-
+<dd>Number of the missile's target. Normally the unit which should be
+hit by the missile.
+</dd>
<dt>damage<dt>
-<dd>Damage done by missile. Units next to it can receive
- some reduced splash damage, this is the full damage.
-
-<dt>ttl
-
-<dd>Time to live in game cycles of the missile, if it
- reaches zero the missile is automatically removed from the map. If -1 the
- missile lives for ever and the lifetime is handled by other means.
-
-<dt>hidden
-
-<dd>This marks the unit as hidden, until the unit is
- shown again in the controlling function. No parameters.
- <DT>transparency
- <DD>Draws the missile with a XX% transparency. Current supported value is 50
- only.</DD>
+<dd>Damage done by missile. Units next to it can receive some reduced splash
+damage, this is the full damage.
+</dd>
+<dt>ttl</dt>
+<dd>Time to live in game cycles of the missile, if it reaches zero
+the missile is automatically removed from the map. If -1 the
+missile lives for ever and the lifetime is handled by other means.
+</dd>
+<dt>hidden</dt>
+<dd>This marks the unit as hidden, until the unit is shown again in the
+controlling function. No parameters.
+</dd>
</dl>
<h4>Example</h4>
-<pre> (missile 'type-fireball
- 'pos '(10 10) 'goal '(10 50) 'global 'state
- 0 'wait 5 'damage 5000 'source 45 'ttl -1 'transparency 50)
+<pre>
+ (missile 'type-fireball 'pos '(10 10) 'goal '(10 50)
+ 'global 'state 0 'wait 5 'damage 5000 'source 45 'ttl -1)
</pre>
<h4>Used</h4>
-<A href="../../data/ccl/wc2.ccl"> $LIBARYPATH/ccl/wc2.ccl </a>
+<a href="../../data/ccl/wc2.ccl"> $LIBARYPATH/ccl/wc2.ccl </a>
<hr>
-Last changed: $Id: magic.html,v 1.10 2003/12/13 16:12:38 mohydine Exp $<br>
+Last changed: $Id: magic.html,v 1.11 2003/12/13 20:54:10 jsalmon3 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/ui.html
diff -u stratagus/doc/ccl/ui.html:1.20 stratagus/doc/ccl/ui.html:1.21
--- stratagus/doc/ccl/ui.html:1.20 Sun Dec 14 03:12:38 2003
+++ stratagus/doc/ccl/ui.html Sun Dec 14 07:54:11 2003
@@ -25,40 +25,40 @@
</head>
<body>
<h1>Stratagus Configuration Language Description: User Interface (UI)</h1>
-<hr><pre width=80> _________ __
- __ / _____//
- |_____________ _/ |______ ____ __ __ ______ \_____ \\
- __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \|
- | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______
- /|__| |__| (____ /__| (____ /\___ /|____//____ >
+<hr><pre width=80>
+ _________ __ __
+ / _____// |_____________ _/ |______ ____ __ __ ______
+ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
+ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
+ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
</pre>
<p><b>(C) Copyright 2002-2003 by The Stratagus Project. Distributed under the
-<A href="../gpl.html">"GNU General Public License"</a></b>
+<a href="../gpl.html">"GNU General Public License"</a></b>
<hr>
-<A href="../stratagus.html">Stratagus</a>
-<A href="../readme.html">Readme</a>
-<A href="../faq.html">FAQ</a>
-<A href="ccl.html">CCL</a>
-<A href="triggers.html">PREV</a>
-<A href="unittype.html">NEXT</a>
-<A href="ccl-index.html">Index</a>
+<a href="../stratagus.html">Stratagus</a>
+<a href="../readme.html">Readme</a>
+<a href="../faq.html">FAQ</a>
+<a href="ccl.html">CCL</a>
+<a href="triggers.html">PREV</a>
+<a href="unittype.html">NEXT</a>
+<a href="ccl-index.html">Index</a>
<hr>
-<A href="#define-button">define-button</a>
-<A href="#define-cursor">define-cursor</a>
-<A href="#define-font">define-font</a>
-<A href="#define-font-colors">define-font-colors</a>
-<A href="#define-menu">define-menu</a>
-<A href="#define-menu-graphics">define-menu-graphics</a>
-<A href="#define-menu-item">define-menu-item</a>
-<A href="#define-ui">define-ui</a>
-<A href="#define-viewports">define-viewports</a>
-<A href="#display-picture">display-picture</a>
-<A href="#process-menu">process-menu</a>
-<A href="#set-game-cursor!">set-game-cursor!</a>
+<a href="#define-button">define-button</a>
+<a href="#define-cursor">define-cursor</a>
+<a href="#define-font">define-font</a>
+<a href="#define-font-colors">define-font-colors</a>
+<a href="#define-menu">define-menu</a>
+<a href="#define-menu-graphics">define-menu-graphics</a>
+<a href="#define-menu-item">define-menu-item</a>
+<a href="#define-ui">define-ui</a>
+<a href="#define-viewports">define-viewports</a>
+<a href="#display-picture">display-picture</a>
+<a href="#process-menu">process-menu</a>
+<a href="#set-game-cursor!">set-game-cursor!</a>
<hr>
<h2>Intro - Introduction to UI functions and variables</h2>
@@ -70,57 +70,45 @@
Define a button in the button panel show during the game. Possible tags:
<dl>
-<dt>forunit
-
-<dd>List of units the button applies to, or '(*) for all
- units.
-
-<dt>pos
-
+<dt>forunit</dt>
+<dd>List of units the button applies to, or '(*) for all units.
+</dd>
+<dt>pos</dt>
<dd>Position number.
<pre>
0 1 2
3 4 5
6 7 8
</pre>
-<dt>level
-
-<dd>Visible when in this button level (0 default, 9
- cancel-only)
-
-<dt>icon
-
-<dd>Name of the icon to display.
-
-<dt>action
-
-<dd>Action to perform when the button is clicked. Can be
- any of the following: move, stop, attack, repair, harvest, button, build,
- train-unit, patrol, stand-ground, attack-ground, return-goods, demolish,
- cast-spell, research, upgrade-to, unload, cancel, cancel-upgrade,
- cancel-train-unit, cancel-build.
-
-<dt>value
-
-<dd>Optional value associated with the action.
-
-<dt>allowed
-
-<dd>Optional check to see if a button is allowed. Can be
- any of the following: check-true, check-false, check-upgrade,
check-units-or,
- check-units-and, check-network, check-no-work, check-no-research,
- check-attack, check-upgrade-to, check-research, check-single-research.
-
-<dt>allowarg
-
-<dd>Optional argument used by the allowed function.
-
-<dt>key
-
-<dd>Shortcut key for the button.
-
-<dt>hint
-
+</dd>
+<dt>level</dt>
+<dd>Visible when in this button level (0 default, 9 cancel-only)
+</dd>
+<dt>icon</dt>
+<dd>Name of the icon to display.
+</dd>
+<dt>action</dt>
+<dd>Action to perform when the button is clicked. Can be any of the following:
+move, stop, attack, repair, harvest, button, build, train-unit, patrol,
+stand-ground, attack-ground, return-goods, demolish, cast-spell, research,
+upgrade-to, unload, cancel, cancel-upgrade, cancel-train-unit, cancel-build.
+</dd>
+<dt>value</dt>
+<dd>Optional value associated with the action.
+</dd>
+<dt>allowed</dt>
+<dd>Optional check to see if a button is allowed. Can be any of the following:
+check-true, check-false, check-upgrade, check-units-or, check-units-and,
+check-network, check-no-work, check-no-research, check-attack,
+check-upgrade-to, check-research, check-single-research.
+</dd>
+<dt>allowarg</dt>
+<dd>Optional argument used by the allowed function.
+</dd>
+<dt>key</dt>
+<dd>Shortcut key for the button.
+</dd>
+<dt>hint</dt>
<dd>Hint to be displayed for the button.
</dd>
</dl>
@@ -140,35 +128,28 @@
Define a cursor.
<dl>
-<dt>ident
-
-<dd>Unique identifier of the cursor, used to reference it
- in config files and during startup.
-
-<dt>race
-
+<dt>ident</dt>
+<dd>Unique identifier of the cursor, used to reference it in config files and
+during startup.
+</dd>
+<dt>race</dt>
<dd>Race to use this cursor with or "any" to use with any race.
</dd>
</dl>
Possible tags:
<dl>
-<dt>image
-
-<dd>Path to the image graphic.
-
-<dt>hot-spot
-
-<dd>Hot spot of the cursor in pixels, in the form '(x y).
- Relative to the sprite origin (0,0). The hot spot of a cursor is the point
to
- which Stratagus refers in tracking the cursor's position.
-
-<dt>size
-
-<dd>Size of the cursor in pixels, in the form '(width
- height).
-
-<dt>rate
-
+<dt>image</dt>
+<dd>Path to the image graphic.
+</dd>
+<dt>hot-spot</dt>
+<dd>Hot spot of the cursor in pixels, in the form '(x y). Relative to the
sprite origin (0,0). The
+hot spot of a cursor is the point to which Stratagus refers in tracking the
+cursor's position.
+</dd>
+<dt>size</dt>
+<dd>Size of the cursor in pixels, in the form '(width height).
+</dd>
+<dt>rate</dt>
<dd>Rate of changing the frames if using an animated cursor. The "rate" tells
the engine how many milliseconds to hold each frame of the animation.
</dd>
@@ -188,18 +169,14 @@
Define a font.
<dl>
-<dt>type
-
-<dd>Type of font. Supported types are: 'game, 'small,
- 'large, 'small-title, and 'large-title.
-
-<dt>file
-
-<dd>File name for font file. Currently only multicolor
- bitmap fonts supported.
-
-<dt>size
-
+<dt>type</dt>
+<dd>Type of font. Supported types are: 'game, 'small, 'large, 'small-title,
+and 'large-title.
+</dd>
+<dt>file</dt>
+<dd>File name for font file. Currently only multicolor bitmap fonts supported.
+</dd>
+<dt>size</dt>
<dd>Font size width and height.
</dd>
</dl>
@@ -218,12 +195,10 @@
What's the relation with the palette?
<dl>
-<dt>color
-
-<dd>Name of the color.
-
-<dt>array
-
+<dt>color</dt>
+<dd>Name of the color.
+</dd>
+<dt>array</dt>
<dd>Name of the color.
Array of 7 rgb colors #( r1 g1 b1 r2 g2 b2 ...)<br>
The colors are:
@@ -237,8 +212,8 @@
<tr><td>#6 </td><td>is the light shadow color</td></tr>
<tr><td>#255 </td><td>is transparent</td></tr>
</table>
- <UL></UL>
</dd>
+</ul>
</dl>
<h4>Example</h4>
@@ -261,25 +236,19 @@
Possible tags:
<dl>
-<dt>geometry
-
-<dd>'(x y width height)
-
-<dt>name
-
-<dd>Name of this menu.
-
-<dt>panel
-
-<dd>Panel name (FIXME: how is it used?), or 'none.
-
-<dt>default
-
-<dd>An integer. FIXME: what for? Default button, or what?
-
-
-<dt>netaction
-
+<dt>geometry</dt>
+<dd>'(x y width height)
+</dd>
+<dt>name</dt>
+<dd>Name of this menu.
+</dd>
+<dt>panel</dt>
+<dd>Panel name (FIXME: how is it used?), or 'none.
+</dd>
+<dt>default</dt>
+<dd>An integer. FIXME: what for? Default button, or what?
+</dd>
+<dt>netaction</dt>
<dd>Eg. 'terminate-net-connect.
</dd>
</dl>
@@ -296,12 +265,10 @@
Define the menu graphics for each of the races.
<dl>
-<dt>filename
-
-<dd>Path to the file containing the menu graphics.
-
-<dt>w, h
-
+<dt>filename</dt>
+<dd>Path to the file containing the menu graphics.
+</dd>
+<dt>w, h</dt>
<dd>Width and height of an image in the menu graphic.
</dd>
</dl>
@@ -323,7 +290,7 @@
<pre>
(define-menu-item 'pos (list 16 (- 288 40)) 'font 'large
'button '(size (224 27)
- caption "Return to Game (~<ESC~>)"
+ caption "Return to Game (~<Esc~>)"
hotkey "esc"
func game-menu-return
style gm-full)
@@ -333,64 +300,53 @@
Possible tags:
<dl>
- <DT>transparent
- <DD>Draw the item with a 50% transparency.
- <DT>pos </DT>
-<dd>Position, in the form '(x y).
-
-<dt>menu
-
-<dd>Menu this item belogs to.
-
-<dt>flags
-
-<dd>Most likely '(disabled). Other possibilities:
- '(active), '(clicked), '(selected). FIXME: are the paranthesis really
needed?
-
-<dt>font
-
-<dd>Font name (see <A href="#define-font">define-font</a>).
-
-<dt>init
-
-<dd>Init function (there are a couple of hardcoded C
- funtions allowed, like 'save-replay-init or 'scen-select-init).
-
-<dt>exit
-
-<dd>Exit funtion (again some C functions like
- 'speed-options-exit or 'load-game-exit).
-
-<dt>text
-
+<dt>pos</dt>
+<dd>Position, in the form '(x y).
+</dd>
+<dt>menu</dt>
+<dd>Menu this item belogs to.
+</dd>
+<dt>flags</dt>
+<dd>Most likely '(disabled).
+Other possibilities: '(active), '(clicked), '(selected).
+FIXME: are the paranthesis really needed?
+</dd>
+<dt>font</dt>
+<dd>Font name (see <a href="#define-font">define-font</a>).
+</dd>
+<dt>init</dt>
+<dd>Init function (there are a couple of
+hardcoded C funtions allowed, like 'save-replay-init or
+'scen-select-init).
+</dd>
+<dt>exit</dt>
+<dd>Exit funtion (again some C functions like 'speed-options-exit or
+'load-game-exit).
+</dd>
+<dt>text</dt>
<dd>The item is a text label. The value is a list of tags, for example:
<pre>
'text '(caption "Connecting to server" align center)
</pre>Allowed tags:
<dl>
- <dt>align
-
- <dd>Left, right or center.
-
- <dt>caption
-
- <dd>The text.
-
- <dt>func
-
- <dd>C handler. FIXME: when called?
-
- <dt>color-normal
-
- <dd>FIXME.
-
- <dt>color-reverse
-
+ <dt>align</dt>
+ <dd>Left, right or center.
+ </dd>
+ <dt>caption</dt>
+ <dd>The text.
+ </dd>
+ <dt>func</dt>
+ <dd>C handler. FIXME: when called?
+ </dd>
+ <dt>color-normal</dt>
+ <dd>FIXME.
+ </dd>
+ <dt>color-reverse</dt>
<dd>FIXME.
</dd>
</dl>
-<dt>button
-
+</dd>
+<dt>button</dt>
<dd>The item is a button. The value is a list of tags like
<pre>
'button '(size (224 27)
@@ -402,20 +358,16 @@
Allowed tags: align, caption, color-normal, color-reverse (see above)
and:
<dl>
- <dt>size
-
- <dd>Dimensions (width height).
-
- <dt>func
-
- <dd>C handler. FIXME: when called?
-
- <dt>hotkey
-
- <dd>A string like "f8".
-
- <dt>style
-
+ <dt>size</dt>
+ <dd>Dimensions (width height).
+ </dd>
+ <dt>func</dt>
+ <dd>C handler. FIXME: when called?
+ </dd>
+ <dt>hotkey</dt>
+ <dd>A string like "f8".
+ </dd>
+ <dt>style</dt>
<dd>Complete list of possible styles (not all for buttons):<br>
main, network, gm-half, 132, gm-full, gem-round, gem-square,
up-arrow, down-arrow, left-arrow, right-arrow, s-knob, s-vcont,
@@ -427,8 +379,8 @@
FIXME: describe them
</dd>
</dl>
-<dt>gem
-
+</dd>
+<dt>gem</dt>
<dd>The item is a gem.
Example:
<pre>
@@ -441,13 +393,12 @@
Allowed tags: size func style text color-normal color-reverse (see
above) and:
<dl>
- <dt>state
-
+ <dt>state</dt>
<dd>One of unchecked, passive, invisible or checked.
</dd>
</dl>
-<dt>pulldown
-
+</dd>
+<dt>pulldown</dt>
<dd>The item is a pulldown menu.
Example:
<pre>
@@ -460,30 +411,24 @@
</pre>
Allowed tags: size state default current (see above) and:
<dl>
- <dt>options
-
- <dd>A list of strings to select from.
-
- <dt>func
-
- <dd>C handler. FIXME: when called?
-
- <dt>state
-
- <dd>The only possible value: passive
-
- <dt>default
-
- <dd>An integer for the default selection id, starting
- with 0.
-
- <dt>current
-
+ <dt>options</dt>
+ <dd>A list of strings to select from.
+ </dd>
+ <dt>func</dt>
+ <dd>C handler. FIXME: when called?
+ </dd>
+ <dt>state</dt>
+ <dd>The only possible value: passive
+ </dd>
+ <dt>default</dt>
+ <dd>An integer for the default selection id, starting with 0.
+ </dd>
+ <dt>current</dt>
<dd>An integer for the current selection id, starting with 0.
</dd>
</dl>
-<dt>listbox
-
+</dd>
+<dt>listbox</dt>
<dd>The item is a list box.
Example:
<pre>
@@ -497,31 +442,24 @@
Allowed tags: size style default current color-normal color-reverse
(see above) and:
<dl>
- <dt>func
-
- <dd>C handler. FIXME: when called?
-
- <dt>handler
-
- <dd>C handler. FIXME: when is it called?
-
- <dt>retopt
-
- <dd>C handler to retrieve the list of options, I guess.
-
-
- <dt>startline
-
- <dd>For scrolling, I guess. Probably only used in
- savegames.
-
- <dt>nlines
-
+ <dt>func</dt>
+ <dd>C handler. FIXME: when called?
+ </dd>
+ <dt>handler</dt>
+ <dd>C handler. FIXME: when is it called?
+ </dd>
+ <dt>retopt</dt>
+ <dd>C handler to retrieve the list of options, I guess.
+ </dd>
+ <dt>startline</dt>
+ <dd>For scrolling, I guess. Probably only used in savegames.
+ </dd>
+ <dt>nlines</dt>
<dd>Number of lines.
</dd>
</dl>
-<dt>vslider
-
+</dd>
+<dt>vslider</dt>
<dd>The item is a vertical slider.
Example:
<pre>
@@ -531,31 +469,24 @@
</pre>
Allowed tags: size default current style (see above) and:
<dl>
- <dt>func
-
- <dd>C handler. FIXME: when is it called?
-
- <dt>handler
-
- <dd>C handler. FIXME: when is it called?
-
- <dt>flags
-
- <dd>FIXME: never seen this used. Possible values: up,
- down, left, right, knob, cont
-
- <dt>startline
-
- <dd>For scrolling, I guess. Probably only used in
- savegames.
-
- <dt>nlines
-
+ <dt>func</dt>
+ <dd>C handler. FIXME: when is it called?
+ </dd>
+ <dt>handler</dt>
+ <dd>C handler. FIXME: when is it called?
+ </dd>
+ <dt>flags</dt>
+ <dd>FIXME: never seen this used. Possible values: up, down, left, right,
knob, cont
+ </dd>
+ <dt>startline</dt>
+ <dd>For scrolling, I guess. Probably only used in savegames.
+ </dd>
+ <dt>nlines</dt>
<dd>Number of lines.
</dd>
</dl>
-<dt>hslider
-
+</dd>
+<dt>hslider</dt>
<dd>The item is a horizontal slider. See vslider above.
Example:
<pre>
@@ -563,8 +494,8 @@
func master-volume-hs-action
handler scen-select-ok)
</pre>
-<dt>drawfunc
-
+</dd>
+<dt>drawfunc</dt>
<dd>The item is drawn from a C function. The value is the name of the
function.
Example:
@@ -573,8 +504,8 @@
'drawfunc 'game-draw-func
'menu 'menu-custom-game)
</pre>
-<dt>input
-
+</dd>
+<dt>input</dt>
<dd>The item is a text input field.
Example:
<pre>
@@ -585,13 +516,10 @@
Allowed tags: size func style color-normal color-reverse (see above)
and:
<dl>
- <dt>maxch
-
- <dd>Maximal number of characters. FIXME: never seen
- this used.
-
- <dt>func
-
+ <dt>maxch</dt>
+ <dd>Maximal number of characters. FIXME: never seen this used.
+ </dd>
+ <dt>func</dt>
<dd>C handler, seems to be called when a key is pressed and
just checks whether it is RETURN.
</dd>
@@ -649,40 +577,39 @@
All of those tags should be given:
<dl>
-<dt>normal-font-color
-
+<dt>normal-font-color</dt>
<dd>
<pre>
'normal-font-color (if (= race 'alliance) 'white 'yellow)
</pre>
-<dt>reverse-font-color
-
+</dd>
+<dt>reverse-font-color</dt>
<dd>
<pre>
'reverse-font-color (if (= race 'alliance) 'yellow 'white)
</pre>
-<dt>filler
-
+</dd>
+<dt>filler</dt>
<dd>
<pre>
-
- 'filler (list 'file (string-append "graphics/ui/"
- race"/" (number->string screen_width) "x"(number->string
screen_height)
+ 'filler (list
+ 'file (string-append "graphics/ui/" race "/"
+ (number->string screen_width) "x" (number->string screen_height)
"/filler1.png")
'pos (list fillerx fillery))
</pre>
-<dt>resource-line
-
+</dd>
+<dt>resource-line</dt>
<dd>
<pre>
-
- 'resource-line (list (string-append "graphics/ui/"
- race"/" (number->string screen_width) "x"(number->string
screen_height)
+ 'resource-line (list
+ (string-append "graphics/ui/" race "/"
+ (number->string screen_width) "x" (number->string screen_height)
"/resource.png")
0 0)
</pre>
-<dt>resources
-
+</dd>
+<dt>resources</dt>
<dd>
<pre>
'resources (list
@@ -693,16 +620,16 @@
'score (list 'file "graphics/ui/score.png" 'row 0
'pos (list (- screen_width 16 68) 0) 'size '(14 14) 'text-pos (list (+
(- screen_width 16 68) 18) 1)))
</pre>
-<dt>info-panel
-
+</dd>
+<dt>info-panel</dt>
<dd>
<pre>
'info-panel (list
(string-append "graphics/ui/" race "/infopanel.png")
infox infoy 176 176)
</pre>
-<dt>completed-bar
-
+</dd>
+<dt>completed-bar</dt>
<dd>
<pre>
'completed-bar (list
@@ -713,32 +640,32 @@
'font 'game
'text-pos (list (+ infox 14 38) (+ infoy 151)))
</pre>
-<dt>button-panel
-
+</dd>
+<dt>button-panel</dt>
<dd>
<pre>
'button-panel (list
(string-append "graphics/ui/" race "/buttonpanel.png")
buttonx buttony)
</pre>
-<dt>map-area
-
+</dd>
+<dt>map-area</dt>
<dd>
<pre>
'map-area (list
'pos '(0 16)
'size (list mapw maph))
</pre>
-<dt>menu-panel
-
+</dd>
+<dt>menu-panel</dt>
<dd>
<pre>
'menu-panel (list
(string-append "graphics/ui/" race "/menubutton.png")
minimapx (+ minimapy 148))
</pre>
-<dt>minimap
-
+</dd>
+<dt>minimap</dt>
<dd>
There is a minimap panel an the minimap on it. The panel graphic has
certain palette restrictions (FIXME: exactly? probably the same as the
@@ -753,20 +680,20 @@
'size '(128 128)
'transparent)
</pre>
-<dt>status-line
-
+</dd>
+<dt>status-line</dt>
<dd>
<pre>
-
- 'status-line (list 'file (string-append "graphics/ui/"
- race"/" (number->string screen_width) "x"(number->string
screen_height)
+ 'status-line (list
+ 'file (string-append "graphics/ui/" race "/"
+ (number->string screen_width) "x" (number->string screen_height)
"/statusline.png")
'pos (list statusx statusy)
'text-pos (list (+ statusx 6) (+ statusy 2))
'font 'game)
</pre>
-<dt>menu-button
-
+</dd>
+<dt>menu-button</dt>
<dd>
<pre>
'menu-button (list
@@ -775,8 +702,8 @@
'caption "Menu (~<F10~>)"
'style 'main)
</pre>
-<dt>network-menu-button
-
+</dd>
+<dt>network-menu-button</dt>
<dd>
<pre>
'network-menu-button '(
@@ -785,8 +712,8 @@
caption "Menu"
style network)
</pre>
-<dt>network-diplomacy-button
-
+</dd>
+<dt>network-diplomacy-button</dt>
<dd>
<pre>
'network-diplomacy-button '(
@@ -795,8 +722,8 @@
caption "Diplomacy"
style network)
</pre>
-<dt>info-buttons
-
+</dd>
+<dt>info-buttons</dt>
<dd>Position of the unit icons on the info panel. Example:
<pre>
'info-buttons (list
@@ -810,20 +737,18 @@
(list 'pos (list (+ infox 65) (+ infoy 116)) 'size '(46 38))
(list 'pos (list (+ infox 121) (+ infoy 116)) 'size '(46 38)))
</pre>
-<dt>training-buttons
-
-<dd>Position of the unit icons in the training queue.
- Should be the same positions as info-buttons above but without the last
three.
- (FIXME: is this a requirement?)
-
-<dt>button-buttons
-
-<dd>Position of the action buttons (attack, move, etc.).
- Currently there must be nine of them, and they must be on the button panel.
- Same syntax as above.
-
-<dt>cursors
-
+</dd>
+<dt>training-buttons</dt>
+<dd>Position of the unit icons in the training queue. Should be the
+same positions as info-buttons above but without the last
+three. (FIXME: is this a requirement?)
+</dd>
+<dt>button-buttons</dt>
+<dd>Position of the action buttons (attack, move, etc.). Currently
+there must be nine of them, and they must be on the button panel. Same
+syntax as above.
+</dd>
+<dt>cursors</dt>
<dd>
<pre>
'cursors '(
@@ -843,8 +768,8 @@
arrow-s cursor-arrow-s
arrow-se cursor-arrow-se)
</pre>
-<dt>menu-panels
-
+</dd>
+<dt>menu-panels</dt>
<dd>FIXME: this really needs docu or change, if you dig out the
requirement of the pictures, write them down here. Example:
<pre>
@@ -855,14 +780,14 @@
'panel4 (string-append "graphics/ui/" race "/panel_4.png")
'panel5 (string-append "graphics/ui/" race "/panel_5.png"))
</pre>
-<dt>victory-background
-
+</dd>
+<dt>victory-background</dt>
<dd>Background image for the victory screen. The image will be scaled. Example:
<pre>
'victory-background (string-append "graphics/ui/" race "/victory.png")
</pre>
-<dt>defeat-background
-
+</dd>
+<dt>defeat-background</dt>
<dd>Background image for the victory screen. The image will be scaled. Example:
<pre>
'defeat-background (string-append "graphics/ui/" race "/defeat.png")
@@ -877,17 +802,13 @@
scenarios.
<dl>
-<dt>mode
-
-<dd>Number corresponding to the viewport mode. See the
- ViewportMode enum.
-
-<dt>mapx
-
-<dd>X coordinate of the map tile.
-
-<dt>mapy
-
+<dt>mode</dt>
+<dd>Number corresponding to the viewport mode. See the ViewportMode enum.
+</dd>
+<dt>mapx</dt>
+<dd>X coordinate of the map tile.
+</dd>
+<dt>mapy</dt>
<dd>Y coordinate of the map tile.
</dd>
</dl>
@@ -911,8 +832,7 @@
<dl>
-<dt>file
-
+<dt>file</dt>
<dd>Path to the image graphic.
</dd>
</dl>
@@ -933,8 +853,7 @@
<dl>
-<dt>id
-
+<dt>id</dt>
<dd>ID of the menu.
</dd>
</dl>
@@ -955,8 +874,7 @@
<dl>
-<dt>ident
-
+<dt>ident</dt>
<dd>Unique identifier of the cursor.
</dd>
</dl>
@@ -971,7 +889,7 @@
<h4>Not Used</h4>
<hr>
-Last changed: $Id: ui.html,v 1.20 2003/12/13 16:12:38 mohydine Exp $<br>
+Last changed: $Id: ui.html,v 1.21 2003/12/13 20:54:11 jsalmon3 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.30
stratagus/src/clone/ccl_spell.c:1.31
--- stratagus/src/clone/ccl_spell.c:1.30 Sun Dec 14 06:10:28 2003
+++ stratagus/src/clone/ccl_spell.c Sun Dec 14 07:54:11 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_spell.c,v 1.30 2003/12/13 19:10:28 mohydine Exp $
+// $Id: ccl_spell.c,v 1.31 2003/12/13 20:54:11 jsalmon3 Exp $
//@{
/*----------------------------------------------------------------------------
@@ -240,23 +240,7 @@
errl("Unsupported area-bombardment tag", value);
}
}
- } else if (gh_eq_p(value, gh_symbol2scm("reclaim"))) {
- spellaction->CastFunction = CastReclaim;
- while (!gh_null_p(list)) {
- value = gh_car(list);
- list = gh_cdr(list);
- if (gh_eq_p(value, gh_symbol2scm("range"))) {
- spellaction->Data.Demolish.Range = gh_scm2int(gh_car(list));
- list = gh_cdr(list);
- } else if (gh_eq_p(value, gh_symbol2scm("damage"))) {
- spellaction->Data.Demolish.Damage = gh_scm2int(gh_car(list));
- list = gh_cdr(list);
- } else {
- errl("Unsupported reclaim tag", value);
- }
-
- }
- } else if (gh_eq_p(value, gh_symbol2scm("demolish"))) {
+ } else if (gh_eq_p(value, gh_symbol2scm("demolish"))) {
spellaction->CastFunction = CastDemolish;
while (!gh_null_p(list)) {
value = gh_car(list);
@@ -270,7 +254,6 @@
} else {
errl("Unsupported demolish tag", value);
}
-
}
} else if (gh_eq_p(value, gh_symbol2scm("adjust-buffs"))) {
spellaction->CastFunction = CastAdjustBuffs;
Index: stratagus/src/clone/mainloop.c
diff -u stratagus/src/clone/mainloop.c:1.168
stratagus/src/clone/mainloop.c:1.169
--- stratagus/src/clone/mainloop.c:1.168 Sun Dec 14 03:14:43 2003
+++ stratagus/src/clone/mainloop.c Sun Dec 14 07:54:12 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mainloop.c,v 1.168 2003/12/13 16:14:43 mohydine Exp $
+// $Id: mainloop.c,v 1.169 2003/12/13 20:54:12 jsalmon3 Exp $
//@{
@@ -274,33 +274,30 @@
TheUI.MenuPanelX, TheUI.MenuPanelY);
}
if (NetworkFildes == (Socket)-1) {
- //FIX ME: Transparent flag, 3rd param, has been hardcoded.
if (TheUI.MenuButton.X != -1) {
DrawMenuButton(TheUI.MenuButton.Button,
(ButtonAreaUnderCursor == ButtonAreaMenu
&& ButtonUnderCursor == ButtonUnderMenu ? MenuButtonActive
: 0) |
- (GameMenuButtonClicked ? MenuButtonClicked : 0), 0,
+ (GameMenuButtonClicked ? MenuButtonClicked : 0),
TheUI.MenuButton.Width, TheUI.MenuButton.Height,
TheUI.MenuButton.X, TheUI.MenuButton.Y,
GameFont, TheUI.MenuButton.Text, NULL, NULL);
}
} else {
if (TheUI.NetworkMenuButton.X != -1) {
- //FIX ME: Transparent flag, 3rd param, has been hardcoded.
DrawMenuButton(TheUI.NetworkMenuButton.Button,
(ButtonAreaUnderCursor == ButtonAreaMenu
&& ButtonUnderCursor == ButtonUnderNetworkMenu ?
MenuButtonActive : 0) |
- (GameMenuButtonClicked ? MenuButtonClicked : 0),/*Transparent*/
0,
+ (GameMenuButtonClicked ? MenuButtonClicked : 0),
TheUI.NetworkMenuButton.Width, TheUI.NetworkMenuButton.Height,
TheUI.NetworkMenuButton.X, TheUI.NetworkMenuButton.Y,
GameFont, TheUI.NetworkMenuButton.Text, NULL, NULL);
}
if (TheUI.NetworkDiplomacyButton.X != -1) {
- //FIX ME: Transparent flag, 3rd param, has been hardcoded.
DrawMenuButton(TheUI.NetworkDiplomacyButton.Button,
(ButtonAreaUnderCursor == ButtonAreaMenu
&& ButtonUnderCursor == ButtonUnderNetworkDiplomacy ?
MenuButtonActive : 0) |
- (GameDiplomacyButtonClicked ? MenuButtonClicked :
0),/*Transparent*/ 0,
+ (GameDiplomacyButtonClicked ? MenuButtonClicked : 0),
TheUI.NetworkDiplomacyButton.Width,
TheUI.NetworkDiplomacyButton.Height,
TheUI.NetworkDiplomacyButton.X, TheUI.NetworkDiplomacyButton.Y,
GameFont, TheUI.NetworkDiplomacyButton.Text, NULL, NULL);
@@ -420,9 +417,6 @@
//
nunits = FindAndSortUnits(vp, table);
nmissiles = FindAndSortMissiles(vp, missiletable);
-/* if (Units[170]) {
- DebugLevel0Fn("Unit 170: %s ref %d\n" _C_ Units[170]->Type->Name
_C_ Units[170]->Refs);
- }*/
i = 0;
j = 0;
@@ -525,7 +519,7 @@
//
for (vp = TheUI.Viewports; vp < evp; ++vp) {
#ifdef USE_SDL_SURFACE
- SDL_Color color;
+ Uint32 color;
#else
VMemType color;
#endif
@@ -838,6 +832,8 @@
CclGarbageCollect(1);
break;
case 1:
+ HandleCloak();
+ break;
case 2:
break;
case 3: // minimap update
Index: stratagus/src/clone/spells.c
diff -u stratagus/src/clone/spells.c:1.131 stratagus/src/clone/spells.c:1.132
--- stratagus/src/clone/spells.c:1.131 Sun Dec 14 06:10:29 2003
+++ stratagus/src/clone/spells.c Sun Dec 14 07:54:12 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: spells.c,v 1.131 2003/12/13 19:10:29 mohydine Exp $
+// $Id: spells.c,v 1.132 2003/12/13 20:54:12 jsalmon3 Exp $
/*
** And when we cast our final spell
@@ -86,43 +86,6 @@
// Cast the Spell
// ****************************************************************************
-
-/**
-** Cast Reclaim
-** @param caster Unit that casts the spell
-** @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
-**
-** @return =!0 if spell should be repeated, 0 if not
-*/
-global int CastReclaim(Unit* caster, const SpellType* spell
__attribute__((unused)),
- const SpellActionType* action,Unit* target __attribute__((unused)), int
x, int y)
-{
- //UnitType* type;
-
- DebugCheck(!caster);
- DebugCheck(!spell);
- DebugCheck(!spell->Action);
- DebugCheck(!target);
-
- PlayerAddCostsFactor(caster->Player, target->Stats->Costs, 50);
-
- if (spell->Missile) {
- MakeMissile(spell->Missile,
- x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
- x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
- //FIXME: need to center the missile correctly
- }
- RemoveUnit(target, NULL);
- UnitLost(target);
- UnitClearOrders(target);
- ReleaseUnit(target);
-
- return 0;
-}
-
/**
** Cast demolish
** @param caster Unit that casts the spell
@@ -219,7 +182,7 @@
// FIXME: vladi: cop should be placed only on explored land
Unit* portal;
UnitType* ptype;
-
+
DebugCheck(!caster);
DebugCheck(!spell);
DebugCheck(!spell->Action);
@@ -279,26 +242,26 @@
mana = action->Data.AreaAdjustVitals.Mana;
caster->Mana -= spell->ManaCost;
for (j = 0; j < nunits; ++j) {
- target = units[j];
+ target = units[j];
// if (!PassCondition(caster, spell, target, x, y) {
if (!CanCastSpell(caster, spell, target, x, y)) {
continue;
}
- if (hp < 0) {
+ if (hp < 0) {
HitUnit(caster, target, -hp);
- } else {
+ } else {
target->HP += hp;
if (target->HP > target->Stats->HitPoints) {
target->HP = target->Stats->HitPoints;
}
- }
- target->Mana += mana;
- if (target->Mana < 0) {
+ }
+ target->Mana += mana;
+ if (target->Mana < 0) {
target->Mana = 0;
- }
- if (target->Mana > target->Type->_MaxMana) {
+ }
+ if (target->Mana > target->Type->_MaxMana) {
target->Mana = target->Type->_MaxMana;
- }
+ }
}
return 0;
}
@@ -675,7 +638,7 @@
(*corpses)->Y >= y - 1 && (*corpses)->Y <= y + 1) {
//
// Found a corpse. eliminate it and proceed to summoning.
- //
+ //
x = (*corpses)->X;
y = (*corpses)->Y;
tempcorpse = *corpses;
@@ -687,7 +650,7 @@
corpses = &(*corpses)->Next;
}
}
- } else {
+ } else {
cansummon = 1;
}
@@ -703,7 +666,7 @@
target->Y = y;
//
// set life span. ttl=0 results in a permanent unit.
- //
+ //
if (ttl) {
target->TTL = GameCycle + ttl;
}
@@ -721,7 +684,7 @@
DropOutOnSide(target, LookingW, 0, 0);
CheckUnitToBeDrawn(target);
}
-
+
caster->Mana -= spell->ManaCost;
MakeMissile(spell->Missile,
@@ -804,7 +767,7 @@
return 0;
}
//
- // Casting an unit spell without a target.
+ // Casting an unit spell without a target.
//
if (spell->Target == TargetUnit && !target) {
return 0;
@@ -827,15 +790,15 @@
return 0;
}
}
- for (i = 0; i < NumberBoolFlag; i++) { // User defined flags
- if (condition->BoolFlag[i] != CONDITION_TRUE) {
- if ((condition->BoolFlag[i] == CONDITION_ONLY) ^
(target->Type->BoolFlag[i])) {
- return 0;
- }
- }
+ for (i = 0; i < NumberBoolFlag; i++) { // User defined flags
+ if (condition->BoolFlag[i] != CONDITION_TRUE) {
+ if ((condition->BoolFlag[i] == CONDITION_ONLY) ^
(target->Type->BoolFlag[i])) {
+ return 0;
+ }
+ }
}
if (condition->Alliance != CONDITION_TRUE) {
- if ((condition->Alliance == CONDITION_ONLY) ^
+ if ((condition->Alliance == CONDITION_ONLY) ^
(IsAllied(caster->Player,target) || target->Player ==
caster->Player)) {
return 0;
}
@@ -891,7 +854,7 @@
**
** @param caster Unit who would cast the spell.
** @param spell Spell-type pointer.
-**
+**
** @return Target* choosen target or Null if spell can't be cast.
**
*/
@@ -935,7 +898,7 @@
caster->Y + range + caster->Type->TileHeight, table);
//
// Check every unit if it is hostile
- //
+ //
combat = 0;
for (i = 0; i < nunits; ++i) {
if (IsEnemy(caster->Player, table[i]) && !table[i]->Type->Coward) {
@@ -971,7 +934,7 @@
//
// The units are already selected.
// Check every unit if it is a possible target
- //
+ //
for (i = 0, j = 0; i < nunits; ++i) {
// FIXME: autocast conditions should include normal conditions.
// FIXME: no, really, they should.
@@ -981,9 +944,9 @@
}
}
nunits = j;
- //
+ //
// Now select the best unit to target.
- // FIXME: Some really smart way to do this.
+ // FIXME: Some really smart way to do this.
// FIXME: Heal the unit with the lowest hit-points
// FIXME: Bloodlust the unit with the highest hit-point
// FIMXE: it will survive more
@@ -1072,7 +1035,7 @@
*/
#if defined(USE_GUILE) || defined(USE_SIOD)
global unsigned CclGetSpellByIdent(SCM value)
-{
+{
int i;
for (i = 0; i < SpellTypeCount; ++i) {
@@ -1083,6 +1046,19 @@
return -1;
}
#elif defined(USE_LUA)
+global unsigned CclGetSpellByIdent(lua_State* l)
+{
+ int i;
+ const char* value;
+
+ value = LuaToString(l, -1);
+ for (i = 0; i < SpellTypeCount; ++i) {
+ if (!strcmp(value, SpellTypeTable[i].IdentName)) {
+ return i;
+ }
+ }
+ return -1;
+}
#endif
/**
@@ -1105,12 +1081,12 @@
/**
** Check if spell is research for player \p player.
** @param player : player for who we want to know if he knows the spell.
-** @param id :
+** @param id :
*/
global int SpellIsAvailable(const Player* player, int spellid)
{
int dependencyId;
-
+
DebugCheck(!player);
DebugCheck(!(0 <= spellid && spellid < SpellTypeCount));
@@ -1269,12 +1245,12 @@
//
// Can't cast, STOP.
//
- return 0;
+ return 0;
}
/*
** Cleanup the spell subsystem.
-**
+**
** @note: everything regarding spells is gone now.
** FIXME: not complete
*/
Index: stratagus/src/editor/editloop.c
diff -u stratagus/src/editor/editloop.c:1.148
stratagus/src/editor/editloop.c:1.149
--- stratagus/src/editor/editloop.c:1.148 Sun Dec 14 03:14:43 2003
+++ stratagus/src/editor/editloop.c Sun Dec 14 07:54:13 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: editloop.c,v 1.148 2003/12/13 16:14:43 mohydine Exp $
+// $Id: editloop.c,v 1.149 2003/12/13 20:54:13 jsalmon3 Exp $
//@{
@@ -936,7 +936,7 @@
DrawMenuButton(TheUI.MenuButton.Button,
(ButtonAreaUnderCursor == ButtonAreaMenu
&& ButtonUnderCursor == ButtonUnderMenu ? MenuButtonActive : 0) |
- (GameMenuButtonClicked ? MenuButtonClicked : 0), 0,
+ (GameMenuButtonClicked ? MenuButtonClicked : 0),
TheUI.MenuButton.Width, TheUI.MenuButton.Height,
TheUI.MenuButton.X,TheUI.MenuButton.Y,
GameFont,TheUI.MenuButton.Text, NULL, NULL);
Index: stratagus/src/game/intro.c
diff -u stratagus/src/game/intro.c:1.113 stratagus/src/game/intro.c:1.114
--- stratagus/src/game/intro.c:1.113 Sun Dec 14 03:14:44 2003
+++ stratagus/src/game/intro.c Sun Dec 14 07:54:14 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: intro.c,v 1.113 2003/12/13 16:14:44 mohydine Exp $
+// $Id: intro.c,v 1.114 2003/12/13 20:54:14 jsalmon3 Exp $
//@{
@@ -207,7 +207,7 @@
*/
local void DrawContinueButton(void)
{
- DrawMenuButton(MBUTTON_GM_HALF, ContinueButtonFlags,0,
+ DrawMenuButton(MBUTTON_GM_HALF, ContinueButtonFlags,
106, 27,
ContinueButtonX, ContinueButtonY,
LargeFont, "~!Continue", NULL, NULL);
Index: stratagus/src/include/menus.h
diff -u stratagus/src/include/menus.h:1.115 stratagus/src/include/menus.h:1.116
--- stratagus/src/include/menus.h:1.115 Sun Dec 14 03:14:45 2003
+++ stratagus/src/include/menus.h Sun Dec 14 07:54:15 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menus.h,v 1.115 2003/12/13 16:14:45 mohydine Exp $
+// $Id: menus.h,v 1.116 2003/12/13 20:54:15 jsalmon3 Exp $
#ifndef __MENUS_H__
#define __MENUS_H__
@@ -222,7 +222,6 @@
int yofs;
unsigned flags;
int font;
- int transparent; /// Add the transparent flag to
draw a transparent flag
void (*initfunc)(struct _menuitem_ *); /// constructor
void (*exitfunc)(struct _menuitem_ *); /// destructor
struct _menus_ *menu; /// backpointer for speedups
@@ -348,7 +347,7 @@
/// Draw menu
extern void DrawMenu(Menu *menu);
/// Draw menu button
-extern void DrawMenuButton(MenuButtonId button,unsigned flags,int
transparent,int w,int h,
+extern void DrawMenuButton(MenuButtonId button,unsigned flags,int w,int h,
int x,int y,const int font,const unsigned char *text,
char *normalcolor, char *reversecolor);
/// Set menu backgound and draw it
Index: stratagus/src/include/missile.h
diff -u stratagus/src/include/missile.h:1.73
stratagus/src/include/missile.h:1.74
--- stratagus/src/include/missile.h:1.73 Sun Dec 14 03:14:45 2003
+++ stratagus/src/include/missile.h Sun Dec 14 07:54:15 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.h,v 1.73 2003/12/13 16:14:45 mohydine Exp $
+// $Id: missile.h,v 1.74 2003/12/13 20:54:15 jsalmon3 Exp $
#ifndef __MISSILE_H__
#define __MISSILE_H__
@@ -162,9 +162,12 @@
** field where the missile hits. A value of 2 would mean that
** the damage for that particular missile would be dealt for a
range
** of 1 around the impact spot. All fields that aren't the center
-** get only 50% of the damage.
-** @note Can this value be higher? 3 (3x3 area with 25%),
-** 4 (4x4 area with 12.5%)! Yes, but is currently not written.
+** get only 1/SpashFactor of the damage. Fields 2 away get
+** 1/(SplashFactor*2), and following...
+**
+** MissileType::SplashFactor
+**
+** Determines The Splash damage divisor, see Range
**
** MissileType::ImpactName
**
@@ -394,7 +397,6 @@
char* Ident; /// missile name
char* File; /// missile sprite file
- int Transparency; /// Missile transparency possible value
is 50 (later 25 and 75)
int Width; /// missile width in pixels
int Height; /// missile height in pixels
int DrawLevel; /// Level to draw missile at
@@ -415,6 +417,7 @@
int Speed; /// missile speed
int Range; /// missile damage range
+ int SplashFactor; /// missile splash divisor
char* ImpactName; /// impact missile-type name
MissileType*ImpactMissile; /// missile produces an impact
char* SmokeName; /// impact missile-type name
Index: stratagus/src/include/spells.h
diff -u stratagus/src/include/spells.h:1.41 stratagus/src/include/spells.h:1.42
--- stratagus/src/include/spells.h:1.41 Sun Dec 14 06:38:20 2003
+++ stratagus/src/include/spells.h Sun Dec 14 07:54:16 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: spells.h,v 1.41 2003/12/13 19:38:20 mohydine Exp $
+// $Id: spells.h,v 1.42 2003/12/13 20:54:16 jsalmon3 Exp $
#ifndef __SPELLS_H__
#define __SPELLS_H__
@@ -328,6 +328,8 @@
// return 0, 1, 2 for true, only, false.
extern char Scm2Condition(SCM value);
#elif defined(USE_LUA)
+extern unsigned CclGetSpellByIdent(lua_State* l);
+
// return 0, 1, 2 for true, only, false.
extern char Ccl2Condition(lua_State* l, const char* value);
#endif
@@ -346,7 +348,7 @@
SpellFunc CastDeathCoil;
SpellFunc CastSpawnPortal;
SpellFunc CastSpawnMissile;
-SpellFunc CastReclaim;
+
//@}
#endif // !__SPELLS_H__
Index: stratagus/src/include/video.h
diff -u stratagus/src/include/video.h:1.102 stratagus/src/include/video.h:1.103
--- stratagus/src/include/video.h:1.102 Sun Dec 14 03:14:45 2003
+++ stratagus/src/include/video.h Sun Dec 14 07:54:16 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: video.h,v 1.102 2003/12/13 16:14:45 mohydine Exp $
+// $Id: video.h,v 1.103 2003/12/13 20:54:16 jsalmon3 Exp $
#ifndef __VIDEO_H__
#define __VIDEO_H__
@@ -107,16 +107,6 @@
/// Draw the object clipped and flipped in X direction.
void (*DrawClipX)(const Graphic* o, unsigned f, int x, int y);
/// Draw the shadow object clipped to the current clipping.
-///50% Transparent functions
- void (*DrawTrans50)(const Graphic* o, unsigned f, int x, int y);
- /// Draw the object unclipped and flipped in X direction.
- void (*DrawXTrans50)(const Graphic* o, unsigned f, int x, int y);
- /// Draw the object clipped to the current clipping.
- void (*DrawClipTrans50)(const Graphic* o, unsigned f, int x, int y);
- /// Draw the object clipped and flipped in X direction.
- void (*DrawClipXTrans50)(const Graphic* o, unsigned f, int x, int y);
- /// Draw the shadow object clipped to the current clipping.
-
void (*DrawShadowClip)(const Graphic* o, unsigned f, int x, int y);
/// Draw the shadow object clipped and flipped in X direction.
void (*DrawShadowClipX)(const Graphic* o, unsigned f, int x, int y);
@@ -343,18 +333,15 @@
extern EventCallback GameCallbacks; /// Game callbacks
extern EventCallback MenuCallbacks; /// Menu callbacks
- /// Maps RGB to a hardware dependent pixel.
-extern SDL_Color VideoMapRGB(int r, int g, int b);
-
-extern SDL_Color ColorBlack;
-extern SDL_Color ColorDarkGreen;
-extern SDL_Color ColorBlue;
-extern SDL_Color ColorOrange;
-extern SDL_Color ColorWhite;
-extern SDL_Color ColorGray;
-extern SDL_Color ColorRed;
-extern SDL_Color ColorGreen;
-extern SDL_Color ColorYellow;
+extern Uint32 ColorBlack;
+extern Uint32 ColorDarkGreen;
+extern Uint32 ColorBlue;
+extern Uint32 ColorOrange;
+extern Uint32 ColorWhite;
+extern Uint32 ColorGray;
+extern Uint32 ColorRed;
+extern Uint32 ColorGreen;
+extern Uint32 ColorYellow;
extern int ColorWaterCycleStart; /// color # start for color cycling
extern int ColorWaterCycleEnd; /// color # end for color cycling
@@ -366,80 +353,81 @@
// FIXME: check these out, clean up if we can
// FIXME: check these out, clean up if we can
// FIXME: check these out, clean up if we can
+
/// Draw pixel unclipped.
-extern void VideoDrawPixel(SDL_Color color, int x, int y);
+extern void (*VideoDrawPixel)(Uint32 color, int x, int y);
/// Draw translucent pixel unclipped.
-extern void VideoDrawTransPixel(SDL_Color color, int x, int y,
+extern void (*VideoDrawTransPixel)(Uint32 color, int x, int y,
unsigned char alpha);
/// Draw pixel clipped to current clip setting.
-extern void VideoDrawPixelClip(SDL_Color color, int x, int y);
+extern void VideoDrawPixelClip(Uint32 color, int x, int y);
/// Draw translucent pixel clipped to current clip setting.
-extern void VideoDrawTransPixelClip(SDL_Color color, int x, int y,
+extern void VideoDrawTransPixelClip(Uint32 color, int x, int y,
unsigned char alpha);
/// Draw vertical line unclipped.
-extern void VideoDrawVLine(SDL_Color color, int x, int y,
+extern void VideoDrawVLine(Uint32 color, int x, int y,
int height);
/// Draw translucent vertical line unclipped.
-extern void VideoDrawTransVLine(SDL_Color color, int x, int y,
+extern void VideoDrawTransVLine(Uint32 color, int x, int y,
int height, unsigned char alpha);
/// Draw vertical line clipped to current clip setting
-extern void VideoDrawVLineClip(SDL_Color color, int x, int y,
+extern void VideoDrawVLineClip(Uint32 color, int x, int y,
int height);
/// Draw translucent vertical line clipped to current clip setting
-extern void VideoDrawTransVLineClip(SDL_Color color, int x, int y,
+extern void VideoDrawTransVLineClip(Uint32 color, int x, int y,
int height, unsigned char alpha);
/// Draw horizontal line unclipped.
-extern void VideoDrawHLine(SDL_Color color, int x, int y,
+extern void VideoDrawHLine(Uint32 color, int x, int y,
int width);
/// Draw translucent horizontal line unclipped.
-extern void VideoDrawTransHLine(SDL_Color color, int x, int y,
+extern void VideoDrawTransHLine(Uint32 color, int x, int y,
int width, unsigned char alpha);
/// Draw horizontal line clipped to current clip setting
-extern void VideoDrawHLineClip(SDL_Color color, int x, int y,
+extern void VideoDrawHLineClip(Uint32 color, int x, int y,
int width);
/// Draw translucent horizontal line clipped to current clip setting
-extern void VideoDrawTransHLineClip(SDL_Color color, int x, int y,
+extern void VideoDrawTransHLineClip(Uint32 color, int x, int y,
int width, unsigned char alpha);
/// Draw line unclipped.
-extern void VideoDrawLine(SDL_Color color, int sx, int sy, int dx, int dy);
+extern void VideoDrawLine(Uint32 color, int sx, int sy, int dx, int dy);
/// Draw translucent line unclipped.
-extern void VideoDrawTransLine(SDL_Color color, int sx, int sy, int dx, int dy,
+extern void VideoDrawTransLine(Uint32 color, int sx, int sy, int dx, int dy,
unsigned char alpha);
/// Draw line clipped to current clip setting
-extern void VideoDrawLineClip(SDL_Color color, int sx, int sy, int dx, int dy);
+extern void VideoDrawLineClip(Uint32 color, int sx, int sy, int dx, int dy);
/// Draw translucent line clipped to current clip setting
-extern void VideoDrawTransLineClip(SDL_Color color, int sx, int sy,
+extern void VideoDrawTransLineClip(Uint32 color, int sx, int sy,
int dx, int dy, unsigned char alpha);
/// Draw rectangle.
-extern void VideoDrawRectangle(SDL_Color color, int x, int y,
+extern void VideoDrawRectangle(Uint32 color, int x, int y,
int w, int h);
/// Draw translucent rectangle.
-extern void VideoDrawTransRectangle(SDL_Color color, int x, int y,
+extern void VideoDrawTransRectangle(Uint32 color, int x, int y,
int w, int h, unsigned char alpha);
/// Draw rectangle clipped.
-extern void VideoDrawRectangleClip(SDL_Color color, int x, int y,
+extern void VideoDrawRectangleClip(Uint32 color, int x, int y,
int w, int h);
/// Draw translucent rectangle clipped.
-extern void VideoDrawTransRectangleClip(SDL_Color color, int x, int y,
+extern void VideoDrawTransRectangleClip(Uint32 color, int x, int y,
int w, int h, unsigned char alpha);
/// Draw 8bit raw graphic data clipped, using given pixel pallette
@@ -453,47 +441,47 @@
int w, int h, int x, int y, unsigned char fade);
/// Draw circle.
-extern void VideoDrawCircle(SDL_Color color, int x, int y, int r);
+extern void VideoDrawCircle(Uint32 color, int x, int y, int r);
/// Draw translucent circle.
-extern void VideoDrawTransCircle(SDL_Color color, int x, int y, int r,
+extern void VideoDrawTransCircle(Uint32 color, int x, int y, int r,
unsigned char alpha);
/// Draw circle clipped.
-extern void VideoDrawCircleClip(SDL_Color color, int x, int y, int r);
+extern void VideoDrawCircleClip(Uint32 color, int x, int y, int r);
/// Draw translucent circle clipped.
-extern void VideoDrawTransCircleClip(SDL_Color color, int x, int y, int r,
+extern void VideoDrawTransCircleClip(Uint32 color, int x, int y, int r,
unsigned char alpha);
/// Fill rectangle.
-extern void VideoFillRectangle(SDL_Color color, int x, int y,
+extern void VideoFillRectangle(Uint32 color, int x, int y,
int w, int h);
/// Fill translucent rectangle.
-extern void VideoFillTransRectangle(SDL_Color color, int x, int y,
+extern void VideoFillTransRectangle(Uint32 color, int x, int y,
int w, int h, unsigned char alpha);
/// Fill rectangle clipped.
-extern void VideoFillRectangleClip(SDL_Color color, int x, int y,
+extern void VideoFillRectangleClip(Uint32 color, int x, int y,
int w, int h);
/// Fill translucent rectangle clipped.
-extern void VideoFillTransRectangleClip(SDL_Color color, int x, int y,
+extern void VideoFillTransRectangleClip(Uint32 color, int x, int y,
int w, int h, unsigned char alpha);
/// Fill circle.
-extern void VideoFillCircle(SDL_Color color, int x, int y, int r);
+extern void VideoFillCircle(Uint32 color, int x, int y, int r);
/// Fill translucent circle.
-extern void VideoFillTransCircle(SDL_Color color, int x, int y, int r,
+extern void VideoFillTransCircle(Uint32 color, int x, int y, int r,
unsigned char alpha);
/// Fill circle clipped.
-extern void VideoFillCircleClip(SDL_Color color, int x, int y, int r);
+extern void VideoFillCircleClip(Uint32 color, int x, int y, int r);
/// Fill translucent circle clipped.
-extern void VideoFillTransCircleClip(SDL_Color color, int x, int y, int r,
+extern void VideoFillTransCircleClip(Uint32 color, int x, int y, int r,
unsigned char alpha);
/// Draw a graphic object unclipped.
@@ -515,42 +503,28 @@
/// Draw a graphic object clipped and flipped in X direction.
extern void VideoDrawClipX(const Graphic*, unsigned frame, int x, int y);
+ /// Draw a shadow graphic object clipped to the current clipping.
+extern void VideoDrawShadowClip(const Graphic*, unsigned frame,
+ int x, int y);
+ /// Draw a shadow graphic object clipped and flipped in X direction.
+extern void VideoDrawShadowClipX(const Graphic*, unsigned frame,
+ int x, int y);
+
// FIXME FIXME FIXME: need to implement all of this
- /// Draw a graphic object unclipped.
-//#define VideoDraw(o, f, x, y) //((o)->Type->Draw)((o), (f), (x), (y))
/// Free a graphic object.
#define VideoFree(o) //((o)->Type->Free)((o))
/// Save (NULL) free a graphic object.
#define VideoSaveFree(o) // do { if ((o)) ((o)->Type->Free)((o)); } while(0)
-//#define VideoDrawSub(a,b,c,d,e,f,g)
- /// Draw a graphic object clipped to the current clipping.
-//#define VideoDrawSubClip(o, ix, iy, w, h, x, y)
- /// Draw a shadow graphic object clipped to the current clipping.
-#define VideoDrawShadowClip(o, f, x, y)
//((o)->Type->DrawShadowClip)((o),(f),(x),(y))
- /// Draw a shadow graphic object clipped and flipped in X direction.
-#define VideoDrawShadowClipX(o, f, x, y)
//((o)->Type->DrawShadowClipX)((o),(f),(x),(y))
/// Get the width of a single frame of a graphic object
#define VideoGraphicWidth(o) ((o)->Width)
/// Get the height of a single frame of a graphic object
#define VideoGraphicHeight(o) ((o)->Height)
#define VideoGraphicFrames(o) ((o)->NumFrames)
-// ((o)->Type->DrawSubClip)((o), (ix), (iy), (w), (h), (x), (y))
-
/// MACRO defines speed of colorcycling FIXME: should be made configurable
#define COLOR_CYCLE_SPEED (CYCLES_PER_SECOND/4)
-extern SDL_Surface* MainSurface;
-
-/*
-#define VideoMemory8 (&VideoMemory->D8) /// video memory 8bpp
-#define VideoMemory16 (&VideoMemory->D16) /// video memory 16bpp
-#define VideoMemory24 (&VideoMemory->D24) /// video memory 24bpp
-#define VideoMemory32 (&VideoMemory->D32) /// video memory 32bpp
-*/
-
-
#else
// OOOOOOOOOLLLLLLLLDDDDDDDD VIDEO MODE *********************************
@@ -702,16 +676,6 @@
void (*DrawClip)(const Graphic* o, unsigned f, int x, int y);
/// Draw the object clipped and flipped in X direction.
void (*DrawClipX)(const Graphic* o, unsigned f, int x, int y);
-///50% Transparent functions
- /// Draw the object unclipped.
- void (*DrawTrans50)(const Graphic* o, unsigned f, int x, int y);
- /// Draw the object unclipped and flipped in X direction.
- void (*DrawXTrans50)(const Graphic* o, unsigned f, int x, int y);
- /// Draw the object clipped to the current clipping.
- void (*DrawClipTrans50)(const Graphic* o, unsigned f, int x, int y);
- /// Draw the object clipped and flipped in X direction.
- void (*DrawClipXTrans50)(const Graphic* o, unsigned f, int x, int y);
-
/// Draw the shadow object clipped to the current clipping.
void (*DrawShadowClip)(const Graphic* o, unsigned f, int x, int y);
/// Draw the shadow object clipped and flipped in X direction.
@@ -1153,18 +1117,6 @@
/// Draw a graphic object clipped and flipped in X direction.
#define VideoDrawClipX(o, f, x, y) ((o)->Type->DrawClipX)((o), (f), (x),
(y))
/// Draw a shadow graphic object clipped to the current clipping.
-///Transparent Functions
- /// Draw a graphic object unclipped.
-#define VideoDrawTrans50(o, f, x, y) ((o)->Type->DrawTrans50)((o), (f), (x),
(y))
- /// Draw a graphic object unclipped and flipped in X direction.
-#define VideoDrawXTrans50(o, f, x, y) ((o)->Type->DrawXTrans50)((o), (f),
(x), (y))
- /// Draw a graphic object clipped to the current clipping.
-#define VideoDrawClipTrans50(o, f, x, y)
((o)->Type->DrawClipTrans50)((o), (f), (x), (y))
- /// Draw a graphic object clipped and flipped in X direction.
-#define VideoDrawClipXTrans50(o, f, x, y)
((o)->Type->DrawClipXTrans50)((o), (f), (x), (y))
- /// Draw a shadow graphic object clipped to the current clipping.
-///Shadows
-
#define VideoDrawShadowClip(o, f, x, y)
((o)->Type->DrawShadowClip)((o),(f),(x),(y))
/// Draw a shadow graphic object clipped and flipped in X direction.
#define VideoDrawShadowClipX(o, f, x, y)
((o)->Type->DrawShadowClipX)((o),(f),(x),(y))
Index: stratagus/src/missile/ccl_missile.c
diff -u stratagus/src/missile/ccl_missile.c:1.46
stratagus/src/missile/ccl_missile.c:1.47
--- stratagus/src/missile/ccl_missile.c:1.46 Sun Dec 14 03:14:46 2003
+++ stratagus/src/missile/ccl_missile.c Sun Dec 14 07:54:17 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_missile.c,v 1.46 2003/12/13 16:14:46 mohydine Exp $
+// $Id: ccl_missile.c,v 1.47 2003/12/13 20:54:17 jsalmon3 Exp $
//@{
@@ -36,6 +36,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "stratagus.h"
#include "video.h"
@@ -90,6 +91,8 @@
}
mtype->NumDirections = 1;
+ // Ensure we don't divide by zero.
+ mtype->SplashFactor = 100;
//
// Parse the arguments, already the new tagged format.
//
@@ -108,8 +111,6 @@
mtype->SpriteFrames = gh_scm2int(gh_car(list));
} else if (gh_eq_p(value, gh_symbol2scm("num-directions"))) {
mtype->NumDirections = gh_scm2int(gh_car(list));
- } else if (gh_eq_p(value, gh_symbol2scm("transparency"))) {
- mtype->Transparency = gh_scm2int(gh_car(list));
} else if (gh_eq_p(value, gh_symbol2scm("fired-sound"))) {
free(mtype->FiredSound.Name);
mtype->FiredSound.Name = gh_scm2newstr(gh_car(list), NULL);
@@ -117,10 +118,13 @@
free(mtype->ImpactSound.Name);
mtype->ImpactSound.Name = gh_scm2newstr(gh_car(list), NULL);
} else if (gh_eq_p(value, gh_symbol2scm("class"))) {
+ const char* name;
+
value = gh_car(list);
+ name = get_c_string(value);
for (i = 0; MissileClassNames[i]; ++i) {
- if (gh_eq_p(value, gh_symbol2scm((char*)MissileClassNames[i])))
{
- mtype->Class=i;
+ if (!strcmp(name, MissileClassNames[i])) {
+ mtype->Class = i;
break;
}
}
@@ -132,13 +136,13 @@
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")) ) {
+ } else if (gh_eq_p(value, gh_symbol2scm("sleep"))) {
mtype->Sleep = gh_scm2int(gh_car(list));
- } else if (gh_eq_p(value, gh_symbol2scm("speed")) ) {
+ } else if (gh_eq_p(value, gh_symbol2scm("speed"))) {
mtype->Speed = gh_scm2int(gh_car(list));
- } else if (gh_eq_p(value, gh_symbol2scm("draw-level")) ) {
+ } else if (gh_eq_p(value, gh_symbol2scm("draw-level"))) {
mtype->DrawLevel = gh_scm2int(gh_car(list));
- } else if (gh_eq_p(value, gh_symbol2scm("range")) ) {
+ } else if (gh_eq_p(value, gh_symbol2scm("range"))) {
mtype->Range = gh_scm2int(gh_car(list));
} else if (gh_eq_p(value, gh_symbol2scm("impact-missile"))) {
free(mtype->ImpactName);
@@ -147,9 +151,11 @@
free(mtype->ImpactName);
mtype->SmokeName = gh_scm2newstr(gh_car(list), NULL);
} else if (gh_eq_p(value, gh_symbol2scm("can-hit-owner"))) {
- mtype->CanHitOwner = gh_scm2bool(gh_car(list));
+ mtype->CanHitOwner = 1;
} else if (gh_eq_p(value, gh_symbol2scm("friendly-fire"))) {
- mtype->FriendlyFire = gh_scm2bool(gh_car(list));
+ mtype->FriendlyFire = 1;
+ } else if (gh_eq_p(value, gh_symbol2scm("splash-factor"))) {
+ mtype->SplashFactor = gh_scm2int(gh_car(list));;
} else {
// FIXME: this leaves a half initialized missile-type
errl("Unsupported tag", value);
@@ -160,6 +166,116 @@
return SCM_UNSPECIFIED;
}
#elif defined(USE_LUA)
+local int CclDefineMissileType(lua_State* l)
+{
+ const char* value;
+ char* str;
+ MissileType* mtype;
+ unsigned i;
+ int args;
+ int j;
+
+ args = lua_gettop(l);
+ j = 0;
+
+ // Slot identifier
+
+ str = strdup(LuaToString(l, j + 1));
+ ++j;
+#ifdef DEBUG
+ i = NoWarningMissileType;
+ NoWarningMissileType = 1;
+#endif
+ mtype = MissileTypeByIdent(str);
+#ifdef DEBUG
+ NoWarningMissileType = i;
+#endif
+ if (mtype) {
+ DebugLevel0Fn("Redefining missile-type `%s'\n" _C_ str);
+ free(str);
+ } else {
+ mtype = NewMissileTypeSlot(str); // str consumed!
+ }
+
+ mtype->NumDirections = 1;
+ // Ensure we don't divide by zero.
+ mtype->SplashFactor = 100;
+ //
+ // Parse the arguments, already the new tagged format.
+ //
+ for (; j < args; ++j) {
+ value = LuaToString(l, j + 1);
+ ++j;
+ if (!strcmp(value, "file")) {
+ free(mtype->File);
+ mtype->File = strdup(LuaToString(l, j + 1));
+ } else if (!strcmp(value, "size")) {
+ if (!lua_istable(l, j + 1)) {
+ lua_pushstring(l, "incorrect argument");
+ lua_error(l);
+ }
+ lua_rawgeti(l, j + 1, 1);
+ mtype->Width = LuaToNumber(l, -1);
+ lua_pop(l, 1);
+ lua_rawgeti(l, j + 1, 2);
+ mtype->Height = LuaToNumber(l, -1);
+ lua_pop(l, 1);
+ } else if (!strcmp(value,"frames")) {
+ mtype->SpriteFrames = LuaToNumber(l, j + 1);
+ } else if (!strcmp(value, "num-directions")) {
+ mtype->NumDirections = LuaToNumber(l, j + 1);
+ } else if (!strcmp(value, "fired-sound")) {
+ free(mtype->FiredSound.Name);
+ mtype->FiredSound.Name = strdup(LuaToString(l, j + 1));
+ } else if (!strcmp(value, "impact-sound")) {
+ free(mtype->ImpactSound.Name);
+ mtype->ImpactSound.Name = strdup(LuaToString(l, j + 1));
+ } else if (!strcmp(value, "class")) {
+ value = LuaToString(l, j + 1);
+ for (i = 0; MissileClassNames[i]; ++i) {
+ if (!strcmp(value, MissileClassNames[i])) {
+ mtype->Class = i;
+ break;
+ }
+ }
+ if (!MissileClassNames[i]) {
+ // FIXME: this leaves a half initialized missile-type
+ lua_pushfstring(l, "Unsupported class: %s", value);
+ lua_error(l);
+ }
+ } else if (!strcmp(value, "num-bounces")) {
+ mtype->NumBounces = LuaToNumber(l, j + 1);
+ } else if (!strcmp(value, "delay")) {
+ mtype->StartDelay = LuaToNumber(l, j + 1);
+ } else if (!strcmp(value, "sleep")) {
+ mtype->Sleep = LuaToNumber(l, j + 1);
+ } else if (!strcmp(value, "speed")) {
+ mtype->Speed = LuaToNumber(l, j + 1);
+ } else if (!strcmp(value, "draw-level")) {
+ mtype->DrawLevel = LuaToNumber(l, j + 1);
+ } else if (!strcmp(value, "range")) {
+ mtype->Range = LuaToNumber(l, j + 1);
+ } else if (!strcmp(value, "impact-missile")) {
+ free(mtype->ImpactName);
+ mtype->ImpactName = strdup(LuaToString(l, j + 1));
+ } else if (!strcmp(value, "smoke-missile")) {
+ free(mtype->ImpactName);
+ mtype->SmokeName = strdup(LuaToString(l, j + 1));
+ } else if (!strcmp(value, "can-hit-owner")) {
+ mtype->CanHitOwner = 1;
+ } else if (!strcmp(value, "friendly-fire")) {
+ mtype->FriendlyFire = 1;
+ } else if (!strcmp(value, "splash-factor")) {
+ mtype->SplashFactor = LuaToNumber(l, j + 1);
+ } else {
+ // FIXME: this leaves a half initialized missile-type
+ lua_pushfstring(l, "Unsupported tag: %s", value);
+ lua_error(l);
+ }
+ }
+
+ return 0;
+}
#endif
/**
@@ -367,6 +483,10 @@
return SCM_UNSPECIFIED;
}
#elif defined(USE_LUA)
+local int CclMissile(lua_State* l)
+{
+ return 0;
+}
#endif
/**
@@ -420,6 +540,56 @@
return SCM_UNSPECIFIED;
}
#elif defined(USE_LUA)
+local int CclDefineBurningBuilding(lua_State* l)
+{
+ const char* value;
+ BurningBuildingFrame** frame;
+ BurningBuildingFrame* ptr;
+ BurningBuildingFrame* next;
+ int args;
+ int j;
+ int subargs;
+ int k;
+
+ ptr = BurningBuildingFrames;
+ while (ptr) {
+ next = ptr->Next;
+ free(ptr);
+ ptr = next;
+ }
+ BurningBuildingFrames = NULL;
+
+ frame = &BurningBuildingFrames;
+
+ args = lua_gettop(l);
+ for (j = 0; j < args; ++j) {
+ if (!lua_istable(l, j + 1)) {
+ lua_pushstring(l, "incorrect argument");
+ lua_error(l);
+ }
+
+ *frame = calloc(1, sizeof(BurningBuildingFrame));
+ subargs = luaL_getn(l, j + 1);
+ for (k = 0; k < subargs; ++k) {
+ lua_rawgeti(l, j + 1, k + 1);
+ value = LuaToString(l, -1);
+ lua_pop(l, 1);
+ ++k;
+
+ if (!strcmp(value, "percent")) {
+ lua_rawgeti(l, j + 1, k + 1);
+ (*frame)->Percent = LuaToNumber(l, -1);
+ lua_pop(l, 1);
+ } else if (!strcmp(value, "missile")) {
+ lua_rawgeti(l, j + 1, k + 1);
+ (*frame)->Missile = MissileTypeByIdent(LuaToString(l, -1));
+ lua_pop(l, 1);
+ }
+ }
+ frame = &((*frame)->Next);
+ }
+ return 0;
+}
#endif
/**
@@ -436,9 +606,9 @@
#elif defined(USE_LUA)
lua_register(Lua, "DefineMissileTypeWcNames",
CclDefineMissileTypeWcNames);
-// lua_register("DefineMissileType", CclDefineMissileType);
-// lua_register("Missile", CclMissile);
-// lua_register("DefineBurningBuilding", CclDefineBurningBuilding);
+ lua_register(Lua, "DefineMissileType", CclDefineMissileType);
+ lua_register(Lua, "Missile", CclMissile);
+ lua_register(Lua, "DefineBurningBuilding", CclDefineBurningBuilding);
#endif
}
Index: stratagus/src/missile/missile.c
diff -u stratagus/src/missile/missile.c:1.114
stratagus/src/missile/missile.c:1.115
--- stratagus/src/missile/missile.c:1.114 Sun Dec 14 03:14:46 2003
+++ stratagus/src/missile/missile.c Sun Dec 14 07:54:17 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.c,v 1.114 2003/12/13 16:14:46 mohydine Exp $
+// $Id: missile.c,v 1.115 2003/12/13 20:54:17 jsalmon3 Exp $
//@{
@@ -161,7 +161,10 @@
file = strcat(strcpy(buf, "graphics/"), file);
ShowLoadProgress("Missile %s", file);
MissileTypes[i].Sprite = LoadSprite(
- file, MissileTypes[i].Width, MissileTypes[i].Height);
+ file, MissileTypes[i].Width, MissileTypes[i].Height);
+#ifdef USE_SDL_SURFACE
+ FlipGraphic(MissileTypes[i].Sprite);
+#endif
// Correct the number of frames in graphic
DebugCheck(MissileTypes[i].Sprite->NumFrames <
MissileTypes[i].SpriteFrames);
@@ -609,6 +612,7 @@
local void GetMissileMapArea(const Missile* missile, int* sx, int* sy,
int* ex, int* ey)
{
+#define Bound(x, y) (x) < 0 ? 0 : ((x) > (y) ? (y) : (x))
DebugCheck(missile == NULL);
DebugCheck(sx == NULL);
DebugCheck(sy == NULL);
@@ -617,10 +621,11 @@
DebugCheck(TileSizeX <= 0);
DebugCheck(TileSizeY <= 0);
DebugCheck(missile->Type == NULL);
- *sx = missile->X / TileSizeX;
- *sy = missile->Y / TileSizeY;
- *ex = (missile->X + missile->Type->Width) / TileSizeX;
- *ey = (missile->Y + missile->Type->Height) / TileSizeY;
+ *sx = Bound(missile->X / TileSizeX, TheMap.Width - 1);
+ *sy = Bound(missile->Y / TileSizeY, TheMap.Height - 1);
+ *ex = Bound((missile->X + missile->Type->Width) / TileSizeX, TheMap.Width
- 1);
+ *ey = Bound((missile->Y + missile->Type->Height) / TileSizeY,
TheMap.Height - 1);
+#undef Bound
}
/**
@@ -637,6 +642,8 @@
int max_x;
int min_y;
int max_y;
+ int x;
+ int y;
DebugCheck(vp == NULL);
DebugCheck(missile == NULL);
@@ -646,11 +653,15 @@
}
DebugLevel3Fn("Missile bounding box %d %d %d %d\n" _C_ min_x _C_ max_x _C_
min_y _C_ max_y);
- if (!IsMapFieldVisible(ThisPlayer, (missile->X - TileSizeX / 2) /
TileSizeX,
- (missile->Y - TileSizeY / 2) / TileSizeY) && !ReplayRevealMap) {
- return 0;
+
+ for (x = min_x; x <= max_x; ++x) {
+ for ( y = min_y; y <= max_y; ++y) {
+ if (ReplayRevealMap || IsMapFieldVisible(ThisPlayer, x, y)) {
+ return 1;
+ }
+ }
}
- return 1;
+ return 0;
}
/**
@@ -683,19 +694,11 @@
{
DebugCheck(mtype == NULL);
// FIXME: This is a hack for mirrored sprites
- if (mtype->Transparency==50) {
- if (frame < 0) {
- VideoDrawClipXTrans50(mtype->Sprite, -frame, x, y);
- } else {
- VideoDrawClipTrans50(mtype->Sprite, frame, x, y);
- }
- } else {
- if (frame < 0) {
- VideoDrawClipX(mtype->Sprite, -frame, x, y);
- } else {
- VideoDrawClip(mtype->Sprite, frame, x, y);
- }
- }
+ if (frame < 0) {
+ VideoDrawClipX(mtype->Sprite, -frame, x, y);
+ } else {
+ VideoDrawClip(mtype->Sprite, frame, x, y);
+ }
}
/**
@@ -1007,6 +1010,7 @@
Unit* table[UnitMax];
int n;
int i;
+ int splash;
DebugCheck(missile == NULL);
DebugCheck(missile->Type == NULL);
@@ -1084,14 +1088,13 @@
// NOTE: perhaps this should be come a property of the missile.
//
if (CanTarget(missile->SourceUnit->Type, goal->Type)) {
- // We are attacking the nearest field of the unit
- if (x < goal->X || y < goal->Y ||
- x >= goal->X + goal->Type->TileWidth ||
- y >= goal->Y + goal->Type->TileHeight) {
- MissileHitsGoal(missile, goal, 2);
+ splash = MapDistanceToUnit(x, y, goal);
+ if (splash) {
+ splash *= missile->Type->SplashFactor;
} else {
- MissileHitsGoal(missile, goal, 1);
+ splash = 1;
}
+ MissileHitsGoal(missile, goal, splash);
}
}
//
@@ -1106,7 +1109,8 @@
if (i == 0 && n == 0) {
MissileHitsWall(missile, x + i, y + n, 1);
} else {
- MissileHitsWall(missile, x + i, y + n, 2);
+ MissileHitsWall(missile, x + i, y + n,
+ MapDistance(x, y, i, n) * missile->Type->SplashFactor);
}
}
}
@@ -1335,7 +1339,7 @@
DebugCheck(file == NULL);
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.114
2003/12/13 16:14:46 mohydine Exp $\n\n");
+ CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.115
2003/12/13 20:54:17 jsalmon3 Exp $\n\n");
//
// Original number to internal missile-type name.
@@ -1384,18 +1388,20 @@
CLprintf(file, " 'sleep %d", mtype->Sleep);
CLprintf(file, " 'speed %d", mtype->Speed);
CLprintf(file, " 'range %d", mtype->Range);
+ CLprintf(file, " 'splash-factor", mtype->SplashFactor);
if (mtype->ImpactMissile) {
CLprintf(file, "\n 'impact-missile '%s",
mtype->ImpactMissile->Ident);
}
if (mtype->SmokeMissile) {
CLprintf(file, "\n 'smoke-missile '%s",
mtype->SmokeMissile->Ident);
}
- if (mtype->Transparency) {
- CLprintf(file, "\n 'transparency %d", mtype->Transparency);
- }
CLprintf(file, "\n ");
- CLprintf(file, " 'can-hit-owner #%c", mtype->CanHitOwner ? 't' : 'f');
- CLprintf(file, " 'friendly-fire #%c", mtype->FriendlyFire ? 't' : 'f');
+ if (mtype->CanHitOwner) {
+ CLprintf(file, " 'can-hit-owner ");
+ }
+ if (mtype->FriendlyFire) {
+ CLprintf(file, " 'friendly-fire");
+ }
CLprintf(file, ")\n");
}
}
@@ -1416,7 +1422,7 @@
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);
-
+
if (missile->SourceUnit) {
CLprintf(file, " 'source '%s", s1 = UnitReference(missile->SourceUnit));
free(s1);
@@ -1447,7 +1453,7 @@
DebugCheck(file == NULL);
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.114 2003/12/13
16:14:46 mohydine Exp $\n\n");
+ CLprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.115 2003/12/13
20:54:17 jsalmon3 Exp $\n\n");
for (missiles = GlobalMissiles; *missiles; ++missiles) {
SaveMissile(*missiles, file);
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.167 stratagus/src/ui/ccl_ui.c:1.168
--- stratagus/src/ui/ccl_ui.c:1.167 Sun Dec 14 03:14:47 2003
+++ stratagus/src/ui/ccl_ui.c Sun Dec 14 07:54:06 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ui.c,v 1.167 2003/12/13 16:14:47 mohydine Exp $
+// $Id: ccl_ui.c,v 1.168 2003/12/13 20:54:06 jsalmon3 Exp $
//@{
@@ -323,7 +323,11 @@
lua_error(l);
}
TheUI.Contrast = i;
+#ifdef USE_SDL_SURFACE
+ // FIXME
+#else
VideoCreatePalette(GlobalPalette); // rebuild palette
+#endif
MustRedraw = RedrawEverything;
lua_pushnumber(l, old);
@@ -377,7 +381,11 @@
lua_error(l);
}
TheUI.Brightness = i;
+#ifdef USE_SDL_SURFACE
+ // FIXME:
+#else
VideoCreatePalette(GlobalPalette); // rebuild palette
+#endif
MustRedraw = RedrawEverything;
lua_pushnumber(l, old);
@@ -431,7 +439,11 @@
lua_error(l);
}
TheUI.Saturation = i;
+#ifdef USE_SDL_SURFACE
+ // FIXME:
+#else
VideoCreatePalette(GlobalPalette); // rebuild palette
+#endif
MustRedraw = RedrawEverything;
lua_pushnumber(l, old);
@@ -483,7 +495,7 @@
** @return Old fullscreen mode
*/
#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetVideoFullscreen(SCM fullscreen)
+local SCM CclSetVideoFullScreen(SCM fullscreen)
{
SCM old;
@@ -494,7 +506,7 @@
return old;
}
#elif defined(USE_LUA)
-local int CclSetVideoFullscreen(lua_State* l)
+local int CclSetVideoFullScreen(lua_State* l)
{
int old;
@@ -3022,13 +3034,25 @@
lua_error(l);
}
lua_rawgeti(l, -1, 1);
+#ifdef USE_SDL_SURFACE
+ ui->CompletedBarColorRGB.r = LuaToNumber(l, -1);
+#else
ui->CompletedBarColorRGB.D24.a = LuaToNumber(l, -1);
+#endif
lua_pop(l, 1);
lua_rawgeti(l, -1, 2);
+#ifdef USE_SDL_SURFACE
+ ui->CompletedBarColorRGB.g = LuaToNumber(l, -1);
+#else
ui->CompletedBarColorRGB.D24.b = LuaToNumber(l, -1);
+#endif
lua_pop(l, 1);
lua_rawgeti(l, -1, 3);
+#ifdef USE_SDL_SURFACE
+ ui->CompletedBarColorRGB.b = LuaToNumber(l, -1);
+#else
ui->CompletedBarColorRGB.D24.c = LuaToNumber(l, -1);
+#endif
lua_pop(l, 1);
lua_pop(l, 1);
} else if (!strcmp(value, "pos")) {
@@ -3040,7 +3064,7 @@
lua_rawgeti(l, -1, 1);
ui->CompletedBarX = LuaToNumber(l, -1);
lua_pop(l, 1);
- lua_rawgeti(l, -1, 1);
+ lua_rawgeti(l, -1, 2);
ui->CompletedBarY = LuaToNumber(l, -1);
lua_pop(l, 1);
lua_pop(l, 1);
@@ -3053,7 +3077,7 @@
lua_rawgeti(l, -1, 1);
ui->CompletedBarW = LuaToNumber(l, -1);
lua_pop(l, 1);
- lua_rawgeti(l, -1, 1);
+ lua_rawgeti(l, -1, 2);
ui->CompletedBarH = LuaToNumber(l, -1);
lua_pop(l, 1);
lua_pop(l, 1);
@@ -3795,12 +3819,12 @@
#elif defined(USE_LUA)
local int CclSetGrabMouse(lua_State* l)
{
- if (lua_gettop(l) != 1 || (!lua_isboolean(l, 1) && !lua_isnumber(l, 1))) {
+ if (lua_gettop(l) != 1 || !lua_isboolean(l, 1)) {
lua_pushstring(l, "incorrect argument");
lua_error(l);
}
- if (lua_isboolean(l, 1)) {
- ToggleGrabMouse(lua_toboolean(l, 1));
+ if (lua_toboolean(l, 1)) {
+ ToggleGrabMouse(1);
} else {
ToggleGrabMouse(-1);
}
@@ -4470,6 +4494,7 @@
} else {
lua_pushfstring(l, "Unsupported style: %s", value);
lua_error(l);
+ return 0;
}
return id;
}
@@ -4505,9 +4530,7 @@
item->xofs = gh_scm2int(gh_car(value));
value = gh_cdr(value);
item->yofs = gh_scm2int(gh_car(value));
- // Addition of the transparent flag
- } else if (gh_eq_p(value, gh_symbol2scm("transparent"))) {
- item->transparent = 1;
+
} else if (gh_eq_p(value, gh_symbol2scm("menu"))) {
value = gh_car(list);
list = gh_cdr(list);
@@ -6343,7 +6366,7 @@
char buf[64];
const char* value;
char* s1;
- char* s2;
+ const char* s2;
ButtonAction ba;
int args;
int j;
@@ -6416,7 +6439,7 @@
lua_error(l);
}
if (lua_isnumber(l, j + 1)) {
- sprintf(buf, "%ld", lua_tonumber(l, j + 1));
+ sprintf(buf, "%ld", (long int)lua_tonumber(l, j + 1));
s1 = strdup(buf);
} else {
s1 = strdup(lua_tostring(l, j + 1));
@@ -6466,14 +6489,11 @@
subargs = luaL_getn(l, j + 1);
for (k = 0; k < subargs; ++k) {
lua_rawgeti(l, j + 1, k + 1);
- s2 = strdup(LuaToString(l, -1));
+ s2 = LuaToString(l, -1);
lua_pop(l, 1);
s1 = realloc(s1, strlen(s1) + strlen(s2) + 2);
strcat(s1, s2);
- free(s2);
- if (k == subargs) {
- strcat(s1, ",");
- }
+ strcat(s1, ",");
}
ba.AllowStr = s1;
} else if (!strcmp(value, "key")) {
@@ -6493,11 +6513,10 @@
subargs = luaL_getn(l, j + 1);
for (k = 0; k < subargs; ++k) {
lua_rawgeti(l, j + 1, k + 1);
- s2 = strdup(LuaToString(l, -1));
+ s2 = LuaToString(l, -1);
s1 = realloc(s1, strlen(s1) + strlen(s2) + 2);
strcat(s1, s2);
strcat(s1, ",");
- free(s2);
}
ba.UnitMask = s1;
if (!strncmp(ba.UnitMask, ",*,", 3)) {
@@ -7218,7 +7237,7 @@
gh_new_procedure1_0("set-saturation!", CclSetSaturation);
gh_new_procedure2_0("set-video-resolution!", CclSetVideoResolution);
- gh_new_procedure1_0("set-video-fullscreen!", CclSetVideoFullscreen);
+ gh_new_procedure1_0("set-video-fullscreen!", CclSetVideoFullScreen);
gh_new_procedureN("set-title-screens!", CclSetTitleScreens);
gh_new_procedure1_0("set-menu-background!", CclSetMenuBackground);
@@ -7298,7 +7317,7 @@
lua_register(Lua, "SetSaturation", CclSetSaturation);
lua_register(Lua, "SetVideoResolution", CclSetVideoResolution);
- lua_register(Lua, "SetVideoFullscreen", CclSetVideoFullscreen);
+ lua_register(Lua, "SetVideoFullScreen", CclSetVideoFullScreen);
lua_register(Lua, "SetTitleScreens", CclSetTitleScreens);
lua_register(Lua, "SetMenuBackground", CclSetMenuBackground);
Index: stratagus/src/ui/menu_proc.c
diff -u stratagus/src/ui/menu_proc.c:1.113 stratagus/src/ui/menu_proc.c:1.114
--- stratagus/src/ui/menu_proc.c:1.113 Sun Dec 14 03:14:47 2003
+++ stratagus/src/ui/menu_proc.c Sun Dec 14 07:54:07 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menu_proc.c,v 1.113 2003/12/13 16:14:47 mohydine Exp $
+// $Id: menu_proc.c,v 1.114 2003/12/13 20:54:07 jsalmon3 Exp $
//@{
@@ -207,7 +207,6 @@
**
** @param button Button identifier
** @param flags State of Button (clicked, mouse over...)
-** @param transparent State of button transparency: 0=No, 1=Yes
** @param w Button width (for border)
** @param h Button height (for border)
** @param x X display position
@@ -217,7 +216,7 @@
** @param normalcolor
** @param reversecolor
*/
-global void DrawMenuButton(MenuButtonId button, unsigned flags, int
transparent, int w, int h,
+global void DrawMenuButton(MenuButtonId button, unsigned flags, int w, int h,
int x, int y, const int font, const unsigned char* text,
char* normalcolor, char* reversecolor)
{
@@ -285,13 +284,7 @@
}
}
if (rb < MenuButtonGfx.Sprite->NumFrames) {
- // Add
here//*******************************************************************
- if (transparent) {
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, rb, x, y);
- } else {
- VideoDrawClip(MenuButtonGfx.Sprite, rb, x, y);
- }
-
+ VideoDrawClip(MenuButtonGfx.Sprite, rb, x, y);
} else {
if (rb < button) {
VideoDrawRectangleClip(ColorGray, x + 1, y + 1, w - 2, h - 2);
@@ -511,11 +504,7 @@
while (i--) {
PushClipping();
SetClipping(0, 0, x + w, VideoHeight - 1);
- if (mi->transparent) {
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, rb, x - 1, y - 1 +
oh * i);
- } else {
VideoDrawClip(MenuButtonGfx.Sprite, rb, x - 1, y - 1 + oh * i);
- }
PopClipping();
text = mi->d.pulldown.options[i];
if (text) {
@@ -547,11 +536,7 @@
} else {
SetClipping(0, 0, x + w - 1, VideoHeight - 1);
}
- if (mi->transparent) {
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, rb, x - 1, y - 1);
- } else {
- VideoDrawClip(MenuButtonGfx.Sprite, rb, x - 1, y - 1);
- }
+ VideoDrawClip(MenuButtonGfx.Sprite, rb, x - 1, y - 1);
PopClipping();
if (!(mi->d.pulldown.state & MI_PSTATE_PASSIVE)) {
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_DOWN_ARROW + rb -
MBUTTON_PULLDOWN,
@@ -621,11 +606,7 @@
while (i--) {
PushClipping();
SetClipping(0, 0, x + w, VideoHeight - 1);
- if (mi->transparent) {
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, rb, x - 1, y - 1 + 18 * i);
- } else {
VideoDrawClip(MenuButtonGfx.Sprite, rb, x - 1, y - 1 + 18 * i);
- }
PopClipping();
if (!(flags & MenuButtonDisabled)) {
if (i < mi->d.listbox.noptions) {
@@ -711,26 +692,16 @@
if (flags & MenuButtonDisabled) {
PushClipping();
SetClipping(0, 0, VideoWidth - 1, y + h - 20);
- if (mi->transparent) {
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_VCONT - 1, x,
y - 2);
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_VCONT - 1, x,
y + h / 2);
- } else {
- VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT - 1, x, y -
2);
+ VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT - 1, x, y - 2);
VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT - 1, x, y + h /
2);
- }
PopClipping();
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_UP_ARROW - 1, x, y - 2);
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_DOWN_ARROW - 1, x, y + h -
20);
} else {
PushClipping();
SetClipping(0, 0, VideoWidth - 1, y + h - 20);
- if (mi->transparent) {
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_VCONT, x, y -
2);
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_VCONT, x, y +
h / 2);
- } else {
- VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT, x, y - 2);
+ VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT, x, y - 2);
VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT, x, y + h / 2);
- }
PopClipping();
if (mi->d.vslider.cflags & MI_CFLAGS_UP) {
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_UP_ARROW + 1, x, y - 2);
@@ -814,26 +785,16 @@
if (flags & MenuButtonDisabled) {
PushClipping();
SetClipping(0, 0, x + w - 20, VideoHeight - 1);
- if (mi->transparent) {
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_HCONT - 1, x -
2, y);
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_HCONT - 1, x +
w / 2, y);
- } else {
- VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT - 1, x - 2,
y);
+ VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT - 1, x - 2, y);
VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT - 1, x + w / 2,
y);
- }
PopClipping();
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_LEFT_ARROW - 1, x - 2, y);
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_RIGHT_ARROW - 1, x + w -
20, y);
} else {
PushClipping();
SetClipping(0, 0, x + w - 20, VideoHeight - 1);
- if (mi->transparent) {
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_HCONT, x - 2,
y);
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_HCONT, x + w /
2, y);
- } else {
- VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT, x - 2, y);
+ VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT, x - 2, y);
VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT, x + w / 2, y);
- }
PopClipping();
if (mi->d.hslider.cflags & MI_CFLAGS_LEFT) {
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_LEFT_ARROW + 1, x - 2,
y);
@@ -978,11 +939,7 @@
PushClipping();
SetClipping(0, 0, x + w, VideoHeight - 1);
- if (mi->transparent) {
- VideoDrawClipTrans50(MenuButtonGfx.Sprite, rb, x - 1, y - 1);
- } else {
VideoDrawClip(MenuButtonGfx.Sprite, rb, x - 1, y - 1);
- }
PopClipping();
text = mi->d.input.buffer;
if (text) {
@@ -1111,7 +1068,7 @@
SetDefaultTextColors(oldnc, oldrc);
break;
case MI_TYPE_BUTTON:
- DrawMenuButton(mi->d.button.button, mi->flags, mi->transparent,
+ DrawMenuButton(mi->d.button.button, mi->flags,
mi->d.button.xsize, mi->d.button.ysize,
menu->X + mi->xofs, menu->Y + mi->yofs,
mi->font, mi->d.button.text,
Index: stratagus/src/ui/menus.c
diff -u stratagus/src/ui/menus.c:1.596 stratagus/src/ui/menus.c:1.597
--- stratagus/src/ui/menus.c:1.596 Sun Dec 14 03:14:47 2003
+++ stratagus/src/ui/menus.c Sun Dec 14 07:54:08 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menus.c,v 1.596 2003/12/13 16:14:47 mohydine Exp $
+// $Id: menus.c,v 1.597 2003/12/13 20:54:08 jsalmon3 Exp $
//@{
@@ -451,8 +451,8 @@
** Help-items for the Net Multiplayer Setup and Client Menus
*/
local Menuitem NetMultiButtonStorage[] = {
- { MI_TYPE_PULLDOWN, 40, 32, 0, GameFont, 0, NULL, NULL, NULL, {{NULL,0}} },
- { MI_TYPE_DRAWFUNC, 40, 32, 0, GameFont, 0, NULL, NULL, NULL, {{NULL,0}} },
+ { MI_TYPE_PULLDOWN, 40, 32, 0, GameFont, NULL, NULL, NULL, {{NULL,0}} },
+ { MI_TYPE_DRAWFUNC, 40, 32, 0, GameFont, NULL, NULL, NULL, {{NULL,0}} },
};
local void InitNetMultiButtonStorage() {
MenuitemPulldown i0 = { mgptsoptions, 172, 20, MBUTTON_PULLDOWN,
MultiGamePTSAction, 3, -1, 0, 0, 0};
@@ -3021,7 +3021,7 @@
Menu *menu;
#ifdef USE_SDL_SURFACE
- VideoUnlockScreen();
+ MenusSetBackground();
Invalidate();
#else
VideoLockScreen();
@@ -7178,7 +7178,6 @@
char* reply;
Menu* menu;
char* port;
-
SendMetaCommand("NumberOfGames", "");
Index: stratagus/src/video/sprite.c
diff -u stratagus/src/video/sprite.c:1.54 stratagus/src/video/sprite.c:1.55
--- stratagus/src/video/sprite.c:1.54 Sun Dec 14 03:14:48 2003
+++ stratagus/src/video/sprite.c Sun Dec 14 07:54:18 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: sprite.c,v 1.54 2003/12/13 16:14:48 mohydine Exp $
+// $Id: sprite.c,v 1.55 2003/12/13 20:54:18 jsalmon3 Exp $
//@{
@@ -72,7 +72,7 @@
----------------------------------------------------------------------------*/
#ifdef USE_SDL_SURFACE
-local void VideoDraw(const Graphic* sprite, unsigned frame, int x, int y)
+global void VideoDraw(const Graphic* sprite, unsigned frame, int x, int y)
{
SDL_Rect srect;
SDL_Rect drect;
@@ -112,12 +112,29 @@
SDL_BlitSurface(sprite->Surface, &srect, TheScreen, &drect);
}
-local void VideoDrawX(const Graphic* sprite, unsigned frame, int x, int y)
+global void VideoDrawX(const Graphic* sprite, unsigned frame, int x, int y)
{
SDL_Rect srect;
SDL_Rect drect;
- DebugCheck(!sprite->SurfaceFlip);
+ srect.x = (sprite->SurfaceFlip->w - (frame % (sprite->SurfaceFlip->w /
+ sprite->Width)) * sprite->Width) - sprite->Width;
+ srect.y = (frame / (sprite->SurfaceFlip->w / sprite->Width)) *
sprite->Height;
+ srect.w = sprite->Width;
+ srect.h = sprite->Height;
+
+ drect.x = x;
+ drect.y = y;
+
+ SDL_BlitSurface(sprite->SurfaceFlip, &srect, TheScreen, &drect);
+}
+
+global void VideoDrawClipX(const Graphic* sprite, unsigned frame, int x, int y)
+{
+ SDL_Rect srect;
+ SDL_Rect drect;
+ int oldx;
+ int oldy;
srect.x = (sprite->SurfaceFlip->w - (frame % (sprite->SurfaceFlip->w /
sprite->Width)) * sprite->Width) - sprite->Width;
@@ -125,18 +142,55 @@
srect.w = sprite->Width;
srect.h = sprite->Height;
+ oldx = x;
+ oldy = y;
+ CLIP_RECTANGLE(x, y, srect.w, srect.h);
+ srect.x += x - oldx;
+ srect.y += y - oldy;
+
drect.x = x;
drect.y = y;
SDL_BlitSurface(sprite->SurfaceFlip, &srect, TheScreen, &drect);
}
-local void VideoDrawClipX(const Graphic* sprite, unsigned frame, int x, int y)
+global void VideoDrawShadowClip(const Graphic* sprite, unsigned frame,
+ int x, int y)
+{
+ SDL_Rect srect;
+ SDL_Rect drect;
+ int oldx;
+ int oldy;
+ unsigned char alpha;
+
+ srect.x = (frame % (sprite->Surface->w / sprite->Width)) * sprite->Width;
+ srect.y = (frame / (sprite->Surface->w / sprite->Width)) * sprite->Height;
+ srect.w = sprite->Width;
+ srect.h = sprite->Height;
+
+ oldx = x;
+ oldy = y;
+ CLIP_RECTANGLE(x, y, srect.w, srect.h);
+ srect.x += x - oldx;
+ srect.y += y - oldy;
+
+ drect.x = x;
+ drect.y = y;
+
+ alpha = sprite->Surface->format->alpha;
+ SDL_SetAlpha(sprite->Surface, SDL_SRCALPHA | SDL_RLEACCEL, 128);
+ SDL_BlitSurface(sprite->Surface, &srect, TheScreen, &drect);
+ SDL_SetAlpha(sprite->Surface, SDL_SRCALPHA | SDL_RLEACCEL, alpha);
+}
+
+global void VideoDrawShadowClipX(const Graphic* sprite, unsigned frame,
+ int x, int y)
{
SDL_Rect srect;
SDL_Rect drect;
int oldx;
int oldy;
+ unsigned char alpha;
srect.x = (sprite->SurfaceFlip->w - (frame % (sprite->SurfaceFlip->w /
sprite->Width)) * sprite->Width) - sprite->Width;
@@ -153,7 +207,10 @@
drect.x = x;
drect.y = y;
+ alpha = sprite->Surface->format->alpha;
+ SDL_SetAlpha(sprite->Surface, SDL_SRCALPHA | SDL_RLEACCEL, 128);
SDL_BlitSurface(sprite->SurfaceFlip, &srect, TheScreen, &drect);
+ SDL_SetAlpha(sprite->Surface, SDL_SRCALPHA | SDL_RLEACCEL, alpha);
}
#else
//
@@ -727,7 +784,6 @@
}
if (dp <= pp) {
*dp++ = pixels[*sp++];
-
}
} while (dp < lp);
dp += da;
@@ -3340,1392 +3396,76 @@
#endif
#endif
}
-///
*******************************************************************************************
-/// Begining of 50% Transparent functions
-///
*******************************************************************************************
-/**
-** Draw 8bit graphic object unclipped and flipped in X direction
-** into 8 bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to8XTrans50(const Graphic* sprite, unsigned frame, int x,
int y)
-{
- const unsigned char* sp;
- unsigned w;
- VMemType8* dp;
- const VMemType8* lp;
- const VMemType8* ep;
- const VMemType8* pp;
- const VMemType8* pixels;
- unsigned da;
-
- pixels = (VMemType8*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
- w = sprite->Width;
- dp = VideoMemory8 + x + y * VideoWidth + w - 1;
- da = VideoWidth + w;
- ep = dp + VideoWidth * sprite->Height;
- do {
- lp = dp - w;
- do { // 1 line
- dp -= *sp++; // transparent
- pp = dp + 1 - *sp++; // opaque
- while (dp > pp) { // unrolled
- *dp-- = pixels[*sp++];
- *dp-- = pixels[*sp++];
- }
- if (dp >= pp) {
- *dp-- = pixels[*sp++];
- }
- } while (dp > lp);
- dp += da;
- } while (dp < ep); // all lines
-}
/**
-** Draw 8bit graphic object unclipped and flipped in X direction
-** into 16 bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
+** Init sprite
*/
-local void VideoDraw8to16XTrans50(const Graphic* sprite, unsigned frame, int
x, int y)
+global void InitSprite(void)
{
- const unsigned char* sp;
- unsigned w;
- VMemType16* dp;
- const VMemType16* lp;
- const VMemType16* ep;
- const VMemType16* pp;
- const VMemType16* pixels;
- unsigned da;
+#ifdef USE_SDL_SURFACE
- pixels = (VMemType16*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
- w = sprite->Width;
- dp = VideoMemory16 + x + y * VideoWidth + w - 1;
- da = VideoWidth + w;
- ep = dp + VideoWidth * sprite->Height;
+#else
- do {
- lp = dp - w;
- do { // 1 line
- dp -= *sp++; // transparent
- pp = dp + 1 - *sp++; // opaque
- while (dp > pp) { // unrolled
- *dp-- = pixels[*sp++];
- *dp-- = pixels[*sp++];
- }
- if (dp >= pp) {
- *dp-- = pixels[*sp++];
- }
- } while (dp > lp);
- dp += da;
- } while (dp < ep); // all lines
-}
+#ifdef USE_OPENGL
+ GraphicSprite8Type.Draw = VideoDrawOpenGL;
+ GraphicSprite8Type.DrawClip = VideoDrawClipOpenGL;
+ GraphicSprite8Type.DrawShadowClip = VideoDraw8to32ShadowClip;
+ GraphicSprite8Type.DrawX = VideoDrawXOpenGL;
+ GraphicSprite8Type.DrawClipX = VideoDrawClipXOpenGL;
+ GraphicSprite8Type.DrawShadowClipX = VideoDraw8to32ShadowClipX;
+ VideoDrawRawClip = VideoDrawRaw32Clip;
+#else
-/**
-** Draw 8bit graphic object unclipped and flipped in X direction
-** into 24 bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to24XTrans50(const Graphic* sprite, unsigned frame, int
x, int y)
-{
- const unsigned char* sp;
- unsigned w;
- VMemType24* dp;
- const VMemType24* lp;
- const VMemType24* ep;
- const VMemType24* pp;
- const VMemType24* pixels;
- unsigned da;
+ switch (VideoBpp) {
+ case 8:
+ GraphicSprite8Type.Draw = VideoDraw8to8;
+ GraphicSprite8Type.DrawClip = VideoDraw8to8Clip;
+ GraphicSprite8Type.DrawShadowClip = VideoDraw8to8ShadowClip;
+ GraphicSprite8Type.DrawX = VideoDraw8to8X;
+ GraphicSprite8Type.DrawClipX = VideoDraw8to8ClipX;
+ GraphicSprite8Type.DrawShadowClipX = VideoDraw8to8ShadowClipX;
+ VideoDrawRawClip = VideoDrawRaw8Clip;
+ break;
- pixels = (VMemType24*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
- w = sprite->Width;
- dp = VideoMemory24 + x + y * VideoWidth + w - 1;
- da = VideoWidth + w;
- ep = dp + VideoWidth * sprite->Height;
+ case 15:
+ case 16:
+ GraphicSprite8Type.Draw = VideoDraw8to16;
+ GraphicSprite8Type.DrawClip = VideoDraw8to16Clip;
+ GraphicSprite8Type.DrawShadowClip = VideoDraw8to16ShadowClip;
+ GraphicSprite8Type.DrawX = VideoDraw8to16X;
+ GraphicSprite8Type.DrawClipX = VideoDraw8to16ClipX;
+ GraphicSprite8Type.DrawShadowClipX = VideoDraw8to16ShadowClipX;
+ VideoDrawRawClip = VideoDrawRaw16Clip;
+ break;
- do {
- lp = dp - w;
- do { // 1 line
- dp -= *sp++; // transparent
- pp = dp + 1 - *sp++; // opaque
- while (dp > pp) { // unrolled
- *dp-- = pixels[*sp++];
- *dp-- = pixels[*sp++];
- }
- if (dp >= pp) {
- *dp-- = pixels[*sp++];
- }
- } while (dp > lp);
- dp += da;
- } while (dp < ep); // all lines
-}
+ case 24:
+ GraphicSprite8Type.Draw = VideoDraw8to24;
+ GraphicSprite8Type.DrawClip = VideoDraw8to24Clip;
+ GraphicSprite8Type.DrawShadowClip = VideoDraw8to24ShadowClip;
+ GraphicSprite8Type.DrawX = VideoDraw8to24X;
+ GraphicSprite8Type.DrawClipX = VideoDraw8to24ClipX;
+ GraphicSprite8Type.DrawShadowClipX = VideoDraw8to24ShadowClipX;
+ VideoDrawRawClip = VideoDrawRaw24Clip;
+ break;
-/**
-** Draw 8bit graphic object unclipped and flipped in X direction
-** into 32 bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to32XTrans50(const Graphic* sprite, unsigned frame, int
x, int y)
-{
- const unsigned char* sp;
- unsigned w;
- VMemType32* dp;
- const VMemType32* lp;
- const VMemType32* ep;
- const VMemType32* pp;
- const VMemType32* pixels;
- unsigned da;
+ case 32:
+ GraphicSprite8Type.Draw = VideoDraw8to32;
+ GraphicSprite8Type.DrawClip = VideoDraw8to32Clip;
+ GraphicSprite8Type.DrawShadowClip = VideoDraw8to32ShadowClip;
+ GraphicSprite8Type.DrawX = VideoDraw8to32X;
+ GraphicSprite8Type.DrawClipX = VideoDraw8to32ClipX;
+ GraphicSprite8Type.DrawShadowClipX = VideoDraw8to32ShadowClipX;
+ VideoDrawRawClip = VideoDrawRaw32Clip;
+ break;
- pixels = (VMemType32*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
- w = sprite->Width;
- dp = VideoMemory32 + x + y * VideoWidth + w - 1;
- da = VideoWidth + w;
- ep = dp + VideoWidth * sprite->Height;
-
- do {
- lp = dp - w;
- do { // 1 line
- dp -= *sp++; // transparent
- pp = dp + 1 - *sp++; // opaque
- while (dp > pp) { // unrolled
- *dp-- = pixels[*sp++];
- *dp-- = pixels[*sp++];
- }
- if (dp >= pp) {
- *dp-- = pixels[*sp++];
- }
- } while (dp > lp);
- dp += da;
- } while (dp < ep); // all lines
-}
-
-
-/**
-** Draw 8bit graphic object clipped into 8 bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to8ClipTrans50(const Graphic* sprite, unsigned frame, int
x, int y)
-{
- int ox;
- int ex;
- int oy;
- int w;
- int h;
- const unsigned char* sp;
- int sw;
- VMemType8* dp;
- const VMemType8* lp;
- const VMemType8* ep;
- VMemType8* pp;
- const VMemType8* pixels;
- int da;
-
-
- //
- // reduce to visible range
- //
- sw = w = sprite->Width;
- h = sprite->Height;
- CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
-
- //
- // Draw the clipped sprite
- //
- pixels = (VMemType8*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
-
- //
- // Skip top lines, if needed.
- //
- while (oy--) {
- da = 0;
- do {
- da += *sp++; // transparent
- da += *sp; // opaque
- sp += *sp + 1;
- } while (da < sw);
- }
-
- da = VideoWidth - sw;
- dp = VideoMemory8 + x + y * VideoWidth;
- ep = dp + VideoWidth * h;
-
- if (w == sw) { // Unclipped horizontal
-
- do {
- lp = dp + sw;
- do { // 1 line
- dp += *sp++; // transparent
- pp = dp - 1 + *sp++; // opaque
- while (dp < pp) { // unroll
- *dp++ = pixels[*sp++];
- *dp++ = pixels[*sp++];
- }
- if (dp <= pp) {
- *dp++ = pixels[*sp++];
- }
- } while (dp < lp);
- dp += da;
- } while (dp < ep); // all lines
-
- } else { // Clip horizontal
-
- da += ox;
- do {
- lp = dp + w;
- //
- // Clip left
- //
- pp = dp - ox;
- for (;;) {
- pp += *sp++; // transparent
- if (pp >= dp) {
- dp = pp;
- goto middle_trans;
- }
- pp += *sp; // opaque
- if (pp >= dp) {
- sp += *sp - (pp - dp) + 1;
- goto middle_pixel;
- }
- sp += *sp + 1;
- }
-
- //
- // Draw middle
- //
- for (;;) {
- dp += *sp++; // transparent
-middle_trans:
- if (dp >= lp) {
- lp += sw - w - ox;
- goto right_trans;
- }
- pp = dp + *sp++; // opaque
-middle_pixel:
- if (pp < lp) {
- while (dp < pp) {
- *dp++ = pixels[*sp++];
- }
- continue;
- }
- while (dp < lp) {
- *dp++ = pixels[*sp++];
- }
- sp += pp - dp;
- dp = pp;
- break;
- }
-
- //
- // Clip right
- //
- lp += sw - w - ox;
- while (dp < lp) {
- dp += *sp++; // transparent
-right_trans:
- dp += *sp; // opaque
- sp += *sp + 1;
- }
- dp += da;
- } while (dp < ep); // all lines
-
- }
-}
-
-/**
-** Draw 8bit graphic object clipped into 16 bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to16ClipTrans50(const Graphic* sprite, unsigned frame,
int x, int y)
-{
- int ox;
- int ex;
- int oy;
- int w;
- int h;
- const unsigned char* sp;
- int sw;
- VMemType16* dp;
- const VMemType16* lp;
- const VMemType16* ep;
- VMemType16* pp;
- const VMemType16* pixels;
- int da;
-
-//Added by Mohydine
-
- VMemType16* p;
- p = VideoMemory16 + y * VideoWidth + x;
-
-//Added by Mohydine
- //
- // reduce to visible range
- //
- sw = w = sprite->Width;
- h = sprite->Height;
- CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
-
-
- //
- // Draw the clipped sprite
- //
- pixels = (VMemType16*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
-
- //
- // Skip top lines, if needed.
- //
- while (oy--) {
- da = 0;
- do {
- da += *sp++; // transparent
- da += *sp; // opaque
- sp += *sp + 1;
- } while (da < sw);
- }
-
- da = VideoWidth - sw;
- dp = VideoMemory16 + x + y * VideoWidth;
- ep = dp + VideoWidth * h;
-
- if (w == sw) { // Unclipped horizontal
-
- do {
- lp = dp + sw;
- do { // 1 line
- dp += *sp++; // transparent
- pp = dp - 1 + *sp++; // opaque
- while (dp < pp) { // unroll
- *dp++ = ((*dp >> 1) & 0x7BEF) +((pixels[*sp++] >> 1) &
0x7BEF);
- *dp++ = ((*dp >> 1) & 0x7BEF) +((pixels[*sp++] >> 1) &
0x7BEF);
- //*dp++ = ((*dp >> 2) & 0x79E7) + ((pixels[*sp] >> 2)
& 0x79E7) +((pixels[*sp++] >> 1) & 0x7BEF);
- //*dp++ = ((*dp >> 2) & 0x79E7) + ((pixels[*sp] >> 2) &
0x79E7) +((pixels[*sp++] >> 1) & 0x7BEF);
- }
- if (dp <= pp) {
- *dp++ = ((*dp >> 1) & 0x7BEF) + ((pixels[*sp++] >> 1) &
0x7BEF);
- }
- } while (dp < lp);
- dp += da;
- } while (dp < ep); // all lines
-
- } else { // Clip horizontal
-
- da += ox;
- do {
- lp = dp + w;
- //
- // Clip left
- //
- pp = dp - ox;
- for (;;) {
- pp += *sp++; // transparent
- if (pp >= dp) {
- dp = pp;
- goto middle_trans;
- }
- pp += *sp; // opaque
- if (pp >= dp) {
- sp += *sp - (pp - dp) + 1;
- goto middle_pixel;
- }
- sp += *sp + 1;
- }
-
- //
- // Draw middle
- //
- for (;;) {
- dp += *sp++; // transparent
-middle_trans:
- if (dp >= lp) {
- lp += sw - w - ox;
- goto right_trans;
- }
- pp = dp + *sp++; // opaque
-middle_pixel:
- if (pp < lp) {
- while (dp < pp) {
- *dp++ = ((*dp >> 1) & 0x7BEF) + ((pixels[*sp++] >> 1)
& 0x7BEF);
- }
- continue;
- }
- while (dp < lp) {
- *dp++ = ((*dp >> 1) & 0x7BEF) + ((pixels[*sp++] >> 1) &
0x7BEF);
- }
- sp += pp - dp;
- dp = pp;
- break;
- }
-
- //
- // Clip right
- //
- lp += sw - w - ox;
- while (dp < lp) {
- dp += *sp++; // transparent
-right_trans:
- dp += *sp; // opaque
- sp += *sp + 1;
- }
- dp += da;
- } while (dp < ep); // all lines
-
- }
-}
-
-/**
-** Draw 8bit graphic object clipped into 24 bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to24ClipTrans50(const Graphic* sprite, unsigned frame,
int x, int y)
-{
- int ox;
- int ex;
- int oy;
- int w;
- int h;
- const unsigned char* sp;
- int sw;
- VMemType24* dp;
- const VMemType24* lp;
- const VMemType24* ep;
- VMemType24* pp;
- const VMemType24* pixels;
- int da;
-
- //
- // reduce to visible range
- //
- sw = w = sprite->Width;
- h = sprite->Height;
- CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
-
- //
- // Draw the clipped sprite
- //
- pixels = (VMemType24*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
-
- //
- // Skip top lines, if needed.
- //
- while (oy--) {
- da = 0;
- do {
- da += *sp++; // transparent
- da += *sp; // opaque
- sp += *sp + 1;
- } while (da < sw);
- }
-
- da = VideoWidth - sw;
- dp = VideoMemory24 + x + y * VideoWidth;
- ep = dp + VideoWidth * h;
-
- if (w == sw) { // Unclipped horizontal
-
- do {
- lp = dp + sw;
- do { // 1 line
- dp += *sp++; // transparent
- pp = dp - 1 + *sp++; // opaque
- while (dp < pp) { // unroll
- *dp++ = pixels[*sp++];
- *dp++ = pixels[*sp++];
- }
- if (dp <= pp) {
- *dp++ = pixels[*sp++];
- }
- } while (dp < lp);
- dp += da;
- } while (dp < ep); // all lines
-
- } else { // Clip horizontal
-
- da += ox;
- do {
- lp = dp + w;
- //
- // Clip left
- //
- pp = dp - ox;
- for (;;) {
- pp += *sp++; // transparent
- if (pp >= dp) {
- dp = pp;
- goto middle_trans;
- }
- pp += *sp; // opaque
- if (pp >= dp) {
- sp += *sp - (pp - dp) + 1;
- goto middle_pixel;
- }
- sp += *sp + 1;
- }
-
- //
- // Draw middle
- //
- for (;;) {
- dp += *sp++; // transparent
-middle_trans:
- if (dp >= lp) {
- lp += sw - w - ox;
- goto right_trans;
- }
- pp = dp + *sp++; // opaque
-middle_pixel:
- if (pp < lp) {
- while (dp < pp) {
- *dp++ = pixels[*sp++];
- }
- continue;
- }
- while (dp < lp) {
- *dp++ = pixels[*sp++];
- }
- sp += pp - dp;
- dp = pp;
- break;
- }
-
- //
- // Clip right
- //
- lp += sw - w - ox;
- while (dp < lp) {
- dp += *sp++; // transparent
-right_trans:
- dp += *sp; // opaque
- sp += *sp + 1;
- }
- dp += da;
- } while (dp < ep); // all lines
-
- }
-}
-
-/**
-** Draw 8bit graphic object clipped into 32 bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to32ClipTrans50(const Graphic* sprite, unsigned frame,
int x, int y)
-{
- int ox;
- int ex;
- int oy;
- int w;
- int h;
- const unsigned char* sp;
- int sw;
- VMemType32* dp;
- const VMemType32* lp;
- const VMemType32* ep;
- VMemType32* pp;
- const VMemType32* pixels;
- int da;
-
- //
- // reduce to visible range
- //
- sw = w = sprite->Width;
- h = sprite->Height;
- CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
-
- //
- // Draw the clipped sprite
- //
- pixels = (VMemType32*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
-
- //
- // Skip top lines, if needed.
- //
- while (oy--) {
- da = 0;
- do {
- da += *sp++; // transparent
- da += *sp; // opaque
- sp += *sp + 1;
- } while (da < sw);
- }
-
- da = VideoWidth - sw;
- dp = VideoMemory32 + x + y * VideoWidth;
- ep = dp + VideoWidth * h;
-
- if (w == sw) { // Unclipped horizontal
-
- do {
- lp = dp + sw;
- do { // 1 line
- dp += *sp++; // transparent
- pp = dp - 1 + *sp++; // opaque
- while (dp < pp) { // unroll
- *dp++ = ((*dp >> 1) & 0x7F7F7F7F) + ((pixels[*sp++] >> 1)
& 0x7F7F7F7F) ;
- *dp++ = ((*dp >> 1) & 0x7F7F7F7F) + ((pixels[*sp++] >> 1)
& 0x7F7F7F7F) ;
- }
- if (dp <= pp) {
- *dp++ = ((*dp >> 1) & 0x7F7F7F7F) + ((pixels[*sp++] >> 1) &
0x7F7F7F7F);
- }
- } while (dp < lp);
- dp += da;
- } while (dp < ep); // all lines
-
- } else { // Clip horizontal
-
- da += ox;
- do {
- lp = dp + w;
- //
- // Clip left
- //
- pp = dp - ox;
- for (;;) {
- pp += *sp++; // transparent
- if (pp >= dp) {
- dp = pp;
- goto middle_trans;
- }
- pp += *sp; // opaque
- if (pp >= dp) {
- sp += *sp - (pp - dp) + 1;
- goto middle_pixel;
- }
- sp += *sp + 1;
- }
-
- //
- // Draw middle
- //
- for (;;) {
- dp += *sp++; // transparent
-middle_trans:
- if (dp >= lp) {
- lp += sw - w - ox;
- goto right_trans;
- }
- pp = dp + *sp++; // opaque
-middle_pixel:
- if (pp < lp) {
- while (dp < pp) {
- *dp++ = ((*dp >> 1) & 0x7F7F7F7F) + ((pixels[*sp++] >>
1) & 0x7F7F7F7F);
- }
- continue;
- }
- while (dp < lp) {
- *dp++ = ((*dp >> 1) & 0x7F7F7F7F) + ((pixels[*sp++] >> 1) &
0x7F7F7F7F);
- }
- sp += pp - dp;
- dp = pp;
- break;
- }
-
- //
- // Clip right
- //
- lp += sw - w - ox;
- while (dp < lp) {
- dp += *sp++; // transparent
-right_trans:
- dp += *sp; // opaque
- sp += *sp + 1;
- }
- dp += da;
- } while (dp < ep); // all lines
-
- }
-}
-
-/**
-** Draw 8bit graphic object clipped and flipped in X direction
-** into 8 bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to8ClipXTrans50(const Graphic* sprite, unsigned frame,
int x, int y)
-{
- int ox;
- int ex;
- int oy;
- int w;
- int h;
- const unsigned char* sp;
- int sw;
- VMemType8* dp;
- const VMemType8* lp;
- const VMemType8* ep;
- VMemType8* pp;
- const VMemType8* pixels;
- int da;
-
- //
- // reduce to visible range
- //
- sw = w = sprite->Width;
- h = sprite->Height;
- CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
-
- //
- // Draw the clipped sprite
- //
- pixels = (VMemType8*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
-
- //
- // Skip top lines
- //
- while (oy--) {
- da = 0;
- do {
- da += *sp++; // transparent
- da += *sp; // opaque
- sp += *sp + 1;
- } while (da < sw);
- }
-
- da = VideoWidth + sw;
- dp = VideoMemory8 + x + y * VideoWidth + w - 1;
- ep = dp + VideoWidth * h;
-
- if (w == sw) { // Unclipped horizontal
-
- while (dp < ep) { // all lines
- lp = dp - w;
- do { // 1 line
- dp -= *sp++; // transparent
- pp = dp + 1 - *sp++; // opaque
- while (dp > pp) {
- *dp-- = pixels[*sp++];
- *dp-- = pixels[*sp++];
- }
- if (dp >= pp) {
- *dp-- = pixels[*sp++];
- }
- } while (dp > lp);
- dp += da;
- }
-
- } else { // Clip horizontal
-
- da -= sw - w - ox;
- while (dp < ep) { // all lines
- lp = dp - w;
- //
- // Clip right side
- //
- pp = dp + sw - w - ox;
- for (;;) {
- pp -= *sp++; // transparent
- if (pp <= dp) {
- dp = pp;
- goto middle_trans;
- }
- pp -= *sp; // opaque
- if (pp <= dp) {
- sp += *sp - (dp - pp) + 1;
- goto middle_pixel;
- }
- sp += *sp + 1;
- }
-
- //
- // Draw middle
- //
- for (;;) {
- dp -= *sp++; // transparent
-middle_trans:
- if (dp <= lp) {
- lp -= ox;
- goto right_trans;
- }
- pp = dp - *sp++; // opaque
-middle_pixel:
- if (pp > lp) {
- while (dp > pp) {
- *dp-- = pixels[*sp++];
- }
- continue;
- }
- while (dp > lp) {
- *dp-- = pixels[*sp++];
- }
- sp += dp - pp;
- dp = pp;
- break;
- }
-
- //
- // Clip left side
- //
- lp -= ox;
- while (dp > lp) {
- dp -= *sp++; // transparent
-right_trans:
- dp -= *sp; // opaque
- sp += *sp + 1;
- }
- dp += da;
-
- }
- }
-}
-
-/**
-** Draw 8bit graphic object clipped and flipped in X direction
-** into 16 bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to16ClipXTrans50(const Graphic* sprite, unsigned frame,
- int x, int y)
-{
- int ox;
- int ex;
- int oy;
- int w;
- int h;
- const unsigned char* sp;
- int sw;
- VMemType16* dp;
- const VMemType16* lp;
- const VMemType16* ep;
- VMemType16* pp;
- const VMemType16* pixels;
- int da;
-
-
- //
- // reduce to visible range
- //
- sw = w = sprite->Width;
- h = sprite->Height;
- CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
-
- //
- // Draw the clipped sprite
- //
- pixels = (VMemType16*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
-
- //
- // Skip top lines
- //
- while (oy--) {
- da = 0;
- do {
- da += *sp++; // transparent
- da += *sp; // opaque
- sp += *sp + 1;
- } while (da < sw);
- }
-
- da = VideoWidth + sw;
- dp = VideoMemory16 + x + y * VideoWidth + w - 1;
- ep = dp + VideoWidth * h;
-
- if (w == sw) { // Unclipped horizontal
-
- while (dp < ep) { // all lines
- lp = dp - w;
- do { // 1 line
- dp -= *sp++; // transparent
- pp = dp + 1 - *sp++; // opaque
- while (dp > pp) {
- *dp-- = ((*dp >> 1) & 0x7BEF) + ((pixels[*sp++] >> 1) &
0x7BEF);
- *dp-- = ((*dp >> 1) & 0x7BEF) + ((pixels[*sp++] >> 1) &
0x7BEF);
- }
- if (dp >= pp) {
- *dp-- = ((*dp >> 1) & 0x7BEF) + ((pixels[*sp++] >> 1) &
0x7BEF);
- }
- } while (dp > lp);
- dp += da;
- }
-
- } else { // Clip horizontal
-
- da -= sw - w - ox;
- while (dp < ep) { // all lines
- lp = dp - w;
- //
- // Clip right side
- //
- pp = dp + sw - w - ox;
- for (;;) {
- pp -= *sp++; // transparent
- if (pp <= dp) {
- dp = pp;
- goto middle_trans;
- }
- pp -= *sp; // opaque
- if (pp <= dp) {
- sp += *sp - (dp - pp) + 1;
- goto middle_pixel;
- }
- sp += *sp + 1;
- }
-
- //
- // Draw middle
- //
- for (;;) {
- dp -= *sp++; // transparent
-middle_trans:
- if (dp <= lp) {
- lp -= ox;
- goto right_trans;
- }
- pp = dp - *sp++; // opaque
-middle_pixel:
- if (pp > lp) {
- while (dp > pp) {
- *dp-- = pixels[*sp++];
- }
- continue;
- }
- while (dp > lp) {
- *dp-- = pixels[*sp++];
- }
- sp += dp - pp;
- dp = pp;
- break;
- }
-
- //
- // Clip left side
- //
- lp -= ox;
- while (dp > lp) {
- dp -= *sp++; // transparent
-right_trans:
- dp -= *sp; // opaque
- sp += *sp + 1;
- }
- dp += da;
-
- }
- }
-}
-
-/**
-** Draw 8bit graphic object clipped and flipped in X direction
-** into 24bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to24ClipXTrans50(const Graphic* sprite, unsigned frame,
- int x, int y)
-{
- int ox;
- int ex;
- int oy;
- int w;
- int h;
- const unsigned char* sp;
- int sw;
- VMemType24* dp;
- const VMemType24* lp;
- const VMemType24* ep;
- VMemType24* pp;
- const VMemType24* pixels;
- int da;
-
- //
- // reduce to visible range
- //
- sw = w = sprite->Width;
- h = sprite->Height;
- CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
-
- //
- // Draw the clipped sprite
- //
- pixels = (VMemType24*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
-
- //
- // Skip top lines
- //
- while (oy--) {
- da = 0;
- do {
- da += *sp++; // transparent
- da += *sp; // opaque
- sp += *sp + 1;
- } while (da < sw);
- }
-
- da = VideoWidth + sw;
- dp = VideoMemory24 + x + y * VideoWidth + w - 1;
- ep = dp + VideoWidth * h;
-
- if (w == sw) { // Unclipped horizontal
-
- while (dp < ep) { // all lines
- lp = dp - w;
- do { // 1 line
- dp -= *sp++; // transparent
- pp = dp + 1 - *sp++; // opaque
- while (dp > pp) {
- *dp-- = pixels[*sp++];
- *dp-- = pixels[*sp++];
- }
- if (dp >= pp) {
- *dp-- = pixels[*sp++];
- }
- } while (dp > lp);
- dp += da;
- }
-
- } else { // Clip horizontal
-
- da -= sw - w - ox;
- while (dp < ep) { // all lines
- lp = dp - w;
- //
- // Clip right side
- //
- pp = dp + sw - w - ox;
- for (;;) {
- pp -= *sp++; // transparent
- if (pp <= dp) {
- dp = pp;
- goto middle_trans;
- }
- pp -= *sp; // opaque
- if (pp <= dp) {
- sp += *sp - (dp - pp) + 1;
- goto middle_pixel;
- }
- sp += *sp + 1;
- }
-
- //
- // Draw middle
- //
- for (;;) {
- dp -= *sp++; // transparent
-middle_trans:
- if (dp <= lp) {
- lp -= ox;
- goto right_trans;
- }
- pp = dp - *sp++; // opaque
-middle_pixel:
- if (pp > lp) {
- while (dp > pp) {
- *dp-- = pixels[*sp++];
- }
- continue;
- }
- while (dp > lp) {
- *dp-- = pixels[*sp++];
- }
- sp += dp - pp;
- dp = pp;
- break;
- }
-
- //
- // Clip left side
- //
- lp -= ox;
- while (dp > lp) {
- dp -= *sp++; // transparent
-right_trans:
- dp -= *sp; // opaque
- sp += *sp + 1;
- }
- dp += da;
-
- }
- }
-}
-
-/**
-** Draw 8bit graphic object clipped and flipped in X direction
-** into 32bit framebuffer.
-**
-** @param sprite pointer to object
-** @param frame number of frame (object index)
-** @param x x coordinate on the screen
-** @param y y coordinate on the screen
-*/
-local void VideoDraw8to32ClipXTrans50(const Graphic* sprite, unsigned frame
- , int x, int y)
-{
- int ex;
- int ox;
- int oy;
- int w;
- int h;
- const unsigned char* sp;
- int sw;
- VMemType32* dp;
- const VMemType32* lp;
- const VMemType32* ep;
- VMemType32* pp;
- const VMemType32* pixels;
- int da;
-
- //
- // reduce to visible range
- //
- sw = w = sprite->Width;
- h = sprite->Height;
- CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
-
- //
- // Draw the clipped sprite
- //
- pixels = (VMemType32*)sprite->Pixels;
- sp = ((unsigned char**)sprite->Frames)[frame];
-
- //
- // Skip top lines
- //
- while (oy--) {
- da = 0;
- do {
- da += *sp++; // transparent
- da += *sp; // opaque
- sp += *sp + 1;
- } while (da < sw);
- }
-
- da = VideoWidth + sw;
- dp = VideoMemory32 + x + y * VideoWidth + w - 1;
- ep = dp + VideoWidth * h;
-
- if (w == sw) { // Unclipped horizontal
-
- while (dp < ep) { // all lines
- lp = dp - w;
- do { // 1 line
- dp -= *sp++; // transparent
- pp = dp + 1 - *sp++; // opaque
- while (dp > pp) {
- *dp-- = ((*dp >> 1) & 0x7F7F7F7F) + ((pixels[*sp++] >> 1) &
0x7F7F7F7F);
- *dp-- = ((*dp >> 1) & 0x7F7F7F7F) + ((pixels[*sp++] >> 1) &
0x7F7F7F7F);
- }
- if (dp >= pp) {
- *dp-- = pixels[*sp++];
- }
- } while (dp > lp);
- dp += da;
- }
-
- } else { // Clip horizontal
-
- da -= ex;
- while (dp < ep) { // all lines
- lp = dp - w;
- //
- // Clip right side
- //
- pp = dp + ex;
- for (;;) {
- pp -= *sp++; // transparent
- if (pp <= dp) {
- dp = pp;
- goto middle_trans;
- }
- pp -= *sp; // opaque
- if (pp <= dp) {
- sp += *sp - (dp - pp) + 1;
- goto middle_pixel;
- }
- sp += *sp + 1;
- }
-
- //
- // Draw middle
- //
- for (;;) {
- dp -= *sp++; // transparent
-middle_trans:
- if (dp <= lp) {
- lp -= ox;
- goto right_trans;
- }
- pp = dp - *sp++; // opaque
-middle_pixel:
- if (pp > lp) {
- while (dp > pp) {
- *dp-- = ((*dp >> 1) & 0x7F7F7F7F) + ((pixels[*sp++] >>
1) & 0x7F7F7F7F);
- }
- continue;
- }
- while (dp > lp) {
- *dp-- = ((*dp >> 1) & 0x7F7F7F7F) + ((pixels[*sp++] >> 1) &
0x7F7F7F7F);
- }
- sp += dp - pp;
- dp = pp;
- break;
- }
-
- //
- // Clip left side
- //
- lp -= ox;
- while (dp > lp) {
- dp -= *sp++; // transparent
-right_trans:
- dp -= *sp; // opaque
- sp += *sp + 1;
- }
- dp += da;
-
- }
- }
-}
-// End Of 50% Transparent functions
-
-/**
-** Init sprite
-*/
-global void InitSprite(void)
-{
-#ifdef USE_SDL_SURFACE
-
-#else
-
-#ifdef USE_OPENGL
- GraphicSprite8Type.Draw = VideoDrawOpenGL;
- GraphicSprite8Type.DrawClip = VideoDrawClipOpenGL;
- GraphicSprite8Type.DrawShadowClip = VideoDraw8to32ShadowClip;
- GraphicSprite8Type.DrawX = VideoDrawXOpenGL;
- GraphicSprite8Type.DrawClipX = VideoDrawClipXOpenGL;
- GraphicSprite8Type.DrawShadowClipX = VideoDraw8to32ShadowClipX;
- VideoDrawRawClip = VideoDrawRaw32Clip;
-#else
-
- switch (VideoBpp) {
- case 8:
- GraphicSprite8Type.Draw = VideoDraw8to8;
- GraphicSprite8Type.DrawClip = VideoDraw8to8Clip;
- GraphicSprite8Type.DrawShadowClip = VideoDraw8to8ShadowClip;
- GraphicSprite8Type.DrawX = VideoDraw8to8X;
- GraphicSprite8Type.DrawClipX = VideoDraw8to8ClipX;
-//50% Transparent functions
- //GraphicSprite8Type.DrawTrans50 = VideoDraw8to8Trans50;
- GraphicSprite8Type.DrawClipTrans50 = VideoDraw8to8ClipTrans50;
- GraphicSprite8Type.DrawXTrans50 = VideoDraw8to8XTrans50;
- GraphicSprite8Type.DrawClipXTrans50 = VideoDraw8to8ClipXTrans50;
-
- GraphicSprite8Type.DrawShadowClip = VideoDraw8to8ShadowClip;
- GraphicSprite8Type.DrawShadowClipX = VideoDraw8to8ShadowClipX;
- VideoDrawRawClip = VideoDrawRaw8Clip;
- break;
-
- case 15:
- case 16:
- GraphicSprite8Type.Draw = VideoDraw8to16;
- GraphicSprite8Type.DrawClip = VideoDraw8to16Clip;
- GraphicSprite8Type.DrawShadowClip = VideoDraw8to16ShadowClip;
- GraphicSprite8Type.DrawX = VideoDraw8to16X;
- GraphicSprite8Type.DrawClipX = VideoDraw8to16ClipX;
-//50% Transparent functions
- //GraphicSprite8Type.DrawTrans50 = VideoDraw8to16Trans50;
- GraphicSprite8Type.DrawClipTrans50 = VideoDraw8to16ClipTrans50;
- GraphicSprite8Type.DrawXTrans50 = VideoDraw8to16XTrans50;
- GraphicSprite8Type.DrawClipXTrans50 = VideoDraw8to16ClipXTrans50;
-
- GraphicSprite8Type.DrawShadowClip = VideoDraw8to16ShadowClip;
- GraphicSprite8Type.DrawShadowClipX = VideoDraw8to16ShadowClipX;
- VideoDrawRawClip = VideoDrawRaw16Clip;
- break;
-
- case 24:
- GraphicSprite8Type.Draw = VideoDraw8to24;
- GraphicSprite8Type.DrawClip = VideoDraw8to24Clip;
- GraphicSprite8Type.DrawShadowClip = VideoDraw8to24ShadowClip;
- GraphicSprite8Type.DrawX = VideoDraw8to24X;
- GraphicSprite8Type.DrawClipX = VideoDraw8to24ClipX;
- //50% Transparent functions
- //GraphicSprite8Type.DrawTrans50 = VideoDraw8to24Trans50;
- GraphicSprite8Type.DrawClipTrans50 = VideoDraw8to24ClipTrans50;
- GraphicSprite8Type.DrawXTrans50 = VideoDraw8to24XTrans50;
- GraphicSprite8Type.DrawClipXTrans50 = VideoDraw8to24ClipXTrans50;
-
- GraphicSprite8Type.DrawShadowClip = VideoDraw8to24ShadowClip;
- GraphicSprite8Type.DrawShadowClipX = VideoDraw8to24ShadowClipX;
- VideoDrawRawClip = VideoDrawRaw24Clip;
- break;
-
- case 32:
- GraphicSprite8Type.Draw = VideoDraw8to32;
- GraphicSprite8Type.DrawClip = VideoDraw8to32Clip;
- GraphicSprite8Type.DrawShadowClip = VideoDraw8to32ShadowClip;
- GraphicSprite8Type.DrawX = VideoDraw8to32X;
- GraphicSprite8Type.DrawClipX = VideoDraw8to32ClipX;
- //50% Transparent functions
- //GraphicSprite8Type.DrawTrans50 = VideoDraw8to32Trans50;
- GraphicSprite8Type.DrawClipTrans50 = VideoDraw8to32ClipTrans50;
- GraphicSprite8Type.DrawXTrans50 = VideoDraw8to32XTrans50;
- GraphicSprite8Type.DrawClipXTrans50 = VideoDraw8to32ClipXTrans50;
-
- GraphicSprite8Type.DrawShadowClipX = VideoDraw8to32ShadowClip;
- GraphicSprite8Type.DrawShadowClipX = VideoDraw8to32ShadowClipX;
- VideoDrawRawClip = VideoDrawRaw32Clip;
- break;
-
- default:
- DebugLevel0Fn("Unsupported %d bpp\n" _C_ VideoBpp);
- abort();
- }
-#endif
+ default:
+ DebugLevel0Fn("Unsupported %d bpp\n" _C_ VideoBpp);
+ abort();
+ }
+#endif
GraphicSprite8Type.Free = FreeSprite8;
#endif
}
-
-
-
//@}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus src/ui/ccl_ui.c src/ui/menu_proc.c sr...,
address@hidden <=