/[enigma]/enigma/levels/ant04.lua
ViewVC logotype

Diff of /enigma/levels/ant04.lua

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

revision 1.1 by dheck, Sun Dec 29 19:09:42 2002 UTC revision 1.2 by ant_39, Fri Jan 3 23:22:17 2003 UTC
# Line 2  Line 2 
2  -- (c) 2002 Petr Machata/ant_39  -- (c) 2002 Petr Machata/ant_39
3  -- Licensed under GPL v2.0 or above  -- Licensed under GPL v2.0 or above
4    
5  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  dofile(enigma.FindDataFile("levels/ant.lua"))
6    
7  function cell_item(it)  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    local n_it = {}  
    n_it.face = (it.face or "")  
    n_it.attr = (it.attr or {})  
    return n_it  
 end  
   
 function cell(structure)  
    local cell = {}  
   
    cell.tag = (structure.tag or "?")  
    cell.setactor = structure.setactor  
    cell.floor = cell_item(structure.floor or {})  
    cell.stone = cell_item(structure.stone or {})  
    cell.item =  cell_item(structure.item or {})  
   
    return function(x, y)  
              --call parents  
              if (%structure.parent) then  
                 for i,parfun in %structure.parent do  
                    parfun(x,y)  
                 end  
              end  
   
              --map elements  
              if (%structure.stone) then set_stone(%cell.stone.face, x, y, %cell.stone.attr) end  
              if (%structure.floor) then set_floor(%cell.floor.face, x, y, %cell.floor.attr) end  
              if (%structure.item) then  
                 if (%structure.item.actor) then  
                    set_actor(%cell.item.face, x+0.5, y+0.5, %cell.item.attr)  
                 else  
                    set_item(%cell.item.face, x, y, %cell.item.attr)  
                 end  
              end  
           end  
 end  
8    
9  cells={}  cells={}
10  cells[" "]=cell{floor={face="fl-sand"}}  cells[" "]=cell{floor={face="fl-sand"}}
# Line 100  enigma1 = { Line 65  enigma1 = {
65     "########."     "########."
66  }  }
67    
 function draw_map(x0, y0, map)  
 for y,str in map do  
    for x = 1,strlen(str) do  
       cell = strchar(strbyte(str,x))  
       cells[cell](y+y0-1, x+x0-1)  
    end  
 end  
   
 end  
   
68  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
69    
70  levelw = 20+19  levelw = 20+19
# Line 117  levelh = 13 Line 72  levelh = 13
72    
73  create_world(levelw, levelh)  create_world(levelw, levelh)
74  fill_floor("fl-abyss",   0, 0, level_width, level_height)  fill_floor("fl-abyss",   0, 0, level_width, level_height)
75  draw_map(2, 0, enigma1)  draw_map(2, 0, enigma1, TRANSPOSE_MAP)
76  oxyd_shuffle()  oxyd_shuffle()
77  display.SetFollowMode(display.FOLLOW_SCROLLING)  display.SetFollowMode(display.FOLLOW_SCROLLING)

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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