/[enigma]/enigma/data/levels/ant05.lua
ViewVC logotype

Diff of /enigma/data/levels/ant05.lua

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by ant_39, Fri Feb 21 18:01:59 2003 UTC revision 1.4 by reallysoft, Mon Aug 18 11:11:28 2003 UTC
# Line 28  mags = {}; function set_magic_stone(x, y Line 28  mags = {}; function set_magic_stone(x, y
28  --table to translate current command to stone properties  --table to translate current command to stone properties
29  --x, y is current direction indicator position - floor  --x, y is current direction indicator position - floor
30  --face is face of stone in buffer  --face is face of stone in buffer
31  --params are parameters of buffer stone  --params is the direction of the bolder (ignored otherwise)
32  function new_command(flx0, fly0, face0, params0)  function new_command(flx0, fly0, face0, params0)
33     ret = {}     ret = {}
34     ret.face = face0     ret.face = face0
# Line 41  end Line 41  end
41  buftable = {}  buftable = {}
42    
43  --command selection via the trigger "gamepad"  --command selection via the trigger "gamepad"
44  function setcommand(newcmd)  function setcommand(newcmd)
45     local flx0, fly0 = buftable[newcmd].x, buftable[newcmd].y     local flx0, fly0 = buftable[newcmd].x, buftable[newcmd].y
46     local clx0, cly0 = buftable[command].x, buftable[command].y     local clx0, cly0 = buftable[command].x, buftable[command].y
47    
# Line 65  function magic_stone(face) Line 65  function magic_stone(face)
65  end  end
66    
67  function draw_magic()    magic_stone("st-magic") end  function draw_magic()    magic_stone("st-magic") end
68  function erase_magic()   magic_stone("st-rock1") end  function erase_magic()   magic_stone("st-rock1") end
69  function invalid_magic() magic_stone("st-death") end  function invalid_magic() magic_stone("st-death") end
70    
71  --bufferworks  --bufferworks
# Line 92  function draw_buffer(buf, tab) Line 92  function draw_buffer(buf, tab)
92        local tab = tab[cmd]        local tab = tab[cmd]
93    
94        enigma.KillStone(x, y)        enigma.KillStone(x, y)
95        set_stone(tab.face, x, y, tab.par)        set_stone(tab.face, x, y, {direction=tab.par})
96     end     end
97  end  end
98    
# Line 109  end Line 109  end
109    
110  function buffer_push_command(buf)  function buffer_push_command(buf)
111     local i = buffer_generic_test(buf, first_free_element)     local i = buffer_generic_test(buf, first_free_element)
112      
113     if (i) then     if (i) then
114        buf[i].command = command        buf[i].command = command
115     end     end
# Line 120  function buffer_pop_command(buf) Line 120  function buffer_pop_command(buf)
120    
121     if (i) then     if (i) then
122        local ret = buf[i].command        local ret = buf[i].command
123        buf[i].command = command_clean        buf[i].command = command_clean
124        return ret        return ret
125     else     else
126        return nil        return nil
# Line 142  buffer_items = buffer_create() Line 142  buffer_items = buffer_create()
142    
143  function addcommand()  function addcommand()
144     if (not(ingame)) then     if (not(ingame)) then
145        buffer_push_command(buffer_items)        buffer_push_command(buffer_items)
146        draw_buffer(buffer_items, buftable)        draw_buffer(buffer_items, buftable)
147        commandclean()        commandclean()
148     end     end
# Line 165  function boldercommand(startcommand) Line 165  function boldercommand(startcommand)
165        local cmd = buffer_pop_command(buffer_items)        local cmd = buffer_pop_command(buffer_items)
166    
167        if (cmd) then        if (cmd) then
168           set_attribs(enigma.GetNamedObject("bolder1"), buftable[cmd].par)           enigma.SendMessage(enigma.GetNamedObject("bolder1"), "direction", buftable[cmd].par)
169           draw_buffer(buffer_items, buftable)           draw_buffer(buffer_items, buftable)
170           draw_magic()           draw_magic()
171        else        else
172           invalid_magic()           invalid_magic()
173        end        end
174     end     end
175    
# Line 179  end Line 179  end
179  function startbolder()  function startbolder()
180     if (not(ingame)) then     if (not(ingame)) then
181        ingame = 1        ingame = 1
182        boldercommand(1)        boldercommand(1)
183     end     end
184  end  end
185    
# Line 228  oxyd_default_flavor = "a" Line 228  oxyd_default_flavor = "a"
228  set_default_parent(cells[" "])  set_default_parent(cells[" "])
229  create_world_by_map(level)  create_world_by_map(level)
230    
231  buftable [command_clean] = new_command(nil,  nil,  "st-grate1", {})  buftable [command_clean] = new_command(nil,  nil,  "st-grate1", NODIR)
232  buftable [command_north] = new_command(cent.x, cent.y-2, "st-bolder", {direction=NORTH})  buftable [command_north] = new_command(cent.x, cent.y-2, "st-bolder", NORTH)
233  buftable [command_south] = new_command(cent.x, cent.y+2, "st-bolder", {direction=SOUTH})  buftable [command_south] = new_command(cent.x, cent.y+2, "st-bolder", SOUTH)
234  buftable [command_east]  = new_command(cent.x+2, cent.y, "st-bolder", {direction=EAST })  buftable [command_east]  = new_command(cent.x+2, cent.y, "st-bolder", EAST )
235  buftable [command_west]  = new_command(cent.x-2, cent.y, "st-bolder", {direction=WEST })  buftable [command_west]  = new_command(cent.x-2, cent.y, "st-bolder", WEST )
236    
237  clearbuffer()  clearbuffer()
238  oxyd_shuffle()  oxyd_shuffle()

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26