From c2af5f87dc306b5f0a92f1d9af80c21d4c91d492 Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Thu, 13 Jul 2006 00:44:58 +0000 Subject: [PATCH] Reworked Thunderstorm scripting SVN-Revision: 3995 --- data/levels/world2/ghostly.stl | 50 +++++++++++++++--------------------------- src/object/thunderstorm.cpp | 2 +- src/object/thunderstorm.hpp | 2 +- src/scripting/thunderstorm.hpp | 25 +++++++++++++-------- 4 files changed, 36 insertions(+), 43 deletions(-) diff --git a/data/levels/world2/ghostly.stl b/data/levels/world2/ghostly.stl index 17a619461..49e0b2ab7 100644 --- a/data/levels/world2/ghostly.stl +++ b/data/levels/world2/ghostly.stl @@ -70,23 +70,13 @@ ) (scripttrigger (script "Tux.deactivate(); -play_sound(\"sounds/brick.wav\"); -Effect.fade_in(0.2); -wait(0.1); -play_sound(\"sounds/brick.wav\"); -Effect.fade_in(0.2); -wait(0.2); -play_sound(\"sounds/brick.wav\"); -Effect.fade_in(0.2); +play_music(\"music/ghostforest.ogg\"); wait(1); -play_sound(\"sounds/brick.wav\"); -wait(0.2); -play_sound(\"sounds/brick.wav\"); -Effect.fade_in(0.2); -wait(0.1); -play_sound(\"sounds/brick.wav\"); -Effect.fade_out(0.5); +thunder1.lightning(); wait(1); +thunder1.lightning(); +wait(0.33); +thunder1.lightning(); play_sound(\"sounds/warp.wav\"); Tux.activate(); Level.spawn(\"ghostforest\", \"main\"); @@ -97,6 +87,10 @@ Level.spawn(\"ghostforest\", \"main\"); (x 2016) (y 0) ) + (thunderstorm + (name "thunder1") + (running #f) + ) ) (sector (name "ghostforest") @@ -204,23 +198,11 @@ Level.spawn(\"ghostforest\", \"main\"); ) (scripttrigger (script "Tux.deactivate(); -play_sound(\"sounds/brick.wav\"); -Effect.fade_in(0.2); -wait(0.1); -play_sound(\"sounds/brick.wav\"); -Effect.fade_in(0.2); -wait(0.2); -play_sound(\"sounds/brick.wav\"); -Effect.fade_in(0.2); -wait(1); -play_sound(\"sounds/brick.wav\"); -wait(0.2); -play_sound(\"sounds/brick.wav\"); -Effect.fade_in(0.2); -wait(0.1); -play_sound(\"sounds/brick.wav\"); -Effect.fade_out(0.5); -wait(1); +thunder2.lightning(); +wait(0.66); +thunder2.thunder(); +wait(0.3); +thunder2.lightning(); play_sound(\"sounds/warp.wav\"); Tux.activate(); Level.spawn(\"main\", \"back\"); @@ -231,5 +213,9 @@ Level.spawn(\"main\", \"back\"); (x 6848) (y 0) ) + (thunderstorm + (name "thunder2") + (running #f) + ) ) ) diff --git a/src/object/thunderstorm.cpp b/src/object/thunderstorm.cpp index 5a9cb362a..1aec3625f 100644 --- a/src/object/thunderstorm.cpp +++ b/src/object/thunderstorm.cpp @@ -91,7 +91,7 @@ void Thunderstorm::expose(HSQUIRRELVM vm, SQInteger table_idx) { if (name == "") return; - Scripting::Thunderstorm* interface = static_cast(this); + Scripting::Thunderstorm* interface = new Scripting::Thunderstorm(this); expose_object(vm, table_idx, interface, name, true); } diff --git a/src/object/thunderstorm.hpp b/src/object/thunderstorm.hpp index 804312f4c..77f8f6887 100644 --- a/src/object/thunderstorm.hpp +++ b/src/object/thunderstorm.hpp @@ -29,7 +29,7 @@ /** * Thunderstorm scriptable GameObject; plays thunder, lightning and electrifies water at regular interval */ -class Thunderstorm : public GameObject, public Scripting::Thunderstorm, public ScriptInterface +class Thunderstorm : public GameObject, public ScriptInterface { public: Thunderstorm(const lisp::Lisp& reader); diff --git a/src/scripting/thunderstorm.hpp b/src/scripting/thunderstorm.hpp index 79e350bdc..24a4d2eb8 100644 --- a/src/scripting/thunderstorm.hpp +++ b/src/scripting/thunderstorm.hpp @@ -20,6 +20,11 @@ #ifndef __SCRIPTING_THUNDERSTORM_H__ #define __SCRIPTING_THUNDERSTORM_H__ +#ifndef SCRIPTING_API +class Thunderstorm; +typedef Thunderstorm _Thunderstorm; +#endif + namespace Scripting { @@ -27,41 +32,43 @@ class Thunderstorm { public: #ifndef SCRIPTING_API - virtual ~Thunderstorm() - {} + Thunderstorm(_Thunderstorm* thunderstorm); + ~Thunderstorm(); #endif /** * Start playing thunder and lightning at configured interval */ - virtual void start() = 0; + void start(); /** * Stop playing thunder and lightning at configured interval */ - virtual void stop() = 0; + void stop(); /** * Play thunder */ - virtual void thunder() = 0; + void thunder(); /** * Play lightning, i.e. call flash() and electrify() */ - virtual void lightning() = 0; + void lightning(); /** * Display a nice flash */ - virtual void flash() = 0; + void flash(); /** * Electrify water throughout the whole sector for a short time */ - virtual void electrify() = 0; - + void electrify(); +#ifndef SCRIPTING_API + _Thunderstorm* thunderstorm; +#endif }; } -- 2.11.0