X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fscripting%2Fplayer.hpp;h=a8f63b769c9d10851a19a49dc65b6f85b23ddf91;hb=02006fdd9da5000586077bf331620b92854c8125;hp=58f10419fe34847fec67e0d12ca5428f50e8c92a;hpb=b72c5d178e4cc95130735d8bf8716513c7cc28e1;p=supertux.git diff --git a/src/scripting/player.hpp b/src/scripting/player.hpp index 58f10419f..a8f63b769 100644 --- a/src/scripting/player.hpp +++ b/src/scripting/player.hpp @@ -1,8 +1,27 @@ -#ifndef __PLAYER_H__ -#define __PLAYER_H__ +// SuperTux +// Copyright (C) 2006 Matthias Braun +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . -namespace Scripting -{ +#ifndef HEADER_SUPERTUX_SCRIPTING_PLAYER_HPP +#define HEADER_SUPERTUX_SCRIPTING_PLAYER_HPP + +#ifndef SCRIPTING_API +#include +#endif + +namespace scripting { class Player { @@ -12,28 +31,114 @@ public: {} #endif -#if 0 /** * Set tux bonus. - * This can be "grow", "fireflow" or "iceflower" at the moment + * This can be "grow", "fireflower" or "iceflower" at the moment */ - virtual void set_bonus(const std::string& bonus) = 0; + virtual bool add_bonus(const std::string& bonus) = 0; /** - * Make tux invicible for a short amount of time + * Give tux more coins + */ + virtual void add_coins(int count) = 0; + /** + * Make tux invincible for a short amount of time */ virtual void make_invincible() = 0; /** - * Give tux another life + * Deactivate user/scripting input for Tux */ - virtual void add_life() = 0; + virtual void deactivate() = 0; /** - * Give tux more coins + * Give control back to user/scripting */ - virtual void add_coins(int count) = 0; -#endif + virtual void activate() = 0; + /** + * Make Tux walk + */ + virtual void walk(float speed) = 0; + /** + * Face Tux in the proper direction + */ + virtual void set_dir(bool right) = 0; + /** + * Set player visible or invisible + */ + virtual void set_visible(bool visible) = 0; + /** + * returns true if the player is currently visible (that is he was not set + * invisible by the set_visible method) + */ + virtual bool get_visible() = 0; + + /** + * Hurts a player, if completely=true then the player will be killed even + * if he had grow or fireflower bonus + */ + virtual void kill(bool completely) = 0; + + /** + * Switches ghost mode on/off. + * Lets Tux float around and through solid objects. + */ + virtual void set_ghost_mode(bool enable) = 0; + + /** + * Returns whether ghost mode is currently enabled + */ + virtual bool get_ghost_mode() = 0; + + /** + * start kick animation + */ + virtual void kick() = 0; + + /** + * play cheer animation. + * This might need some space and behave in an unpredictable way. Best to use this at level end. + */ + virtual void do_cheer() = 0; + + /** + * duck down if possible. + * this won't last long as long as input is enabled. + */ + virtual void do_duck() = 0; + + /** + * stand back up if possible. + */ + virtual void do_standup() = 0; + + /** + * do a backflip if possible. + */ + virtual void do_backflip() = 0; + + /** + * jump in the air if possible + * sensible values for yspeed are negative - unless we want to jump into the ground of course + */ + virtual void do_jump(float yspeed) = 0; + + /** + * Orders the current GameSession to start a sequence + */ + virtual void trigger_sequence(std::string sequence_name) = 0; + + /** + * Uses a scriptable controller for all user input (or restores controls) + */ + virtual void use_scripting_controller(bool use_or_release) = 0; + + /** + * Instructs the scriptable controller to press or release a button + */ + virtual void do_scripting_controller(std::string control, bool pressed) = 0; + }; } #endif +/* EOF */