mail[Wesnoth-commits] r20501 - in /trunk/data/core: macros/interface-utils.cfg units.cfg units/fake/ units/fake/Fog_Clearer.cfg


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by lari . nieminen on September 17, 2007 - 19:01:
Author: zookeeper
Date: Mon Sep 17 19:00:56 2007
New Revision: 20501

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20501&view=rev
Log:
Add a CLEAR_FOG macro for temporarily (for the duration of an event) clearing 
fog from specific locations. Requires a helper unit, so also added a separate 
dir for these kind of fake units in the units directory.

Added:
    trunk/data/core/units/fake/
    trunk/data/core/units/fake/Fog_Clearer.cfg
Modified:
    trunk/data/core/macros/interface-utils.cfg
    trunk/data/core/units.cfg

Modified: trunk/data/core/macros/interface-utils.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/macros/interface-utils.cfg?rev=20501&r1=20500&r2=20501&view=diff
==============================================================================
--- trunk/data/core/macros/interface-utils.cfg (original)
+++ trunk/data/core/macros/interface-utils.cfg Mon Sep 17 19:00:56 2007
@@ -200,6 +200,71 @@
         image={IMAGE}
     [/item]
     [redraw][/redraw]
+#enddef
+
+#define CLEAR_FOG SIDE X Y RADIUS
+    # Clears fog in a specific area for the given side. This is to be used 
only
+    # for the duration of an event: always use {UNCLEAR_FOG} (below) before 
the
+    # event exits, or otherwise you'll be left with fake fog clearer units on
+    # the map.
+    [if]
+        [have_unit]
+            type=Fog Clearer
+        [/have_unit]
+
+        [then]
+            [set_variable]
+                name=fog_clearer_i
+                add=1
+            [/set_variable]
+        [/then]
+
+        [else]
+            [set_variable]
+                name=fog_clearer_i
+                value=1
+            [/set_variable]
+        [/else]
+    [/if]
+
+    [unit]
+        side={SIDE}
+        type=Fog Clearer
+        description=fog_clearer_$fog_clearer_i
+        x,y={X},{Y}
+        max_moves={RADIUS}
+    [/unit]
+
+    [store_unit]
+        [filter]
+            description=fog_clearer_$fog_clearer_i
+        [/filter]
+
+        kill=no
+        variable=new_fog_clearer
+    [/store_unit]
+
+    [hide_unit]
+        x,y=$new_fog_clearer.x,$new_fog_clearer.y
+    [/hide_unit]
+
+    [redraw]
+        side={SIDE}
+    [/redraw]
+#enddef
+
+#define UNCLEAR_FOG
+    # Restores fog that was temporarily cleared (check CLEAR_FOG above). Only
+    # one UNCLEAR_FOG is required no matter how many times CLEAR_FOG was 
used.
+    [kill]
+        type=Fog Clearer
+        animate=no
+        fire_event=no
+    [/kill]
+
+    [clear_variable]
+        name=fog_clearer_i
+    [/clear_variable]
 #enddef
 
 #define SET_LABEL X Y TEXT

Modified: trunk/data/core/units.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/units.cfg?rev=20501&r1=20500&r2=20501&view=diff
==============================================================================
--- trunk/data/core/units.cfg (original)
+++ trunk/data/core/units.cfg Mon Sep 17 19:00:56 2007
@@ -25,6 +25,7 @@
     {core/units/trolls/}
     {core/units/undead/}
     {core/units/wose/}
+    {core/units/fake/}
     {~units}
 
     #       *   R A C I A L   T R A I T S   A N D   N A M E S   *

Added: trunk/data/core/units/fake/Fog_Clearer.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/units/fake/Fog_Clearer.cfg?rev=20501&view=auto
==============================================================================
--- trunk/data/core/units/fake/Fog_Clearer.cfg (added)
+++ trunk/data/core/units/fake/Fog_Clearer.cfg Mon Sep 17 19:00:56 2007
@@ -1,0 +1,21 @@
+#textdomain wesnoth-units
+
+# Use this unit to temporarily clear fog around a particular location.
+
+[unit]
+    id=Fog Clearer
+    name=""
+    race=monster
+    image="misc/blank-hex.png"
+    hitpoints=1
+    movement_type=fly
+    movement=1
+    experience=1
+    level=1
+    alignment=neutral
+    advanceto=null
+    cost=1
+    usage=scout
+    unit_description=""
+    hide_help=true
+[/unit]




Related Messages


Powered by MHonArc, Updated Mon Sep 17 21:40:36 2007