From: Ondřej Hošek Date: Sat, 22 Oct 2005 18:21:01 +0000 (+0000) Subject: * Moved my docs to the wiki X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=4a5d9260ab42bc48f317a2732b6ab41be495856a;p=supertux.git * Moved my docs to the wiki * Fixed a spelling mistake in an ifdef SVN-Revision: 2901 --- diff --git a/docs/fileformats/fileformats.xml b/docs/fileformats/fileformats.xml deleted file mode 100644 index 2cbcb8b5f..000000000 --- a/docs/fileformats/fileformats.xml +++ /dev/null @@ -1,335 +0,0 @@ - - - - -
- - -SuperTux File Format Documentation -OndraHosek - -This document serves the simple purpose of a reference for the files specific to SuperTux (levels, worldmaps, ...). Some of these files can be modified using an editor such as Flexlay. -Brackets, brackets, brackets (About the Language) -As you might have already noticed, the SuperTux definition files (just about for everything) are full of brackets ('(' and ')'). I know that BASIC programmers already freak out when seeing the vast amount of brackets used in C. The truth is that you can never have too many brackets. (Okay, that's a lie, but I don't know how lenient your compiler is.) -"That Crazy File Format" used by SuperTux is Lisp. In most of its implementations, it is used as a programming language, but the devs simply thought why not to implement it as a data storage language. And so, the SuperTux data language, nearly fully based on Lisp, was born. - -Basic Syntax -So now you expect me to teach you Lisp. "You'd like that, wouldn't ya?" Okay, okay, let me teach you a bit. -Language syntax is (nearly) always best consumable when demonstrated on an example, like so: -(supertux-lisp-example - ; This is a comment. It is initiated by a semi-colon. (Yes, you un-believer.) - (some-integer 120) ; Integer values are simple to input and to understand. - (floaty-float 58.5) ; Floating-point numbers should be self-explanatory too. - (string-thong "omg") ; Strings are simple and C-like. - (intl-string _("wtf")) ; Internationalised strings are implemented not unlike in C. - (boo-bool #t) ; That's a "true"... - (second-bool #f) ; ... and that's a "false". (Well duh.) - (integer-list 10 20 30) ; A list of integers, much like an array. -) ; Don't forget the closing bracket!!! - - - - - - -Level Files -The level format is a bit complex, which is why Flexlay can prove itself very useful as an editor. If you are interested in how the levels look like or want to edit them manually (and find some of the parameters not self-explanatory enough), then you may read or skim through this section. -;; Generated by Flexlay Editor (or Emacs or Vi or whatever) -(supertux-level ;; This initiates a level. - - (version 2) ;; This document only describes version 2. Version 1 is deprecated - ;; and I'm not going to teach it since it lacks a lot of features. - - (name _("Some demo level")) ;; Name of the level. Call it a nice name. Note that this should be - ;; internationalised (that's why the extra underscore and brackets). - - (author "Ondra Hosek") ;; Put your name here unless you are me (very improbable) - - (sector ;; A level is divided into independent sectors that can be connected - ;; by doors. - - (name "main") ;; Tux begins in the sector named "main". - - (music "Ondras_chipdisko.mod") ;; Name of the music file. See the data/music/ directory. - - (gravity 10.0) ;; Gravity of Tux. 10.0 is the default and sanest value (unless you - ;; apply the level design correctly). - - (tilemap ;; Here come the tiles. - (layer "background" ;; Currently, there are three layer types: "background", - ;; "interactive" and "foreground". - - (solid #f) ;; Will Tux collide with tiles in this tilemap? - - (speed 1.0) ;; If the tilemap is solid, this has to be 1. Basically sets how - ;; fast the tilemap scrolls. - - (width 5) ;; Number of tiles you plan to put in a row... - (height 5) ;; ... and in a column. (5x5 is pretty tiny; small Tux - ;; takes up 1x1 tiles, big Tux 1x2 tiles). - - (tiles ;; Integer lists of which tiles you want to use. - 0 0 0 0 0 ;; The tiles and their numbers are defined in - 0 0 0 0 0 ;; data/images/tiles.strf. - 0 0 0 0 0 - 0 0 0 0 0 - 0 0 0 0 0 - ) - ) - (tilemap - (layer "interactive") - ;; See the bacgkround layer definition. - ) - (tilemap - (layer "foreground") - ;; ... - ) - - (camera ;; Definitions of the camera paths - - (mode "autoscroll") ;; This can be set to "normal" to deactivate - ;; forced scrolling. Then you can omit the - ;; "path" directive. - - (path ;; Forced scrolling path - - (point (x 2) (y 3) (speed 2) ;; Point to where camera will scroll. - ) - - (point - ;; ... - ) - ) - - (backscrolling #f) ;; You can prevent the camera from scrolling - ;; backwards with this setting. - ) - - (background - (image "ocean.jpg") ;; Background from data/images/background - (speed 0.5) ;; Scrolling speed - ) - - (spawnpoint (name "main") (x 0) ;; A spawning point for Tux. By default, he is - (y 0) ;; spawned at spawnpoint named "main". - ) - - ;; THE FOLLOWING OBJECTS ARE OPTIONAL. - (init-script " -// A Squirrel script -// See the scripting reference for more information. -") - - ;; Here you can add badguys of your choice. - ;; A reference on badguy types and their parameters is a TODO. - - ;; Particle systems - ;; It is advisable only to use one particle system at a time. - - (particles-<type> ;; Valid values for <type> are rain, snow and clouds - - (layer 201) ;; -100 are background, 0 are interactive, 200 are foreground tiles. - ;; Choose a number to put the rain between two layers. In this case, - ;; the rain is in front of the foreground tiles. (see also - ;; src/video/drawing_context.hpp) - ) - - (leveltime - - (time 300) ;; The player must complete this level - ;; within 300 seconds. - ) - ) ;; End of sector - - ;; You can add other sectors here. -) -;; End of level - - -Badguys -This section describes the various badguys and their parameters. - -Common parameters -(<badguy-name> - (x 270) ;; The badguy's X coordinate. - (y 126) ;; The badguy's Y coordinate. (Note that the origin is in the top-left corner!) - (stay-on-platform #f) ;; Optional. Should the badguy do its best not to fall from the platform it's on? (NYI) -) - -Bouncing Snowballs, Flying Snowballs, Jumpies, Mr Bombs, Mr Iceblocks, Mr Rockets, Mr Trees, World 1 Noloks, Poison Ivies, Snowballs, Spikies, Stalactites, Yeti Stalactites and Zeeklings only require this list of parameters. Simply substitute <badguy-name> with one of the following: - -bouncingsnowball -flyingsnowball -jumpy -mrbomb -mriceblock -mrrocket -mrtree -nolok_01 -poisonivy -snowball -spiky -stalactite -yeti_stalactite -zeekling - - - -The next few sections describe the extra parameters for the other badguys. - -Dispenser -(dispenser - (cycle 3) ;; How often should a badguy be dispensed? - - (badguy random) ;; Valid values are "snowball", "bouncingsnowball", "mrbomb", - ;; "mriceblock", "mrrocket", "poisonivy" or "random". -) - - -Flame -(flame - (radius 3) ;; How big should the radius of the circle be that the flame - ;; follows? - - (speed 10) ;; How fast should the flame be? -) - - -Lightning orb -The lighting orb ("kugelblitz") ignores the y coordinate, spawning above the visible screen. - - -Spike -Don't mistake this badguy for Spiky! Spiky is the snowball-like creature with spikes, whilst a spike is an object serving the same purpose like the stalactite. -(spike - (direction 2) ;; 0: north, 1: south, 2: west, 3: east -) - - -Yeti -(yeti - (dead-script " -// A squirrel script that is executed once the Yeti dies. -") -) - - - - - - -Scrolling texts -Scrolling texts are used for the credits and were used for the intro and extro in Milestone 1. The format is simple: -(supertux-text - (background "extro.jpg") ; Background image (see data/images/background) - - (speed 1.5) ;; Default speed of text - - ;; Here we demonstrate the formatting characters - (text _(" - --This is a heading -<tab>This is a normal line. - This is a line in a small font. -#This is a left-aligned line. -*This should be printed in a blue font. -!Filename of the picture to be embedded into the scrolling text (relative to scrolltext file path) - -") - ) -) - - - - -Worldmaps -Worldmaps are basically level files with a few nuances. To explain the syntax, let's just picture somebody with the idea to write a level set that takes place in London (represented by a lonely island): -(supertux-worldmap - (properties ;; Global worldmap properties. - (name (_ "London")) ;; Name of the worldmap - (music "bigben.ogg") ;; Music to be played while on worldmap - ) - (spawnpoint ;; At the moment, defining multiple spawnpoints on a worldmap is useless. - (name "main") ;; Call your spawn point "main". - (x 3) ;; Note that the coordinates are, unlike in a level, bound to the tilemap. - (y 3) - ) - (tilemap - (width 5) ;; Number of tiles in a row. Four is just for demonstrational purposes. - (height 5) - (layer "interactive") ;; This has to be "interactive". - (solid #t) ;; This has to be true. - (speed 1.000000) ;; This has to be 1.0. - (tiles - 0 0 0 0 0 ;; The tiles as defined in data/images/worldmap.strf. - 0 11 16 12 0 - 0 15 60 17 0 - 0 14 18 13 0 - 0 0 0 0 0 - ) - ) - (level ;; Repeat this block for each level. Continuing from a level tile is only possible when the level is completed. - (x 3) ;; Coordinates of the level entry point. - (y 3) - (name "heathrow.stl") ;; Filename of the level, relative to the location of the worldmap file. - (extro-script " -// A Squirrel script to execute once this level is completed. - ") - ) - (special-tile ;; This is a sample message tile. - (x 4) - (y 3) - (map-message (_ "Hello.")) ;; Display the following text when Tux steps on this tile. - (passive-message #t) ;; Set to #f to stop Tux when he steps on this tile. - (apply-to-direction "north-west") ;; The message is displayed only when Tux comes from one of the specified directions (north, south, west, east, concatenate with a hyphen). - ) - (special-tile ;; This is a sample portal tile. - (x 2) - (y 3) - (map-message (_ "Warp to the Tower")) - (teleport-to-x 1) ;; Worldmap coordinates to which Tux is teleported. - (teleport-to-y 1) - ) -) - - - -Level subsets -Whilst creating a worldmap is optional, you'll need to write a level subset file to make your level package to appear in the contribs menu (or, ironically, inhibiting this behaviour). A file containing a level subset is called info and lies in data/levels/<subset_name>. -(supertux-level-subset - (title "Domain of the Hosek siblings") ;; Give your levelset a nice name... - (description "Levels by Ondra and Klara, the Hosek siblings") ;; ... and a short description. - (hide-from-contribs #f) ;; Set to true if you don't want your levelset to appear in the "Contrib Levels" menu. -) - - - - -
diff --git a/docs/scripting/scripting.xml b/docs/scripting/scripting.xml deleted file mode 100644 index b2b6c98d8..000000000 --- a/docs/scripting/scripting.xml +++ /dev/null @@ -1,386 +0,0 @@ - - - - -
- - -SuperTux Scripting Documentation -OndraHosek - -Since May 2005, SuperTux sports a Squirrel scripting interface useful for level designers who want to add some interactive pep to their levels. This document poses as a reference article for those who want to explore the various objects of the SuperTux scripting model. -What is Squirrel? -One of your first questions might be, "What does a rodent have to do with a penguin?" Squirrel is a language with a syntax not much unlike other C-like languages (C, C++, Java, ...). In the current implementation, it is integrated as elements in the SuperTux level files. - -Squirrel, Scheme and SuperTux -I have no clue if the developers simply chose Squirrel just because the name so nicely integrates into the series of words "SuperTux" and "Scheme". Currently, the Squirrel code is integrated in string arguments of Scheme elements in SuperTux level files. (Whew.) This is an example code block inside a level: -(supertux-level - (version 2) - (name _("Go Blind")) - (author "Team") - (sector - (name "main") - (music "Annoying_penguin_gawking_sounds.mod") - - ;; (Tilemaps, objects, whatever.) - - (init-script " -DisplayEffect.fade_out(2.5); -") - ) -) -When this level loads, the screen fades out completely during two and a half seconds right after the level is loaded. (Mind you, this would be a frustrating experience for the player if you add a horde of badguys near the spawn point.) - - -Object reference -If you are interested in an object and what cans of worms you can open with it, this section is for you. -"(NYI)" after the function name symbolises functions that haven't been implemented yet. Calling them will result in a line being printed to standard output informing anybody who reads it that the script is using a function that actually doesn't exist. (Win32 users will happily ignore this, because they simply start the application by opening it with Explorer. Unix users are going to be more interested in what SuperTux can actually tell them, so it's better if you don't use non-existent functions in your scripts.) - -Global Constants -These constants can be accessed from anywhere in the game code. - -KEY_BRASS -Type: integer -Value: 1 -Represents the brass key. -Used in: add_key as argument 1 - - -KEY_IRON -Type: integer -Value: 2 -Represents the iron key. -Used in: add_key as argument 1 - - -KEY_BRONZE -Type: integer -Value: 4 -Represents the bronze key. -Used in: add_key as argument 1 - - -KEY_SILVER -Type: integer -Value: 8 -Represents the silver key. -Used in: add_key as argument 1 - - -KEY_GOLD -Type: integer -Value: 16 -Represents the gold key. -Used in: add_key as argument 1 - - - - -Global Functions -These global functions access basic or generic methods of SuperTux. They are called without an object name. - -display_text_file -Usage: display_text_file(string filename) -Displays the SuperTux text file named filename. (The path is relative to the level file.) -See also: SuperTux file format reference, SuperTux texts - - -wait -Usage: wait(float time) -Pauses execution of the squirrel code for time seconds. - - -translate -Usage: translate(string text) -Returns: Translated string -Translates text into the user's locale. -Note: This construct is unfortunately not yet recognised by XGetText, so translation files have to be written manually. - - -import -Usage: import(string filename) -Imports and runs the Squirrel script filename. (The path is relative to the level file.) - - -add_key -Usage: add_key(int key) -Adds or removes a key from the player's posession. key should be replaced with one of the KEY_ constants. -See also: src/player_status.hpp - - - - -DisplayEffect -DisplayEffect is an interface for toying with the display. - -fade_out -Usage: DisplayEffect.fade_out(float fadetime) -Gradually fades out the screen to black for the next fadetime seconds. - - -fade_in -Usage: DisplayEffect.fade_in(float fadetime) -Gradually fades in the screen from black for the next fadetime seconds. - - -set_black -Usage: DisplayEffect.set_black(bool black) -Blackens or un-blackens the screen (depending on the value of black). - - -is_black -Usage: DisplayEffect.is_black() -Returns: bool -Returns true if the screen has been blackened by set_black. Calling fade_in or fade_out resets the return value to false. - - -sixteen_to_nine -Usage: DisplayEffect.sixteen_to_nine() -Sets the display ratio to 16:9, effectively adding black bars at the top and bottom of the screen. Should be used before cutscenes. - - -four_to_three -Usage: DisplayEffect.four_to_three() -Sets the display ratio to 4:3, removing the black bars added by sixteen_to_nine(). Should be used after cutscenes. - - - - -Camera -Camera is an interface to manipulate the camera. - -shake (NYI) -Usage: Camera.shake(float time, float x, float y) -Warning: This function has not yet been implemented. - - -set_pos (NYI) -Usage: Camera.set_pos(float x, float y) -Warning: This function has not yet been implemented. - - -set_mode (NYI) -Usage: Camera.set_mode(string modestring) -Warning: This function has not yet been implemented. - - - - -Level -The Level class provides basic controlling functions for the current level. - -finish -Usage: Level.finish() -Ends the current level and marks it as completed if launched from a worldmap. -Tip: Very useful if you have created a frustrating level and want to, at some point, save the player from agony. - - -spawn -Usage: Level.spawn(string sectorname, string spawnpointname) -Respawns Tux in the sector sectorname at the spawnpointname spawnpoint. -Exceptions: If sectorname or spawnpointname are empty or the specified sector does not exist, the function will bail out first chance it gets. If the specified spawnpoint doesn't exist, Tux will be spawned at the spawnpoint named main. If this spawnpoint doesn't exist either, Tux will simply end up at the origin (top-left 0, 0). - - -flip_vertically -Usage: Level.flip_vertically() -Flips the level vertically (i.e. top is now bottom and vice versa). Call again to revert the effect. -Tip: Make sure the player can land on something after the level is flipped! - - - - -ScriptedObject -A ScriptedObject is basically a SuperTux object that can be scripted to move around and animate. This object will be used in the SuperTux cutscenes a whole lot. - -Usage notes -Since a ScriptedObject is a reference object and not a statically declared object, you will have to build it into your level file, where a scriptedobject is a child of sector. This is an example definition: - -(scripted-object - (name "WOOT") - (x 420) - (y 94) - (sprite "snowball") - (solid #t) - (physic-enabled #f) - (visible #t) -) - - -Now, the object can be accessed in code using the WOOT identifier like so: - -WOOT.set_animation("left"); - - - - -set_animation -Usage: <scriptedobject>.set_animation(string animation_name) -Activates the sprite's animation specified in animation_name. - - -get_animation -Usage: <scriptedobject>.get_animation() -Returns: string -Returns the name of the sprite's current animation. - - -move -Usage: <scriptedobject>.move(float x, float y) -Moves the object by x units to the right and y down relative to its current position. - - -set_pos -Usage: <scriptedobject>.set_pos(float x, float y) -Basically identical to move, except its relativity to the sector origin. - - -get_pos_x -Usage: <scriptedobject>.get_pos_x() -Returns: float -Returns the X coordinate of the object's position. - - -get_pos_y -Usage: <scriptedobject>.get_pos_y() -Returns: float -Totally identical to get_pos_x except for its obvious choice of the other (Y) axis. - - -set_velocity -Usage: <scriptedobject>.set_velocity(float x, float y) -Makes the object move in a certain direction (with a certain speed) given by the x and y coordinates. - - -get_velocity_x -Usage: <scriptedobject>.get_velocity_x() -Returns: float -Returns the object's velocity in the direction of the X coordinate. - - -get_velocity_y -Usage: <scriptedobject>.get_velocity_y() -Returns: float -The difference between this function and get_velocity_x is just the same like between get_pos_y and get_pos_x: same thing, different coordinates. - - -set_visible -Usage: <scriptedobject>.set_visible(bool visible) -Shows or hides the object according to the value of visible. - - -is_visible -Usage: <scriptedobject>.is_visible() -Returns: bool -Returns true if the object is visible. (You've seen this coming, haven't you?) - - -get_name -Usage: <scriptedobject>.get_name() -Returns: string -Simply gives you the name of the scripted object (as if you didn't have it already...) - - - - -Sound -This class provides a very simple interface to the audio subsystem. - -play_music -Usage: Sound.play_music(string track_name) -Plays the selected music track (automatically prepending the path to the music folder and appending the .ogg extension). - - -play_sound -Usage: Sound.play_sound(string sound_name) -Plays the sound specified in sound_name (that is identical to the filename of the sound without the .wav extension). - - - - -Text -This module provides access to methods reponsible for displaying text on-screen. - -set_text -Usage: Text.set_text(string text) -Sets the text string to be displayed to text. - - -set_font -Usage: Text.set_font(string font) -Sets the font of the text to be displayed to text. Currently valid values are gold, white, blue, gray, big and small. - - -fade_in -Usage: Text.fade_in(float time) -Fades in the specified text for the next time seconds. - - -fade_out -Usage: Text.fade_out(float time) -Just the opposite of fade_out. - - -set_visible -Usage: Text.set_visible(bool visible) -Shows or hides the text abruptly (drastic counterpart to fade_in and fade_out). - - -set_centered -Usage: Text.set_centered(bool centered) -If centered is true, the text will be centered on the screen. Otherwise, it will be left-aligned. - - - - -Player -This module contains methods controlling the player. (No, SuperTux doesn't use mind control. Player refers to the player object.) - -make_invincible -Usage: Player.make_invincible() -Makes the player invincible for a predefined amount of time. -See also: TUX_INVINCIBLE_TIME in src/object/player.hpp for the amount of seconds that the player becomes invincible. - - -deactivate -Usage: Player.deactivate() -Stops the player and blocks the movement controls. -Tip: Don't call this in front of a horde of badguys. - - -activate -Usage: Player.activate() -Reactivates the player's movement controls. - - -walk -Usage: Player.walk(float velocity) -Makes the player move in a certain horizontal velocity (specified by velocity). A negative velocity moves the player to the left. - - - - - - -
diff --git a/src/worldmap.cpp b/src/worldmap.cpp index d731b4ea9..86498528c 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -143,7 +143,7 @@ Tux::draw(DrawingContext& context) tux_sprite->set_action("small"); break; default: -#ifdef DBEUG +#ifdef DEBUG std::cerr << "Bonus type not handled in worldmap.\n"; #endif tux_sprite->set_action("large");