From: Matthias Braun Date: Wed, 19 Apr 2006 15:18:30 +0000 (+0000) Subject: more work on worldmap switching X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=7cf5d7c12c212819c17041832d181842842d6cf8;p=supertux.git more work on worldmap switching SVN-Revision: 3370 --- diff --git a/data/levels/test/script.stl b/data/levels/test/script.stl index 581a84104..7c6846b68 100644 --- a/data/levels/test/script.stl +++ b/data/levels/test/script.stl @@ -1,147 +1,13 @@ -;; Generated by Flexlay Editor (supertux-level (version 2) - (name (_ "Scripting Test")) + (name (_ "Scripting Test")) (author "Development Team") (sector - (name "main") - (music "salcon.ogg") - (gravity 10.000000) - (tilemap - (layer "background") - (solid #f) - (speed 1.000000) - (width 25) - (height 20) - (tiles - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 - 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 - 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 - 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 - 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 - 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 - 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 - 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 - 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 - 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 - )) - (tilemap - (layer "interactive") - (solid #t) - (speed 1.000000) - (width 25) - (height 20) - (tiles - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 122 209 209 123 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 124 98 98 125 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 124 98 98 125 0 0 0 0 0 0 0 0 0 - 0 0 122 123 0 0 0 0 0 0 0 0 124 98 98 125 0 0 0 0 0 1348 0 0 0 - 0 0 124 125 0 0 0 0 0 0 0 0 124 98 98 125 0 0 122 123 0 79 0 0 0 - 0 0 124 125 0 0 0 0 0 0 0 0 124 98 98 125 0 0 124 125 0 79 0 0 0 - 0 0 1345 1344 0 0 0 0 0 0 0 0 1345 1346 1346 1344 0 0 1345 1344 0 1349 0 0 0 - 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - )) - (tilemap - (layer "foreground") - (solid #f) - (speed 1.000000) - (width 25) - (height 20) - (tiles - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 1321 1322 1323 1324 0 0 0 0 0 0 0 0 0 1321 1322 1323 1324 0 0 0 0 0 0 0 - 0 1325 1326 1327 1328 0 0 0 0 0 0 0 0 0 1325 1326 1327 1328 0 0 0 0 0 0 0 - 0 1329 1330 1331 1332 0 0 1350 0 0 0 0 0 0 1329 1330 1331 1332 0 0 0 0 0 0 0 - 0 1333 1334 1335 1336 0 0 0 0 0 0 0 0 0 1333 1334 1335 1336 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - )) - (camera - (mode "normal") - ) - - (background - (image "images/background/semi_arctic.jpg") - (speed 0.500000) - ) - (spawnpoint (name "main") (x 320) (y 416)) - (particles-snow - ) - (ambient_sound (x 674) (y 390) (distance_factor 0.01) - (distance_bias 200.0) (sample "phone") - ) - (infoblock (x 674) (y 390) - (message (_ "-VoiceMail -# -#(Play phone digit noises) -#(Play Nolok Sound) -#(Display text) -#Tux, I have captured -#Penny. -# -")) - ) - (scriptedobject - (name "TUX") - (x 160) - (y 448) - (sprite "images/creatures/yeti/yeti.sprite") - ) - (scriptedobject - (name "PENNY") - (x 390) - (y 448) - (sprite "images/creatures/dummyguy/dummyguy.sprite") - ) - (scriptedobject - (name "NOLOK") - (x 420) - (y 94) - (sprite "images/creatures/dummyguy/dummyguy.sprite") - (visible #f) - (physic-enabled #f) - (solid #f) - ) - (init-script " - - local logo = FloatingImage(\"images/objects/logo/logo.sprite\"); - - logo.set_visible(true); + (name "main") + (music "salcon.ogg") + (init-script " +local logo = FloatingImage(\"images/objects/logo/logo.sprite\"); +logo.set_visible(true); Text.set_text(translate(\"The Crazy Nolok Dance\")); Text.fade_in(2); @@ -152,31 +18,117 @@ wait(1); NOLOK.set_visible(true); tuxjumps <- 2; while(true) { - wait(0.8); - Sound.play(\"sounds/jump.wav\"); - if(tuxjumps >= 0) { - TUX.set_velocity(50, 300); - } else { - TUX.set_velocity(-50, 300); - if(tuxjumps < -2) - tuxjumps = 3; - } - tuxjumps--; - wait(0.5); - if(PENNY.get_action() == \"stand\") { - PENNY.set_action(\"throw\"); - } else if(PENNY.get_action() == \"throw\") { - PENNY.set_action(\"jump\"); - } else if(PENNY.get_action() == \"jump\") { - PENNY.set_action(\"dead\"); - } else { - Sound.play(\"sounds/grow.wav\"); - PENNY.set_action(\"stand\"); - PENNY.set_velocity(0, 900); - } + wait(0.8); + Sound.play(\"sounds/jump.wav\"); + if(tuxjumps >= 0) { + TUX.set_velocity(50, 300); + } else { + TUX.set_velocity(-50, 300); + if(tuxjumps < -2) + tuxjumps = 3; + } + tuxjumps--; + wait(0.5); + if(PENNY.get_action() == \"stand\") { + PENNY.set_action(\"throw\"); + } else if(PENNY.get_action() == \"throw\") { + PENNY.set_action(\"jump\"); + } else if(PENNY.get_action() == \"jump\") { + PENNY.set_action(\"dead\"); + } else { + Sound.play(\"sounds/grow.wav\"); + PENNY.set_action(\"stand\"); + PENNY.set_velocity(0, 900); + } } ") - ) - ) - -;; EOF ;; + (background + (image "images/background/semi_arctic.jpg") + (speed 0.5) + ) + (camera + (mode "normal") + ) + (spawnpoint + (name "main") + (x 320) + (y 416) + ) + (infoblock + (message "-VoiceMail +# +#(Play phone digit noises) +#(Play Nolok Sound) +#(Display text) +#Tux, I have captured +#Penny. +# +") + (x 674) + (y 390) + ) + (scriptedobject + (name "TUX") + (visible #t) + (physic-enabled #f) + (solid #f) + (x 160) + (y 448) + (sprite "images/creatures/yeti/yeti.sprite") + ) + (scriptedobject + (name "PENNY") + (visible #t) + (physic-enabled #f) + (solid #f) + (x 390) + (y 448) + (sprite "images/creatures/dummyguy/dummyguy.sprite") + ) + (scriptedobject + (name "NOLOK") + (visible #f) + (physic-enabled #f) + (solid #f) + (x 420) + (y 94) + (sprite "images/creatures/dummyguy/dummyguy.sprite") + ) + (ambient_sound + (sample "phone") + (distance_factor 0.01) + (distance_bias 200) + (volume 0) + (width 32) + (height 32) + (x 674) + (y 390) + ) + (particles-snow + ) + (tilemap + (layer "background") + (solid #f) + (speed 1) + (width 25) + (height 20) + (tiles 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342) + ) + (tilemap + (layer "interactive") + (solid #t) + (speed 1) + (width 25) + (height 20) + (tiles 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 122 209 209 123 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124 98 98 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124 98 98 125 0 0 0 0 0 0 0 0 0 0 0 122 123 0 0 0 0 0 0 0 0 124 98 98 125 0 0 0 0 0 1348 0 0 0 0 0 124 125 0 0 0 0 0 0 0 0 124 98 98 125 0 0 122 123 0 79 0 0 0 0 0 124 125 0 0 0 0 0 0 0 0 124 98 98 125 0 0 124 125 0 79 0 0 0 0 0 1345 1344 0 0 0 0 0 0 0 0 1345 1346 1346 1344 0 0 1345 1344 0 1349 0 0 0 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 1342 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + ) + (tilemap + (layer "foreground") + (solid #f) + (speed 1) + (width 25) + (height 20) + (tiles 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1321 1322 1323 1324 0 0 0 0 0 0 0 0 0 1321 1322 1323 1324 0 0 0 0 0 0 0 0 1325 1326 1327 1328 0 0 0 0 0 0 0 0 0 1325 1326 1327 1328 0 0 0 0 0 0 0 0 1329 1330 1331 1332 0 0 1350 0 0 0 0 0 0 1329 1330 1331 1332 0 0 0 0 0 0 0 0 1333 1334 1335 1336 0 0 0 0 0 0 0 0 0 1333 1334 1335 1336 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + ) + ) +) diff --git a/data/levels/world1/world.nut b/data/levels/world1/world.nut index 278e7ac85..c9e608b31 100644 --- a/data/levels/world1/world.nut +++ b/data/levels/world1/world.nut @@ -5,10 +5,12 @@ if(! ("intro_displayed" in state)) { state.intro_displayed <- true; save_state(); } -load_worldmap("levels/world1/worldmap.stwm"); +if(! ("world" in state)) { + println("No worldfound"); + state.world <- "levels/world1/worldmap.stwm"; + save_state(); +} +load_worldmap(state.world); fadeout_screen(0.5); wait_for_screenswitch(); save_state(); -wait_for_screenswitch(); -save_state(); -print("Goodbye from world1\n"); diff --git a/data/levels/world1/worldmap.stwm b/data/levels/world1/worldmap.stwm index dfc2f33d8..647b7f210 100644 --- a/data/levels/world1/worldmap.stwm +++ b/data/levels/world1/worldmap.stwm @@ -5,14 +5,6 @@ (sector (name "main") (music "music/salcon.ogg") - (tilemap - (layer "interactive") - (solid #t) - (speed 1) - (width 80) - (height 30) - (tiles 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 12 11 16 16 16 16 12 9 9 9 9 11 16 16 16 12 9 14 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 16 16 22 19 17 15 24 25 25 26 23 16 12 9 9 15 19 58 19 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 22 19 19 19 20 18 13 15 31 32 32 34 26 19 23 16 12 15 19 59 19 17 9 11 16 16 16 16 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 24 25 26 20 13 9 9 15 31 35 29 29 28 19 19 60 17 14 21 47 20 13 11 22 24 25 25 26 23 12 11 16 16 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 31 32 27 17 11 16 16 22 30 28 19 48 40 40 40 39 17 9 15 47 17 11 22 19 30 29 29 28 19 23 22 19 19 23 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 31 32 27 23 22 19 19 19 19 19 19 47 19 19 19 47 23 16 22 47 23 22 48 40 40 40 40 40 39 24 25 25 25 26 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 30 29 28 48 40 40 43 40 40 40 40 44 39 69 40 44 40 43 40 44 40 43 42 24 25 25 25 26 47 30 29 29 36 27 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 19 19 60 68 19 19 47 24 25 25 26 19 47 19 19 19 19 47 20 18 21 47 19 30 36 32 35 28 37 40 40 39 30 28 23 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 18 21 24 25 25 26 47 31 32 32 27 19 37 40 40 40 40 42 17 9 15 37 40 39 30 29 28 19 19 19 60 41 40 71 19 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 31 32 32 27 47 31 32 32 27 20 18 18 18 18 18 18 13 9 14 18 21 47 19 19 48 40 40 40 40 42 19 19 19 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 30 29 29 28 47 30 29 29 28 17 9 9 9 9 11 16 16 16 12 9 15 37 40 40 42 19 19 19 20 18 18 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 21 19 19 48 42 20 18 18 18 13 9 9 9 9 15 49 50 51 17 9 14 18 18 18 18 18 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 12 9 14 21 19 47 19 17 9 9 9 9 9 9 9 9 15 52 53 54 17 9 9 9 11 16 16 16 16 16 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 13 11 12 14 21 41 40 73 74 74 74 74 74 74 74 74 75 77 76 57 73 74 74 74 75 40 40 40 40 914 915 78 78 78 81 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 13 9 15 47 19 17 9 9 9 9 9 9 9 9 14 18 18 18 13 9 9 9 14 18 18 18 18 18 13 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 22 47 19 23 16 16 16 16 16 16 16 16 16 16 16 12 9 9 9 9 9 11 16 12 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 22 19 48 44 40 40 39 24 25 25 26 24 25 25 25 25 26 23 16 16 16 16 16 22 70 17 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 24 26 19 47 19 19 19 47 30 29 29 28 30 29 36 32 32 34 25 26 24 26 24 25 26 47 17 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 31 27 19 37 40 39 19 41 40 40 40 40 40 39 30 29 29 29 29 28 30 28 30 29 28 47 17 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 31 34 26 19 19 47 19 47 60 24 25 25 26 47 19 19 19 19 19 48 40 40 40 43 40 42 17 9 9 11 12 9 9 84 78 78 78 81 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 30 29 28 19 19 37 40 61 19 31 32 32 27 41 40 40 43 40 40 46 24 26 60 47 20 18 13 9 9 14 13 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 18 18 18 18 21 24 26 47 19 30 29 29 28 47 60 19 47 19 48 42 31 27 48 42 17 9 9 9 9 9 9 9 9 9 9 9 9 84 78 78 81 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 30 28 37 40 40 40 40 40 42 19 19 47 19 47 19 30 28 47 19 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 12 9 9 11 12 9 14 18 21 19 24 25 25 26 69 40 40 40 42 19 37 40 40 40 42 19 17 9 9 11 16 16 12 9 9 9 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 70 17 9 9 14 13 9 9 9 14 21 31 32 32 34 25 25 25 25 25 26 19 20 18 18 18 18 13 9 9 14 21 60 23 12 9 9 9 9 9 9 9 9 84 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 81 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 47 23 16 12 9 9 9 9 9 9 15 30 29 29 29 29 29 29 29 29 28 20 13 11 12 9 9 9 9 9 9 14 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 84 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 9 9 9 15 37 66 71 17 9 9 9 9 9 9 14 18 18 18 18 18 18 18 18 18 18 13 9 14 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 18 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9) - ) (worldmap-spawnpoint (name "main") (x 22) @@ -190,6 +182,17 @@ (x 1) (y 27) ) + (special-tile + (invisible-tile #t) + (script "state.world <- \"levels/world2/worldmap.stwm\"; +save_state(); + +exit_screen(); +fadeout_screen(2.5); +") + (x 38) + (y 21) + ) (sprite-change (change-on-touch #t) (initial-stay-action #f) @@ -205,6 +208,14 @@ (y 15) (sprite "images/worldmap/common/boat/boat.sprite") ) + (tilemap + (layer "interactive") + (solid #t) + (speed 1) + (width 80) + (height 30) + (tiles 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 12 11 16 16 16 16 12 9 9 9 9 11 16 16 16 12 9 14 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 16 16 22 19 17 15 24 25 25 26 23 16 12 9 9 15 19 58 19 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 22 19 19 19 20 18 13 15 31 32 32 34 26 19 23 16 12 15 19 59 19 17 9 11 16 16 16 16 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 24 25 26 20 13 9 9 15 31 35 29 29 28 19 19 60 17 14 21 47 20 13 11 22 24 25 25 26 23 12 11 16 16 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 31 32 27 17 11 16 16 22 30 28 19 48 40 40 40 39 17 9 15 47 17 11 22 19 30 29 29 28 19 23 22 19 19 23 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 31 32 27 23 22 19 19 19 19 19 19 47 19 19 19 47 23 16 22 47 23 22 48 40 40 40 40 40 39 24 25 25 25 26 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 30 29 28 48 40 40 43 40 40 40 40 44 39 69 40 44 40 43 40 44 40 43 42 24 25 25 25 26 47 30 29 29 36 27 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 19 19 60 68 19 19 47 24 25 25 26 19 47 19 19 19 19 47 20 18 21 47 19 30 36 32 35 28 37 40 40 39 30 28 23 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 18 21 24 25 25 26 47 31 32 32 27 19 37 40 40 40 40 42 17 9 15 37 40 39 30 29 28 19 19 19 60 41 40 71 19 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 31 32 32 27 47 31 32 32 27 20 18 18 18 18 18 18 13 9 14 18 21 47 19 19 48 40 40 40 40 42 19 19 19 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 30 29 29 28 47 30 29 29 28 17 9 9 9 9 11 16 16 16 12 9 15 37 40 40 42 19 19 19 20 18 18 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 21 19 19 48 42 20 18 18 18 13 9 9 9 9 15 49 50 51 17 9 14 18 18 18 18 18 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 12 9 14 21 19 47 19 17 9 9 9 9 9 9 9 9 15 52 53 54 17 9 9 9 11 16 16 16 16 16 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 13 11 12 14 21 41 40 73 74 74 74 74 74 74 74 74 75 77 76 57 73 74 74 74 75 40 40 40 40 914 915 78 78 78 81 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 13 9 15 47 19 17 9 9 9 9 9 9 9 9 14 18 18 18 13 9 9 9 14 18 18 18 18 18 13 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 22 47 19 23 16 16 16 16 16 16 16 16 16 16 16 12 9 9 9 9 9 11 16 12 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 22 19 48 44 40 40 39 24 25 25 26 24 25 25 25 25 26 23 16 16 16 16 16 22 70 17 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 24 26 19 47 19 19 19 47 30 29 29 28 30 29 36 32 32 34 25 26 24 26 24 25 26 47 17 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 31 27 19 37 40 39 19 41 40 40 40 40 40 39 30 29 29 29 29 28 30 28 30 29 28 47 17 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 31 34 26 19 19 47 19 47 60 24 25 25 26 47 19 19 19 19 19 48 40 40 40 43 40 42 17 9 9 11 12 9 9 84 78 78 78 81 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 30 29 28 19 19 37 40 61 19 31 32 32 27 41 40 40 43 40 40 46 24 26 60 47 20 18 13 9 9 14 13 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 18 18 18 18 21 24 26 47 19 30 29 29 28 47 60 19 47 19 48 42 31 27 48 42 17 9 9 9 9 9 9 9 9 9 9 9 9 84 78 78 81 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 30 28 37 40 40 40 40 40 42 19 19 47 19 47 19 30 28 47 19 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 12 9 9 11 12 9 14 18 21 19 24 25 25 26 69 40 40 40 42 19 37 40 40 40 42 19 17 9 9 11 16 16 12 9 9 9 9 9 9 9 9 9 79 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 70 17 9 9 14 13 9 9 9 14 21 31 32 32 34 25 25 25 25 25 26 19 20 18 18 18 18 13 9 9 14 21 60 23 12 9 9 9 9 9 9 9 9 84 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 81 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 47 23 16 12 9 9 9 9 9 9 15 30 29 29 29 29 29 29 29 29 28 20 13 11 12 9 9 9 9 9 9 14 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 84 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 9 9 9 15 37 66 71 17 9 9 9 9 9 9 14 18 18 18 18 18 18 18 18 18 18 13 9 14 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 18 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9) + ) ) (tileset "images/worldmap.strf") ) diff --git a/src/badguy/yeti.cpp b/src/badguy/yeti.cpp index b18e215ba..fe68b11e8 100644 --- a/src/badguy/yeti.cpp +++ b/src/badguy/yeti.cpp @@ -46,10 +46,6 @@ Yeti::Yeti(const lisp::Lisp& reader) sprite->set_action("right"); state = INIT; side = LEFT; -#if 0 - sound_manager->preload_sound("yeti_gna"); - sound_manager->preload_sound("yeti_roar"); -#endif hit_points = INITIAL_HITPOINTS; reader.get("dead-script", dead_script); countMe = false; diff --git a/src/object/player.cpp b/src/object/player.cpp index 1a60e53b3..1547ca7da 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -96,7 +96,7 @@ TuxBodyParts::draw(DrawingContext& context, const Vector& pos, int layer) if(body != NULL) body->draw(context, pos, layer-3); if(arms != NULL) - arms->draw(context, pos, layer); + arms->draw(context, pos, layer+10); if(feet != NULL) feet->draw(context, pos, layer-2); } @@ -630,7 +630,7 @@ Player::draw(DrawingContext& context) else tux_body = small_tux; - int layer = LAYER_OBJECTS + 10; + int layer = LAYER_OBJECTS + 1; /* Set Tux sprite action */ if (duck && is_big()) diff --git a/src/object/rock.cpp b/src/object/rock.cpp index 3a27757cc..2df1586fa 100644 --- a/src/object/rock.cpp +++ b/src/object/rock.cpp @@ -57,7 +57,7 @@ Rock::write(lisp::Writer& writer) void Rock::draw(DrawingContext& context) { - sprite->draw(context, get_pos(), LAYER_OBJECTS); + sprite->draw(context, get_pos(), LAYER_OBJECTS+1); } void @@ -74,21 +74,21 @@ Rock::update(float elapsed_time) } grabbed = false; + /* printf("%p - V %3.1f %3.1f - P %3.1f %3.1f\n", this, physic.get_velocity().x, physic.get_velocity().y, get_pos().x, get_pos().y); + */ } HitResponse -Rock::collision(GameObject& object, const CollisionHit& hit) +Rock::collision(GameObject& object, const CollisionHit& ) { if(grabbed) { return FORCE_MOVE; } if(object.get_flags() & FLAG_SOLID) { - printf("%p vs %p - %3.1f %3.1f D %3.1f\n", this, &object, - hit.normal.x, hit.normal.y, hit.depth); physic.set_velocity(0, 0); return CONTINUE; } diff --git a/src/scripting/serialize.cpp b/src/scripting/serialize.cpp index 7b67e25b6..1aee22aad 100644 --- a/src/scripting/serialize.cpp +++ b/src/scripting/serialize.cpp @@ -38,7 +38,7 @@ void load_squirrel_table(HSQUIRRELVM vm, int table_idx, const lisp::Lisp* lisp) table_idx -= 2; lisp::ListIterator iter(lisp); - while(iter.next()) { + while(iter.next() && iter.lisp() != NULL) { const std::string& token = iter.item(); sq_pushstring(vm, token.c_str(), token.size()); diff --git a/src/worldmap/special_tile.cpp b/src/worldmap/special_tile.cpp index 201458a78..6db08a145 100644 --- a/src/worldmap/special_tile.cpp +++ b/src/worldmap/special_tile.cpp @@ -44,6 +44,7 @@ SpecialTile::SpecialTile(const lisp::Lisp* lisp) lisp->get("map-message", map_message); lisp->get("passive-message", passive_message); + lisp->get("script", script); lisp->get("teleport-to-x", teleport_dest.x); lisp->get("teleport-to-y", teleport_dest.y); diff --git a/src/worldmap/special_tile.hpp b/src/worldmap/special_tile.hpp index f958d9bcf..068c01fb5 100644 --- a/src/worldmap/special_tile.hpp +++ b/src/worldmap/special_tile.hpp @@ -52,6 +52,9 @@ public: std::string map_message; bool passive_message; + /** Script to execute when tile is touched */ + std::string script; + /** Hide special tile */ bool invisible; diff --git a/src/worldmap/tux.cpp b/src/worldmap/tux.cpp index de138089e..2b070a567 100644 --- a/src/worldmap/tux.cpp +++ b/src/worldmap/tux.cpp @@ -28,6 +28,7 @@ #include "special_tile.hpp" #include "sprite_change.hpp" #include "control/joystickkeyboardcontroller.hpp" +#include "scripting/wrapper_util.hpp" #include "main.hpp" namespace WorldMapNS @@ -174,7 +175,7 @@ Tux::tryContinueWalking(float elapsed_time) // if this is a special_tile with passive_message, display it SpecialTile* special_tile = worldmap->at_special_tile(); - if(special_tile && special_tile->passive_message) + if(special_tile) { // direction and the apply_action_ are opposites, since they "see" // directions in a different way @@ -183,15 +184,27 @@ Tux::tryContinueWalking(float elapsed_time) (direction == D_WEST && special_tile->apply_action_east) || (direction == D_EAST && special_tile->apply_action_west)) { - worldmap->passive_message = special_tile->map_message; - worldmap->passive_message_timer.start(map_message_TIME); + if(special_tile->passive_message) { + worldmap->passive_message = special_tile->map_message; + worldmap->passive_message_timer.start(map_message_TIME); + } else if(special_tile->script != "") { + try { + std::istringstream in(special_tile->script); + HSQUIRRELVM vm = ScriptManager::instance->create_thread(); + Scripting::compile_and_run(vm, in, "specialtile"); + } catch(std::exception& e) { + log_warning << "Couldn't execute special tile script: " << e.what() + << std::endl; + } + } } } // stop if we reached a level, a WORLDMAP_STOP tile or a special tile without a passive_message if ((worldmap->at_level()) || (worldmap->at(tile_pos)->getData() & Tile::WORLDMAP_STOP) - || (special_tile && !special_tile->passive_message)) { + || (special_tile && !special_tile->passive_message + && special_tile->script == "")) { if(special_tile && !special_tile->map_message.empty() && !special_tile->passive_message) worldmap->passive_message_timer.start(0);