1 ------------------------------------------------------------------------
2 -- Copyright (C) 2002,2003,2004,2005 Daniel Heck
3 -- Copyright (C) 2009,2010 Raoul Bourquin
5 -- This program is free software; you can redistribute it and/or
6 -- modify it under the terms of the GNU General Public License
7 -- as published by the Free Software Foundation; either version 2
8 -- of the License, or (at your option) any later version.
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
15 -- You should have received a copy of the GNU General Public License along
16 -- with this program; if not, write to the Free Software Foundation, Inc.,
17 -- 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19 ------------------------------------------------------------------------
21 -- This file defines the models used in Enigma.
22 dofile(FindDataFile("models.lua"))
27 --------------------------------------------------------------------------------
29 --------------------------------------------------------------------------------
30 Progress(0, "Loading actor models")
32 ------------------------
33 -- ball-shaped actors --
34 ------------------------
38 local images
,frames
,shadows
40 -- Normal black marble
41 images
= SpriteImages("ac_marble_black", 2, 0.5, 0.31)
42 shadows
= SpriteImage("sh_marble", 0.4, 0.29)
43 DefShModel("ac_marble_black", "ac_marble_black1", "sh_marble")
44 DefShModel("ac_marble_black-shine", "ac_marble_black2", "sh_marble")
46 -- Normal white marble
47 -- Use shadow from black marble
48 images
= SpriteImages("ac_marble_white", 2, 0.5, 0.31)
49 DefShModel("ac_marble_white", "ac_marble_white1", "sh_marble")
50 DefShModel("ac_marble_white-shine", "ac_marble_white2", "sh_marble")
52 -- Falling black marble
53 images
= SpriteImages("ac_marble_black_fall", 10)
54 shadows
= SpriteImages("sh_marble_fall", 10, 0.4)
56 for i
=1,table.getn(images
) do
57 DefShModel("ac_marble_black-sink"..(i
-1), images
[i
], shadows
[i
])
58 frames
[i
] = "ac_marble_black-sink"..(i
-1)
60 DefAnim("ac_marble_black-fall", ComposeFrames(frames
,{70,65,60,55,50,50,50,50,50,50,50}))
61 DefAlias("ac_marble_black-fallen", "invisible")
63 -- Appearing / disappearing black marble
64 -- use the images from falling black marble
65 DefAnim("ac_marble_black-appear", ReverseFrames(BuildFrames(frames
, 25)))
66 DefAnim("ac_marble_black-disappear", BuildFrames(frames
, 25))
68 -- Falling white marble
69 -- Use shadow from black marble
70 images
= SpriteImages("ac_marble_white_fall", 10)
72 for i
=1,table.getn(images
) do
73 DefShModel("ac_marble_white-sink"..(i
-1), images
[i
], shadows
[i
])
74 frames
[i
] = "ac_marble_white-sink"..(i
-1)
76 DefAnim("ac_marble_white-fall", ComposeFrames(frames
,{70,65,60,55,50,50,50,50,50,50,50}))
77 DefAlias("ac_marble_white-fallen", "invisible")
79 -- Appearing / disappearing white marble
80 -- use the images from falling white marble
81 DefAnim("ac_marble_white-appear", ReverseFrames(BuildFrames(frames
, 25)))
82 DefAnim("ac_marble_white-disappear", BuildFrames(frames
, 25))
84 -- Jumping black marble
85 images
= SpriteImages("ac_marble_black_jump", 4)
86 shadows
= SpriteImages("sh_marble_jump", 4, 0.4)
89 DefShModel("bb-jump"..i
, images
[i
], shadows
[i
])
90 table.insert(frames
, "bb-jump"..i
)
92 DefAnim("ac_marble_black-jump", PingPong(BuildFrames(frames
, 70)))
94 -- Jumping white marble
95 -- Use shadow from black marble
96 images
= SpriteImages("ac_marble_white_jump", 4)
99 DefShModel("wb-jump"..i
, images
[i
], shadows
[i
])
100 table.insert(frames
, "wb-jump"..i
)
102 DefAnim("ac_marble_white-jump", PingPong(BuildFrames(frames
, 70)))
104 -- Sinking black marble
105 shadows
= SpriteImages("sh_marble_sink", 7, 0.4)
106 images
= SpriteImages("ac_marble_black_sink", 7)
107 for i
=1,table.getn(images
) do
108 DefShModel("ac_marble_black-sink"..(i
-1), images
[i
], shadows
[i
])
110 DefAlias("ac_marble_black-sunk", "invisible")
112 -- Sinking white marble
113 -- Use shadow from black marble
114 images
= SpriteImages("ac_marble_white_sink", 7)
115 for i
=1,table.getn(images
) do
116 DefShModel("ac_marble_white-sink"..(i
-1), images
[i
], shadows
[i
])
118 DefAlias("ac_marble_white-sunk", "invisible")
120 -- Shattering black marble
121 Sprite({name
="ac_marble_black_shatter", nimages
=5, framelen
=60})
122 DefAlias("ac_marble_black-shatter", "ac_marble_black_shatter")
123 DefAlias("ac_marble_black-shattered", "ac_marble_black_shatter5")
125 -- Shattering white marble
126 Sprite({name
="ac_marble_white_shatter", nimages
=5, framelen
=60})
127 DefAlias("ac_marble_white-shatter", "ac_marble_white_shatter")
128 DefAlias("ac_marble_white-shattered", "ac_marble_white_shatter5")
133 local images
, frames
, shadows
135 -- Normal black pearl
136 SpriteImage("ac_pearl_black", 0.5, 0.43)
137 SpriteImage("sh_pearl", 0.4, 0.41)
138 DefShModel("ac_pearl_black", "ac_pearl_black", "sh_pearl")
139 DefAlias("ac_pearl_black-shine", "ac_pearl_black")
141 -- Normal white pearl
142 -- Use shadow from black pearl
143 SpriteImage("ac_pearl_white", 0.5, 0.43)
144 DefShModel("ac_pearl_white", "ac_pearl_white", "sh_pearl")
145 DefAlias("ac_pearl_white-shine", "ac_pearl_white")
147 -- Falling black pearl
148 images
= SpriteImages("ac_pearl_black_fall", 5, 0.5, 0.43)
149 shadows
= SpriteImages("sh_pearl_fall", 5, 0.4, 0.43)
150 table.insert(images
, "invisible")
151 table.insert(shadows
, "invisible")
153 for i
=1,table.getn(images
) do
154 DefShModel("ac_pearl_black-fall"..(i
-1), images
[i
], shadows
[i
])
155 frames
[i
] = "ac_pearl_black-fall"..(i
-1)
157 DefAnim("ac_pearl_black-fall", ComposeFrames(frames
,{70,65,60,55,50,30}))
158 DefAlias("ac_pearl_black-fallen", "invisible")
160 -- Appearing / disappearing black pearl
161 -- use the images from falling black pearl
162 DefAnim("ac_pearl_black-appear", ReverseFrames(BuildFrames(frames
, 25)))
163 DefAnim("ac_pearl_black-disappear", BuildFrames(frames
, 25))
165 -- Falling white pearl
166 -- Use shadows from falling black pearl
167 images
= SpriteImages("ac_pearl_white_fall", 5, 0.5, 0.43)
168 table.insert(images
, "invisible")
170 for i
=1,table.getn(images
) do
171 DefShModel("ac_pearl_white-fall"..(i
-1), images
[i
], shadows
[i
])
172 frames
[i
] = "ac_pearl_white-fall"..(i
-1)
174 DefAnim("ac_pearl_white-fall", ComposeFrames(frames
,{70,65,60,55,50,30}))
175 DefAlias("ac_pearl_white-fallen", "invisible")
177 -- Appearing / disappearing white pearl
178 -- use the images from falling white pearl
179 DefAnim("ac_pearl_white-appear", ReverseFrames(BuildFrames(frames
, 25)))
180 DefAnim("ac_pearl_white-disappear", BuildFrames(frames
, 25))
182 -- Jumping black pearl
183 images
= SpriteImages("ac_pearl_black_jump", 4)
184 shadows
= SpriteImages("sh_pearl_jump", 4, 0.4)
187 DefShModel("sb-jump"..i
, images
[i
], shadows
[i
])
188 table.insert(frames
, "sb-jump"..i
)
190 DefAnim("ac_pearl_black-jump", PingPong(BuildFrames(frames
, 70)))
192 -- Jumping white pearl
193 -- Use shadow from black pearl
194 images
= SpriteImages("ac_pearl_white_jump", 4)
197 DefShModel("sb-jump"..i
, images
[i
], shadows
[i
])
198 table.insert(frames
, "sb-jump"..i
)
200 DefAnim("ac_pearl_white-jump", PingPong(BuildFrames(frames
, 70)))
202 -- Sinking black pearl
203 -- TODO: extra sink animation for pearls?
204 DefAlias("ac_pearl_black-sink0", "ac_pearl_black_fall1")
205 DefAlias("ac_pearl_black-sink1", "ac_pearl_black_fall2")
206 DefAlias("ac_pearl_black-sink2", "ac_pearl_black_fall3")
207 DefAlias("ac_pearl_black-sink3", "ac_pearl_black_fall3")
208 DefAlias("ac_pearl_black-sink4", "ac_pearl_black_fall4")
209 DefAlias("ac_pearl_black-sink5", "ac_pearl_black_fall4")
210 DefAlias("ac_pearl_black-sink6", "ac_pearl_black_fall5")
211 DefAlias("ac_pearl_black-sunk", "invisible")
213 -- Sinking white pearl
214 DefAlias("ac_pearl_white-sink0", "ac_pearl_white_fall1")
215 DefAlias("ac_pearl_white-sink1", "ac_pearl_white_fall2")
216 DefAlias("ac_pearl_white-sink2", "ac_pearl_white_fall3")
217 DefAlias("ac_pearl_white-sink3", "ac_pearl_white_fall3")
218 DefAlias("ac_pearl_white-sink4", "ac_pearl_white_fall4")
219 DefAlias("ac_pearl_white-sink5", "ac_pearl_white_fall4")
220 DefAlias("ac_pearl_white-sink6", "ac_pearl_white_fall5")
221 DefAlias("ac_pearl_white-sunk", "invisible")
223 -- Shattering black pearl
224 Sprite({name
="ac_pearl_black_shatter", nimages
=5, framelen
=60})
225 DefAlias("ac_pearl_black-shatter", "ac_pearl_black_shatter")
226 DefAlias("ac_pearl_black-shattered", "ac_pearl_black_shatter5")
228 -- Shattering white pearl
229 Sprite({name
="ac_pearl_white_shatter", nimages
=5, framelen
=60})
230 DefAlias("ac_pearl_white-shatter", "ac_pearl_white_shatter")
231 DefAlias("ac_pearl_white-shattered", "ac_pearl_white_shatter5")
236 DefAlias("ac_killer_black", "ac_pearl_black")
237 DefAlias("ac_killer_white", "ac_pearl_white")
240 ----------------------------
241 -- not ball-shaped actors --
242 ----------------------------
246 SpriteImage("ac_bug",0.5,0.44)
247 DefShModel("ac_bug", "ac_bug", "sh_pearl")
252 DefAlias("ac_cannonball", "ac_marble_black-jump")
257 SpriteImage("ac_horse",0.5,0.18)
258 SpriteImage("sh_horse", 0.4)
259 DefShModel("ac_horse", "ac_horse", "sh_horse")
264 local fg
= SpriteImages("ac_rotor",9)
265 local bg
= SpriteImages("sh_rotor", 9, 0.4)
269 DefShModel("ac-rotor"..i
, fg
[i
], bg
[i
])
270 table.insert(frames
, "ac-rotor"..i
)
272 DefAnim("ac_rotor", BuildFrames(frames
, 30), true)
277 local fg
= SpriteImages("ac_top", 9, 0.5, 0.3)
278 local bg
= SpriteImage("sh_top", 0.4, 0.3)
282 DefShModel("ac-top"..i
, fg
[i
], bg
)
283 table.insert(frames
, "ac-top"..i
)
285 DefAnim("ac_top", BuildFrames(frames
, 25), true)
288 --------------------------------------------------------------------------------
290 --------------------------------------------------------------------------------
291 Progress(15, "Loading floor models")
297 DefImage("floor_frame")
300 -------------------------------------------------------
301 -- simple tile floors (single and multiple (random)) --
302 -------------------------------------------------------
306 {"fl_abyss", noframe
= true},
310 {"fl-dummy", noframe
= true},
313 {"fl_ice", noframe
= true},
314 {"fl_inverse_white", noframe
= true},
315 {"fl_inverse_gray", noframe
= true},
318 {"fl_adhesionless", noframe
= true},
324 -- multiple, with height and width (or 1)
326 {"fl_aquamarine", 2},
328 {"fl_pinkbumps", 2, 2},
345 {"fl_space", 3, 2, noframe
= true},
346 {"fl_wood_framed", 2},
347 {"fl_swamp", 4, noframe
= true},
349 {"fl_water", 4, noframe
= true},
353 for _
, floor in pairs(floorlist
) do
354 local basename
= floor[1]
355 local height
= floor[2] or 1
356 local width
= floor[3] or 1
357 if (height
== 1) and (width
== 1) then
360 if not floor.noframe
then
361 display
.DefineComposite(basename
.. "_framed", basename
, "floor_frame")
364 -- multiple (random) floor
365 local imagelist
= DefSubimages(basename
, {h
= height
, w
= width
})
366 display
.DefineRandModel(basename
, getn(imagelist
), imagelist
)
367 if not floor.noframe
then
368 local framedlist
= {}
369 for _
, subimage
in pairs(imagelist
) do
370 display
.DefineComposite(subimage
.. "_framed", subimage
, "floor_frame")
371 table.insert(framedlist
, subimage
.. "_framed")
373 display
.DefineRandModel(basename
.. "_framed", getn(framedlist
), framedlist
)
379 -----------------------------------------
381 -----------------------------------------
385 DefSubimages("fl_slope", {w
=6, h
=4, modelname
="fl_slope"})
386 DefAlias("fl_slope", "fl_slope21")
387 DefAlias("fl_slope_pw", "fl_slope4")
388 DefAlias("fl_slope_ps", "fl_slope1")
389 DefAlias("fl_slope_pe", "fl_slope3")
390 DefAlias("fl_slope_pn", "fl_slope2")
391 DefAlias("fl_slope_inw", "fl_slope12")
392 DefAlias("fl_slope_isw", "fl_slope11")
393 DefAlias("fl_slope_ise", "fl_slope9")
394 DefAlias("fl_slope_ine", "fl_slope10")
395 DefAlias("fl_slope_onw", "fl_slope8")
396 DefAlias("fl_slope_osw", "fl_slope6")
397 DefAlias("fl_slope_ose", "fl_slope5")
398 DefAlias("fl_slope_one", "fl_slope7")
399 DefAlias("fl_slope_tw", "fl_slope21")
400 DefAlias("fl_slope_ts", "fl_slope21")
401 DefAlias("fl_slope_te", "fl_slope21")
402 DefAlias("fl_slope_tn", "fl_slope21")
403 DefAlias("fl_slope_twl", "fl_slope2")
404 DefAlias("fl_slope_tsl", "fl_slope4")
405 DefAlias("fl_slope_tel", "fl_slope1")
406 DefAlias("fl_slope_tnl", "fl_slope3")
407 DefAlias("fl_slope_twr", "fl_slope1")
408 DefAlias("fl_slope_tsr", "fl_slope3")
409 DefAlias("fl_slope_ter", "fl_slope2")
410 DefAlias("fl_slope_tnr", "fl_slope4")
415 DefSubimages("fl_lawn", {w
=10, h
=2, modelname
="fl_lawnx"})
416 DefRandFloor("fl_lawn", {"fl_lawnx1", "fl_lawnx2", "fl_lawnx3", "fl_lawnx4"})
417 DefAlias("fl_lawn_a", "fl_lawn")
418 DefRandFloor("fl_lawn_b", {"fl_lawnx5", "fl_lawnx6", "fl_lawnx7", "fl_lawnx8"})
419 DefAlias("fl_lawn_c1", "fl_lawnx9")
420 DefAlias("fl_lawn_c2", "fl_lawnx10")
421 DefAlias("fl_lawn_c3", "fl_lawnx11")
422 DefAlias("fl_lawn_c4", "fl_lawnx12")
423 DefAlias("fl_lawn_d1", "fl_lawnx13")
424 DefAlias("fl_lawn_d2", "fl_lawnx14")
425 DefAlias("fl_lawn_d3", "fl_lawnx15")
426 DefAlias("fl_lawn_d4", "fl_lawnx16")
427 DefAlias("fl_lawn_e1", "fl_lawnx17")
428 DefAlias("fl_lawn_e2", "fl_lawnx18")
429 DefAlias("fl_lawn_e3", "fl_lawnx19")
430 DefAlias("fl_lawn_e4", "fl_lawnx20")
435 DefSubimages("fl_wood", {w
=1, h
=4, modelname
="fl-woodx"})
436 DefRandFloor("fl_wood", {"fl-woodx1", "fl-woodx2", "fl-woodx3", "fl-woodx4"})
437 DefRandFloor("fl_wood1", {"fl-woodx3", "fl-woodx4"})
438 DefRandFloor("fl_wood2", {"fl-woodx1", "fl-woodx2"})
443 DefSubimages("fl_yinyang_yin", {w
=1, h
=2, modelname
="fl_yinyang_yinx"})
444 DefSubimages("fl_yinyang_yang", {w
=1, h
=2, modelname
="fl_yinyang_yangx"})
445 DefAlias("fl_yinyang_yin", "fl_yinyang_yinx1")
446 DefAlias("fl_yinyang_yin_invisible", "fl_yinyang_yinx2")
447 DefAlias("fl_yinyang_yang", "fl_yinyang_yangx1")
448 DefAlias("fl_yinyang_yang_invisible", "fl_yinyang_yangx2")
451 --------------------------
452 -- Simple floor aliases --
453 --------------------------
455 DefAlias("fl_fake_abyss", "fl_abyss")
456 DefAlias("fl_inverse", "fl_inverse_white")
457 DefAlias("fl_metal_1", "fl_metal1")
458 DefAlias("fl_metal_2", "fl_metal2")
459 DefAlias("fl_metal_3", "fl_metal3")
460 DefAlias("fl_metal_4", "fl_metal4")
461 DefAlias("fl_metal_5", "fl_metal5")
462 DefAlias("fl_metal_6", "fl_metal6")
463 DefAlias("fl_metal_7", "fl_metal7")
464 DefAlias("fl_metal_7n", "fl_metal7")
465 DefAlias("fl_metal_1_framed", "fl_metal1_framed")
466 DefAlias("fl_metal_2_framed", "fl_metal2_framed")
467 DefAlias("fl_metal_3_framed", "fl_metal3_framed")
468 DefAlias("fl_metal_4_framed", "fl_metal4_framed")
469 DefAlias("fl_metal_5_framed", "fl_metal5_framed")
470 DefAlias("fl_metal_6_framed", "fl_metal6_framed")
471 DefAlias("fl_metal_7_framed", "fl_metal7_framed")
472 DefAlias("fl-space-force", "fl_space")
473 DefAlias("fl_samba_h", "fl_samba1")
474 DefAlias("fl_samba_v", "fl_samba2")
475 DefAlias("fl_samba_h_framed", "fl_samba1_framed")
476 DefAlias("fl_samba_v_framed", "fl_samba2_framed")
479 ----------------------
480 -- Floor animations --
481 ----------------------
485 DefImage("fl_bridge_gc_open")
486 DefImage("fl_bridge_gc_closed")
487 local namelist
= DefSubimages("fl_bridge_gc", {h
=10})
488 local frames
= BuildFrames(namelist
,70)
489 DefAnim("fl_bridge_gc_opening", ReverseFrames(frames
))
490 DefAnim("fl_bridge_gc_closing", frames
)
491 local bridge_o
= DefImage("fl_bridge_bw_open")
492 local bridge_c
= DefImage("fl_bridge_bw_closed")
494 for key
,suff
in ipairs({"bw", "bs", "be", "bn"}) do
495 DefAlias("fl_bridge_"..suff
.."_open", "fl_bridge_bw_open")
496 DefAlias("fl_bridge_"..suff
.."_closed", "fl_bridge_bw_closed")
498 local namelist
= DefSubimages("fl_bridge_"..suff
, {h
=7})
499 table.insert(namelist
, 1, bridge_c
)
500 table.insert(namelist
, bridge_o
)
501 local frames
= BuildFrames(namelist
,70)
502 DefAnim("fl_bridge_"..suff
.."_opening", frames
)
503 DefAnim("fl_bridge_"..suff
.."_closing", ReverseFrames(frames
))
509 local scales
= DefSubimages("fl_scales", {h
=2})
511 display
.DefineComposite("fl_scales_brick_released", "fl_brick", scales
[1])
512 display
.DefineComposite("fl_scales_brick_pressed", "fl_brick", scales
[2])
514 display
.DefineComposite("fl_scales_bridgewood_released", "fl_bridge_bw_closed", scales
[1])
515 display
.DefineComposite("fl_scales_bridgewood_pressed", "fl_bridge_bw_closed", scales
[2])
517 display
.DefineComposite("fl_scales_concrete_released", "fl_concrete", scales
[1])
518 display
.DefineComposite("fl_scales_concrete_pressed", "fl_concrete", scales
[2])
520 display
.DefineComposite("fl_scales_darkgray_released", "fl_darkgray", scales
[1])
521 display
.DefineComposite("fl_scales_darkgray_pressed", "fl_darkgray", scales
[2])
523 display
.DefineComposite("fl_scales_gray_released", "fl_gray", scales
[1])
524 display
.DefineComposite("fl_scales_gray_pressed", "fl_gray", scales
[2])
526 display
.DefineComposite("fl_scales_platinum_released", "fl_platinum", scales
[1])
527 display
.DefineComposite("fl_scales_platinum_pressed", "fl_platinum", scales
[2])
530 ------------------------
531 -- Heating animations --
532 ------------------------
534 function heating_animation(basemodel
)
535 local images
= DefSubimages(basemodel
.."_heating", {h
=8});
536 local frames
= BuildFrames(images
, 240)
537 DefAnim(basemodel
.."_heating", frames
);
540 heating_animation("fl_ice")
541 heating_animation("fl_water")
542 heating_animation("fl_swamp")
545 --------------------------------------------------------------------------------
547 --------------------------------------------------------------------------------
548 Progress(25, "Loading item models")
549 ------------------------------------------------------
550 -- Single-Image-Items, non animated, e.g. it-banana --
551 ------------------------------------------------------
596 DefImage("it_brake", {filename
="st_brake"})
597 DefImage("it_meditation_hollow", {filename
="it_meditation_hollow"})
598 DefImage("it_meditation_hill", {filename
="it_meditation_hill"})
599 DefImage("it_meditation_dent", {filename
="it_meditation_dent"})
600 DefImage("it_meditation_bump", {filename
="it_meditation_bump"})
601 DefImage("it_meditation_volcano", {filename
="it_meditation_volcano"})
602 DefImage("it_meditation_caldera", {filename
="it_meditation_caldera"})
605 -------------------------
606 -- Simple item aliases --
607 -------------------------
609 -- necessary for barrier stone
610 DefAlias("it_bottle", "it_bottle_idle")
612 --------------------------------------------------------------
613 -- Multiple-Image-Items, non animated, e.g. it-burnable-oil --
614 --------------------------------------------------------------
616 -- it_extinguisher --
618 DefTiles("it_extinguisher", {"it_extinguisher_full", "it_extinguisher_medium", "it_extinguisher_empty", "it_extinguisher"})
623 DefTiles("it_dummy", {"it_dummy", "it_dummy_egg"})
628 DefTiles("it_key", {"it_key", "it_key_1", "it_key_2", "it_key_3", "it_key_4", "it_key_5", "it_key_6", "it_key_7", "it_key_8"})
633 DefSubimages("it_burnable_oil", {h
=4})
638 DefTiles("it_laser", {"it_laser_h", "it_laser_v", "it_laser_hv"})
643 -- first two rows are pipe models for the pipe item
644 -- second two rows are the models used for the barrier stone
645 DefTiles("it_pipe", {"it_pipe_e", "it_pipe_s", "it_pipe_es", "it_pipe_sw", "it_pipe_ew",
646 "it_pipe_w", "it_pipe_n", "it_pipe_ne", "it_pipe_nw", "it_pipe_ns", "it_pipe_nil",
647 "pipe_e", "pipe_s", "pipe_es", "pipe_sw", "pipe_ew",
648 "pipe_w", "pipe_n", "pipe_ne", "pipe_nw", "pipe_ns", "pipe"})
653 DefTiles("it_spring", {"it_spring_keep", "it_spring_drop", "it_spring"})
658 DefSubimages("it_strip", {modelname
="it_strip", w
=4, h
=4, startindex
=0})
663 DefTiles("it_trigger", {"it_trigger_up","it_trigger_down"})
668 DefTiles("it_yinyang", {"it_yinyang", "it_yangyin"})
671 ----------------------------------------
672 -- Animated Items and Item Animations --
673 ----------------------------------------
677 DefSubimages("it_bomb", {modelname
="it_bomb", w
=3, h
=10})
679 -- Black and white bombs --
680 DefAlias("it_bomb_black", "it_bomb1")
681 DefAlias("it_bomb_white", "it_bomb11")
683 -- Bombs for barrier stone --
684 DefAlias("bomb_black", "it_bomb21")
685 DefAlias("bomb_white", "it_bomb22")
686 DefAlias("bomb", "it_bomb23")
688 -- Burning black bomb --
689 local images
= {"it_bomb2", "it_bomb3", "it_bomb4", "it_bomb5", "it_bomb6", "it_bomb7", "it_bomb8", "it_bomb9", "it_bomb10"}
690 local frames
= BuildFrames(images
, 100)
691 DefAnim("it_bomb_black_burning", frames
)
693 -- Burning white bomb --
694 images
= {"it_bomb12", "it_bomb13", "it_bomb14", "it_bomb15", "it_bomb16", "it_bomb17", "it_bomb18", "it_bomb19", "it_bomb20"}
695 local frames
= BuildFrames(images
, 100)
696 DefAnim("it_bomb_white_burning", frames
)
698 local frames
= BuildFrames({"it_bomb19", "it_bomb20"}, 120)
699 DefAnim("it_bomb_white_exploding", frames
)
702 -- Burning dynamite --
704 local images
= DefSubimages("it_dynamite_burning", {h
=15})
705 local frames
= BuildFrames(images
, 100)
706 DefAnim("it_dynamite_burning", frames
)
711 local images
= DefSubimages("it_burnable_ignite", {h
=8})
712 local frames
= BuildFrames(images
, 100)
713 DefAnim("it_burnable_ignited", frames
)
715 local images
= DefSubimages("it_burnable_burning", {h
=8})
716 local frames
= BuildFrames(images
, 100)
717 DefAnim("it_burnable_burning", frames
)
719 -- Simple fire related items:
720 DefImages({"it_burnable_ash", "it_burnable_fireproof"})
721 DefAlias("it_burnable_invisible", "invisible")
726 local images
= DefSubimages("it_coffee", {h
=4})
727 local frames
= BuildFrames(images
,150)
728 DefAnim("it_coffee", frames
, true)
733 local images
= DefSubimages("it_crack_abyss", {h
=8})
734 local frames
= BuildFrames(images
,50)
735 DefAnim("it_debris", frames
)
737 local frames
= BuildFrames({"it_crack_abyss4", "it_crack_abyss5", "it_crack_abyss6", "it_crack_abyss7", "it_crack_abyss8"},120)
738 DefAnim("it_crack_abyss_anim", frames
)
740 local images
= DefSubimages("it_crack_water", {h
=8})
741 local frames
= BuildFrames(images
,50)
742 DefAnim("it_debris_water", frames
)
744 local frames
= BuildFrames({"it_crack_water4", "it_crack_water5", "it_crack_water6", "it_crack_water7", "it_crack_water8"},120)
745 DefAnim("it_crack_water_anim", frames
)
750 local images
= DefSubimages("it_death", {h
=4})
751 DefAlias("it_death", images
[1])
752 DefAnim("it_death_anim", BuildFrames(images
, 100))
757 DefAnimImages("it_explosion", {{"it_explosion", 50}})
762 DefImage("it_magnet_off")
763 local images
= DefSubimages("it_magnet_on", {h
=5})
764 local frames
= BuildFrames(images
, 100)
765 DefAnim("it_magnet_on", frames
, 1)
770 local images
= {"it_puller_n", "it_puller_e", "it_puller_s", "it_puller_w", "it_puller"}
771 DefTiles("it_puller", images
)
772 table.remove(images
, 5)
773 local frames
= BuildFrames(images
, 100)
774 DefAnim("it_puller_active", RepeatAnim(frames
, 4), false)
779 local images
= DefSubimages("it_seed", {h
=5})
780 DefAlias("it_seed", "it_seed1")
782 "it_seed1", "it_seed2", "it_seed1", "it_seed3", "it_seed1", "it_seed2",
783 "it_seed1", "it_seed4", "it_seed5", "it_seed4", "it_seed1",
784 "it_seed4", "it_seed5",
786 DefAnim("it_seed_growing", BuildFrames(frames
, 120))
788 DefAlias("it_seed_wood", "it_seed1")
789 DefAlias("it_seed_greenbrown", "it_seed1")
790 DefAlias("it_seed_hay", "it_seed1")
791 DefAlias("it_seed_volcano", "it_seed1")
796 DefTiles("it_sensor", {"it_sensor","it_sensor1"})
797 local frames
= BuildFrames({"it_sensor","it_sensor1"}, 300)
798 DefAnim("it_sensor_hit", RepeatAnim(frames
, 3), false)
799 DefTiles("it_sensor_exit", {"it_sensor_exit","it_sensor_exit1"})
800 local exitframes
= BuildFrames({"it_sensor_exit","it_sensor_exit1"}, 300)
801 DefAnim("it_sensor_exit_hit", RepeatAnim(exitframes
, 3), false)
806 NewAnim("it_shogun_s", {img
="it_shogun_s", h
=3, speed
=160, pingpong
=1, loop
=1})
807 NewAnim("it_shogun_m", {img
="it_shogun_m", h
=3, speed
=160, pingpong
=1, loop
=1})
808 NewAnim("it_shogun_l", {img
="it_shogun_l", h
=3, speed
=160, pingpong
=1, loop
=1})
813 local images
= {"it_springboard1", "it_springboard2"}
814 DefTiles ("it_springboard", images
)
815 DefAlias ("it_springboard", images
[1])
816 DefAnim("it_springboard_anim", BuildFrames(ReverseFrames(images
),120))
821 local images
= DefSubimages("it_vortex", {h
=4})
822 DefAlias("it_vortex_open", images
[1])
823 DefAlias("it_vortex_closed", images
[4])
825 DefAnim("it_vortex_opening", ReverseFrames(BuildFrames(images
, 100)))
826 DefAnim("it_vortex_closing", BuildFrames(images
, 100))
831 local images
= DefSubimages("it_wormhole", {h
=2})
832 local frames
= BuildFrames(images
, 100)
833 DefAnim("it_wormhole", frames
, true)
834 DefAlias("it_wormhole_off", "it_wormhole1")
839 local images
= DefSubimages("it_trap", {h
=8})
840 local frames
= BuildFrames(images
, 100)
841 DefAnim("it_trap_breaking", frames
)
842 DefAlias("it_trap", "it_trap8")
845 --------------------------------------------------------------------------------
847 --------------------------------------------------------------------------------
848 Progress(40, "Loading stone models")
856 DefImage("sh_rounded")
857 DefImage("sh_grate_cross")
858 DefImage("sh_grate_framed")
859 DefImage("sh_portal_horse")
860 DefImage("sh_rawglass")
861 DefImage("sh_rawglass_quad")
862 DefImage("sh_passage_frame")
863 DefImage("sh_passage_slash")
864 DefImage("sh_passage_cross")
865 DefImage("sh_puzzle_hollow")
867 DefImage("sh_floating")
870 -- Note: Window shadows are defined where needed.
877 DefStone("st_beads", "sh_beads")
878 DefStone("st_passage_black_square", "sh_round")
879 DefStone("st_passage_black_slash", "sh_passage_slash")
880 DefStone("st_passage_black_cross", "sh_passage_cross")
881 DefStone("st_passage_black_frame", "sh_passage_frame")
882 DefStone("st_jamb_black", "sh_jamb")
883 DefStone("st_plop_slate")
884 DefStone("st_bluegray", "sh_round")
885 DefStone("st_brake", "sh_brake")
886 DefStone("st_brownie", "sh_round")
887 DefStone("st_break_bug")
888 DefStone("st_pinkbumps")
889 DefStone("st_camouflage")
891 DefImage("st-easymode")
892 DefStone("st_floppy_off", "sh_round")
893 DefStone("st_floppy_on", "sh_round")
894 DefStone("st_box_rock", "sh_round")
895 DefStone("st_rawglass", "sh_rawglass")
896 DefStone("st_rawglass_quad", "sh_rawglass_quad")
897 DefStone("st_lightglass", "sh_rawglass")
898 DefStone("st_darkglass", "sh_rawglass")
899 DefStone("st_redfiber", "sh_rawglass")
900 DefStone("st_grate_cross", "sh_grate_cross")
901 DefStone("st_grate_framed", "sh_grate_framed")
902 DefStone("st_portal_horse", "sh_portal_horse")
903 DefStone("st_redbrown", "sh_round")
905 DefStone("st_redrock", "sh_rounded")
906 DefStone("st_granite", "sh_round")
907 DefStone("st_darkgray", "sh_rounded")
908 DefStone("st_plaster")
909 DefStone("st_purplemarble")
910 DefStone("st_tigris")
911 DefStone("st_purplegray")
912 DefStone("st_greengray")
913 DefStone("st_concrete", "sh_round")
914 DefStone("st_ancient", "sh_round")
915 DefStone("st_brownmarble")
916 DefStone("st_rubberband", "sh_round")
917 DefStone("st_brownpyramid")
918 DefStone("st_redmarble")
919 DefStone("st_surprise", "sh_round")
920 DefStone("st_passage_white_square", "sh_round")
921 DefStone("st_passage_white_slash", "sh_passage_slash")
922 DefStone("st_passage_white_cross", "sh_passage_cross")
923 DefStone("st_passage_white_frame", "sh_passage_frame")
924 DefStone("st_jamb_white", "sh_jamb")
926 DefStone("st_yellow")
927 DefStone("st_blur_straight", "sh_round")
928 DefStone("st_blur_cross", "sh_round")
929 DefStone("st_yinyang_inactive", "sh_round")
934 local images_on
= DefSubimages("st_key_on", {modelname
="st_key_on", w
=1, h
=9})
935 local images_off
= DefSubimages("st_key_off", {modelname
="st_key_off", w
=1, h
=9})
936 DefRoundStone("st_key_on", images_on
[1])
937 DefRoundStone("st_key_off", images_off
[1])
939 DefRoundStone("st_key_"..i
.."_on", images_on
[i
+1])
940 DefRoundStone("st_key_"..i
.."_off", images_off
[i
+1])
944 ---------------------
945 -- Animated stones --
946 ---------------------
948 -- st_actorimpulse --
950 namelist
= DefSubimages("st_actorimpulse", {h
=3})
951 shnamelist
= DefSubimages("sh_actorimpulse", {h
=3,imgw
=ShadowSize
,imgh
=ShadowSize
})
953 DefAnim("st-ai-fg", PingPong(BuildFrames(namelist
, 30)))
954 DefAnim("st-ai-sh", PingPong(BuildFrames(shnamelist
, 30)))
955 DefShModel("st_actorimpulse_anim", "st-ai-fg", "st-ai-sh")
957 DefShModel("st_actorimpulse", namelist
[1], shnamelist
[1])
962 DefSubimages("st_bluesand", {modelname
="st_bluesandx",w
=4,h
=4})
963 for i
=0,15 do DefSolidStone("st_bluesand"..i
, "st_bluesandx"..(i
+1)) end
968 DefSubimages("st_brick", {modelname
="st_brickx",w
=4,h
=4})
969 for i
=0,15 do DefSolidStone("st_brick"..i
, "st_brickx"..(i
+1)) end
974 DefSubimages("st_panel", {modelname
="st_panelx",w
=4,h
=4})
975 for i
=0,15 do DefSolidStone("st_panel"..i
, "st_panelx"..(i
+1)) end
980 local img
= DefSubimages("st_boulder", {w
=4,h
=3})
981 local imgfall
= DefSubimages("st_boulder_fall", {w
=4,h
=3})
983 function def_boulder(orient
, start
)
984 local animname
= "st_boulder"..orient
.."a"
985 local frames
= {img
[start
], img
[start
+1], img
[start
+2]}
986 DefAnim(animname
, BuildFrames(frames
, 120), false)
987 DefShModel("st_boulder_"..orient
, animname
, "sh_round")
989 animname
= "st_boulder_"..orient
.."_fall_anim"
990 frames
= {imgfall
[start
],imgfall
[start
+1],imgfall
[start
+2]}
991 DefAnim(animname
, BuildFrames(frames
, 120), false)
1000 -- st-break_*, breakable stones --
1002 DefSolidStoneWithAnim ("st_break_oxydc", 10, 50)
1003 DefSolidStoneWithAnim ("st_break_boulder", 10, 50)
1004 DefRoundStoneWithAnim ("st_break_white", 10, 50)
1005 DefRoundStoneWithAnim ("st_break_black", 10, 50)
1006 DefRoundStoneWithAnim ("st_break_plain", 10, 50)
1009 -- st_chage_plus, st_charge_zero, st_charge_minus --
1011 function def_chargestone(basename
)
1012 local images
= DefSubimages(basename
, {h
=2})
1013 DefShModel(basename
, images
[1], "sh_rounded")
1014 DefAnim(basename
.."-animfg", {{images
[2], 140}})
1015 DefShModel(basename
.."_anim", basename
.."-animfg", "sh_rounded")
1018 def_chargestone("st_charge_plus")
1019 def_chargestone("st_charge_minus")
1020 def_chargestone("st_charge_zero")
1023 -- st_chess_black, st_chess_white --
1025 function make_chess(colour
)
1026 local img1
= DefSubimages("st_chess"..colour
, {h
=5});
1027 --local img2 = DefSubimages("st_chess"..colour.."-capture", {h=5});
1028 local f1
= BuildFrames(img1
, 120)
1029 --local f2 = BuildFrames(img2, 40)
1031 local f3
= BuildFrames(img1
, 500)
1032 DefAnim("st_chess"..colour
.."-disappearing", f1
);
1033 DefAnim("st_chess"..colour
.."-appearing", ReverseFrames(f1
))
1034 DefAnim("st_chess"..colour
.."-capture", f2
);
1035 DefAnim("st_chess"..colour
.."-swamp", f3
);
1036 DefRoundStone("st_chess"..colour
, img1
[1])
1039 make_chess("_black")
1040 make_chess("_white")
1045 DefStone("st_coinslot")
1046 local images
= DefSubimages("st_coinslot_insert", {h
=18})
1047 DefAnim("st_coinslot_anim", BuildFrames(images
, 20))
1048 DefSolidStone("st_coinslot_insert", "st_coinslot_anim")
1049 DefSolidStone("st_coinslot_active", "st_coinslot_insert18")
1054 DefTiles("st_disco", {"st_disco0","st_disco1","st_disco2"})
1059 DefRoundStoneWithAnim ("st_death", 3, 140)
1060 DefRoundStoneWithAnim ("st_death_light", 3, 140)
1065 DefRoundStoneWithAnim("st_yinyang", 6, 140)
1070 function make_dispenser(name
)
1071 local images
= DefSubimages(name
, {h
=7})
1072 DefRoundStone(name
, name
.."1")
1073 DefAnim(name
.."_breaking", BuildFrames(images
,50))
1076 make_dispenser("st_dispenser_bombblack")
1077 make_dispenser("st_dispenser_dynamite")
1078 make_dispenser("st_dispenser_bombwhite")
1079 make_dispenser("st_dispenser_extralife")
1084 local images
= DefSubimages("st_flash", {h
=6})
1085 DefSolidStone("st_flash", "st_flash1")
1086 table.remove(images
,1)
1087 local frames
= BuildFrames(images
,50)
1088 DefAnim("st_flash_anim", frames
)
1089 DefSolidStone("st_flash-anim", "st_flash_anim")
1094 DefSubimages("st_fourswitch",{h
=4})
1095 DefShModel("st_fourswitch-n", "st_fourswitch1", "sh_round")
1096 DefShModel("st_fourswitch-e", "st_fourswitch2", "sh_round")
1097 DefShModel("st_fourswitch-s", "st_fourswitch3", "sh_round")
1098 DefShModel("st_fourswitch-w", "st_fourswitch4", "sh_round")
1103 DefStone("st_ice", "sh_rawglass")
1105 local images
= DefSubimages("st_ice_break", {h
=5})
1106 local frames
= BuildFrames(images
,50)
1107 DefAnim("st_ice_break-anim", frames
)
1108 DefShModel("st_ice_breaking", "st_ice_break-anim", "sh_rawglass")
1110 images
= DefSubimages("st_ice_melting", {h
=10})
1111 frames
= BuildFrames(images
,200)
1112 DefAnim("st_ice_melt-anim", frames
)
1113 DefShModel("st_ice_melting", "st_ice_melt-anim", "sh_rawglass")
1118 local images
= DefSubimages("st_knight", {modelname
="knight", h
=5})
1119 for i
=1, table.getn(images
) do
1120 DefShModel("st_knight"..i
, images
[i
], "sh_round")
1126 local images
= DefSubimages("st_laser", {w
=4,h
=9})
1132 imagesn
[i
] = images
[1+i
]
1133 imagese
[i
] = images
[10+i
]
1134 imagess
[i
] = images
[19+i
]
1135 imagesw
[i
] = images
[28+i
]
1136 -- slicing like in python would be nice here :-)
1139 -- deactivated laser
1140 DefShModel("st-laser-n", imagesn
[1], "sh_rounded")
1141 DefShModel("st-laser-e", imagese
[1], "sh_rounded")
1142 DefShModel("st-laser-s", imagess
[1], "sh_rounded")
1143 DefShModel("st-laser-w", imagesw
[1], "sh_rounded")
1146 DefAnim("st-laseron-anim-n", BuildFrames(imagesn
,100), true)
1147 DefShModel("st-laseron-n", "st-laseron-anim-n", "sh_rounded")
1148 DefAnim("st-laseron-anim-e", BuildFrames(imagese
,100), true)
1149 DefShModel("st-laseron-e", "st-laseron-anim-e", "sh_rounded")
1150 DefAnim("st-laseron-anim-s", BuildFrames(imagess
,100), true)
1151 DefShModel("st-laseron-s", "st-laseron-anim-s", "sh_rounded")
1152 DefAnim("st-laseron-anim-w", BuildFrames(imagesw
,100), true)
1153 DefShModel("st-laseron-w", "st-laseron-anim-w", "sh_rounded")
1156 -- st_lightpassenger --
1158 local img
= DefSubimages("st_lightpassenger", {h
=7})
1159 DefShModel("st_lightpassenger", img
[1], "sh_rawglass")
1160 DefImage("st_lightpassenger_offx", {filename
= "st_lightpassenger_off"})
1161 DefShModel("st_lightpassenger_off", "st_lightpassenger_offx", "sh_rawglass")
1162 DefAlias("st_lightpassenger_hidden", "st_darkglass")
1164 local frames
= {img
[2], img
[3], img
[4], img
[5], img
[6], img
[7]}
1165 DefAnim("st_lightpassenger_blink1", PingPong(BuildFrames(frames
, 75)), true)
1166 DefShModel("st_lightpassenger_blink", "st_lightpassenger_blink1", "sh_rawglass")
1168 img
= DefSubimages("st_lightpassenger_break", {h
=7})
1169 local anim_v
, anim_h
, anim_hv
= {}, {}, {}
1171 anim_v
[j
] = "st_lightpassenger_break_v"..j
1172 display
.DefineComposite(anim_v
[j
], "it_laser_v", img
[j
])
1173 anim_h
[j
] = "st_lightpassenger_break_h"..j
1174 display
.DefineComposite(anim_h
[j
], "it_laser_h", img
[j
])
1175 anim_hv
[j
] = "st_lightpassenger_break_hv"..j
1176 display
.DefineComposite(anim_hv
[j
], "it_laser_hv", img
[j
])
1178 DefAnim("st_lightpassenger_break_v", BuildFrames(anim_v
, 50), false)
1179 DefAnim("st_lightpassenger_break_h", BuildFrames(anim_h
, 50), false)
1180 DefAnim("st_lightpassenger_break_hv", BuildFrames(anim_hv
, 50), false)
1185 local img
= DefSubimages("st_dongle", {h
=4, modelname
="st_dongle-fg"})
1187 for i
=1, table.getn(img
) do
1188 nlist
[i
] = "st_dongle"..i
1189 DefRoundStone(nlist
[i
], img
[i
])
1191 display
.DefineRandModel("st_dongle", table.getn(nlist
), nlist
)
1196 local images
= DefSubimages("st_mail", {h
=4})
1197 DefSolidStone("st_mail_n", images
[1])
1198 DefSolidStone("st_mail_e", images
[2])
1199 DefSolidStone("st_mail_w", images
[3])
1200 DefSolidStone("st_mail_s", images
[4])
1203 -- st_oneway, st_oneway_black, st_oneway_white --
1205 local model_names
= {
1206 "st_oneway_e", "st_oneway_n", "st_oneway_s", "st_oneway_w",
1207 "st_oneway_black_e", "st_oneway_black_n", "st_oneway_black_s", "st_oneway_black_w",
1208 "st_oneway_white_e", "st_oneway_white_n", "st_oneway_white_s", "st_oneway_white_w"
1210 DefSubimages("st_oneway", {modelname
="st_onewayx",w
=3,h
=4})
1211 for i
=1,12 do DefFloatingStone(model_names
[i
], "st_onewayx"..i
) end
1214 -- st_pull, st_swap --
1216 DefSubimages("st_pull",{modelname
="st-pull-fg",h
=5})
1217 DefSubimages("st_swap",{modelname
="st-swap-fg",h
=5})
1218 DefSubimages("sh_pull",{h
=4, imgw
=ShadowSize
, imgh
=ShadowSize
})
1220 DefShModel("st_pull", "st-pull-fg1", "sh_rawglass")
1221 DefShModel("st_pull_n", "st-pull-fg2", "sh_pull1")
1222 DefShModel("st_pull_s", "st-pull-fg3", "sh_pull2")
1223 DefShModel("st_pull_e", "st-pull-fg4", "sh_pull3")
1224 DefShModel("st_pull_w", "st-pull-fg5", "sh_pull4")
1226 DefShModel("st_swap", "st-swap-fg1", "sh_round")
1227 DefShModel("st_swap_n", "st-swap-fg2", "sh_pull1")
1228 DefShModel("st_swap_s", "st-swap-fg3", "sh_pull2")
1229 DefShModel("st_swap_e", "st-swap-fg4", "sh_pull3")
1230 DefShModel("st_swap_w", "st-swap-fg5", "sh_pull4")
1235 DefSubimages("st_puzzle_blue", {modelname
="st_puzzlex",w
=4,h
=4,startindex
=0})
1236 DefSubimages("st_puzzle_yellow", {modelname
="st_puzzlex",w
=4,h
=4,startindex
=16})
1237 DefSubimages("st_puzzle_blue_hollow", {modelname
="st_puzzlex",w
=4,h
=4,startindex
=32})
1238 DefSubimages("st_puzzle_yellow_hollow", {modelname
="st_puzzlex",w
=4,h
=4,startindex
=48})
1240 for i
=0,31 do DefSolidStone("st_puzzle"..i
, "st_puzzlex"..i
) end
1242 for i
=32,63 do DefShModel("st_puzzle"..i
, "st_puzzlex"..i
, "sh_puzzle_hollow") end
1247 local images
= DefSubimages("st_flat", {h
=4})
1249 DefShModel("st_flat", images
[1], "sh_solid")
1250 -- flat stone fall anim
1251 DefAnim("st_flat_falling", BuildFrames(images
, 100))
1253 local images
= DefSubimages("st_flat_break", {h
=6})
1254 DefAnim("flat_break-anim", BuildFrames(images
, 50))
1255 DefSolidStone("st_flat_breaking", "flat_break-anim")
1256 DefAlias("st_plaster_breaking", "st_flat_breaking")
1258 DefStone("st_flat_cracked")
1260 DefStone("st_flat_fire")
1265 local images
= DefSubimages("st_rotator_ccw", {h
=8})
1266 DefAnim("st_rotator_ccw_anim", BuildFrames(images
, 70), false)
1267 DefRoundStone("st_rotator_ccw", "st_rotator_ccw_anim")
1268 local images
= DefSubimages("st_rotator_cw", {h
=8})
1269 DefAnim("st_rotator_cw_anim", BuildFrames(images
, 70), false)
1270 DefRoundStone("st_rotator_cw", "st_rotator_cw_anim")
1275 local images
= DefSubimages("st_scissors", {h
=2})
1276 DefRoundStone("st_scissors", images
[1])
1277 DefAnim("st_scissors_snip_anim", {{images
[2], 130}})
1278 DefShModel("st_scissors_snip", "st_scissors_snip_anim", "sh_round")
1283 DefImages
{"sh_shogun_s","sh_shogun_m", "sh_shogun_l"}
1284 DefSubimages("st_shogun", {modelname
="st-shogun-fg",h
=7})
1286 DefShModel("st_shogun1", "st-shogun-fg1", "sh_shogun_s")
1287 DefShModel("st_shogun2", "st-shogun-fg2", "sh_shogun_m")
1288 DefShModel("st_shogun3", "st-shogun-fg3", "sh_shogun_s")
1289 DefShModel("st_shogun4", "st-shogun-fg4", "sh_shogun_l")
1290 DefShModel("st_shogun5", "st-shogun-fg5", "sh_shogun_s")
1291 DefShModel("st_shogun6", "st-shogun-fg6", "sh_shogun_m")
1292 DefShModel("st_shogun7", "st-shogun-fg7", "sh_shogun_s")
1295 -- st_stoneimpulse --
1297 -- Note: It's important that the duration of the closing animation
1298 -- (anim2) is longer than the opening animation (anim1). Otherwise
1299 -- impulse stones do not work properly!
1301 local images
= DefSubimages("st_stoneimpulse", {h
=6})
1302 DefRoundStone("st_stoneimpulse", images
[1])
1303 DefRoundStone("st_stoneimpulse_steady", images
[6])
1305 for i
=1,4 do table.insert(frames
, images
[i
]) end
1306 DefAnim("stoneimpulse_anim1", BuildFrames(frames
, 55))
1307 DefRoundStone("st_stoneimpulse_anim1", "stoneimpulse_anim1")
1308 table.insert(frames
, images
[4]) -- add 1 frame to make closing anim longer!
1309 DefAnim("stoneimpulse_anim2", ReverseFrames(BuildFrames(frames
, 55)))
1310 DefRoundStone("st_stoneimpulse_anim2", "stoneimpulse_anim2")
1313 -- st_stoneimpulse_hollow --
1315 local images
= DefSubimages("st_stoneimpulse_hollow", {h
=4})
1316 local shadows
= DefSubimages("sh_stoneimpulse_hollow", {h
=4, imgw
=ShadowSize
, imgh
=ShadowSize
})
1321 table.insert(framesfg
, images
[i
])
1322 table.insert(framesbg
, shadows
[i
])
1325 DefShModel("st_stoneimpulse_hollow", framesfg
[1], framesbg
[1])
1327 DefAnim("stoneimpulse-hollow-anim1-fg", BuildFrames(framesfg
, 55))
1328 DefAnim("stoneimpulse-hollow-anim1-bg", BuildFrames(framesbg
, 55))
1329 DefShModel("st_stoneimpulse_hollow_anim1", "stoneimpulse-hollow-anim1-fg", "stoneimpulse-hollow-anim1-bg")
1331 table.insert(framesfg
, images
[4]) -- add 1 frame to make closing anim longer!
1332 table.insert(framesbg
, shadows
[4]) -- add 1 frame to make closing anim longer!
1334 DefAnim("stoneimpulse-hollow-anim2-fg", ReverseFrames(BuildFrames(framesfg
, 55)))
1335 DefAnim("stoneimpulse-hollow-anim2-bg", ReverseFrames(BuildFrames(framesbg
, 55)))
1336 DefShModel("st_stoneimpulse_hollow_anim2", "stoneimpulse-hollow-anim2-fg", "stoneimpulse-hollow-anim2-bg")
1338 images
= DefSubimages("st_stoneimpulse_break", {h
=8})
1339 DefAnim("st_stoneimpulse_breaking", BuildFrames(images
,50))
1342 -- st_switch, st_switch_black, st_switch_white --
1344 function mkswitch(modelname
, basename
)
1345 local n
= DefSubimages(modelname
, {h
=3, modelname
=basename
.."-fg"})
1346 local f
= BuildFrames(n
, 60)
1347 DefRoundStone(modelname
.."_off", n
[1])
1348 DefRoundStone(modelname
.."_on", n
[3])
1349 DefAnim(basename
.."_turnon", f
)
1350 DefAnim(basename
.."_turnoff", ReverseFrames(f
))
1351 DefRoundStone(modelname
.."_turnon", basename
.."_turnon")
1352 DefRoundStone(modelname
.."_turnoff", basename
.."_turnoff")
1354 mkswitch("st_switch", "switch")
1355 mkswitch("st_switch_black", "switch_black")
1356 mkswitch("st_switch_white", "switch_white")
1361 local images
= DefSubimages("st_timer", {h
=5})
1362 local timerframes
= {"st_timer3", "st_timer2", "st_timer1", "st_timer2", "st_timer3", "st_timer4", "st_timer5", "st_timer4"}
1363 DefAnim("timer_anim", BuildFrames(timerframes
, 120), 1)
1364 DefRoundStone("st_timer", "timer_anim")
1365 DefRoundStone("st_timeroff", "st_timer3")
1368 -- st_monoflop, st_laserswitch --
1370 local images
= DefSubimages("st_monoflop", {h
=2})
1371 DefRoundStone("st_monoflop", "st_monoflop1")
1372 DefAnim("st_monoflop_anim", BuildFrames (images
, 180), 1)
1373 DefShModel("st_monoflop_anim", "st_monoflop_anim", "sh_round")
1378 DefStone("st_laserswitch0", "sh_round", {filename
="st_oxydb"})
1379 local images
= DefSubimages("st_quake", {h
=4})
1380 local frames
= BuildFrames(RepeatAnim(PingPong(images
)), 50 )
1381 DefAnim("laserswitch-blink", frames
, true)
1382 DefShModel("st_laserswitch1", "laserswitch-blink", "sh_round")
1387 local images
= DefSubimages("st_turnstile", {h
=2})
1388 DefAnim("turnstile_anim", ReverseFrames(BuildFrames(images
, 30)))
1389 DefSolidStone("st_turnstile", images
[1])
1390 DefSolidStone("st_turnstile_anim", "turnstile_anim")
1392 DefAlias("st_turnstile_e", "st_puzzle1")
1393 DefAlias("st_turnstile_w", "st_puzzle4")
1394 DefAlias("st_turnstile_s", "st_puzzle8")
1395 DefAlias("st_turnstile_n", "st_puzzle2")
1398 -- st-turnstile-green --
1400 local images
= DefSubimages("st_turnstile_green", {h
=2})
1401 DefAnim("turnstile_green_anim", ReverseFrames(BuildFrames(images
, 30)))
1402 DefSolidStone("st_turnstile_green", images
[1])
1403 DefSolidStone("st_turnstile_green_anim", "turnstile_green_anim")
1406 -- growing stones, st_box, st_flhay, greenbrown seed, st-volcano, st-blocker --
1408 local shadows
=DefSubimages("sh_round_growing", {h
=3,imgw
=ShadowSize
,imgh
=ShadowSize
})
1412 DefSubimages("st_box_wood", {modelname
="st_box_wood_fg", h
=2})
1413 DefShModel("st_box_wood1", "st_box_wood_fg1", "sh_round")
1414 DefShModel("st_box_wood2", "st_box_wood_fg2", "sh_round")
1416 local images
=DefSubimages("st_box_wood_growing", {h
=3})
1417 DefAnim("st_box_wood_growing_fg", BuildFrames(images
, 130))
1418 DefAnim("st_box_wood_growing_bg", BuildFrames(shadows
, 130))
1419 DefShModel("st_box_wood_growing", "st_box_wood_growing_fg", "st_box_wood_growing_bg")
1422 -- Greenbrown stone --
1424 local images
= DefSubimages("st_greenbrown", {h
=4})
1426 DefShModel("st_greenbrown", images
[1], "sh_round")
1428 table.remove(images
, 1)
1429 DefAnim("st_greenbrown_growing_fg", ReverseFrames(BuildFrames(images
, 130)))
1430 DefAnim("st_greenbrown_growing_bg", BuildFrames(shadows
, 130))
1431 DefShModel("st_greenbrown_growing", "st_greenbrown_growing_fg", "st_greenbrown_growing_bg")
1436 local images
= DefSubimages("st_box_hay", {h
=4})
1438 DefShModel("st_box_hay", images
[1], "sh_round")
1440 table.remove(images
, 1)
1441 DefAnim("st_box_hay_growing_fg", ReverseFrames(BuildFrames(images
, 130)))
1442 DefAnim("st_box_hay_growing_bg", BuildFrames(shadows
, 130))
1443 DefShModel("st_box_hay_growing", "st_box_hay_growing_fg", "st_box_hay_growing_bg")
1446 -- Volcano growing --
1448 local images
= DefSubimages("st_volcano_growing", {h
=3})
1449 DefAnim("volcano-growing-fg", BuildFrames(images
, 80))
1450 DefAnim("volcano-growing-bg", BuildFrames(shadows
, 80))
1451 DefShModel("st_volcano_growing", "volcano-growing-fg", "volcano-growing-bg")
1456 local images
= DefSubimages("st_blocker", {h
=4})
1458 DefShModel("st_blocker", images
[1], "sh_round")
1460 DefAlias("it_blocker", images
[4])
1461 -- open/close animation
1464 table.insert(frames
, "st_blocker"..i
)
1466 DefAnim("blocker_growing_fg", BuildFrames(frames
, 60))
1467 DefAnim("blocker_growing_bg", BuildFrames(shadows
, 60))
1468 DefAnim("blocker_shrinking_fg", ReverseFrames(BuildFrames(frames
, 60)))
1469 DefAnim("blocker_shrinking_bg", ReverseFrames(BuildFrames(shadows
, 60)))
1470 DefShModel("st_blocker_shrinking", "blocker_shrinking_fg", "blocker_shrinking_bg");
1471 DefShModel("st_blocker_growing", "blocker_growing_fg", "blocker_growing_bg");
1477 local fg_window
= {blue
= DefSubimages("st_window_blue", {modelname
="fg-window_blue",w
=4,h
=4}),
1478 green
= DefSubimages("st_window_green", {modelname
="fg-window_green",w
=4,h
=4}) }
1479 local sh_window
= DefSubimages("sh_window", {w
=2,h
=4,imgw
=ShadowSize
,imgh
=ShadowSize
})
1480 local breaking_images
= {blue
= DefSubimages("st_window_blue_break", {h
=4}),
1481 green
= DefSubimages("st_window_green_break", {h
=4})}
1483 local function name(combination
, separator
)
1484 return combination
.normal_faces
..separator
..combination
.scratched_faces
1487 -- The window images are constructed in two steps.
1488 -- 1) All possible combinations of the shadows are constructed
1489 -- (for each direction: "no shadow", "normal face", "scratched face",
1490 -- represented as "0, 1, 2" in a table).
1491 -- 2) Using the table of all possible combinations, all images
1492 -- and animations of the window stones are constructed.
1493 -- Step 1 works as follows: We start with direction 1 (West),
1494 -- and all three possibilities for shadows to the West. At this
1495 -- point, the images for shadows to West only are build.
1496 -- As next, for each of the three West-possibilities, we
1497 -- construct the South-possibilities, i.e. we now have 3*3 combinations
1498 -- and 3*3-1 shadow-images. We continue with East and North.
1499 -- The table "all_combinations" is after each pass of the "direction"-loop:
1501 -- 1) {{0}, {1}, {2}}
1502 -- 2) {{0,0}, {0,1}, {0,2}, {1,0}, {1,1}, {1,2}, {2,0}, {2,1}, {2,2}}
1503 -- 3) {{0,0,0}, {0,0,1}, {0,0,2}, {0,1,0}, {0,1,1}, ... }
1504 -- 4) {{0,0,0,0}, {0,0,0,1}, {0,0,0,2}, {0,0,1,0}, ... }
1505 -- Plus extra entries to count the number of normal_faces and
1506 -- scratched_faces (to be exactly, the numbers binarily represent
1507 -- the existence of the face).
1508 local all_combinations
= {{normal_faces
= 0, scratched_faces
= 0}}
1509 DefAlias("sh_window0-0", "invisible")
1510 local base
= {0, 1, 2}
1511 for direction
= 1, 4 do
1512 local next_list
= {}
1513 for _
, old_combination
in pairs(all_combinations
) do
1514 for _
, new_digit
in pairs(base
) do
1515 -- Deep-copy old_combination to new_combination.
1516 local new_combination
= {}
1517 for k
, digit
in pairs(old_combination
) do
1518 new_combination
[k
] = digit
1520 -- Add a new digit to new_combination and save it.
1521 new_combination
[direction
] = new_digit
1522 table.insert(next_list
, new_combination
)
1523 -- If this combination adds a new face, create
1524 -- the corresponding composite image, based on the
1525 -- image of old_combination.
1526 if new_digit
~= 0 then
1527 -- First, increase the "number" of faces.
1528 if new_digit
== 1 then
1529 new_combination
.normal_faces
= new_combination
.normal_faces
1530 + ({1,2,4,8})[direction
]
1531 elseif new_digit
== 2 then
1532 new_combination
.scratched_faces
= new_combination
.scratched_faces
1533 + ({1,2,4,8})[direction
]
1535 -- Now compose the shadow image.
1536 display
.DefineComposite(
1537 "sh_window"..name(new_combination
, "-"),
1538 "sh_window"..name(old_combination
, "-"),
1539 "sh_window"..(direction
+ ({0,4})[new_digit
]))
1543 all_combinations
= next_list
1546 for _
, combination
in pairs(all_combinations
) do
1547 -- Abbreviations. Note that sometimes "-" and sometimes "_" is
1548 -- used as separator. Don't expect a pattern.
1549 local total_faces
= combination
.normal_faces
+ combination
.scratched_faces
1550 local name1
= name(combination
, "-")
1551 local name2
= name(combination
, "_")
1552 for _
, color
in pairs({"blue", "green"}) do
1553 -- Normal stone (= not breaking)
1554 DefShModel("st_window_"..color
..name2
,
1555 "fg-window_"..color
..(total_faces
+ 1),
1557 -- Breaking animation
1558 local breaking_window_names
= {}
1559 for j
= 1, table.getn(breaking_images
[color
]) do
1560 breaking_window_names
[j
] =
1561 "st-window_"..color
.."_breaking"..name1
.."-"..j
1562 display
.DefineComposite(breaking_window_names
[j
],
1563 fg_window
[color
][total_faces
+ 1],
1564 breaking_images
[color
][j
])
1566 local frames
= BuildFrames(breaking_window_names
, 130)
1567 DefAnim("st-window_"..color
..name2
.."_anim_fg", frames
)
1568 DefShModel("st_window_"..color
..name2
.."_anim",
1569 "st-window_"..color
..name2
.."_anim_fg",
1570 "sh_window"..name1
);
1579 -- Oxyd stones occur in different colors and different flavors and
1580 -- for each combination of these two attributes we need animations
1581 -- for the following internal states or state transitions:
1583 -- (a) opening and closing
1587 -- Creating the required image files by hand would be tedious, so
1588 -- we use a couple of specialized functions and overlays to create
1589 -- them automatically.
1592 local num_colors
= 12
1594 -- Some images we will need later on
1595 local colordots
= DefSubimages("st_oxyd_colordots", {w
=4,h
=4})
1596 local questmark
= DefImage("st_oxyd_questmark")
1597 local blink_ovals
= DefSubimages("st_oxyd_blink", {w
=1,h
=5})
1598 local quake_spot
= DefSubimages("st_oxyd_quake", {w
=1,h
=4})
1599 local shuffle_spot
= DefSubimages("st_oxyd_shuffle", {w
=1,h
=8})
1600 local oxyde
= DefImage("st_oxyde")
1602 -- Define "fading in" and "fading out" animations for oxyd stones.
1603 -- These two animations are combined with the stone images to
1604 -- produce the opening and closing animations for oxyd stones.
1617 local shadow_open
= {
1624 a
= BuildFrames(DefSubimages("st_oxyda_opening", {h
=10}), 35),
1625 b
= BuildFrames(DefSubimages("st_oxydb_opening", {h
=14}), 25),
1626 c
= BuildFrames(DefSubimages("st_oxydc_opening", {h
=5}), 70),
1627 d
= BuildFrames(DefSubimages("st_oxydd_opening", {h
=10}), 35),
1630 a
= ReverseFrames(fopening
["a"]),
1631 b
= ReverseFrames(fopening
["b"]),
1632 c
= ReverseFrames(fopening
["c"]),
1633 d
= ReverseFrames(fopening
["d"]),
1636 -- The open/close animation of oxyd stones
1637 function mkopenclose(flavor
, color
)
1638 local name
= "st_oxyd" .. flavor
.. color
1639 local fadein
= "oxyd"..flavor
.."_fadein"
1640 local fadeout
= "oxyd"..flavor
.."_fadeout"
1641 -- Magic numbers for pseudo oxyds which need model number "-3" and "-4"
1642 -- but are subimage #15 and #16
1646 DefMultipleComposite(name
.."_base", {baseimg
[flavor
], colordots
[color
+1]})
1647 DefMultipleComposite(name
.."_opening_fg", {name
.."_base", fadein
})
1648 DefMultipleComposite(name
.."_closing_fg", {name
.."_base", fadeout
})
1649 DefShModel (name
.."_opening", name
.."_opening_fg", shadow
[flavor
])
1650 DefShModel (name
.."_closing", name
.."_closing_fg", shadow
[flavor
])
1653 -- The blinking question mark animation of single open oxyds
1654 function mkblink(flavor
, color
)
1655 local name
= "st_oxyd"..flavor
..color
.."_blink"
1656 DefMultipleComposite(name
..1, {baseimg
[flavor
], colordots
[color
+1], questmark
})
1657 DefMultipleComposite(name
..2, {baseimg
[flavor
], colordots
[color
+1]})
1658 DefAnim(name
.."_anim", ComposeFrames({name
..1,name
..2}, {800, 1200}), true)
1659 DefShModel(name
, name
.."_anim", shadow_open
[flavor
])
1662 -- The animation of pairwise open oxyds
1663 function mkopened(flavor
, color
)
1664 local name
= "st_oxyd" .. flavor
.. color
.. "_open"
1667 names
[i
] = name
.. i
1668 DefMultipleComposite(names
[i
], {baseimg
[flavor
], colordots
[color
+1], blink_ovals
[i
]})
1670 DefAnim(name
.."_anim", PingPong(BuildFrames(names
, 100)), true)
1671 DefShModel(name
, name
.."_anim", shadow_open
[flavor
])
1674 -- The "open" state animation of the pseudo oxyds "quake" and "shuffle"
1675 function mkpseudo(flavor
, color
)
1676 local name
= "st_oxyd" .. flavor
.. "_pseudo" .. color
1678 if (color
== -3) then
1680 names
[i
] = name
.. i
1681 DefMultipleComposite(names
[i
], {baseimg
[flavor
], quake_spot
[i
]})
1683 frames
= RepeatAnim(PingPong(BuildFrames(names
, 50)), 2)
1684 elseif (color
== -4) then
1686 names
[i
] = name
.. i
1687 DefMultipleComposite(names
[i
], {baseimg
[flavor
], shuffle_spot
[i
]})
1689 frames
= RepeatAnim(BuildFrames(names
, 100),2)
1691 DefAnim(name
.."_anim", frames
, false)
1692 DefShModel(name
, name
.."_anim", shadow
[flavor
])
1695 -- Now really make the oxyds, calling the functions defined above
1696 function mkoxyd(flavor
)
1697 DefStone("st_oxyd"..flavor
, shadow
[flavor
])
1698 DefShModel("st_fake_oxyd"..flavor
, "st_oxyd"..flavor
, shadow
[flavor
])
1699 local img
= DefImage("st_oxyd"..flavor
.."_open")
1700 DefShModel("st_fake_oxyd"..flavor
.."_open", img
, shadow
[flavor
])
1701 local fadein
= "oxyd"..flavor
.."_fadein"
1702 local fadeout
= "oxyd"..flavor
.."_fadeout"
1703 DefAnim(fadein
, fopening
[flavor
])
1704 DefAnim(fadeout
, fclosing
[flavor
])
1705 -- The regular oxyds are position 1 to 12 in the
1707 for color
= 0, num_colors
do
1708 mkopenclose(flavor
, color
)
1709 mkblink(flavor
, color
)
1710 mkopened(flavor
, color
)
1712 -- Position 13, 14 are currently empty
1713 -- The shuffle and quake oxyds are number 15
1714 -- and 16 in colordots image.
1715 -- BUT they require modelnames with "-3" and "-4"
1716 mkopenclose(flavor
, -3)
1717 mkpseudo(flavor
, -3)
1718 mkopenclose(flavor
, -4)
1719 mkpseudo(flavor
, -4)
1722 -- Make all the models and animations for the oxyd flavors a,b,c,d
1728 -- And now for flavor 'e'
1729 for color
= 0, num_colors
- 1 do
1730 DefMultipleComposite("st_oxyde"..color
.."_peep", {"st_oxydb_open", colordots
[color
+1], oxyde
})
1731 DefShModel("st_oxyde"..color
, "st_oxyde"..color
.."_peep", "sh_round")
1732 DefAlias("st_oxyde"..color
.."_opening", "st_oxydb"..color
.."_opening")
1733 DefAlias("st_oxyde"..color
.."_closing", "st_oxydb"..color
.."_closing")
1734 DefAlias("st_oxyde"..color
.."_blink", "st_oxydb"..color
.."_blink")
1735 DefAlias("st_oxyde"..color
.."_open", "st_oxydb"..color
.."_open")
1737 DefMultipleComposite("st_oxyde-3_peep", {"st_oxydb_open", colordots
[16], oxyde
})
1738 DefShModel("st_oxyde-3", "st_oxyde-3_peep", "sh_round")
1739 DefMultipleComposite("st_oxyde-4_peep", {"st_oxydb_open", colordots
[15], oxyde
})
1740 DefShModel("st_oxyde-4", "st_oxyde-4_peep", "sh_round")
1741 DefAlias("st_oxyde", "st_oxydb")
1742 DefAlias("st_fake_oxyde", "st_oxydb")
1743 DefAlias("st_fake_oxyde_open", "st_fake_oxydb_open")
1744 DefAlias("st_oxyde-3_opening", "st_oxydb-3_opening")
1745 DefAlias("st_oxyde_pseudo-3", "st_oxydb_pseudo-3")
1746 DefAlias("st_oxyde-3_closing", "st_oxydb-3_closing")
1747 DefAlias("st_oxyde-4_opening", "st_oxydb-4_opening")
1748 DefAlias("st_oxyde_pseudo-4", "st_oxydb_pseudo-4")
1749 DefAlias("st_oxyde-4_closing", "st_oxydb-4_closing")
1754 DefAlias("st_magic_brick", "st_brick0")
1755 DefAlias("st_magic_oxyda", "st_oxyda")
1756 DefAlias("st_magic_oxydc", "st_oxydc")
1761 local img
= DefSubimages("st_door_d_ns", {h
=7})
1762 local sh
= DefSubimages("sh_doorh", {h
=7,imgw
=ShadowSize
,imgh
=ShadowSize
})
1763 DefShModel("st_door_d_ns_open", img
[1], sh
[1])
1764 DefShModel("st_door_d_ns_closed", img
[7], sh
[7])
1765 DefAnim("doorh-opening-fg", ReverseFrames(BuildFrames(img
, 60)))
1766 DefAnim("doorh-opening-bg", ReverseFrames(BuildFrames(sh
, 60)))
1767 DefShModel("st_door_d_ns_opening", "doorh-opening-fg", "doorh-opening-bg")
1768 DefAnim("doorh-closing-fg", BuildFrames(img
, 60))
1769 DefAnim("doorh-closing-bg", BuildFrames(sh
, 60))
1770 DefShModel("st_door_d_ns_closing", "doorh-closing-fg", "doorh-closing-bg")
1772 img
= DefSubimages("st_door_d_ew", {w
=7})
1773 sh
= DefSubimages("sh_doorv", {w
=7,imgw
=ShadowSize
,imgh
=ShadowSize
})
1774 DefShModel("st_door_d_ew_open", img
[1], sh
[1])
1775 DefShModel("st_door_d_ew_closed", img
[7], sh
[7])
1776 DefAnim("doorv-opening-fg", ReverseFrames(BuildFrames(img
, 60)))
1777 DefAnim("doorv-opening-bg", ReverseFrames(BuildFrames(sh
, 60)))
1778 DefShModel("st_door_d_ew_opening", "doorv-opening-fg", "doorv-opening-bg")
1779 DefAnim("doorv-closing-fg", BuildFrames(img
, 60))
1780 DefAnim("doorv-closing-bg", BuildFrames(sh
, 60))
1781 DefShModel("st_door_d_ew_closing", "doorv-closing-fg", "doorv-closing-bg")
1786 DefAlias("st_door_a_open", "st_grate_cross")
1787 DefAlias("st_door_a_closed", "st_oxyda")
1788 local f
= BuildFrames({"st_door_a_closed", "st_door_a_open"},60)
1789 DefAnim("st_door_a_opening", f
)
1790 DefAnim("st_door_a_closing", ReverseFrames(f
))
1795 DefAlias("st_door_b_open", "invisible")
1796 DefAlias("st_door_b_closed", "st_flat")
1797 local img
= DefSubimages("st_door_b", {modelname
="doorb", h
=8})
1798 local f
= BuildFrames(img
,60)
1799 DefAnim("st_door_b_opening", f
)
1800 DefAnim("st_door_b_closing", ReverseFrames(f
))
1805 DefAlias("st_door_c_open", "st_grate_framed")
1806 DefAlias("st_door_c_closed", "st_flat")
1807 frames
= BuildFrames({"st_door_c_closed","st_door_c_open"},60)
1808 DefAnim("st_door_c_opening", frames
)
1809 DefAnim("st_door_c_closing", ReverseFrames(frames
))
1814 DefStone("st_quake", "sh_round", {filename
="st_oxydb"})
1815 local images
= DefSubimages("st_quake", {h
=4})
1816 local frames
= BuildFrames(RepeatAnim(PingPong(images
)), 50)
1817 DefAnim("quaking", frames
)
1818 DefShModel("st_quaking", "quaking", "sh_round")
1819 local namelist
= DefSubimages("st_quake_break",{h
=6})
1820 DefAnim("quakebreak_anim", BuildFrames(namelist
,50))
1821 DefRoundStone("st_quakebreak_anim", "quakebreak_anim")
1826 local images
= DefSubimages("st_spitter_idle", {h
=6})
1827 local frames
= BuildFrames(images
,150)
1828 DefAnim("st_spitter_active", frames
, true)
1829 DefShModel("st_spitter_active", "st_spitter_active", "sh_round")
1830 DefShModel("st_spitter_idle", "st_spitter_idle1", "sh_round")
1832 local images
= DefSubimages("st_spitter_spitting", {h
=6})
1833 local frames
= BuildFrames(images
,175)
1834 DefAnim("st_spitter_spitting", frames
)
1835 DefShModel("st_spitter_spitting", "st_spitter_spitting", "sh_round")
1837 local images
= DefSubimages("st_spitter_loading", {h
=6})
1838 local frames
= BuildFrames(images
,100)
1840 DefAnim("st_spitter_loading", frames
)
1841 DefShModel("st_spitter_loading", "st_spitter_loading", "sh_round")
1843 local images
= DefSubimages("st_spitter_breaking", {h
=6})
1844 local frames
= BuildFrames(images
,100)
1845 DefAnim("st_spitter_breaking", frames
)
1846 DefShModel("st_spitter_breaking", "st_spitter_breaking", "sh_round")
1850 ---------------------------
1851 -- Thief stone and floor --
1852 ---------------------------
1856 local stonebase
= "st_bluegray"
1857 local floorbase
= "fl_bluegray"
1858 local thiefovl
= DefSubimages("thief_template", {h
= 7})
1859 local captureovl
= DefSubimages("thief_capture_template", {h
= 12})
1860 local drunkenovl
= DefSubimages("thief_drunken_template", {h
= 2})
1862 -- Creating st-thief
1865 for j
= 1, table.getn(thiefovl
) do
1866 names
[j
] = "st_thief"..format("_%04d", j
)
1867 display
.DefineComposite(names
[j
], stonebase
, thiefovl
[j
])
1870 local f1
= BuildFrames(names
, 80)
1871 DefAnim("pre_st_thief_emerge", f1
)
1872 DefAnim("pre_st_thief_retreat", ReverseFrames(f1
))
1873 DefRoundStone("st_thief", stonebase
)
1874 DefRoundStone("st_thief_emerge", "pre_st_thief_emerge")
1875 DefRoundStone("st_thief_retreat", "pre_st_thief_retreat")
1878 for j
= 1, table.getn(drunkenovl
) do
1879 names
[j
] = "st_thief_drunken"..format("%04d", j
)
1880 display
.DefineComposite(names
[j
], stonebase
, drunkenovl
[j
])
1883 local f5
= BuildFrames(names
, 3000)
1884 DefAnim("pre_st_thief_drunken", f5
, true)
1885 DefRoundStone("st_thief_drunken", "pre_st_thief_drunken")
1887 -- Creating st_thief_capture
1889 -- Note that this is done without template, as the whole
1890 -- stone has to disappear (e.g. via shrinking)
1892 local img2
= DefSubimages("st_thief_capture", {h
= 12})
1893 local f2
= BuildFrames(img2
, 80)
1894 DefAnim("st_thief_capture", f2
)
1896 -- Creating fl-thief
1898 local floornames
= {}
1899 local floorcapture
= {}
1900 local floordrunken
= {}
1901 local floorbases
= DefSubimages(floorbase
, {h
=4, modelname
="fl_thief_base"})
1904 for j
= 1, table.getn(thiefovl
) do
1905 floornames
[k
][j
] = "fl_thief"..k
..format("_%04d", j
)
1906 display
.DefineComposite(floornames
[k
][j
], floorbases
[k
], thiefovl
[j
])
1908 floorcapture
[k
] = {}
1909 for j
= 1, table.getn(captureovl
) do
1910 floorcapture
[k
][j
] = "fl_thief"..k
.."_capture"..format("_%04d", j
)
1911 display
.DefineComposite(floorcapture
[k
][j
], floorbases
[k
], captureovl
[j
])
1913 floordrunken
[k
] = {}
1914 for j
= 1, table.getn(drunkenovl
) do
1915 floordrunken
[k
][j
] = "fl-thief"..k
.."-drunken"..format("_%04d", j
)
1916 display
.DefineComposite(floordrunken
[k
][j
], floorbases
[k
], drunkenovl
[j
])
1918 local f3
= BuildFrames(floornames
[k
], 80)
1919 local f4
= BuildFrames(floorcapture
[k
], 80)
1920 local f6
= BuildFrames(floordrunken
[k
], 3000)
1921 DefAlias("fl_thief"..k
, floorbases
[k
])
1922 DefAnim("fl_thief"..k
.."_emerge", f3
)
1923 DefAnim("fl_thief"..k
.."_retreat", ReverseFrames(f3
))
1924 DefAnim("fl_thief"..k
.."_capture", f4
)
1925 DefAnim("fl_thief"..k
.."_drunken", f6
, true)
1933 -- naming scheme for mirror models:
1935 -- st-{3mirror,pmirror}-{m,s}{o,t}[1234]
1937 -- {m,s} -> movable or static
1938 -- {o,t,f} -> opaque or pane transparent or full transparent (pane + side)
1940 -- The numbers map to actual orientations as follows:
1942 -- NUMBER ORIENTATION TRIANG.M. PLANE M.
1948 -- The models are stored in the file from top to bottom as north, east, south, west
1949 -- in each column, therefore we need the mapping (i+1)%4+1
1951 local mst
= DefSubimages("st_mirror_static", {w
=5,h
=4})
1952 local mmo
= DefSubimages("st_mirror_movable", {w
=5,h
=4})
1953 local names_st
= {"st-3mirror-so", "st-3mirror-st", "st-pmirror-so", "st-pmirror-st", "st-pmirror-sf"}
1954 local names_mo
= {"st-3mirror-mo", "st-3mirror-mt", "st-pmirror-mo", "st-pmirror-mt", "st-pmirror-mf"}
1958 DefShModel(names_st
[j
+1]..((i
+1)%4+1), mst
[j
*4+i
], "sh_rounded")
1964 DefShModel(names_mo
[j
+1]..((i
+1)%4+1), mmo
[j
*4+i
], "sh_rounded")
1969 --------------------------
1970 -- Simple stone aliases --
1971 --------------------------
1973 DefAlias("st_break_bug-anim", "st_flat_breaking")
1974 DefAlias("st-glass_move", "st-glass");
1975 DefAlias("st_break_laser", "st_flat")
1976 DefAlias("st_break_laser-anim", "st_flat_breaking")
1977 DefAlias("st_blur_magic", "st_blur_cross")
1980 -- Invisible stones --
1982 DefAlias("st-actorimpulse_invisible", "invisible")
1983 DefAlias("st_death_invisible", "invisible")
1984 DefAlias("st_invisible", "invisible")
1989 local items
= {"it_bag", "it_banana", "it_bottle", "it_brake",
1990 "it_brush", "it_cherry", "it_coffee", "it_coin", "it_coin_s", "it_coin_m",
1991 "it_coin_l", "it_document", "it_drop", "it_dynamite", "it_extinguisher",
1992 "it_extinguisher_empty", "it_extinguisher_full", "it_extinguisher_medium",
1993 "it_extralife", "it_flag", "it_flag_black", "it_flag_white",
1994 "it_floppy", "it_glasses", "it_glasses_broken", "it_hammer", "it_key",
1995 "it_magicwand", "it_pencil", "it_pin",
1996 "it_puller", "it_puller_w", "it_puller_s", "it_puller_e", "it_puller_n",
1997 "it_ring", "it_rubberband", "it_seed", "it_seed_wood", "it_seed_hay",
1998 "it_seed_greenbrown", "it_seed_volcano",
1999 "it_spade", "it_spoon", "it_spring", "it_spring_keep", "it_spring_drop",
2000 "it_springboard", "it_surprise", "it_sword", "it_umbrella", "it_weight",
2001 "it_wrench", "it_yinyang"}
2002 local stonebase
= DefImage("st_barrier")
2003 for _
, it
in pairs(items
) do
2004 display
.DefineComposite("st_barrier_"..it
.."_fg", stonebase
, it
)
2005 DefShModel("st_barrier_"..it
, "st_barrier_"..it
.."_fg", "sh_solid")
2007 -- Pipe barriers need an extra solution as they use models that are different from the pipe item models
2008 local pipes
= {"pipe_w", "pipe_s", "pipe_sw", "pipe_e", "pipe_ew", "pipe_es", "pipe_n",
2009 "pipe_nw", "pipe_ns", "pipe_ne", "pipe"}
2010 for _
, it
in pairs(pipes
) do
2011 display
.DefineComposite("st_barrier_it_"..it
.."_fg", stonebase
, it
)
2012 DefShModel("st_barrier_it_"..it
, "st_barrier_it_"..it
.."_fg", "sh_solid")
2014 -- Bomb barriers need an extra solution as they use models that are different from the bomb item models
2015 local bombs
= {"bomb", "bomb_black", "bomb_white"}
2016 for _
, it
in pairs(bombs
) do
2017 display
.DefineComposite("st_barrier_it_"..it
.."_fg", stonebase
, it
)
2018 DefShModel("st_barrier_it_"..it
, "st_barrier_it_"..it
.."_fg", "sh_solid")
2020 -- And the all-blocking barrier
2021 DefShModel("st_barrier_all", stonebase
, "sh_solid")
2024 --------------------------------------------------------------------------------
2025 -- Sprite Effects --
2026 --------------------------------------------------------------------------------
2027 Progress(95, "Loading Sprite Effects")
2037 name
= "ac-drowned",
2052 name
= "halo-blink",
2058 -- Halo for small balls --
2060 name
= "halo-small",
2067 name
= "halo-small-blink",
2073 Progress(100, "Loading Enigma Levels")