home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 August / GSSH0804.iso / Geschicklichkeit / Enigma / Enigma-081.exe / data / models-2d.lua < prev    next >
Text File  |  2003-10-11  |  41KB  |  1,304 lines

  1. ------------------------------------------------------------------------
  2. -- Copyright (C) 2002,2003 Daniel Heck
  3. --
  4. -- This program is free software; you can redistribute it and/or
  5. -- modify it under the terms of the GNU General Public License
  6. -- as published by the Free Software Foundation; either version 2
  7. -- of the License, or (at your option) any later version.
  8. --
  9. -- This program is distributed in the hope that it will be useful,
  10. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. -- GNU General Public License for more details.
  13. --
  14. -- You should have received a copy of the GNU General Public License along
  15. -- with this program; if not, write to the Free Software Foundation, Inc.,
  16. -- 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  17. --
  18. -- $Id: models-2d.lua,v 1.109.2.8 2003/10/11 13:45:26 dheck Exp $
  19. ------------------------------------------------------------------------
  20.  
  21. -- This file defines the models used in Enigma.
  22.  
  23. dofile(FindDataFile("models.lua"))
  24.  
  25. def_image("invisible")
  26. def_image("dummy")
  27.  
  28. TRUE, FALSE = 1, 0
  29.  
  30. --------------------------------------------------------------------
  31. --                           ACTOR MODELS                         --
  32. --------------------------------------------------------------------
  33. Progress(0)
  34.  
  35. ------------------
  36. -- Spinning top --
  37. ------------------
  38. do
  39.     local img=def_subimages("ac-top",
  40.                             {h=9, imgw=32, imgh=32, xoff=-16, yoff=-16})
  41.     def_image("sh-top", {xoff=-10,yoff=-10})
  42.  
  43.     frames={}
  44.     for i=1,9 do
  45.         def_shmodel("actop"..i, img[i], "sh-top")
  46.         tinsert(frames, "actop"..i)
  47.     end
  48.     def_anim("ac-top", buildframes(frames, 25), TRUE)
  49. end
  50.  
  51. -----------
  52. -- Rotor --
  53. -----------
  54. do
  55.     local fg=def_subimages("ac-rotor",
  56.                             {h=9, imgw=32, imgh=32, xoff=-16, yoff=-16})
  57.     local bg=def_subimages("sh-rotor",
  58.                             {h=9, imgw=32, imgh=32, xoff=-10, yoff=-10})
  59.  
  60.     frames={}
  61.     for i=1,9 do
  62.         def_shmodel("ac-rotor"..i, fg[i], bg[i])
  63.         tinsert(frames, "ac-rotor"..i)
  64.     end
  65.     def_anim("ac-rotor", buildframes(frames, 30), TRUE)
  66. end
  67.  
  68. -----------
  69. -- Horse --
  70. -----------
  71. do
  72.     def_image("ac-horse#", {filename="ac-horse", xoff=-15, yoff=-15})
  73.     def_image("sh-horse", {xoff=-10, yoff=-10})
  74.     def_shmodel("ac-horse", "ac-horse#", "sh-horse")
  75. end
  76.  
  77. ----------------------
  78. -- Small white ball --
  79. ----------------------
  80. do
  81.     local fg,img
  82.  
  83.     -- Normal
  84.     def_image("sh-whiteball-small", {xoff=-4, yoff=-4})
  85.     fg=def_image(nil, {filename="ac-whiteball-small", xoff=-6, yoff=-6})
  86.     def_shmodel("ac-whiteball-small", fg, "sh-whiteball-small")
  87.     def_alias ("ac-whiteball-small-shine", "ac-whiteball-small")
  88.  
  89.     -- Falling
  90.     img=def_subimages("ac-whiteball-small-fall",
  91.                       {modelname="ac-wbs-f",h=5,imgw=12,imgh=12,
  92.                           xoff=-6,yoff=-6})
  93.     tinsert(img, "invisible")
  94.     def_anim("ac-whiteball-small-fall", composeframes(img,{70,65,60,55,50,30}))
  95.     def_alias("ac-whiteball-small-fallen", "invisible")
  96.  
  97.     -- Appearing / disappearing
  98.     def_anim("ac-whiteball-small-appear", reverseframes(buildframes(img, 25)))
  99.     def_anim("ac-whiteball-small-disappear", buildframes(img, 25))
  100.  
  101.     -- Shattering
  102.     img=def_subimages("ac-whiteball-small-shatter",
  103.                       {h=5, imgw=20, imgh=20, xoff=-10, yoff=-10})
  104.     def_anim("ac-whiteball-small-shatter", buildframes(img, 60))
  105.     def_image("ac-whiteball-small-shattered", {xoff=-8, yoff=-9})
  106. end
  107.  
  108. def_alias("ac-killerball", "ac-whiteball-small")
  109.  
  110. ----------------
  111. -- Black ball --
  112. ----------------
  113. do
  114.     local img,f,sh
  115.  
  116.     -- Normal
  117.     def_image("sh-blackball", {xoff=-6, yoff=-6})
  118.     def_subimages("ac-blackball", {h=2, xoff=-9, yoff=-9, imgw=19, imgh=19})
  119. --    def_image("fg-bb", {filename="ac-blackball", xoff=-9, yoff=-9})
  120.     def_shmodel("ac-blackball", "ac-blackball1", "sh-blackball")
  121.     def_shmodel("ac-blackball-shine", "ac-blackball2", "sh-blackball")
  122.  
  123.     -- Falling
  124.     img=def_subimages("ac-blackball-fall",{h=10, imgw=24, imgh=24, xoff=-12, yoff=-12})
  125.     tinsert(img, "invisible")
  126.     f=composeframes(img,{70,65,60,55,50,50,50,50,50,50,50})
  127.     def_anim("ac-blackball-fall", f)
  128.     def_alias("ac-blackball-fallen", "invisible")
  129.  
  130.     -- Appearing / disappearing
  131.     def_anim("ac-blackball-appear", reverseframes(buildframes(img, 25)))
  132.     def_anim("ac-blackball-disappear", buildframes(img, 25))
  133.  
  134.     -- Sinking
  135.     img=def_subimages("ac-blackball-sinkdown",{h=7,imgw=19,imgh=19,xoff=-9,yoff=-9})
  136.     sh =def_subimages("sh-blackball-sinkdown",{h=7,imgw=19,imgh=19,xoff=-6,yoff=-6})
  137.     for i=1,getn(img) do
  138.         def_shmodel("ac-blackball-sink"..(i-1), img[i], sh[i])
  139.     end
  140.     def_alias("ac-blackball-sunk", "invisible")
  141.  
  142.     img=def_subimages("ac-drowned",{h=5,imgw=19,imgh=19,xoff=-9,yoff=-9});
  143.     def_anim("ac-drowned",buildframes(img,80))
  144.  
  145.     -- Shattering
  146.     img=def_subimages("ac-blackball-shatter",
  147.                       {h=5, imgw=40, imgh=40, xoff=-20, yoff=-20})
  148.     def_anim("ac-blackball-shatter", buildframes(img, 60))
  149.  
  150.     def_image("ac-blackball-shattered", {xoff=-20, yoff=-20})
  151. end
  152.  
  153. ----------------
  154. -- White ball --
  155. ----------------
  156. do
  157.     local img,f
  158.  
  159.     -- Normal
  160.     def_image("sh-whiteball", {xoff=-6, yoff=-6})
  161.     def_image("fg-wb", {filename="ac-whiteball", xoff=-9, yoff=-9})
  162.     def_shmodel("ac-whiteball", "fg-wb", "sh-whiteball")
  163.     def_alias("ac-whiteball-shine", "ac-whiteball")
  164.  
  165.     -- Falling
  166.     img=def_subimages("ac-whiteball-fall",{h=10, imgw=24, imgh=24, xoff=-12, yoff=-12})
  167.     tinsert(img, "invisible")
  168.     f=composeframes(img,{70,65,60,55,50,50,50,50,50,50,50})
  169.     def_anim("ac-whiteball-fall", f)
  170.     def_alias("ac-whiteball-fallen", "invisible")
  171.  
  172.     -- Appearing / disappearing
  173.     def_anim("ac-whiteball-appear", reverseframes(buildframes(img, 25)))
  174.     def_anim("ac-whiteball-disappear", buildframes(img, 25))
  175.  
  176.     -- Sinking
  177.     img=def_subimages("ac-whiteball-sinkdown",{h=7,imgw=19,imgh=19,xoff=-9,yoff=-9})
  178.     sh =def_subimages("sh-blackball-sinkdown",{h=7,imgw=19,imgh=19,xoff=-6,yoff=-6})
  179.     for i=1,getn(img) do
  180.         def_shmodel("ac-whiteball-sink"..(i-1), img[i], sh[i])
  181.     end
  182.     def_alias("ac-whiteball-sunk", "invisible")
  183.  
  184. --    img=def_subimages("ac-drowned",{h=5,imgw=19,imgh=19,xoff=-9,yoff=-9});
  185. --    def_anim("ac-drowned",buildframes(img,80))
  186.  
  187.     -- Shattering
  188.     img=def_subimages("ac-whiteball-shatter",
  189.                       {h=5, imgw=40, imgh=40, xoff=-20, yoff=-20})
  190.     def_anim("ac-whiteball-shatter", buildframes(img, 60))
  191.  
  192.     def_alias("ac-whiteball-shattered", img[5])
  193. end
  194.  
  195. -- Jumping normal balls --
  196. do
  197.     namelist=def_subimages("ac-blackball-jump", {h=4, imgw=32, imgh=32, xoff=-16, yoff=-16})
  198.     shadows=def_subimages("sh-blackball-jump", {h=4, imgw=32, imgh=32, xoff=-10, yoff=-10})
  199.     frames={}
  200.     for i=1,4 do
  201.         def_shmodel("bb-jump"..i, namelist[i], shadows[i])
  202.         tinsert(frames, "bb-jump"..i)
  203.     end
  204.     def_anim("ac-blackball-jump", pingpong(buildframes(frames, 70)))
  205.  
  206.     namelist=def_subimages("ac-whiteball-jump", {h=4, imgw=32, imgh=32, xoff=-16, yoff=-16})
  207.     frames={}
  208.     for i=1,4 do
  209.         def_shmodel("wb-jump"..i, namelist[i], shadows[i])
  210.         tinsert(frames, "wb-jump"..i)
  211.     end
  212.     def_anim("ac-whiteball-jump", pingpong(buildframes(frames, 70)))
  213. end
  214.  
  215. ---------
  216. -- Bug --
  217. ---------
  218. do
  219.     def_image("ac-bug#", {filename="ac-bug", xoff=-6, yoff=-6})
  220.     def_shmodel("ac-bug", "ac-bug#", "sh-whiteball-small")
  221. end
  222.  
  223. -- Marbles in inventory  --
  224. def_image("inv-blackball")
  225. def_image("inv-whiteball")
  226.  
  227.  
  228. ------------------
  229. -- Floor models --
  230. ------------------
  231. Progress(10)
  232.  
  233. function def_floors(floorlist)
  234.     for i,name in floorlist do
  235.     def_image(name)
  236.     end
  237. end
  238.  
  239. function def_randfloor(name, imagelist)
  240.     def_floors(imagelist)
  241.     display.DefineRandModel(name, getn(imagelist), imagelist)
  242. end
  243.  
  244. -- _si for _subimage
  245. function def_randfloor_si(name, height, width)
  246.     imagelist=def_subimages(name, {h=height, w=width})
  247.     display.DefineRandModel(name, getn(imagelist), imagelist)
  248. end
  249.  
  250. --if options.WizardMode > 0 then
  251. --    def_subimages("fl-gradient-wiz", {modelname="fl-gradient",w=6, h=4})
  252. --else
  253. def_subimages("fl-gradient2", {w=6, h=4, modelname="fl-gradient"})
  254. --end
  255.  
  256. def_randfloor("fl-rock", {"fl-rock1", "fl-rock2"})
  257. def_floors{"fl-abyss"}
  258. def_alias("fl-abyss_fake", "fl-abyss")
  259. def_floors{"fl-dunes", "fl-sand", "fl-bluegreen", "fl-bluegreenx"}
  260. def_floors{"fl-inverse", "fl-inverse2", "fl-white", "fl-black", "fl-acwhite", "fl-acblack"}
  261. def_floors{"fl-springboard"}
  262. def_image("fl-normal")
  263. def_randfloor_si("fl-hay", 4)
  264. def_floors{"fl-floor_001"}
  265. def_floors{"fl-ice_001"}
  266. def_floors{"fl-stone"}
  267. def_alias("fl-normal_x", "fl-normal")
  268. def_floors{"fl-dummy"}
  269. def_floors{"fl-light"}
  270. def_floors{"fl-trigger"}
  271. def_randfloor_si("fl-concrete", 4)
  272. def_randfloor_si("fl-gravel", 4)
  273. def_randfloor_si("fl-bumps", 2,2)
  274. def_randfloor_si("fl-mortar", 2, 2)
  275.  
  276. def_randfloor_si("fl-brick", 3)
  277. def_randfloor_si("fl-space", 3,2)
  278. def_randfloor_si("fl-rough", 5)
  279. def_randfloor("fl-rough_medium", {"fl-rough5", "fl-rough1", "fl-rough2", "fl-rough3", "fl-rough4"})
  280. def_randfloor("fl-rough_slow", {"fl-rough5", "fl-rough1", "fl-rough2", "fl-rough3", "fl-rough4"})
  281. def_randfloor_si("fl-gray", 5)
  282. def_randfloor_si("fl-leaves", 3)
  283. def_randfloor_si("fl-metal", 6)
  284. def_randfloor_si("fl-plank", 4)
  285. def_randfloor_si("fl-water", 4)
  286. def_randfloor_si("fl-swamp", 4)
  287. def_randfloor_si("fl-woven", 5)
  288. def_randfloor_si("fl-marble", 4)
  289. def_randfloor_si("fl-wood", 4)
  290. def_subimages("fl-stwood", {h=2})
  291. def_randfloor_si("fl-stwood", 2)
  292. def_randfloor_si("fl-bluegray", 4)
  293. def_randfloor_si("fl-red", 4)
  294. def_randfloor_si("fl-rough-blue", 4)
  295. def_randfloor_si("fl-rough-red", 4)
  296. def_randfloor_si("fl-sahara", 4)
  297. def_randfloor_si("fl-tigris", 4)
  298. def_randfloor_si("fl-samba", 2)
  299. def_randfloor_si("fl-himalaya", 4)
  300.  
  301. --
  302. -- Bridges
  303. --
  304. def_image("fl-bridgea-open")
  305. def_image("fl-bridgea-closed")
  306. namelist=def_subimages("fl-bridgea", {h=10})
  307. frames = buildframes(namelist,70)
  308. def_anim("fl-bridgea-opening", reverseframes(frames))
  309. def_anim("fl-bridgea-closing", frames)
  310.  
  311.  
  312. def_image("fl-bridgex-open")
  313. def_image("fl-bridgex-closed")
  314. namelist=def_subimages("fl-bridgex", {h=9})
  315. frames = buildframes(namelist,70)
  316. def_anim("fl-bridgex-opening", frames)
  317. def_anim("fl-bridgex-closing", reverseframes(frames))
  318.  
  319.  
  320. def_image("fl-bridgey-open")
  321. def_image("fl-bridgey-closed")
  322. namelist=def_subimages("fl-bridgey", {h=9})
  323. frames = buildframes(namelist,70)
  324. def_anim("fl-bridgey-opening", frames)
  325. def_anim("fl-bridgey-closing", reverseframes(frames))
  326.  
  327. --------------------------------------------------------------------------
  328. --                           ITEM MODELS                                --
  329. --------------------------------------------------------------------------
  330. Progress(20)
  331.  
  332. do
  333.     def_image("items")
  334.     local itemtiles={
  335.         "it-brush", "it-floppy",
  336.         "it-document", "it-hammer",
  337.         "it-key", "it-spade",
  338.         "it-umbrella", "it-extralife",
  339.         "it-hill", "it-hollow", "it-tinyhill", "it-tinyhollow",
  340.         "it-laserh", "it-laserv", "it-laserhv",
  341.         "it-magicwand",
  342.         "it-spring1", "it-spring2",
  343.         "it-sword",
  344.         "it-surprise",
  345.         "it-trigger", "it-trigger1",
  346.         "it-yinyang", "it-yanying",
  347.         "it-puller-n", "it-puller-e", "it-puller-s", "it-puller-w",
  348.         "it-odometer",
  349.         "it-flagblack", "it-flagwhite",
  350.         "it-soother", "it-pin",
  351.     }
  352.     def_tiles("items", itemtiles)
  353. end
  354.  
  355. -- Puller animation
  356. do
  357.     local models={"it-puller-n", "it-puller-e", "it-puller-s", "it-puller-w"}
  358.     local frames=buildframes(models, 100)
  359.     def_anim("it-puller-active", repeatanim(frames, 4), FALSE)
  360. end
  361.  
  362. def_images{
  363.     "it-blackbomb",
  364.     "it-whitebomb",
  365.     "it-dynamite",
  366.     "it-dummy",
  367.     "it-blocker",
  368.     "it-coffee",
  369.     "it-wrench",
  370.     "it-cherry",
  371.     "it-glasses",
  372.     "it-glasses-broken",
  373.     "it-weight",
  374.     "it-landmine",
  375.     "it-hstrip",
  376.     "it-vstrip"
  377. }
  378.  
  379. def_alias("it-key_a", "it-key")
  380. def_alias("it-key_b", "it-key")
  381. def_alias("it-key_c", "it-key")
  382.  
  383. -- Seed --
  384. do
  385.     local n = def_subimages("it-seed", {h=5})
  386.     def_alias("it-seed", "it-seed1")
  387.     local f={
  388.         "it-seed1", "it-seed2", "it-seed1", "it-seed3", "it-seed1", "it-seed2",
  389.         "it-seed1", "it-seed4", "it-seed5", "it-seed4", "it-seed1",
  390.         "it-seed4", "it-seed5",
  391.     }
  392.     def_anim("it-seed-growing", buildframes(f, 120))
  393. end
  394.  
  395. -- Cracks --
  396. namelist=def_subimages("it-crack", {h=8})
  397. --frames=buildframes({"it-crack4", "it-crack6", "it-crack7", "it-crack8"},90)
  398. frames=buildframes(namelist,50)
  399. def_anim("it-debris", frames)
  400.  
  401. frames=buildframes({"it-crack4", "it-crack5"},120)
  402. def_anim("it-crack_anim1", frames)
  403.  
  404. frames=buildframes({"it-crack6", "it-crack7", "it-crack8"},120)
  405. def_anim("it-crack_anim2", frames)
  406.  
  407. -- Burning Floor --
  408. frames=buildframes(def_subimages("it-burnable_ignite", {h=8}), 100)
  409. def_anim("it-burnable_ignite", frames)
  410.  
  411. frames=buildframes(def_subimages("it-burnable_burning", {h=8}), 100)
  412. def_anim("it-burnable_burning", frames)
  413.  
  414. def_images{ "it-burnable_ash", "it-burnable_fireproof"}
  415.  
  416. do
  417.    local img = def_subimages("it-extinguisher", {h=3})
  418.    def_alias("it-extinguisher_full", img[1])
  419.    def_alias("it-extinguisher_medium", img[2])
  420.    def_alias("it-extinguisher_empty", img[3])
  421. end
  422.  
  423.  
  424. -- Magnet --
  425. def_image("it-magnet-off")
  426. frames=buildframes(def_subimages("it-magnet-on", {h=5}), 100)
  427. def_anim("it-magnet-on", frames, 1)
  428.  
  429. -- Wormhole --
  430. do
  431.     local f = buildframes(def_subimages("it-wormhole", {h=2}), 100)
  432.     def_anim("it-wormhole", f, TRUE)
  433. end
  434.  
  435. -- Vortex --
  436. do
  437.    local img = def_subimages("it-vortex", {h=4})
  438.    def_alias("it-vortex-open", img[1])
  439.    def_alias("it-vortex-closed", img[4])
  440.  
  441.    def_anim("it-vortex-opening", reverseframes(buildframes(img, 100)))
  442.    def_anim("it-vortex-closing", buildframes(img, 100))
  443. end
  444.  
  445. -- Coins --
  446. def_images{"it-coin1", "it-coin2", "it-coin4"}
  447.  
  448. -- Burning dynamite --
  449. dyn_frames=buildframes(def_subimages("it-dynamite-burning", {h=15}), 100)
  450. def_anim("it-dynamite-burning", dyn_frames) --repeat_frames(dyn_frames,3,2))
  451.  
  452. -- Burning bomb --
  453. frames=buildframes(def_subimages("it-blackbomb-burning", {h=9}), 100)
  454. def_anim("it-blackbomb-burning", frames) --repeat_frames(frames,3,2))
  455.  
  456. frames=buildframes(def_subimages("it-whitebomb-burning", {h=9}), 100)
  457. def_anim("it-whitebomb-burning", frames) --repeat_frames(frames,3,2))
  458.  
  459. -- Explosion --
  460. def_anim_images("expl", {{"expl", 50}})
  461.  
  462. -- Pipes --
  463. def_tiles("it-pipe", {
  464.               "it-pipe-e", "it-pipe-s", "it-pipe-es", "it-pipe-sw",
  465.               "it-pipe-h", "it-pipe-w", "it-pipe-n", "it-pipe-ne",
  466.               "it-pipe-wn", "it-pipe-v"})
  467.  
  468. -----------------
  469. -- Shogun dots --
  470. -----------------
  471.  
  472. NewAnim("it-shogun1", {img="it-shogun-small", h=3, speed=160, pingpong=1, loop=1})
  473. NewAnim("it-shogun2", {img="it-shogun-med",   h=3, speed=160, pingpong=1, loop=1})
  474. NewAnim("it-shogun3", {img="it-shogun-big",   h=3, speed=160, pingpong=1, loop=1})
  475.  
  476. -- Springboard --
  477. do
  478.     local r = Rect:new(0,0,32,32);
  479.     display.DefineSubImage("it-springboard", "it-springboard", 0, 0, r)
  480.     frames=buildframes(reverseframes(def_subimages("it-springboard", {h=2})),120)
  481.     def_anim("it-springboard_anim", frames)
  482.     r:delete();
  483. end
  484.  
  485. def_alias("it-bridge-oxyd", "invisible")
  486. def_alias("it-sensor", "invisible")
  487. def_alias("it-inversesensor", "invisible")
  488.  
  489. ------------------
  490. -- STONE MODELS --
  491. ------------------
  492. Progress(30)
  493.  
  494. -------------------
  495. -- Stone shadows --
  496. -------------------
  497. def_image("sh-solid")
  498. def_image("sh-round")
  499. def_image("sh-round2")
  500. def_image("sh-grate1")
  501. def_image("sh-grate2")
  502. def_image("sh-grate3")
  503. def_image("sh-glass")
  504. def_image("sh-white4")
  505. def_image("sh-puzzle1")
  506. def_image("sh-brake")
  507.  
  508. -- stone models
  509. def_stone("st-glass", "sh-glass");
  510.  
  511. -- Scissors
  512. do
  513.     def_stone("st-scissors")
  514.     local n=def_subimages("st-scissors-snip", {h=1})
  515.     def_anim("st-scissors-snip-anim", buildframes(n, 130))
  516.     def_solidstone("st-scissors-snip", "st-scissors-snip-anim")
  517. end
  518.  
  519. def_stone("st-rubberband")
  520.  
  521.  
  522. do
  523.     local tiles = {
  524.         "st-disco-light",
  525.         "st-disco-medium",
  526.         "st-disco-dark"
  527.     }
  528.     map_tiles({h=3},
  529.               function (i, rect)
  530.                   local model = %tiles[i]
  531.                   display.DefineSubImage(model, "st-disco", 0,0, rect)
  532.               end)
  533. end
  534.  
  535. -- other
  536.  
  537. do
  538.     def_image("stones")
  539.     local stonetiles={
  540.         "st-black1#",
  541.         "st-black2#",
  542.         "st-black3#",
  543.         "st-black4#",
  544.         "st-block#",
  545.         "st-idontknowwhattonameit2",
  546.         "st-beads#"
  547.     }
  548.     def_tiles("stones", stonetiles)
  549. end
  550.  
  551. def_alias("st-explosion", "expl")
  552.  
  553. def_stone2("st-black1")
  554. def_stone2("st-black2")
  555. def_stone2("st-black3")
  556. def_stone2("st-black4", "sh-white4")
  557. def_stone2("st-block")
  558. def_stone2("st-beads", "sh-glass")
  559.  
  560.  
  561. def_stone("st-glass1", "sh-glass")
  562. def_stone("st-glass2", "sh-glass")
  563. def_stone("st-glass3", "sh-glass")
  564. def_stone("st-rock1", "sh-round")
  565. def_stone("st-rock2")
  566. def_stone("st-rock3")
  567. def_stone("st-rock4")
  568. def_stone("st-rock5")
  569. def_stone("st-rock6")
  570. def_stone("st-rock7")
  571. def_stone("st-rock8", "sh-round")
  572. def_stone("st-brownie", "sh-round")
  573. def_stone("st-stone1")
  574. def_stone("st-stone2")
  575.  
  576. def_alias("st-rock1_hole", "st-rock1")
  577. def_alias("st-rock1_move", "st-rock1")
  578.  
  579. def_alias("st-rock2_hole", "st-rock2")
  580.  
  581. def_alias("st-rock3_hole", "st-rock3")
  582. def_alias("st-rock3_move", "st-rock3")
  583. def_alias("st-rock3_break", "st-rock3")
  584.  
  585. def_stone("st-marble", "sh-round")
  586. def_alias("st-marble_hole", "st-marble")
  587. def_alias("st-marble_move", "st-marble")
  588.  
  589. def_alias("st-glass_move", "st-glass");
  590.  
  591. def_alias("st-glass1_hole", "st-glass1")
  592. def_alias("st-glass2_hole", "st-glass2")
  593.  
  594. def_stone("st-metal")
  595. def_stone("st-blue-sand")
  596.  
  597. do
  598.    local sh=def_subimages("sh-round2-growing", {h=3,imgw=41,imgh=41})
  599.  
  600.    -- Wooden stone --
  601.    do
  602.       def_subimages("st-wood", {modelname="st-wood-fg",h=2})
  603.       def_shmodel("st-wood1", "st-wood-fg1", "sh-round")
  604.       def_shmodel("st-wood2", "st-wood-fg2", "sh-round")
  605.  
  606.       local n=def_subimages("st-wood-growing", {h=3})
  607.       def_anim("wood-growing-fg", buildframes(n, 130))
  608.       def_anim("wood-growing-bg", buildframes(sh, 130))
  609.       def_shmodel("st-wood-growing", "wood-growing-fg", "wood-growing-bg")
  610.       def_shmodel("st-greenbrown-growing", "wood-growing-fg", "wood-growing-bg")
  611.    end
  612.  
  613.    -- Blocker stone
  614.    do
  615.       local n=def_subimages("st-blocker", {h=4})
  616.       def_roundstone("st-blocker", n[1])
  617.       frames={}
  618.       for i=4,2,-1 do
  619.          tinsert(frames, "st-blocker"..i)
  620.       end
  621.       def_anim("blocker-growing-fg", buildframes(frames, 60))
  622.       def_anim("blocker-growing-bg", buildframes(sh, 60))
  623.       def_anim("blocker-shrinking-fg", reverseframes(buildframes(frames, 60)))
  624.       def_anim("blocker-shrinking-bg", reverseframes(buildframes(sh, 60)))
  625.       def_shmodel("st-blocker-shrinking", "blocker-shrinking-fg", "blocker-shrinking-bg");
  626.       def_shmodel("st-blocker-growing", "blocker-growing-fg", "blocker-growing-bg");
  627.    end
  628. end
  629.  
  630. def_alias("st-volcano-growing", "st-blocker-growing")
  631.  
  632. -- Rotator stones
  633. do
  634.     local n=def_subimages("st-rotator-left", {h=8})
  635.     def_anim("st-rotator-left-anim", buildframes(n, 70), FALSE)
  636.     def_roundstone("st-rotator-left", "st-rotator-left-anim")
  637.     n=def_subimages("st-rotator-right", {h=8})
  638.     def_anim("st-rotator-right-anim", buildframes(n, 70), FALSE)
  639.     def_roundstone("st-rotator-right", "st-rotator-right-anim")
  640. end
  641.  
  642. def_stone("st-grate1", "sh-grate1")
  643. def_stone("st-grate2", "sh-grate2")
  644. def_stone("st-grate3", "sh-grate3")
  645.  
  646. def_stone("st-brake", "sh-brake")
  647. def_image("it-brake", {filename="st-brake"})
  648.  
  649. def_stone("st-greenbrown", "sh-round")
  650. def_alias("st-greenbrown_hole", "st-greenbrown")
  651. def_alias("st-greenbrown_move", "st-greenbrown")
  652.  
  653. Progress(40)
  654.  
  655.  
  656. --def_stone("st-block")
  657. def_stone("st-brick")
  658. def_stone("st-woven")
  659. def_stone("st-brick_magic", nil, {filename="st-brick"})
  660. def_subimages("st-switch", {h=2, modelname="st-switchfg"})
  661. def_roundstone("st-switch1", "st-switchfg1")
  662. def_roundstone("st-switch2", "st-switchfg2")
  663. def_stone("st-switch_black2", nil, {filename="st-switch_black2"})
  664. def_stone("st-switch_black1", nil, {filename="st-switch_black1"})
  665. def_stone("st-switch_white2", nil, {filename="st-switch_white2"})
  666. def_stone("st-switch_white1", nil, {filename="st-switch_white1"})
  667. def_stone("st-fourswitch", nil, {filename="st-fourswitch_n"})
  668. def_stone("st-fourswitch_e")
  669. def_stone("st-fourswitch_s")
  670. def_stone("st-fourswitch_w")
  671. def_stone("st-floppy0", "sh-round", {filename="st-floppy1"})
  672. def_stone("st-floppy1", "sh-round", {filename="st-floppy2"})
  673.  
  674. def_image("st-easymode")
  675.  
  676.  
  677. def_stone("st-laserswitch0", nil, {filename="st-oxydb"})
  678. def_anim_images("laserswitch-blink",
  679.                 repeatanim(pingpong
  680.                            (buildframes(framenames("st-fakeoxyd-blink", 1,4),
  681.                             50))), {loop=1})
  682. def_solidstone("st-laserswitch1", "laserswitch-blink")
  683.  
  684. def_stone("st-wood_001")
  685. def_stone("st-key0", "sh-round", {filename="st-key1"})
  686. def_stone("st-key1", "sh-round", {filename="st-key2"})
  687. def_stone("st-white1")
  688. def_stone("st-white2")
  689. def_stone("st-white3")
  690. def_stone("st-white4", "sh-white4")
  691. def_stone("st-yinyang1")
  692. def_stone("st-yinyang2")
  693. def_stone("st-bluegray", "sh-round")
  694. def_stone("st-bluegray_hole", "sh-round", {filename="st-bluegray"})
  695. def_stone("st-plain")
  696. def_stone("st-yellow")
  697. def_stone("st-dummy")
  698.  
  699. --------------------------
  700. -- pull and swap stones --
  701. --------------------------
  702.  
  703. --def_stone("st-swap", "sh-round")
  704.  
  705. do
  706.    def_subimages("st-pull",{modelname="st-pull-fg",h=5})
  707.    def_subimages("st-swap",{modelname="st-swap-fg",h=5})
  708.    def_subimages("sh-pull",{h=4,imgw=41,imgh=41})
  709.  
  710.    def_shmodel("st-pull",   "st-pull-fg1", "sh-glass")
  711.    def_shmodel("st-pull-n", "st-pull-fg2", "sh-pull1")
  712.    def_shmodel("st-pull-s", "st-pull-fg3", "sh-pull2")
  713.    def_shmodel("st-pull-e", "st-pull-fg4", "sh-pull3")
  714.    def_shmodel("st-pull-w", "st-pull-fg5", "sh-pull4")
  715.  
  716.    def_shmodel("st-swap",   "st-swap-fg1", "sh-round")
  717.    def_shmodel("st-swap-n", "st-swap-fg2", "sh-pull1")
  718.    def_shmodel("st-swap-s", "st-swap-fg3", "sh-pull2")
  719.    def_shmodel("st-swap-e", "st-swap-fg4", "sh-pull3")
  720.    def_shmodel("st-swap-w", "st-swap-fg5", "sh-pull4")
  721. end
  722.  
  723. -----------------
  724. -- Oxyd Stones --
  725. -----------------
  726.  
  727. -- Oxyd stones occur in different colors and different flavors and
  728. -- for each combination of these two attributes we need animations
  729. -- for the following internal states or state transitions:
  730. --
  731. --   (a) opening and closing
  732. --   (b) blinking
  733. --   (c) opened
  734. --
  735. -- Creating the required image files by hand would be tedious, so
  736. -- we use a couple of specialized functions and overlays to create
  737. -- them automatically.
  738.  
  739. do
  740.  
  741.  
  742.     local colorspots = framenames("st-oxydbtempl", 2,9)
  743.     local openovls = framenames("st-oxydbtempl", 10,14)
  744.  
  745. -- Define "fading in" and "fading out" animations for oxyd stones.
  746. -- These two animations are combined with the stone images to
  747. -- produce the opening and closing animations for oxyd stones.
  748.  
  749.     local baseimg = {
  750.         a="st-oxyda-open",
  751.         b="st-oxydb-open",
  752.         c="st-oxydc-open",
  753.         d="st-oxydd-open"
  754.     }
  755.     local shadow = {
  756.        a="sh-round",
  757.        b="sh-round",
  758.        c="sh-solid",
  759.        d="sh-solid",
  760.     }
  761.     local fopening = {
  762.         a = buildframes(def_subimages("st-oxyda-opening", {h=9}), 60),
  763.         b = buildframes(def_subimages("st-oxydb-opening", {h=14}), 40),
  764.         c = buildframes(def_subimages("st-oxydc-opening", {h=5}), 70),
  765.         d = buildframes(def_subimages("st-oxydd-opening", {h=5}), 70),
  766.     }
  767.     local fclosing = {
  768.         a = reverseframes(fopening["a"]),
  769.         b = reverseframes(fopening["b"]),
  770.         c = reverseframes(fopening["c"]),
  771.         d = reverseframes(fopening["d"]),
  772.     }
  773.  
  774.     function mkopenclose(flavor, color)
  775.         local n = "st-oxyd" .. flavor .. color
  776.         local fadein = "oxyd"..flavor.."-fadein"
  777.         local fadeout= "oxyd"..flavor.."-fadeout"
  778.  
  779.         def_overlay(n.."-base", {%baseimg[flavor], %colorspots[color+1]})
  780.         display.DefineComposite(n.."-opening-fg", n.."-base", fadein)
  781.         display.DefineComposite(n.."-closing-fg", n.."-base", fadeout)
  782.         def_shmodel (n.."-opening", n.."-opening-fg", %shadow[flavor])
  783.         def_shmodel (n.."-closing", n.."-closing-fg", %shadow[flavor])
  784.     end
  785.  
  786.     function mkblink(flavor, color)
  787.         local n = "st-oxyd"..flavor..color.."-blink"
  788.         local img={%baseimg[flavor],%colorspots[color+1], "st-oxyd-questmark"}
  789.         def_overlay(n..1, img)
  790.         def_overlay(n..2, {%baseimg[flavor], %colorspots[color+1]})
  791.         def_anim(n.."-anim", buildframes({n..1,n..2}, 500), 1)
  792.         def_shmodel(n, n.."-anim", %shadow[flavor])
  793.     end
  794.  
  795.     function mkopened(flavor, color)
  796.         local n = "st-oxyd" .. flavor .. color .. "-open"
  797.         local names = {}
  798.  
  799.         for i=1,getn(%openovls) do
  800.             local images={%baseimg[flavor],%colorspots[color+1],%openovls[i]}
  801.             names[i] = n .. format("_%04d", i)
  802.             def_overlay(names[i], images)
  803.         end
  804.  
  805.         -- compose these images into an animation
  806.         frames = pingpong(buildframes(names, 100))
  807.         def_anim(n.."-anim", frames, 1)
  808.  
  809.         -- and finally add a shadow to make the model complete
  810.         def_shmodel(n, n.."-anim", %shadow[flavor])
  811.     end
  812.  
  813.     function mkoxyd(flavor)
  814.         def_stone("st-oxyd"..flavor, %shadow[flavor])
  815.         def_shmodel("st-likeoxyd"..flavor, "st-oxyd"..flavor, %shadow[flavor])
  816. --        def_solidstone("st-likeoxyd"..flavor, "st-oxyd"..flavor)
  817.         img=def_image("st-oxyd"..flavor.."-open")
  818.         def_shmodel("st-likeoxyd"..flavor.."-open", img, %shadow[flavor])
  819.  
  820.         local fadein = "oxyd"..flavor.."-fadein"
  821.         local fadeout= "oxyd"..flavor.."-fadeout"
  822.         def_anim(fadein, %fopening[flavor])
  823.         def_anim(fadeout, %fclosing[flavor])
  824.  
  825.         for color=0,7 do
  826.             mkopenclose(flavor, color)
  827.             mkblink(flavor, color)
  828.             mkopened(flavor, color)
  829.         end
  830.     end
  831.     mkoxyd("a")
  832.     mkoxyd("b")
  833.     Progress(50)
  834.     mkoxyd("d")
  835.     mkoxyd("c")
  836. end
  837.  
  838. Progress(60)
  839.  
  840. -----------------
  841. -- Laser stone --
  842. -----------------
  843. function make_laser(dir)
  844.     laseron=framenames("st-laser"..dir, 1, 9)
  845.  
  846.     -- deactivated laser
  847.     def_overlay("laser"..dir, {"st-laser-base", laseron[1]})
  848.     def_roundstone("st-laser"..dir, "laser"..dir)
  849.  
  850.     -- activated laser
  851.     names = {}
  852.     for i=1,getn(laseron) do
  853.     names[i] = "st-laseron"..dir .. format("_%04d", i)
  854.     def_overlay (names[i], {"st-laser-base", laseron[i]})
  855.     end
  856.     frames = buildframes(names, 100)
  857.     def_anim("st-laseron-anim"..dir, frames, 1)
  858.     def_roundstone("st-laseron"..dir, "st-laseron-anim"..dir)
  859. end
  860.  
  861. make_laser("-e")
  862. make_laser("-s")
  863. make_laser("-w")
  864. make_laser("-n")
  865.  
  866. ---------------------
  867. -- Fake oxyd stone --
  868. ---------------------
  869. def_stone("st-fakeoxyd", "sh-round", {filename="st-oxydb"})
  870. def_anim_images("fakeoxyd-blink",
  871.                 repeatanim(pingpong
  872.                            (buildframes(framenames("st-fakeoxyd-blink", 1,4),
  873.                                         50))))
  874. def_roundstone("st-fakeoxyd-blink", "fakeoxyd-blink")
  875.  
  876. -- Fart stone
  877. def_stone("st-fart", "sh-round", {filename="st-oxydb"})
  878. def_anim_images("farting",
  879.                 repeatanim(pingpong
  880.                            (buildframes(framenames("st-fakeoxyd-blink", 1,4),
  881.                                         50))))
  882. def_roundstone("st-farting", "farting")
  883.  
  884. namelist = def_subimages("st-fart-break",{h=6})
  885. def_anim("fartbreak-anim", buildframes(namelist,50))
  886. def_roundstone("st-fartbreak-anim", "fartbreak-anim")
  887.  
  888. -- st-rock3_movebreak
  889.  
  890. namelist = def_subimages("st-rock3-break", {h=6})
  891. def_anim("rock3_break-anim",buildframes(namelist,50))
  892. def_solidstone("st-rock3_break-anim", "rock3_break-anim")
  893. def_alias("st-rock3_movebreak", "st-rock3")
  894.  
  895. -- Actor impulse stone
  896. do
  897.    namelist = def_subimages("st-actorimpulse", {h=3})
  898.    shnamelist = def_subimages("sh-actorimpulse", {h=3,imgw=41,imgh=41})
  899.  
  900.    def_anim("st-ai-fg", pingpong(buildframes(namelist, 30)))
  901.    def_anim("st-ai-sh", pingpong(buildframes(shnamelist, 30)))
  902.    def_shmodel("st-actorimpulse-anim", "st-ai-fg", "st-ai-sh")
  903.  
  904.    def_shmodel("st-actorimpulse", namelist[1], shnamelist[1])
  905. end
  906.  
  907. -- Stone impulse stone
  908. --
  909. -- Note: It's important that the duration of the closing animation
  910. -- (anim2) is longer than the opening animation (anim1). Otherwise
  911. -- impulse stones do not work properly!
  912.  
  913. do
  914.    namelist = def_subimages("st-stoneimpulse", {h=4})
  915.    def_roundstone("st-stoneimpulse", namelist[1])
  916.    frames={}
  917.    for i=1,4 do tinsert(frames, namelist[i]) end
  918.    def_anim("stoneimpulse-anim1", buildframes(frames, 55))
  919.    def_roundstone("st-stoneimpulse-anim1", "stoneimpulse-anim1")
  920.    tinsert(frames, namelist[4]) -- add 1 frame to make closing anim longer!
  921.    def_anim("stoneimpulse-anim2", reverseframes(buildframes(frames, 55)))
  922.    def_roundstone("st-stoneimpulse-anim2", "stoneimpulse-anim2")
  923. end
  924.  
  925. do
  926.    namelist = def_subimages("st-stoneimpulse-hollow", {h=4})
  927.    def_shmodel("st-stoneimpulse-hollow", namelist[1], "sh-glass")
  928.    frames={}
  929.    for i=1,4 do tinsert(frames, namelist[i]) end
  930.    def_anim("stoneimpulse-hollow-anim1", buildframes(frames, 55))
  931.    def_shmodel("st-stoneimpulse-hollow-anim1", "stoneimpulse-hollow-anim1", "sh-glass")
  932.    tinsert(frames, namelist[4]) -- add 1 frame to make closing anim longer!
  933.    def_anim("stoneimpulse-hollow-anim2", reverseframes(buildframes(frames, 55)))
  934.    def_shmodel("st-stoneimpulse-hollow-anim2", "stoneimpulse-hollow-anim2", "sh-glass")
  935. end
  936.  
  937. -----------------
  938. -- Thief stone --
  939. -----------------
  940. do
  941.     local img = def_subimages("st-thief", {h=7})
  942.     local f = buildframes(img, 80)
  943.     def_anim("thief-emerge", f)
  944.     def_anim("thief-retreat", reverseframes(f))
  945.     def_roundstone("st-thief", img[1])
  946.     def_roundstone("st-thief-emerge", "thief-emerge")
  947.     def_roundstone("st-thief-retreat", "thief-retreat")
  948. end
  949.  
  950. -----------------
  951. -- Timer stone --
  952. -----------------
  953. do
  954.     local img = def_subimages("st-timer", {h=4})
  955.     def_anim("timer-anim", buildframes(img, 120), 1)
  956.     def_roundstone("st-timer", "timer-anim")
  957.     def_roundstone("st-timeroff", "st-timer1")
  958. end
  959.  
  960. -----------
  961. -- Bombs --
  962. -----------
  963.  
  964. do
  965.     local n=def_subimages("st-bombs", {h=7})
  966.     def_roundstone("st-bombs", "st-bombs1")
  967.     def_anim("st-bombs-anim", buildframes(n,50))
  968. end
  969.  
  970. ----------------
  971. -- Mail stone --
  972. ----------------
  973. do
  974.     local n=def_subimages("st-mail", {h=4})
  975.     def_solidstone("st-mail-n", "st-mail1")
  976.     def_solidstone("st-mail-e", "st-mail2")
  977.     def_solidstone("st-mail-s", "st-mail4")
  978.     def_solidstone("st-mail-w", "st-mail3")
  979. end
  980.  
  981. function def_solidstone_with_anim(name, npictures, frametime)
  982.     local n=def_subimages(name, {h=npictures})
  983.     def_anim(name.."-animfg", buildframes(n,frametime))
  984.     def_solidstone(name.."-anim", name.."-animfg")
  985.     def_solidstone(name, n[1])
  986. end
  987. function def_roundstone_with_anim(name, npictures, frametime)
  988.     local n=def_subimages(name, {h=npictures})
  989.     def_anim(name.."-animfg", buildframes(n,frametime))
  990.     def_roundstone(name.."-anim", name.."-animfg")
  991.     def_roundstone(name, n[1])
  992.  end
  993.  
  994. def_solidstone_with_anim ("st-window", 4, 80)
  995. def_solidstone_with_anim ("st-stone_break", 10, 50)
  996. def_solidstone_with_anim ("st-break_bolder", 10, 50)
  997. def_roundstone_with_anim ("st-break_acwhite", 10, 50)
  998. def_roundstone_with_anim ("st-break_acblack", 10, 50)
  999. def_roundstone_with_anim ("st-death", 3, 140)
  1000.  
  1001. do
  1002.     function def_chargestone(basename)
  1003.         local n=def_subimages(basename, {h=2})
  1004.         def_solidstone(basename, n[1])
  1005.         def_anim(basename.."-animfg", {{n[2], 140}})
  1006.         def_solidstone(basename.."-anim", basename.."-animfg")
  1007.     end
  1008.     def_chargestone("st-chargeplus")
  1009.     def_chargestone("st-chargeminus")
  1010.     def_chargestone("st-chargezero")
  1011. end
  1012.  
  1013. ---------------
  1014. -- Turnstile --
  1015. ---------------
  1016. do
  1017.    local img = def_subimages("st-turnstile", {h=2})
  1018.    def_anim("turnstile-anim", reverseframes(buildframes(img, 30)))
  1019.    def_solidstone("st-turnstile", img[1])
  1020.    def_solidstone("st-turnstile-anim", "turnstile-anim")
  1021. end
  1022.  
  1023. do
  1024.    local img = def_subimages("st-turnstile-green", {h=2})
  1025.    def_anim("turnstile-green-anim", reverseframes(buildframes(img, 30)))
  1026.    def_solidstone("st-turnstile-green", img[1])
  1027.    def_solidstone("st-turnstile-green-anim", "turnstile-green-anim")
  1028. end
  1029.  
  1030. ----------------
  1031. -- Timeswitch --
  1032. ----------------
  1033. do
  1034.     def_stone("st-timeswitch")
  1035.     local img = def_subimages("st-time1switch", {h=10})
  1036.     def_anim("st-time1switch-anim", buildframes (img, 180))
  1037.     def_solidstone("st-time1switch", "st-time1switch-anim")
  1038. end
  1039.  
  1040. Progress(70)
  1041.  
  1042. -------------
  1043. -- Mirrors --
  1044. -------------
  1045.  
  1046. -- naming scheme for mirror models:
  1047. --
  1048. --    st-{3mirror,pmirror}-{m,s}{o,t}[1234]
  1049. --
  1050. -- {m,s} -> movable or static
  1051. -- {o,t} -> opaque or transparent
  1052. --
  1053. -- The numbers map to actual orientations as follows:
  1054. --
  1055. --   NUMBER    TRIANG.M.   PLANE M.
  1056. --    1    south      "v"        "-"
  1057. --    2    west      "<"        "\"
  1058. --    3    north      "^"        "|"
  1059. --    4    east      ">"        "/"
  1060.  
  1061. function make_mirror(basename, baseimg, overlays)
  1062.     for i=1,4 do
  1063.     mname = basename .. i
  1064.     def_overlay (mname .. "-ovl", {baseimg, overlays[i]})
  1065.     def_shmodel(mname, mname .. "-ovl", "sh-round2")
  1066.     end
  1067. end
  1068.  
  1069. mirror3_opaque = framenames("st-mirrortempl", 1, 4)
  1070. mirror3_transp = framenames("st-mirrortempl", 5, 8)
  1071. mirrorp_opaque = framenames("st-mirrortempl", 9, 12)
  1072. mirrorp_transp = framenames("st-mirrortempl", 13, 16)
  1073.  
  1074. make_mirror("st-3mirror-mo", "st-mirror-movable", mirror3_opaque)
  1075. make_mirror("st-3mirror-so", "st-mirror-static",  mirror3_opaque)
  1076. make_mirror("st-3mirror-mt", "st-mirror-movable", mirror3_transp)
  1077. make_mirror("st-3mirror-st", "st-mirror-static",  mirror3_transp)
  1078.  
  1079. make_mirror("st-pmirror-mo", "st-mirror-movable", mirrorp_opaque)
  1080. make_mirror("st-pmirror-so", "st-mirror-static",  mirrorp_opaque)
  1081. make_mirror("st-pmirror-mt", "st-mirror-movable", mirrorp_transp)
  1082. make_mirror("st-pmirror-st", "st-mirror-static",  mirrorp_transp)
  1083.  
  1084. -- OneWay --
  1085. do
  1086.    local model_names = {  "st-oneway-e", "st-oneway-n", "st-oneway-s", "st-oneway-w",
  1087.                       "st-oneway_black-e", "st-oneway_black-n", "st-oneway_black-s", "st-oneway_black-w",
  1088.                       "st-oneway_white-e", "st-oneway_white-n", "st-oneway_white-s", "st-oneway_white-w"
  1089.                       }
  1090.    def_subimages("st-oneway", {modelname="st-onewayx",w=3,h=4})
  1091.    for i=1,12 do def_roundstone(model_names[i], "st-onewayx"..i) end
  1092. end
  1093.  
  1094. ---------------
  1095. -- Coin slot --
  1096. ---------------
  1097. do
  1098.     def_stone("st-coinslot")
  1099.     local img=def_subimages("st-coin2slot", {h=18})
  1100.     def_anim("st-coin2slot-anim", buildframes(img, 20))
  1101.     def_solidstone("st-coin2slot", "st-coin2slot-anim")
  1102.     def_solidstone("st-coinslot-active", "st-coin2slot18")
  1103. end
  1104.  
  1105.  
  1106. Progress(80)
  1107.  
  1108. -------------------
  1109. -- Puzzle stones --
  1110. -------------------
  1111. do
  1112.     def_subimages("st-puzzle", {modelname="st-puzzlex",w=8,h=4})
  1113.     for i=2,16  do def_solidstone("st-puzzle"..i, "st-puzzlex"..i) end
  1114.     for i=18,32 do def_solidstone("st-puzzle"..i, "st-puzzlex"..i) end
  1115.     def_shmodel("st-puzzle1", "st-puzzlex1", "sh-puzzle1")
  1116.     def_shmodel("st-puzzle17", "st-puzzlex17", "sh-puzzle1")
  1117. end
  1118.  
  1119. def_alias("st-turnstile-e", "st-puzzle2")
  1120. def_alias("st-turnstile-w", "st-puzzle5")
  1121. def_alias("st-turnstile-s", "st-puzzle9")
  1122. def_alias("st-turnstile-n", "st-puzzle3")
  1123. --def_stone("st-turnstile")
  1124.  
  1125. ---------------
  1126. -- Big brick --
  1127. ---------------
  1128.  
  1129. do
  1130.    def_subimages("st-bigbrick", {modelname="st-bigbrickx",w=4,h=4})
  1131.    for i=1,16 do def_solidstone("st-bigbrick"..i, "st-bigbrickx"..i) end
  1132. end
  1133.  
  1134. --def_alias("st-bigbrick", "st-bigbrick1");
  1135. --def_alias("st-bigbrick-n", "st-bigbrick9");
  1136. --def_alias("st-bigbrick-e", "st-bigbrick5");
  1137. --def_alias("st-bigbrick-s", "st-bigbrick3");
  1138. --def_alias("st-bigbrick-w", "st-bigbrick2");
  1139. --def_alias("st-bigbrick-ne", "st-bigbrick13");
  1140. --def_alias("st-bigbrick-nw", "st-bigbrick10");
  1141. --def_alias("st-bigbrick-es", "st-bigbrick7");
  1142. --def_alias("st-bigbrick-sw", "st-bigbrick4");
  1143. --def_alias("st-bigbrick-ns", "st-bigbrick11");
  1144. --def_alias("st-bigbrick-ew", "st-bigbrick6");
  1145. --def_alias("st-bigbrick-nes", "st-bigbrick15");
  1146. --def_alias("st-bigbrick-new", "st-bigbrick14");
  1147. --def_alias("st-bigbrick-nsw", "st-bigbrick12");
  1148. --def_alias("st-bigbrick-esw", "st-bigbrick8");
  1149. --def_alias("st-bigbrick-nesw", "st-bigbrick16");
  1150.  
  1151. ----------
  1152. -- Door --
  1153. ----------
  1154. do
  1155.     local f,img,sh
  1156.  
  1157.     img=def_subimages("st-doorh", {h=7})
  1158.     sh=def_subimages("sh-doorh", {h=7,imgw=41,imgh=41})
  1159.     def_shmodel("st-doorh-open", img[1], sh[1])
  1160.     def_shmodel("st-doorh-closed", img[7], sh[7])
  1161.     def_anim("doorh-opening-fg", reverseframes(buildframes(img, 60)))
  1162.     def_anim("doorh-opening-bg", reverseframes(buildframes(sh, 60)))
  1163.     def_shmodel("st-doorh-opening", "doorh-opening-fg", "doorh-opening-bg")
  1164.     def_anim("doorh-closing-fg", buildframes(img, 60))
  1165.     def_anim("doorh-closing-bg", buildframes(sh, 60))
  1166.     def_shmodel("st-doorh-closing", "doorh-closing-fg", "doorh-closing-bg")
  1167.  
  1168.  
  1169.     img=def_subimages("st-doorv", {w=7})
  1170.     sh=def_subimages("sh-doorv", {w=7,imgw=41,imgh=41})
  1171.     def_shmodel("st-doorv-open", img[1], sh[1])
  1172.     def_shmodel("st-doorv-closed", img[7], sh[7])
  1173.     def_anim("doorv-opening-fg", reverseframes(buildframes(img, 60)))
  1174.     def_anim("doorv-opening-bg", reverseframes(buildframes(sh, 60)))
  1175.     def_shmodel("st-doorv-opening", "doorv-opening-fg", "doorv-opening-bg")
  1176.     def_anim("doorv-closing-fg", buildframes(img, 60))
  1177.     def_anim("doorv-closing-bg", buildframes(sh, 60))
  1178.     def_shmodel("st-doorv-closing", "doorv-closing-fg", "doorv-closing-bg")
  1179. end
  1180.  
  1181. -- Door_a --
  1182. do
  1183.     def_alias("st-door_a-open", "st-grate1")
  1184.     def_alias("st-door_a-closed", "st-oxyda")
  1185.     local f = buildframes({"st-door_a-closed", "st-door_a-open"},60)
  1186.     def_anim("st-door_a-opening", f)
  1187.     def_anim("st-door_a-closing", reverseframes(f))
  1188. end
  1189.  
  1190. -- Door_b --
  1191. do
  1192.     def_alias("st-door_b-open", "invisible")
  1193.     def_alias("st-door_b-closed", "st-plain")
  1194.     local img=def_subimages("st-doorb", {modelname="doorb", h=8})
  1195.     local f = buildframes(img,60)
  1196.     def_anim("st-door_b-opening", f)
  1197.     def_anim("st-door_b-closing", reverseframes(f))
  1198. end
  1199.  
  1200. -- Door_c --
  1201. do
  1202.     def_alias("st-door_c-open", "st-grate2")
  1203.     def_alias("st-door_c-closed", "st-plain")
  1204.     frames=buildframes({"st-door_c-closed","st-door_c-open"},60)
  1205.     def_anim("st-door_c-opening", frames)
  1206.     def_anim("st-door_c-closing", reverseframes(frames))
  1207. end
  1208.  
  1209. ------------------
  1210. -- Knight stone --
  1211. ------------------
  1212. do
  1213.     local n = def_subimages("st-knight", {modelname="knight", h=5})
  1214.     for i=1,getn(n) do
  1215.         def_solidstone("st-knight"..i, n[i])
  1216.     end
  1217. end
  1218.  
  1219.  
  1220.  
  1221. -------------------
  1222. -- Shogun stones --
  1223. -------------------
  1224. do
  1225.     def_images{"sh-shogun1","sh-shogun2", "sh-shogun4"}
  1226.     def_subimages("st-shogun", {modelname="st-shogun-fg",h=7})
  1227.  
  1228.     def_shmodel("st-shogun1", "st-shogun-fg1", "sh-shogun1")
  1229.     def_shmodel("st-shogun2", "st-shogun-fg2", "sh-shogun2")
  1230.     def_shmodel("st-shogun3", "st-shogun-fg3", "sh-shogun1")
  1231.     def_shmodel("st-shogun4", "st-shogun-fg4", "sh-shogun4")
  1232.     def_shmodel("st-shogun5", "st-shogun-fg5", "sh-shogun1")
  1233.     def_shmodel("st-shogun6", "st-shogun-fg6", "sh-shogun2")
  1234.     def_shmodel("st-shogun7", "st-shogun-fg7", "sh-shogun1")
  1235. end
  1236.  
  1237. Progress(90)
  1238.  
  1239. -------------------
  1240. -- Bolder stones --
  1241. -------------------
  1242.  
  1243. do
  1244.     local img=def_subimages("st-bolder", {w=4,h=3})
  1245.     local imgfall=def_subimages("st-bolder-fall", {w=4,h=3})
  1246.  
  1247.     function def_bolder(orient, start)
  1248.        local animname="st-bolder"..orient.."a"
  1249.        local frames={%img[start], %img[start+1], %img[start+2]}
  1250.        def_anim(animname, buildframes(frames, 120),1)
  1251.        def_shmodel("st-bolder-"..orient, animname, "sh-round")
  1252.  
  1253.        animname="st-bolder-"..orient.."-fall-anim"
  1254.        frames={%imgfall[start],%imgfall[start+1],%imgfall[start+2]}
  1255.        def_anim(animname, buildframes(frames, 120), 0)
  1256.     end
  1257.  
  1258.     def_bolder("n",1)
  1259.     def_bolder("e",4)
  1260.     def_bolder("s",7)
  1261.     def_bolder("w",10)
  1262. end
  1263.  
  1264. -- Invisible stone --
  1265. def_alias("st-invisible", "invisible")
  1266. def_alias("st-invisible_magic", "invisible")
  1267. def_alias("st-stonebrush", "invisible")
  1268. def_alias("st-break_invisible", "invisible")
  1269. def_alias("st-actorimpulse_invisible", "invisible")
  1270. def_alias("st-death_invisible", "invisible")
  1271.  
  1272. ----------------------
  1273. -- Magic stones :-) --
  1274. ----------------------
  1275. do
  1276.     local img = def_subimages("st-magic", {h=4, modelname="st-magic-fg"})
  1277.     local nlist = {}
  1278.     for i=1,getn(img) do
  1279.         nlist[i] = "st-magic"..i
  1280.         def_roundstone(nlist[i], img[i])
  1281.     end
  1282.     display.DefineRandModel("st-magic", getn(nlist), nlist)
  1283. end
  1284.  
  1285.  
  1286. -------------
  1287. -- Effects --
  1288. -------------
  1289. Progress(100)
  1290.  
  1291. do
  1292.     local img=def_subimages("ring-anim", {h=8,xoff=-8,yoff=-8, imgw=16, imgh=16})
  1293.     def_anim("ring-anim", buildframes(img, 50))
  1294. end
  1295.  
  1296. -- Halo --
  1297. do
  1298.     local n=def_subimages("halo", {h=2, xoff=-11, yoff=-11, imgw=23, imgh=23})
  1299.     def_anim("halo", buildframes(n, 30), TRUE)
  1300.  
  1301.     n=def_subimages("halo-blink", {h=2, xoff=-11, yoff=-11, imgw=23, imgh=23})
  1302.     def_anim("halo-blink", buildframes(n, 30), TRUE)
  1303. end
  1304.