From 57c3cbae3e8f0cc9e24e649f9d5e4da60d1a0f76 Mon Sep 17 00:00:00 2001 From: curaga Date: Thu, 30 May 2013 19:47:39 +0000 Subject: [PATCH] Space cleanup pass on the headers git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12817 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/addons/addon.hpp | 38 +-- src/addons/addons_manager.hpp | 2 +- src/addons/dummy_network_http.hpp | 4 +- src/addons/inetwork_http.hpp | 8 +- src/addons/network_http.hpp | 6 +- src/addons/news_manager.hpp | 4 +- src/addons/request.hpp | 2 +- src/animations/animation_base.hpp | 12 +- src/animations/ipo.hpp | 10 +- src/animations/three_d_animation.hpp | 12 +- src/audio/dummy_sfx.hpp | 10 +- src/audio/music.hpp | 2 +- src/audio/music_dummy.hpp | 2 +- src/audio/music_information.hpp | 20 +- src/audio/music_manager.hpp | 18 +- src/audio/music_ogg.hpp | 4 +- src/audio/sfx_base.hpp | 8 +- src/audio/sfx_buffer.hpp | 30 +- src/audio/sfx_manager.hpp | 28 +- src/audio/sfx_openal.hpp | 16 +- src/challenges/challenge.hpp | 16 +- src/challenges/challenge_data.hpp | 66 ++--- src/challenges/game_slot.hpp | 62 ++-- src/challenges/unlock_manager.hpp | 28 +- src/config/device_config.hpp | 54 ++-- src/config/player.hpp | 40 +-- src/config/saved_grand_prix.hpp | 10 +- src/config/stk_config.hpp | 18 +- src/config/user_config.hpp | 278 +++++++++--------- src/graphics/CBatchingMesh.hpp | 20 +- src/graphics/camera.hpp | 24 +- src/graphics/explosion.hpp | 2 +- src/graphics/hardware_skinning.hpp | 4 +- src/graphics/hit_effect.hpp | 2 +- src/graphics/hit_sfx.hpp | 2 +- src/graphics/irr_driver.hpp | 106 +++---- src/graphics/lod_node.hpp | 30 +- src/graphics/material.hpp | 90 +++--- src/graphics/material_manager.hpp | 10 +- src/graphics/moving_texture.hpp | 4 +- src/graphics/particle_emitter.hpp | 42 +-- src/graphics/particle_kind.hpp | 64 ++-- src/graphics/particle_kind_manager.hpp | 12 +- src/graphics/per_camera_node.hpp | 20 +- src/graphics/post_processing.hpp | 14 +- src/graphics/rain.hpp | 10 +- src/graphics/referee.hpp | 4 +- src/graphics/shadow.hpp | 2 +- src/graphics/show_curve.hpp | 4 +- src/graphics/skid_marks.hpp | 16 +- src/graphics/slip_stream.hpp | 4 +- src/graphics/stars.hpp | 12 +- src/guiengine/abstract_state_manager.hpp | 82 +++--- .../abstract_top_level_container.hpp | 38 +-- src/guiengine/engine.hpp | 68 ++--- src/guiengine/event_handler.hpp | 26 +- src/guiengine/layout_manager.hpp | 18 +- src/guiengine/modaldialog.hpp | 44 +-- src/guiengine/scalable_font.hpp | 32 +- src/guiengine/screen.hpp | 12 +- src/guiengine/skin.hpp | 266 ++++++++--------- src/guiengine/widget.hpp | 206 ++++++------- src/input/binding.hpp | 4 +- src/input/device_manager.hpp | 18 +- src/input/input.hpp | 24 +- src/input/input_device.hpp | 60 ++-- src/input/input_manager.hpp | 30 +- src/input/wiimote.hpp | 12 +- src/input/wiimote_manager.hpp | 14 +- src/io/file_manager.hpp | 8 +- src/io/xml_node.hpp | 16 +- src/io/xml_writer.hpp | 10 +- src/items/attachment.hpp | 12 +- src/items/attachment_manager.hpp | 6 +- src/items/attachment_plugin.hpp | 12 +- src/items/bowling.hpp | 4 +- src/items/cake.hpp | 10 +- src/items/flyable.hpp | 26 +- src/items/item.hpp | 58 ++-- src/items/item_manager.hpp | 18 +- src/items/plunger.hpp | 2 +- src/items/powerup.hpp | 2 +- src/items/powerup_manager.hpp | 28 +- src/items/projectile_manager.hpp | 6 +- src/items/rubber_ball.hpp | 32 +- src/items/rubber_band.hpp | 4 +- src/items/swatter.hpp | 14 +- src/karts/abstract_kart.hpp | 38 +-- src/karts/abstract_kart_animation.hpp | 4 +- src/karts/cannon_animation.hpp | 10 +- src/karts/explosion_animation.hpp | 4 +- src/karts/ghost_kart.hpp | 8 +- src/karts/kart.hpp | 60 ++-- src/karts/kart_gfx.hpp | 8 +- src/karts/kart_model.hpp | 44 +-- src/karts/kart_properties.hpp | 112 +++---- src/karts/kart_properties_manager.hpp | 8 +- src/karts/kart_with_stats.hpp | 2 +- src/karts/max_speed.hpp | 32 +- src/karts/moveable.hpp | 16 +- src/karts/skidding.hpp | 10 +- src/karts/skidding_properties.hpp | 22 +- src/modes/cutscene_world.hpp | 26 +- src/modes/demo_world.hpp | 4 +- src/modes/easter_egg_hunt.hpp | 12 +- src/modes/follow_the_leader.hpp | 10 +- src/modes/linear_world.hpp | 28 +- src/modes/overworld.hpp | 14 +- src/modes/profile_world.hpp | 2 +- src/modes/soccer_world.hpp | 18 +- src/modes/standard_race.hpp | 4 +- src/modes/three_strikes_battle.hpp | 30 +- src/modes/tutorial_world.hpp | 2 +- src/modes/world.hpp | 84 +++--- src/modes/world_status.hpp | 14 +- src/modes/world_with_rank.hpp | 6 +- src/network/character_confirm_message.hpp | 8 +- src/network/character_info_message.hpp | 2 +- src/network/character_selected_message.hpp | 10 +- src/network/flyable_info.hpp | 6 +- src/network/item_info.hpp | 2 +- src/network/kart_control_message.hpp | 2 +- src/network/message.hpp | 44 +-- src/network/network_kart.hpp | 2 +- src/network/network_manager.hpp | 4 +- src/network/race_start_message.hpp | 2 +- src/network/race_state.hpp | 16 +- src/network/remote_kart_info.hpp | 10 +- src/physics/btKart.hpp | 38 +-- src/physics/btKartRaycast.hpp | 8 +- src/physics/btUprightConstraint.hpp | 8 +- src/physics/irr_debug_drawer.hpp | 12 +- src/physics/kart_motion_state.hpp | 10 +- src/physics/physical_object.hpp | 32 +- src/physics/physics.hpp | 12 +- src/physics/stk_dynamics_world.hpp | 4 +- src/physics/triangle_mesh.hpp | 12 +- src/race/grand_prix_data.hpp | 12 +- src/race/highscore_manager.hpp | 8 +- src/race/highscores.hpp | 8 +- src/race/history.hpp | 2 +- src/race/race_manager.hpp | 202 ++++++------- src/replay/replay_base.hpp | 4 +- src/replay/replay_play.hpp | 2 +- src/replay/replay_recorder.hpp | 6 +- src/states_screens/addons_screen.hpp | 16 +- src/states_screens/arenas_screen.hpp | 10 +- src/states_screens/credits.hpp | 34 +-- src/states_screens/cutscene_gui.hpp | 6 +- src/states_screens/feature_unlocked.hpp | 70 ++--- src/states_screens/grand_prix_lose.hpp | 30 +- src/states_screens/grand_prix_win.hpp | 32 +- src/states_screens/help_screen_1.hpp | 6 +- src/states_screens/help_screen_2.hpp | 8 +- src/states_screens/help_screen_3.hpp | 12 +- src/states_screens/help_screen_4.hpp | 12 +- src/states_screens/kart_selection.hpp | 78 ++--- src/states_screens/main_menu_screen.hpp | 16 +- src/states_screens/minimal_race_gui.hpp | 20 +- src/states_screens/options_screen_audio.hpp | 12 +- src/states_screens/options_screen_input.hpp | 22 +- src/states_screens/options_screen_input2.hpp | 28 +- src/states_screens/options_screen_players.hpp | 14 +- src/states_screens/options_screen_ui.hpp | 14 +- src/states_screens/options_screen_video.hpp | 16 +- src/states_screens/race_gui.hpp | 28 +- src/states_screens/race_gui_base.hpp | 46 +-- src/states_screens/race_gui_overworld.hpp | 52 ++-- src/states_screens/race_result_gui.hpp | 48 +-- src/states_screens/race_setup_screen.hpp | 12 +- src/states_screens/soccer_setup_screen.hpp | 20 +- src/states_screens/state_manager.hpp | 128 ++++---- src/states_screens/story_mode_lobby.hpp | 14 +- src/states_screens/tracks_screen.hpp | 18 +- src/tinygettext/dictionary.hpp | 10 +- src/tinygettext/dictionary_manager.hpp | 4 +- src/tinygettext/file_system.hpp | 2 +- src/tinygettext/iconv.hpp | 10 +- src/tinygettext/language.hpp | 8 +- src/tinygettext/plural_forms.hpp | 4 +- src/tinygettext/po_parser.hpp | 2 +- src/tinygettext/tgt_log.hpp | 2 +- src/tracks/ambient_light_sphere.hpp | 4 +- src/tracks/bezier_curve.hpp | 2 +- src/tracks/check_cannon.hpp | 2 +- src/tracks/check_goal.hpp | 8 +- src/tracks/check_lap.hpp | 4 +- src/tracks/check_line.hpp | 14 +- src/tracks/check_sphere.hpp | 6 +- src/tracks/check_structure.hpp | 14 +- src/tracks/graph_node.hpp | 48 +-- src/tracks/lod_node_loader.hpp | 12 +- src/tracks/quad.hpp | 6 +- src/tracks/quad_graph.hpp | 28 +- src/tracks/quad_set.hpp | 8 +- src/tracks/terrain_info.hpp | 4 +- src/tracks/track.hpp | 110 +++---- src/tracks/track_manager.hpp | 44 +-- src/tracks/track_object.hpp | 34 +-- src/tracks/track_object_manager.hpp | 16 +- src/tracks/track_object_presentation.hpp | 46 +-- src/tracks/track_sector.hpp | 2 +- src/utils/aligned_array.hpp | 4 +- src/utils/constants.hpp | 2 +- src/utils/interpolation_array.hpp | 16 +- src/utils/leak_check.hpp | 14 +- src/utils/log.hpp | 8 +- src/utils/no_copy.hpp | 6 +- src/utils/profiler.hpp | 12 +- src/utils/ptr_vector.hpp | 20 +- src/utils/string_utils.hpp | 118 ++++---- src/utils/synchronised.hpp | 14 +- src/utils/time.hpp | 10 +- src/utils/translation.hpp | 12 +- src/utils/vec3.hpp | 22 +- 215 files changed, 2591 insertions(+), 2591 deletions(-) diff --git a/src/addons/addon.hpp b/src/addons/addon.hpp index 69ca37953..13443ca1e 100644 --- a/src/addons/addon.hpp +++ b/src/addons/addon.hpp @@ -60,7 +60,7 @@ public: // ------------------------------------------------------------------------ /** A static function that checks if the given ID is an addon. This is - * done by testing if the directory name is in the addons directory. + * done by testing if the directory name is in the addons directory. */ static bool isAddon(const std::string &directory) { @@ -131,7 +131,7 @@ public: /** Initialises the object from an XML node. */ Addon(const XMLNode &xml); // ------------------------------------------------------------------------ - /** Sets the sort order used in the comparison function. It is static, so + /** Sets the sort order used in the comparison function. It is static, so * that each instance can access the sort order. */ static void setSortOrder(SortOrder so) { m_sort_order = so; } // ------------------------------------------------------------------------ @@ -166,7 +166,7 @@ public: /** Returns the name of the addon. */ const core::stringw& getDescription() const { return m_description; } // ------------------------------------------------------------------------ - /** Returns the date (in seconds since epoch) when the addon was + /** Returns the date (in seconds since epoch) when the addon was * uploaded. */ Time::TimeType getDate() const { return m_date; } // ------------------------------------------------------------------------ @@ -179,8 +179,8 @@ public: /** Returns the installed revision number of an addon. */ int getInstalledRevision() const { return m_installed_revision; } // ------------------------------------------------------------------------ - /** Returns the latest revision number of this addon. - * m_revision>m_installed_revision if a newer revision is available + /** Returns the latest revision number of this addon. + * m_revision>m_installed_revision if a newer revision is available * online. */ int getRevision() const { return m_revision; } // ------------------------------------------------------------------------ @@ -212,7 +212,7 @@ public: } // iconNeedsUpdate // ------------------------------------------------------------------------ /** Marks this addon to be installed. If the addon is marked as being - * installed, it also updates the installed revision number to be the + * installed, it also updates the installed revision number to be the * same as currently available revision number. */ void setInstalled(bool state) { @@ -221,28 +221,28 @@ public: m_installed_revision = m_revision; } // setInstalled // ------------------------------------------------------------------------ - /** Returns true if the icon of this addon was downloaded and is ready + /** Returns true if the icon of this addon was downloaded and is ready * to be displayed. */ bool iconReady() const { return m_icon_ready; } // ------------------------------------------------------------------------ /** Marks that the icon for this addon can be displayed. */ - void setIconReady() - { + void setIconReady() + { m_icon_revision = m_revision; - m_icon_ready=true; + m_icon_ready=true; } // setIconReady // ------------------------------------------------------------------------ /** Returns the size of the compressed package. */ int getSize() const { return m_size; } // ------------------------------------------------------------------------ - /** Returns the directory in which this type of addons is stored (in a + /** Returns the directory in which this type of addons is stored (in a * separate subdirectory). A kart is stored in .../karts/X and tracks in * .../tracks/X. If further types are added here, make sure that the * name return ends with a "/". */ std::string getTypeDirectory() const { - if(m_type=="kart") + if(m_type=="kart") return "karts/"; else if(m_type=="track") return "tracks/"; @@ -261,7 +261,7 @@ public: bool testStatus(AddonStatus n) const {return (m_status & n) !=0; } // ------------------------------------------------------------------------ /** Returns the directory in which this addon is installed. */ - std::string getDataDir() const + std::string getDataDir() const { return file_manager->getAddonsFile(getTypeDirectory()+m_dir_name); } // getDataDir @@ -273,10 +273,10 @@ public: { switch(m_sort_order) { - case SO_DEFAULT: - if(testStatus(AS_FEATURED) && + case SO_DEFAULT: + if(testStatus(AS_FEATURED) && !a.testStatus(AS_FEATURED)) return true; - if(!testStatus(AS_FEATURED) && + if(!testStatus(AS_FEATURED) && a.testStatus(AS_FEATURED)) return false; // Otherwise fall through to name comparison! case SO_NAME: @@ -300,10 +300,10 @@ public: { switch(m_sort_order) { - case SO_DEFAULT: - if(testStatus(AS_FEATURED) && + case SO_DEFAULT: + if(testStatus(AS_FEATURED) && !a.testStatus(AS_FEATURED)) return true; - if(!testStatus(AS_FEATURED) && + if(!testStatus(AS_FEATURED) && a.testStatus(AS_FEATURED)) return false; // Otherwise fall through to name comparison! case SO_NAME: diff --git a/src/addons/addons_manager.hpp b/src/addons/addons_manager.hpp index c715de974..d3b0545d8 100644 --- a/src/addons/addons_manager.hpp +++ b/src/addons/addons_manager.hpp @@ -68,7 +68,7 @@ public: bool uninstall(const Addon &addon); void reInit(); // ------------------------------------------------------------------------ - /** Returns true if the list of online addons has been downloaded. This is + /** Returns true if the list of online addons has been downloaded. This is * used to grey out the 'addons' entry till a network connections could be * established. */ bool onlineReady() const {return m_state.getAtomic()==STATE_READY; } diff --git a/src/addons/dummy_network_http.hpp b/src/addons/dummy_network_http.hpp index 461913a93..cf58b8859 100644 --- a/src/addons/dummy_network_http.hpp +++ b/src/addons/dummy_network_http.hpp @@ -31,13 +31,13 @@ class XMLNode; */ class DummyNetworkHttp : public INetworkHttp { - + public: virtual ~DummyNetworkHttp() {} virtual void startNetworkThread() {} virtual void stopNetworkThread() {} virtual void insertReInit() {} - virtual Request *downloadFileAsynchron(const std::string &url, + virtual Request *downloadFileAsynchron(const std::string &url, const std::string &save = "", int priority = 1, bool manage_memory=true) { return NULL; } diff --git a/src/addons/inetwork_http.hpp b/src/addons/inetwork_http.hpp index f0b414f21..ed55aa215 100644 --- a/src/addons/inetwork_http.hpp +++ b/src/addons/inetwork_http.hpp @@ -38,20 +38,20 @@ private: public: /** If stk has permission to access the internet (for news * server etc). - * IPERM_NOT_ASKED: The user needs to be asked if he wants to + * IPERM_NOT_ASKED: The user needs to be asked if he wants to * grant permission * IPERM_ALLOWED: STK is allowed to access server. * IPERM_NOT_ALLOWED: STK must not access external servers. */ enum InternetPermission {IPERM_NOT_ASKED =0, IPERM_ALLOWED =1, IPERM_NOT_ALLOWED=2 }; - + public: virtual ~INetworkHttp() {} virtual void startNetworkThread() = 0; virtual void stopNetworkThread() = 0; virtual void insertReInit() = 0; - virtual Request *downloadFileAsynchron(const std::string &url, + virtual Request *downloadFileAsynchron(const std::string &url, const std::string &save = "", int priority = 1, bool manage_memory=true) = 0; @@ -59,7 +59,7 @@ public: static void create(); static INetworkHttp *get() { return m_network_http; } static void destroy(); - + }; // NetworkHttp diff --git a/src/addons/network_http.hpp b/src/addons/network_http.hpp index 2cbf19e80..3c670d7cc 100644 --- a/src/addons/network_http.hpp +++ b/src/addons/network_http.hpp @@ -45,8 +45,8 @@ class NetworkHttp : public INetworkHttp private: /** The list of pointes to all requests. */ - Synchronised< std::priority_queue, + Synchronised< std::priority_queue, Request::Compare > > m_all_requests; /** The current requested being worked on. */ @@ -79,7 +79,7 @@ public: void startNetworkThread(); void stopNetworkThread(); void insertReInit(); - Request *downloadFileAsynchron(const std::string &url, + Request *downloadFileAsynchron(const std::string &url, const std::string &save = "", int priority = 1, bool manage_memory=true); diff --git a/src/addons/news_manager.hpp b/src/addons/news_manager.hpp index 283256ffa..ba1770e7b 100644 --- a/src/addons/news_manager.hpp +++ b/src/addons/news_manager.hpp @@ -81,7 +81,7 @@ private: * the delay between messages. */ core::stringw m_all_news_messages; - /** Stores the news message display count from the user config file. + /** Stores the news message display count from the user config file. */ std::vector m_saved_display_count; @@ -99,7 +99,7 @@ public: ~NewsManager(); const core::stringw getNextNewsMessage(); - const core::stringw + const core::stringw getImportantMessage(); void init(); void addNewsMessage(const core::stringw &s); diff --git a/src/addons/request.hpp b/src/addons/request.hpp index eb4483ceb..4b6f540f9 100644 --- a/src/addons/request.hpp +++ b/src/addons/request.hpp @@ -73,7 +73,7 @@ private: public: LEAK_CHECK() - Request(HttpCommands command, int priority, + Request(HttpCommands command, int priority, bool manage_memory=true); Request(HttpCommands command, int priority, bool manage_memory, const std::string &url, const std::string &save); diff --git a/src/animations/animation_base.hpp b/src/animations/animation_base.hpp index ae20b0666..53aa55fab 100644 --- a/src/animations/animation_base.hpp +++ b/src/animations/animation_base.hpp @@ -72,11 +72,11 @@ public: virtual void update(float dt, Vec3 *xyz=NULL, Vec3 *hpr=NULL, Vec3 *scale=NULL); /** This needs to be implemented by the inheriting classes. It is called - * once per frame from the track. It has a dummy implementation that - * just asserts so that this class can be instantiated in + * once per frame from the track. It has a dummy implementation that + * just asserts so that this class can be instantiated in * CannonAnimation. */ virtual void update(float dt) {assert(false); }; - void setInitialTransform(const Vec3 &xyz, + void setInitialTransform(const Vec3 &xyz, const Vec3 &hpr); void reset(); // ------------------------------------------------------------------------ @@ -84,17 +84,17 @@ public: void setPlaying(bool playing) {m_playing = playing; } // ------------------------------------------------------------------------ - + float getAnimationDuration() const { float duration = -1; - + const Ipo* currIpo; for_in (currIpo, m_all_ipos) { duration = std::max(duration, currIpo->getEndTime()); } - + return duration; } diff --git a/src/animations/ipo.hpp b/src/animations/ipo.hpp index cc77d8ec3..308ae87a5 100644 --- a/src/animations/ipo.hpp +++ b/src/animations/ipo.hpp @@ -79,14 +79,14 @@ private: /** Stores the inital rotation of the object. */ Vec3 m_initial_hpr; private: - float getCubicBezier(float t, float p0, float p1, + float getCubicBezier(float t, float p0, float p1, float p2, float p3) const; - void approximateBezier(float t0, float t1, + void approximateBezier(float t0, float t1, const Vec3 &p0, const Vec3 &p1, const Vec3 &h0, const Vec3 &h2, unsigned int rec_level = 0); public: - IpoData(const XMLNode &curve, float fps, bool reverse); + IpoData(const XMLNode &curve, float fps, bool reverse); void readCurve(const XMLNode &node, bool reverse); void readIPO(const XMLNode &node, float fps, bool reverse); float approximateLength(float t0, float t1, @@ -118,7 +118,7 @@ public: Ipo(const XMLNode &curve, float fps=25, bool reverse=false); virtual ~Ipo(); Ipo *clone(); - void update(float time, Vec3 *xyz=NULL, Vec3 *hpr=NULL, + void update(float time, Vec3 *xyz=NULL, Vec3 *hpr=NULL, Vec3 *scale=NULL); float get(float time, unsigned int index) const; void setInitialTransform(const Vec3 &xyz, const Vec3 &hpr); @@ -128,7 +128,7 @@ public: /** Returns the raw data points for this IPO. */ const std::vector& getPoints() const { return m_ipo_data->m_points; } // ------------------------------------------------------------------------ - /** Returns the last specified time (i.e. not considering any extend + /** Returns the last specified time (i.e. not considering any extend * types). */ float getEndTime() const { return m_ipo_data->m_end_time; } }; // Ipo diff --git a/src/animations/three_d_animation.hpp b/src/animations/three_d_animation.hpp index ecf44d256..3c4ccd6e5 100644 --- a/src/animations/three_d_animation.hpp +++ b/src/animations/three_d_animation.hpp @@ -45,15 +45,15 @@ class ThreeDAnimation : public AnimationBase { private: TrackObject *m_object; - - /** True if a collision with this object should trigger + + /** True if a collision with this object should trigger * rescuing a kart. */ bool m_crash_reset; - - /** True if a collision with this object should trigger + + /** True if a collision with this object should trigger * "exploding" a kart. */ bool m_explode_kart; - + /** We have to store the rotation value as computed in blender, since * irrlicht uses a different order, so for rotation animations we * can not use the value returned by getRotation from a scene node. */ @@ -71,7 +71,7 @@ public: virtual ~ThreeDAnimation(); virtual void update(float dt); // ------------------------------------------------------------------------ - /** Returns true if a collision with this object should + /** Returns true if a collision with this object should * trigger a rescue. */ bool isCrashReset() const { return m_crash_reset; } bool isExplodeKartObject() const { return m_explode_kart; } diff --git a/src/audio/dummy_sfx.hpp b/src/audio/dummy_sfx.hpp index 8b09fa8a4..812828ada 100644 --- a/src/audio/dummy_sfx.hpp +++ b/src/audio/dummy_sfx.hpp @@ -24,7 +24,7 @@ -/** +/** * \brief Dummy sound when ogg or openal aren't available * \ingroup audio */ @@ -33,10 +33,10 @@ class DummySFX : public SFXBase public: DummySFX(SFXBuffer* buffer, bool positional, float gain) {} virtual ~DummySFX() {} - + /** Late creation, if SFX was initially disabled */ virtual bool init() { return true; } - + virtual void position(const Vec3 &position) {} virtual void setLoop(bool status) {} virtual void play() {} @@ -48,9 +48,9 @@ public: virtual SFXManager::SFXStatus getStatus() { return SFXManager::SFX_STOPPED; } virtual void onSoundEnabledBack() {} virtual void setRolloff(float rolloff) {} - + virtual const SFXBuffer* getBuffer() const { return NULL; } - + }; // DummySFX diff --git a/src/audio/music.hpp b/src/audio/music.hpp index 86cab57ab..0ed725960 100644 --- a/src/audio/music.hpp +++ b/src/audio/music.hpp @@ -39,7 +39,7 @@ public: virtual void updateFaster(float percent, float pitch) = 0; virtual void update () = 0; virtual bool isPlaying () = 0; - + virtual ~Music () {}; }; diff --git a/src/audio/music_dummy.hpp b/src/audio/music_dummy.hpp index 9b11e718f..16efd4e96 100644 --- a/src/audio/music_dummy.hpp +++ b/src/audio/music_dummy.hpp @@ -39,7 +39,7 @@ public: virtual void updateFaster(float percent, float pitch) {} virtual void update () {} virtual bool isPlaying () { return false; } - + virtual ~MusicDummy () {} }; diff --git a/src/audio/music_information.hpp b/src/audio/music_information.hpp index 2e3ab69f7..4af4a3f21 100644 --- a/src/audio/music_information.hpp +++ b/src/audio/music_information.hpp @@ -45,16 +45,16 @@ private: stringw m_title; std::string m_normal_filename; std::string m_fast_filename; - std::vector m_all_tracks; + std::vector m_all_tracks; //int m_numLoops; - + /** If faster music is enabled at all (either separate file or using * the pitch shift approach). */ - bool m_enable_fast; - + bool m_enable_fast; + float m_gain; float m_adjusted_gain; - + /** Either time for fading faster music in, or time to change pitch. */ float m_faster_time; /** Maximum pitch for faster music. */ @@ -66,15 +66,15 @@ private: SOUND_FADING, //!< normal music fading out, faster fading in SOUND_FASTER, //!< change pitch of normal music SOUND_FAST} //!< playing faster music or max pitch reached - m_mode; + m_mode; float m_time_since_faster; - // The constructor is private so that the + // The constructor is private so that the // static create function must be used. MusicInformation (const XMLNode *root, const std::string &filename); public: LEAK_CHECK() - + #if (defined(WIN32) || defined(_WIN32)) && !defined(__MINGW32__) #pragma warning(disable:4290) #endif @@ -94,10 +94,10 @@ public: void pauseMusic (); void resumeMusic (); void volumeMusic (float gain); - + void setTemporaryVolume(float gain); void resetTemporaryVolume() { volumeMusic(m_adjusted_gain); } - + void switchToFastMusic(); bool isPlaying() const; }; // MusicInformation diff --git a/src/audio/music_manager.hpp b/src/audio/music_manager.hpp index 66ffbac66..ef6887f96 100644 --- a/src/audio/music_manager.hpp +++ b/src/audio/music_manager.hpp @@ -36,14 +36,14 @@ class Vec3; */ class MusicManager : public NoCopy { -private: +private: MusicInformation *m_current_music; /** If the sound could not be initialized, e.g. if the player doesn't has - * a sound card, we want to avoid anything sound related so we crash the + * a sound card, we want to avoid anything sound related so we crash the * game. */ - bool m_initialized; - std::map + bool m_initialized; + std::map m_all_music; void loadMusicInformation(); @@ -64,15 +64,15 @@ public: m_current_music->resumeMusic(); } void switchToFastMusic() {if(m_current_music) m_current_music->switchToFastMusic();} - + void setMasterMusicVolume(float gain); float getMasterMusicVolume() const { return m_masterGain; } - - MusicInformation *getCurrentMusic() {return m_current_music; } - + + MusicInformation *getCurrentMusic() {return m_current_music; } + /** * @throw runtime_error if the music file could not be found/opened - */ + */ MusicInformation *getMusicInformation(const std::string& filename); void loadMusicFromOneDir(const std::string& dir); diff --git a/src/audio/music_ogg.hpp b/src/audio/music_ogg.hpp index 2ca78e917..afd1f899e 100644 --- a/src/audio/music_ogg.hpp +++ b/src/audio/music_ogg.hpp @@ -62,7 +62,7 @@ public: virtual bool resumeMusic(); virtual void volumeMusic (float gain); virtual bool isPlaying(); - + protected: bool empty(); bool check(const char* what); @@ -79,7 +79,7 @@ private: bool m_error; bool m_playing; - + ALuint m_soundBuffers[2]; ALuint m_soundSource; ALenum nb_channels; diff --git a/src/audio/sfx_base.hpp b/src/audio/sfx_base.hpp index 4b9ca2a78..7fd5a8ec4 100644 --- a/src/audio/sfx_base.hpp +++ b/src/audio/sfx_base.hpp @@ -30,7 +30,7 @@ class Vec3; -/** +/** * \brief The base class for sound effects. * It gets a sound buffer from the sound * manager, which is shared between all instances. Do create a new sound @@ -43,10 +43,10 @@ class SFXBase : public NoCopy { public: virtual ~SFXBase() {} - + /** Late creation, if SFX was initially disabled */ virtual bool init() = 0; - + virtual void position(const Vec3 &position) = 0; virtual void setLoop(bool status) = 0; virtual void play() = 0; @@ -55,7 +55,7 @@ public: virtual void resume() = 0; virtual void speed(float factor) = 0; virtual void volume(float gain) = 0; - virtual SFXManager::SFXStatus + virtual SFXManager::SFXStatus getStatus() = 0; virtual void onSoundEnabledBack() = 0; virtual void setRolloff(float rolloff) = 0; diff --git a/src/audio/sfx_buffer.hpp b/src/audio/sfx_buffer.hpp index 6fd28af1e..4efbf53aa 100644 --- a/src/audio/sfx_buffer.hpp +++ b/src/audio/sfx_buffer.hpp @@ -45,64 +45,64 @@ class XMLNode; class SFXBuffer { private: - + /** Whether the contents of the file was loaded */ bool m_loaded; - + /** The file that contains the OGG audio data */ std::string m_file; - + ALuint m_buffer; bool m_positional; float m_rolloff; float m_gain; float m_max_dist; - + bool loadVorbisBuffer(const std::string &name, ALuint buffer); - + public: - + SFXBuffer(const std::string& file, bool positional, float rolloff, float max_width, float gain); - + SFXBuffer(const std::string& file, const XMLNode* node); - + ~SFXBuffer() { } - + /** * \brief load the buffer from file into OpenAL. * \note If this buffer is already loaded, this call does nothing and returns false * \return whether loading was successful */ bool load(); - + /** * \brief Frees the loaded buffer * Cannot appear in destructor because copy-constructors may be used, * and the OpenAL source must not be deleted on a copy */ void unload(); - + /** \return whether this buffer was loaded from disk */ bool isLoaded() const { return m_loaded; } - + /** Only returns a valid buffer if isLoaded() returned true */ ALuint getBufferID() const { return m_buffer; } - + bool isPositional() const { return m_positional; } float getRolloff() const { return m_rolloff; } float getGain() const { return m_gain; } float getMaxDist() const { return m_max_dist; } std::string getFileName() const { return m_file; } - + void setPositional(bool positional) { m_positional = positional; } - + LEAK_CHECK() }; diff --git a/src/audio/sfx_manager.hpp b/src/audio/sfx_manager.hpp index ab1d793f8..f62022885 100644 --- a/src/audio/sfx_manager.hpp +++ b/src/audio/sfx_manager.hpp @@ -78,18 +78,18 @@ public: SFX_INITIAL = 3 }; -private: - +private: + /** Listener position */ Vec3 m_position; - + /** The buffers and info for all sound effects. These are shared among all * instances of SFXOpenal. */ std::map m_all_sfx_types; - + /** The actual instances (sound sources) */ std::vector m_all_sfx; - + /** To play non-positional sounds without having to create a new object for each */ static std::map m_quick_sounds; @@ -101,7 +101,7 @@ private: void loadSfx(); - bool loadVorbisBuffer(const std::string &name, + bool loadVorbisBuffer(const std::string &name, ALuint buffer); public: SFXManager(); @@ -116,12 +116,12 @@ public: float max_width, float gain); - SFXBase* createSoundSource(SFXBuffer* info, + SFXBase* createSoundSource(SFXBuffer* info, const bool addToSFXList=true, const bool owns_buffer=false); - SFXBase* createSoundSource(const std::string &name, + SFXBase* createSoundSource(const std::string &name, const bool addToSFXList=true); - + void deleteSFX(SFXBase *sfx); void deleteSFXMapping(const std::string &name); void pauseAll(); @@ -129,19 +129,19 @@ public: bool soundExist(const std::string &name); void setMasterSFXVolume(float gain); float getMasterSFXVolume() const { return m_master_gain; } - + static bool checkError(const std::string &context); static const std::string getErrorString(int err); - + void positionListener(const Vec3 &position, const Vec3 &front); SFXBase* quickSound(const std::string &soundName); - + /** Called when sound was muted/unmuted */ void soundToggled(const bool newValue); - + /** Prints the list of currently loaded sounds to stdout. Useful to debug audio leaks */ void dump(); - + Vec3 getListenerPos() const { return m_position; } }; diff --git a/src/audio/sfx_openal.hpp b/src/audio/sfx_openal.hpp index e6e09b309..edc0c30cd 100644 --- a/src/audio/sfx_openal.hpp +++ b/src/audio/sfx_openal.hpp @@ -43,29 +43,29 @@ private: bool m_ok; bool m_positional; float m_defaultGain; - + /** The OpenAL source contains this info, but if audio is disabled initially then the sound source won't be created and we'll be left with no clue when enabling sounds later */ bool m_loop; - + /** Contains a volume if set through the "volume" method, or a negative number if this method was not called. The OpenAL source contains this info, but if audio is disabled initially then the sound source won't be created and we'll be left with no clue when enabling sounds later. */ float m_gain; - + bool m_owns_buffer; - + public: SFXOpenAL(SFXBuffer* buffer, bool positional, float gain, bool owns_buffer = false); virtual ~SFXOpenAL(); - + /** Late creation, if SFX was initially disabled */ virtual bool init(); - + virtual void play(); virtual void setLoop(bool status); virtual void stop(); @@ -79,9 +79,9 @@ public: virtual void setRolloff(float rolloff); virtual const SFXBuffer* getBuffer() const { return m_soundBuffer; } - + LEAK_CHECK() - + }; // SFXOpenAL #endif diff --git a/src/challenges/challenge.hpp b/src/challenges/challenge.hpp index d1ce33a6a..739cc4e5b 100644 --- a/src/challenges/challenge.hpp +++ b/src/challenges/challenge.hpp @@ -42,7 +42,7 @@ class ChallengeData; * \brief The state of a challenge for one player. * Each Challenge has one ChallengeData associcated, which stores * the actual data about the challenge. - * + * * \ingroup challenges */ class Challenge : public NoCopy @@ -52,9 +52,9 @@ private: CH_ACTIVE, // challenge possible, but not yet solved CH_SOLVED} // challenge was solved m_state[RaceManager::DIFFICULTY_COUNT]; - + ChallengeData* m_data; - + public: Challenge(ChallengeData* data) { @@ -71,24 +71,24 @@ public: // ------------------------------------------------------------------------ /** Returns if this challenge was solved at the specified difficulty. */ - bool isSolved(RaceManager::Difficulty d) const + bool isSolved(RaceManager::Difficulty d) const { return m_state[d]==CH_SOLVED; } // isSolved // ------------------------------------------------------------------------ /** Returns true if this challenge was solved at any difficult. */ - bool isSolvedAtAnyDifficulty() const + bool isSolvedAtAnyDifficulty() const { return m_state[0]==CH_SOLVED || m_state[1]==CH_SOLVED || - m_state[2]==CH_SOLVED; + m_state[2]==CH_SOLVED; } // isSolvedAtAnyDifficulty // ------------------------------------------------------------------------ /** True if this challenge is active at the given difficulty. */ - bool isActive(RaceManager::Difficulty d) const + bool isActive(RaceManager::Difficulty d) const { - return m_state[d]==CH_ACTIVE; + return m_state[d]==CH_ACTIVE; } // isActive // ------------------------------------------------------------------------ /** Sets this challenge to be active. diff --git a/src/challenges/challenge_data.hpp b/src/challenges/challenge_data.hpp index 1eb8511b6..e1586dc0c 100644 --- a/src/challenges/challenge_data.hpp +++ b/src/challenges/challenge_data.hpp @@ -48,11 +48,11 @@ public: class UnlockableFeature { public: - + std::string m_name; // internal name irr::core::stringw m_user_name; // not all types of feature have one RewardType m_type; - + const irr::core::stringw getUnlockedMessage() const; }; // UnlockableFeature // ------------------------------------------------------------------------ @@ -69,8 +69,8 @@ private: * a race challenge). */ enum ChallengeModeType { - CM_GRAND_PRIX, - CM_SINGLE_RACE, + CM_GRAND_PRIX, + CM_SINGLE_RACE, CM_ANY }; @@ -105,29 +105,29 @@ private: /** Number of trophies required to access this challenge */ int m_num_trophies; - + irr::core::stringw m_challenge_description; - + public: #ifdef WIN32 ChallengeData(const std::string& filename); #else ChallengeData(const std::string& filename) throw(std::runtime_error); #endif - + virtual ~ChallengeData() {} - + /** sets the right parameters in RaceManager to try this challenge */ void setRace(RaceManager::Difficulty d) const; - + virtual void check() const; virtual bool isChallengeFulfilled() const; virtual bool isGPFulfilled() const; void addUnlockTrackReward(const std::string &track_name); - void addUnlockModeReward(const std::string &internal_mode_name, + void addUnlockModeReward(const std::string &internal_mode_name, const irr::core::stringw &user_mode_name); void addUnlockGPReward(const std::string &gp_name); - void addUnlockDifficultyReward(const std::string &internal_name, + void addUnlockDifficultyReward(const std::string &internal_name, const irr::core::stringw &user_name); void addUnlockKartReward(const std::string &internal_name, const irr::core::stringw &user_name); @@ -135,13 +135,13 @@ public: // ------------------------------------------------------------------------ /** Returns the version number of this challenge. */ int getVersion() const { return m_version; } - + // ------------------------------------------------------------------------ - /** Returns the list of unlockable features for this challenge. + /** Returns the list of unlockable features for this challenge. */ const std::vector& getFeatures() const { return m_feature; } - + // ------------------------------------------------------------------------ /** Returns the id of the challenge. */ const std::string &getId() const { return m_id; } @@ -149,21 +149,21 @@ public: // ------------------------------------------------------------------------ /** Sets the id of this challenge. */ void setId(const std::string& s) { m_id = s; } - + // ------------------------------------------------------------------------ /** Returns the track associated with this challenge. */ - const std::string& getTrackId() const - { + const std::string& getTrackId() const + { assert(m_mode==CM_SINGLE_RACE); - return m_track_id; + return m_track_id; } // getTrackId // ------------------------------------------------------------------------ /** Returns the id of the grand prix associated with this challenge. */ - const std::string& getGPId() const - { + const std::string& getGPId() const + { assert(m_mode==CM_GRAND_PRIX); - return m_gp_id; + return m_gp_id; } // getGPId // ------------------------------------------------------------------------ @@ -177,26 +177,26 @@ public: // ------------------------------------------------------------------------ /** Get number of required trophies to start this challenge */ int getNumTrophies() const { return m_num_trophies; } - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ /** Returns if this challenge is a grand prix. */ bool isGrandPrix() const { return m_mode == CM_GRAND_PRIX; } - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ /** Returns if this challenge is a grand prix. */ bool isSingleRace() const { return m_mode == CM_SINGLE_RACE; } - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ /** Returns the challenge mode of this challenge. */ ChallengeModeType getMode() const { return m_mode; } // ------------------------------------------------------------------------ /** Returns the minor mode of this challenge. */ RaceManager::MinorRaceModeType getMinorMode() const { return m_minor; } // ------------------------------------------------------------------------ - /** Returns the description of this challenge. + /** Returns the description of this challenge. */ - const irr::core::stringw& getChallengeDescription() const + const irr::core::stringw& getChallengeDescription() const { return m_challenge_description; } // getChallengeDescription - + // ------------------------------------------------------------------------ /** Returns the minimum position the player must have in order to win. */ @@ -208,8 +208,8 @@ public: // ------------------------------------------------------------------------ /** Returns the number of karts to use. */ - int getNumKarts(RaceManager::Difficulty difficulty) const - { + int getNumKarts(RaceManager::Difficulty difficulty) const + { return m_num_karts[difficulty]; } // getNumKarts // ------------------------------------------------------------------------ @@ -223,17 +223,17 @@ public: /** Return the energy that a kart must at least have at the end of a race. */ int getEnergy(RaceManager::Difficulty difficulty) const - { + { return m_energy[difficulty]; } // getEnergy // ------------------------------------------------------------------------ /** Returns the name of the AI to use (used for boss challenge). */ const std::string& getAIKartIdent(RaceManager::Difficulty difficulty) const - { - return m_ai_kart_ident[difficulty]; + { + return m_ai_kart_ident[difficulty]; } - + }; // ChallengeData #endif // HEADER_CHALLENGE_DATA_HPP diff --git a/src/challenges/game_slot.hpp b/src/challenges/game_slot.hpp index 6ce3d4412..1994b0bc9 100644 --- a/src/challenges/game_slot.hpp +++ b/src/challenges/game_slot.hpp @@ -41,43 +41,43 @@ const int CHALLENGE_POINTS[] = { 8, 9, 10 }; class GameSlot { std::string m_kart_ident; - + /** Profile names can change, so rather than try to make sure all renames * are done everywhere, assign a unique ID to each profiler. * Will save much headaches. */ std::string m_player_unique_id; - + /** Contains whether each feature of the challenge is locked or unlocked */ std::map m_locked_features; - + /** Recently unlocked features (they are waiting here * until they are shown to the user) */ std::vector m_unlocked_features; - + std::map m_challenges_state; - - /** A pointer to the current challenge, or NULL + + /** A pointer to the current challenge, or NULL * if no challenge is active. */ const Challenge *m_current_challenge; friend class UnlockManager; - + void computeActive(); - + int m_points; - + /** Set to false after the initial stuff (intro, select kart, etc.) */ bool m_first_time; - + int m_easy_challenges; int m_medium_challenges; int m_hard_challenges; - + public: - - // do NOT attempt to pass 'player_unique_id' by reference here. I don't - // know why (compiler bug maybe?) but this screws up everything. Better + + // do NOT attempt to pass 'player_unique_id' by reference here. I don't + // know why (compiler bug maybe?) but this screws up everything. Better // pass by copy. GameSlot(std::string player_unique_id) { @@ -90,36 +90,36 @@ public: m_current_challenge = NULL; } ~GameSlot(); - + const std::string& getPlayerID() const { return m_player_unique_id; } const std::string& getKartIdent () const { return m_kart_ident; } - void setKartIdent(const std::string& kart_ident) + void setKartIdent(const std::string& kart_ident) { - m_kart_ident = kart_ident; + m_kart_ident = kart_ident; } - - - /** Returns the list of recently unlocked features (e.g. call at the end + + + /** Returns the list of recently unlocked features (e.g. call at the end * of a race to know if any features were unlocked) */ - const std::vector + const std::vector getRecentlyCompletedChallenges() {return m_unlocked_features;} - + /** Clear the list of recently unlocked challenges */ void clearUnlocked () {m_unlocked_features.clear(); } - + bool isLocked (const std::string& feature); - + void lockFeature (Challenge *challenge); - - void unlockFeature (Challenge* c, RaceManager::Difficulty d, + + void unlockFeature (Challenge* c, RaceManager::Difficulty d, bool do_save=true); - + void raceFinished (); void grandPrixFinished (); - + void save (std::ofstream& file, const std::string& name); void setCurrentChallenge(const std::string &challenge_id); - + /** Returns the number of points accumulated. */ int getPoints () const { return m_points; } // ------------------------------------------------------------------------ @@ -140,11 +140,11 @@ public: // ------------------------------------------------------------------------ const Challenge *getCurrentChallenge() const { return m_current_challenge; } // ------------------------------------------------------------------------ - /** Returns a challenge given the challenge id. + /** Returns a challenge given the challenge id. */ const Challenge* getChallenge(const std::string& id) const { - std::map::const_iterator it = + std::map::const_iterator it = m_challenges_state.find(id); assert(it!=m_challenges_state.end()); return it->second; diff --git a/src/challenges/unlock_manager.hpp b/src/challenges/unlock_manager.hpp index 857c53d25..7a56ade22 100644 --- a/src/challenges/unlock_manager.hpp +++ b/src/challenges/unlock_manager.hpp @@ -44,19 +44,19 @@ private: SFXBase *m_locked_sound; void load (); - + typedef std::map AllChallengesType; AllChallengesType m_all_challenges; - + std::map m_game_slots; - + void readAllChallengesInDirs(const std::vector* all_dirs); - + /** ID of the active player */ std::string m_current_game_slot; - + friend class GameSlot; - + public: UnlockManager (); ~UnlockManager (); @@ -65,33 +65,33 @@ public: void save (); bool createSlotsIfNeeded(); bool deleteSlotsIfNeeded(); - + const ChallengeData *getChallenge (const std::string& id); bool isSupportedVersion(const ChallengeData &challenge); /** Eye- (or rather ear-) candy. Play a sound when user tries to access a locked area */ void playLockSound() const; - + const std::string& getCurrentSlotID() const { return m_current_game_slot; } - + GameSlot* getCurrentSlot() { assert(m_game_slots.find(m_current_game_slot) != m_game_slots.end()); return m_game_slots[m_current_game_slot]; } - + /** \param slotid name of the player */ void setCurrentSlot(std::string slotid) { m_current_game_slot = slotid; } - + void findWhatWasUnlocked(int pointsBefore, int pointsNow, std::vector& tracks, std::vector& gps); - + PlayerProfile* getCurrentPlayer(); - + void updateActiveChallengeList(); - + }; // UnlockManager extern UnlockManager* unlock_manager; diff --git a/src/config/device_config.hpp b/src/config/device_config.hpp index 7ce123970..b7bf2a1c5 100644 --- a/src/config/device_config.hpp +++ b/src/config/device_config.hpp @@ -47,22 +47,22 @@ enum DeviceConfigType class DeviceConfig : public NoCopy { protected: - + Binding m_bindings[PA_COUNT]; int m_plugged; //!< How many devices connected to the system which uses this config? - + bool m_enabled; //!< If set to false, this device will be ignored. Currently for gamepads only std::string m_name; - + DeviceConfigType m_type; - + DeviceConfig(DeviceConfigType type) { m_type = type; m_enabled = true; } - + /** * \brief internal helper method for DeviceConfig::getGameAction and DeviceConfig::getMenuAction */ @@ -72,62 +72,62 @@ protected: const PlayerAction firstActionToCheck, const PlayerAction lastActionToCheck, PlayerAction* action /* out */ ); - + public: - + std::string getName () const { return m_name; }; irr::core::stringw toString (); DeviceConfigType getType () const { return m_type; } - + /** Get a user-readable string describing the bound action */ irr::core::stringw getBindingAsString(const PlayerAction action) const; - + /** Get an internal unique string describing the bound action */ irr::core::stringw getMappingIdString (const PlayerAction action) const; - + void serialize (std::ofstream& stream); bool deserializeAction (irr::io::IrrXMLReader* xml); - + void setBinding (const PlayerAction action, const Input::InputType type, const int id, Input::AxisDirection direction = Input::AD_NEUTRAL, wchar_t character=0); - + void setPlugged () { m_plugged++; } bool isPlugged () const { return m_plugged > 0; } int getNumberOfDevices () const { return m_plugged; } - + /** * \brief Searches for a game actions associated with the given input event * \note Don't call this directly unless you are KeyboardDevice or GamepadDevice * \param[out] action the result, only set if method returned true * \return whether finding an action associated to this input was successful */ - bool getGameAction (Input::InputType type, + bool getGameAction (Input::InputType type, const int id, const int value, PlayerAction* action /* out */); - + /** * \brief Searches for a game actions associated with the given input event * \note Don't call this directly unless you are KeyboardDevice or GamepadDevice * \param[out] action the result, only set if method returned true * \return whether finding an action associated to this input was successful */ - bool getMenuAction (Input::InputType type, + bool getMenuAction (Input::InputType type, const int id, const int value, PlayerAction* action /* out */); - + Binding& getBinding (int i) {return m_bindings[i];} - + bool hasBindingFor(const int buttonID) const; bool hasBindingFor(const int buttonID, PlayerAction from, PlayerAction to) const; - + /** At this time only relevant for gamepads, keyboards are always enabled */ bool isEnabled() const { return m_enabled; } - + void setEnabled(bool newValue) { m_enabled = newValue; } }; @@ -141,10 +141,10 @@ class KeyboardConfig : public DeviceConfig { public: - + void setDefaultBinds (); void serialize (std::ofstream& stream); - + KeyboardConfig (); }; @@ -157,16 +157,16 @@ public: */ class GamepadConfig : public DeviceConfig { - + private: /** Number of axis this device has. */ int m_axis_count; /** Number of buttons this device has. */ int m_button_count; - + public: - + irr::core::stringw toString (); void serialize (std::ofstream& stream); @@ -180,8 +180,8 @@ public: void setNumberOfButtons(int count) { m_button_count = count; } // ------------------------------------------------------------------------ /** Sets the number of axis this device has. */ - void setNumberOfAxis(int count) { m_axis_count = count; } - // ~GamepadConfig(); + void setNumberOfAxis(int count) { m_axis_count = count; } + // ~GamepadConfig(); }; #endif diff --git a/src/config/player.hpp b/src/config/player.hpp index 78789db71..c0c68a779 100644 --- a/src/config/player.hpp +++ b/src/config/player.hpp @@ -34,54 +34,54 @@ using namespace irr; class PlayerProfile : public NoCopy { protected: - + /** * For saving to config file. * WARNING : m_player_group has to be declared before the other userconfigparams! */ GroupUserConfigParam m_player_group; - + WStringUserConfigParam m_name; - + BoolUserConfigParam m_is_guest_account; - + #ifdef DEBUG unsigned int m_magic_number; #endif - + IntUserConfigParam m_use_frequency; /** Profile names can change, so rather than try to make sure all renames are done everywhere, * assign a unique ID to each profiler. Will save much headaches. */ StringUserConfigParam m_unique_id; - + int64_t generateUniqueId(const char* playerName); - + public: - + /** * Constructor to create a new player that didn't exist before */ PlayerProfile(const core::stringw& name); - + /** * Constructor to deserialize a player that was saved to a XML file * (...UserConfigParam classes will automagically take care of serializing all * create players to the user's config file) */ PlayerProfile(const XMLNode* node); - - + + ~PlayerProfile() { #ifdef DEBUG m_magic_number = 0xDEADBEEF; #endif } - + void setName(const core::stringw& name) - { + { #ifdef DEBUG assert(m_magic_number == 0xABCD1234); #endif @@ -89,7 +89,7 @@ public: } core::stringw getName() const - { + { #ifdef DEBUG assert(m_magic_number == 0xABCD1234); #endif @@ -97,22 +97,22 @@ public: } bool isGuestAccount() const - { + { #ifdef DEBUG - assert(m_magic_number == 0xABCD1234); + assert(m_magic_number == 0xABCD1234); #endif return m_is_guest_account; } - + int getUseFrequency() const { if (m_is_guest_account) return -1; else return m_use_frequency; } - - + + void incrementUseFrequency(); - + // please do NOT try to optimise this to return a reference, I don't know why, // maybe compiler bug, but hell breaks loose when you do that std::string getUniqueID() const diff --git a/src/config/saved_grand_prix.hpp b/src/config/saved_grand_prix.hpp index 3a74bb12f..89b061be5 100644 --- a/src/config/saved_grand_prix.hpp +++ b/src/config/saved_grand_prix.hpp @@ -54,7 +54,7 @@ private: }; // SavedGPKart protected: - + /** * For saving to config file. * WARNING : m_savedgp_group has to be declared before the other userconfigparams! @@ -95,7 +95,7 @@ public: void setKarts(const std::vector &kart_list); void clearKarts(); void loadKarts(std::vector & kart_list); - + // ------------------------------------------------------------------------ /** Returns the player id for this saved GP. */ const std::string getPlayerID() const { return m_player_id; } @@ -137,9 +137,9 @@ public: /** Finds the right SavedGrandPrix given the specified data, or * NULL if no matching GP was found. */ - static SavedGrandPrix* getSavedGP(const std::string &player, - const std::string &gpid, - int difficulty, int total_karts, + static SavedGrandPrix* getSavedGP(const std::string &player, + const std::string &gpid, + int difficulty, int total_karts, int player_karts) { for (int n=0; n m_leader_intervals; /** m_switch_items; /**< How to switch items. */ /** The number of points a kart on position X has more than the diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index 810b715c7..3d9eb9eb5 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -25,7 +25,7 @@ (so that defaults to 0) 1: Removed singleWindowMenu, newKeyboardStyle, oldStatusDisplay, added config-version number - Version 1 can read version 0 without any problems, so + Version 1 can read version 0 without any problems, so SUPPORTED_CONFIG_VERSION is 0. 2: Changed to SDL keyboard bindings 3: Added username (userid was used for ALL players) @@ -61,7 +61,7 @@ class XMLNode; class XMLWriter; /** - * The base of a set of small utilities to enable quickly adding/removing + * The base of a set of small utilities to enable quickly adding/removing * stuff to/from config painlessly. */ class UserConfigParam @@ -106,26 +106,26 @@ class IntUserConfigParam : public UserConfigParam { int m_value; int m_default_value; - + public: - - IntUserConfigParam(int default_value, const char* param_name, + + IntUserConfigParam(int default_value, const char* param_name, const char* comment = NULL); - IntUserConfigParam(int default_value, const char* param_name, - GroupUserConfigParam* group, + IntUserConfigParam(int default_value, const char* param_name, + GroupUserConfigParam* group, const char* comment = NULL); void write(XMLWriter& stream) const; void findYourDataInAChildOf(const XMLNode* node); void findYourDataInAnAttributeOf(const XMLNode* node); - + irr::core::stringw toString() const; void revertToDefaults() { m_value = m_default_value; } operator int() const { return m_value; } int& operator++(int dummy) { m_value++; return m_value; } int& operator=(const int& v) { m_value = v; return m_value; } - int& operator=(const IntUserConfigParam& v) + int& operator=(const IntUserConfigParam& v) { m_value = (int)v; return m_value; } }; // IntUserConfigParam @@ -134,24 +134,24 @@ class TimeUserConfigParam : public UserConfigParam { Time::TimeType m_value; Time::TimeType m_default_value; - + public: - - TimeUserConfigParam(Time::TimeType default_value, const char* param_name, + + TimeUserConfigParam(Time::TimeType default_value, const char* param_name, const char* comment = NULL); - TimeUserConfigParam(Time::TimeType default_value, const char* param_name, + TimeUserConfigParam(Time::TimeType default_value, const char* param_name, GroupUserConfigParam* group, const char* comment=NULL); void write(XMLWriter& stream) const; void findYourDataInAChildOf(const XMLNode* node); void findYourDataInAnAttributeOf(const XMLNode* node); - + irr::core::stringw toString() const; void revertToDefaults() { m_value = m_default_value; } operator Time::TimeType() const { return m_value; } - Time::TimeType& operator=(const Time::TimeType& v) + Time::TimeType& operator=(const Time::TimeType& v) { m_value = v; return m_value; } - Time::TimeType& operator=(const TimeUserConfigParam& v) + Time::TimeType& operator=(const TimeUserConfigParam& v) { m_value = (int)v; return m_value; } }; // TimeUserConfigParam @@ -160,29 +160,29 @@ class StringUserConfigParam : public UserConfigParam { std::string m_value; std::string m_default_value; - + public: - - StringUserConfigParam(const char* default_value, const char* param_name, + + StringUserConfigParam(const char* default_value, const char* param_name, const char* comment = NULL); - StringUserConfigParam(const char* default_value, const char* param_name, - GroupUserConfigParam* group, + StringUserConfigParam(const char* default_value, const char* param_name, + GroupUserConfigParam* group, const char* comment = NULL); void write(XMLWriter& stream) const; void findYourDataInAChildOf(const XMLNode* node); void findYourDataInAnAttributeOf(const XMLNode* node); - + void revertToDefaults() { m_value = m_default_value; } - + std::string getDefaultValue() const { return m_default_value; } - + irr::core::stringw toString() const { return m_value.c_str(); } - + operator std::string() const { return m_value; } std::string& operator=(const std::string& v) { m_value = v; return m_value; } - std::string& operator=(const StringUserConfigParam& v) + std::string& operator=(const StringUserConfigParam& v) { m_value = (std::string)v; return m_value; } const char* c_str() const { return m_value.c_str(); } @@ -193,28 +193,28 @@ class WStringUserConfigParam : public UserConfigParam { stringw m_value; stringw m_default_value; - + public: - - WStringUserConfigParam(const stringw& default_value, + + WStringUserConfigParam(const stringw& default_value, const char* param_name, const char* comment = NULL); - WStringUserConfigParam(const stringw& default_value, + WStringUserConfigParam(const stringw& default_value, const char* param_name, - GroupUserConfigParam* group, + GroupUserConfigParam* group, const char* comment = NULL); - + void write(XMLWriter& stream) const; void findYourDataInAChildOf(const XMLNode* node); void findYourDataInAnAttributeOf(const XMLNode* node); - + void revertToDefaults() { m_value = m_default_value; } - + irr::core::stringw toString() const { return m_value; } - + operator stringw() const { return m_value; } stringw& operator=(const stringw& v) { m_value = v; return m_value; } - stringw& operator=(const WStringUserConfigParam& v) + stringw& operator=(const WStringUserConfigParam& v) { m_value = (stringw)v; return m_value; } const wchar_t* c_str() const { return m_value.c_str(); } }; // WStringUserConfigParam @@ -224,23 +224,23 @@ class BoolUserConfigParam : public UserConfigParam { bool m_value; bool m_default_value; - + public: - BoolUserConfigParam(bool default_value, const char* param_name, + BoolUserConfigParam(bool default_value, const char* param_name, const char* comment = NULL); - BoolUserConfigParam(bool default_value, const char* param_name, - GroupUserConfigParam* group, + BoolUserConfigParam(bool default_value, const char* param_name, + GroupUserConfigParam* group, const char* comment = NULL); void write(XMLWriter& stream) const; void findYourDataInAChildOf(const XMLNode* node); void findYourDataInAnAttributeOf(const XMLNode* node); - + irr::core::stringw toString() const; void revertToDefaults() { m_value = m_default_value; } - + operator bool() const { return m_value; } bool& operator=(const bool& v) { m_value = v; return m_value; } - bool& operator=(const BoolUserConfigParam& v) + bool& operator=(const BoolUserConfigParam& v) { m_value = (bool)v; return m_value; } }; // BoolUserConfigParam @@ -249,36 +249,36 @@ class FloatUserConfigParam : public UserConfigParam { float m_value; float m_default_value; - + public: - FloatUserConfigParam(float default_value, const char* param_name, + FloatUserConfigParam(float default_value, const char* param_name, const char* comment = NULL); - FloatUserConfigParam(float default_value, const char* param_name, - GroupUserConfigParam* group, + FloatUserConfigParam(float default_value, const char* param_name, + GroupUserConfigParam* group, const char* comment = NULL); void write(XMLWriter& stream) const; void findYourDataInAChildOf(const XMLNode* node); void findYourDataInAnAttributeOf(const XMLNode* node); - + irr::core::stringw toString() const; void revertToDefaults() { m_value = m_default_value; } - + operator float() const { return m_value; } float& operator=(const float& v) { m_value = v; return m_value; } - float& operator=(const FloatUserConfigParam& v) + float& operator=(const FloatUserConfigParam& v) { m_value = (float)v; return m_value; } }; // FloatUserConfigParam // ============================================================================ -enum AnimType {ANIMS_NONE = 0, +enum AnimType {ANIMS_NONE = 0, ANIMS_PLAYERS_ONLY = 1, ANIMS_ALL = 2 }; -/** Using X-macros for setting-possible values is not very pretty, but it's a +/** Using X-macros for setting-possible values is not very pretty, but it's a * no-maintenance case : - * when you want to add a new parameter, just add one signle line below and - * everything else automagically works (including default value, saving to + * when you want to add a new parameter, just add one signle line below and + * everything else automagically works (including default value, saving to * file, loading from file) */ @@ -300,53 +300,53 @@ namespace UserConfigParams // ---- Audio PARAM_PREFIX GroupUserConfigParam m_audio_group PARAM_DEFAULT( GroupUserConfigParam("Audio", "Audio Settings") ); - + PARAM_PREFIX BoolUserConfigParam m_sfx PARAM_DEFAULT( BoolUserConfigParam(true, "sfx_on", &m_audio_group, "Whether sound effects are enabled or not (true or false)") ); PARAM_PREFIX BoolUserConfigParam m_music - PARAM_DEFAULT( BoolUserConfigParam(true, "music_on", - &m_audio_group, + PARAM_DEFAULT( BoolUserConfigParam(true, "music_on", + &m_audio_group, "Whether musics are enabled or not (true or false)") ); PARAM_PREFIX FloatUserConfigParam m_sfx_volume - PARAM_DEFAULT( FloatUserConfigParam(1.0, "sfx_volume", + PARAM_DEFAULT( FloatUserConfigParam(1.0, "sfx_volume", &m_audio_group, "Volume for sound effects, see openal AL_GAIN " "for interpretation") ); PARAM_PREFIX FloatUserConfigParam m_music_volume - PARAM_DEFAULT( FloatUserConfigParam(0.7f, "music_volume", + PARAM_DEFAULT( FloatUserConfigParam(0.7f, "music_volume", &m_audio_group, "Music volume from 0.0 to 1.0") ); - + // ---- Race setup PARAM_PREFIX GroupUserConfigParam m_race_setup_group - PARAM_DEFAULT( GroupUserConfigParam("RaceSetup", + PARAM_DEFAULT( GroupUserConfigParam("RaceSetup", "Race Setup Settings") ); - + PARAM_PREFIX IntUserConfigParam m_num_karts - PARAM_DEFAULT( IntUserConfigParam(4, "numkarts", - &m_race_setup_group, + PARAM_DEFAULT( IntUserConfigParam(4, "numkarts", + &m_race_setup_group, "Default number of karts. -1 means use all") ); PARAM_PREFIX IntUserConfigParam m_num_laps - PARAM_DEFAULT( IntUserConfigParam(4, "numlaps", + PARAM_DEFAULT( IntUserConfigParam(4, "numlaps", &m_race_setup_group, "Default number of laps.") ); PARAM_PREFIX IntUserConfigParam m_difficulty - PARAM_DEFAULT( IntUserConfigParam(0, "difficulty", - &m_race_setup_group, + PARAM_DEFAULT( IntUserConfigParam(0, "difficulty", + &m_race_setup_group, "Default race difficulty. 0=easy, 1=medium, 2=hard") ); PARAM_PREFIX IntUserConfigParam m_game_mode - PARAM_DEFAULT( IntUserConfigParam(0, "game_mode", - &m_race_setup_group, + PARAM_DEFAULT( IntUserConfigParam(0, "game_mode", + &m_race_setup_group, "Game mode. 0=standard, 1=time trial, 2=follow " "the leader, 3=3 strikes") ); PARAM_PREFIX StringUserConfigParam m_default_kart - PARAM_DEFAULT( StringUserConfigParam("tux", "kart", + PARAM_DEFAULT( StringUserConfigParam("tux", "kart", "Kart to select by default (the last used kart)") ); PARAM_PREFIX StringUserConfigParam m_last_used_kart_group - PARAM_DEFAULT( StringUserConfigParam("all", "last_kart_group", + PARAM_DEFAULT( StringUserConfigParam("all", "last_kart_group", "Last selected kart group") ); // ---- Wiimote data PARAM_PREFIX GroupUserConfigParam m_wiimote_group - PARAM_DEFAULT( GroupUserConfigParam("WiiMote", + PARAM_DEFAULT( GroupUserConfigParam("WiiMote", "Settings for the wiimote") ); PARAM_PREFIX FloatUserConfigParam m_wiimote_max PARAM_DEFAULT( FloatUserConfigParam(90.0f, "wiimote-max", @@ -386,11 +386,11 @@ namespace UserConfigParams PARAM_DEFAULT( BoolUserConfigParam(false, "player_last", &m_gp_start_order, "Always put the player at the back or not (Bully mode).") ); - + // ---- Video PARAM_PREFIX GroupUserConfigParam m_video_group PARAM_DEFAULT( GroupUserConfigParam("Video", "Video Settings") ); - + PARAM_PREFIX IntUserConfigParam m_width PARAM_DEFAULT( IntUserConfigParam(1024, "width", &m_video_group, "Screen/window width in pixels") ); @@ -398,34 +398,34 @@ namespace UserConfigParams PARAM_DEFAULT( IntUserConfigParam(768, "height", &m_video_group, "Screen/window height in pixels") ); PARAM_PREFIX BoolUserConfigParam m_fullscreen - PARAM_DEFAULT( BoolUserConfigParam(false, "fullscreen", + PARAM_DEFAULT( BoolUserConfigParam(false, "fullscreen", &m_video_group) ); PARAM_PREFIX IntUserConfigParam m_prev_width - PARAM_DEFAULT( IntUserConfigParam(1024, "prev_width", + PARAM_DEFAULT( IntUserConfigParam(1024, "prev_width", &m_video_group, "Previous screen/window width") ); PARAM_PREFIX IntUserConfigParam m_prev_height - PARAM_DEFAULT( IntUserConfigParam(768, "prev_height", + PARAM_DEFAULT( IntUserConfigParam(768, "prev_height", &m_video_group,"Previous screen/window height") ); PARAM_PREFIX BoolUserConfigParam m_prev_fullscreen - PARAM_DEFAULT( BoolUserConfigParam(false, "prev_fullscreen", + PARAM_DEFAULT( BoolUserConfigParam(false, "prev_fullscreen", &m_video_group) ); PARAM_PREFIX BoolUserConfigParam m_remember_window_location - PARAM_DEFAULT( BoolUserConfigParam(false, "remember_window_location", + PARAM_DEFAULT( BoolUserConfigParam(false, "remember_window_location", &m_video_group) ); PARAM_PREFIX IntUserConfigParam m_window_x - PARAM_DEFAULT( IntUserConfigParam(-1, "window_x", + PARAM_DEFAULT( IntUserConfigParam(-1, "window_x", &m_video_group,"If remember_window_location is true") ); PARAM_PREFIX IntUserConfigParam m_window_y - PARAM_DEFAULT( IntUserConfigParam(-1, "window_y", + PARAM_DEFAULT( IntUserConfigParam(-1, "window_y", &m_video_group,"If remember_window_location is true") ); - + PARAM_PREFIX BoolUserConfigParam m_display_fps - PARAM_DEFAULT( BoolUserConfigParam(false, "show_fps", + PARAM_DEFAULT( BoolUserConfigParam(false, "show_fps", &m_video_group, "Display frame per seconds") ); PARAM_PREFIX IntUserConfigParam m_max_fps - PARAM_DEFAULT( IntUserConfigParam(120, "max_fps", + PARAM_DEFAULT( IntUserConfigParam(120, "max_fps", &m_video_group, "Maximum fps, should be at least 60") ); // Renderer type (OpenGL, Direct3D9, Direct3D8, Software, etc) @@ -439,11 +439,11 @@ namespace UserConfigParams /** Wiimote debugging. */ PARAM_PREFIX bool m_wiimote_debug PARAM_DEFAULT( false ); - + /** Debug gamepads by visualising their values. */ PARAM_PREFIX bool m_gamepad_visualisation PARAM_DEFAULT( false ); - - /** If material debugging (printing terrain specific slowdown) + + /** If material debugging (printing terrain specific slowdown) * is enabled. */ PARAM_PREFIX bool m_material_debug PARAM_DEFAULT( false ); @@ -464,28 +464,28 @@ namespace UserConfigParams /** True if follow-the-leader debug information should be printed. */ PARAM_PREFIX bool m_ftl_debug PARAM_DEFAULT( false ); - + /** True if currently developed tutorial debugging is enabled. */ PARAM_PREFIX bool m_tutorial_debug PARAM_DEFAULT( false ); - /** Verbosity level for debug messages. Note that error and + /** Verbosity level for debug messages. Note that error and * important warnings must always be printed. */ PARAM_PREFIX int m_verbosity PARAM_DEFAULT( 0 ); PARAM_PREFIX bool m_no_start_screen PARAM_DEFAULT( false ); - + PARAM_PREFIX bool m_race_now PARAM_DEFAULT( false ); - /** True to test funky ambient/diffuse/specularity in RGB & + /** True to test funky ambient/diffuse/specularity in RGB & * all anisotropic */ PARAM_PREFIX bool m_rendering_debug PARAM_DEFAULT( false ); - + /** True if graphical profiler should be displayed */ PARAM_PREFIX bool m_profiler_enabled PARAM_DEFAULT( false ); - + /** True if hardware skinning should be enabled */ PARAM_PREFIX bool m_hw_skinning_enabled PARAM_DEFAULT( false ); - + /** True if Christmas Mode should be enabled */ PARAM_PREFIX bool m_xmas_enabled PARAM_DEFAULT( false ); @@ -496,15 +496,15 @@ namespace UserConfigParams PARAM_DEFAULT( StringUserConfigParam("localhost", "server_adress", "Information about last server used") ); PARAM_PREFIX IntUserConfigParam m_server_port - PARAM_DEFAULT( IntUserConfigParam(2305, "server_port", + PARAM_DEFAULT( IntUserConfigParam(2305, "server_port", "Information about last server used") ); - + // ---- Graphic Quality PARAM_PREFIX GroupUserConfigParam m_graphics_quality - PARAM_DEFAULT( GroupUserConfigParam("GFX", + PARAM_DEFAULT( GroupUserConfigParam("GFX", "Graphics Quality Settings") ); - - // On OSX 10.4 and before there may be driver issues with FBOs, so to be + + // On OSX 10.4 and before there may be driver issues with FBOs, so to be // safe disable them by default #ifdef __APPLE__ #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 @@ -515,50 +515,50 @@ namespace UserConfigParams #else #define FBO_DEFAULT true #endif - + PARAM_PREFIX BoolUserConfigParam m_fbo - PARAM_DEFAULT( BoolUserConfigParam(FBO_DEFAULT, "fbo", + PARAM_DEFAULT( BoolUserConfigParam(FBO_DEFAULT, "fbo", &m_graphics_quality, "Use frame buffer objects (FBOs)") ); - + PARAM_PREFIX BoolUserConfigParam m_graphical_effects - PARAM_DEFAULT( BoolUserConfigParam(true, "anim_gfx", + PARAM_DEFAULT( BoolUserConfigParam(true, "anim_gfx", &m_graphics_quality, "Scenery animations") ); - + PARAM_PREFIX BoolUserConfigParam m_weather_effects - PARAM_DEFAULT( BoolUserConfigParam(true, "weather_gfx", + PARAM_DEFAULT( BoolUserConfigParam(true, "weather_gfx", &m_graphics_quality, "Weather effects") ); PARAM_PREFIX IntUserConfigParam m_show_steering_animations - PARAM_DEFAULT( IntUserConfigParam(ANIMS_ALL, + PARAM_DEFAULT( IntUserConfigParam(ANIMS_ALL, "steering_animations", &m_graphics_quality, "Whether to display kart animations (0=disabled for all; " "1=enabled for humans, disabled for AIs; 2=enabled for all") ); PARAM_PREFIX IntUserConfigParam m_anisotropic - PARAM_DEFAULT( IntUserConfigParam(8, "anisotropic", + PARAM_DEFAULT( IntUserConfigParam(8, "anisotropic", &m_graphics_quality, "Quality of anisotropic filtering (usual values include 2-4-8-16; 0 to disable)") ); PARAM_PREFIX BoolUserConfigParam m_trilinear - PARAM_DEFAULT( BoolUserConfigParam(true, "trilinear", + PARAM_DEFAULT( BoolUserConfigParam(true, "trilinear", &m_graphics_quality, "Whether trilinear filtering is allowed to be " "used (true or false)") ); PARAM_PREFIX IntUserConfigParam m_antialiasing - PARAM_DEFAULT( IntUserConfigParam(0, + PARAM_DEFAULT( IntUserConfigParam(0, "antialiasing", &m_graphics_quality, "Whether antialiasing is enabled (0 = disabled, 1 = 2x, 2 = 4x, 3 = 8x") ); PARAM_PREFIX BoolUserConfigParam m_vsync - PARAM_DEFAULT( BoolUserConfigParam(false, "vsync", + PARAM_DEFAULT( BoolUserConfigParam(false, "vsync", &m_graphics_quality, "Whether vertical sync is enabled") ); PARAM_PREFIX BoolUserConfigParam m_pixel_shaders - PARAM_DEFAULT( BoolUserConfigParam(true, "pixel_shaders", + PARAM_DEFAULT( BoolUserConfigParam(true, "pixel_shaders", &m_graphics_quality, "Whether to enable pixel shaders (splatting, normal maps, ...)") ); PARAM_PREFIX BoolUserConfigParam m_postprocess_enabled - PARAM_DEFAULT( BoolUserConfigParam(false, + PARAM_DEFAULT( BoolUserConfigParam(false, "postprocess_enabled", &m_graphics_quality, "Whether post-processing (motion blur...) should " "be enabled") ); - + // ---- Misc PARAM_PREFIX BoolUserConfigParam m_cache_overworld PARAM_DEFAULT( BoolUserConfigParam(true, "cache-overworld") ); @@ -567,8 +567,8 @@ namespace UserConfigParams PARAM_DEFAULT( BoolUserConfigParam(false, "minimal-race-gui") ); // TODO : is this used with new code? does it still work? PARAM_PREFIX BoolUserConfigParam m_crashed - PARAM_DEFAULT( BoolUserConfigParam(false, "crashed") ); - + PARAM_DEFAULT( BoolUserConfigParam(false, "crashed") ); + #if defined(WIN32) && !defined(__CYGWIN__) // No console on windows # define CONSOLE_DEFAULT false @@ -579,43 +579,43 @@ namespace UserConfigParams PARAM_PREFIX BoolUserConfigParam m_log_errors_to_console PARAM_DEFAULT( BoolUserConfigParam( CONSOLE_DEFAULT, "log_errors", "Enable logging to console.") ); - + PARAM_PREFIX IntUserConfigParam m_reverse_look_threshold - PARAM_DEFAULT( IntUserConfigParam(0, "reverse_look_threshold", + PARAM_DEFAULT( IntUserConfigParam(0, "reverse_look_threshold", "If the kart is driving backwards faster than this value,\n" "switch automatically to reverse camera (set to 0 to disable).") ); PARAM_PREFIX IntUserConfigParam m_camera_style - PARAM_DEFAULT( IntUserConfigParam(Camera::CS_MODERN, + PARAM_DEFAULT( IntUserConfigParam(Camera::CS_MODERN, "camera_style", "Camera Style") ); - + PARAM_PREFIX StringUserConfigParam m_item_style - PARAM_DEFAULT( StringUserConfigParam("items", "item_style", + PARAM_DEFAULT( StringUserConfigParam("items", "item_style", "Name of the .items file to use.") ); - + PARAM_PREFIX StringUserConfigParam m_last_track - PARAM_DEFAULT( StringUserConfigParam("olivermath", "last_track", - "Name of the last track used.") ); + PARAM_DEFAULT( StringUserConfigParam("olivermath", "last_track", + "Name of the last track used.") ); PARAM_PREFIX StringUserConfigParam m_last_used_track_group PARAM_DEFAULT( StringUserConfigParam("all", "last_track_group", "Last selected track group") ); - + PARAM_PREFIX StringUserConfigParam m_skin_file PARAM_DEFAULT( StringUserConfigParam("Peach.stkskin", "skin_file", "Name of the skin to use") ); - + PARAM_PREFIX WStringUserConfigParam m_default_player - PARAM_DEFAULT( WStringUserConfigParam(L"", "default_player", + PARAM_DEFAULT( WStringUserConfigParam(L"", "default_player", "Which player to use by default (if empty, will prompt)") ); - + // ---- Addon server related entries PARAM_PREFIX GroupUserConfigParam m_addon_group - PARAM_DEFAULT( GroupUserConfigParam("AddonAndNews", + PARAM_DEFAULT( GroupUserConfigParam("AddonAndNews", "Addon and news related settings") ); PARAM_PREFIX StringUserConfigParam m_server_addons PARAM_DEFAULT( StringUserConfigParam("http://stkaddons.net/dl/xml", - "server_addons", + "server_addons", &m_addon_group, "The server used for addon.")); @@ -625,18 +625,18 @@ namespace UserConfigParams "Time news was updated last.") ); PARAM_PREFIX IntUserConfigParam m_news_frequency - PARAM_DEFAULT( IntUserConfigParam(0, "news_frequency", + PARAM_DEFAULT( IntUserConfigParam(0, "news_frequency", &m_addon_group, "How often news should be updated.") ); PARAM_PREFIX StringUserConfigParam m_display_count - PARAM_DEFAULT( StringUserConfigParam("", "news_display_count", + PARAM_DEFAULT( StringUserConfigParam("", "news_display_count", &m_addon_group, "How often all news messages " "have been displayed") ); PARAM_PREFIX IntUserConfigParam m_last_important_message_id - PARAM_DEFAULT( IntUserConfigParam(-1, "last_important_message_id", + PARAM_DEFAULT( IntUserConfigParam(-1, "last_important_message_id", &m_addon_group, "Don't show important message " "with this or a lower id again") ); @@ -654,16 +654,16 @@ namespace UserConfigParams "Time addon-list was updated last.") ); PARAM_PREFIX StringUserConfigParam m_language - PARAM_DEFAULT( StringUserConfigParam("system", "language", + PARAM_DEFAULT( StringUserConfigParam("system", "language", "Which language to use (language code or 'system')") ); - + PARAM_PREFIX BoolUserConfigParam m_artist_debug_mode PARAM_DEFAULT( BoolUserConfigParam(false, "artist_debug_mode", "Whether to enable track debugging features") ); - + // TODO? implement blacklist for new irrlicht device and GUI PARAM_PREFIX std::vector m_blacklist_res; - + PARAM_PREFIX PtrVector m_all_players; /** List of all saved GPs. */ @@ -701,13 +701,13 @@ namespace UserConfigParams class UserConfig : public NoCopy { private: - + /** Filename of the user config file. */ std::string m_filename; irr::core::stringw m_warning; public: - /** Create the user config object; does not actually load it, + /** Create the user config object; does not actually load it, * UserConfig::loadConfig needs to be called. */ UserConfig(); ~UserConfig(); @@ -718,7 +718,7 @@ public: const irr::core::stringw& getWarning() { return m_warning; } void resetWarning() { m_warning=""; } void setWarning(irr::core::stringw& warning) { m_warning=warning; } - + void addDefaultPlayer(); }; // UserConfig diff --git a/src/graphics/CBatchingMesh.hpp b/src/graphics/CBatchingMesh.hpp index 54613d1ea..b92998399 100644 --- a/src/graphics/CBatchingMesh.hpp +++ b/src/graphics/CBatchingMesh.hpp @@ -34,8 +34,8 @@ public: //! adds a mesh to the buffers with the given offset /** \Return: Returns an array of ID numbers */ - core::array addMesh(IMesh* mesh, - core::vector3df pos = core::vector3df(0,0,0), + core::array addMesh(IMesh* mesh, + core::vector3df pos = core::vector3df(0,0,0), core::vector3df rot = core::vector3df(0,0,0), core::vector3df scale = core::vector3df(1,1,1)); @@ -46,7 +46,7 @@ public: //! adds a mesh buffer with the given transformation /** \Return: Returns the ID of this mesh buffer */ s32 addMeshBuffer(IMeshBuffer* buffer, - core::vector3df pos = core::vector3df(0,0,0), + core::vector3df pos = core::vector3df(0,0,0), core::vector3df rot = core::vector3df(0,0,0), core::vector3df scale = core::vector3df(1,1,1)); @@ -57,13 +57,13 @@ public: //! updates bouding box from internal buffers void recalculateBoundingBox(); - //! Moves a mesh, - /** mesh buffers in clean destination buffers will be moved immediately, + //! Moves a mesh, + /** mesh buffers in clean destination buffers will be moved immediately, ones in dirty buffers will be left until the next update */ core::array moveMesh(const core::array& bufferIDs, const core::matrix4 &newMatrix); //! Moves a mesh buffer - /** if the destination buffer is clean it will be moved immediately, + /** if the destination buffer is clean it will be moved immediately, if a member of a dirty buffer, it will be left until the next update */ bool moveMeshBuffer(const s32 id, const core::matrix4 &newMatrix); @@ -85,13 +85,13 @@ public: //! Returns pointer to a mesh buffer. /** \param nr: Zero based index of the mesh buffer. The maximum value is getMeshBufferCount() - 1; - \return Returns the pointer to the mesh buffer or + \return Returns the pointer to the mesh buffer or NULL if there is no such mesh buffer. */ virtual IMeshBuffer* getMeshBuffer(u32 nr) const; //! Returns pointer to a mesh buffer which fits a material /** \param material: material to search for - \return Returns the pointer to the mesh buffer or + \return Returns the pointer to the mesh buffer or NULL if there is no such mesh buffer. */ virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const; @@ -124,8 +124,8 @@ private: struct SBufferReference { - SBufferReference() - : SourceBuffer(0), DestReference(0), FirstVertex(0), VertexCount(0), + SBufferReference() + : SourceBuffer(0), DestReference(0), FirstVertex(0), VertexCount(0), FirstIndex(0), IndexCount(0), Initialized(false) { } IMeshBuffer* SourceBuffer; diff --git a/src/graphics/camera.hpp b/src/graphics/camera.hpp index 1aa27d908..96cdb128c 100644 --- a/src/graphics/camera.hpp +++ b/src/graphics/camera.hpp @@ -71,7 +71,7 @@ private: /** Camera's mode. */ Mode m_mode; - /** The index of this camera which is the index of the kart it is + /** The index of this camera which is the index of the kart it is * attached to. */ unsigned int m_index; @@ -134,9 +134,9 @@ private: { public: /** The camera type: - EC_STATIC_FOLLOW_KART A static camera that always points at the + EC_STATIC_FOLLOW_KART A static camera that always points at the kart. - EC_AHEAD_OF_KART A camera that flies ahead of the kart + EC_AHEAD_OF_KART A camera that flies ahead of the kart always pointing at the kart. */ typedef enum {EC_STATIC_FOLLOW_KART, @@ -144,7 +144,7 @@ private: EndCameraType m_type; /** Position of the end camera. */ - Vec3 m_position; + Vec3 m_position; /** Distance to kart by which this camera is activated. */ float m_distance2; @@ -162,7 +162,7 @@ private: m_type = EC_AHEAD_OF_KART; else { - fprintf(stderr, + fprintf(stderr, "Invalid camera type '%s' - camera is ignored.\n", s.c_str()); return false; @@ -179,12 +179,12 @@ private: * \param xyz Position to test for distance. * \returns True if xyz is close enough to this camera. */ - bool isReached(const Vec3 &xyz) + bool isReached(const Vec3 &xyz) { return (xyz-m_position).length2() < m_distance2; } }; // EndCameraInformation // ------------------------------------------------------------------------ - /** List of all end camera information. This information is shared + /** List of all end camera information. This information is shared * between all cameras, so it's static. */ static AlignedArray m_end_cameras; @@ -200,7 +200,7 @@ private: void computeNormalCameraPosition(Vec3 *wanted_position, Vec3 *wanted_target); void handleEndCamera(float dt); - void getCameraSettings(float *above_kart, float *cam_angle, + void getCameraSettings(float *above_kart, float *cam_angle, float *side_way, float *distance, bool *smoothing); void positionCamera(float dt, float above_kart, float cam_angle, @@ -220,15 +220,15 @@ public: // ------------------------------------------------------------------------ /** Remove all cameras. */ - static void removeAllCameras() - { + static void removeAllCameras() + { for(unsigned int i=0; i m_debug_meshes; void drawDebugMeshes(); - void drawJoint(bool drawline, bool drawname, + void drawJoint(bool drawline, bool drawname, irr::scene::ISkinnedMesh::SJoint* joint, irr::scene::ISkinnedMesh* mesh, int id); #endif - + void doScreenShot(); public: IrrDriver(); @@ -130,10 +130,10 @@ public: void setAllMaterialFlags(scene::IMesh *mesh) const; scene::IAnimatedMesh *getAnimatedMesh(const std::string &name); scene::IMesh *getMesh(const std::string &name); - video::ITexture *applyMask(video::ITexture* texture, - const std::string& mask_path); + video::ITexture *applyMask(video::ITexture* texture, + const std::string& mask_path); void displayFPS(); - bool OnEvent(const irr::SEvent &event); + bool OnEvent(const irr::SEvent &event); void setAmbientLight(const video::SColor &light); video::ITexture *getTexture(const std::string &filename, bool is_premul=false, @@ -141,9 +141,9 @@ public: bool complain_if_not_found=true); void grabAllTextures(const scene::IMesh *mesh); void dropAllTextures(const scene::IMesh *mesh); - scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL, + scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL, bool create_one_quad=false); - scene::IMesh *createTexturedQuadMesh(const video::SMaterial *material, + scene::IMesh *createTexturedQuadMesh(const video::SMaterial *material, const double w, const double h); scene::ISceneNode *addWaterNode(scene::IMesh *mesh, float wave_height, float wave_speed, float wave_length); @@ -152,17 +152,17 @@ public: const video::SColor &color=video::SColor(128, 255, 255, 255)); scene::IMeshSceneNode*addMesh(scene::IMesh *mesh, scene::ISceneNode *parent=NULL); - PerCameraNode *addPerCameraMesh(scene::IMesh* mesh, + PerCameraNode *addPerCameraMesh(scene::IMesh* mesh, scene::ICameraSceneNode* node, scene::ISceneNode *parent = NULL); - scene::ISceneNode *addBillboard(const core::dimension2d< f32 > size, - video::ITexture *texture, + scene::ISceneNode *addBillboard(const core::dimension2d< f32 > size, + video::ITexture *texture, scene::ISceneNode* parent=NULL); scene::IParticleSystemSceneNode *addParticleNode(bool default_emitter=true); scene::ISceneNode *addSkyDome(video::ITexture *texture, int hori_res, - int vert_res, float texture_percent, + int vert_res, float texture_percent, float sphere_percent); scene::ISceneNode *addSkyBox(const std::vector &texture_names); void removeNode(scene::ISceneNode *node); @@ -170,7 +170,7 @@ public: void removeTexture(video::ITexture *t); scene::IAnimatedMeshSceneNode *addAnimatedMesh(scene::IAnimatedMesh *mesh); - scene::ICameraSceneNode + scene::ICameraSceneNode *addCameraSceneNode(); Camera *addCamera(unsigned int index, AbstractKart *kart); void removeCameraSceneNode(scene::ICameraSceneNode *camera); @@ -182,31 +182,31 @@ public: void cancelResChange(); bool moveWindow(const int x, const int y); - + void showPointer(); void hidePointer(); bool isPointerShown() const { return m_pointer_shown; } core::position2di getMouseLocation(); - + void printRenderStats(); bool supportsSplatting(); void requestScreenshot(); void draw2dTriangle(const core::vector2df &a, const core::vector2df &b, - const core::vector2df &c, + const core::vector2df &c, const video::ITexture *texture = NULL, - const video::SColor *ca=NULL, + const video::SColor *ca=NULL, const video::SColor *cb=NULL, const video::SColor *cc=NULL); - + // ------------------------------------------------------------------------ /** Returns a list of all video modes supports by the graphics card. */ const std::vector& getVideoModes() const { return m_modes; } // ------------------------------------------------------------------------ /** Returns the frame size. */ - const core::dimension2d& getFrameSize() const + const core::dimension2d& getFrameSize() const { return m_video_driver->getCurrentRenderTargetSize(); } // ------------------------------------------------------------------------ /** Returns the irrlicht device. */ @@ -219,7 +219,7 @@ public: scene::ISceneManager *getSceneManager() const { return m_scene_manager; } // ------------------------------------------------------------------------ /** Returns the gui environment, used to add widgets to a screen. */ - gui::IGUIEnvironment *getGUI() const { return m_gui_env; } + gui::IGUIEnvironment *getGUI() const { return m_gui_env; } // ------------------------------------------------------------------------ /** Returns the current real time, which might not be 0 at start of the * application. Value in msec. */ @@ -233,20 +233,20 @@ public: void clearDebugMesh() { m_debug_meshes.clear(); } // ------------------------------------------------------------------------ /** Adds a debug mesh to be displaed. */ - void addDebugMesh(scene::IAnimatedMeshSceneNode *node) - { - m_debug_meshes.push_back(node); + void addDebugMesh(scene::IAnimatedMeshSceneNode *node) + { + m_debug_meshes.push_back(node); } // addDebugMesh #endif // --------------------- RTT -------------------- /** - * Class that provides RTT (currently, only when no other 3D rendering + * Class that provides RTT (currently, only when no other 3D rendering * in the main scene is required) * Provides an optional 'setupRTTScene' method to make it quick and easy - * to prepare rendering of 3D objects but you can also manually set the + * to prepare rendering of 3D objects but you can also manually set the * scene/camera. If you use the factory 'setupRTTScene', cleanup can be - * done through 'tearDownRTTScene' (destructor will also do this). If + * done through 'tearDownRTTScene' (destructor will also do this). If * you set it up manually, you need to clean it up manually. */ class RTTProvider @@ -254,57 +254,57 @@ public: /** A pointer to texture on which a scene is rendered. Only used * in between beginRenderToTexture() and endRenderToTexture calls. */ video::ITexture *m_render_target_texture; - + bool m_persistent_texture; - + /** Main node of the RTT scene */ scene::ISceneNode *m_rtt_main_node; - + scene::ICameraSceneNode *m_camera; - + scene::ILightSceneNode *m_light; - + /** Irrlicht video driver. */ video::IVideoDriver *m_video_driver; - + public: - RTTProvider(const core::dimension2du &dimension, + RTTProvider(const core::dimension2du &dimension, const std::string &name, bool persistent_texture); - + ~RTTProvider(); - + /** - * \brief Quick utility method to setup a scene from a plain list + * \brief Quick utility method to setup a scene from a plain list * of models * * Sets up a given vector of meshes for render-to-texture. Ideal to * embed a 3D object inside the GUI. If there are multiple meshes, - * the first mesh is considered to be the root, and all following - * meshes will have their locations relative to the location of the + * the first mesh is considered to be the root, and all following + * meshes will have their locations relative to the location of the * first mesh. * * \param mesh The list of meshes to add to the scene * \param mesh_location Location of each fo these meshes - * \param model_frames For animated meshes, which frame to use + * \param model_frames For animated meshes, which frame to use * (value can be -1 to set none) - * When frame is not -1, the corresponding + * When frame is not -1, the corresponding * IMesh must be an IAnimatedMesh. * \pre The 3 vectors have the same size. */ - void setupRTTScene(PtrVector& mesh, + void setupRTTScene(PtrVector& mesh, AlignedArray& mesh_location, AlignedArray& mesh_scale, const std::vector& model_frames); - - /** Optional 'angle' parameter will rotate the object added + + /** Optional 'angle' parameter will rotate the object added * *through setupRTTScene* */ video::ITexture* renderToTexture(float angle=-1, bool is_2d_render=false); - + void tearDownRTTScene(); - + }; - + }; // IrrDriver diff --git a/src/graphics/lod_node.hpp b/src/graphics/lod_node.hpp index 83b4e8969..29f2ee768 100644 --- a/src/graphics/lod_node.hpp +++ b/src/graphics/lod_node.hpp @@ -53,12 +53,12 @@ private: std::vector m_detail; std::vector m_nodes; - + std::set m_nodes_set; - + std::string m_group_name; - - /** The normal level of detail can be overwritten. If + + /** The normal level of detail can be overwritten. If * m_forced_lod is >=0, only this level is be used. */ int m_forced_lod; @@ -70,27 +70,27 @@ private: WAS_SHOWN, WAS_HIDDEN }; - + PreviousVisibility m_previous_visibility; - + public: - + LODNode(std::string group_name, scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id=-1); virtual ~LODNode(); - + //! returns the axis aligned bounding box of this node virtual const core::aabbox3d& getBoundingBox() const { return Box; } - + /* //! Returns a reference to the current relative transformation matrix. //! This is the matrix, this scene node uses instead of scale, translation //! and rotation. virtual core::matrix4& getRelativeTransformationMatrix() { return RelativeTransformationMatrix; } - + //! Returns the relative transformation of the scene node. virtual core::matrix4 getRelativeTransformation() const { return RelativeTransformationMatrix; } */ - + /** * Adds a node associated with a level of detail. * \note The LOD levels must be added in ascending order. @@ -99,7 +99,7 @@ public: * \param reparent If true, node will be removed from its current parent first */ void add(int level, scene::ISceneNode* node, bool reparent); - + void forceLevelOfDetail(int n); /** Get the highest level of detail node */ @@ -108,9 +108,9 @@ public: if (m_nodes.size() > 0) return m_nodes[0]; else return NULL; } - + std::vector& getAllNodes() { return m_nodes; } - + //! OnAnimate() is called just before rendering the whole scene. /** This method will be called once per frame, independent of whether the scene node is visible or not. */ @@ -118,7 +118,7 @@ public: virtual void OnRegisterSceneNode(); virtual void render(); - + virtual scene::ESCENE_NODE_TYPE getType() const { return (scene::ESCENE_NODE_TYPE)scene::ESNT_LOD_NODE; } const std::string& getGroupName() const { return m_group_name; } diff --git a/src/graphics/material.hpp b/src/graphics/material.hpp index 89849061c..84cec20a4 100644 --- a/src/graphics/material.hpp +++ b/src/graphics/material.hpp @@ -65,19 +65,19 @@ public: { EMIT_ON_DRIVE = 0, EMIT_ON_SKID, - + EMIT_KINDS_COUNT }; - + enum CollisionReaction { NORMAL, RESCUE, PUSH_BACK }; - + private: - + enum Shaders { SHADER_NORMAL_MAP, @@ -89,7 +89,7 @@ private: SHADER_GRASS, SHADER_COUNT }; - + video::ITexture *m_texture; unsigned int m_index; std::string m_texname; @@ -118,46 +118,46 @@ private: bool m_zipper; /** If a kart is rescued when driving on this surface. */ bool m_drive_reset; - - + + /** Speed of the 'main' wave in the water shader. Only used if m_graphical_effect == WATER_SHADER */ float m_water_shader_speed_1; - + /** Speed of the 'secondary' waves in the water shader. Only used if m_graphical_effect == WATER_SHADER */ float m_water_shader_speed_2; - + /** If a kart is rescued when crashing into this surface. */ CollisionReaction m_collision_reaction; - + /** Particles to show on touch */ std::string m_collision_particles; - + float m_grass_speed; float m_grass_amplitude; - + /** If the property should be ignored in the physics. Example would be * plants that a kart can just drive through. */ bool m_ignore; bool m_add; - + bool m_fog; - + ParticleKind* m_particles_effects[EMIT_KINDS_COUNT]; - + /** For normal maps */ std::string m_normal_map_tex; std::string m_normal_map_shader_lightmap; - + //bool m_normal_map_uv2; //!< Whether to use a second UV layer for normal map bool m_is_heightmap; bool m_parallax_map; float m_parallax_height; - + /** Texture clamp bitmask */ unsigned int m_clamp_tex; - + bool m_lighting; bool m_smooth_reflection_shader; bool m_alpha_testing; @@ -166,7 +166,7 @@ private: /** True if backface culliing should be enabled. */ bool m_backface_culling; - + /** Set to true to disable writing to the Z buffer. Usually to be used with alpha blending */ bool m_disable_z_write; @@ -178,7 +178,7 @@ private: bool m_lightmap; /** True if (additive) lightmapping is enabled for this material. */ bool m_additive_lightmap; - + bool m_high_tire_adhesion; /** How much the top speed is reduced per second. */ float m_slowdown_time; @@ -200,50 +200,50 @@ private: * if a zipper is used. If this value is <0 the kart specific value will * be used. */ float m_zipper_max_speed_increase; - /** Time a zipper stays activated. If this value is <0 the kart specific + /** Time a zipper stays activated. If this value is <0 the kart specific * value will be used. */ float m_zipper_duration; - /** A one time additional speed gain - the kart will instantly add this + /** A one time additional speed gain - the kart will instantly add this * amount of speed to its current speed. If this value is <0 the kart * specific value will be used. */ float m_zipper_speed_gain; - /** Time it takes for the zipper advantage to fade out. If this value + /** Time it takes for the zipper advantage to fade out. If this value * is <0 the kart specific value will be used. */ float m_zipper_fade_out_time; /** Additional engine force. */ float m_zipper_engine_force; std::string m_mask; - + /** If m_splatting is true, indicates the first splatting texture */ std::string m_splatting_texture_1; - + /** If m_splatting is true, indicates the second splatting texture */ std::string m_splatting_texture_2; - + /** If m_splatting is true, indicates the third splatting texture */ - std::string m_splatting_texture_3; - + std::string m_splatting_texture_3; + /** If m_splatting is true, indicates the fourth splatting texture */ std::string m_splatting_texture_4; - + std::string m_splatting_lightmap; - + std::vector m_shaders; /** Only used if bubble effect is enabled */ std::map m_bubble_provider; - + bool m_deprecated; - + void init (unsigned int index); void install (bool is_full_path=false, bool complain_if_not_found=true); void initCustomSFX(const XMLNode *sfx); void initParticlesEffect(const XMLNode *node); - + public: Material(const XMLNode *node, int index, bool deprecated); - Material(const std::string& fname, int index, + Material(const std::string& fname, int index, bool is_full_path=false, bool complain_if_not_found=true); ~Material (); @@ -251,7 +251,7 @@ public: void setSFXSpeed(SFXBase *sfx, float speed) const; void setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* mb); void adjustForFog(scene::ISceneNode* parent, video::SMaterial *m, bool use_fog) const; - + /** Returns the ITexture associated with this material. */ video::ITexture *getTexture() const { return m_texture; } bool isIgnore () const { return m_ignore; } @@ -264,16 +264,16 @@ public: /** Returns if this material should trigger a rescue if a kart * crashes against it. */ CollisionReaction getCollisionReaction() const { return m_collision_reaction; } - + std::string getCrashResetParticles() const { return m_collision_particles; } - + bool highTireAdhesion () const { return m_high_tire_adhesion; } - const std::string& + const std::string& getTexFname () const { return m_texname; } int getIndex () const { return m_index; } - + bool isTransparent () const { return m_alpha_testing || m_alpha_blending || m_add; } - + // ------------------------------------------------------------------------ /** Returns true if this materials need pre-multiply of alpha. */ bool isPreMul() const {return m_adjust_image==ADJ_PREMUL; } @@ -299,7 +299,7 @@ public: bool isBelowSurface () const { return m_below_surface; } // ------------------------------------------------------------------------ /** Returns true if this material is a surface, i.e. it is going to be - * ignored for the physics, but the information is needed e.g. for + * ignored for the physics, but the information is needed e.g. for * gfx. See m_below_surface for more details. */ bool isSurface () const { return m_surface; } // ------------------------------------------------------------------------ @@ -307,15 +307,15 @@ public: * terrain. The string will be "" if no special sfx exists. */ const std::string & getSFXName () const { return m_sfx_name; } - + bool isFogEnabled() const { return m_fog; } - + /** * \brief Get the kind of particles that are to be used on this material, in the given conditions * \return The particles to use, or NULL if none */ const ParticleKind* getParticlesWhen(ParticleConditions cond) const { return m_particles_effects[cond]; } - + // ------------------------------------------------------------------------ /** Returns true if a kart falling over this kind of material triggers * the special falling camera. */ @@ -336,7 +336,7 @@ public: } // getZipperParameter bool isNormalMap() const { return m_graphical_effect == GE_NORMAL_MAP; } - + void onMadeVisible(scene::IMeshBuffer* who); void onHidden(scene::IMeshBuffer* who); void isInitiallyHidden(scene::IMeshBuffer* who); diff --git a/src/graphics/material_manager.hpp b/src/graphics/material_manager.hpp index 65d6297a0..a508f88cb 100644 --- a/src/graphics/material_manager.hpp +++ b/src/graphics/material_manager.hpp @@ -50,15 +50,15 @@ public: MaterialManager(); ~MaterialManager(); void loadMaterial (); - Material* getMaterialFor(video::ITexture* t, + Material* getMaterialFor(video::ITexture* t, scene::IMeshBuffer *mb); - void setAllMaterialFlags(video::ITexture* t, + void setAllMaterialFlags(video::ITexture* t, scene::IMeshBuffer *mb); - void adjustForFog(video::ITexture* t, + void adjustForFog(video::ITexture* t, scene::IMeshBuffer *mb, scene::ISceneNode* parent, bool use_fog) const; - + void setAllUntexturedMaterialFlags(scene::IMeshBuffer *mb) const; int addEntity (Material *m); @@ -72,7 +72,7 @@ public: void popTempMaterial (); void makeMaterialsPermanent(); bool hasMaterial(const std::string& fname); - + Material* getLatestMaterial() { return m_materials[m_materials.size()-1]; } }; // MaterialManager diff --git a/src/graphics/moving_texture.hpp b/src/graphics/moving_texture.hpp index 352d4bca6..f4f7c9870 100644 --- a/src/graphics/moving_texture.hpp +++ b/src/graphics/moving_texture.hpp @@ -36,12 +36,12 @@ class MovingTexture : public NoCopy private: /** Translation increment per second. */ float m_dx, m_dy; - + /** Delta set by user and count */ float m_dt; float m_count; bool m_isAnimatedByStep; - + /** Current x,y position. */ float m_x, m_y; /** The texture matrix of this texture. */ diff --git a/src/graphics/particle_emitter.hpp b/src/graphics/particle_emitter.hpp index ccaf4bb38..e0c4b6b4b 100644 --- a/src/graphics/particle_emitter.hpp +++ b/src/graphics/particle_emitter.hpp @@ -46,14 +46,14 @@ class Track; class ParticleEmitter : public NoCopy { private: - + /** Irrlicht's particle systems. */ scene::IParticleSystemSceneNode *m_node; - + Vec3 m_position; - + scene::ISceneNode* m_parent; - + /** The emitters. Access to these is needed to adjust the number of * particles per second. */ scene::IParticleEmitter *m_emitter; @@ -61,23 +61,23 @@ private: #if VISUALIZE_BOX_EMITTER std::vector m_visualisation; #endif - + const ParticleKind *m_particle_type; - + unsigned int m_magic_number; - + /** Decay of emission rate, in particles per second */ int m_emission_decay_rate; - + /** The irrlicht emitter contains this info, but as an int. We want it as a float */ float m_min_rate, m_max_rate; - - + + public: - + LEAK_CHECK() - - ParticleEmitter (const ParticleKind* type, + + ParticleEmitter (const ParticleKind* type, const Vec3 &position, scene::ISceneNode* parent = NULL); virtual ~ParticleEmitter(); @@ -85,22 +85,22 @@ public: void setCreationRateAbsolute(float fraction); void setCreationRateRelative(float f); int getCreationRate(); - + void setPosition(const Vec3 &pos); - + const ParticleKind* getParticlesInfo() const { return m_particle_type; } - + void setParticleType(const ParticleKind* p); - + void resizeBox(float size); - + void clearParticles(); - + scene::IParticleSystemSceneNode* getNode() { return m_node; } - + /** call this if the node was freed otherwise */ void unsetNode() { m_node = NULL; } - + void addHeightMapAffector(Track* t); }; #endif diff --git a/src/graphics/particle_kind.hpp b/src/graphics/particle_kind.hpp index b2f4fa78e..eae92b10c 100644 --- a/src/graphics/particle_kind.hpp +++ b/src/graphics/particle_kind.hpp @@ -40,54 +40,54 @@ enum EmitterShape class ParticleKind : public NoCopy { private: - + /** Size of the particles. */ //float m_particle_size; float m_max_size; float m_min_size; - + int m_angle_spread; - + float m_velocity_x; float m_velocity_y; float m_velocity_z; - + EmitterShape m_shape; - + /** Minimal emission rate in particles per second */ int m_min_rate; - + /** Maximal emission rate in particles per second */ int m_max_rate; - + int m_lifetime_min; int m_lifetime_max; - + int m_fadeout_time; - + video::SColor m_min_start_color; video::SColor m_max_start_color; - + /** Strength of gravity, not sure what the units are. Make it 0 to disable */ float m_gravity_strength; - + /** Time it takes for gravity to completely replace the emission force */ int m_force_lost_to_gravity_time; - + /** For box emitters only */ float m_box_x, m_box_y, m_box_z; - + /** Distance from camera at which particles start fading out, or negative if disabled */ float m_fade_away_start, m_fade_away_end; - + int m_emission_decay_rate; - + std::string m_name; - + std::string m_material_file; - + public: - + /** * @brief Load a XML file describing a type of particles * @param file Name of the file to load (no full path) @@ -96,48 +96,48 @@ public: ParticleKind(const std::string file); virtual ~ParticleKind() {} - + float getMaxSize () const { return m_max_size; } float getMinSize () const { return m_min_size; } - + int getMinRate () const { return m_min_rate; } int getMaxRate () const { return m_max_rate; } - + EmitterShape getShape () const { return m_shape; } - + Material* getMaterial () const; int getMaxLifetime () const { return m_lifetime_max; } int getMinLifetime () const { return m_lifetime_min; } - + int getFadeoutTime () const { return m_fadeout_time; } - + video::SColor getMinColor() const { return m_min_start_color; } video::SColor getMaxColor() const { return m_max_start_color; } - + float getBoxSizeX () const { return m_box_x; } float getBoxSizeY () const { return m_box_y; } float getBoxSizeZ () const { return m_box_z; } - + int getAngleSpread () const { return m_angle_spread; } float getVelocityX () const { return m_velocity_x; } float getVelocityY () const { return m_velocity_y; } float getVelocityZ () const { return m_velocity_z; } - + /** Get the strength of gravity, not sure what the units are. Will be 0 if disabled. */ float getGravityStrength() const { return m_gravity_strength; } - + /** Get the time it takes for gravity to completely replace the emission force. Meaningless if gravity is disabled. */ int getForceLostToGravityTime() const { return m_force_lost_to_gravity_time; } - + float getFadeAwayStart() const { return m_fade_away_start; } float getFadeAwayEnd () const { return m_fade_away_end; } - + void setBoxSizeXZ (float x, float z) { m_box_x = x; m_box_z = z; } - + int getEmissionDecayRate() const { return m_emission_decay_rate; } - + std::string getName() const { return m_name; } }; diff --git a/src/graphics/particle_kind_manager.hpp b/src/graphics/particle_kind_manager.hpp index aeb4c6723..9ded19ec2 100644 --- a/src/graphics/particle_kind_manager.hpp +++ b/src/graphics/particle_kind_manager.hpp @@ -31,23 +31,23 @@ class ParticleKindManager : public NoCopy { private: - + std::map m_per_track_kinds; std::map m_kinds; static ParticleKindManager* singleton; - + ParticleKindManager(); - + public: - + virtual ~ParticleKindManager(); ParticleKind* getParticles(const std::string &name); - + void cleanUpTrackSpecificGfx(); void cleanup(); - + static ParticleKindManager* get(); }; #endif diff --git a/src/graphics/per_camera_node.hpp b/src/graphics/per_camera_node.hpp index 29686fbcd..fb1799a73 100644 --- a/src/graphics/per_camera_node.hpp +++ b/src/graphics/per_camera_node.hpp @@ -37,7 +37,7 @@ namespace irr const int ESNT_PER_CAMERA_NODE = MAKE_IRR_ID('p','c','a','m'); } } - + /** * \brief manages smoke particle effects * \ingroup graphics @@ -50,31 +50,31 @@ private: scene::ICameraSceneNode* m_camera; scene::ISceneNode* m_child; - + public: - + PerCameraNode(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id, scene::ICameraSceneNode* camera, scene::IMesh* mesh); virtual ~PerCameraNode(); - + //! returns the axis aligned bounding box of this node virtual const core::aabbox3d& getBoundingBox() const { return Box; } - + //! Returns a reference to the current relative transformation matrix. //! This is the matrix, this scene node uses instead of scale, translation //! and rotation. virtual core::matrix4& getRelativeTransformationMatrix() { return RelativeTransformationMatrix; } - + //! Returns the relative transformation of the scene node. virtual core::matrix4 getRelativeTransformation() const { return RelativeTransformationMatrix; } - + void setCamera(scene::ICameraSceneNode* camera); - + virtual void OnRegisterSceneNode(); virtual void render(); - + virtual scene::ESCENE_NODE_TYPE getType() const { return (scene::ESCENE_NODE_TYPE)scene::ESNT_PER_CAMERA_NODE; } - + scene::ISceneNode* getChild() { return m_child; } }; diff --git a/src/graphics/post_processing.hpp b/src/graphics/post_processing.hpp index 17d1afac8..136c0e1ec 100644 --- a/src/graphics/post_processing.hpp +++ b/src/graphics/post_processing.hpp @@ -1,5 +1,5 @@ // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2011-2013 the SuperTuxKart team +// Copyright (C) 2011-2013 the SuperTuxKart team // Copyright (C) 2013 Joerg Henrichs // // This program is free software; you can redistribute it and/or @@ -42,7 +42,7 @@ private: video::SMaterial m_blur_material; bool m_supported; - + /** Boost time, how long the boost should be displayed. This also * affects the strength of the effect: longer boost time will * have a stronger effect. */ @@ -67,11 +67,11 @@ private: /** The vertices for the rectangle used for each camera. This includes * the vertex position, normal, and texture coordinate. */ std::vector m_vertices; - + public: PostProcessing(video::IVideoDriver* video_driver); virtual ~PostProcessing(); - + void reset(); /** Those should be called around the part where we render the scene to be post-processed */ void beginCapture(); @@ -80,13 +80,13 @@ public: /** Render the post-processed scene */ void render(); - + /** Is the hardware able to use post-processing? */ inline bool isSupported() const {return m_supported;} - + /** Use motion blur for a short time */ void giveBoost(unsigned int cam_index); - + /** Implement IShaderConstantsSetCallback. Shader constants setter for post-processing */ virtual void OnSetConstants(video::IMaterialRendererServices *services, s32 user_data); }; diff --git a/src/graphics/rain.hpp b/src/graphics/rain.hpp index 4dafed01d..4f7f13f24 100644 --- a/src/graphics/rain.hpp +++ b/src/graphics/rain.hpp @@ -39,21 +39,21 @@ class Rain PerCameraNode* m_node[RAIN_RING_COUNT]; std::vector m_materials; - + float m_x[RAIN_RING_COUNT]; float m_y[RAIN_RING_COUNT]; - + float m_next_lightning; bool m_lightning; SFXBase* m_thunder_sound; - + public: Rain(Camera* camera, irr::scene::ISceneNode* parent); ~Rain(); - + void update(float dt); void setPosition(const irr::core::vector3df& position); - + void setCamera(scene::ICameraSceneNode* camera); }; diff --git a/src/graphics/referee.hpp b/src/graphics/referee.hpp index efebf339d..1aca693ee 100644 --- a/src/graphics/referee.hpp +++ b/src/graphics/referee.hpp @@ -90,7 +90,7 @@ public: scene::IAnimatedMeshSceneNode* getSceneNode() { return m_scene_node; } // ------------------------------------------------------------------------ /** Moves the referee to the specified position. */ - void setPosition(const Vec3 &xyz) + void setPosition(const Vec3 &xyz) {m_scene_node->setPosition(xyz.toIrrVector()); } // ------------------------------------------------------------------------ /** Sets the rotation of the scene node (in degrees). @@ -105,7 +105,7 @@ public: * start of a race. */ static const Vec3& getStartOffset() {return m_st_start_offset; } // ------------------------------------------------------------------------ - /** Returns the rotation of the mesh so that it faces the kart (when + /** Returns the rotation of the mesh so that it faces the kart (when * applied to a kart with heading 0). */ static const Vec3& getStartRotation() {return m_st_start_rotation; } }; // Referee diff --git a/src/graphics/shadow.hpp b/src/graphics/shadow.hpp index 313769fa8..4a7d23e8c 100644 --- a/src/graphics/shadow.hpp +++ b/src/graphics/shadow.hpp @@ -30,7 +30,7 @@ namespace irr } using namespace irr; -/** +/** * \brief This class is used to enable a shadow for a kart. * For now it uses a simple texture to simulate the shadow, real time shadows might * be added later. diff --git a/src/graphics/show_curve.hpp b/src/graphics/show_curve.hpp index db576d098..6a6086819 100644 --- a/src/graphics/show_curve.hpp +++ b/src/graphics/show_curve.hpp @@ -33,7 +33,7 @@ using namespace irr; /** This class is used for debugging. It allows to show an arbitrary curve * in the race. The curve is shown as a 'tunnel', i.e. in the constructor - * you can specify the width and height of this tunnel. Each point then + * you can specify the width and height of this tunnel. Each point then * adds 4 vertices: point + (+- width/2, +- height2, 0). That's not * exact (if the curve is not parallel to the z axis), but good enough for * debugging. @@ -64,7 +64,7 @@ private: void addEmptyMesh(); public: - ShowCurve(float width, float height, + ShowCurve(float width, float height, const irr::video::SColor &color = video::SColor(77, 0, 179, 0)); ~ShowCurve(); void addPoint(const Vec3 &pnt); diff --git a/src/graphics/skid_marks.hpp b/src/graphics/skid_marks.hpp index 105000c77..ef3ffb3e0 100644 --- a/src/graphics/skid_marks.hpp +++ b/src/graphics/skid_marks.hpp @@ -61,7 +61,7 @@ private: /** Material to use for the skid marks. */ video::SMaterial *m_material; - + // ------------------------------------------------------------------------ class SkidMarkQuads : public scene::SMeshBuffer, public NoCopy { @@ -76,11 +76,11 @@ private: /** For culling, we need the overall radius of the skid marks. We * approximate this by maintaining an axis-aligned boundary box. */ core::aabbox3df m_aabb; - + video::SColor m_start_color; - + public: - SkidMarkQuads (const Vec3 &left, const Vec3 &right, + SkidMarkQuads (const Vec3 &left, const Vec3 &right, video::SMaterial *material, float z_offset, video::SColor* custom_color = NULL); void add (const Vec3 &left, @@ -104,12 +104,12 @@ private: public: SkidMarks(const AbstractKart& kart, float width=0.2f); ~SkidMarks(); - void update (float dt, bool force_skid_marks=false, - video::SColor* custom_color = NULL); + void update (float dt, bool force_skid_marks=false, + video::SColor* custom_color = NULL); void reset(); - + void adjustFog(bool enabled); - + }; // SkidMarks #endif diff --git a/src/graphics/slip_stream.hpp b/src/graphics/slip_stream.hpp index b07d98599..57d40483f 100644 --- a/src/graphics/slip_stream.hpp +++ b/src/graphics/slip_stream.hpp @@ -63,7 +63,7 @@ private: /** The time a kart was in slipstream. */ float m_slipstream_time; - + /** Slipstream mode: either nothing happening, or the kart is collecting * 'slipstream credits', or the kart is using accumulated credits. */ enum {SS_NONE, SS_COLLECT, SS_USE} m_slipstream_mode; @@ -72,7 +72,7 @@ private: * This value is current area, i.e. takes the kart position into account. */ Quad *m_slipstream_quad; - /** This is slipstream area if the kart is at 0,0,0 without rotation. From + /** This is slipstream area if the kart is at 0,0,0 without rotation. From * this value m_slipstream_area is computed by applying the kart transform. */ Quad *m_slipstream_original_quad; diff --git a/src/graphics/stars.hpp b/src/graphics/stars.hpp index bfd2efd0b..5f8dbfc03 100644 --- a/src/graphics/stars.hpp +++ b/src/graphics/stars.hpp @@ -35,22 +35,22 @@ using namespace irr; class Stars : public NoCopy { private: - + /** Vector containing the stars */ std::vector m_nodes; - + /** The scene node of the kart to which the stars belong. */ scene::ISceneNode *m_parent_kart_node; - + /** Center around which stars rotate */ core::vector3df m_center; - + /** Whether stars are currently enabled */ bool m_enabled; - + float m_fade_in_time; float m_remaining_time; - + public: Stars (scene::ISceneNode* parentKart, core::vector3df center); ~Stars (); diff --git a/src/guiengine/abstract_state_manager.hpp b/src/guiengine/abstract_state_manager.hpp index b1e9f63a8..98a054862 100644 --- a/src/guiengine/abstract_state_manager.hpp +++ b/src/guiengine/abstract_state_manager.hpp @@ -32,7 +32,7 @@ namespace GUIEngine { class Widget; class Screen; - + /** * \ingroup guiengine */ @@ -42,7 +42,7 @@ namespace GUIEngine GAME, INGAME_MENU }; // GameState - + /** * \brief Abstract base class you must override from to use the GUI engine * \ingroup guiengine @@ -54,118 +54,118 @@ namespace GUIEngine * Whether we are in game mode */ GameState m_game_mode; - + /** - * This stack will contain menu names (e.g. main.stkgui), + * This stack will contain menu names (e.g. main.stkgui), * and/or 'race'. */ std::vector m_menu_stack; - + void pushMenu(std::string name); - + void setGameState(GameState state); - + public: - + LEAK_CHECK() - + /** inits an AbstractStateManager is MENU state */ AbstractStateManager(); - + virtual ~AbstractStateManager() { } - + /** \brief adds a menu at the top of the screens stack */ void pushScreen(Screen* screen); - + /** \brief replaces the menu at the top of the screens stack - * (i.e. pops the topmost screen and adds this one instead, but - * without displaying the second-topmost menu of the stack + * (i.e. pops the topmost screen and adds this one instead, but + * without displaying the second-topmost menu of the stack * in-between) */ void replaceTopMostScreen(Screen* screen); - + /** * \brief removes the menu at the top of the screens stack - * If the stack becomes empty after performing the pop (i.e. if it + * If the stack becomes empty after performing the pop (i.e. if it * contained only one item prior to the call), the game is aborted. * In other cases, the second-topmost screen is displayed. */ void popMenu(); - + /** - * \brief clears the menu stack and starts afresh with a new stack + * \brief clears the menu stack and starts afresh with a new stack * containing only the given screen */ void resetAndGoToScreen(Screen* screen); - + /** * \brief Sets the whole menu stack. * Only the topmost screen will be inited/shown, but others remain * under for cases where the user wants to go back. - * \param screens an array containing the menus that should go into - * stack. The first item will be the bottom item in the stack, the + * \param screens an array containing the menus that should go into + * stack. The first item will be the bottom item in the stack, the * last item will be the stack top. Array must be NULL-terminated. */ void resetAndSetStack(Screen* screens[]); - + /** * \brief call to make the state manager enter game mode. * Causes the menu stack to be cleared; all widgets shown on screen * are removed */ void enterGameState(); - + /** \return the current state of the game */ GameState getGameState(); - + /** \brief to be called after e.g. a resolution switch */ void reshowTopMostMenu(); - + template void hardResetAndGoToScreen() - { + { if (m_game_mode != GAME) GUIEngine::getCurrentScreen()->tearDown(); m_menu_stack.clear(); - + GUIEngine::clearScreenCache(); - + T* instance = T::getInstance(); - + m_menu_stack.push_back(instance->getName()); setGameState(MENU); - + switchToScreen(instance->getName().c_str()); getCurrentScreen()->init(); - + onTopMostScreenChanged(); } - + /* *********************************** * methods to override in children * *********************************** */ - + /** - * \brief callback invoked whenever escape was pressed (or any + * \brief callback invoked whenever escape was pressed (or any * similar cancel operation) */ virtual void escapePressed() = 0; - + /** - * \brief callback invoked when game mode changes (e.g. goes from + * \brief callback invoked when game mode changes (e.g. goes from * "menu" to "in-game") */ virtual void onGameStateChange(GameState new_state) = 0; - + /** * \brief callback invoked when the stack is emptied (all menus are - * popped out). This is essentially a request to close the + * popped out). This is essentially a request to close the * application (since a game can't run without a state) */ virtual void onStackEmptied() = 0; - + virtual void onTopMostScreenChanged() = 0; - + }; // Class AbstractStateManager - + } // GUIEngine #endif diff --git a/src/guiengine/abstract_top_level_container.hpp b/src/guiengine/abstract_top_level_container.hpp index 93817391f..e75d3cb71 100644 --- a/src/guiengine/abstract_top_level_container.hpp +++ b/src/guiengine/abstract_top_level_container.hpp @@ -29,10 +29,10 @@ namespace GUIEngine { class Widget; - + /** * \brief Represents a GUI widgets container. - * + * * Abstract base class for both Screen and ModalDialog. * * \ingroup guiengine @@ -42,39 +42,39 @@ namespace GUIEngine protected: /** the widgets in this screen */ PtrVector m_widgets; - + /** * AbstractTopLevelContainer is generally able to determine its first - * widget just fine, but in highly complex screens (e.g. multiplayer - * kart selection) you can help it by providing the first widget + * widget just fine, but in highly complex screens (e.g. multiplayer + * kart selection) you can help it by providing the first widget * manually. */ Widget* m_first_widget; - + /** * AbstractTopLevelContainer is generally able to determine its last * widget just fine, but in highly complex screens (e.g. multiplayer - * kart selection) you can help it by providing the first widget + * kart selection) you can help it by providing the first widget * manually. */ Widget* m_last_widget; - void addWidgetsRecursively(PtrVector& widgets, + void addWidgetsRecursively(PtrVector& widgets, Widget* parent=NULL); public: AbstractTopLevelContainer(); virtual ~AbstractTopLevelContainer() {} - + virtual int getWidth() = 0; virtual int getHeight() = 0; - + /** \return an object by name, or NULL if not found */ Widget* getWidget(const char* name); - + /** \return an object by irrlicht ID, or NULL if not found */ Widget* getWidget(const int id); - + /** This function searches and returns a widget by name, cast as specified type, * if that widget is found and the type is correct. * \param name The name of the widget to find @@ -88,26 +88,26 @@ namespace GUIEngine if (out != NULL && outCasted == NULL) { fprintf(stderr, "Screen::getWidget : Widget '%s' of type '%s'" - "cannot be casted to requested type '%s'!\n", name, - typeid(*out).name(), typeid(T).name()); + "cannot be casted to requested type '%s'!\n", name, + typeid(*out).name(), typeid(T).name()); abort(); } return outCasted; } - - static Widget* getWidget(const char* name, + + static Widget* getWidget(const char* name, PtrVector* within_vector); static Widget* getWidget(const int id, PtrVector* within_vector); - + Widget* getFirstWidget(PtrVector* within_vector=NULL); Widget* getLastWidget(PtrVector* within_vector=NULL); void elementsWereDeleted(PtrVector* within_vector = NULL); - + bool isMyChild(Widget* widget) const; }; // AbstractTopLevelContainer - + } // namespace GUIEngine #endif diff --git a/src/guiengine/engine.hpp b/src/guiengine/engine.hpp index 81da7e586..9a91cdd84 100644 --- a/src/guiengine/engine.hpp +++ b/src/guiengine/engine.hpp @@ -46,12 +46,12 @@ namespace irr * See \ref gui_overview for more information. */ namespace GUIEngine -{ +{ class Screen; class Widget; class Skin; class AbstractStateManager; - + /** \brief Returns the widget currently focused by given player, or NULL if none. * \note Do NOT use irrLicht's GUI focus facilities; it's too limited for our * needs, so we use ours. (i.e. always call these functions are never those @@ -72,7 +72,7 @@ namespace GUIEngine * in IGUIEnvironment) */ bool isFocusedForPlayer(const Widget*w, const int playerID); - + /** * In an attempt to make getters as fast as possible, by possibly still allowing inlining * These fields should never be accessed outside of the GUI engine. @@ -93,10 +93,10 @@ namespace GUIEngine extern AbstractStateManager* g_state_manager; extern Widget* g_focus_for_player[MAX_PLAYER_COUNT]; } - + /** Widgets that need to be notified at every frame can add themselves there (FIXME: unclean) */ extern PtrVector needsUpdate; - + /** * \brief Call this method to init the GUI engine. * \pre A irrlicht device and its corresponding video drivers must have been created @@ -105,32 +105,32 @@ namespace GUIEngine * \param state_manager An instance of a class derived from abstract base AbstractStateManager */ void init(irr::IrrlichtDevice* device, irr::video::IVideoDriver* driver, AbstractStateManager* state_manager); - + void cleanUp(); - + void deallocate(); - - + + /** * \return the irrlicht device object */ inline irr::IrrlichtDevice* getDevice() { return Private::g_device; } - + /** * \return the irrlicht GUI environment object */ inline irr::gui::IGUIEnvironment* getGUIEnv() { return Private::g_env; } - + /** * \return the irrlicht video driver object */ inline irr::video::IVideoDriver* getDriver() { return Private::g_driver; } - + /** * \return the smaller font (useful for less important messages) */ inline irr::gui::ScalableFont* getSmallFont() { return Private::g_small_font; } - + /** * \return the "normal" font (useful for text) */ @@ -140,7 +140,7 @@ namespace GUIEngine * \return the "large" font (useful for text) */ inline irr::gui::ScalableFont* getLargeFont() { return Private::g_large_font; } - + /** * \return the "high-res digits" font (useful for big numbers) */ @@ -150,19 +150,19 @@ namespace GUIEngine * \return the "title" font (it's bigger and orange, useful for headers/captions) */ inline irr::gui::ScalableFont* getTitleFont() { return Private::g_title_font; } - + /** * \return the currently shown screen, or NULL if none */ inline Screen* getCurrentScreen() { return Private::g_current_screen; } - + /** * \return the state manager being used, as passed to GUIEngine::init */ inline AbstractStateManager* getStateManager() { return Private::g_state_manager; } - + void clearScreenCache(); - + /** * \pre GUIEngine::init must have been called first * \return the skin object used to render widgets @@ -170,74 +170,74 @@ namespace GUIEngine inline Skin* getSkin() { return Private::g_skin; } Screen* getScreenNamed(const char* name); - + /** \return the height of the title font in pixels */ int getTitleFontHeight(); - + /** \return the height of the font in pixels */ int getFontHeight(); - + /** \return the height of the small font in pixels */ int getSmallFontHeight(); - + /** * \pre the value returned by this function is only valid when invoked from GUIEngine::render * \return the time delta between the last two frames */ float getLatestDt(); - + /** * \brief shows a message at the bottom of the screen for a while * \param message the message to display * \param time the time to display the message, in seconds */ void showMessage(const wchar_t* message, const float time=5.0f); - + /** \brief Add a screen to the list of screens known by the gui engine */ void addScreenToList(Screen* screen); - + /** \brief Low-level mean to change current screen. * \note Do not use directly. Use a state manager instead to get higher-level functionnality. */ void switchToScreen(const char* ); - + /** \brief erases the currently displayed screen, removing all added irrLicht widgets * \note Do not use directly. Use a state manager instead to get higher-level functionnality. */ void clear(); void update(float dt); - + /** \brief like GUIEngine::clear, but to be called before going into game */ void cleanForGame(); - + /** \brief to be called after e.g. a resolution switch */ void reshowCurrentScreen(); - + /** * \brief called on every frame to trigger the rendering of the GUI */ void render(float dt); - + /** \brief renders a "loading" screen */ void renderLoading(bool clearIcons = true); - + /** \brief to spice up a bit the loading icon : add icons to the loading screen */ void addLoadingIcon(irr::video::ITexture* icon); - + /** \brief Finds a widget from its name (PROP_ID) in the current screen/dialog * \param name the name (PROP_ID) of the widget to search for * \return the widget that bears that name, or NULL if it was not found */ Widget* getWidget(const char* name); - + /** \brief Finds a widget from its irrlicht widget ID in the current screen/dialog * \param name the irrlicht widget ID (not to be confused with PROP_ID, which is a string) * of the widget to search for * \return the widget that bears that irrlicht ID, or NULL if it was not found */ Widget* getWidget(const int id); - + /** * \brief call when skin in user config was updated */ diff --git a/src/guiengine/event_handler.hpp b/src/guiengine/event_handler.hpp index a40d8c391..59362ea6b 100644 --- a/src/guiengine/event_handler.hpp +++ b/src/guiengine/event_handler.hpp @@ -28,7 +28,7 @@ */ namespace GUIEngine { - + /** * \ingroup guiengine */ @@ -37,9 +37,9 @@ namespace GUIEngine EVENT_BLOCK, EVENT_LET }; - + class Widget; - + /** * \brief Class to handle irrLicht events (GUI and input as well) * @@ -59,30 +59,30 @@ namespace GUIEngine EventPropagation onWidgetActivated(Widget* w, const int playerID); void navigateUp(const int playerID, Input::InputType type, const bool pressedDown); void navigateDown(const int playerID, Input::InputType type, const bool pressedDown); - + /** \brief send an event to the GUI module user's event callback * \param widget the widget that triggerred this event * \param name the name/ID (PROP_ID) of the widget that triggerred this event * \param playerID ID of the player that triggerred this event */ void sendEventToUser(Widget* widget, std::string& name, const int playerID); - + /** Last position of the mouse cursor */ irr::core::vector2di m_mouse_pos; - + public: - + LEAK_CHECK() - + EventHandler(); ~EventHandler(); - + /** * All irrLicht events will go through this (input as well GUI; input events are * immediately delegated to the input module, GUI events are processed here) */ bool OnEvent (const irr::SEvent &event); - + /** * When the input module is done processing an input and mapped it to an action, * and this action needs to be applied to the GUI (e.g. fire pressed, left @@ -90,15 +90,15 @@ namespace GUIEngine */ void processGUIAction(const PlayerAction action, int deviceID, const unsigned int value, Input::InputType type, const int playerID); - + /** Get the mouse position */ const irr::core::vector2di& getMousePos() const { return m_mouse_pos; } - + /** singleton access */ static EventHandler* get(); static void deallocate(); }; - + } #endif diff --git a/src/guiengine/layout_manager.hpp b/src/guiengine/layout_manager.hpp index 70d899c2c..4a009bb3e 100644 --- a/src/guiengine/layout_manager.hpp +++ b/src/guiengine/layout_manager.hpp @@ -27,10 +27,10 @@ namespace GUIEngine { class Widget; class AbstractTopLevelContainer; - + class LayoutManager { - + /** * \brief Receives as string the raw property value retrieved from XML file. * Will try to make sense of it, as an absolute value or a percentage. @@ -40,9 +40,9 @@ namespace GUIEngine * Returns false if couldn't convert to either */ static bool convertToCoord(std::string& x, int* absolute /* out */, int* percentage /* out */); - + static void recursivelyReadCoords(PtrVector& widgets); - + /** * \brief Recursive call that lays out children widget within parent (or screen if none). * @@ -51,10 +51,10 @@ namespace GUIEngine */ static void doCalculateLayout(PtrVector& widgets, AbstractTopLevelContainer* topLevelContainer, Widget* parent); - - + + public: - + /** * \brief Recursive call that lays out children widget within parent (or screen if none). * @@ -62,13 +62,13 @@ namespace GUIEngine * of the remaining children, as well as absolute sizes and locations. */ static void calculateLayout(PtrVector& widgets, AbstractTopLevelContainer* topLevelContainer); - + /** * \brief Find a widget's x, y, w and h coords from what is specified in the XML properties. * Most notably, expands coords relative to parent and percentages. */ static void applyCoords(Widget* self, AbstractTopLevelContainer* topLevelContainer, Widget* parent); - + /** * \brief Find a widget's x, y, w and h coords from what is specified in the XML properties. * (First step; 'applyCoords' is the second step) diff --git a/src/guiengine/modaldialog.hpp b/src/guiengine/modaldialog.hpp index e6a9b3c62..731749a94 100644 --- a/src/guiengine/modaldialog.hpp +++ b/src/guiengine/modaldialog.hpp @@ -38,13 +38,13 @@ namespace GUIEngine class Widget; class TextBoxWidget; class ButtonWidget; - + enum ModalDialogLocation { MODAL_DIALOG_LOCATION_CENTER = 0, MODAL_DIALOG_LOCATION_BOTTOM = 1 }; - + /** * \brief Abstract base class representing a modal dialog. * Only once instance at a time (if you create a 2nd the first will be destroyed). @@ -57,16 +57,16 @@ namespace GUIEngine private: /** Because C++ doesn't support constructor delegation... */ void doInit(const float percentWidth, const float percentHeight); - + ModalDialogLocation m_dialog_location; - - + + protected: irr::gui::IGUIWindow* m_irrlicht_window; irr::core::rect< irr::s32 > m_area; - + InputManager::InputDriverMode m_previous_mode; - + /** * \brief Creates a modal dialog with given percentage of screen width and height */ @@ -80,57 +80,57 @@ namespace GUIEngine virtual void onEnterPressedInternal(); void clearWindow(); - + /** \brief Callback invoked when the dialog was loaded from the XML file (if the constructor * that takes a XML file as argument is used) */ virtual void loadedFromFile() {} - + public: LEAK_CHECK() - + virtual ~ModalDialog(); - + /** Returns whether to block event propagation (usually, you will want to block events you processed) */ virtual EventPropagation processEvent(const std::string& eventSource){ return EVENT_LET; } - + irr::gui::IGUIWindow* getIrrlichtElement() { return m_irrlicht_window; } - + static void dismiss(); static void onEnterPressed(); static ModalDialog* getCurrent(); static bool isADialogActive(); - + /** Override to change what happens on escape pressed */ virtual void escapePressed() { dismiss(); } - + /** Override to be notified of updates */ virtual void onUpdate(float dt) { } - + /** * \brief Optional callback invoked very early, before widgets have been added (contrast with * init(), which is invoked afer widgets were added) */ virtual void beforeAddingWidgets() {} - + /** \brief Optional callback invoked after widgets have been add()ed */ virtual void init() {} - + /** * \brief Implementing callback from AbstractTopLevelContainer */ virtual int getWidth() { return m_area.getWidth(); } - + /** * \brief Implementing callback from AbstractTopLevelContainer */ virtual int getHeight() { return m_area.getHeight(); } - + bool isMyIrrChild(irr::gui::IGUIElement* widget) const { return m_irrlicht_window->isMyChild(widget); } - }; - + }; + } #endif diff --git a/src/guiengine/scalable_font.hpp b/src/guiengine/scalable_font.hpp index 05fb44763..c6aed9d81 100644 --- a/src/guiengine/scalable_font.hpp +++ b/src/guiengine/scalable_font.hpp @@ -39,41 +39,41 @@ class ScalableFont : public IGUIFontBitmap bool m_mono_space_digits; irr::video::SColor m_shadow_color; - + struct TextureInfo { irr::core::stringc m_file_name; bool m_has_alpha; float m_scale; bool m_exclude_from_max_height_calculation; - + TextureInfo() { m_has_alpha = false; m_scale = 1.0f; } }; - + std::map m_texture_files; - + void doReadXmlFile(io::IXMLReader* xml); - + bool m_is_hollow_copy; bool m_rtl; - + /** Position in range [0..1] of the single tab stop we support */ float m_tab_stop; - + public: LEAK_CHECK() - + bool m_black_border; - + ScalableFont* m_fallback_font; float m_fallback_font_scale; int m_fallback_kerning_width; - + //! constructor ScalableFont(IGUIEnvironment* env, const io::path& filename); @@ -91,7 +91,7 @@ public: out->m_is_hollow_copy = true; return out; } - + //! destructor virtual ~ScalableFont(); @@ -108,7 +108,7 @@ public: virtual void draw(const core::stringw& text, const core::rect& position, video::SColor color, bool hcenter, bool vcenter, const core::rect* clip, bool ignoreRTL); - + //! returns the dimension of a text virtual core::dimension2d getDimension(const wchar_t* text) const; @@ -142,12 +142,12 @@ public: void setScale(const float scale); float getScale() const { return m_scale; } - + void updateRTL(); - + /** \param pos position of the tab stop, in range [0..1] */ void setTabStop(float pos) { m_tab_stop = pos; } - + private: struct SFontArea @@ -158,7 +158,7 @@ private: s32 width; u32 spriteno; }; - + int getCharWidth(const SFontArea& area, const bool fallback) const; s32 getAreaIDFromCharacter(const wchar_t c, bool* fallback_font) const; const SFontArea &getAreaFromCharacter(const wchar_t c, bool* fallback_font) const; diff --git a/src/guiengine/screen.hpp b/src/guiengine/screen.hpp index e65bbe91b..b6271c0c1 100644 --- a/src/guiengine/screen.hpp +++ b/src/guiengine/screen.hpp @@ -96,7 +96,7 @@ namespace GUIEngine class Screen : public AbstractTopLevelContainer { private: - /** True if the race (if it is running) should be paused when this + /** True if the race (if it is running) should be paused when this * screen is shown. The RaceResultGUI uses this to leave the race * running while it is being shown. */ bool m_pause_race; @@ -180,7 +180,7 @@ namespace GUIEngine */ void setNeeds3D(bool needs3D) { m_render_3d = needs3D; } - /** + /** * \brief Callback invoked when loading this menu. * * \pre Children widgets of this menu have been created by the time @@ -216,7 +216,7 @@ namespace GUIEngine */ virtual void beforeAddingWidget() {} - /** + /** * \brief Callback invoked when entering this menu (after the * widgets have been added). * @@ -227,7 +227,7 @@ namespace GUIEngine */ virtual void init(); - /** + /** * \brief Callback invoked before leaving this menu. * * \note The same instance of your object may be entered/left more @@ -237,7 +237,7 @@ namespace GUIEngine */ virtual void tearDown(); - /** + /** * \brief Called when escape is pressed. * \return true if the screen should be closed, * false if you handled the press another way @@ -283,7 +283,7 @@ namespace GUIEngine int deviceID, const unsigned int value, Input::InputType type, - int playerId) + int playerId) { return EVENT_LET; } /** Callback you can use if you want to know when the user pressed diff --git a/src/guiengine/skin.hpp b/src/guiengine/skin.hpp index 0fe3b32e8..969399c67 100644 --- a/src/guiengine/skin.hpp +++ b/src/guiengine/skin.hpp @@ -40,91 +40,91 @@ using namespace irr; /** \page skin Overview of GUI skin - - The GUIEngine::Skin is the one handling skinning. It loads images and their - sizing from a XML file. Since the irrLicht way of handling skin is quite - "boxy" and results in games looking like Window 95, this class overrides it + + The GUIEngine::Skin is the one handling skinning. It loads images and their + sizing from a XML file. Since the irrLicht way of handling skin is quite + "boxy" and results in games looking like Window 95, this class overrides it very much; in pretty much all callbacks, rather drawing plainly what irrLicht - asks it to draw, it first checks which widget we're asked to render and + asks it to draw, it first checks which widget we're asked to render and redirects the call to a more specific method. - - Furthermore, since irrLicht widgets were quite basic, a few widgets were - created by combining several irrLicht widgets (e.g. 2 buttons and a label in - a box make a spinner). Because of this, some jumping through hoops is + + Furthermore, since irrLicht widgets were quite basic, a few widgets were + created by combining several irrLicht widgets (e.g. 2 buttons and a label in + a box make a spinner). Because of this, some jumping through hoops is performed (we get a callback for each of these sub-widgets, but want to draw the whole thing as a single block) - There are two types of images : some will be simply stretched as a whole, - others will have non-stretchable borders (you cannot choose which one you - must use, it's hardcoded for each element type; though, as you will see - below, for all "advanced stretching" images you can easily fake "simple + There are two types of images : some will be simply stretched as a whole, + others will have non-stretchable borders (you cannot choose which one you + must use, it's hardcoded for each element type; though, as you will see + below, for all "advanced stretching" images you can easily fake "simple stretch") - + \section Describing a skin in a XML file - + All elements will have at least 2 properties : \li \c type="X" : sets what you're skinning with this entry - \li \c image="skinDirectory/imageName.png" : sets which image is used for + \li \c image="skinDirectory/imageName.png" : sets which image is used for this element - - For more information, I highly recommend simply looking at existing skins, + + For more information, I highly recommend simply looking at existing skins, they will show the format of the XML file describing a skin quite well. - + \section states Widget States - + Most elements also support states : \li \c state="neutral" \li \c state="focused" \li \c state="down" - - You can thus give different looks for different states. Not all widgets - support all states, see entries and comments below to know what's + + You can thus give different looks for different states. Not all widgets + support all states, see entries and comments below to know what's supported. Note that checkboxes are an exception and have the following styles : \li \lc "neutral+unchecked" \li \lc "neutral+checked" \li \lc "focused+unchecked" \li \lc "focused+checked" - + \section stretch Advanced stretching "Advanced stretching" images are split this way : - + \code +----+--------------------+----+ | | | | +----+--------------------+----+ | | | | - | | | | - | | | | + | | | | + | | | | +----+--------------------+----+ - | | | | + | | | | +----+--------------------+----+ \endcode - + The center border will be stretched in all directions. The 4 corners will not - stretch at all. Horizontal borders will stretch horizontally, vertical - borders will stretch vertically. Use properties left_border="X" + stretch at all. Horizontal borders will stretch horizontally, vertical + borders will stretch vertically. Use properties left_border="X" right_border="X" top_border="X" bottom_border="X" to specify the size of each border in pixels (setting all borders to '0' makes the whole image scaled). - + In some cases, you may not want vertical stretching to occur (like if the left - and right sides of the image must not be stretched vertically, e.g. for the - spinner). In this case, pass parameter preserve_h_aspect_ratios="true" to + and right sides of the image must not be stretched vertically, e.g. for the + spinner). In this case, pass parameter preserve_h_aspect_ratios="true" to make the left and right areas stretch by keeping their aspect ratio. - + Some components may fill the full inner area with stuff; others will only take - a smaller area at the center. To adjust for this, there are properties + a smaller area at the center. To adjust for this, there are properties "hborder_out_portion" and "vborder_out_portion" that take a float from 0 to 1, representing the percentage of each border that goes out of the widget's area - (this might include stuff like shadows, etc.). The 'h' one is for horizontal + (this might include stuff like shadows, etc.). The 'h' one is for horizontal borders, the 'v' one is for vertical borders. - - Finnally : the image is split, as shown above, into 9 areas. In some cases, - you may not want all areas to be rendered. Then you can pass parameter - areas="body+left+right+top+bottom" and explicitely specify which parts you - want to see. The 4 corner areas are only visible when the border that + + Finnally : the image is split, as shown above, into 9 areas. In some cases, + you may not want all areas to be rendered. Then you can pass parameter + areas="body+left+right+top+bottom" and explicitely specify which parts you + want to see. The 4 corner areas are only visible when the border that intersect at this corner are enabled. - + */ /** @@ -132,10 +132,10 @@ using namespace irr; */ namespace GUIEngine { - + /** - * In order to avoid calculating render information every frame, it's - * stored in a SkinWidgetContainer for each widget (or each widget part + * In order to avoid calculating render information every frame, it's + * stored in a SkinWidgetContainer for each widget (or each widget part * if it requires many) * \ingroup guiengine */ @@ -143,40 +143,40 @@ namespace GUIEngine { public: int m_skin_x, m_skin_y, m_skin_w, m_skin_h; - + bool m_skin_dest_areas_inited; bool m_skin_dest_areas_yflip_inited; int m_skin_dest_x, m_skin_dest_y, m_skin_dest_x2, m_skin_dest_y2; - - // see comments in Skin::drawBoxFromStretchableTexture for + + // see comments in Skin::drawBoxFromStretchableTexture for // explaination of what these are core::rect m_skin_dest_area_left; core::rect m_skin_dest_area_center; core::rect m_skin_dest_area_right; - + core::rect m_skin_dest_area_top; core::rect m_skin_dest_area_bottom; - + core::rect m_skin_dest_area_top_left; core::rect m_skin_dest_area_top_right; core::rect m_skin_dest_area_bottom_left; core::rect m_skin_dest_area_bottom_right; - + // y flip core::rect m_skin_dest_area_left_yflip; core::rect m_skin_dest_area_center_yflip; core::rect m_skin_dest_area_right_yflip; - + core::rect m_skin_dest_area_top_yflip; core::rect m_skin_dest_area_bottom_yflip; - + core::rect m_skin_dest_area_top_left_yflip; core::rect m_skin_dest_area_top_right_yflip; core::rect m_skin_dest_area_bottom_left_yflip; - core::rect m_skin_dest_area_bottom_right_yflip; - + core::rect m_skin_dest_area_bottom_right_yflip; + short m_skin_r, m_skin_g, m_skin_b; - + SkinWidgetContainer() { m_skin_dest_areas_inited = false; @@ -190,13 +190,13 @@ namespace GUIEngine m_skin_b = -1; } // SkinWidgetContainer }; // class SkinWidgetContainer - + // ======================================================================== class Widget; - + /** - * \brief class containing render params for the - * 'drawBoxFromStretchableTexture' function see \ref skin for more + * \brief class containing render params for the + * 'drawBoxFromStretchableTexture' function see \ref skin for more * information about skinning in STK * \ingroup guiengine */ @@ -205,15 +205,15 @@ namespace GUIEngine video::ITexture* m_image; bool m_y_flip_set; - public: + public: int m_left_border, m_right_border, m_top_border, m_bottom_border; bool m_preserve_h_aspect_ratios; float m_hborder_out_portion, m_vborder_out_portion; - + // this parameter is a bit special since it's the only one that can // change at runtime bool m_vertical_flip; - + /** bitmap containing which areas to render */ int areas; // possible values in areas @@ -222,33 +222,33 @@ namespace GUIEngine static const int RIGHT = 4; static const int TOP = 8; static const int BOTTOM = 16; - + core::rect m_source_area_left; core::rect m_source_area_center; core::rect m_source_area_right; - + core::rect m_source_area_top; core::rect m_source_area_bottom; - + core::rect m_source_area_top_left; core::rect m_source_area_top_right; core::rect m_source_area_bottom_left; - core::rect m_source_area_bottom_right; - - + core::rect m_source_area_bottom_right; + + // y-flipped coords core::rect m_source_area_left_yflip; core::rect m_source_area_center_yflip; core::rect m_source_area_right_yflip; - + core::rect m_source_area_top_yflip; core::rect m_source_area_bottom_yflip; - + core::rect m_source_area_top_left_yflip; core::rect m_source_area_top_right_yflip; core::rect m_source_area_bottom_left_yflip; core::rect m_source_area_bottom_right_yflip; - + BoxRenderParams(); void setTexture(video::ITexture* image); void calculateYFlipIfNeeded(); @@ -256,7 +256,7 @@ namespace GUIEngine /** Returns the image for this BoxRenderParams. */ video::ITexture* getImage() { return m_image; } }; // BoxRenderParams - + // ======================================================================== /** * \brief Object used to render the GUI widgets @@ -266,75 +266,75 @@ namespace GUIEngine class Skin : public gui::IGUISkin { gui::IGUISkin* m_fallback_skin; - + video::ITexture* bg_image; - - + + std::vector m_tooltips; std::vector m_tooltip_at_mouse; - + #ifdef USE_PER_LINE_BACKGROUND public: #endif LEAK_CHECK() - - void drawBoxFromStretchableTexture(SkinWidgetContainer* w, + + void drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rect< s32 > &dest, - BoxRenderParams& params, + BoxRenderParams& params, bool deactivated=false, const core::rect* clipRect=NULL); private: - // my utility methods, to work around irrlicht's very + // my utility methods, to work around irrlicht's very // Windows-95-like-look-enforcing skin system - void process3DPane(gui::IGUIElement *element, + void process3DPane(gui::IGUIElement *element, const core::rect< s32 > &rect, const bool pressed); - void drawButton(Widget* w, const core::rect< s32 > &rect, + void drawButton(Widget* w, const core::rect< s32 > &rect, const bool pressed, const bool focused); - void drawProgress(Widget* w, const core::rect< s32 > &rect, + void drawProgress(Widget* w, const core::rect< s32 > &rect, const bool pressed, const bool focused); - void drawRibbon(const core::rect< s32 > &rect, Widget* widget, + void drawRibbon(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused); void drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused); void drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused); - void drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, + void drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused); - void drawGauge(const core::rect< s32 > &rect, Widget* widget, + void drawGauge(const core::rect< s32 > &rect, Widget* widget, bool focused); - void drawGaugeFill(const core::rect< s32 > &rect, Widget* widget, + void drawGaugeFill(const core::rect< s32 > &rect, Widget* widget, bool focused); - void drawCheckBox(const core::rect< s32 > &rect, Widget* widget, + void drawCheckBox(const core::rect< s32 > &rect, Widget* widget, bool focused); - void drawList(const core::rect< s32 > &rect, Widget* widget, + void drawList(const core::rect< s32 > &rect, Widget* widget, bool focused); void drawListHeader(const core::rect< s32 > &rect, Widget* widget); void drawListSelection(const core::rect< s32 > &rect, Widget* widget, bool focused, const core::rect< s32 > *clip); - void drawIconButton(const core::rect< s32 > &rect, Widget* widget, + void drawIconButton(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused); void drawScrollbarBackground(const core::rect< s32 > &rect); void drawScrollbarThumb(const core::rect< s32 > &rect); - void drawScrollbarButton(const core::rect< s32 > &rect, + void drawScrollbarButton(const core::rect< s32 > &rect, const bool pressed, const bool bottomArrow); void drawTooltip(Widget* widget, bool atMouse); - + public: - + // dirty way to have dialogs that zoom in bool m_dialog; float m_dialog_size; - + /** * \brief load a skin from the file specified in the user configuration file * \throw std::runtime_error if file cannot be read */ Skin(gui::IGUISkin* fallback_skin); - + ~Skin(); - + static video::SColor getColor(const std::string &name); void renderSections(PtrVector* within_vector=NULL); void drawBgImage(); @@ -342,73 +342,73 @@ namespace GUIEngine void drawBadgeOn(const Widget* widget, const core::rect& rect); // irrlicht's callbacks - virtual void draw2DRectangle (gui::IGUIElement *element, + virtual void draw2DRectangle (gui::IGUIElement *element, const video::SColor &color, - const core::rect< s32 > &pos, + const core::rect< s32 > &pos, const core::rect< s32 > *clip); - virtual void draw3DButtonPanePressed(gui::IGUIElement *element, + virtual void draw3DButtonPanePressed(gui::IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip); virtual void draw3DButtonPaneStandard(gui::IGUIElement *element, - const core::rect< s32 > &rect, + const core::rect< s32 > &rect, const core::rect< s32 > *clip); - virtual void draw3DMenuPane (gui::IGUIElement *element, - const core::rect< s32 > &rect, + virtual void draw3DMenuPane (gui::IGUIElement *element, + const core::rect< s32 > &rect, const core::rect< s32 > *clip); - virtual void draw3DSunkenPane (gui::IGUIElement *element, - video::SColor bgcolor, - bool flat, bool fillBackGround, - const core::rect< s32 > &rect, + virtual void draw3DSunkenPane (gui::IGUIElement *element, + video::SColor bgcolor, + bool flat, bool fillBackGround, + const core::rect< s32 > &rect, const core::rect< s32 > *clip); virtual void draw3DTabBody (gui::IGUIElement *element, bool border, - bool background, - const core::rect< s32 > &rect, - const core::rect< s32 > *clip, - s32 tabHeight=-1, + bool background, + const core::rect< s32 > &rect, + const core::rect< s32 > *clip, + s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment= gui::EGUIA_UPPERLEFT); - virtual void draw3DTabButton (gui::IGUIElement *element, - bool active, - const core::rect< s32 > &rect, - const core::rect< s32 > *clip, + virtual void draw3DTabButton (gui::IGUIElement *element, + bool active, + const core::rect< s32 > &rect, + const core::rect< s32 > *clip, gui::EGUI_ALIGNMENT alignment= gui::EGUIA_UPPERLEFT); - virtual void draw3DToolBar (gui::IGUIElement *element, - const core::rect< s32 > &rect, + virtual void draw3DToolBar (gui::IGUIElement *element, + const core::rect< s32 > &rect, const core::rect< s32 > *clip); - virtual core::rect< s32 > - draw3DWindowBackground(gui::IGUIElement *element, - bool drawTitleBar, - video::SColor titleBarColor, + virtual core::rect< s32 > + draw3DWindowBackground(gui::IGUIElement *element, + bool drawTitleBar, + video::SColor titleBarColor, const core::rect< s32 > &rect, const core::rect< s32 > *clip, core::rect* checkClientArea=0); - virtual void drawIcon (gui::IGUIElement *element, - gui::EGUI_DEFAULT_ICON icon, - const core::position2di position, - u32 starttime, u32 currenttime, - bool loop=false, + virtual void drawIcon (gui::IGUIElement *element, + gui::EGUI_DEFAULT_ICON icon, + const core::position2di position, + u32 starttime, u32 currenttime, + bool loop=false, const core::rect< s32 > *clip=NULL); virtual video::SColor getColor (gui::EGUI_DEFAULT_COLOR color) const; - virtual const wchar_t* + virtual const wchar_t* getDefaultText(gui::EGUI_DEFAULT_TEXT text) const; virtual gui::IGUIFont* getFont(gui::EGUI_DEFAULT_FONT which= gui::EGDF_DEFAULT) const ; virtual u32 getIcon (gui::EGUI_DEFAULT_ICON icon) const ; virtual s32 getSize (gui::EGUI_DEFAULT_SIZE size) const ; virtual gui::IGUISpriteBank * getSpriteBank () const ; - virtual void setColor (gui::EGUI_DEFAULT_COLOR which, + virtual void setColor (gui::EGUI_DEFAULT_COLOR which, video::SColor newColor); - virtual void setDefaultText (gui::EGUI_DEFAULT_TEXT which, + virtual void setDefaultText (gui::EGUI_DEFAULT_TEXT which, const wchar_t* newText); - virtual void setFont (gui::IGUIFont *font, + virtual void setFont (gui::IGUIFont *font, gui::EGUI_DEFAULT_FONT which=gui::EGDF_DEFAULT); virtual void setIcon (gui::EGUI_DEFAULT_ICON icon, u32 index); virtual void setSize (gui::EGUI_DEFAULT_SIZE which, s32 size); virtual void setSpriteBank (gui::IGUISpriteBank *bank); - + void drawTooltips(); - + video::ITexture* getImage(const char* name); gui::IGUISkin* getFallbackSkin() { return m_fallback_skin; } diff --git a/src/guiengine/widget.hpp b/src/guiengine/widget.hpp index b2415910e..3cbaaf88e 100644 --- a/src/guiengine/widget.hpp +++ b/src/guiengine/widget.hpp @@ -33,9 +33,9 @@ namespace irr namespace GUIEngine { - + class DynamicRibbonWidget; - + enum WidgetType { WTYPE_NONE = -1, @@ -54,7 +54,7 @@ namespace GUIEngine WTYPE_TEXTBOX, WTYPE_PROGRESS }; - + enum BadgeType { /** display a lock on the widget, to mean a certain game feature is locked */ @@ -72,8 +72,8 @@ namespace GUIEngine /** An hourglass badge to indocate loading */ LOADING_BADGE = 64 }; - - + + enum Property { PROP_ID = 100, @@ -102,10 +102,10 @@ namespace GUIEngine PROP_MAX_ROWS, PROP_WRAP_AROUND }; - + bool isWithinATextBox(); void setWithinATextBox(bool in); - + /** * \brief The nearly-abstract base of all widgets * (not fully abstract since a bare Widget can be created for the sole goal of containing @@ -122,8 +122,8 @@ namespace GUIEngine * \ingroup guiengine */ class Widget : public SkinWidgetContainer - { - protected: + { + protected: unsigned int m_magic_number; // FIXME: find better ways than hackish "friend"? @@ -137,19 +137,19 @@ namespace GUIEngine friend class LayoutManager; friend class ModalDialog; friend class AbstractTopLevelContainer; - + /** Used during loading, by the layout engine. After layout is done this is not read anymore. */ int m_absolute_x, m_absolute_y, m_absolute_w, m_absolute_h; int m_absolute_reverse_x, m_absolute_reverse_y; float m_relative_x, m_relative_y, m_relative_w, m_relative_h; - + /** PROP_TEXT is a special case : since it can be translated it can't * go in the map above, which uses narrow strings */ irr::core::stringw m_text; - + /** Whether the text in m_text is right-to-left */ bool m_is_text_rtl; - + /** When true, this widget shall use a bigger and more colourful font */ bool m_title_font; @@ -159,41 +159,41 @@ namespace GUIEngine * irrLicht widget can not directly contain this state */ bool m_selected[MAX_PLAYER_COUNT]; - + /** * Whether to descend in the children of this widget when searching a widget * from its ID or name. (children classes can override this value as they please) */ bool m_check_inside_me; - + /** - * called when right key is pressed and focus is on widget. + * called when right key is pressed and focus is on widget. * Returns 'EVENT_LET' if user's event handler should be notified of a change. * Override in children to be notified of left/right events and/or make * the event propagate to the user's event handler. */ virtual EventPropagation rightPressed(const int playerID) { return EVENT_BLOCK; } - + /** - * called when left key is pressed and focus is on widget. + * called when left key is pressed and focus is on widget. * Returns 'EVENT_LET' if user's event handler should be notified of a change. * Override in children to be notified of left/right events and/or make * the event propagate to the user's event handler. */ virtual EventPropagation leftPressed (const int playerID) { return EVENT_BLOCK; } - + /** used when you set eventSupervisors - see m_event_handler explainations below called when one of a widget's children is hovered. \return 'EVENT_LET' if main event handler should be notified of a change, 'EVENT_BLOCK' otherwise */ virtual EventPropagation mouseHovered(Widget* child, const int playerID) { return EVENT_BLOCK; } - + /** override in children if you need to know when the widget is focused. * \return whether to block event */ virtual EventPropagation focused(const int playerID) { setWithinATextBox(false); return EVENT_LET; } - + /** override in children if you need to know when the widget is unfocused. */ virtual void unfocused(const int playerID, Widget* new_focus) { } - + /** * An irrlicht parent (most often used to put widgets in dialogs) */ @@ -203,13 +203,13 @@ namespace GUIEngine * IrrLicht widget created to represent this object. */ irr::gui::IGUIElement* m_element; - - + + /** numerical ID used by irrLicht to identify this widget * (not the same as the string identificator specified in the XML file) */ int m_id; - + /** Usually, only one widget at a time can be focused. There is however a special case where all players can move through the screen. This variable will then be used as a bitmask to contain which players beyong player 1 have this widget focused. */ @@ -220,7 +220,7 @@ namespace GUIEngine /** Type of this widget */ WidgetType m_type; - + /** * If this widget has any children, they go here. Children can be either * specified in the XML file (e.g. Ribbon or Div children), or can also @@ -228,27 +228,27 @@ namespace GUIEngine * one irrlicht widgets (e.g. Spinner) */ PtrVector m_children; - + /** A bitmask of which badges to show, if any; choices are *_BADGE, defined above */ int m_badges; - + /** A simple flag that can be raised to hide this widget */ bool m_deactivated; - + /** Set to false if widget is something that should not receive focus */ bool m_focusable; - + bool m_bottom_bar; bool m_top_bar; - + /** If a badge wouldn't look too pretty on the very side of the widget */ int m_badge_x_shift; - + bool m_has_tooltip; irr::core::stringw m_tooltip_text; - + public: - + /** * This is set to NULL by default; set to something else in a widget to mean * that events happening on this widget should also be passed to m_event_handler->transmitEvent, @@ -257,29 +257,29 @@ namespace GUIEngine * one irrlicht widgets (e.g. Spinner, Ribbon) */ Widget* m_event_handler; - + /** * Whether this widget supports multiplayer interaction (i.e. whether this widget can be * used by players other than by the game master) */ bool m_supports_multiplayer; - + /** Instead of searching for widget IDs smaller/greater than that of this object, navigation through widgets will start from these IDs (if they are set). */ int m_tab_down_root; - + /** Instead of searching for widget IDs smaller/greater than that of this object, navigation through widgets will start from these IDs (if they are set). */ int m_tab_up_root; - + /** Coordinates of the widget once added (the difference between those x/h and PROP_WIDTH/PROP_HEIGHT is that the props are read in raw form from the XML file; PROP_WIDTH can then be e.g. "10%" and w, once the widget is added, will be e.g. 80.) */ int m_x, m_y, m_w, m_h; - + /** Whether to show a bounding box around this widget (used for sections) */ bool m_show_bounding_box; - + /** Only used if m_show_bounding_box is true */ bool m_is_bounding_box_round; @@ -290,7 +290,7 @@ namespace GUIEngine 2) Theorically, in 'add()', derived widgets should checked if this value is set, and use it instead of creating a new ID if it is. In practice, it's not widely implemented (FIXME) */ int m_reserved_id; - + /** * A map that holds values for all specified widget properties (in the XML file) * @@ -300,16 +300,16 @@ namespace GUIEngine * \note Not all widgets use all properties, some widgets may ignore some properties. */ std::map m_properties; - + Widget(WidgetType type, bool reserve_id = false); virtual ~Widget(); - + /** * Set the irrlicht widget to be used as parent of this widget next time Widget::add() * is invoked on this widget. */ void setParent(irr::gui::IGUIElement* parent); - + /** * \brief Sets the widget (and its children, if any) visible or not. * Note that setting a widget invisible implicitely calls setDeactivated(), and setting @@ -320,19 +320,19 @@ namespace GUIEngine /** Returns if the element is visible. */ bool isVisible() const; - + /** * Call to resize/move the widget. Not all widgets can resize gracefully. */ virtual void move(const int x, const int y, const int w, const int h); - + /** * Get whether this widget is selected (only makes sense in some cases where * a widget is part of a bigger widget, e.g. in ribbons, and a selected item * is kept) */ bool isSelected(const int playerID) const { return m_selected[playerID]; } - + bool isBottomBar() const { return m_bottom_bar; } bool isTopBar () const { return m_top_bar; } @@ -340,23 +340,23 @@ namespace GUIEngine * \name Enabling or disabling widgets * \{ */ - + /** \brief undos setDeactivated() */ virtual void setActivated(); - + /** \brief greys out the widget, making it not clickable for the user */ virtual void setDeactivated(); - - + + /** * \} */ - + /** * \name Accessing the underlying irrlicht element * \{ */ - + /** * Get the underlying irrLicht GUI element, casted to the right type. */ @@ -387,7 +387,7 @@ namespace GUIEngine * Get the underlying irrLicht GUI element */ irr::gui::IGUIElement* getIrrlichtElement() { return m_element; } - + void moveIrrlichtElement(); bool isSameIrrlichtWidgetAs(const Widget* ref) const { return m_element == ref->m_element; } @@ -402,8 +402,8 @@ namespace GUIEngine * it will generally work to set the properties before add() is called, modifying * the widget after it was added will require other widget-specific calls. */ - - /** + + /** * Sets the text of a widget from a wchar_t. * Handy for many constant strings used in stk. * @@ -412,8 +412,8 @@ namespace GUIEngine * is add()ed */ virtual void setText(const wchar_t *s); - - /** + + /** * Sets the text of a widget from a stringw. * \note This method uses the virtual setText(wchar_t*) function, so only the latter * needs to be overwritten by other classes. @@ -425,10 +425,10 @@ namespace GUIEngine /** Returns the text of a widget. */ const irr::core::stringw &getText() const {return m_text; } - + /** \return Type of this widget */ WidgetType getType() const { return m_type; } - + /** * Get the irrlicht widget ID attributed to this widget * \pre Only call this method after the widget has been add()ed @@ -437,38 +437,38 @@ namespace GUIEngine /** Get whether this object is allowed to receive focus */ bool isFocusable() const { return m_focusable; } - + void setFocusable(bool f) { m_focusable = f; } - + /** * \} */ - + /** * \name Focus management * \{ */ - + /** * Focus the widget for the given player. * \param playerID ID of the player you want to set/unset focus for, starting from 0 */ void setFocusForPlayer(const int playerID); - + /** * Find whether this widget is focused by a given player. * \param playerID ID of the player you want to set/unset focus for, starting from 0 * \return whether this widget is focused by a given player. */ bool isFocusedForPlayer(const int playerID); - + /** Internal method, do not call it. Call the functions in GUIEngine instead to unset focus. */ void unsetFocusForPlayer(const int playerID); - + /** * \} */ - + /** * \name ID Counter Functions * Functions used to generate IDs for new widgets. The domain of each ID @@ -478,19 +478,19 @@ namespace GUIEngine * sequential with focusable widgets in order not to break keyboard navigation). * \{ */ - + static void resetIDCounters(); /** * \brief Provides a new unique ID on each call, for widgets that can be focused. */ static int getNewID(); - + /** * \brief Provides a new unique ID on each call, for widgets that can not be focused. */ static int getNewNoFocusID(); - + /** * \brief get whether the given ID represents an ID of a widget that can be focused * \return whether the given ID represents an ID of a widget that can be focused @@ -498,22 +498,22 @@ namespace GUIEngine * Widget::getNewNoFocusID()) */ static bool isFocusableId(const int id); - + /** * \} */ - + /** * \name Handling children * If this widget is a container and has children. * \{ */ - + /** * \return a read-only view of the childrens of this widget, if any */ const PtrVector& getChildren() const { return m_children; } - + PtrVector& getChildren() { return m_children; } /** @@ -527,65 +527,65 @@ namespace GUIEngine * \return whether deletion was successful */ bool deleteChild(const char* id); - + /** * \} */ - + /** * \{ * \name Callbacks for subclasses * Classes that subclass Widget to provide actual implementations may override/implement these * methods to change behaviour or be notified of some events. */ - + /** * \brief Override in children to possibly receive updates (you may need to register to * them first) */ virtual void update(float delta) { } - + /** All widgets, including their parents (m_event_handler) will be notified on event through this call. Must return whether main (GUI engine user) event callback should be notified or not. Note that in the case of a hierarchy of widgets (with m_event_handler), only the topmost widget of the chain decides whether the main handler is notified; return value is not read for others. */ - virtual EventPropagation transmitEvent(Widget* w, - const std::string& originator, - const int playerID) + virtual EventPropagation transmitEvent(Widget* w, + const std::string& originator, + const int playerID) { return EVENT_LET; } - + /** * \brief Create and add the irrLicht widget(s) associated with this object. * Call after Widget was read from XML file and laid out. */ virtual void add(); - + /** * \brief Called when irrLicht widgets cleared. Forget all references to them, they're no more valid. */ virtual void elementRemoved(); - + bool searchInsideMe() const { return m_check_inside_me; } /** When inferring widget size from its label length, this method will be called to * if/how much space must be added to the raw label's size for the widget to be large enough */ virtual int getWidthNeededAroundLabel() const { return 0; } - + /** When inferring widget size from its label length, this method will be called to * if/how much space must be added to the raw label's size for the widget to be large enough */ virtual int getHeightNeededAroundLabel() const { return 0; } - + /** * \} */ - + /** * \name Badge support * "Badges" are icons that can appear on top of some widgets. * \{ */ - - /** + + /** * \brief adds a particular badge to this widget. * The STK widget toolkit has support for "badges". Badges are icon overlays displayed * on the corner of a widget; they are useful to convey information visually. @@ -594,8 +594,8 @@ namespace GUIEngine { m_badges |= int(badge_bit); } - - /** + + /** * \brief removes a particular bade from this widget, if it had it. * \see GUIEngine::Widget::setBadge for more info on badge support */ @@ -603,7 +603,7 @@ namespace GUIEngine { m_badges &= (~int(badge_bit)); } - + /** \brief sets this widget to have no badge * \see GUIEngine::Widget::setBadge for more info on badge support */ @@ -611,7 +611,7 @@ namespace GUIEngine { m_badges = 0; } - + /** * \brief Get which badges are currently on this widget * \return a bitmask of BadgeType values @@ -620,31 +620,31 @@ namespace GUIEngine { return m_badges; } - + /** * \} */ - + /** * \name Tooltip support * \{ */ - - + + bool hasTooltip() const { return m_has_tooltip; } - + /** Only call if hasTooltip() returned true */ irr::core::stringw getTooltipText() const { return m_tooltip_text; } - + void setTooltip(irr::core::stringw s) { m_tooltip_text = s; m_has_tooltip = true; } - + /** * \} */ - + bool ok() const { return (m_magic_number == 0xCAFEC001); } }; - + } #endif diff --git a/src/input/binding.hpp b/src/input/binding.hpp index 8a099cc38..b687a7df7 100644 --- a/src/input/binding.hpp +++ b/src/input/binding.hpp @@ -48,8 +48,8 @@ public: Input::AxisDirection getDirection() const {return m_dir;} // ------------------------------------------------------------------------ /** Defines all values of this binding. */ - void set(Input::InputType type, int id, - Input::AxisDirection dir, + void set(Input::InputType type, int id, + Input::AxisDirection dir, wchar_t character) { m_type = type; m_id=id; m_dir=dir; m_character=character; diff --git a/src/input/device_manager.hpp b/src/input/device_manager.hpp index 2d80c3a21..b3b1baef2 100644 --- a/src/input/device_manager.hpp +++ b/src/input/device_manager.hpp @@ -81,7 +81,7 @@ private: /** Will be non-null in single-player mode */ StateManager::ActivePlayer* m_single_player; - + /** * Helper method, only used internally. Takes care of analyzing keyboard input. * @@ -93,7 +93,7 @@ private: InputDevice *mapKeyboardInput ( int btnID, InputManager::InputDriverMode mode, StateManager::ActivePlayer **player /* out */, PlayerAction *action /* out */); - /** If this is flag is set the next fire event (if the fire key is not + /** If this is flag is set the next fire event (if the fire key is not * mapped to anything else) will be mapped to 'select'. This is used * in the kart select GUI to support the old way of adding players by * pressing fire. */ @@ -106,7 +106,7 @@ public: DeviceManager(); - + // ---- Assign mode ---- PlayerAssignMode getAssignMode() const { return m_assign_mode; } void setAssignMode(const PlayerAssignMode assignMode); @@ -120,8 +120,8 @@ public: GamePadDevice* getGamePadFromIrrID(const int i); void clearGamepads() { m_gamepads.clearAndDeleteAll(); } /** Returns the keyboard that has a binding for this button, or NULL if none */ - bool getConfigForGamepad(const int sdl_id, const core::stringc& pname, GamepadConfig **config); - + bool getConfigForGamepad(const int sdl_id, const core::stringc& pname, GamepadConfig **config); + // ---- Keyboard(s) ---- void addEmptyKeyboard(); void addKeyboard(KeyboardDevice* d); @@ -137,9 +137,9 @@ public: * \brief Delete the given config and removes DeviceManager references to it. */ bool deleteConfig(DeviceConfig* config); - + /** Given some input, finds to which device it belongs and, using the corresponding device object, - * maps this input to the corresponding player and game action. + * maps this input to the corresponding player and game action. * * \return false if player/action could not be set. * \note Special case : can return 'true' but set action to PA_BEFORE_FIRST if the input was used but @@ -160,14 +160,14 @@ public: InputDevice* getLatestUsedDevice(); bool initialize(); void serialize(); - + StateManager::ActivePlayer* getSinglePlayer() { return m_single_player; } void setSinglePlayer(StateManager::ActivePlayer* p) { m_single_player = p; } // ------------------------------------------------------------------------ /** Sets or reset the 'map fire to select' option. */ void mapFireToSelect(bool v) {m_map_fire_to_select = v; } - + }; // DeviceManager diff --git a/src/input/input.hpp b/src/input/input.hpp index d6b1ce961..0426b9d00 100644 --- a/src/input/input.hpp +++ b/src/input/input.hpp @@ -40,10 +40,10 @@ const int MULTIPLIER_MOUSE = 750; struct Input { static const int MAX_VALUE = 32768; - + static const int HAT_H_ID = 100; static const int HAT_V_ID = 101; - + enum AxisDirection { AD_NEGATIVE, @@ -70,12 +70,12 @@ struct Input wchar_t m_character; Input() - : m_type(IT_NONE), m_device_id(0), m_button_id(0), + : m_type(IT_NONE), m_device_id(0), m_button_id(0), m_axis_direction(0), m_character(0) { // Nothing to do. } - + /** Creates an Input instance which represents an arbitrary way of getting * game input using a type specifier and 3 integers. * @@ -93,19 +93,19 @@ struct Input * IT_MOUSEMOTION: id0 - axis index (0 -> X, 1 -> Y). Mouse wheel is * represented as buttons! * IT_MOUSEBUTTON: id0 - button number (1 -> left, 2 -> middle, 3 -> right, - * ...) + * ...) * * Note: For joystick bindings that are actice in the menu the joystick's * index should be zero. The binding will react to all joysticks connected * to the system. */ - Input(InputType ntype, int deviceID , int btnID = 0, int axisDirection= 0) - : m_type(ntype), m_device_id(deviceID), m_button_id(btnID), + Input(InputType ntype, int deviceID , int btnID = 0, int axisDirection= 0) + : m_type(ntype), m_device_id(deviceID), m_button_id(btnID), m_axis_direction(axisDirection) { // Nothing to do. } - + }; // struct Input /** @@ -115,7 +115,7 @@ struct Input enum PlayerAction { PA_BEFORE_FIRST = -1, - + PA_STEER_LEFT = 0, PA_STEER_RIGHT, PA_ACCEL, @@ -126,14 +126,14 @@ enum PlayerAction PA_FIRE, PA_LOOK_BACK, PA_PAUSE_RACE, - + PA_MENU_UP, PA_MENU_DOWN, PA_MENU_LEFT, PA_MENU_RIGHT, PA_MENU_SELECT, PA_MENU_CANCEL, - + PA_COUNT }; @@ -146,7 +146,7 @@ const PlayerAction PA_LAST_MENU_ACTION = PA_MENU_CANCEL; * \brief human-readable strings for each PlayerAction * \ingroup input */ -static std::string KartActionStrings[PA_COUNT] = {std::string("steerLeft"), +static std::string KartActionStrings[PA_COUNT] = {std::string("steerLeft"), std::string("steerRight"), std::string("accel"), std::string("brake"), diff --git a/src/input/input_device.hpp b/src/input/input_device.hpp index 20fec5ed8..7a175a835 100644 --- a/src/input/input_device.hpp +++ b/src/input/input_device.hpp @@ -31,16 +31,16 @@ protected: DeviceConfig* m_configuration; public: - /** If device has a name; unused for keyboards since AFAIK we + /** If device has a name; unused for keyboards since AFAIK we * can't tell keyboards apart. */ std::string m_name; - + InputDevice(); void setConfiguration(DeviceConfig *config) {m_configuration = config;} DeviceConfig *getConfiguration() {return m_configuration;} DeviceType getType() const { return m_type; }; - + void setPlayer(StateManager::ActivePlayer* owner); StateManager::ActivePlayer *getPlayer() { return m_player; } }; @@ -53,23 +53,23 @@ class KeyboardDevice : public InputDevice { public: - + KeyboardDevice(); KeyboardDevice(KeyboardConfig *configuration); - + /** - * Checks if this key belongs to this device. if yes, sets action and + * Checks if this key belongs to this device. if yes, sets action and * returns true; otherwise returns false * - * \param id ID of the key that was pressed - * \param mode Used to determine whether to bind menu actions or + * \param id ID of the key that was pressed + * \param mode Used to determine whether to bind menu actions or * game actions - * \param[out] action The action associated to this input (only check + * \param[out] action The action associated to this input (only check * this value if method returned true) */ bool processAndMapInput(const int id, InputManager::InputDriverMode mode, PlayerAction* action); - + }; /** @@ -78,60 +78,60 @@ public: */ class GamePadDevice : public InputDevice { - void resetAxisDirection(const int axis, Input::AxisDirection direction, + void resetAxisDirection(const int axis, Input::AxisDirection direction, StateManager::ActivePlayer* player); bool m_buttonPressed[SEvent::SJoystickEvent::NUMBER_OF_BUTTONS]; public: Input::AxisDirection *m_prevAxisDirections; - - /** used to determine if an axis is valid; an axis is considered valid - * when at least 2 different values are read from this axis (if an axis - * keeps on sending the exact same value continuously, chances are that - * it's not meant by the user - for instance some gamepads have hats or + + /** used to determine if an axis is valid; an axis is considered valid + * when at least 2 different values are read from this axis (if an axis + * keeps on sending the exact same value continuously, chances are that + * it's not meant by the user - for instance some gamepads have hats or * analog switches that get reported as axis, we even had a report that - * on linux some hard disks may be reported as gamepads with + * on linux some hard disks may be reported as gamepads with * uninteresting axis values) */ int *m_prevAxisValue; /** \see m_prevAxisValue */ bool *m_axis_ok; - + int m_deadzone; int m_index; int m_axis_count; int m_button_count; - - /** Constructor for GamePadDevice from a connected gamepad for which no + + /** Constructor for GamePadDevice from a connected gamepad for which no * configuration existed (defaults will be used) * \param irrIndex Index of stick as given by irrLicht. */ - GamePadDevice(const int irrIndex, const std::string name, + GamePadDevice(const int irrIndex, const std::string name, const int axis_number, const int btnAmount, GamepadConfig *configuration); ~GamePadDevice(); - + bool isButtonPressed(const int i); void setButtonPressed(const int i, bool isButtonPressed); - + /** - * Invoked when this device it used. Verifies if the key/button that - * was pressed is associated with a binding. If yes, sets action and + * Invoked when this device it used. Verifies if the key/button that + * was pressed is associated with a binding. If yes, sets action and * returns true; otherwise returns false. * - * \param player Only passed to know where to send 'axis reset's + * \param player Only passed to know where to send 'axis reset's * when necessary - * \param id ID of the key that was pressed or of the axis + * \param id ID of the key that was pressed or of the axis * that was triggered (depending on * the value of the 'type' parameter) - * \param mode Used to determine whether to map menu actions or + * \param mode Used to determine whether to map menu actions or * game actions - * \param[out] action The action associated to this input (only check + * \param[out] action The action associated to this input (only check * this value if method returned true) * * \return Whether the pressed key/button is bound with an action */ - bool processAndMapInput(Input::InputType type, const int id, + bool processAndMapInput(Input::InputType type, const int id, const int value, InputManager::InputDriverMode mode, StateManager::ActivePlayer* player, diff --git a/src/input/input_manager.hpp b/src/input/input_manager.hpp index 28d8f5feb..d5652f861 100644 --- a/src/input/input_manager.hpp +++ b/src/input/input_manager.hpp @@ -29,8 +29,8 @@ class DeviceManager; -/** - * \brief Class to handle input. +/** + * \brief Class to handle input. * \ingroup input */ class InputManager: public NoCopy @@ -51,7 +51,7 @@ public: // to put a delay before a new gamepad axis move is considered in menu bool m_timer_in_use; float m_timer; - + private: DeviceManager *m_device_manager; @@ -59,16 +59,16 @@ private: std::set m_sensed_input_high_kbd; InputDriverMode m_mode; - + /** When at true, only the master player can play with menus */ bool m_master_player_only; - + /* Helper values to store and track the relative mouse movements. If these * values exceed the deadzone value the input is reported to the game. This * makes the mouse behave like an analog axis on a gamepad/joystick. */ int m_mouse_val_x, m_mouse_val_y; - + void dispatchInput(Input::InputType, int deviceID, int btnID, Input::AxisDirection direction, int value); void handleStaticAction(int id0, int value); void inputSensing(Input::InputType type, int deviceID, int btnID, Input::AxisDirection axisDirection, int value); @@ -76,24 +76,24 @@ public: InputManager(); ~InputManager(); // void initGamePadDevices(); - + //void input(); GUIEngine::EventPropagation input(const irr::SEvent& event); - + DeviceManager* getDeviceList() { return m_device_manager; } - - void setMode(InputDriverMode); + + void setMode(InputDriverMode); bool isInMode(InputDriverMode); - InputDriverMode getMode() { return m_mode; } - + InputDriverMode getMode() { return m_mode; } + /** When this mode is enabled, only the master player will be able to play with menus (only works in 'assign' mode) */ void setMasterPlayerOnly(bool enabled); - + /** Returns whether only the master player should be allowed to perform changes in menus */ bool masterPlayerOnly() const; - + void update(float dt); - + /** Returns the ID of the player that plays with the keyboard, or -1 if none */ int getPlayerKeyboardID() const; }; diff --git a/src/input/wiimote.hpp b/src/input/wiimote.hpp index d44ec7214..1eae85de9 100644 --- a/src/input/wiimote.hpp +++ b/src/input/wiimote.hpp @@ -39,25 +39,25 @@ private: /** Handle to the corresponding WiiUse wiimote handle */ wiimote_t* m_wiimote_handle; - + /** Index of this element the arrays of wiimotes */ int m_wiimote_id; - + /** Corresponding gamepad managed by the DeviceManager */ GamePadDevice* m_gamepad_device; - + /** Corresponding Irrlicht gamepad event */ Synchronised m_irr_event; - + /** Whether the wiimote received a "disconnected" event */ bool m_connected; - + void resetIrrEvent(); void printDebugInfo() const; public: /** Resets internal state and creates the corresponding gamepad device */ - Wiimote(wiimote_t* wiimote_handle, int wiimote_id, + Wiimote(wiimote_t* wiimote_handle, int wiimote_id, GamepadConfig* gamepad_config); ~Wiimote(); diff --git a/src/input/wiimote_manager.hpp b/src/input/wiimote_manager.hpp index e8d8f080c..75dd7c3d3 100644 --- a/src/input/wiimote_manager.hpp +++ b/src/input/wiimote_manager.hpp @@ -47,18 +47,18 @@ class WiimoteManager private: /** List of all connected wiimotes. */ std::vector m_wiimotes; - + /** WiiUse wiimote handles */ wiimote_t** m_all_wiimote_handles; int m_number_wiimotes; - + // While the wiimote code can technically work without threading, // its too slow (high latency), but it is useful for debugging. #define WIIMOTE_THREADING #ifdef WIIMOTE_THREADING /** Wiimote state update thread */ pthread_t m_thread; - + /** Shut the update thread? */ bool m_shut; #endif @@ -74,19 +74,19 @@ private: public: WiimoteManager(); ~WiimoteManager(); - + /** Sets the wiimote to be enabled. */ static void enable() { m_enabled = true; } /** Returns if the wii was enabled on the command line. */ static bool isEnabled() { return m_enabled; } - + void launchDetection(int timeout); void update(); void cleanup(); void enableAccelerometer(bool state); - + /** A simple listener to allow the user to connect wiimotes. It * will display a feedback windows (# wiimotes connected or 'no wiimotes * found'). @@ -104,7 +104,7 @@ public: // ------------------------------------------------------------------------ /** Returns the number of wiimotes connected. */ unsigned int getNumberOfWiimotes() const {return m_wiimotes.size();} - + }; // class WiimoteManager diff --git a/src/io/file_manager.hpp b/src/io/file_manager.hpp index 79a8379a8..132f7c17d 100644 --- a/src/io/file_manager.hpp +++ b/src/io/file_manager.hpp @@ -58,7 +58,7 @@ private: /** Directory to store screenshots in. */ std::string m_screenshot_dir; - std::vector + std::vector m_texture_search_path, m_model_search_path, m_music_search_path; @@ -131,7 +131,7 @@ public: */ void pushMusicSearchPath(const std::string& path) { - m_music_search_path.push_back(path); + m_music_search_path.push_back(path); } // pushMusicSearchPath // ------------------------------------------------------------------------ /** Removes the last added directory from the music search path. @@ -141,8 +141,8 @@ public: /** Returns true if the specified file exists. */ bool fileExists(const std::string& path) - { - return m_file_system->existFile(path.c_str()); + { + return m_file_system->existFile(path.c_str()); } // fileExists }; // FileManager diff --git a/src/io/xml_node.hpp b/src/io/xml_node.hpp index 5a2cd0eaf..0e8642d69 100644 --- a/src/io/xml_node.hpp +++ b/src/io/xml_node.hpp @@ -60,20 +60,20 @@ private: std::map m_attributes; /** List of all sub nodes. */ std::vector m_nodes; - + void readXML(io::IXMLReader *xml); - + std::string m_file_name; - + public: LEAK_CHECK(); XMLNode(io::IXMLReader *xml); - + /** \throw runtime_error if the file is not found */ XMLNode(const std::string &filename); - + ~XMLNode(); - + const std::string &getName() const {return m_name; } const XMLNode *getNode(const std::string &name) const; const void getNodes(const std::string &s, std::vector& out) const; @@ -100,9 +100,9 @@ public: int getXYZ(Vec3 *vaslue) const; int getHPR(core::vector3df *value) const; int getHPR(Vec3 *value) const; - + bool hasChildNamed(const char* name) const; - + /** Handy functions to test the bit pattern returned by get(vector3df*).*/ static bool hasX(int b) { return (b&1)==1; } static bool hasY(int b) { return (b&2)==2; } diff --git a/src/io/xml_writer.hpp b/src/io/xml_writer.hpp index 418d54ffa..474c8791f 100644 --- a/src/io/xml_writer.hpp +++ b/src/io/xml_writer.hpp @@ -32,12 +32,12 @@ class XMLWriter { std::ofstream m_base; public: - + XMLWriter(const char* dest); - + XMLWriter& operator<< (const irr::core::stringw& txt); XMLWriter& operator<< (const wchar_t* txt); - + template XMLWriter& operator<< (const T t) { @@ -46,9 +46,9 @@ public: (*this) << tmp; return *this; } - + void close(); - + bool is_open() { return m_base.is_open(); } }; diff --git a/src/items/attachment.hpp b/src/items/attachment.hpp index d5a9069b7..5db73d08e 100644 --- a/src/items/attachment.hpp +++ b/src/items/attachment.hpp @@ -31,13 +31,13 @@ class AbstractKart; class Item; class SFXBase; -/** This objects is permanently available in a kart and stores information +/** This objects is permanently available in a kart and stores information * about addons. If a kart has no attachment, this object will have the * attachment type ATTACH_NOTHING. This way other tests for attachment * in STK do not have to additionally test if there is an attachment, all * tests for a type will always be valid. * Certain attachments need additional coding, this is supported by - * a 'plugin' mechanism: This attachment will forward certain calls to + * a 'plugin' mechanism: This attachment will forward certain calls to * (see attachment_pluging abstract class). Compared to normal subclassing * (i.e. replacing the attachment object each time an attachment changes) * this has less overhead (since the attachment class always creates @@ -78,7 +78,7 @@ private: /** Scene node of the attachment, which will be attached to the kart's * scene node. */ - scene::IAnimatedMeshSceneNode + scene::IAnimatedMeshSceneNode *m_node; /** Used by bombs so that it's not passed back to previous owner. */ @@ -90,7 +90,7 @@ private: /** Pseudo random number generator. */ RandomGenerator m_random; - + /** Ticking sound for the bomb */ SFXBase *m_bomb_sound; @@ -101,7 +101,7 @@ public: void hitBanana(Item *item, int new_attachment=-1); void update (float dt); void handleCollisionWithKart(AbstractKart *other); - void set (AttachmentType type, float time, + void set (AttachmentType type, float time, AbstractKart *previous_kart=NULL); // ------------------------------------------------------------------------ @@ -122,7 +122,7 @@ public: AbstractKart* getPreviousOwner() const { return m_previous_owner; } // ------------------------------------------------------------------------ /** Returns additional weight for the kart. */ - float weightAdjust() const { + float weightAdjust() const { return m_type==ATTACH_ANVIL ? stk_config->m_anvil_weight : 0.0f; } // ------------------------------------------------------------------------ /** Return the currently associated scene node (used by e.g the swatter) */ diff --git a/src/items/attachment_manager.hpp b/src/items/attachment_manager.hpp index a42705175..fbb41c19f 100644 --- a/src/items/attachment_manager.hpp +++ b/src/items/attachment_manager.hpp @@ -38,16 +38,16 @@ private: Material *m_all_icons [Attachment::ATTACH_MAX]; public: AttachmentManager() {}; - ~AttachmentManager(); + ~AttachmentManager(); void removeTextures (); void loadModels (); // ------------------------------------------------------------------------ /** Returns the mest for a certain attachment. * \param type Type of the attachment needed. */ - scene::IAnimatedMesh *getMesh(Attachment::AttachmentType type) const + scene::IAnimatedMesh *getMesh(Attachment::AttachmentType type) const {return m_attachments[type]; } // ------------------------------------------------------------------------ - /** Returns the icon to display in the race gui if a kart + /** Returns the icon to display in the race gui if a kart * has an attachment. */ const Material* getIcon (int type) const {return m_all_icons [type]; } // ------------------------------------------------------------------------ diff --git a/src/items/attachment_plugin.hpp b/src/items/attachment_plugin.hpp index 0d41ea388..cb006ceb2 100644 --- a/src/items/attachment_plugin.hpp +++ b/src/items/attachment_plugin.hpp @@ -29,31 +29,31 @@ class Attachment; * This is the base class for a plugin into an attachment. Plugins are * used to handle attachment specific data so that the attachment class * that is used in every kart isn't overloaded. It could be done by - * inheriting from Attachment, but then every time an attachment is + * inheriting from Attachment, but then every time an attachment is * changed, we could delete and create a new SceneNode. To avoid this * overhead, we use plugins to encapsulate additional code for some * plugins. */ class AttachmentPlugin { -protected: +protected: /** Kart the attachment is attached to. */ AbstractKart *m_kart; public: /** Constructor for a plugin. */ - AttachmentPlugin(AbstractKart *kart) + AttachmentPlugin(AbstractKart *kart) { m_kart = kart; } - + virtual ~AttachmentPlugin() {} - + // ------------------------------------------------------------------------ /** Updates a plugin. This is called once each time frame. If the * function returns true, the attachment is discarded. */ virtual bool updateAndTestFinished(float dt) = 0; - + // ------------------------------------------------------------------------ /** Called when the animation of the Attachment's node is done. */ virtual void onAnimationEnd() {} diff --git a/src/items/bowling.hpp b/src/items/bowling.hpp index c89e09553..9841ee0f7 100644 --- a/src/items/bowling.hpp +++ b/src/items/bowling.hpp @@ -39,7 +39,7 @@ private: static float m_st_max_distance; // maximum distance for a bowling ball to be attracted static float m_st_max_distance_squared; static float m_st_force_to_target; - + /** If a bowling ball has hit something, this flag is set to indicate * if a kart was hit or not. The sound effect is only played if a * kart was hit. */ @@ -53,7 +53,7 @@ public: virtual bool hit(AbstractKart* kart, PhysicalObject* obj=NULL); virtual HitEffect *getHitEffect() const; - + }; // Bowling #endif diff --git a/src/items/cake.hpp b/src/items/cake.hpp index fc4dba641..111a74cb8 100644 --- a/src/items/cake.hpp +++ b/src/items/cake.hpp @@ -49,19 +49,19 @@ private: public: Cake (AbstractKart *kart); static void init (const XMLNode &node, scene::IMesh *cake_model); - virtual const core::stringw + virtual const core::stringw getHitString(const AbstractKart *kart) const; virtual bool hit(AbstractKart* kart, PhysicalObject* obj=NULL); // ------------------------------------------------------------------------ virtual void hitTrack () { hit(NULL); } // ------------------------------------------------------------------------ - /** Kinematic objects are not allowed to have a velocity (assertion in - * bullet), so we have to do our own velocity handling here. This + /** Kinematic objects are not allowed to have a velocity (assertion in + * bullet), so we have to do our own velocity handling here. This * function returns the velocity of this object. */ virtual const btVector3 &getVelocity() const {return m_initial_velocity;} // ------------------------------------------------------------------------ - /** Kinematic objects are not allowed to have a velocity (assertion in - * bullet), so we have to do our own velocity handling here. This + /** Kinematic objects are not allowed to have a velocity (assertion in + * bullet), so we have to do our own velocity handling here. This * function sets the velocity of this object. * \param v Linear velocity of this object. */ diff --git a/src/items/flyable.hpp b/src/items/flyable.hpp index a204f8238..bfd46835f 100644 --- a/src/items/flyable.hpp +++ b/src/items/flyable.hpp @@ -59,7 +59,7 @@ private: /** An offset that is added when doing the raycast for terrain. This * is useful in case that the position of the object is just under - * the terrain (perhaps due to floating point errors), and would + * the terrain (perhaps due to floating point errors), and would * otherwise result in an invalid terrain. */ Vec3 m_position_offset; @@ -74,8 +74,8 @@ protected: AbstractKart* m_owner; /** Type of the powerup. */ - PowerupManager::PowerupType - m_type; + PowerupManager::PowerupType + m_type; /** Collision shape of this Flyable. */ btCollisionShape *m_shape; @@ -124,25 +124,25 @@ protected: /** Size of the model. */ static Vec3 m_st_extend[PowerupManager::POWERUP_MAX]; - /** Time since thrown. used so a kart can't hit himself when trying + /** Time since thrown. used so a kart can't hit himself when trying * something, and also to put some time limit to some collectibles */ float m_time_since_thrown; - /** Set to something > -1 if this flyable should auto-destrcut after + /** Set to something > -1 if this flyable should auto-destrcut after * a while. */ float m_max_lifespan; - /** If set to true, the kart that throwns this flyable can't collide + /** If set to true, the kart that throwns this flyable can't collide * with it for a short time. */ bool m_owner_has_temporary_immunity; - void getClosestKart(const AbstractKart **minKart, + void getClosestKart(const AbstractKart **minKart, float *minDistSquared, - Vec3 *minDelta, + Vec3 *minDelta, const AbstractKart* inFrontOf=NULL, const bool backwards=false) const; - void getLinearKartItemIntersection(const Vec3 &origin, + void getLinearKartItemIntersection(const Vec3 &origin, const AbstractKart *target_kart, float item_XY_velocity, float gravity, float forw_offset, @@ -152,15 +152,15 @@ protected: /** init bullet for moving objects like projectiles */ void createPhysics(float y_offset, const Vec3 &velocity, - btCollisionShape *shape, + btCollisionShape *shape, float restitution, const float gravity=0.0f, - const bool rotates=false, + const bool rotates=false, const bool turn_around=false, const btTransform* customDirection=NULL); public: - Flyable (AbstractKart* kart, + Flyable (AbstractKart* kart, PowerupManager::PowerupType type, float mass=1.0f); virtual ~Flyable (); @@ -175,7 +175,7 @@ public: void explode(AbstractKart* kart, PhysicalObject* obj=NULL, bool secondary_hits=true); // ------------------------------------------------------------------------ - /** If true the up velocity of the flyable will be adjust so that the + /** If true the up velocity of the flyable will be adjust so that the * flyable stays at a height close to the average height. * \param f True if the up velocity should be adjusted. */ void setAdjustUpVelocity(bool f) { m_adjust_up_velocity = f; } diff --git a/src/items/item.hpp b/src/items/item.hpp index 7ce352796..c61d57dcf 100644 --- a/src/items/item.hpp +++ b/src/items/item.hpp @@ -98,7 +98,7 @@ private: /** Stores the original rotation of an item. This is used in * case of a switch to restore the rotation of a bubble gum * (bubble gums don't rotate, but it will be replaced with - * a nitro which rotates, and so overwrites the original + * a nitro which rotates, and so overwrites the original * rotation). */ Vec3 m_original_hpr; @@ -115,7 +115,7 @@ private: scene::IMesh *m_original_mesh; scene::IMesh *m_original_lowmesh; - /** The original position - saves calls to m_node->getPosition() + /** The original position - saves calls to m_node->getPosition() * and then converting this value to a Vec3. */ Vec3 m_xyz; @@ -123,28 +123,28 @@ private: unsigned int m_item_id; /** Set to false if item should not rotate. */ - bool m_rotate; - - /** Optionally set this if this item was laid by a particular kart. in - * this case the 'm_deactive_time' will also be set - see below. */ + bool m_rotate; + + /** Optionally set this if this item was laid by a particular kart. in + * this case the 'm_deactive_time' will also be set - see below. */ const AbstractKart *m_event_handler; /** Kart that emitted this item if any */ const AbstractKart *m_emitter; - - /** Optionally if item was placed by a kart, a timer can be used to + + /** Optionally if item was placed by a kart, a timer can be used to * temporarly deactivate collision so a kart is not hit by its own item */ float m_deactive_time; - /** Counts how often an item is used before it disappears. Used for + /** Counts how often an item is used before it disappears. Used for * bubble gum to make them disappear after a while. A value >0 * indicates that the item still exists, =0 that the item can be * deleted, and <0 that the item will never be deleted. */ int m_disappear_counter; - + /** callback used if type == ITEM_TRIGGER */ TriggerItemListener* m_listener; - + /** square distance at which item is collected */ float m_distance_2; @@ -155,8 +155,8 @@ private: * >0 if it is to the right of the center, and undefined if this quad * is not on any quad. */ float m_distance_from_center; - - /** The closest point to the left and right of this item at which it + + /** The closest point to the left and right of this item at which it * would not be collected. Used by the AI to avoid items. */ Vec3 *m_avoidance_points[2]; @@ -167,7 +167,7 @@ private: public: Item(ItemType type, const Vec3& xyz, const Vec3& normal, scene::IMesh* mesh, scene::IMesh* lowres_mesh); - Item(const Vec3& xyz, float distance, + Item(const Vec3& xyz, float distance, TriggerItemListener* trigger); virtual ~Item (); void update (float delta); @@ -176,13 +176,13 @@ public: void reset(); void switchTo(ItemType type, scene::IMesh *mesh, scene::IMesh *lowmesh); void switchBack(); - + const AbstractKart* getEmitter() const { return m_emitter; } - - + + // ------------------------------------------------------------------------ - /** Returns true if the Kart is close enough to hit this item, the item is - * not deactivated anymore, and it wasn't placed by this kart (this is + /** Returns true if the Kart is close enough to hit this item, the item is + * not deactivated anymore, and it wasn't placed by this kart (this is * e.g. used to avoid that a kart hits a bubble gum it just dropped). * \param kart Kart to test. * \param xyz Location of kart (avoiding to use kart->getXYZ() so that @@ -196,19 +196,19 @@ public: private: // ------------------------------------------------------------------------ - /** Returns true if the Kart is close enough to hit this item, the item is - * not deactivated anymore, and it wasn't placed by this kart (this is + /** Returns true if the Kart is close enough to hit this item, the item is + * not deactivated anymore, and it wasn't placed by this kart (this is * e.g. used to avoid that a kart hits a bubble gum it just dropped). * This function only uses the 2d coordinates, and it used by the AI only. * \param kart Kart to test. * \param xyz Location of kart (avoiding to use kart->getXYZ() so that * kart.hpp does not need to be included here). */ - bool hitKart (const core::vector2df &xyz, + bool hitKart (const core::vector2df &xyz, const AbstractKart *kart=NULL) const { if(m_event_handler==kart && m_deactive_time >0) return false; - float d2 = (m_xyz.getX()-xyz.X)*(m_xyz.getX()-xyz.X) + float d2 = (m_xyz.getX()-xyz.X)*(m_xyz.getX()-xyz.X) + (m_xyz.getZ()-xyz.Y)*(m_xyz.getZ()-xyz.Y); return d2 < m_distance_2; } // hitKart @@ -222,7 +222,7 @@ protected: * \param line The line segment which is tested if it is close enough * to this item so that this item would be collected. */ - bool hitLine(const core::line2df &line, + bool hitLine(const core::line2df &line, const AbstractKart *kart=NULL) const { if(m_event_handler==kart && m_deactive_time >0) return false; @@ -243,7 +243,7 @@ public: ItemType getType() const { return m_type; } // ------------------------------------------------------------------------ /** Returns true if this item is currently collected. */ - bool wasCollected() const { return m_collected;} + bool wasCollected() const { return m_collected;} // ------------------------------------------------------------------------ /** Returns true if this item is used up and can be removed. */ bool isUsedUp() const {return m_disappear_counter==0; } @@ -257,8 +257,8 @@ public: * hits a banana: by the time the explosion animation is ended and the * kart is back at its original position, the banana would be back again * and therefore hit the kart again. See Attachment::hitBanana for more - * details. - * \param f Time till the item can be used again. + * details. + * \param f Time till the item can be used again. */ void setDisableTime(float f) { m_time_till_return = f; } // ------------------------------------------------------------------------ @@ -271,13 +271,13 @@ public: /** Returns the index of the graph node this item is on. */ int getGraphNode() const { return m_graph_node; } // ------------------------------------------------------------------------ - /** Returns the distance from center: negative means left of center, + /** Returns the distance from center: negative means left of center, * positive means right of center. */ float getDistanceFromCenter() const { return m_distance_from_center; } // ------------------------------------------------------------------------ /** Returns a point to the left or right of the item which will not trigger * a collection of this item. - * \param left If true, return a point to the left, else a point to + * \param left If true, return a point to the left, else a point to * the right. */ const Vec3 *getAvoidancePoint(bool left) const { diff --git a/src/items/item_manager.hpp b/src/items/item_manager.hpp index e357ee2a8..90ba4e36c 100644 --- a/src/items/item_manager.hpp +++ b/src/items/item_manager.hpp @@ -39,7 +39,7 @@ class ItemManager : public NoCopy private: /** Stores all item models. */ static std::vector m_item_mesh; - + /** Stores all low-resolution item models. */ static std::vector m_item_lowres_mesh; @@ -58,11 +58,11 @@ public: // ------------------------------------------------------------------------ /** Return an instance of the item manager (it does not automatically * create one, call create for that). */ - static ItemManager *get() { - assert(m_item_manager); + static ItemManager *get() { + assert(m_item_manager); return m_item_manager; } // get - + // ======================================================================== private: /** The vector of all items of the current track. */ @@ -70,7 +70,7 @@ private: AllItemTypes m_all_items; /** Stores which items are on which quad. m_items_in_quads[#quads] - * contains all items that are not on a quad. Note that this + * contains all items that are not on a quad. Note that this * field is undefined if no QuadGraph exist, e.g. in battle mode. */ std::vector< AllItemTypes > *m_items_in_quads; @@ -90,10 +90,10 @@ private: void setSwitchItems(const std::vector &switch_items); public: - Item* newItem (Item::ItemType type, const Vec3& xyz, - const Vec3 &normal, + Item* newItem (Item::ItemType type, const Vec3& xyz, + const Vec3 &normal, AbstractKart* parent=NULL); - Item* newItem (const Vec3& xyz, float distance, + Item* newItem (const Vec3& xyz, float distance, TriggerItemListener* listener); void update (float delta); void checkItemHit (AbstractKart* kart); @@ -113,7 +113,7 @@ public: // ------------------------------------------------------------------------ /** Returns a reference to the array of all items on the specified quad. */ - const AllItemTypes& getItemsInQuads(unsigned int n) const + const AllItemTypes& getItemsInQuads(unsigned int n) const { assert(m_items_in_quads); assert(n<(*m_items_in_quads).size()); diff --git a/src/items/plunger.hpp b/src/items/plunger.hpp index 15eea4ddb..951a1eef1 100644 --- a/src/items/plunger.hpp +++ b/src/items/plunger.hpp @@ -56,7 +56,7 @@ public: // ------------------------------------------------------------------------ /** Sets the keep-alive value. Setting it to 0 will remove the plunger - * at the next update - which is used if the rubber band snaps. + * at the next update - which is used if the rubber band snaps. */ void setKeepAlive(float t) {m_keep_alive = t;} // ------------------------------------------------------------------------ diff --git a/src/items/powerup.hpp b/src/items/powerup.hpp index ebae115ed..973f41185 100644 --- a/src/items/powerup.hpp +++ b/src/items/powerup.hpp @@ -63,7 +63,7 @@ public: int getNum () const {return m_number;} // ------------------------------------------------------------------------ /** Returns the type of this powerup. */ - PowerupManager::PowerupType + PowerupManager::PowerupType getType () const {return m_type; } // ------------------------------------------------------------------------ }; diff --git a/src/items/powerup_manager.hpp b/src/items/powerup_manager.hpp index 95f7a02ef..096b6a6a1 100644 --- a/src/items/powerup_manager.hpp +++ b/src/items/powerup_manager.hpp @@ -41,7 +41,7 @@ class XMLNode; /** This class manages all powerups. It reads in powerup.xml to get the data, * initialise the static member of some flyables (i.e. powerup.xml contains * info about cakes, plunger etc which needs to be stored), and maintains - * the 'weights' (used in randomly chosing which item was collected) for all + * the 'weights' (used in randomly chosing which item was collected) for all * items depending on position. The latter is done so that as the first player * you get less advantageous items (but no useless ones either, e.g. anchor), * while as the last you get more useful ones. @@ -49,14 +49,14 @@ class XMLNode; * The position in a race is mapped to one of five position classes: * first, top, middle, bottom, last - e.g. for a 6 player game the distribution * is: - * position 1 2 3 4 5 6 + * position 1 2 3 4 5 6 * class first top middle middle bottom last * For each class the weight distribution is read in from powerup.xml: * * * So a (well, in this case 'the') player belonging to the class 'last' * will not get a bubble gum or switch. Cakes and bowling balls have - * lower probability. + * lower probability. * At the start of each race two mappings are computed in updateWeightsForRace: * m_position_to_class maps each postion to the class using the function * convertPositionToClass. @@ -74,12 +74,12 @@ public: // The anvil and parachute must be at the end of the enum, and the // zipper just before them (see Powerup::hitBonusBox). enum PowerupType {POWERUP_NOTHING, - POWERUP_FIRST, - POWERUP_BUBBLEGUM = POWERUP_FIRST, + POWERUP_FIRST, + POWERUP_BUBBLEGUM = POWERUP_FIRST, POWERUP_CAKE, POWERUP_BOWLING, POWERUP_ZIPPER, POWERUP_PLUNGER, POWERUP_SWITCH, POWERUP_SWATTER, POWERUP_RUBBERBALL, - POWERUP_PARACHUTE, + POWERUP_PARACHUTE, POWERUP_ANVIL, //powerup.cpp assumes these two come last POWERUP_LAST=POWERUP_ANVIL, POWERUP_MAX @@ -88,7 +88,7 @@ public: /** The different position classes, used to map a kart's position to a * weight distribution for the different powerups. The battle mode is * listed as a separate 'position' - this way the same implementation - * as used for normal racing can be used to define which items are + * as used for normal racing can be used to define which items are * available in battle mode*/ enum PositionClass {POSITION_FIRST, POSITION_TOP33, @@ -139,10 +139,10 @@ private: PowerupType getPowerupType(const std::string &name) const; - void loadWeights(const XMLNode &root, + void loadWeights(const XMLNode &root, const std::string &class_name, PositionClass position_class); - PositionClass convertPositionToClass(unsigned int num_karts, + PositionClass convertPositionToClass(unsigned int num_karts, unsigned int position); public: PowerupManager (); @@ -152,19 +152,19 @@ public: void LoadPowerup (PowerupType type, const XMLNode &node); void updateWeightsForRace(unsigned int num_karts); Material* getIcon (int type) const {return m_all_icons [type];} - PowerupManager::PowerupType + PowerupManager::PowerupType getRandomPowerup(unsigned int pos, unsigned int *n); - /** Returns the mesh for a certain powerup. + /** Returns the mesh for a certain powerup. * \param type Mesh type for which the model is returned. */ - irr::scene::IMesh + irr::scene::IMesh *getMesh (int type) const {return m_all_meshes[type];} float getForceToTarget(int type) const {return m_all_force_to_target[type];} float getMaxDistance (int type) const {return m_all_max_distance[type];} float getMaxTurnAngle (int type) const {return m_all_max_turn_angle[type];} - const btVector3& + const btVector3& getExtend (int type) const {return m_all_extends[type];} float getBallCollectTime() const {return m_rubber_ball_collect_time;} - void setBallCollectTime(float time) {m_rubber_ball_collect_time=time;} + void setBallCollectTime(float time) {m_rubber_ball_collect_time=time;} }; diff --git a/src/items/projectile_manager.hpp b/src/items/projectile_manager.hpp index 7d192b000..f0906ca6b 100644 --- a/src/items/projectile_manager.hpp +++ b/src/items/projectile_manager.hpp @@ -45,7 +45,7 @@ private: typedef std::vector Projectiles; typedef std::vector HitEffects; - /** The list of all active projectiles, i.e. projectiles which are + /** The list of all active projectiles, i.e. projectiles which are * currently moving on the track. */ Projectiles m_active_projectiles; @@ -66,9 +66,9 @@ public: void Deactivate (Flyable *p) {} void removeTextures (); // ------------------------------------------------------------------------ - /** Adds a special hit effect to be shown. + /** Adds a special hit effect to be shown. * \param hit_effect The hit effect to be added. */ - void addHitEffect(HitEffect *hit_effect) + void addHitEffect(HitEffect *hit_effect) { m_active_hit_effects.push_back(hit_effect); } }; diff --git a/src/items/rubber_ball.hpp b/src/items/rubber_ball.hpp index 85c0b4176..f0a1da0a9 100644 --- a/src/items/rubber_ball.hpp +++ b/src/items/rubber_ball.hpp @@ -43,10 +43,10 @@ private: /** A class variable to store the default interval size. */ static float m_st_interval; - + /** A class variable to store the default squash duration. */ static float m_st_squash_duration; - + /** A class variable to store the default squash slowdown. */ static float m_st_squash_slowdown; @@ -62,7 +62,7 @@ private: static float m_st_max_height_difference; /** Distance between ball and target at which the ball will start to - * bounce faster (which makes more 'ping' sfx for the driver to + * bounce faster (which makes more 'ping' sfx for the driver to * hear it coming closer, but also higher probability to hit the * target and not fly over it). */ static float m_st_fast_ping_distance; @@ -86,10 +86,10 @@ private: * that there are not too many rubber balls on the track in races with many * karts. */ static float m_time_between_balls; - + /** This factor is used to influence how much the rubber ball should aim * at its target early. It used the 'distance to center of track' of its - * target, and adjusts the interpolation control points to be more or + * target, and adjusts the interpolation control points to be more or * less at the same (relative) distance from center. If the factor is * 1, the rubber ball will aim to be at the same relative distance, * if the factor is 0, the rubber ball will aim directly at the @@ -110,7 +110,7 @@ private: * m_control_points[3]. */ int m_last_aimed_graph_node; - /** Keep the last two, current, and next aiming points + /** Keep the last two, current, and next aiming points * for interpolation. */ Vec3 m_control_points[4]; @@ -132,8 +132,8 @@ private: float m_length_cp_2_3; /** The parameter for the spline, m_t in [0,1]. This is not directly - * related to the time, since depending on the distance between - * the two control points different increments must be used for m_t. + * related to the time, since depending on the distance between + * the two control points different increments must be used for m_t. * For example, if the distance is 10 m, and assuming a speed of * 10 m/s for the ball, then each second must add '1' to m_t. If * the distance on the other hand is 200 m, then 10/200 = 1/20 per @@ -149,13 +149,13 @@ private: /** How long it takes from one bounce of the ball to the next. */ float m_interval; - /** This flag is set if the target is within the fast ping distance. It + /** This flag is set if the target is within the fast ping distance. It * will cause the rubber ball to decrese the jump height and intervall. */ bool m_fast_ping; - /** Distance to target. This is measured in terms of 'distance along - * track', but also takes the 3d distance and height difference into - * account (in case that the target is on a different part of the + /** Distance to target. This is measured in terms of 'distance along + * track', but also takes the 3d distance and height difference into + * account (in case that the target is on a different part of the * track) */ float m_distance_to_target; @@ -169,7 +169,7 @@ private: * it indicates that the ball is targeting another kart atm. */ float m_delete_timer; - /** The current maximum height of the ball. This value will be + /** The current maximum height of the ball. This value will be * reduced if the ball gets closer to the target. */ float m_current_max_height; @@ -179,7 +179,7 @@ private: * used to keep track of the state of this ball. */ bool m_aiming_at_target; - /** This variable counts how often a ball tunneled (in consecutive + /** This variable counts how often a ball tunneled (in consecutive * frames). If a ball tunnels a certain number of times, it is * considered stuck and will be removed. */ unsigned int m_tunnel_count; @@ -189,10 +189,10 @@ private: /** Sound effect to be played when a ball hits a kart. */ SFXBase *m_hit_sfx; - + void computeTarget(); void updateDistanceToTarget(); - unsigned int getSuccessorToHitTarget(unsigned int node_index, + unsigned int getSuccessorToHitTarget(unsigned int node_index, float *f=NULL); void getNextControlPoint(); float updateHeight(); diff --git a/src/items/rubber_band.hpp b/src/items/rubber_band.hpp index d0e575ada..bab96d15d 100644 --- a/src/items/rubber_band.hpp +++ b/src/items/rubber_band.hpp @@ -43,7 +43,7 @@ private: RB_TO_TRACK} /**< Rubber band is attached to track. */ m_attached_state; /** True if plunger was fired backwards. */ - bool m_is_backward; + bool m_is_backward; /** If rubber band is attached to track, the coordinates. */ Vec3 m_hit_position; /** The plunger the rubber band is attached to. */ @@ -60,7 +60,7 @@ private: /** The kart a plunger might have hit. */ AbstractKart *m_hit_kart; - /** Stores the end of the rubber band (i.e. the side attached to the + /** Stores the end of the rubber band (i.e. the side attached to the * plunger. */ Vec3 m_end_position; diff --git a/src/items/swatter.hpp b/src/items/swatter.hpp index 158aa7482..5d5c55a23 100644 --- a/src/items/swatter.hpp +++ b/src/items/swatter.hpp @@ -53,7 +53,7 @@ private: Moveable *m_target; SFXBase *m_swat_sound; - + /** True if the swatter is removing an attached bomb. */ bool m_removing_bomb; @@ -63,12 +63,12 @@ private: /** The scene node where a bomb is saved (in case that the swatter * replaces a bomb. */ scene::ISceneNode *m_bomb_scene_node; - + /** For some reason the built-in animation system doesn't work correctly here?? */ float m_swat_bomb_frame; - + const core::stringw getHitString(const AbstractKart *kart) const; - + public: Swatter(AbstractKart *kart, bool was_bomb, scene::ISceneNode* bomb_scene_node); @@ -84,14 +84,14 @@ public: // ------------------------------------------------------------------------ virtual void onAnimationEnd(); // ------------------------------------------------------------------------ - + private: /** Determine the nearest kart or item and update the current target accordingly */ void chooseTarget(); - + /** If there is a current target, point to it, otherwise adopt the default position */ void pointToTarget(); - + /** Squash karts or items that are around the end position (determined using a joint) of the swatter */ void squashThingsAround(); }; // Swatter diff --git a/src/karts/abstract_kart.hpp b/src/karts/abstract_kart.hpp index 4e53a20f1..b4972112e 100644 --- a/src/karts/abstract_kart.hpp +++ b/src/karts/abstract_kart.hpp @@ -39,7 +39,7 @@ class Skidding; class SlipStream; /** An abstract interface for the actual karts. Some functions are actually - * implemented here in order to allow inlining. + * implemented here in order to allow inlining. * \ingroup karts */ class AbstractKart : public Moveable @@ -75,7 +75,7 @@ protected: AbstractKartAnimation *m_kart_animation; public: - AbstractKart(const std::string& ident, + AbstractKart(const std::string& ident, int world_kart_id, int position, const btTransform& init_transform); virtual ~AbstractKart(); @@ -100,7 +100,7 @@ public: // Access to the kart properties. // ------------------------------------------------------------------------ /** Returns the kart properties of this kart. */ - const KartProperties* getKartProperties() const + const KartProperties* getKartProperties() const { return m_kart_properties; } // ------------------------------------------------------------------------ /** Sets the kart properties. */ @@ -116,7 +116,7 @@ public: * speed. */ virtual float getMaxSteerAngle () const = 0; // ------------------------------------------------------------------------ - /** Returns the time till full steering is reached for this kart. + /** Returns the time till full steering is reached for this kart. * This can depend on the current steering value, which must be >= 0. */ virtual float getTimeFullSteer(float steer) const = 0; @@ -155,7 +155,7 @@ public: * animation is being shown. */ AbstractKartAnimation *getKartAnimation() { return m_kart_animation; } // ------------------------------------------------------------------------ - const AbstractKartAnimation *getKartAnimation() const + const AbstractKartAnimation *getKartAnimation() const { return m_kart_animation; } // ------------------------------------------------------------------------ /** Sets a new kart animation. */ @@ -167,7 +167,7 @@ public: /** Returns the index of this kart in world. */ unsigned int getWorldKartId() const { return m_world_kart_id; } // ------------------------------------------------------------------------ - /** Saves the old controller in m_saved_controller and stores a new + /** Saves the old controller in m_saved_controller and stores a new * controller. The save controller is needed in case of a reset. * \param controller The new controller to use (atm it's always an * end controller). */ @@ -223,7 +223,7 @@ public: * bonus and maluses that are currently applied. */ virtual float getCurrentMaxSpeed() const = 0; // ------------------------------------------------------------------------ - /** Returns how much increased speed time is left over in the given + /** Returns how much increased speed time is left over in the given * category. Not pure abstract, since there is no need to implement this * e.g. in Ghost. * \param category Which category to report on. */ @@ -237,14 +237,14 @@ public: * \param fade_out_time How long the maximum speed will fade out linearly. */ virtual void increaseMaxSpeed(unsigned int category, float add_speed, - float engine_force, float duration, + float engine_force, float duration, float fade_out_time) = 0; // ------------------------------------------------------------------------ /** Defines a slowdown, which is in fraction of top speed. * \param category The category for which the speed is increased. * \param max_speed_fraction Fraction of top speed to allow only. * \param fade_in_time How long till maximum speed is capped. */ - virtual void setSlowdown(unsigned int category, float max_speed_fraction, + virtual void setSlowdown(unsigned int category, float max_speed_fraction, float fade_in_time) = 0; // ------------------------------------------------------------------------ /** Returns the remaining collected energy. */ @@ -282,20 +282,20 @@ public: /** Plays a beep sfx. */ virtual void beep() = 0; // ------------------------------------------------------------------------ - /** This function will play a particular character voice for this kart. - * It returns whether or not a character voice sample exists for the - * particular event. If there is no voice sample, a default can be + /** This function will play a particular character voice for this kart. + * It returns whether or not a character voice sample exists for the + * particular event. If there is no voice sample, a default can be * played instead. */ virtual bool playCustomSFX(unsigned int type) = 0; // ------------------------------------------------------------------------ /** Show fire to go with a zipper. */ virtual void showZipperFire() = 0; // ------------------------------------------------------------------------ - /** Sets zipper time, and apply one time additional speed boost. It can be + /** Sets zipper time, and apply one time additional speed boost. It can be * used with a specific material, in which case the zipper parmaters are * taken from this material (parameters that are <0 will be using the * kart-specific values from kart-properties. */ - virtual void handleZipper(const Material *m=NULL, + virtual void handleZipper(const Material *m=NULL, bool play_sound=false) = 0; // ------------------------------------------------------------------------ /** Returns true if this kart has finished the race. */ @@ -329,14 +329,14 @@ public: /** Returns true if the kart is 'resting', i.e. (nearly) not moving. */ virtual bool isInRest() const = 0; // ------------------------------------------------------------------------ - /** Starts the engine sound effect. Called once the track intro phase is + /** Starts the engine sound effect. Called once the track intro phase is * over. */ virtual void startEngineSFX() = 0; // ------------------------------------------------------------------------ - /** Stores the current suspension length. This function is called from - * world after all karts are in resting position (see - * World::resetAllKarts), so that the default suspension rest length can - * be stored. This is then used later to move the wheels depending on + /** Stores the current suspension length. This function is called from + * world after all karts are in resting position (see + * World::resetAllKarts), so that the default suspension rest length can + * be stored. This is then used later to move the wheels depending on * actual suspension, so that when a kart is in rest, the wheels are at * the position at which they were modelled. */ virtual void setSuspensionLength() = 0; diff --git a/src/karts/abstract_kart_animation.hpp b/src/karts/abstract_kart_animation.hpp index 35ba0c0ab..423b69b15 100644 --- a/src/karts/abstract_kart_animation.hpp +++ b/src/karts/abstract_kart_animation.hpp @@ -27,7 +27,7 @@ class AbstractKart; /** The base class for all kart animation, like rescue, explosion, or cannon. - * Kart animations are done by removing the physics body from the physics + * Kart animations are done by removing the physics body from the physics * world, and instead modifying the rotation and position of the kart * directly. They are registered with the kart, and only one can be * used at the same time. The memory is handled by the kart object, so @@ -48,7 +48,7 @@ protected: float m_timer; public: - AbstractKartAnimation(AbstractKart *kart, + AbstractKartAnimation(AbstractKart *kart, const std::string &name); virtual ~AbstractKartAnimation(); virtual void update(float dt); diff --git a/src/karts/cannon_animation.hpp b/src/karts/cannon_animation.hpp index d276a17bc..39057c37f 100644 --- a/src/karts/cannon_animation.hpp +++ b/src/karts/cannon_animation.hpp @@ -22,8 +22,8 @@ #include "karts/abstract_kart_animation.hpp" #include "utils/vec3.hpp" -/** This animation shoots the kart to a specified point on the track. - * +/** This animation shoots the kart to a specified point on the track. + * * \ingroup karts */ @@ -34,8 +34,8 @@ class Ipo; class CannonAnimation: public AbstractKartAnimation { protected: - /** This is the difference between the position of the kart when the - * cannon line is crossed and the curve interpolation at t=0. This + /** This is the difference between the position of the kart when the + * cannon line is crossed and the curve interpolation at t=0. This * is added to each interpolated curve value to give the final * kart position (so the kart moves relative to the curve). */ Vec3 m_delta; @@ -51,6 +51,6 @@ public: CannonAnimation(AbstractKart *kart, Ipo *ipo); virtual ~CannonAnimation(); virtual void update(float dt); - + }; // CannonAnimation #endif diff --git a/src/karts/explosion_animation.hpp b/src/karts/explosion_animation.hpp index 5b88db4f9..387dd6b58 100644 --- a/src/karts/explosion_animation.hpp +++ b/src/karts/explosion_animation.hpp @@ -22,11 +22,11 @@ #include "karts/abstract_kart_animation.hpp" #include "utils/vec3.hpp" -/** +/** * \brief This class is a 'mixin' for kart, and handles the animated explosion. * I.e. it will throw the kart a certain amount in the air, rotate it * randomly, and after the specified time period let it land at the - * same spot where it was hit, therefore avoiding any problems of + * same spot where it was hit, therefore avoiding any problems of * karts being pushed on wrong parts of the track, and making explosion * more 'fair' (it can't happen that one explosion give you actually * a benefit by pushing you forwards. diff --git a/src/karts/ghost_kart.hpp b/src/karts/ghost_kart.hpp index a01e1919b..3b691127e 100644 --- a/src/karts/ghost_kart.hpp +++ b/src/karts/ghost_kart.hpp @@ -28,8 +28,8 @@ /** \defgroup karts */ -/** A ghost kart. It does not have a phsyics representation. It gets two - * transforms from the replay objects at two consecutive time steps, +/** A ghost kart. It does not have a phsyics representation. It gets two + * transforms from the replay objects at two consecutive time steps, * and will interpolate between those positions depending on the current * time */ @@ -44,13 +44,13 @@ private: std::vector m_replay_events; - /** Pointer to the last index in m_all_times that is smaller than + /** Pointer to the last index in m_all_times that is smaller than * the current world time. */ unsigned int m_current_transform; /** Index of the next kart replay event. */ unsigned int m_next_event; - + void updateTransform(float t, float dt); public: GhostKart(const std::string& ident); diff --git a/src/karts/kart.hpp b/src/karts/kart.hpp index b207e9b99..e95e283cd 100644 --- a/src/karts/kart.hpp +++ b/src/karts/kart.hpp @@ -52,8 +52,8 @@ class SkidMarks; class SlipStream; class Stars; -/** The main kart class. All type of karts are of this object, but with - * different controllers. The controllers are what turn a kart into a +/** The main kart class. All type of karts are of this object, but with + * different controllers. The controllers are what turn a kart into a * player kart (i.e. the controller handle input), or an AI kart (the * controller runs the AI code to set steering etc). * Kart has two base classes: the most important one is moveable (which @@ -76,17 +76,17 @@ private: /** True if kart is flying (for debug purposes only). */ bool m_flying; - + /** Set when hitting bubblegum */ bool m_has_caught_nolok_bubblegum; - + /** Reset position. */ btTransform m_reset_transform; /** This object handles all skidding. */ Skidding *m_skidding; - /** The main controller of this object, used for driving. This + /** The main controller of this object, used for driving. This * controller is used to run the kart. It will be replaced * with an end kart controller when the kart finishes the race. */ Controller *m_controller; @@ -107,18 +107,18 @@ private: /** For stars rotating around head effect */ Stars *m_stars_effect; - + private: - /** True if the kart hasn't moved since 'ready-set-go' - used to + /** True if the kart hasn't moved since 'ready-set-go' - used to * determine startup boost. */ bool m_has_started; /**0 * the kart is squashed. */ float m_squash_time; - + /** If > 0 then bubble gum effect is on */ float m_bubblegum_time; @@ -148,13 +148,13 @@ private: // ----------------- /** The shadow of a kart. */ Shadow *m_shadow; - + /** If a kart is flying, the shadow is disabled (since it is * stuck to the kart, i.e. the shadow would be flying, too). */ bool m_shadow_enabled; - + ParticleEmitter *m_sky_particles_emitter; - + /** All particle effects. */ KartGFX *m_kart_gfx; @@ -163,14 +163,14 @@ private: /** Handles all slipstreaming. */ SlipStream *m_slipstream; - + /** Rotation compared to the start position, same for all wheels */ float m_wheel_rotation; /** Rotation change in the last time delta, same for all wheels */ float m_wheel_rotation_dt; - - /** For each wheel it stores the suspension length after the karts are at + + /** For each wheel it stores the suspension length after the karts are at * the start position, i.e. the suspension will be somewhat compressed. * The bullet suspensionRestLength is the value when the suspension is not * at all compressed. */ @@ -182,7 +182,7 @@ private: float m_finish_time; bool m_finished_race; - /** When a kart has its view blocked by the plunger, this variable will be + /** When a kart has its view blocked by the plunger, this variable will be * > 0 the number it contains is the time left before removing plunger. */ float m_view_blocked_by_plunger; float m_speed; @@ -210,13 +210,13 @@ private: float getActualWheelForce(); void crashed(); void loadData(RaceManager::KartType type, bool animatedModel); - + public: Kart(const std::string& ident, unsigned int world_kart_id, int position, const btTransform& init_transform); virtual ~Kart(); virtual void init(RaceManager::KartType type); - virtual void updateGraphics(float dt, const Vec3& off_xyz, + virtual void updateGraphics(float dt, const Vec3& off_xyz, const btQuaternion& off_rotation); virtual void createPhysics (); virtual void updateWeight (); @@ -226,13 +226,13 @@ public: virtual void flyUp(); virtual void flyDown(); - + virtual void startEngineSFX (); virtual void adjustSpeed (float f); virtual void increaseMaxSpeed(unsigned int category, float add_speed, - float engine_force, float duration, + float engine_force, float duration, float fade_out_time); - virtual void setSlowdown(unsigned int category, float max_speed_fraction, + virtual void setSlowdown(unsigned int category, float max_speed_fraction, float fade_in_time); virtual float getSpeedIncreaseTimeLeft(unsigned int category) const; virtual void collectedItem(Item *item, int random_attachment); @@ -242,7 +242,7 @@ public: virtual float getTerrainPitch(float heading) const; virtual void reset (); - virtual void handleZipper (const Material *m=NULL, + virtual void handleZipper (const Material *m=NULL, bool play_sound=false); virtual void setSquash (float time, float slowdown); @@ -298,11 +298,11 @@ public: // ------------------------------------------------------------------------ /** Sets that the view is blocked by a plunger. The duration depends on * the difficulty, see KartPorperties getPlungerInFaceTime. */ - virtual void blockViewWithPlunger() - { + virtual void blockViewWithPlunger() + { // Avoid that a plunger extends the plunger time if(m_view_blocked_by_plunger<=0) - m_view_blocked_by_plunger = + m_view_blocked_by_plunger = m_kart_properties->getPlungerInFaceTime(); } // blockViewWithPlunger // ------------------------------------------------------------------------- @@ -312,14 +312,14 @@ public: virtual btTransform getAlignedTransform(const float customPitch=-1); // ------------------------------------------------------------------------- /** Returns the color used for this kart. */ - const video::SColor &getColor() const + const video::SColor &getColor() const {return m_kart_properties->getColor();} // ------------------------------------------------------------------------ /** Returns the time till full steering is reached for this kart. * \param steer Current steer value (must be >=0), on which the time till * full steer depends. */ - virtual float getTimeFullSteer(float steer) const - { + virtual float getTimeFullSteer(float steer) const + { return m_kart_properties->getTimeFullSteer(steer); } // getTimeFullSteer // ------------------------------------------------------------------------ @@ -340,7 +340,7 @@ public: virtual btKart *getVehicle () const {return m_vehicle; } // ------------------------------------------------------------------------ /** Returns the upright constraint for this kart. */ - virtual btUprightConstraint *getUprightConstraint() const + virtual btUprightConstraint *getUprightConstraint() const {return m_uprightConstraint;} // ------------------------------------------------------------------------ /** Returns the speed of the kart in meters/second. */ diff --git a/src/karts/kart_gfx.hpp b/src/karts/kart_gfx.hpp index 84929fab3..a0ff5ae00 100644 --- a/src/karts/kart_gfx.hpp +++ b/src/karts/kart_gfx.hpp @@ -19,7 +19,7 @@ #ifndef HEADER_KART_GFX_HPP #define HEADER_KART_GFX_HPP -/** \defgroup karts +/** \defgroup karts * This class implements all particle effects for a kart. */ #include @@ -33,9 +33,9 @@ class Vec3; class KartGFX { public: - /** All particle effects supported by this object. + /** All particle effects supported by this object. * Nitro, zipper, terrain, and skidding effects. Two different - * skid types are supported, but only one emitter node will be + * skid types are supported, but only one emitter node will be * created. So KGFX_SKID1/2 store the two types, and KGFX_SKID * = KGFX_SKID1 stores the actual emitter node. KGFX_COUNT * is the number of entries and must therefore be last. */ @@ -66,7 +66,7 @@ private: /** Used to alternate particle effects from the rear wheels. */ int m_wheel_toggle; - void addEffect(KartGFXType type, const std::string &file_name, + void addEffect(KartGFXType type, const std::string &file_name, const Vec3 &position); public: diff --git a/src/karts/kart_model.hpp b/src/karts/kart_model.hpp index f6c6a64c4..49a9caa54 100644 --- a/src/karts/kart_model.hpp +++ b/src/karts/kart_model.hpp @@ -24,7 +24,7 @@ #include namespace irr { - namespace scene { class IAnimatedMesh; class IMesh; + namespace scene { class IAnimatedMesh; class IMesh; class ISceneNode; class IMeshSceneNode; } } using namespace irr; @@ -41,7 +41,7 @@ class XMLNode; * It takes especially care of attaching * the wheels, which are loaded as separate objects. The wheels can turn * and (for the front wheels) rotate. The implementation is dependent on the - * OpenGL library used. + * OpenGL library used. * Note that this object is copied using the default copy function. See * kart.cpp. * \ingroup karts @@ -63,7 +63,7 @@ public: AF_WIN_START, // Begin of win animation AF_WIN_LOOP_START, // Begin of win loop animation AF_WIN_END, // End of win animation - AF_END=AF_WIN_END, // Last animation frame + AF_END=AF_WIN_END, // Last animation frame AF_COUNT}; // Number of entries here private: /** Which frame number starts/end which animation. */ @@ -107,9 +107,9 @@ private: /** The position of all four wheels in the 3d model. */ Vec3 m_wheel_graphics_position[4]; - /** The position of the wheels for the physics, which can be different + /** The position of the wheels for the physics, which can be different * from the graphical position. */ - Vec3 m_wheel_physics_position[4]; + Vec3 m_wheel_physics_position[4]; /** Radius of the graphical wheels. */ float m_wheel_graphics_radius[4]; @@ -139,14 +139,14 @@ private: * anything attached to it etc. */ bool m_is_master; - void loadWheelInfo(const XMLNode &node, + void loadWheelInfo(const XMLNode &node, const std::string &wheel_name, int index); void OnAnimationEnd(scene::IAnimatedMeshSceneNode *node); /** Pointer to the kart object belonging to this kart model. */ AbstractKart* m_kart; - + public: KartModel(bool is_master); ~KartModel(); @@ -154,45 +154,45 @@ public: void reset(); void loadInfo(const XMLNode &node); bool loadModels(const KartProperties &kart_properties); - void update(float rotation_dt, float steer, + void update(float rotation_dt, float steer, const float suspension[4]); - void setDefaultPhysicsPosition(const Vec3 ¢er_shift, + void setDefaultPhysicsPosition(const Vec3 ¢er_shift, float wheel_radius); void finishedRace(); scene::ISceneNode* attachModel(bool animatedModels); // ------------------------------------------------------------------------ /** Returns the animated mesh of this kart model. */ - scene::IAnimatedMesh* + scene::IAnimatedMesh* getModel() const { return m_mesh; } // ------------------------------------------------------------------------ /** Returns the mesh of the wheel for this kart. */ - scene::IMesh* getWheelModel(const int i) const + scene::IMesh* getWheelModel(const int i) const { assert(i>=0 && i<4); return m_wheel_model[i]; } // ------------------------------------------------------------------------ - /** Since karts might be animated, we might need to know which base frame + /** Since karts might be animated, we might need to know which base frame * to use. */ int getBaseFrame() const { return m_animation_frame[AF_STRAIGHT]; } // ------------------------------------------------------------------------ - /** Returns the position of a wheel relative to the kart. - * \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear + /** Returns the position of a wheel relative to the kart. + * \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear * right, 3 = rear left. */ - const Vec3& getWheelGraphicsPosition(int i) const + const Vec3& getWheelGraphicsPosition(int i) const {assert(i>=0 && i<4); return m_wheel_graphics_position[i];} // ------------------------------------------------------------------------ /** Returns the position of a wheel relative to the kart for the physics. - * The physics wheels can be attached at a different place to make the + * The physics wheels can be attached at a different place to make the * karts more stable. - * \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear + * \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear * right, 3 = rear left. */ - const Vec3& getWheelPhysicsPosition(int i) const + const Vec3& getWheelPhysicsPosition(int i) const {assert(i>=0 && i<4); return m_wheel_physics_position[i];} // ------------------------------------------------------------------------ /** Returns the radius of the graphical wheels. - * \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear + * \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear * right, 3 = rear left. */ - float getWheelGraphicsRadius(int i) const + float getWheelGraphicsRadius(int i) const {assert(i>=0 && i<4); return m_wheel_graphics_radius[i]; } // ------------------------------------------------------------------------ /** Returns the length of the kart model. */ @@ -205,7 +205,7 @@ public: float getHeight () const {return m_kart_height; } // ------------------------------------------------------------------------ /** Enables- or disables the end animation. */ - void setAnimation(AnimationFrameType type); + void setAnimation(AnimationFrameType type); // ------------------------------------------------------------------------ /** Sets the kart this model is currently used for */ void setKart(AbstractKart* k) { m_kart = k; } @@ -215,6 +215,6 @@ public: // ------------------------------------------------------------------------ /** Returns the array of wheel nodes. */ scene::ISceneNode** getWheelNodes() { return m_wheel_node; } - + }; // KartModel #endif diff --git a/src/karts/kart_properties.hpp b/src/karts/kart_properties.hpp index a52d2d54b..77859bf93 100644 --- a/src/karts/kart_properties.hpp +++ b/src/karts/kart_properties.hpp @@ -42,12 +42,12 @@ class Material; class SkiddingProperties; class XMLNode; -/** +/** * \brief This class stores the properties of a kart. * This includes size, name, identifier, physical properties etc. * It is atm also the base class for STKConfig, which stores the default values * for all physics constants. - * Note that KartProperies is copied (when setting the default values from + * Note that KartProperies is copied (when setting the default values from * stk_config. * * \ingroup karts @@ -160,16 +160,16 @@ private: /** Duration a zipper is active. */ float m_zipper_time; - + /** Fade out time for a zipper. */ float m_zipper_fade_out_time; /** Additional force added to the acceleration. */ float m_zipper_force; - + /** Initial one time speed gain. */ float m_zipper_speed_gain; - + /** Absolute increase of the kart's maximum speed (in m/s). */ float m_zipper_max_speed_increase; @@ -207,10 +207,10 @@ private: float m_nitro_max_speed_increase; /** Additional engine force to affect the kart. */ float m_nitro_engine_force; - /** How long the increased nitro max speed will be valid after + /** How long the increased nitro max speed will be valid after * the kart stops using nitro (and the fade-out-time starts). */ float m_nitro_duration; - /** Duration during which the increased maximum speed + /** Duration during which the increased maximum speed * due to nitro fades out. */ float m_nitro_fade_out_time; /** Maximum nitro a kart can collect. */ @@ -245,7 +245,7 @@ private: * &p=21240&hilit=vehicle#p21240 */ float m_downward_impulse_factor; - /** Artifical acceleration that pulls a kart down onto the track if one + /** Artifical acceleration that pulls a kart down onto the track if one * axis loses contact with the track. */ float m_track_connection_accel; @@ -278,7 +278,7 @@ public: * driveline. The later works nice as long as the kart is driving * on the main track, but can work very bad if the kart is drivling * off-track (and a wrong driveline is selected). */ - enum TerrainImpulseType {IMPULSE_NONE, IMPULSE_NORMAL, + enum TerrainImpulseType {IMPULSE_NONE, IMPULSE_NORMAL, IMPULSE_TO_DRIVELINE}; private: TerrainImpulseType m_terrain_impulse_type; @@ -286,7 +286,7 @@ private: /** An additional impulse to push a kart away if it hits terrain */ float m_collision_terrain_impulse; - /** An additiojnal artificial impulse that pushes two karts in a + /** An additiojnal artificial impulse that pushes two karts in a * side-side collision away from each other. */ float m_collision_impulse; @@ -311,7 +311,7 @@ private: float m_slipstream_add_power; /** Minimum speed for slipstream to take effect. */ float m_slipstream_min_speed; - /** How much the speed of the kart might exceed its + /** How much the speed of the kart might exceed its * normal maximum speed. */ float m_slipstream_max_speed_increase; /** How long the higher speed lasts after slipstream stopped working. */ @@ -322,11 +322,11 @@ private: /** Distance of normal camera from kart. */ float m_camera_distance; - /** Up angle of the camera in relation to the pitch of the kart when + /** Up angle of the camera in relation to the pitch of the kart when * driving forwards. */ float m_camera_forward_up_angle; - /** Up angle of the camera in relation to the pitch of the kart when + /** Up angle of the camera in relation to the pitch of the kart when * driving backwards. */ float m_camera_backward_up_angle; @@ -339,7 +339,7 @@ private: m_gear_switch_ratio). */ std::vector m_gear_power_increase; - /** If the kart starts within the specified time at index I after 'go', + /** If the kart starts within the specified time at index I after 'go', * it receives the speed boost from m_startup_boost[I]. */ std::vector m_startup_times; @@ -360,7 +360,7 @@ public: float getStartupBoost () const; // ------------------------------------------------------------------------ - /** Returns the (maximum) speed for a given turn radius. + /** Returns the (maximum) speed for a given turn radius. * \param radius The radius for which the speed needs to be computed. */ float getSpeedForTurnRadius(float radius) const { float angle = sin(m_wheel_base / radius); @@ -368,7 +368,7 @@ public: } // getSpeedForTurnRadius // ------------------------------------------------------------------------ /** Returns the maximum steering angle (depending on speed). */ - float getMaxSteerAngle(float speed) const { + float getMaxSteerAngle(float speed) const { return m_turn_angle_at_speed.get(speed); } // getMaxSteerAngle @@ -382,7 +382,7 @@ public: // ------------------------------------------------------------------------ /** Returns a pointer to the KartModel object. */ - KartModel* getKartModelCopy () const + KartModel* getKartModelCopy () const {return m_kart_model->makeCopy(); } // ------------------------------------------------------------------------ @@ -391,12 +391,12 @@ public: const KartModel& getMasterKartModel() const {return *m_kart_model; } // ------------------------------------------------------------------------ - /** Returns the name of this kart. + /** Returns the name of this kart. \note Pass it through fridibi as needed, this is the LTR name */ - const wchar_t* getName() const + const wchar_t* getName() const { - return translations->w_gettext(m_name.c_str()); + return translations->w_gettext(m_name.c_str()); } // ------------------------------------------------------------------------ @@ -416,7 +416,7 @@ public: // ------------------------------------------------------------------------ /** Returns custom sound effects for this kart. */ - const int getCustomSfxId (SFXManager::CustomSFX type) + const int getCustomSfxId (SFXManager::CustomSFX type) const {return m_custom_sfx_id[type]; } // ------------------------------------------------------------------------ @@ -441,17 +441,17 @@ public: float getMass () const {return m_mass; } // ------------------------------------------------------------------------ /** Returns the maximum engine power depending on difficulty. */ - float getMaxPower () const + float getMaxPower () const {return m_engine_power[race_manager->getDifficulty()];} // ------------------------------------------------------------------------ - /** Returns the time the kart needs to fully steer in one direction from + /** Returns the time the kart needs to fully steer in one direction from * steering straight depending on the current steering value. * \param steer Current steering value, must be >=0. */ - float getTimeFullSteer(float steer) const + float getTimeFullSteer(float steer) const { assert(steer>=0); - return m_time_full_steer.get(steer); + return m_time_full_steer.get(steer); } // getTimeFullSteer // ------------------------------------------------------------------------ @@ -464,7 +464,7 @@ public: // ------------------------------------------------------------------------ /** Get maximum reverse speed ratio. */ - float getMaxSpeedReverseRatio () const + float getMaxSpeedReverseRatio () const {return m_max_speed_reverse_ratio; } // ------------------------------------------------------------------------ @@ -478,12 +478,12 @@ public: // ------------------------------------------------------------------------ /** Returns damping relaxation. */ - float getWheelDampingRelaxation () const + float getWheelDampingRelaxation () const {return m_wheel_damping_relaxation; } // ------------------------------------------------------------------------ /** Returns the wheel damping compression. */ - float getWheelDampingCompression() const + float getWheelDampingCompression() const {return m_wheel_damping_compression;} // ------------------------------------------------------------------------ @@ -512,7 +512,7 @@ public: // ------------------------------------------------------------------------ /** Returns angular damping of chassis. */ - float getChassisAngularDamping () const + float getChassisAngularDamping () const {return m_chassis_angular_damping; } // ------------------------------------------------------------------------ @@ -542,7 +542,7 @@ public: // ------------------------------------------------------------------------ /** Returns the increase of maximum speed due to nitro. */ - float getNitroMaxSpeedIncrease () const + float getNitroMaxSpeedIncrease () const {return m_nitro_max_speed_increase; } // ------------------------------------------------------------------------ @@ -553,7 +553,7 @@ public: float getNitroDuration () const {return m_nitro_duration; } // ------------------------------------------------------------------------ - /** Returns the duration during which the increased maximum speed + /** Returns the duration during which the increased maximum speed * due to nitro fades out. */ float getNitroFadeOutTime () const {return m_nitro_fade_out_time; } @@ -562,7 +562,7 @@ public: float getNitroMax () const {return m_nitro_max; } // ------------------------------------------------------------------------ - /** Returns a shift of the center of mass (lowering the center of mass + /** Returns a shift of the center of mass (lowering the center of mass * makes the karts more stable. */ const Vec3&getGravityCenterShift() const {return m_gravity_center_shift; } @@ -579,9 +579,9 @@ public: bool getExpSpringResponse() const {return m_exp_spring_response; } // ------------------------------------------------------------------------ - /** Returns an artificial impulse to push karts away from the terrain + /** Returns an artificial impulse to push karts away from the terrain * it hits. */ - float getCollisionTerrainImpulse() const + float getCollisionTerrainImpulse() const {return m_collision_terrain_impulse;} // ------------------------------------------------------------------------ @@ -624,9 +624,9 @@ public: float getExplosionRadius () const {return m_explosion_radius; } // ------------------------------------------------------------------------ - /** Returns how long a kart is invulnerable after being hit by an + /** Returns how long a kart is invulnerable after being hit by an explosion. */ - float getExplosionInvulnerabilityTime() const + float getExplosionInvulnerabilityTime() const { return m_explosion_invulnerability_time; } // ------------------------------------------------------------------------ @@ -651,23 +651,23 @@ public: float getRubberBandDuration () const {return m_rubber_band_duration; } // ------------------------------------------------------------------------ - /** Returns the increase of maximum speed while a rubber band is + /** Returns the increase of maximum speed while a rubber band is * pulling. */ - float getRubberBandSpeedIncrease() const + float getRubberBandSpeedIncrease() const { return m_rubber_band_speed_increase; } // ------------------------------------------------------------------------ /** Return the fade out time once a rubber band is removed. */ - float getRubberBandFadeOutTime() const + float getRubberBandFadeOutTime() const { return m_rubber_band_fade_out_time; } // ------------------------------------------------------------------------ /** Returns duration of a plunger in your face. */ - float getPlungerInFaceTime () const + float getPlungerInFaceTime () const {return m_plunger_in_face_duration[race_manager->getDifficulty()];} // ------------------------------------------------------------------------ @@ -687,9 +687,9 @@ public: float getZipperSpeedGain () const { return m_zipper_speed_gain; } // ------------------------------------------------------------------------ - /** Returns the increase of the maximum speed of the kart + /** Returns the increase of the maximum speed of the kart * if a zipper is active. */ - float getZipperMaxSpeedIncrease () const + float getZipperMaxSpeedIncrease () const { return m_zipper_max_speed_increase;} // ------------------------------------------------------------------------ @@ -702,7 +702,7 @@ public: // ------------------------------------------------------------------------ /** Returns time after which slipstream has maximum effect. */ - float getSlipstreamCollectTime () const + float getSlipstreamCollectTime () const {return m_slipstream_collect_time; } // ------------------------------------------------------------------------ @@ -718,44 +718,44 @@ public: float getSlipstreamMinSpeed () const {return m_slipstream_min_speed; } // ------------------------------------------------------------------------ - /** Returns the increase of the maximum speed of a kart + /** Returns the increase of the maximum speed of a kart * due to slipstream. */ - float getSlipstreamMaxSpeedIncrease() const + float getSlipstreamMaxSpeedIncrease() const { return m_slipstream_max_speed_increase; } // ------------------------------------------------------------------------ - /** Returns how long the higher speed lasts after slipstream + /** Returns how long the higher speed lasts after slipstream * stopped working. */ float getSlipstreamDuration () const { return m_slipstream_duration; } // ------------------------------------------------------------------------ - /** Returns how long the slip stream speed increase will gradually + /** Returns how long the slip stream speed increase will gradually * be reduced. */ - float getSlipstreamFadeOutTime () const + float getSlipstreamFadeOutTime () const { return m_slipstream_fade_out_time; } // ------------------------------------------------------------------------ /** Returns the scale factor by which the shadow plane * had to be set. */ float getShadowScale () const {return m_shadow_scale; } - + // ------------------------------------------------------------------------ /** Returns the scale factor by which the shadow plane * had to be set. */ float getShadowXOffset () const {return m_shadow_x_offset; } - + // ------------------------------------------------------------------------ /** Returns the scale factor by which the shadow plane * had to be set. */ float getShadowYOffset () const {return m_shadow_y_offset; } - + // ------------------------------------------------------------------------ /** Returns a pointer to the skidding properties. */ - const SkiddingProperties *getSkiddingProperties() const + const SkiddingProperties *getSkiddingProperties() const { return m_skidding_properties; } // ------------------------------------------------------------------------ /** Returns a pointer to the AI properties. */ - const AIProperties *getAIPropertiesForDifficulty() const + const AIProperties *getAIPropertiesForDifficulty() const { return m_ai_properties[race_manager->getDifficulty()]; } // getAIProperties @@ -777,12 +777,12 @@ public: // ------------------------------------------------------------------------ /** Returns the angle the camera has relative to the pitch of the kart. */ - float getCameraForwardUpAngle () const + float getCameraForwardUpAngle () const {return m_camera_forward_up_angle; } // ------------------------------------------------------------------------ /** Returns the angle the camera has relative to the pitch of the kart. */ - float getCameraBackwardUpAngle () const + float getCameraBackwardUpAngle () const {return m_camera_backward_up_angle; } // ------------------------------------------------------------------------ @@ -790,7 +790,7 @@ public: const std::string& getKartDir () const {return m_root; } // ------------------------------------------------------------------------ - /** Returns the square of the maximum distance at which a swatter + /** Returns the square of the maximum distance at which a swatter * can hit karts. */ float getSwatterDistance2() const { return m_swatter_distance2; } diff --git a/src/karts/kart_properties_manager.hpp b/src/karts/kart_properties_manager.hpp index efb4a0401..f6b435a19 100644 --- a/src/karts/kart_properties_manager.hpp +++ b/src/karts/kart_properties_manager.hpp @@ -70,9 +70,9 @@ public: const KartProperties* getKartById (int i) const; const KartProperties* getKart(const std::string &ident) const; const int getKartId(const std::string &ident) const; - int getKartByGroup(const std::string& group, + int getKartByGroup(const std::string& group, int i) const; - + bool loadKart (const std::string &dir); void loadAllKarts (bool loading_icon = true); void unloadAllKarts (); @@ -84,7 +84,7 @@ public: void setUnavailableKarts(std::vector); void selectKartName(const std::string &kart_name); bool testAndSetKart(int kartid); - void getRandomKartList(int count, + void getRandomKartList(int count, RemoteKartInfoList& existing_karts, std::vector *ai_list); // ------------------------------------------------------------------------ @@ -104,7 +104,7 @@ public: void selectKart(int kartid) { m_selected_karts.push_back(kartid); } // ------------------------------------------------------------------------ /** Returns all directories from which karts were loaded. */ - const std::vector* getAllKartDirs() const + const std::vector* getAllKartDirs() const { return &m_all_kart_dirs; } // ------------------------------------------------------------------------ /** Returns the number of karts. */ diff --git a/src/karts/kart_with_stats.hpp b/src/karts/kart_with_stats.hpp index 7ff344427..5087350a5 100644 --- a/src/karts/kart_with_stats.hpp +++ b/src/karts/kart_with_stats.hpp @@ -71,7 +71,7 @@ private: float m_skidding_time; public: - KartWithStats(const std::string& ident, + KartWithStats(const std::string& ident, unsigned int world_kart_id, int position, const btTransform& init_transform); diff --git a/src/karts/max_speed.hpp b/src/karts/max_speed.hpp index 732054fb7..3e10c32fd 100644 --- a/src/karts/max_speed.hpp +++ b/src/karts/max_speed.hpp @@ -30,8 +30,8 @@ public: * Increase due to zipper, slipstream, nitro, rubber band, * skidding usage. */ enum {MS_INCREASE_MIN, - MS_INCREASE_ZIPPER = MS_INCREASE_MIN, - MS_INCREASE_SLIPSTREAM, + MS_INCREASE_ZIPPER = MS_INCREASE_MIN, + MS_INCREASE_SLIPSTREAM, MS_INCREASE_NITRO, MS_INCREASE_RUBBER, MS_INCREASE_SKIDDING, @@ -40,8 +40,8 @@ public: /** The categories to use for decreasing the speed of a kart: * Decrease due to terrain, different AI levels and end controller. */ enum {MS_DECREASE_MIN, - MS_DECREASE_TERRAIN = MS_DECREASE_MIN, - MS_DECREASE_AI, + MS_DECREASE_TERRAIN = MS_DECREASE_MIN, + MS_DECREASE_AI, MS_DECREASE_SQUASH, MS_DECREASE_MAX}; @@ -64,7 +64,7 @@ private: float m_max_add_speed; /** How long this speed will apply. This is used as a timer internally, * to the duration will be decreased. When the duration is <0, the - * fade out time starts, and duration will go down to + * fade out time starts, and duration will go down to * -m_fade_out_time before this speed increase stops. */ float m_duration; /** The fadeout time. */ @@ -74,7 +74,7 @@ private: /** Additional engine force. */ float m_engine_force; - /** The constructor initialised the values with a no-increase + /** The constructor initialised the values with a no-increase * entry, i.e. an entry that does affect top speed at all. */ SpeedIncrease() { @@ -96,8 +96,8 @@ private: float getTimeLeft() const {return m_duration; } // -------------------------------------------------------------------- /** Returns the additional engine force for this speed increase. */ - float getEngineForce() const - { + float getEngineForce() const + { return m_duration > 0 ? m_engine_force : 0; } }; // SpeedIncrease @@ -111,7 +111,7 @@ private: float m_max_speed_fraction; /** How long it should take for the full slowdown to take effect. */ float m_fade_in_time; - /** The current slowdown fraction, taking the fade-in time + /** The current slowdown fraction, taking the fade-in time * into account. */ float m_current_fraction; @@ -125,31 +125,31 @@ private: } // SpeedDecrease void update(float dt); // -------------------------------------------------------------------- - /** Returns the current slowdown fracftion, taking a 'fade in' + /** Returns the current slowdown fracftion, taking a 'fade in' * into account. */ float getSlowdownFraction() const {return m_current_fraction;} }; // SpeedDecrease // ------------------------------------------------------------------------ - /** Stores all speed decrease related information + /** Stores all speed decrease related information * for each possible category. */ SpeedDecrease m_speed_decrease[MS_DECREASE_MAX]; - /** Stores all speed increase related information + /** Stores all speed increase related information * for each possible category. */ SpeedIncrease m_speed_increase[MS_INCREASE_MAX]; public: MaxSpeed(AbstractKart *kart); - + void increaseMaxSpeed(unsigned int category, float add_speed, float engine_force, float duration, float fade_out_time); - void instantSpeedIncrease(unsigned int category, + void instantSpeedIncrease(unsigned int category, float add_speed, float speed_boost, - float engine_force, float duration, + float engine_force, float duration, float fade_out_time/*=1.0f*/); - void setSlowdown(unsigned int category, float max_speed_fraction, + void setSlowdown(unsigned int category, float max_speed_fraction, float fade_in_time); float getSpeedIncreaseTimeLeft(unsigned int category); void update(float dt); diff --git a/src/karts/moveable.hpp b/src/karts/moveable.hpp index ebfdce722..4461620ee 100644 --- a/src/karts/moveable.hpp +++ b/src/karts/moveable.hpp @@ -60,10 +60,10 @@ public: Moveable(); virtual ~Moveable(); /** Returns the scene node of this moveable. */ - scene::ISceneNode + scene::ISceneNode *getNode() const { return m_node; } void setNode(scene::ISceneNode *n); - virtual const btVector3 + virtual const btVector3 &getVelocity() const {return m_body->getLinearVelocity();} const btVector3 &getVelocityLC() const {return m_velocityLC; } @@ -75,16 +75,16 @@ public: float getPitch() const {return m_pitch; } /** Returns the roll of the kart between -pi and pi. */ float getRoll() const {return m_roll; } - const btQuaternion + const btQuaternion getRotation() const {return m_transform.getRotation(); } /** Enter flying mode */ virtual void flyUp(); virtual void flyDown(); virtual void stopFlying(); - + /** Sets the XYZ coordinates of the moveable. */ - void setXYZ(const Vec3& a) + void setXYZ(const Vec3& a) { m_transform.setOrigin(a); if(m_motion_state) @@ -99,15 +99,15 @@ public: m_motion_state->setWorldTransform(m_transform); } // ------------------------------------------------------------------------ - virtual void updateGraphics(float dt, const Vec3& off_xyz, + virtual void updateGraphics(float dt, const Vec3& off_xyz, const btQuaternion& off_rotation); virtual void reset(); virtual void update(float dt) ; btRigidBody *getBody() const {return m_body; } - void createBody(float mass, btTransform& trans, + void createBody(float mass, btTransform& trans, btCollisionShape *shape, float restitution); - const btTransform + const btTransform &getTrans() const {return m_transform;} void setTrans(const btTransform& t); } diff --git a/src/karts/skidding.hpp b/src/karts/skidding.hpp index 5df51a5ce..d2feaf19e 100644 --- a/src/karts/skidding.hpp +++ b/src/karts/skidding.hpp @@ -58,7 +58,7 @@ private: * trigger the skidding bonus. */ float m_skid_time; - /** True if the kart has skidded long enough to get a skid bonus if it + /** True if the kart has skidded long enough to get a skid bonus if it * stopped skidding now. */ bool m_skid_bonus_ready; @@ -82,8 +82,8 @@ public: * SKID_SHOW_GFX_LEFT: Shows the gfx, while the bonus is active, * and the kart was turning left. * SKID_SHOW_GFX_RIGHT: Similar for turning right. */ - enum SkidState {SKID_OLD, SKID_NONE, SKID_ACCUMULATE_LEFT, - SKID_ACCUMULATE_RIGHT, SKID_SHOW_GFX_LEFT, + enum SkidState {SKID_OLD, SKID_NONE, SKID_ACCUMULATE_LEFT, + SKID_ACCUMULATE_RIGHT, SKID_SHOW_GFX_LEFT, SKID_SHOW_GFX_RIGHT} ; private: @@ -98,7 +98,7 @@ private: ShowCurve *m_actual_curve; #endif - unsigned int getSkidBonus(float *bonus_time, float *bonus_speed, + unsigned int getSkidBonus(float *bonus_time, float *bonus_speed, float *bonus_force) const; void updateSteering(float steer, float dt); public: @@ -134,7 +134,7 @@ public: // ------------------------------------------------------------------------ float getSteeringWhenSkidding(float steering) const; // ------------------------------------------------------------------------ - /** Returns if the kart has skidded long enough to get a skid bonus if it + /** Returns if the kart has skidded long enough to get a skid bonus if it * stopped skidding now. This function returns false if the kart is * actually using the skid bonus. */ bool getSkidBonusReady() const { return m_skid_bonus_ready; } diff --git a/src/karts/skidding_properties.hpp b/src/karts/skidding_properties.hpp index 8d719b097..e5e2c30af 100644 --- a/src/karts/skidding_properties.hpp +++ b/src/karts/skidding_properties.hpp @@ -40,7 +40,7 @@ class SkiddingProperties public: //LEAK_CHECK(); protected: - /** Skidding is multiplied by this when skidding + /** Skidding is multiplied by this when skidding * to increase to m_skid_increase. */ float m_skid_increase; @@ -50,7 +50,7 @@ protected: /** How long it takes for visual skid to reach maximum. */ float m_skid_visual_time; - /** How long it takes for the physical and graphical bodies to be + /** How long it takes for the physical and graphical bodies to be * in sync again after a skid. */ float m_skid_revert_visual_time; @@ -70,7 +70,7 @@ protected: float m_graphical_jump_time; /** This factor is used to determine how much the chassis of a kart - * should rotate to match the graphical view. A factor of 1 is + * should rotate to match the graphical view. A factor of 1 is * identical, a smaller factor will rotate the kart less (which might * feel better). */ float m_post_skid_rotate_factor; @@ -86,7 +86,7 @@ protected: * define more than one speed, i.e. longer skidding gives more bonus. */ std::vector m_skid_bonus_speed; - /** How long the bonus will last. It's possible to define more than one + /** How long the bonus will last. It's possible to define more than one * time, i.e. longer skidding gives more bonus. */ std::vector m_skid_bonus_time; @@ -97,12 +97,12 @@ protected: std::vector m_skid_bonus_force; /** A factor is used to reduce the amount of steering while skidding. This - * is the minimum factor used (i.e. resulting in the largest turn + * is the minimum factor used (i.e. resulting in the largest turn * radius). */ float m_skid_reduce_turn_min; /** A factor is used to reduce the amount of steering while skidding. This - * is the maximum factor used (i.e. resulting in the smallest turn + * is the maximum factor used (i.e. resulting in the smallest turn * radius). */ float m_skid_reduce_turn_max; @@ -137,14 +137,14 @@ public: float getSkidVisualTime () const {return m_skid_visual_time; } // ------------------------------------------------------------------------ - /** Returns a factor to be used to determine how much the chassis of a - * kart should rotate to match the graphical view. A factor of 1 is + /** Returns a factor to be used to determine how much the chassis of a + * kart should rotate to match the graphical view. A factor of 1 is * identical, a smaller factor will rotate the kart less (which might * feel better). */ float getPostSkidRotateFactor () const {return m_post_skid_rotate_factor;} // ------------------------------------------------------------------------ - /** Returns the factor by which to recude the amount of steering while + /** Returns the factor by which to recude the amount of steering while skidding. */ float getSkidReduceTurnMin () const { return m_skid_reduce_turn_min; } // ------------------------------------------------------------------------ @@ -154,10 +154,10 @@ public: int getNumberOfBonusTimes() const { return m_skid_bonus_time.size(); } // ------------------------------------------------------------------------ /** Returns how long a kart must skid in order to reach the specified - * bonus level. + * bonus level. * param n Bonus level (0<=n > m_sounds_to_trigger; std::map > m_sounds_to_stop; std::map > m_particles_to_trigger; - + double m_duration; bool m_aborted; - + /** monkey tricks to get the animations in sync with irrlicht. we reset the time * after all is loaded and it's running withotu delays */ bool m_second_reset; double m_time_at_second_reset; - + void abortCutscene() { if (m_time < m_duration - 2.0f) m_duration = m_time + 2.0f; m_aborted = true; } - + std::vector m_parts; - + public: - + CutsceneWorld(); virtual ~CutsceneWorld(); - + virtual void init() OVERRIDE; - + // clock events virtual bool isRaceOver() OVERRIDE; virtual void terminateRace() OVERRIDE; - + void setParts(std::vector parts) { m_parts = parts; @@ -79,13 +79,13 @@ public: std::vector *info) OVERRIDE; virtual bool raceHasLaps() OVERRIDE { return false; } virtual void moveKartAfterRescue(AbstractKart* kart) OVERRIDE; - + virtual const std::string& getIdent() const OVERRIDE; - + virtual void update(float dt) OVERRIDE; virtual void createRaceGUI() OVERRIDE; - + virtual void enterRaceOverState() OVERRIDE; virtual void onFirePressed(Controller* who) OVERRIDE { abortCutscene(); } diff --git a/src/modes/demo_world.hpp b/src/modes/demo_world.hpp index 8904db2fc..23f8d46bf 100644 --- a/src/modes/demo_world.hpp +++ b/src/modes/demo_world.hpp @@ -31,7 +31,7 @@ class Kart; class DemoWorld : public ProfileWorld { private: - /** True if demo mode should be aborted, e.g. because a key was + /** True if demo mode should be aborted, e.g. because a key was * pressed. */ bool m_abort; @@ -70,7 +70,7 @@ public: // ------------------------------------------------------------------------ static void setTracks(const std::vector &tracks); // ------------------------------------------------------------------------ - /** Enables demo mode after the specified amount of time (default 1 + /** Enables demo mode after the specified amount of time (default 1 * second). * \param time The idle time after which demo mode should be started. */ static void enableDemoMode(float time=1.0f) { m_max_idle_time = time; } diff --git a/src/modes/easter_egg_hunt.hpp b/src/modes/easter_egg_hunt.hpp index 541dd6b40..11db3cef6 100755 --- a/src/modes/easter_egg_hunt.hpp +++ b/src/modes/easter_egg_hunt.hpp @@ -45,23 +45,23 @@ private: public: EasterEggHunt(); virtual ~EasterEggHunt(); - + virtual void init(); - + virtual bool isRaceOver(); - + // overriding World methods virtual void reset(); virtual bool raceHasLaps(){ return false; } virtual void moveKartAfterRescue(AbstractKart* kart); - + virtual const std::string& getIdent() const; - + virtual void update(float dt); virtual void getKartsDisplayInfo( std::vector *info); - + void updateKartRanks(); void collectedEasterEgg(const AbstractKart *kart); void readData(const std::string &filename); diff --git a/src/modes/follow_the_leader.hpp b/src/modes/follow_the_leader.hpp index 9f816cfb2..ca58e31ec 100644 --- a/src/modes/follow_the_leader.hpp +++ b/src/modes/follow_the_leader.hpp @@ -30,13 +30,13 @@ private: std::vector m_leader_intervals; // time till elimination in follow leader public: - + FollowTheLeaderRace(); virtual ~FollowTheLeaderRace(); - + // clock events virtual void countdownReachedZero() OVERRIDE; - + // overriding World methods virtual void reset() OVERRIDE; virtual const std::string& getIdent() const OVERRIDE; @@ -45,10 +45,10 @@ public: virtual void getKartsDisplayInfo( std::vector *info) OVERRIDE; virtual void init() OVERRIDE; - + virtual bool isRaceOver() OVERRIDE; virtual bool raceHasLaps() OVERRIDE { return false; } - + }; // FollowTheLeader diff --git a/src/modes/linear_world.hpp b/src/modes/linear_world.hpp index 17a2ce45f..ececb9e1d 100644 --- a/src/modes/linear_world.hpp +++ b/src/modes/linear_world.hpp @@ -40,13 +40,13 @@ private: /** Last lap sfx should only be played once. */ bool m_last_lap_sfx_played; - + bool m_last_lap_sfx_playing; /** The fastest lap time. */ float m_fastest_lap; - /** The track length returned by Track::getLength() only covers the + /** The track length returned by Track::getLength() only covers the * distance from start line to finish line, i.e. it does not include * the distance the karts actually start behind the start line (the * karts would have a negative distance till they reach the start line @@ -136,33 +136,33 @@ public: virtual void moveKartAfterRescue(AbstractKart* kart) OVERRIDE; virtual void reset() OVERRIDE; virtual void newLap(unsigned int kart_index) OVERRIDE; - - // ------------------------------------------------------------------------ + + // ------------------------------------------------------------------------ /** Returns if this race mode has laps. */ virtual bool raceHasLaps() OVERRIDE { return true; } - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ /** Returns if this race mode has bonus items. */ virtual bool haveBonusBoxes() OVERRIDE { return true; } - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ /** Override settings from base class */ virtual bool useChecklineRequirements() const OVERRIDE { return true; } - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ /** Returns true if the kart is on a valid driveline quad. * \param kart_index Index of the kart. */ - bool isOnRoad(unsigned int kart_index) const + bool isOnRoad(unsigned int kart_index) const { - return m_kart_info[kart_index].getSector()->isOnRoad(); + return m_kart_info[kart_index].getSector()->isOnRoad(); } // isOnRoad - + // ------------------------------------------------------------------------ - /** Returns the number of laps a kart has completed. + /** Returns the number of laps a kart has completed. * \param kart_index World index of the kart. */ int getKartLaps(unsigned int kart_index) const { assert(kart_index < m_kart_info.size()); return m_kart_info[kart_index].m_race_lap; } // getkartLap - + // ------------------------------------------------------------------------ /** Returns the track_sector object for the specified kart. * \param kart_index World index of the kart. */ @@ -170,9 +170,9 @@ public: { return m_kart_info[kart_index].m_current_sector; } // getTrackSector - + // ------------------------------------------------------------------------ - /** Returns how far the kart has driven so far (i.e. + /** Returns how far the kart has driven so far (i.e. * number-of-laps-finished times track-length plus distance-on-track. * \param kart_index World kart id of the kart. */ float getOverallDistance(unsigned int kart_index) const diff --git a/src/modes/overworld.hpp b/src/modes/overworld.hpp index f150fb255..8c54f0350 100644 --- a/src/modes/overworld.hpp +++ b/src/modes/overworld.hpp @@ -35,14 +35,14 @@ class OverWorld : public LinearWorld { protected: - + /** Override from base class */ virtual void createRaceGUI(); - + bool m_return_to_garage; - + void moveKartAfterRescue(AbstractKart* kart, float angle); - + btTransform getClosestStartPoint(float currentKart_x, float currentKart_z); public: @@ -50,9 +50,9 @@ public: virtual ~OverWorld(); static void enterOverWorld(); - + virtual void update(float delta) OVERRIDE; - + // ------------------------------------------------------------------------ /** Returns if this race mode has laps. */ virtual bool raceHasLaps() OVERRIDE { return false; } @@ -63,7 +63,7 @@ public: virtual bool isRaceOver() OVERRIDE { return false; } // ------------------------------------------------------------------------ /** Implement base class method */ - virtual const std::string& + virtual const std::string& getIdent() const OVERRIDE { return IDENT_OVERWORLD; } // ------------------------------------------------------------------------ /** Override base class method */ diff --git a/src/modes/profile_world.hpp b/src/modes/profile_world.hpp index 080dd9e15..bc05260d9 100644 --- a/src/modes/profile_world.hpp +++ b/src/modes/profile_world.hpp @@ -59,7 +59,7 @@ private: long long m_num_solid; /** Number of transparent triangles drawn. */ - long long m_num_transparent; + long long m_num_transparent; /** Number of transparent effect triangles drawn. */ long long m_num_trans_effect; diff --git a/src/modes/soccer_world.hpp b/src/modes/soccer_world.hpp index 148fe2445..06aa1bcf1 100644 --- a/src/modes/soccer_world.hpp +++ b/src/modes/soccer_world.hpp @@ -41,22 +41,22 @@ private: /** Number of goals each team scored */ int m_team_goals[NB_SOCCER_TEAMS]; - + /** Whether or not goals can be scored (they are disabled when a point is scored and re-enabled when the next game can be played)*/ bool m_can_score_points; - + public: - + SoccerWorld(); virtual ~SoccerWorld() {} - + virtual void init(); - + // clock events virtual bool isRaceOver(); virtual void terminateRace(); - + // overriding World methods virtual void reset(); @@ -65,13 +65,13 @@ public: std::vector *info); virtual bool raceHasLaps(){ return false; } virtual void moveKartAfterRescue(AbstractKart* kart); - + virtual const std::string& getIdent() const; - + virtual void update(float dt); void onCheckGoalTriggered(bool first_goal); - + private: void initKartList(); }; // SoccerWorld diff --git a/src/modes/standard_race.hpp b/src/modes/standard_race.hpp index 49838331e..b37f24a7d 100644 --- a/src/modes/standard_race.hpp +++ b/src/modes/standard_race.hpp @@ -34,9 +34,9 @@ protected: public: StandardRace(); virtual ~StandardRace() {}; - + // overriding World methods - virtual void getDefaultCollectibles(int *collectible_type, + virtual void getDefaultCollectibles(int *collectible_type, int *amount) OVERRIDE; virtual bool haveBonusBoxes() OVERRIDE; virtual const std::string& getIdent() const OVERRIDE; diff --git a/src/modes/three_strikes_battle.hpp b/src/modes/three_strikes_battle.hpp index 267694333..276dcc468 100644 --- a/src/modes/three_strikes_battle.hpp +++ b/src/modes/three_strikes_battle.hpp @@ -43,21 +43,21 @@ private: { int m_lives; }; - + /** This vector contains an 'BattleInfo' struct for every kart in the race. */ std::vector m_kart_info; /** The mesh of the tire which is displayed when a kart loses a life. */ irr::scene::IMesh* m_tire; - - /** Indicates the number of tires that should be + + /** Indicates the number of tires that should be * inserted into the track. */ int m_insert_tire; - + /** For tires that are blown away. */ core::vector3df m_tire_position; - + /** The original locations of the tires of a kart. */ core::vector3df m_tire_offsets[4]; @@ -71,9 +71,9 @@ private: float m_tire_rotation; PtrVector m_tires; - + public: - + /** Used to show a nice graph when battle is over */ struct BattleEvent { @@ -81,16 +81,16 @@ public: std::vector m_kart_info; }; std::vector m_battle_events; - + ThreeStrikesBattle(); virtual ~ThreeStrikesBattle(); - + virtual void init(); - + // clock events virtual bool isRaceOver(); virtual void terminateRace(); - + // overriding World methods virtual void reset(); @@ -100,15 +100,15 @@ public: std::vector *info); virtual bool raceHasLaps(){ return false; } virtual void moveKartAfterRescue(AbstractKart* kart); - + virtual const std::string& getIdent() const; - + virtual void kartHit(const unsigned int kart_id); virtual void update(float dt); - + virtual void kartAdded(AbstractKart* kart, scene::ISceneNode* node); - + void updateKartRanks(); }; // ThreeStrikesBattles diff --git a/src/modes/tutorial_world.hpp b/src/modes/tutorial_world.hpp index 22d09dac8..35be6fea9 100644 --- a/src/modes/tutorial_world.hpp +++ b/src/modes/tutorial_world.hpp @@ -11,7 +11,7 @@ private: public: TutorialWorld(); - + virtual void moveKartAfterRescue(AbstractKart* kart) OVERRIDE; }; diff --git a/src/modes/world.hpp b/src/modes/world.hpp index 075e5e594..ad61fc7b8 100644 --- a/src/modes/world.hpp +++ b/src/modes/world.hpp @@ -45,11 +45,11 @@ namespace irr namespace scene { class ISceneNode; } } -/** +/** * \brief base class for all game modes * This class is responsible for running the actual race. A world is created * by the race manager on the start of each race (so a new world is created - * for each race of a Grand Prix). It creates the + * for each race of a Grand Prix). It creates the * physics, loads the track, creates all karts, and initialises the race * specific managers (ItemManager, ProjectilManager, highscores, ...). * It uses the information from the race manager to get information like @@ -98,13 +98,13 @@ protected: * True by default, change to false in a child class to disable. */ bool m_use_highscores; - - void updateHighscores (int* best_highscore_rank, int* best_finish_time, + + void updateHighscores (int* best_highscore_rank, int* best_finish_time, std::string* highscore_who, StateManager::ActivePlayer** best_player); void resetAllKarts (); void eliminateKart (int kart_number, bool notifyOfElimination=true); - Controller* + Controller* loadAIController (AbstractKart *kart); virtual AbstractKart *createKart(const std::string &kart_ident, int index, @@ -116,7 +116,7 @@ protected: /** Pointer to the race GUI. The race GUI is handled by world. */ RaceGUIBase *m_race_gui; - /** The actual race gui needs to be saved when the race result gui is + /** The actual race gui needs to be saved when the race result gui is displayed since it is still needed in case of a restart, and it can't simply be created again (since it assumes that it can render to texture without having any scene nodes, but in case of a restart @@ -124,34 +124,34 @@ protected: RaceGUIBase *m_saved_race_gui; bool m_clear_back_buffer; - + irr::video::SColor m_clear_color; - - /** Pausing/unpausing are not done immediately, but at next udpdate. The - * use of this is when switching between screens : if we leave a screen - * that paused the game, only to go to another screen that pauses back - * the game, this mechanism prevents the game from moving on between + + /** Pausing/unpausing are not done immediately, but at next udpdate. The + * use of this is when switching between screens : if we leave a screen + * that paused the game, only to go to another screen that pauses back + * the game, this mechanism prevents the game from moving on between * the switch. */ bool m_schedule_pause; - + /** Pausing/unpausing are not done immediately, but at next udpdate. The - * use of this is when switching between screens : if we leave a screen - * that paused the game, only to go to another screen that pauses back + * use of this is when switching between screens : if we leave a screen + * that paused the game, only to go to another screen that pauses back * the game, this mechanism prevents the game from moving on between the * switch. */ bool m_schedule_unpause; - + bool m_schedule_exit_race; - + bool m_schedule_tutorial; - + Phase m_scheduled_pause_phase; - + /** Set when the world needs to be deleted but you can't do it immediately * because you are e.g. within World::update() */ bool m_self_destruct; - + virtual void onGo(); /** Returns true if the race is over. Must be defined by all modes. */ virtual bool isRaceOver() = 0; @@ -161,15 +161,15 @@ protected: // ------------------------------------------------------------------------ /** Used for AI karts that are still racing when all player kart finished. * Generally it should estimate the arrival time for those karts, but as - * a default (useful for battle mode and ftl races) we just use the - * current time for this (since this is a good value for karts still + * a default (useful for battle mode and ftl races) we just use the + * current time for this (since this is a good value for karts still * around at the end of a race, and other criteria (number of lives, * race position) will be used to determine the final order. */ virtual float estimateFinishTimeForKart(AbstractKart* kart) {return getTime(); } - + public: World(); virtual ~World(); @@ -179,11 +179,11 @@ public: /** Returns a pointer to the (singleton) world object. */ static World* getWorld() { return m_world; } // ------------------------------------------------------------------------ - /** Delete the )singleton) world object, if it exists, and sets the - * singleton pointer to NULL. It's harmless to call this if the world + /** Delete the )singleton) world object, if it exists, and sets the + * singleton pointer to NULL. It's harmless to call this if the world * has been deleted already. */ static void deleteWorld() { delete m_world; m_world = NULL; } - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ /** Sets the pointer to the world object. This is only used by * the race_manager.*/ static void setWorld(World *world) {m_world = world; } @@ -194,15 +194,15 @@ public: /** Each game mode should have a unique identifier. Override * this method in child classes to provide it. */ - virtual const std::string& + virtual const std::string& getIdent() const = 0; - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ /** Since each mode will have a different way of deciding where a rescued - * kart is dropped, this method will be called and each mode can implement + * kart is dropped, this method will be called and each mode can implement * it. */ virtual void moveKartAfterRescue(AbstractKart* kart) = 0; - // ------------------------------------------------------------------------ - /** Called when it is needed to know whether this kind of race involves + // ------------------------------------------------------------------------ + /** Called when it is needed to know whether this kind of race involves * counting laps. */ virtual bool raceHasLaps() = 0; // ------------------------------------------------------------------------ @@ -226,7 +226,7 @@ public: virtual void reset(); virtual void pause(Phase phase) OVERRIDE; virtual void unpause() OVERRIDE; - virtual void getDefaultCollectibles(int *collectible_type, + virtual void getDefaultCollectibles(int *collectible_type, int *amount ); virtual void endRaceEarly() { return; } @@ -236,12 +236,12 @@ public: // ------------------------------------------------------------------------ /** Returns if this mode should use fast music (if available). */ virtual bool useFastMusicNearEnd() const { return true; } - // ------------------------------------------------------------------------ - /** If you want to do something to karts or their graphics at the start + // ------------------------------------------------------------------------ + /** If you want to do something to karts or their graphics at the start * of the race, override this. */ virtual void kartAdded(AbstractKart* kart, scene::ISceneNode* node) {} - // ------------------------------------------------------------------------ - /** Called whenever a kart starts a new lap. Meaningless (and won't be + // ------------------------------------------------------------------------ + /** Called whenever a kart starts a new lap. Meaningless (and won't be * called) in non-laped races. */ virtual void newLap(unsigned int kart_index) {} @@ -293,7 +293,7 @@ public: * whether the game mode wants a timer drawn. */ virtual bool shouldDrawTimer() const { return isRacePhase() && getClockMode() != CLOCK_NONE; } - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ /** \return whether this world can generate/have highscores */ bool useHighScores() const { return m_use_highscores; } // ------------------------------------------------------------------------ @@ -304,10 +304,10 @@ public: const irr::video::SColor& getClearColor() const { return m_clear_color; } // ------------------------------------------------------------------------ /** Sets the color to use when clearing the back buffer. */ - void setClearbackBufferColor(irr::video::SColor color) - { - m_clear_color = color; - m_clear_back_buffer = true; + void setClearbackBufferColor(irr::video::SColor color) + { + m_clear_color = color; + m_clear_back_buffer = true; } // ------------------------------------------------------------------------ /** Override if you want to know when a kart presses fire */ @@ -320,7 +320,7 @@ public: void delayedSelfDestruct(); // ------------------------------------------------------------------------ virtual void escapePressed(); - + }; // World #endif diff --git a/src/modes/world_status.hpp b/src/modes/world_status.hpp index 2f21fff0f..5a255cfc7 100644 --- a/src/modes/world_status.hpp +++ b/src/modes/world_status.hpp @@ -87,7 +87,7 @@ protected: SFXBase *m_prestart_sound; /** The third sound to be played in ready, set, go. */ SFXBase *m_start_sound; - + /** * Elasped/remaining time in seconds */ @@ -113,7 +113,7 @@ private: public: WorldStatus(); virtual ~WorldStatus(); - + void reset(); void update(const float dt); void setTime(const float time); @@ -121,12 +121,12 @@ public: virtual void unpause(); virtual void enterRaceOverState(); virtual void terminateRace(); - + // ------------------------------------------------------------------------ // Note: GO_PHASE is both: start phase and race phase bool isStartPhase() const { return m_phase=GO_PHASE && + bool isRacePhase() const { return m_phase>=GO_PHASE && m_phase m_position_used; - /** True if beginSetKartPositions was called, false after + /** True if beginSetKartPositions was called, false after * endSetKartPositions. Used to make sure the sequence of calls * is correct. */ bool m_position_setting_initialised; @@ -59,7 +59,7 @@ public: virtual void init(); bool displayRank() const { return m_display_rank; } - + void beginSetKartPositions(); bool setKartPosition(unsigned int kart_id, unsigned int position); diff --git a/src/network/character_confirm_message.hpp b/src/network/character_confirm_message.hpp index 7a3ccdd6b..527794928 100644 --- a/src/network/character_confirm_message.hpp +++ b/src/network/character_confirm_message.hpp @@ -24,10 +24,10 @@ #include "network/message.hpp" -/** This message is from the server to all clients to inform them about a +/** This message is from the server to all clients to inform them about a * newly selected character. This means that this character is not available * anymore. The message contains the hostid of the client who selected this - * character (0 in case of server), so that this message acts as a + * character (0 in case of server), so that this message acts as a * confirmation for the corresponding client (or a reject if the message has * a different hostid, meaning that another client selected the character * earlier). @@ -45,7 +45,7 @@ public: * \param host_id Id of the host who selected this character. */ CharacterConfirmMessage(const std::string &kart_name, int host_id) - : Message(Message::MT_CHARACTER_CONFIRM) + : Message(Message::MT_CHARACTER_CONFIRM) { allocate(getStringLength(kart_name) + getCharLength()); addString(kart_name); @@ -53,7 +53,7 @@ public: } // CharacterConfirmMessage // ------------------------------------------------------------------------ - /** Unpacks a character confirm message. + /** Unpacks a character confirm message. * \param pkt Received enet packet. */ CharacterConfirmMessage(ENetPacket* pkt):Message(pkt, MT_CHARACTER_CONFIRM) diff --git a/src/network/character_info_message.hpp b/src/network/character_info_message.hpp index 93b4130ea..443a2d670 100644 --- a/src/network/character_info_message.hpp +++ b/src/network/character_info_message.hpp @@ -29,7 +29,7 @@ class CharacterInfoMessage : public Message { // Add the remote host id to this message (to avoid sending this separately) public: - CharacterInfoMessage(int hostid) : Message(Message::MT_CHARACTER_INFO) + CharacterInfoMessage(int hostid) : Message(Message::MT_CHARACTER_INFO) { std::vector all_karts = kart_properties_manager->getAllAvailableKarts(); diff --git a/src/network/character_selected_message.hpp b/src/network/character_selected_message.hpp index 8610375f2..9e8a61961 100644 --- a/src/network/character_selected_message.hpp +++ b/src/network/character_selected_message.hpp @@ -34,7 +34,7 @@ class CharacterSelectedMessage : public Message { private: /** Number of local players on a host. If the message is send from the - * server to the clients, this field instead contains the host id of + * server to the clients, this field instead contains the host id of * the host which selected the kart */ int m_num_local_players; @@ -43,7 +43,7 @@ private: public: /** Contains information about a selected kart. When send from the client - * to the server, it contains the number of local players (which + * to the server, it contains the number of local players (which * technically needs only to be sent once); when send from from the server * to the clients this field instead contains the host id of the host * selected the character. This allows the client to detect if a selected @@ -54,8 +54,8 @@ public: * used in the message instead of the number of local * players. */ - CharacterSelectedMessage(int player_id, int host_id=-1) - : Message(Message::MT_CHARACTER_INFO) + CharacterSelectedMessage(int player_id, int host_id=-1) + : Message(Message::MT_CHARACTER_INFO) { m_kart_info = race_manager->getLocalKartInfo(player_id); m_num_local_players = race_manager->getNumLocalPlayers(); @@ -67,7 +67,7 @@ public: addChar(m_kart_info.getLocalPlayerId()); addString(m_kart_info.getKartName()); addString(core::stringc(m_kart_info.getPlayerName().c_str()).c_str()); // FIXME: encoding issues - // Piggy backing this information saves sending it as a separate + // Piggy backing this information saves sending it as a separate // message. It is actually only required in the first message if(host_id>-1) addChar(host_id); diff --git a/src/network/flyable_info.hpp b/src/network/flyable_info.hpp index 28495d0a0..eedc33585 100644 --- a/src/network/flyable_info.hpp +++ b/src/network/flyable_info.hpp @@ -22,7 +22,7 @@ #include "network/message.hpp" /** Class used to transfer information about projectiles from server to client. - * It contains only the coordinates, rotation, and explosion state. + * It contains only the coordinates, rotation, and explosion state. */ class FlyableInfo { @@ -31,13 +31,13 @@ public: btQuaternion m_rotation; /** Orientation of object */ bool m_exploded; /** If the object exploded in the current frame. */ - /** Constructor to initialise all fields. + /** Constructor to initialise all fields. */ FlyableInfo(const Vec3& xyz, const btQuaternion &rotation, bool exploded) : m_xyz(xyz), m_rotation(rotation), m_exploded(exploded) {}; // ------------------------------------------------------------------------ - /** Allow this object to be stored in std::vector fields. + /** Allow this object to be stored in std::vector fields. */ FlyableInfo() {}; // ------------------------------------------------------------------------ diff --git a/src/network/item_info.hpp b/src/network/item_info.hpp index 5988640fe..0334e2ee0 100644 --- a/src/network/item_info.hpp +++ b/src/network/item_info.hpp @@ -38,7 +38,7 @@ public: /** Constructor to initialise all fields. */ ItemInfo(int kart, int item, char add_info) : m_kart_id(kart), m_item_id(item), - m_add_info(add_info) + m_add_info(add_info) {} // ------------------------------------------------------------- /** Construct ItemInfo from a message (which is unpacked). */ diff --git a/src/network/kart_control_message.hpp b/src/network/kart_control_message.hpp index bca03d4cd..6127f62b9 100644 --- a/src/network/kart_control_message.hpp +++ b/src/network/kart_control_message.hpp @@ -25,7 +25,7 @@ class KartControlMessage : public Message { public: KartControlMessage(); - KartControlMessage(ENetPacket* pkt, int kart_id_offset, + KartControlMessage(ENetPacket* pkt, int kart_id_offset, int num_local_players); }; // KartUpdateMessage #endif diff --git a/src/network/message.hpp b/src/network/message.hpp index 9413f2351..ee0c49dfe 100644 --- a/src/network/message.hpp +++ b/src/network/message.hpp @@ -31,19 +31,19 @@ using std::memcpy; #include "utils/vec3.hpp" -// sjl: when a message is received, need to work out what kind of message it +// sjl: when a message is received, need to work out what kind of message it // is and therefore what to do with it -/** Base class to serialises/deserialises messages. +/** Base class to serialises/deserialises messages. * This is the base class for all messages being exchange between client * and server. It handles the interface to enet, and adds a message type - * (which is checked via an assert to help finding bugs by receiving a + * (which is checked via an assert to help finding bugs by receiving a * message of an incorrect type). It also takes care of endianess (though - * floats are converted via a byte swap, too - so it must be guaranteed + * floats are converted via a byte swap, too - so it must be guaranteed * that the float representation between all machines is identical). */ class Message -{ +{ public: /** Contains all tags used in identifying a message. */ enum MessageType {MT_CONNECT=1, MT_CHARACTER_INFO, MT_CHARACTER_CONFIRM, @@ -62,31 +62,31 @@ private: public: void addInt(int data); void addShort(short data); - void addString(const std::string &data); + void addString(const std::string &data); void addStringVector(const std::vector& vs); void addUInt(unsigned int data) { addInt(*(int*)&data); } - void addFloat(const float data); + void addFloat(const float data); void addBool(bool data) { addChar(data?1:0); } void addChar(char data) { addCharArray((char*)&data,1);} - void addCharArray(char *c, unsigned int n=1) + void addCharArray(char *c, unsigned int n=1) { assert((int)(m_pos+n)<=m_data_size); memcpy(m_data+m_pos,c,n); m_pos+=n; } #ifndef WIN32 // on windows size_t is unsigned int void addSizeT(size_t data) { addInt((int)data); } #endif - void addIntArray(int *d, unsigned int n) - { for(unsigned int i=0; + void addIntArray(int *d, unsigned int n) + { for(unsigned int i=0; i-1); return m_pkt; } /** Return the type of a message without unserialising the message */ - static MessageType peekType(ENetPacket *pkt) + static MessageType peekType(ENetPacket *pkt) { return (MessageType)pkt->data[0];} }; // Message diff --git a/src/network/network_kart.hpp b/src/network/network_kart.hpp index 3bb7e926f..892439a24 100644 --- a/src/network/network_kart.hpp +++ b/src/network/network_kart.hpp @@ -28,7 +28,7 @@ class NetworkKart : public Kart private: int m_global_player_id; // to identify this kart to the network manager public: - NetworkKart(const std::string& kart_name, unsigned int world_kart_id, + NetworkKart(const std::string& kart_name, unsigned int world_kart_id, int position, const btTransform& init_transform, int global_player_id, RaceManager::KartType type); void setControl(const KartControl& kc); diff --git a/src/network/network_manager.hpp b/src/network/network_manager.hpp index b462564d0..83d55f556 100644 --- a/src/network/network_manager.hpp +++ b/src/network/network_manager.hpp @@ -67,7 +67,7 @@ private: ENetHost *m_host; // me ENetPeer *m_server; // (clients only) - std::vector m_clients; // (server only) pos in vector is client host_id + std::vector m_clients; // (server only) pos in vector is client host_id /** Name of the kart that a client is waiting for confirmation for. */ std::string m_kart_to_confirm; @@ -95,7 +95,7 @@ public: int getMyHostId() const {return m_host_id; } void setHostId(int host_id) {m_host_id = host_id; } unsigned int getNumClients() const {return m_num_clients; } - const std::string& + const std::string& getClientName(int i) const {return m_client_names[i];} bool initialiseConnections(); void update(float dt); diff --git a/src/network/race_start_message.hpp b/src/network/race_start_message.hpp index 5134bba37..eac2d7594 100644 --- a/src/network/race_start_message.hpp +++ b/src/network/race_start_message.hpp @@ -28,7 +28,7 @@ class RaceStartMessage : public Message private: // For now this is an empty message public: - RaceStartMessage() : Message(Message::MT_RACE_START) + RaceStartMessage() : Message(Message::MT_RACE_START) { allocate(0); } // RaceStartMessage diff --git a/src/network/race_state.hpp b/src/network/race_state.hpp index b69ca01f1..bf3fce064 100644 --- a/src/network/race_state.hpp +++ b/src/network/race_state.hpp @@ -31,7 +31,7 @@ #include "network/message.hpp" #include "utils/aligned_array.hpp" -/** This class stores the state information of a (single) race, e.g. the +/** This class stores the state information of a (single) race, e.g. the position and orientation of karts, collisions that have happened etc. It is used for the network version to update the clients with the 'official' state information from the server. @@ -49,10 +49,10 @@ private: /** Collision information. This vector stores information about which * kart collided with which kart or track (kartid=-1) */ std::vector m_collision_info; - + public: /** Initialise the global race state. */ - RaceState() : Message(MT_RACE_STATE) + RaceState() : Message(MT_RACE_STATE) { m_kart_controls.resize(World::getWorld()->getNumKarts()); } // RaceState() @@ -65,8 +65,8 @@ private: /** Collects information about collision in which at least one kart was * involved. Other collision (e.g. projectiles, moving physics) are * not needed on the client, so it's not stored at all. If a kart - * track collision happens, the second kart id is -1 (necessary to - * play back sound effects). A simple int vector is used to store the + * track collision happens, the second kart id is -1 (necessary to + * play back sound effects). A simple int vector is used to store the * pair of collision, so the first collision is using the index 0 and * 1; the second one 2 and 3 etc. * \param kartId1 World id of the kart involved in the collision. @@ -86,11 +86,11 @@ private: m_flyable_info[n] = fi; } // -------------------------------------------------------------------- - /** Stores the current kart control (at the time kart->update() is + /** Stores the current kart control (at the time kart->update() is * called. This allows modifications of kart->m_control during the * update (e.g. see in kart::update() how firing is handled). */ - void storeKartControls(const AbstractKart& kart) + void storeKartControls(const AbstractKart& kart) { m_kart_controls[kart.getWorldKartId()] = kart.getControls(); } // storeKartControls @@ -99,7 +99,7 @@ private: void receive(ENetPacket *pkt); void clear(); // Removes all currently stored information unsigned int getNumFlyables() const {return m_flyable_info.size(); } - const FlyableInfo + const FlyableInfo &getFlyable(unsigned int i) const {return m_flyable_info[i];} }; // RaceState diff --git a/src/network/remote_kart_info.hpp b/src/network/remote_kart_info.hpp index f3146296d..507458d08 100644 --- a/src/network/remote_kart_info.hpp +++ b/src/network/remote_kart_info.hpp @@ -40,15 +40,15 @@ class RemoteKartInfo SoccerTeam m_soccer_team; public: - RemoteKartInfo(int player_id, const std::string& kart_name, + RemoteKartInfo(int player_id, const std::string& kart_name, const irr::core::stringw& user_name, int host_id) - : m_kart_name(kart_name), m_user_name(user_name), + : m_kart_name(kart_name), m_user_name(user_name), m_local_player_id(player_id), m_host_id(host_id), m_soccer_team(SOCCER_TEAM_NONE) {}; RemoteKartInfo(const std::string& kart_name) {m_kart_name=kart_name; m_user_name=""; m_host_id=-1; m_local_player_id=-1;} - RemoteKartInfo() {m_kart_name=""; m_user_name=""; + RemoteKartInfo() {m_kart_name=""; m_user_name=""; m_host_id=-1; m_local_player_id=-1;} void setKartName(const std::string& n) { m_kart_name = n; } void setPlayerName(const irr::core::stringw& u) { m_user_name = u; } @@ -56,14 +56,14 @@ public: void setLocalPlayerId(int id) { m_local_player_id = id; } void setGlobalPlayerId(int id) { m_global_player_id = id; } void setSoccerTeam(SoccerTeam team) { m_soccer_team = team; } - + int getHostId() const { return m_host_id; } int getLocalPlayerId() const { return m_local_player_id; } int getGlobalPlayerId() const { return m_global_player_id; } const std::string& getKartName() const { return m_kart_name; } const irr::core::stringw& getPlayerName() const { return m_user_name; } const SoccerTeam getSoccerTeam() const {return m_soccer_team; } - + bool operator<(const RemoteKartInfo& other) const { return ((m_host_idis(UserPointer::UP_KART) && b->is(UserPointer::UP_KART) && a>b) { @@ -85,15 +85,15 @@ private: return (p.m_up[0]==m_up[0] && p.m_up[1]==m_up[1]); } // operator== // -------------------------------------------------------------------- - const UserPointer *getUserPointer(unsigned int n) const + const UserPointer *getUserPointer(unsigned int n) const { assert(n>=0 && n<=1); return m_up[n]; } // getUserPointer // -------------------------------------------------------------------- - /** Returns the contact point of the collision in + /** Returns the contact point of the collision in * car (local) coordinates. */ - const Vec3 &getContactPointCS(unsigned int n) const + const Vec3 &getContactPointCS(unsigned int n) const { assert(n>=0 && n<=1); return m_contact_point[n]; @@ -103,7 +103,7 @@ private: // ======================================================================== // This class is the list of collision objects, where each collision // pair is stored as most once. - class CollisionList : public std::vector + class CollisionList : public std::vector { private: void push_back(CollisionPair p) { @@ -143,7 +143,7 @@ private: btCollisionDispatcher *m_dispatcher; btBroadphaseInterface *m_axis_sweep; btDefaultCollisionConfiguration *m_collision_conf; - CollisionList m_all_collisions; + CollisionList m_all_collisions; public: Physics (); diff --git a/src/physics/stk_dynamics_world.hpp b/src/physics/stk_dynamics_world.hpp index ce61fe4fe..5be3db306 100644 --- a/src/physics/stk_dynamics_world.hpp +++ b/src/physics/stk_dynamics_world.hpp @@ -28,7 +28,7 @@ public: STKDynamicsWorld(btDispatcher* dispatcher, btBroadphaseInterface* pairCache, btConstraintSolver* constraintSolver, - btCollisionConfiguration* collisionConfiguration) + btCollisionConfiguration* collisionConfiguration) : btDiscreteDynamicsWorld(dispatcher, pairCache, constraintSolver, @@ -36,7 +36,7 @@ public: { } - /** Resets m_localTime to 0. This allows more precise replay of + /** Resets m_localTime to 0. This allows more precise replay of * physics, which is important for replaying histories. */ virtual void resetLocalTime() { m_localTime = 0; } diff --git a/src/physics/triangle_mesh.hpp b/src/physics/triangle_mesh.hpp index fddeca06f..9a2978ef5 100644 --- a/src/physics/triangle_mesh.hpp +++ b/src/physics/triangle_mesh.hpp @@ -27,7 +27,7 @@ class Material; -/** +/** * \brief A special class to store a triangle mesh with a separate material per triangle. * \ingroup physics */ @@ -47,7 +47,7 @@ private: public: TriangleMesh(); ~TriangleMesh(); - void addTriangle(const btVector3 &t1, const btVector3 &t2, + void addTriangle(const btVector3 &t1, const btVector3 &t2, const btVector3 &t3, const btVector3 &n1, const btVector3 &n2, const btVector3 &n3, const Material* m); @@ -60,20 +60,20 @@ public: btVector3 getInterpolatedNormal(unsigned int index, const btVector3 &position) const; // ------------------------------------------------------------------------ - const Material* getMaterial(int n) const + const Material* getMaterial(int n) const {return m_triangleIndex2Material[n];} // ------------------------------------------------------------------------ - const btCollisionShape &getCollisionShape() const + const btCollisionShape &getCollisionShape() const { return *m_collision_shape; } // ------------------------------------------------------------------------ btCollisionShape &getCollisionShape() { return *m_collision_shape; } // ------------------------------------------------------------------------ bool castRay(const btVector3 &from, const btVector3 &to, - btVector3 *xyz, const Material **material, + btVector3 *xyz, const Material **material, btVector3 *normal=NULL) const; // ------------------------------------------------------------------------ /** Returns the points of the 'indx' triangle. - * \param indx Index of the triangle to get. + * \param indx Index of the triangle to get. * \param p1,p2,p3 On return the three points of the triangle. */ void getTriangle(unsigned int indx, btVector3 *p1, btVector3 *p2, btVector3 *p3) const diff --git a/src/race/grand_prix_data.hpp b/src/race/grand_prix_data.hpp index 039886182..2004bef9c 100644 --- a/src/race/grand_prix_data.hpp +++ b/src/race/grand_prix_data.hpp @@ -42,9 +42,9 @@ class GrandPrixData /** Original filename, only for error handling needed. */ std::string m_filename; - + /** The ident of the tracks in this grand prix in their right order, ident - * means the filename of the .track file without .track extension + * means the filename of the .track file without .track extension * (ie. 'volcano'). */ std::vector m_tracks; @@ -56,7 +56,7 @@ class GrandPrixData * nolok is unlocked, Fort Magma is available, otherwise not). * Mark this member mutable so that getTrackNames can be const. */ mutable std::vector m_really_available_tracks; - + /** The number of laps that each track should be raced, in the right order */ std::vector m_laps; @@ -72,21 +72,21 @@ public: #endif GrandPrixData (const std::string filename) throw(std::logic_error); GrandPrixData () {}; // empty for initialising - + bool checkConsistency(bool chatty=true) const; const std::vector& getTrackNames() const; void getLaps(std::vector *laps) const; void getReverse(std::vector *reverse) const; // ------------------------------------------------------------------------ - /** @return the (potentially translated) user-visible name of the Grand + /** @return the (potentially translated) user-visible name of the Grand * Prix (apply fribidi as needed) */ const irr::core::stringw getName() const { return _LTR(m_name.c_str()); } // ------------------------------------------------------------------------ /** @return the internal name identifier of the Grand Prix (not translated) */ const std::string& getId() const { return m_id; } - + // ------------------------------------------------------------------------ /** Returns the filename of the grand prix xml file. */ const std::string& getFilename() const { return m_filename; } diff --git a/src/race/highscore_manager.hpp b/src/race/highscore_manager.hpp index 271936a27..128277bd2 100644 --- a/src/race/highscore_manager.hpp +++ b/src/race/highscore_manager.hpp @@ -38,7 +38,7 @@ private: static const unsigned int CURRENT_HSCORE_FILE_VERSION = 3; typedef std::vector type_all_scores; type_all_scores m_all_scores; - + std::string m_filename; bool m_can_write; @@ -50,9 +50,9 @@ public: ~HighscoreManager(); void saveHighscores(); Highscores *getHighscores(const Highscores::HighscoreType highscore_type, - int num_karts, - const RaceManager::Difficulty difficulty, - const std::string trackName, + int num_karts, + const RaceManager::Difficulty difficulty, + const std::string trackName, const int number_of_laps, const bool reverse); }; // HighscoreManager diff --git a/src/race/highscores.hpp b/src/race/highscores.hpp index 51f8e5394..0e31b6904 100644 --- a/src/race/highscores.hpp +++ b/src/race/highscores.hpp @@ -38,7 +38,7 @@ class Highscores { public: typedef std::string HighscoreType; - + private: enum {HIGHSCORE_LEN = 3}; // It's a top 3 list std::string m_track; @@ -54,17 +54,17 @@ public: /** Creates a new entry */ Highscores (const Highscores::HighscoreType highscore_type, - int num_karts, const RaceManager::Difficulty difficulty, + int num_karts, const RaceManager::Difficulty difficulty, const std::string trackName, const int number_of_laps, const bool reverse); /** Creates an entry from a file */ Highscores (const XMLNode &node); - + void readEntry (const XMLNode &node); void writeEntry(XMLWriter &writer); int matches (HighscoreType highscore_type, int num_karts, - const RaceManager::Difficulty difficulty, + const RaceManager::Difficulty difficulty, const std::string track, const int number_of_laps, const bool reverse); int addData (const std::string& kart_name, diff --git a/src/race/history.hpp b/src/race/history.hpp index 9bdd19b30..22aa430ed 100644 --- a/src/race/history.hpp +++ b/src/race/history.hpp @@ -103,7 +103,7 @@ public: /** Enable replaying a history, enabled from the command line. */ void doReplayHistory(HistoryReplayMode m) {m_replay_mode = m; } // ------------------------------------------------------------------------ - /** Returns true if the physics should not be simulated in replay mode. + /** Returns true if the physics should not be simulated in replay mode. * I.e. either no replay mode, or physics replay mode. */ bool dontDoPhysics () const { return m_replay_mode == HISTORY_POSITION;} }; diff --git a/src/race/race_manager.hpp b/src/race/race_manager.hpp index eb7fb23a1..cc6bc07dd 100644 --- a/src/race/race_manager.hpp +++ b/src/race/race_manager.hpp @@ -47,7 +47,7 @@ static const std::string IDENT_SOCCER ("SOCCER" ); static const std::string IDENT_OVERWORLD("OVERWORLD" ); static const std::string IDENT_CUSTSCENE("CUTSCENE" ); -/** +/** * The race manager has two functions: * 1) it stores information about the race the user selected (e.g. number * of karts, track, race mode etc.). Most of the values are just stored @@ -57,8 +57,8 @@ static const std::string IDENT_CUSTSCENE("CUTSCENE" ); * the GrandPrix object), and local player information (number of local * players, and selected karts). The local player information is read * from the NetworkManager, gathered on the server (from all clients and - * the server, see NetworkManager::setupPlayerKartInfo), and then the - * combined information distributed to all RaceManagers in all clients + * the server, see NetworkManager::setupPlayerKartInfo), and then the + * combined information distributed to all RaceManagers in all clients * and server. Even in no networking mode, the data flow is the same: * information about local players is stored here, then processed by * NetworkManager::setupPlayerKartInfo and the 'global' information about @@ -90,9 +90,9 @@ public: MAJOR_MODE_GRAND_PRIX, MAJOR_MODE_SINGLE }; - + // quick method to tell the difference between battle modes and race modes - // think of it like a bitmask, but done in decimal to avoid endianness + // think of it like a bitmask, but done in decimal to avoid endianness // issues #define LINEAR_RACE(ID, COUNT_LAPSES) (1000+ID+100*COUNT_LAPSES) #define BATTLE_ARENA(ID) (2000+ID) @@ -104,13 +104,13 @@ public: enum MinorRaceModeType { MINOR_MODE_NONE = -1, - + MINOR_MODE_NORMAL_RACE = LINEAR_RACE(0, true), MINOR_MODE_TIME_TRIAL = LINEAR_RACE(1, true), MINOR_MODE_FOLLOW_LEADER = LINEAR_RACE(2, false), MINOR_MODE_OVERWORLD = LINEAR_RACE(3, false), MINOR_MODE_TUTORIAL = LINEAR_RACE(4, false), - + MINOR_MODE_3_STRIKES = BATTLE_ARENA(0), MINOR_MODE_SOCCER = BATTLE_ARENA(1), MINOR_MODE_CUTSCENE = BATTLE_ARENA(2), @@ -125,7 +125,7 @@ public: SUPERPOWER_NONE = 0, SUPERPOWER_NOLOK_BOSS = 1 }; - + // ------------------------------------------------------------------------ /** Returns a string identifier for each minor race mode. * \param mode Minor race mode. @@ -140,14 +140,14 @@ public: case MINOR_MODE_3_STRIKES: return IDENT_STRIKES; case MINOR_MODE_EASTER_EGG: return IDENT_EASTER; case MINOR_MODE_SOCCER: return IDENT_SOCCER; - default: assert(false); + default: assert(false); return IDENT_STD; // stop compiler warning } } // getIdentOf - + // ------------------------------------------------------------------------ - /** Returns the icon for a minor race mode. - * \param mode Minor race mode. + /** Returns the icon for a minor race mode. + * \param mode Minor race mode. */ static const char* getIconOf(const MinorRaceModeType mode) { @@ -186,7 +186,7 @@ public: default: assert(false); return NULL; } } - + // ------------------------------------------------------------------------ static bool hasAI(const MinorRaceModeType mode) { @@ -201,8 +201,8 @@ public: default: assert(false); return NULL; } } - - + + // ------------------------------------------------------------------------ /** Returns the minor mode id from a string identifier. This function is * used from challenge_data, which reads the mode from a challenge file. @@ -221,22 +221,22 @@ public: assert(0); return MINOR_MODE_NONE; } - + #undef LINEAR_RACE #undef BATTLE_ARENA - + /** Game difficulty. */ enum Difficulty { DIFFICULTY_EASY, DIFFICULTY_FIRST = DIFFICULTY_EASY, - DIFFICULTY_MEDIUM, + DIFFICULTY_MEDIUM, DIFFICULTY_HARD, DIFFICULTY_BEST, DIFFICULTY_LAST = DIFFICULTY_BEST, DIFFICULTY_COUNT}; - + /** Different kart types: A local player, a player connected via network, * an AI kart, the leader kart (currently not used), a ghost kart. */ - enum KartType { KT_PLAYER, KT_NETWORK_PLAYER, KT_AI, KT_LEADER, + enum KartType { KT_PLAYER, KT_NETWORK_PLAYER, KT_AI, KT_LEADER, KT_GHOST }; private: @@ -268,21 +268,21 @@ public: int m_local_player_id; /** Global ID of player. */ int m_global_player_id; - /** In GPs, at the end, will hold the overall rank of this kart + /** In GPs, at the end, will hold the overall rank of this kart * (0<=m_gp_rank < num_karts-1). */ - int m_gp_rank; - - KartStatus(const std::string& ident, const int& prev_finish_pos, - int local_player_id, int global_player_id, + int m_gp_rank; + + KartStatus(const std::string& ident, const int& prev_finish_pos, + int local_player_id, int global_player_id, int init_gp_rank, KartType kt) : - m_ident(ident), m_score(0), m_last_score(0), + m_ident(ident), m_score(0), m_last_score(0), m_overall_time(0.0f), m_last_time(0.0f), m_prev_finish_pos(prev_finish_pos), m_kart_type(kt), m_local_player_id(local_player_id), m_global_player_id(global_player_id), m_gp_rank(init_gp_rank) {} - + }; // KartStatus private: @@ -306,7 +306,7 @@ private: /** The number of laps for each track of a GP (only one element * is used if only a single track is used. */ std::vector m_num_laps; - + /** Whether a track should be reversed */ std::vector m_reverse_track; @@ -349,7 +349,7 @@ private: public: RaceManager(); ~RaceManager(); - + /** Resets the race manager. It is called by world when restarting a race. */ void reset(); @@ -358,51 +358,51 @@ public: * \{ * \name Setting race parameters */ - + /** \brief Stores the information which local players uses which karts. * \param player_id Id of the local player for which the kart is set. * \param kart Kart name this player is using. */ void setLocalKartInfo(unsigned int player_id, const std::string& kart); - + /** Sets additional information for a player to indicate which soccer team it belong to */ void setLocalKartSoccerTeam(unsigned int player_id, SoccerTeam team); - + /** Sets the number of local players playing on this computer (including * split screen). * \param n Number of local players. */ void setNumLocalPlayers(unsigned int n); - + /** In case of non GP mode set the track to use. * \param track Pointer to the track to use. */ void setTrack(const std::string& track); - - /** \brief Returns the kart with a given GP rank (or NULL if no such + + /** \brief Returns the kart with a given GP rank (or NULL if no such * kart exists). * \param n Rank (0<=n& getAIKartList() const + const std::vector& getAIKartList() const { return m_ai_kart_list; } @@ -582,25 +582,25 @@ public: if(id > 999 && id < 2000) return true; else return false; } // isLinearRaceMode - + // ------------------------------------------------------------------------ /** \brief Returns true if the current mode is a battle mode. */ bool isBattleMode() { const int id = (int)m_minor_mode; - // This uses the numerical id of the mode, see the macros + // This uses the numerical id of the mode, see the macros // LINEAR_RACE and BATTLE_ARENA above for exact meaning. if (id >= 2000) return true; else return false; } // isBattleMode - + // ------------------------------------------------------------------------ - + bool isTutorialMode() { return m_minor_mode == MINOR_MODE_TUTORIAL; } - + // ------------------------------------------------------------------------ /** \brief Returns true if the current mode has laps. */ bool modeHasLaps() @@ -615,46 +615,46 @@ public: /** Returns true if the currently selected minor mode has highscores. */ bool modeHasHighscores() { - //FIXME: this information is duplicated. RaceManager knows about it, - // and each World may set m_use_highscores to true or false. + //FIXME: this information is duplicated. RaceManager knows about it, + // and each World may set m_use_highscores to true or false. // The reason for this duplication is that we might want to know // whether to display highscores without creating a World. - return m_minor_mode != MINOR_MODE_3_STRIKES && + return m_minor_mode != MINOR_MODE_3_STRIKES && m_minor_mode != MINOR_MODE_FOLLOW_LEADER; } // modeHasHighscore /** \} */ - + // ------------------------------------------------------------------------ /** * \{ * \name Controlling race * Start, stop, continue, restart races */ - + /** * \brief Starts a new race or GP (or other mode). - * It sets up the list of player karts, AI karts, GP tracks if relevant + * It sets up the list of player karts, AI karts, GP tracks if relevant * etc. - * \pre The list of AI karts to use must be set up first. This is - * usually being done by a call to computeRandomKartList() from - * NetworkManager::setupPlayerKartInfo, but could be done differently + * \pre The list of AI karts to use must be set up first. This is + * usually being done by a call to computeRandomKartList() from + * NetworkManager::setupPlayerKartInfo, but could be done differently * (e.g. depending on user command line options to test certain AIs) */ void startNew(bool from_overworld); - + /** \brief Start the next race or go back to the start screen * If there are more races to do, starts the next race, otherwise * calls exitRace to finish the race. */ void next(); - + /** \brief Rerun the same race again * This is called after a race is finished, and it will adjust * the number of points and the overall time before restarting the race. */ void rerunRace(); - + /** \brief Exit a race (and don't start the next one) * \note In GP, displays the GP result screen first * \note Deletes the world. @@ -668,18 +668,18 @@ public: void startGP(const GrandPrixData* gp, bool from_overworld); /** - * \brief Higher-level method to start a GP without having to care about + * \brief Higher-level method to start a GP without having to care about * the exact startup sequence. * \param trackIdent Internal name of the track to race on - * \param num_laps Number of laps to race, or -1 if number of laps is + * \param num_laps Number of laps to race, or -1 if number of laps is * not relevant in current mode */ void startSingleRace(const std::string &track_ident, const int num_laps, bool from_overworld); - bool raceWasStartedFromOverworld() const + bool raceWasStartedFromOverworld() const { - return m_started_from_overworld; + return m_started_from_overworld; } /** \} */ @@ -687,10 +687,10 @@ public: /** * \{ * \name Callbacks from the race classes - * These methods are to be used by the classes that manage the various + * These methods are to be used by the classes that manage the various * races, to let the race manager know about current status */ - bool allPlayerFinished() const + bool allPlayerFinished() const { return m_num_finished_players==m_player_karts.size(); } @@ -698,7 +698,7 @@ public: void kartFinishedRace(const AbstractKart* kart, float time); /** \} */ - + /** * \{ * \name For internal use @@ -706,8 +706,8 @@ public: * You shouldn't need to call any of those from higher-level code. */ void setNumPlayers(int num); - - void setPlayerKart(unsigned int player_id, + + void setPlayerKart(unsigned int player_id, const RemoteKartInfo& ki); void setDefaultAIKartList(const std::vector &ai_list); void computeRandomKartList(); @@ -716,14 +716,14 @@ public: * over the random selection. */ void setAIKartList(const std::vector& rkl) { - m_ai_kart_list = rkl; + m_ai_kart_list = rkl; } /** \} */ // ------------------------------------------------------------------------ bool haveKartLastPositionOnOverworld() - { - return m_have_kart_last_position_on_overworld; + { + return m_have_kart_last_position_on_overworld; } // ------------------------------------------------------------------------ void setKartLastPositionOnOverworld(Vec3 pos) @@ -738,10 +738,10 @@ public: } // ------------------------------------------------------------------------ Vec3 getKartLastPositionOnOverworld() - { + { return m_kart_last_position_on_overworld; } - + }; // RaceManager extern RaceManager *race_manager; diff --git a/src/replay/replay_base.hpp b/src/replay/replay_base.hpp index f89e19afd..3151e0922 100644 --- a/src/replay/replay_base.hpp +++ b/src/replay/replay_base.hpp @@ -52,7 +52,7 @@ protected: struct KartReplayEvent { /** The type of event. */ - enum KartReplayEventType {KRE_NONE, + enum KartReplayEventType {KRE_NONE, KRE_SKID_LEFT, KRE_SKID_MIN = KRE_SKID_LEFT, KRE_SKID_RIGHT, KRE_SKID_RELEASE} m_type; @@ -69,7 +69,7 @@ protected: const std::string &getReplayFilename() const { return m_filename;} // ---------------------------------------------------------------------- /** Returns the version number of the replay file. This is used to check - * that a loaded replay file can still be understood by this + * that a loaded replay file can still be understood by this * executable. */ unsigned int getReplayVersion() const { return 1; } }; // ReplayBase diff --git a/src/replay/replay_play.hpp b/src/replay/replay_play.hpp index e9e7a777a..279041db5 100644 --- a/src/replay/replay_play.hpp +++ b/src/replay/replay_play.hpp @@ -37,7 +37,7 @@ private: /** Points to the next free entry. */ unsigned int m_next; - + /** All ghost karts. */ PtrVector m_ghost_karts; diff --git a/src/replay/replay_recorder.hpp b/src/replay/replay_recorder.hpp index 2882e3481..f53eb1adf 100644 --- a/src/replay/replay_recorder.hpp +++ b/src/replay/replay_recorder.hpp @@ -70,12 +70,12 @@ public: // ------------------------------------------------------------------------ /** Creates a new instance of the replay object. */ - static void create() { + static void create() { assert(!m_replay_recorder); - m_replay_recorder = new ReplayRecorder(); + m_replay_recorder = new ReplayRecorder(); } // ------------------------------------------------------------------------ - /** Returns the instance of the replay object. Returns NULL if no + /** Returns the instance of the replay object. Returns NULL if no * recorder is available, i.e. recording can be disabled. */ static ReplayRecorder *get() { return m_replay_recorder; } // ------------------------------------------------------------------------ diff --git a/src/states_screens/addons_screen.hpp b/src/states_screens/addons_screen.hpp index 5da45b6d2..8b2e370a3 100644 --- a/src/states_screens/addons_screen.hpp +++ b/src/states_screens/addons_screen.hpp @@ -32,7 +32,7 @@ namespace GUIEngine { class Widget; } * \brief Addons screen * \ingroup states_screens */ -class AddonsScreen : public GUIEngine::Screen, +class AddonsScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton, public GUIEngine::IListWidgetHeaderListener { @@ -50,7 +50,7 @@ private: int m_icon_not_installed; /** Icon for 'loading' */ int m_icon_loading; - + irr::gui::STKModifiedSpriteBank *m_icon_bank; GUIEngine::LabelWidget @@ -64,12 +64,12 @@ private: int m_selected_index; float m_icon_height; - + bool m_reloading; - + /** \brief To check (and set) if sort order is descending **/ bool m_sort_desc; - + public: /** Load the addons into the main list.*/ @@ -79,19 +79,19 @@ public: virtual void loadedFromFile() OVERRIDE; virtual void unloaded() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; /** \brief implement callback from parent class GUIEngine::Screen */ virtual void beforeAddingWidget() OVERRIDE; - + virtual void onColumnClicked(int columnId); virtual void init() OVERRIDE; virtual void tearDown() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void onUpdate(float dt, irr::video::IVideoDriver*) OVERRIDE; diff --git a/src/states_screens/arenas_screen.hpp b/src/states_screens/arenas_screen.hpp index c276d649b..bd64dede3 100644 --- a/src/states_screens/arenas_screen.hpp +++ b/src/states_screens/arenas_screen.hpp @@ -30,21 +30,21 @@ namespace GUIEngine { class Widget; } class ArenasScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { friend class GUIEngine::ScreenSingleton; - + ArenasScreen(); void buildTrackList(); public: - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void beforeAddingWidget() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; diff --git a/src/states_screens/credits.hpp b/src/states_screens/credits.hpp index bd57c2356..8b54aaf6c 100644 --- a/src/states_screens/credits.hpp +++ b/src/states_screens/credits.hpp @@ -38,22 +38,22 @@ class CreditsSection; * \brief Screen where STK credits are shown * \ingroup states_screens */ -class CreditsScreen : public GUIEngine::Screen, +class CreditsScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { float m_time_element; - + PtrVector m_sections; CreditsSection* getCurrentSection(); - + int m_x, m_y, m_w, m_h; core::rect< s32 > m_section_rect; - + int m_curr_section; int m_curr_element; - + float time_before_next_step; - + friend class GUIEngine::ScreenSingleton; CreditsScreen(); bool getWideLine(std::ifstream& file, core::stringw* out); @@ -61,29 +61,29 @@ class CreditsScreen : public GUIEngine::Screen, bool m_is_victory_music; public: - - + + void setArea(const int x, const int y, const int w, const int h); - + // start from beginning again void reset(); - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - - /** \brief implement optional callback from parent class + + /** \brief implement optional callback from parent class * GUIEngine::Screen */ void onUpdate(float dt, irr::video::IVideoDriver*) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ - void eventCallback(GUIEngine::Widget* widget, const std::string& name, + void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + void setVictoryMusic(bool isVictory) { m_is_victory_music = isVictory; } - + virtual MusicInformation* getMusic() const { if (m_is_victory_music) diff --git a/src/states_screens/cutscene_gui.hpp b/src/states_screens/cutscene_gui.hpp index 85b19c141..7b23a16ec 100644 --- a/src/states_screens/cutscene_gui.hpp +++ b/src/states_screens/cutscene_gui.hpp @@ -49,13 +49,13 @@ public: CutsceneGUI(); ~CutsceneGUI(); - + void setFadeLevel(float level) { m_fade_level = level; } void setSubtitle(const core::stringw& subtitle) { m_subtitle = subtitle; } - + virtual void renderGlobal(float dt); virtual void renderPlayerView(const AbstractKart *kart); - + virtual const core::dimension2du getMiniMapSize() const OVERRIDE { return core::dimension2du(1,1); diff --git a/src/states_screens/feature_unlocked.hpp b/src/states_screens/feature_unlocked.hpp index 144c5d831..761dca4e6 100644 --- a/src/states_screens/feature_unlocked.hpp +++ b/src/states_screens/feature_unlocked.hpp @@ -24,9 +24,9 @@ #include "race/race_manager.hpp" #include "utils/ptr_vector.hpp" -namespace irr { - namespace scene { class ISceneNode; class ICameraSceneNode; - class ILightSceneNode; } +namespace irr { + namespace scene { class ISceneNode; class ICameraSceneNode; + class ILightSceneNode; } } class KartModel; class KartProperties; @@ -39,33 +39,33 @@ class ChallengeData; class FeatureUnlockedCutScene : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { friend class GUIEngine::ScreenSingleton; - + FeatureUnlockedCutScene(); - + /** Whichever of these is non-null decides what comes out of the chest */ struct UnlockedThing { /** Will be non-null if this unlocked thing is a kart */ KartProperties* m_unlocked_kart; - + std::string m_unlock_model; - + /** Will be non-empty if this unlocked thing is one or many pictures */ std::vector m_pictures; /** Will be set if this unlocked thing is a picture */ float m_w, m_h; /** used for slideshows */ int m_curr_image; - + /** Contains whatever is in the chest */ scene::ISceneNode* m_root_gift_node; - + irr::core::stringw m_unlock_message; - + UnlockedThing(std::string model, irr::core::stringw msg); UnlockedThing(KartProperties* kart, irr::core::stringw msg); - + /** * Creates a 'picture' reward. * \param pict the picture to display as reward. @@ -73,7 +73,7 @@ class FeatureUnlockedCutScene : public GUIEngine::Screen, public GUIEngine::Scre * \param y height of the picture to display */ UnlockedThing(irr::video::ITexture* pict, float w, float h, irr::core::stringw msg); - + /** * Creates a 'picture slideshow' reward. * \param picts the pictures to display as reward. @@ -81,28 +81,28 @@ class FeatureUnlockedCutScene : public GUIEngine::Screen, public GUIEngine::Scre * \param y height of the pictures to display */ UnlockedThing(std::vector picts, float w, float h, irr::core::stringw msg); - + ~UnlockedThing(); }; /** The list of all unlocked things. */ PtrVector m_unlocked_stuff; - + /** To store the copy of the KartModel for each unlocked kart. */ PtrVector m_all_kart_models; - + /** sky angle, 0-360 */ float m_sky_angle; - + /** Global evolution of time */ double m_global_time; - + /** Key position from origin (where the chest is) */ float m_key_pos; - + /** Angle of the key (from 0 to 1, simply traces progression) */ float m_key_angle; - + /** The scene node for the sky box. */ irr::scene::ISceneNode *m_sky; @@ -114,62 +114,62 @@ class FeatureUnlockedCutScene : public GUIEngine::Screen, public GUIEngine::Scre /** The scene node for the light. */ irr::scene::ILightSceneNode* m_light; - + //#define USE_IRRLICHT_BUG_WORKAROUND - + #ifdef USE_IRRLICHT_BUG_WORKAROUND scene::IMeshSceneNode *m_avoid_irrlicht_bug; #endif - + void continueButtonPressed(); - + public: /** \brief implement optional callback from parent class GUIEngine::Screen */ void onUpdate(float dt, irr::video::IVideoDriver*) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ void tearDown() OVERRIDE; - + void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + void findWhatWasUnlocked(RaceManager::Difficulty difficulty); /** Call before showing up the screen to make a kart come out of the chest. 'addUnlockedThings' will invoke this, so you generally don't need to call this directly. */ void addUnlockedKart(KartProperties* unlocked_kart, irr::core::stringw msg); - + /** Call before showing up the screen to make a picture come out of the chest 'addUnlockedThings' will invoke this, so you generally don't need to call this directly. */ void addUnlockedPicture(irr::video::ITexture* picture, float w, float h, irr::core::stringw msg); - + /** Call before showing up the screen to make a picture slideshow come out of the chest 'addUnlockedThings' will invoke this, so you generally don't need to call this directly. */ void addUnlockedPictures(std::vector pictures, float w, float h, irr::core::stringw msg); - + void addUnlockedTrack(const Track* track); void addUnlockedGP(const GrandPrixData* gp); - + /** Call before showing up the screen to make whatever the passed challenges unlocked * come out of the chest */ // unused for now... maybe this could could useful later? /* void addUnlockedThings(const std::vector unlocked); */ - + void addTrophy(RaceManager::Difficulty difficulty); - + /** override from base class to handle escape press */ virtual bool onEscapePressed() OVERRIDE; - + virtual MusicInformation* getInGameMenuMusic() const OVERRIDE; }; diff --git a/src/states_screens/grand_prix_lose.hpp b/src/states_screens/grand_prix_lose.hpp index 73779e042..ba286aa4d 100644 --- a/src/states_screens/grand_prix_lose.hpp +++ b/src/states_screens/grand_prix_lose.hpp @@ -35,58 +35,58 @@ class KartProperties; class GrandPrixLose : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { friend class GUIEngine::ScreenSingleton; - + GrandPrixLose(); - + /** sky angle, 0-360 */ float m_sky_angle; - + /** Global evolution of time */ float m_global_time; - + irr::scene::IMeshSceneNode* m_garage; irr::scene::IAnimatedMeshSceneNode* m_garage_door; irr::scene::ISceneNode* m_kart_node[4]; - + irr::scene::ISceneNode* m_sky; irr::scene::ICameraSceneNode* m_camera; irr::scene::ILightSceneNode* m_light; - + /** A copy of the kart model for each kart used. */ std::vector m_all_kart_models; int m_phase; - + float m_kart_x, m_kart_y, m_kart_z; - + float m_camera_x, m_camera_y, m_camera_z; float m_camera_target_x, m_camera_target_z; MusicInformation* m_music; - + //irr::core::recti m_viewport[4]; - + public: /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement optional callback from parent class GUIEngine::Screen */ void onUpdate(float dt, irr::video::IVideoDriver*) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ void tearDown() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief set which karts lost this GP */ void setKarts(std::vector ident); diff --git a/src/states_screens/grand_prix_win.hpp b/src/states_screens/grand_prix_win.hpp index f56cc1068..85fa5afae 100644 --- a/src/states_screens/grand_prix_win.hpp +++ b/src/states_screens/grand_prix_win.hpp @@ -33,15 +33,15 @@ class KartProperties; class GrandPrixWin : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { friend class GUIEngine::ScreenSingleton; - + GrandPrixWin(); - + /** sky angle, 0-360 */ float m_sky_angle; - + /** Global evolution of time */ double m_global_time; - + irr::scene::IMeshSceneNode* m_village; irr::scene::IMeshSceneNode* m_podium_step[3]; @@ -49,43 +49,43 @@ class GrandPrixWin : public GUIEngine::Screen, public GUIEngine::ScreenSingleton /** A copy of the kart model for each kart used. */ std::vector m_all_kart_models; - + irr::scene::ISceneNode* m_sky; irr::scene::ICameraSceneNode* m_camera; irr::scene::ILightSceneNode* m_light; - + GUIEngine::LabelWidget* m_unlocked_label; - + int m_phase; - + float m_kart_x[3], m_kart_y[3], m_kart_z[3]; float m_podium_x[3], m_podium_z[3]; float m_kart_rotation[3]; - + float m_camera_x, m_camera_y, m_camera_z; float m_camera_target_x, m_camera_target_z; - + MusicInformation* m_music; - + public: /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement optional callback from parent class GUIEngine::Screen */ void onUpdate(float dt, irr::video::IVideoDriver*) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ void tearDown() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \pre must be called after pushing the screen, but before onUpdate had the chance to be invoked */ void setKarts(const std::string idents[3]); diff --git a/src/states_screens/help_screen_1.hpp b/src/states_screens/help_screen_1.hpp index 3aa91af62..a8750bf35 100644 --- a/src/states_screens/help_screen_1.hpp +++ b/src/states_screens/help_screen_1.hpp @@ -30,16 +30,16 @@ class HelpScreen1 : public GUIEngine::Screen, public GUIEngine::ScreenSingleton< { friend class GUIEngine::ScreenSingleton; HelpScreen1(); - + public: /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; }; diff --git a/src/states_screens/help_screen_2.hpp b/src/states_screens/help_screen_2.hpp index 355974ada..b773b733e 100644 --- a/src/states_screens/help_screen_2.hpp +++ b/src/states_screens/help_screen_2.hpp @@ -30,16 +30,16 @@ class HelpScreen2 : public GUIEngine::Screen, public GUIEngine::ScreenSingleton< { friend class GUIEngine::ScreenSingleton; HelpScreen2(); - + public: - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; }; diff --git a/src/states_screens/help_screen_3.hpp b/src/states_screens/help_screen_3.hpp index 706eba822..904fb6f38 100644 --- a/src/states_screens/help_screen_3.hpp +++ b/src/states_screens/help_screen_3.hpp @@ -29,21 +29,21 @@ namespace GUIEngine { class Widget; } class HelpScreen3 : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { friend class GUIEngine::ScreenSingleton; - + HelpScreen3(); - + public: - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + }; #endif diff --git a/src/states_screens/help_screen_4.hpp b/src/states_screens/help_screen_4.hpp index 1da508501..eb4941549 100644 --- a/src/states_screens/help_screen_4.hpp +++ b/src/states_screens/help_screen_4.hpp @@ -29,21 +29,21 @@ namespace GUIEngine { class Widget; } class HelpScreen4 : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { friend class GUIEngine::ScreenSingleton; - + HelpScreen4(); - + public: - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + }; #endif diff --git a/src/states_screens/kart_selection.hpp b/src/states_screens/kart_selection.hpp index 6fa385898..fc6f1ee00 100644 --- a/src/states_screens/kart_selection.hpp +++ b/src/states_screens/kart_selection.hpp @@ -1,6 +1,6 @@ // // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2006 +// Copyright (C) 2006 // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -33,108 +33,108 @@ class KartHoverListener; * \brief screen where players can choose their kart * \ingroup states_screens */ -class KartSelectionScreen : public GUIEngine::Screen, +class KartSelectionScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { friend class KartHoverListener; friend class PlayerNameSpinner; friend class FocusDispatcher; - - /** Contains the custom widget shown for every player. (ref only since - * we're adding them to a Screen, and the Screen will take ownership + + /** Contains the custom widget shown for every player. (ref only since + * we're adding them to a Screen, and the Screen will take ownership * of these widgets) */ PtrVector m_kart_widgets; - + friend class GUIEngine::ScreenSingleton; friend class PlayerKartWidget; - + bool m_multiplayer; - + /** Whether this screen is being visited from overworld or not */ bool m_from_overworld; - + bool m_go_to_overworld_next; - - + + KartSelectionScreen(); - - /** Stores whether any player confirmed their choice; then, some things + + /** Stores whether any player confirmed their choice; then, some things * are "frozen", for instance the selected kart group tab */ bool m_game_master_confirmed; - + PlayerKartWidget* m_removed_widget; - + /** Message shown in multiplayer mode */ GUIEngine::BubbleWidget* m_multiplayer_message; - + /** Called when all players selected their kart */ void allPlayersDone(); - - /** Called when number/order of karts changed, so that all will keep + + /** Called when number/order of karts changed, so that all will keep * an up-to-date ID */ void renumberKarts(); - /** Checks identities chosen by players, making sure no duplicates are + /** Checks identities chosen by players, making sure no duplicates are * used. * \return Whether all choices are ok */ bool validateIdentChoices(); - + /** Checks karts chosen by players, making sure no duplicates are used. * \return Whether all choices are ok */ bool validateKartChoices(); - + /** Fill the ribbon with the karts from the currently selected group */ void setKartsFromCurrentGroup(); - + void playerConfirm(const int playerID); - + public: - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + void setMultiplayer(bool multiplayer); - + /** \brief Set whether this screen is being visited from overworld or not */ void setFromOverworld(bool from_overworld) { m_from_overworld = from_overworld; } - + void setGoToOverworldNext() { m_go_to_overworld_next = true; } - - /** \brief Called when a player hits 'fire'/'select' on his device to + + /** \brief Called when a player hits 'fire'/'select' on his device to * join the game */ bool playerJoin(InputDevice* device, bool firstPlayer); - + /** - * \brief Called when a player hits 'rescue'/'cancel' on his device + * \brief Called when a player hits 'rescue'/'cancel' on his device * to leave the game * \return true if event was handled succesfully */ bool playerQuit(StateManager::ActivePlayer* player); - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + virtual void beforeAddingWidget() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void tearDown() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void onUpdate(float dt, irr::video::IVideoDriver*) OVERRIDE; - /** \brief implement optional callback from parent + /** \brief implement optional callback from parent * class GUIEngine::Screen */ virtual void unloaded() OVERRIDE; - - /** \brief implement optional callback from parent + + /** \brief implement optional callback from parent * class GUIEngine::Screen */ virtual bool onEscapePressed() OVERRIDE; diff --git a/src/states_screens/main_menu_screen.hpp b/src/states_screens/main_menu_screen.hpp index cbcc7ebe6..696c7a6bc 100644 --- a/src/states_screens/main_menu_screen.hpp +++ b/src/states_screens/main_menu_screen.hpp @@ -30,26 +30,26 @@ class MainMenuScreen : public GUIEngine::Screen, public GUIEngine::ScreenSinglet { private: friend class GUIEngine::ScreenSingleton; - + MainMenuScreen(); - + public: - + virtual void onUpdate(float delta, irr::video::IVideoDriver* driver) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void tearDown() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void onDisabledItemClicked(const std::string& item) OVERRIDE; }; diff --git a/src/states_screens/minimal_race_gui.hpp b/src/states_screens/minimal_race_gui.hpp index a3f8ab151..9c79d7591 100644 --- a/src/states_screens/minimal_race_gui.hpp +++ b/src/states_screens/minimal_race_gui.hpp @@ -70,12 +70,12 @@ private: // ------------------------- /** The mini map of the track. */ video::ITexture *m_mini_map; - - /** The size of a single marker on the screen for AI karts, + + /** The size of a single marker on the screen for AI karts, * need not be a power of 2. */ int m_marker_ai_size; - /** The size of a single marker on the screen or player karts, + /** The size of a single marker on the screen or player karts, * need not be a power of 2. */ int m_marker_player_size; @@ -84,7 +84,7 @@ private: /** The height of the rendered mini map in pixels, must be a power of 2. */ int m_map_rendered_height; - + /** Width of the map in pixels on the screen, need not be a power of 2. */ int m_map_width; @@ -99,29 +99,29 @@ private: /** Used to display messages without overlapping */ int m_max_font_height; - + /** previous position of icons */ std::vector< core::vector2d > m_previous_icons_position; - + /* Display informat for one player on the screen. */ void drawEnergyMeter (const AbstractKart *kart, - const core::recti &viewport, + const core::recti &viewport, const core::vector2df &scaling); void drawRankLap (const AbstractKart* kart, const core::recti &viewport); /** Display items that are shown once only (for all karts). */ void drawGlobalMiniMap (); void drawGlobalTimer (); - + public: MinimalRaceGUI(); ~MinimalRaceGUI(); virtual void renderGlobal(float dt); virtual void renderPlayerView(const Camera *camera, float dt); - + /** Returns the size of the texture on which to render the minimap to. */ - virtual const core::dimension2du getMiniMapSize() const + virtual const core::dimension2du getMiniMapSize() const { return core::dimension2du(m_map_width, m_map_height); } }; // MinimalRaceGUI diff --git a/src/states_screens/options_screen_audio.hpp b/src/states_screens/options_screen_audio.hpp index f6058d478..1a4f4380a 100644 --- a/src/states_screens/options_screen_audio.hpp +++ b/src/states_screens/options_screen_audio.hpp @@ -34,23 +34,23 @@ struct Input; class OptionsScreenAudio : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { OptionsScreenAudio(); - + public: friend class GUIEngine::ScreenSingleton; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void tearDown() OVERRIDE; - + /** \brief implement optional callback from parent class GUIEngine::Screen */ virtual void unloaded() OVERRIDE; }; diff --git a/src/states_screens/options_screen_input.hpp b/src/states_screens/options_screen_input.hpp index c6ce5c385..647aa5f8f 100644 --- a/src/states_screens/options_screen_input.hpp +++ b/src/states_screens/options_screen_input.hpp @@ -36,30 +36,30 @@ struct Input; class OptionsScreenInput : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { OptionsScreenInput(); - + void updateInputButtons(DeviceConfig* config); void buildDeviceList(); - + irr::gui::STKModifiedSpriteBank* m_icon_bank; - + std::map m_highlights; - + public: friend class GUIEngine::ScreenSingleton; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile(); - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID); - + /** \brief implement optional callback from parent class GUIEngine::Screen */ virtual void unloaded(); - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init(); - - /** + + /** * \brief invoke if the list of devices changed after the creation of this screen. * This will cause the displayed list to be updated accordingly with the data in the device manager. */ @@ -71,7 +71,7 @@ public: int btnID, int axisDir, int value); - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void onUpdate(float dt, irr::video::IVideoDriver* drv); }; diff --git a/src/states_screens/options_screen_input2.hpp b/src/states_screens/options_screen_input2.hpp index c909c540a..bfa2f7e8a 100644 --- a/src/states_screens/options_screen_input2.hpp +++ b/src/states_screens/options_screen_input2.hpp @@ -42,37 +42,37 @@ class OptionsScreenInput2 : public GUIEngine::Screen, public MessageDialog::IConfirmDialogListener { OptionsScreenInput2(); - + void updateInputButtons(); - bool conflictsBetweenKbdConfig(PlayerAction action, PlayerAction from, + bool conflictsBetweenKbdConfig(PlayerAction action, PlayerAction from, PlayerAction to); DeviceConfig* m_config; - - irr::core::stringw makeLabel(const irr::core::stringw &translatedName, + + irr::core::stringw makeLabel(const irr::core::stringw &translatedName, PlayerAction action) const; public: friend class GUIEngine::ScreenSingleton; - + void setDevice(DeviceConfig* config) { m_config = config; } - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ - virtual void eventCallback(GUIEngine::Widget* widget, + virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - - /** \brief implement optional callback from parent class + + /** \brief implement optional callback from parent class * GUIEngine::Screen */ virtual void unloaded() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - - /** \brief implement optional callback from parent class + + /** \brief implement optional callback from parent class * GUIEngine::Screen */ virtual bool onEscapePressed() OVERRIDE; @@ -81,7 +81,7 @@ public: * Updates the input bindings accordingly with the sensed input. */ void gotSensedInput(const Input& sensedInput); - + /** \brief Implement IConfirmDialogListener callback */ virtual void onConfirm() OVERRIDE; }; diff --git a/src/states_screens/options_screen_players.hpp b/src/states_screens/options_screen_players.hpp index d59db3f17..3261bc402 100644 --- a/src/states_screens/options_screen_players.hpp +++ b/src/states_screens/options_screen_players.hpp @@ -41,29 +41,29 @@ private: bool refreshPlayerList(); public: friend class GUIEngine::ScreenSingleton; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** * \brief Adds a new player (if 'player' is NULL) or renames an existing player (if 'player' is not NULL) * \return whether adding was successful (can fail e.g. if trying to add a duplicate) */ bool renamePlayer(const irr::core::stringw& newName, PlayerProfile* player=NULL); void deletePlayer(PlayerProfile* player); - + void selectPlayer(const irr::core::stringw& name); - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void tearDown() OVERRIDE; - + /** \brief implement callback from EnterPlayerNameDialog::INewPlayerListener */ virtual void onNewPlayerWithName(const irr::core::stringw& newName); }; diff --git a/src/states_screens/options_screen_ui.hpp b/src/states_screens/options_screen_ui.hpp index 2d68bf7b4..d88eccc2c 100644 --- a/src/states_screens/options_screen_ui.hpp +++ b/src/states_screens/options_screen_ui.hpp @@ -35,25 +35,25 @@ class OptionsScreenUI : public GUIEngine::Screen, public GUIEngine::ScreenSingle { OptionsScreenUI(); bool m_inited; - + std::vector m_skins; - + public: friend class GUIEngine::ScreenSingleton; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void tearDown() OVERRIDE; - + /** \brief implement optional callback from parent class GUIEngine::Screen */ virtual void unloaded() OVERRIDE; }; diff --git a/src/states_screens/options_screen_video.hpp b/src/states_screens/options_screen_video.hpp index 7753a0377..de2744358 100644 --- a/src/states_screens/options_screen_video.hpp +++ b/src/states_screens/options_screen_video.hpp @@ -35,30 +35,30 @@ class OptionsScreenVideo : public GUIEngine::Screen, public GUIEngine::ScreenSin { OptionsScreenVideo(); bool m_inited; - + std::vector m_skins; void updateTooltip(); - + public: friend class GUIEngine::ScreenSingleton; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void tearDown() OVERRIDE; - + /** \brief implement optional callback from parent class GUIEngine::Screen */ virtual void unloaded() OVERRIDE; - + void updateGfxSlider(); }; diff --git a/src/states_screens/race_gui.hpp b/src/states_screens/race_gui.hpp index ff456c8bf..bfd687bae 100644 --- a/src/states_screens/race_gui.hpp +++ b/src/states_screens/race_gui.hpp @@ -55,12 +55,12 @@ private: // ------------------------- /** The mini map of the track. */ video::ITexture *m_mini_map; - - /** The size of a single marker on the screen for AI karts, + + /** The size of a single marker on the screen for AI karts, * need not be a power of 2. */ int m_marker_ai_size; - /** The size of a single marker on the screen or player karts, + /** The size of a single marker on the screen or player karts, * need not be a power of 2. */ int m_marker_player_size; @@ -69,7 +69,7 @@ private: /** The height of the rendered mini map in pixels, must be a power of 2. */ int m_map_rendered_height; - + /** Width of the map in pixels on the screen, need not be a power of 2. */ int m_map_width; @@ -81,22 +81,22 @@ private: /** Distance of map from bottom of screen. */ int m_map_bottom; - + /** Maximum string length of 'rank', 'lap', '99/99'. Used to position * the rank/lap text correctly close to the right border. */ int m_rank_lap_width; /** Maximum string length for the timer */ int m_timer_width; - - + + bool m_is_tutorial; - + /* Display informat for one player on the screen. */ void drawEnergyMeter (int x, int y, const AbstractKart *kart, - const core::recti &viewport, + const core::recti &viewport, const core::vector2df &scaling); - void drawSpeedAndEnergy (const AbstractKart* kart, + void drawSpeedAndEnergy (const AbstractKart* kart, const core::recti &viewport, const core::vector2df &scaling); void drawRankLap (const AbstractKart* kart, @@ -105,18 +105,18 @@ private: /** Display items that are shown once only (for all karts). */ void drawGlobalMiniMap (); void drawGlobalTimer (); - + public: RaceGUI(); ~RaceGUI(); virtual void renderGlobal(float dt); virtual void renderPlayerView(const Camera *camera, float dt); - + /** Returns the size of the texture on which to render the minimap to. */ - virtual const core::dimension2du getMiniMapSize() const + virtual const core::dimension2du getMiniMapSize() const { return core::dimension2du(m_map_width, m_map_height); } - + }; // RaceGUI #endif diff --git a/src/states_screens/race_gui_base.hpp b/src/states_screens/race_gui_base.hpp index e86fdf599..530443bcd 100644 --- a/src/states_screens/race_gui_base.hpp +++ b/src/states_screens/race_gui_base.hpp @@ -41,7 +41,7 @@ class Material; class Referee; /** - * \brief An abstract base class for the two race guis (race_gui and + * \brief An abstract base class for the two race guis (race_gui and * race_result gui) * \ingroup states_screens */ @@ -56,13 +56,13 @@ public: { /** Text to display next to icon, if any. */ core::stringw m_text; - + /** Text color, if any text. */ video::SColor m_color; - + /** If this kart has a special title, e.g. "leader" in follow-the-leader. */ core::stringw special_title; - + /** Current lap of this kart, or -1 if irrelevant. */ int lap; }; // KartIconDisplayInfo @@ -89,17 +89,17 @@ private: /** Important msgs are displayed in the middle of the screen. */ bool m_important; bool m_big_font; - + // ----------------------------------------------------- // std::vector needs standard copy-ctor and std-assignment op. // let compiler create defaults .. they'll do the job, no // deep copies here .. - TimedMessage(const irr::core::stringw &message, + TimedMessage(const irr::core::stringw &message, const AbstractKart *kart, float time, const video::SColor &color, const bool important, bool big_font) { - m_message = message; + m_message = message; m_kart = kart; m_remaining_time = ( time < 0.0f ) ? -1.0f : time; m_color = color; @@ -131,7 +131,7 @@ private: /** Translated string 'Top %d' displayed every frame. */ core::stringw m_string_top; - + /** The position of the referee for all karts. */ std::vector m_referee_pos; @@ -139,7 +139,7 @@ private: std::vector m_referee_rotation; /** The height of the referee. This is used to make the referee fly - * into view. This is the same Y-offset for all karts, so only a + * into view. This is the same Y-offset for all karts, so only a * single value needs to be used. */ float m_referee_height; @@ -151,12 +151,12 @@ protected: /** Material for the 'plunger in the face' texture. */ Material *m_plunger_face; - /** State of the plunger: From the 'init' states the plunger switches + /** State of the plunger: From the 'init' states the plunger switches * between two slow moving states ('shakily moving') till the end of - * the plunger time is nearly reached, then it goes to a very fast + * the plunger time is nearly reached, then it goes to a very fast * moving state ('plunger blown off'). */ - enum PlungerState {PLUNGER_STATE_INIT, PLUNGER_STATE_SLOW_1, - PLUNGER_STATE_SLOW_2, PLUNGER_STATE_FAST} + enum PlungerState {PLUNGER_STATE_INIT, PLUNGER_STATE_SLOW_1, + PLUNGER_STATE_SLOW_2, PLUNGER_STATE_FAST} m_plunger_state; /** How long the plunger should stay in the current state. */ @@ -184,18 +184,18 @@ protected: /** The frame around player karts in the mini map. */ Material *m_icons_frame; - + void cleanupMessages(const float dt); void createMarkerTexture(); - void createRegularPolygon(unsigned int n, float radius, + void createRegularPolygon(unsigned int n, float radius, const core::vector2df ¢er, const video::SColor &color, video::S3DVertex *v, unsigned short int *index); void drawAllMessages (const AbstractKart* kart, - const core::recti &viewport, + const core::recti &viewport, const core::vector2df &scaling); void drawPowerupIcons (const AbstractKart* kart, - const core::recti &viewport, + const core::recti &viewport, const core::vector2df &scaling); void drawGlobalMusicDescription(); void drawGlobalReadySetGo (); @@ -204,20 +204,20 @@ protected: * item messages). */ void ignoreUnimportantMessages() { m_ignore_unimportant_messages = true; } - + /** Distance on track to begin showing overlap in drawGlobalPlayerIcons */ float m_dist_show_overlap;///can be zero float m_icons_inertia;///can be zero - + /** previous position of icons */ std::vector< core::vector2d > m_previous_icons_position; - /** This vector is passed to world to be filled with the current + /** This vector is passed to world to be filled with the current * race data information. */ std::vector m_kart_display_infos; public: - + bool m_enabled; RaceGUIBase(); @@ -226,7 +226,7 @@ public: virtual void init(); virtual void reset(); virtual void renderPlayerView(const Camera *camera, float dt); - virtual void addMessage(const irr::core::stringw &m, + virtual void addMessage(const irr::core::stringw &m, const AbstractKart *kart, float time, const video::SColor &color= video::SColor(255, 255, 0, 255), @@ -236,7 +236,7 @@ public: virtual void preRenderCallback(const Camera *camera); // ------------------------------------------------------------------------ /** Returns the size of the texture on which to render the minimap to. */ - virtual const core::dimension2du + virtual const core::dimension2du getMiniMapSize() const = 0; // ------------------------------------------------------------------------ virtual void clearAllMessages() { m_messages.clear(); } diff --git a/src/states_screens/race_gui_overworld.hpp b/src/states_screens/race_gui_overworld.hpp index 3cb0fc3a3..426fa2970 100644 --- a/src/states_screens/race_gui_overworld.hpp +++ b/src/states_screens/race_gui_overworld.hpp @@ -47,23 +47,23 @@ const int CHALLENGE_DISTANCE_SQUARED = 20; class RaceGUIOverworld : public RaceGUIBase { private: - + Material *m_speed_meter_icon; Material *m_speed_bar_icon; - + bool m_close_to_a_challenge; - + /** Translated string 'lap' displayed every frame. */ core::stringw m_string_lap; - + /** Translated string 'rank' displayed every frame. */ core::stringw m_string_rank; - + // Minimap related variables // ------------------------- /** The mini map of the track. */ video::ITexture *m_mini_map; - + video::ITexture *m_trophy1; video::ITexture *m_trophy2; video::ITexture *m_trophy3; @@ -71,70 +71,70 @@ private: video::ITexture *m_open_challenge; video::ITexture* m_icons[5]; - - /** The size of a single marker on the screen for AI karts, + + /** The size of a single marker on the screen for AI karts, * need not be a power of 2. */ int m_marker_challenge_size; - - /** The size of a single marker on the screen or player karts, + + /** The size of a single marker on the screen or player karts, * need not be a power of 2. */ int m_marker_player_size; - + /** The width of the rendered mini map in pixels, must be a power of 2. */ int m_map_rendered_width; - + /** The height of the rendered mini map in pixels, must be a power of 2. */ int m_map_rendered_height; - + /** Width of the map in pixels on the screen, need not be a power of 2. */ int m_map_width; - + /** Height of the map in pixels on the screen, need not be a power of 2. */ int m_map_height; - + /** Distance of map from left side of screen. */ int m_map_left; - + /** True if this is the first time the renderer is called. */ bool m_is_first_render_call; /** Distance of map from bottom of screen. */ int m_map_bottom; - + int m_trophy_points_width; /** The current challenge over which the mouse is hovering. */ const OverworldChallenge *m_current_challenge; - + /* Display informat for one player on the screen. */ void drawEnergyMeter (int x, int y, const AbstractKart *kart, - const core::recti &viewport, + const core::recti &viewport, const core::vector2df &scaling); - + /** Display items that are shown once only (for all karts). */ void drawGlobalMiniMap (); void drawTrophyPoints (); - + public: - + RaceGUIOverworld(); ~RaceGUIOverworld(); virtual void renderGlobal(float dt); virtual void renderPlayerView(const Camera *camera, float dt); // ------------------------------------------------------------------------ - /** Returns the currently selected challenge data (or NULL if no is + /** Returns the currently selected challenge data (or NULL if no is * selected). */ - const OverworldChallenge *getCurrentChallenge() const + const OverworldChallenge *getCurrentChallenge() const { return m_current_challenge; } // getCurrentChallenge // ------------------------------------------------------------------------ /** Returns the size of the texture on which to render the minimap to. */ - virtual const core::dimension2du getMiniMapSize() const + virtual const core::dimension2du getMiniMapSize() const { return core::dimension2du(m_map_width, m_map_height); } - + }; // RaceGUI #endif diff --git a/src/states_screens/race_result_gui.hpp b/src/states_screens/race_result_gui.hpp index 30bd83056..e796a3d35 100644 --- a/src/states_screens/race_result_gui.hpp +++ b/src/states_screens/race_result_gui.hpp @@ -42,7 +42,7 @@ class SFXBase; * \brief Displays the results (while the end animation is shown). * \ingroup states_screens */ -class RaceResultGUI : public RaceGUIBase, +class RaceResultGUI : public RaceGUIBase, public GUIEngine::Screen, public GUIEngine::ScreenSingleton, public MessageDialog::IConfirmDialogListener @@ -57,7 +57,7 @@ private: OLD_GP_TABLE: Scroll new table into place, sorted by previous GP ranks INCREASE_POINTS: The overall points are added up - RESORT_TABLE: Resort the table so that it is now sorted by + RESORT_TABLE: Resort the table so that it is now sorted by GP points. WAIT_TILL_END Some delay to wait for end, after a period it wii automatically end. */ @@ -94,7 +94,7 @@ private: /** New overall points after this race. */ int m_new_overall_points; /** When updating the number of points in the display, this is the - currently displayed number of points. This is a floating point number + currently displayed number of points. This is a floating point number since it stores the increments during increasing the points. */ float m_current_displayed_points; /** The kart icons. */ @@ -156,8 +156,8 @@ private: /** The overall width of the table. */ unsigned int m_table_width; - /** GP Progress text */ - unsigned int m_gp_progress_x; + /** GP Progress text */ + unsigned int m_gp_progress_x; /** The font to use. */ gui::ScalableFont *m_font; @@ -170,28 +170,28 @@ private: bool m_was_monospace; SFXBase* m_finish_sound; - + /** For highscores */ std::string m_highscore_who; - + /** For highscores */ StateManager::ActivePlayer* m_highscore_player; - + /** For highscores */ int m_highscore_rank; - + /** For highscores */ int m_highscore_time; - + unsigned int m_width_all_points; - - void displayOneEntry(unsigned int x, unsigned int y, + + void displayOneEntry(unsigned int x, unsigned int y, unsigned int n, bool display_points); void determineTableLayout(); void determineGPLayout(); void enableAllButtons(); void enableGPProgress(); - void displayGPProgress(); + void displayGPProgress(); void cleanupGPProgress(); void displayHighScores(); public: @@ -205,17 +205,17 @@ public: virtual void init() OVERRIDE; virtual void tearDown() OVERRIDE; virtual bool onEscapePressed() OVERRIDE; - virtual GUIEngine::EventPropagation + virtual GUIEngine::EventPropagation filterActions(PlayerAction action, int deviceID, const unsigned int value, Input::InputType type, int playerId) OVERRIDE; - void eventCallback(GUIEngine::Widget* widget, const std::string& name, + void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; friend class GUIEngine::ScreenSingleton; /** Should not be called anymore. */ - const core::dimension2du getMiniMapSize() const + const core::dimension2du getMiniMapSize() const { assert(false); return core::dimension2du(0, 0); } /** No kart specific view needs to be rendered in the result gui. */ @@ -227,21 +227,21 @@ public: * called (e.g. 'new lap' message if the end controller is used for more * than one lap). So do nothing in this case. */ - virtual void addMessage(const irr::core::stringw &m, - const AbstractKart *kart, - float time, + virtual void addMessage(const irr::core::stringw &m, + const AbstractKart *kart, + float time, const video::SColor &color= video::SColor(255, 255, 0, 255), bool important=true) { } /** Should not be called anymore. */ virtual void clearAllMessages() {assert(false); } - + void nextPhase(); - + /** Show no highscore */ void clearHighscores(); - + /** * To call if the user got a new highscore * \param kart identity of the kart that made the highscore @@ -249,9 +249,9 @@ public: * \param rank Highscore rank (first highscore, second highscore, etc.). This is not the race rank * \param time Finish time in seconds */ - void setHighscore(const std::string &kart, + void setHighscore(const std::string &kart, StateManager::ActivePlayer* player, int rank, int time); - + virtual void onConfirm(); }; // RaceResultGUI diff --git a/src/states_screens/race_setup_screen.hpp b/src/states_screens/race_setup_screen.hpp index b6848475e..4fe3d759a 100644 --- a/src/states_screens/race_setup_screen.hpp +++ b/src/states_screens/race_setup_screen.hpp @@ -34,20 +34,20 @@ class RaceSetupScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingle friend class GameModeRibbonListener; RaceSetupScreen(); - + GameModeRibbonListener* m_mode_listener; - + void onGameModeChanged(); - + public: - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; }; diff --git a/src/states_screens/soccer_setup_screen.hpp b/src/states_screens/soccer_setup_screen.hpp index 56ab102bf..0934cd8bf 100644 --- a/src/states_screens/soccer_setup_screen.hpp +++ b/src/states_screens/soccer_setup_screen.hpp @@ -32,44 +32,44 @@ class SoccerSetupScreen : public GUIEngine::Screen, public GUIEngine::ScreenSing friend class GUIEngine::ScreenSingleton; SoccerSetupScreen(); - + struct KartViewInfo { GUIEngine::ModelViewWidget* view; bool confirmed; int local_player_id; SoccerTeam team; - + KartViewInfo() : view(NULL), confirmed(false), local_player_id(-1), team(SOCCER_TEAM_NONE) {} }; AlignedArray m_kart_view_info; - + public: - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void beforeAddingWidget() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void tearDown() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual GUIEngine::EventPropagation filterActions( PlayerAction action, int deviceID, const unsigned int value, Input::InputType type, int playerId) OVERRIDE; - + private: bool areAllKartsConfirmed() const; void updateKartViewsLayout(); diff --git a/src/states_screens/state_manager.hpp b/src/states_screens/state_manager.hpp index e6fdfe8ae..7db8c6798 100644 --- a/src/states_screens/state_manager.hpp +++ b/src/states_screens/state_manager.hpp @@ -48,16 +48,16 @@ namespace GUIEngine const static int PLAYER_ID_GAME_MASTER = 0; /** - * \brief A concrete scene manager, derived from GUIEngine's + * \brief A concrete scene manager, derived from GUIEngine's * AbastractSceneManager * \ingroup states_screens */ class StateManager : public GUIEngine::AbstractStateManager { - + void updateActivePlayerIDs(); - + public: /** @@ -71,126 +71,126 @@ public: class ActivePlayer { friend class StateManager; - + PlayerProfile *m_player; InputDevice *m_device; - + /** Pointer to the kart of this player, only valid during the game. */ AbstractKart *m_kart; - + /** ID of this player within the list of active players */ int m_id; - + ActivePlayer(PlayerProfile* player, InputDevice* device); - + #ifdef DEBUG unsigned int m_magic_number; #endif - + public: - + ~ActivePlayer(); - + #ifdef DEBUG bool ok() { return (m_magic_number == 0xAC1EF1AE); } // ok #endif - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /** \return the identity of this active player */ - PlayerProfile* getProfile() - { -#ifdef DEBUG - assert(m_magic_number == 0xAC1EF1AE); -#endif - return m_player; - } // getProfile - - // -------------------------------------------------------------------- - /** \return the identity of this active player */ - const PlayerProfile* getConstProfile() const + PlayerProfile* getProfile() { #ifdef DEBUG - assert(m_magic_number == 0xAC1EF1AE); + assert(m_magic_number == 0xAC1EF1AE); #endif - return m_player; + return m_player; + } // getProfile + + // -------------------------------------------------------------------- + /** \return the identity of this active player */ + const PlayerProfile* getConstProfile() const + { +#ifdef DEBUG + assert(m_magic_number == 0xAC1EF1AE); +#endif + return m_player; } // getConstProfile - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /** Call to change the identity of this player (useful when player is * selecting his identity) */ void setPlayerProfile(PlayerProfile* player); - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- /** ID of this player within the list of active players */ - int getID() const + int getID() const { #ifdef DEBUG - assert(m_magic_number == 0xAC1EF1AE); + assert(m_magic_number == 0xAC1EF1AE); #endif - return m_id; + return m_id; } // getID - // -------------------------------------------------------------------- - - /** \return Which input device this player is using, or NULL if none + // -------------------------------------------------------------------- + + /** \return Which input device this player is using, or NULL if none * is set yet */ - InputDevice* getDevice() const - { -#ifdef DEBUG - assert(m_magic_number == 0xAC1EF1AE); -#endif - return m_device; - } // getDevice - - // -------------------------------------------------------------------- - void setDevice(InputDevice* device); - - // -------------------------------------------------------------------- - /** Sets the kart for this player. */ - void setKart(AbstractKart *kart) + InputDevice* getDevice() const { #ifdef DEBUG assert(m_magic_number == 0xAC1EF1AE); #endif - m_kart = kart; + return m_device; + } // getDevice + + // -------------------------------------------------------------------- + void setDevice(InputDevice* device); + + // -------------------------------------------------------------------- + /** Sets the kart for this player. */ + void setKart(AbstractKart *kart) + { +#ifdef DEBUG + assert(m_magic_number == 0xAC1EF1AE); +#endif + m_kart = kart; } // setKart - - // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- /** \return the kart of this player. Only valid while world exists. */ AbstractKart* getKart() - { + { #ifdef DEBUG - assert(m_magic_number == 0xAC1EF1AE); + assert(m_magic_number == 0xAC1EF1AE); #endif - return m_kart; + return m_kart; } // getKart }; // ActivePlayer // ======================================================================== - const PtrVector& getActivePlayers() + const PtrVector& getActivePlayers() { return m_active_players; } ActivePlayer* getActivePlayer(const int id); - + /** \return the PlayerProfile of a given ActivePlayer. * \param id the ID of the active player for whichyou want the profile */ const PlayerProfile* getActivePlayerProfile(const int id); - + int createActivePlayer(PlayerProfile *profile, InputDevice *device); void removeActivePlayer(int id); int activePlayerCount(); void resetActivePlayers(); - + /** \return whether to reduce FPS at the moment - * \note this can be useful to avoid being too CPU/GPU intensive in - * parts of the game that don't require high framerates, like + * \note this can be useful to avoid being too CPU/GPU intensive in + * parts of the game that don't require high framerates, like * menus */ bool throttleFPS(); - + /** \brief implementing callback from base class AbstractStateManager */ void escapePressed(); @@ -199,14 +199,14 @@ public: /** \brief implementing callback from base class AbstractStateManager */ virtual void onStackEmptied(); - + /** \brief implementing callback from base class AbstractStateManager */ virtual void onTopMostScreenChanged(); - + // singleton static StateManager* get(); static void deallocate(); - + private: /** * A list of all currently playing players. diff --git a/src/states_screens/story_mode_lobby.hpp b/src/states_screens/story_mode_lobby.hpp index b2c3150d9..756273137 100644 --- a/src/states_screens/story_mode_lobby.hpp +++ b/src/states_screens/story_mode_lobby.hpp @@ -35,25 +35,25 @@ class StoryModeLobbyScreen : public GUIEngine::Screen, public EnterPlayerNameDia public GUIEngine::ScreenSingleton { StoryModeLobbyScreen(); - + public: friend class GUIEngine::ScreenSingleton; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile(); - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID); - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init(); - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void tearDown(); - + /** \brief implement optional callback from parent class GUIEngine::Screen */ virtual void unloaded(); - + /** \brief implement callback from EnterPlayerNameDialog::INewPlayerListener */ virtual void onNewPlayerWithName(const irr::core::stringw& newName); }; diff --git a/src/states_screens/tracks_screen.hpp b/src/states_screens/tracks_screen.hpp index f284625c2..e3276874f 100644 --- a/src/states_screens/tracks_screen.hpp +++ b/src/states_screens/tracks_screen.hpp @@ -30,30 +30,30 @@ namespace GUIEngine { class Widget; } class TracksScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton { friend class GUIEngine::ScreenSingleton; - + TracksScreen(); - + /** adds the tracks from the current track group into the tracks ribbon */ void buildTrackList(); - + std::deque m_random_track_list; - + public: - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void init() OVERRIDE; - + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void beforeAddingWidget() OVERRIDE; - + void setFocusOnTrack(const std::string& trackName); void setFocusOnGP(const std::string& gpName); diff --git a/src/tinygettext/dictionary.hpp b/src/tinygettext/dictionary.hpp index 668b35e92..f902d2821 100644 --- a/src/tinygettext/dictionary.hpp +++ b/src/tinygettext/dictionary.hpp @@ -45,7 +45,7 @@ private: bool m_has_fallback; Dictionary* m_fallback; - + public: /** Constructs a dictionary converting to the specified \a charset (default UTF-8) */ Dictionary(const std::string& charset = "UTF-8"); @@ -82,7 +82,7 @@ public: translate(). */ void add_translation(const std::string& msgid, const std::string& msgid_plural, const std::vector& msgstrs); - void add_translation(const std::string& msgctxt, + void add_translation(const std::string& msgctxt, const std::string& msgid, const std::string& msgid_plural, const std::vector& msgstrs); @@ -94,7 +94,7 @@ public: /** Iterate over all messages, Func is of type: void func(const std::string& msgid, const std::vector& msgstrs) */ template - Func foreach(Func func) + Func foreach(Func func) { for(Entries::iterator i = entries.begin(); i != entries.end(); ++i) { @@ -108,11 +108,11 @@ public: m_has_fallback = true; m_fallback = fallback; } - + /** Iterate over all messages with a context, Func is of type: void func(const std::string& ctxt, const std::string& msgid, const std::vector& msgstrs) */ template - Func foreach_ctxt(Func func) + Func foreach_ctxt(Func func) { for(CtxtEntries::iterator i = ctxt_entries.begin(); i != ctxt_entries.end(); ++i) { diff --git a/src/tinygettext/dictionary_manager.hpp b/src/tinygettext/dictionary_manager.hpp index c507c1578..bd1de629a 100644 --- a/src/tinygettext/dictionary_manager.hpp +++ b/src/tinygettext/dictionary_manager.hpp @@ -45,7 +45,7 @@ private: std::string charset; bool use_fuzzy; - + Language current_language; Dictionary* current_dict; @@ -58,7 +58,7 @@ private: #ifdef DEBUG unsigned int m_magic_number; #endif - + public: DictionaryManager(const std::string& charset_ = "UTF-8"); ~DictionaryManager(); diff --git a/src/tinygettext/file_system.hpp b/src/tinygettext/file_system.hpp index af47aaf96..aff3bfd8d 100644 --- a/src/tinygettext/file_system.hpp +++ b/src/tinygettext/file_system.hpp @@ -25,7 +25,7 @@ namespace tinygettext { -class FileSystem +class FileSystem { public: virtual ~FileSystem() {} diff --git a/src/tinygettext/iconv.hpp b/src/tinygettext/iconv.hpp index 4a3ec3192..2b43ef5b8 100644 --- a/src/tinygettext/iconv.hpp +++ b/src/tinygettext/iconv.hpp @@ -5,12 +5,12 @@ // 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 . @@ -27,20 +27,20 @@ # define tinygettext_iconv_t SDL_iconv_t # define tinygettext_iconv SDL_iconv # define tinygettext_iconv_open SDL_iconv_open -# define tinygettext_iconv_close SDL_iconv_close +# define tinygettext_iconv_close SDL_iconv_close #else # include # ifdef HAVE_ICONV_CONST # define tinygettext_ICONV_CONST ICONV_CONST # else -# define tinygettext_ICONV_CONST +# define tinygettext_ICONV_CONST # endif # define tinygettext_iconv_t iconv_t # define tinygettext_iconv iconv # define tinygettext_iconv_open iconv_open -# define tinygettext_iconv_close iconv_close +# define tinygettext_iconv_close iconv_close #endif namespace tinygettext { diff --git a/src/tinygettext/language.hpp b/src/tinygettext/language.hpp index 099911205..bd4a3ea63 100644 --- a/src/tinygettext/language.hpp +++ b/src/tinygettext/language.hpp @@ -35,12 +35,12 @@ private: public: /** Create a language from language and country code: Example: Languge("de", "DE"); */ - static Language from_spec(const std::string& language, - const std::string& country = std::string(), + static Language from_spec(const std::string& language, + const std::string& country = std::string(), const std::string& modifier = std::string()); /** Create a language from language and country code: - Example: Languge("deutsch"); + Example: Languge("deutsch"); Example: Languge("de_DE"); */ static Language from_name(const std::string& str); @@ -54,7 +54,7 @@ public: /** Create an undefined Language object */ Language(); - + operator bool() const { return language_spec!=NULL; } /** Returns the language code (i.e. de, en, fr) */ diff --git a/src/tinygettext/plural_forms.hpp b/src/tinygettext/plural_forms.hpp index c2f92f14d..2c05e6a28 100644 --- a/src/tinygettext/plural_forms.hpp +++ b/src/tinygettext/plural_forms.hpp @@ -39,7 +39,7 @@ public: {} PluralForms(unsigned int nplural_, PluralFunc plural_) - : nplural(nplural_), + : nplural(nplural_), plural(plural_) {} @@ -56,6 +56,6 @@ public: } // namespace tinygettext -#endif +#endif /* EOF */ diff --git a/src/tinygettext/po_parser.hpp b/src/tinygettext/po_parser.hpp index c3c451314..02bc5b42a 100644 --- a/src/tinygettext/po_parser.hpp +++ b/src/tinygettext/po_parser.hpp @@ -43,7 +43,7 @@ private: std::string current_line; //IConv conv; - + POParser(const std::string& filename, std::istream& in_, Dictionary& dict_, bool use_fuzzy = true); ~POParser(); diff --git a/src/tinygettext/tgt_log.hpp b/src/tinygettext/tgt_log.hpp index a8eadb461..4adc80fd5 100644 --- a/src/tinygettext/tgt_log.hpp +++ b/src/tinygettext/tgt_log.hpp @@ -45,7 +45,7 @@ private: public: Log(log_callback_t callback); ~Log(); - + std::ostream& get(); }; diff --git a/src/tracks/ambient_light_sphere.hpp b/src/tracks/ambient_light_sphere.hpp index d10af5e03..5cc494f77 100644 --- a/src/tracks/ambient_light_sphere.hpp +++ b/src/tracks/ambient_light_sphere.hpp @@ -45,14 +45,14 @@ private: * file is stored. */ float m_inner_radius2; - /** THe full ambient color to use once the kart is inside the + /** THe full ambient color to use once the kart is inside the * inner radius. */ video::SColor m_ambient_color; public: AmbientLightSphere(const XMLNode &node, unsigned int index); virtual ~AmbientLightSphere() {}; virtual void update(float dt); - virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, + virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, unsigned int indx); }; // AmbientLightSphere diff --git a/src/tracks/bezier_curve.hpp b/src/tracks/bezier_curve.hpp index 642bfcb18..d9bce843d 100644 --- a/src/tracks/bezier_curve.hpp +++ b/src/tracks/bezier_curve.hpp @@ -26,7 +26,7 @@ class XMLNode; -/** +/** * A class to manage bezier curves and interpolation. * \ingroup tracks */ diff --git a/src/tracks/check_cannon.hpp b/src/tracks/check_cannon.hpp index 7726763a1..3c14ed2c1 100644 --- a/src/tracks/check_cannon.hpp +++ b/src/tracks/check_cannon.hpp @@ -27,7 +27,7 @@ class Ipo; class ShowCurve; class XMLNode; -/** +/** * \brief Implements a simple checkline that will cause a kart to be * shot to a specified point. * diff --git a/src/tracks/check_goal.hpp b/src/tracks/check_goal.hpp index f7da9d784..577a0be49 100644 --- a/src/tracks/check_goal.hpp +++ b/src/tracks/check_goal.hpp @@ -28,7 +28,7 @@ class CheckManager; class XMLNode; class Track; -/** +/** * \brief Implements a simple checkline that will score a point when the * soccer ball crosses it. * @@ -39,16 +39,16 @@ class CheckGoal : public CheckStructure private: /** Which team is this goal for? */ bool m_first_goal; - + /** The line that is tested for being crossed. */ core::line2df m_line; - + public: CheckGoal(const XMLNode &node, unsigned int index); virtual ~CheckGoal() {} virtual void update(float dt) OVERRIDE; virtual void trigger(unsigned int kart_index); - virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, + virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, unsigned int indx) OVERRIDE; virtual void reset(const Track &track) OVERRIDE; }; // CheckLine diff --git a/src/tracks/check_lap.hpp b/src/tracks/check_lap.hpp index 5663fd10d..f873928ab 100644 --- a/src/tracks/check_lap.hpp +++ b/src/tracks/check_lap.hpp @@ -24,7 +24,7 @@ class XMLNode; class CheckManager; -/** +/** * \brief Implements a simple lap test. A new lap is detected * when the distance along the track reduces by a certain amount * of time. @@ -39,7 +39,7 @@ private: public: CheckLap(const XMLNode &node, unsigned int index); virtual ~CheckLap() {}; - virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, + virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, unsigned int indx); virtual void reset(const Track &track); }; // CheckLine diff --git a/src/tracks/check_line.hpp b/src/tracks/check_line.hpp index 4589e82ff..f0c14b4d8 100644 --- a/src/tracks/check_line.hpp +++ b/src/tracks/check_line.hpp @@ -29,14 +29,14 @@ using namespace irr; class XMLNode; class CheckManager; -/** +/** * \brief Implements a simple checkline. - * It's a finite line with 2 endpoints in 2d - * and a minimum height (i.e. the minimum Y coordinate of the two points). + * It's a finite line with 2 endpoints in 2d + * and a minimum height (i.e. the minimum Y coordinate of the two points). * If a kart crosses the line (in the projection on the 2d plane) and has an * appropriate height, the checkline will be triggered. This allows for very - * easy checking of checklines, and should be sufficient for most check - * structure. + * easy checking of checklines, and should be sufficient for most check + * structure. * * \ingroup tracks */ @@ -56,7 +56,7 @@ private: * points are set from the 2d points and the min height. */ Vec3 m_left_point, m_right_point; - /** Stores the sign (i.e. side) of the previous line to save some + /** Stores the sign (i.e. side) of the previous line to save some * computations. True if the value is >=0, i.e. the point is on * or to the right of the line. */ std::vector m_previous_sign; @@ -74,7 +74,7 @@ private: public: CheckLine(const XMLNode &node, unsigned int index); virtual ~CheckLine(); - virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, + virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, unsigned int indx); virtual void reset(const Track &track); virtual void changeDebugColor(bool is_active); diff --git a/src/tracks/check_sphere.hpp b/src/tracks/check_sphere.hpp index 79b846eab..d9befa876 100644 --- a/src/tracks/check_sphere.hpp +++ b/src/tracks/check_sphere.hpp @@ -26,7 +26,7 @@ class CheckManager; /** This class implements a check sphere that is used to change the ambient * light if a kart is inside this sphere. Besides a normal radius this - * sphere also has a 2nd 'inner' radius: player karts inside the inner + * sphere also has a 2nd 'inner' radius: player karts inside the inner * radius will have the full new ambient light, karts outside the default * light, and karts in between will mix the light dependent on distance. * @@ -47,13 +47,13 @@ private: public: CheckSphere(const XMLNode &node, unsigned int index); virtual ~CheckSphere() {}; - virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, + virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, unsigned int kart_id); // ------------------------------------------------------------------------ /** Returns if kart indx is currently inside of the sphere. */ bool isInside(int index) const { return m_is_inside[index]; } // ------------------------------------------------------------------------- - /** Returns the squared distance of kart index from the enter of + /** Returns the squared distance of kart index from the enter of * this sphere. */ float getDistance2ForKart(int index) const { return m_distance2[index];} // ------------------------------------------------------------------------- diff --git a/src/tracks/check_structure.hpp b/src/tracks/check_structure.hpp index 6c68330d5..93285d0a4 100644 --- a/src/tracks/check_structure.hpp +++ b/src/tracks/check_structure.hpp @@ -28,17 +28,17 @@ class XMLNode; class Track; class CheckManager; -/** +/** * \brief Virtual base class for a check structure. * * A check structure has a certain ype: * CT_NEW_LAP : triggering this check structure will cause a new lap to be * counted. If this type is triggered, it will set itselt to * inactive (which means it is not possible to count several - * laps by driving over the starting line forwardws and + * laps by driving over the starting line forwardws and * backwards) * CT_ACTIVATE: Activates the specified other check structures. - * CT_TOGGLE: Toggles the specified other check structures (active to + * CT_TOGGLE: Toggles the specified other check structures (active to * inactive and vice versa. * CT_CANNON: A check line that 'shoots' the kart to a specified location. * CT_GOAL: A goal line in soccer mode. @@ -50,7 +50,7 @@ class CheckManager; class CheckStructure { public: - /** Different types of check structures: + /** Different types of check structures: * ACTIVATE: Activates another check structure (independent of * the state that check structure is in) * TOGGLE: Switches (inverts) the state of another check structure. @@ -80,12 +80,12 @@ protected: /** Stores the index of this check structure. This is only used for * debugging (use --check-debug option). */ unsigned int m_index; - + private: /** The type of this checkline. */ CheckType m_check_type; - /** Contains the indices of the corresponding check structures that + /** Contains the indices of the corresponding check structures that * get their state changed (activated or switched). */ std::vector m_check_structures_to_change_state; @@ -113,7 +113,7 @@ public: * \param indx Index of the kart, can be used to store kart specific * additional data. */ - virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, + virtual bool isTriggered(const Vec3 &old_pos, const Vec3 &new_pos, unsigned int indx)=0; virtual void trigger(unsigned int kart_index); virtual void reset(const Track &track); diff --git a/src/tracks/graph_node.hpp b/src/tracks/graph_node.hpp index 576073cb8..482602d74 100644 --- a/src/tracks/graph_node.hpp +++ b/src/tracks/graph_node.hpp @@ -31,15 +31,15 @@ class QuadGraph; -/** - * \brief This class stores a node of the graph, i.e. a list of successor +/** + * \brief This class stores a node of the graph, i.e. a list of successor * edges. * \ingroup tracks */ -class GraphNode +class GraphNode { -public: - /** To indiciate in which direction the track is going: +public: + /** To indiciate in which direction the track is going: * straight, left, right. The undefined direction is used by the * AI only. */ enum DirectionType {DIR_STRAIGHT, DIR_LEFT, DIR_RIGHT, @@ -69,7 +69,7 @@ private: /** Distance from the start to the beginning of this quad. */ float m_distance_from_start; - /** Width of the track, which is the average of the width at the + /** Width of the track, which is the average of the width at the * beginning and at the end. FIXME: for now the width is independent * of the orientation (e.g. a quad used more than once might once * be used from top to bottom, one from left to right, so it should @@ -90,7 +90,7 @@ private: /** A vector from the center of the quad to the right edge. */ Vec3 m_center_to_right; - /** Line between lower and upper center, saves computation in + /** Line between lower and upper center, saves computation in * getDistanceFromLine() later. The line is 2d only since otherwise * taller karts would have a larger distance from the center. It also * saves computation, and it is only needed to determine the distance @@ -106,7 +106,7 @@ private: /** The direction for each of the successors. */ std::vector m_direction; - + /** Stores for each successor the index of the last graph node that * has the same direction (i.e. if index 0 curves left, this vector * will store the index of the last graph node that is still turning @@ -123,8 +123,8 @@ private: * alternate ways) */ std::vector< int > m_checkline_requirements; - - void markAllSuccessorsToUse(unsigned int n, + + void markAllSuccessorsToUse(unsigned int n, PathToNodeVector *m_path_to_node); public: @@ -134,22 +134,22 @@ public: float getDistance2FromPoint(const Vec3 &xyz); void setupPathsToNode(); void setChecklineRequirements(int latest_checkline); - void setDirectionData(unsigned int successor, DirectionType dir, + void setDirectionData(unsigned int successor, DirectionType dir, unsigned int last_node_index); // ------------------------------------------------------------------------ /** Returns the number of successors. */ - unsigned int getNumberOfSuccessors() const + unsigned int getNumberOfSuccessors() const { return (unsigned int)m_successor_nodes.size(); } // ------------------------------------------------------------------------ /** Returns the i-th successor node. */ - unsigned int getSuccessor(unsigned int i) const + unsigned int getSuccessor(unsigned int i) const { return m_successor_nodes[i]; } // ------------------------------------------------------------------------ /** Returns the number of predecessors. */ unsigned int getNumberOfPredecessors() const { return (unsigned int)m_predecessor_nodes.size(); } // ------------------------------------------------------------------------ - /** Returns a predecessor for this node. Note that the first predecessor + /** Returns a predecessor for this node. Note that the first predecessor * is the most 'natural' one, i.e. the one on the main driveline. */ int getPredecessor(unsigned int i) const {return m_predecessor_nodes[i]; } @@ -161,10 +161,10 @@ public: const Quad& getQuad() const {return QuadSet::get()->getQuad(m_quad_index);} // ------------------------------------------------------------------------ /** Returns the i-th. point of a quad. ATM this just returns the vertices - * from the quads, but if necessary this method will also consider - * rotated quads. So index 0 will always be lower left point, then + * from the quads, but if necessary this method will also consider + * rotated quads. So index 0 will always be lower left point, then * counterclockwise. */ - const Vec3& operator[](int i) const + const Vec3& operator[](int i) const {return QuadSet::get()->getQuad(m_quad_index)[i];} // ------------------------------------------------------------------------ /** Returns the distance to the j-th. successor. */ @@ -177,7 +177,7 @@ public: { return m_angle_to_next[j]; } // ------------------------------------------------------------------------ /** Returns the distance from start. */ - float getDistanceFromStart() const + float getDistanceFromStart() const { return m_distance_from_start; } // ------------------------------------------------------------------------ /** Sets the distance from start for this node. */ @@ -193,11 +193,11 @@ public: const Vec3& getUpperCenter() const {return m_upper_center;} // ------------------------------------------------------------------------ /** Returns the center point of this graph node. */ - const Vec3 getCenter() const + const Vec3 getCenter() const {return (m_upper_center + m_lower_center) / 2.0f;} // ------------------------------------------------------------------------ /** Returns the length of the quad of this node. */ - float getNodeLength() const + float getNodeLength() const {return (m_lower_center-m_upper_center).length();} // ------------------------------------------------------------------------ /** Returns true if the index-successor of this node is one that the AI @@ -213,20 +213,20 @@ public: * \param n Index of the graph node to reach. */ int getSuccessorToReach(unsigned int n) - { + { // If we have a path to node vector, use its information, otherwise // (i.e. there is only one successor anyway) use this one successor. return m_path_to_node.size()>0 ? m_path_to_node[n] : 0; } // getSuccesorToReach // ------------------------------------------------------------------------ /** Returns the checkline requirements of this graph node. */ - const std::vector& getChecklineRequirements() const + const std::vector& getChecklineRequirements() const { return m_checkline_requirements; } // ------------------------------------------------------------------------ /** Returns the direction in which the successor n is. */ void getDirectionData(unsigned int succ, DirectionType *dir, - unsigned int *last) const - { + unsigned int *last) const + { *dir = m_direction[succ]; *last = m_last_index_same_direction[succ]; } // ------------------------------------------------------------------------ diff --git a/src/tracks/lod_node_loader.hpp b/src/tracks/lod_node_loader.hpp index c11a169ae..22f76127d 100644 --- a/src/tracks/lod_node_loader.hpp +++ b/src/tracks/lod_node_loader.hpp @@ -27,7 +27,7 @@ class Track; #include #include "io/xml_node.hpp" -namespace irr +namespace irr { namespace scene { @@ -40,21 +40,21 @@ struct LodModel std::string m_model_file; bool m_tangent; const XMLNode* m_xml; - + /** Constructor to allow storing this in STL containers */ LodModel() { m_tangent = false; m_xml = NULL; } - + LodModel(const XMLNode* xml, std::string& model, bool tangent) { m_model_file = model; m_tangent = tangent; m_xml = xml; } - + ~LodModel() { } @@ -71,13 +71,13 @@ private: public: LodNodeLoader(); - + bool check(const XMLNode* xml); void done(Track* track, std::string directory, std::vector& cache, std::vector& out); - + void clear(); }; // LodNodeLoader diff --git a/src/tracks/quad.hpp b/src/tracks/quad.hpp index f823d7665..80e3bc8f1 100644 --- a/src/tracks/quad.hpp +++ b/src/tracks/quad.hpp @@ -33,13 +33,13 @@ class btTransform; /** * \ingroup tracks */ -class Quad +class Quad { private: /** The four points of a quad. */ Vec3 m_p[4]; - /** The center of all four points, which is used by the AI. + /** The center of all four points, which is used by the AI. * This saves some computations at runtime. */ Vec3 m_center; @@ -79,6 +79,6 @@ public: // ------------------------------------------------------------------------ /** True if this quad should be ignored by the AI. */ bool letAIIgnore() const { return m_ai_ignore; } - + }; // class Quad #endif diff --git a/src/tracks/quad_graph.hpp b/src/tracks/quad_graph.hpp index db23c65c2..7c8d5d805 100644 --- a/src/tracks/quad_graph.hpp +++ b/src/tracks/quad_graph.hpp @@ -41,7 +41,7 @@ class CheckLine; /** * \brief This class stores a graph of quads. It uses a 'simplified singleton' * design pattern: it has a static create function to create exactly instance, - * a destroy function, and a get function (that does not have the side effect + * a destroy function, and a get function (that does not have the side effect * of the 'normal singleton' design pattern to create an instance). Besides * saving on the if statement in get(), this is necessary since certain race * modes might not have a quad graph at all (e.g. battle mode). So get() @@ -50,7 +50,7 @@ class CheckLine; */ class QuadGraph : public NoCopy { - + private: static QuadGraph *m_quad_graph; @@ -74,7 +74,7 @@ private: /** Stores the filename - just used for error messages. */ std::string m_quad_filename; - + /** Wether the graph should be reverted or not */ bool m_reverse; @@ -88,11 +88,11 @@ private: void load (const std::string &filename); void computeDistanceFromStart(unsigned int start_node, float distance); void createMesh(bool show_invisible=true, - bool enable_transparency=false, + bool enable_transparency=false, const video::SColor *track_color=NULL, const video::SColor *lap_color=NULL); unsigned int getStartNode() const; - QuadGraph (const std::string &quad_file_name, + QuadGraph (const std::string &quad_file_name, const std::string graph_file_name, const bool reverse); ~QuadGraph (); @@ -101,10 +101,10 @@ public: void createDebugMesh(); void cleanupDebugMesh(); - void getSuccessors(int node_number, + void getSuccessors(int node_number, std::vector& succ, bool for_ai=false) const; - void spatialToTrack(Vec3 *dst, const Vec3& xyz, + void spatialToTrack(Vec3 *dst, const Vec3& xyz, const int sector) const; void findRoadSector(const Vec3& XYZ, int *sector, std::vector *all_sectors=NULL) const; @@ -112,14 +112,14 @@ public: const int curr_sector=UNKNOWN_SECTOR, std::vector *all_sectors=NULL ) const; - void setDefaultStartPositions(AlignedArray + void setDefaultStartPositions(AlignedArray *start_transforms, unsigned int karts_per_row, float forwards_distance=1.5f, float sidewards_distance=1.5f, float upwards_distance=0.0f) const; video::ITexture *makeMiniMap(const core::dimension2du &where, - const std::string &name, + const std::string &name, const video::SColor &fill_color =video::SColor(127, 255, 255, 255) ); void mapPoint2MiniMap(const Vec3 &xyz, Vec3 *out) const; @@ -134,7 +134,7 @@ public: static QuadGraph *get() { return m_quad_graph; } // ---------------------------------------------------------------------- /** Creates a QuadGraph instance. */ - static void create(const std::string &quad_file_name, + static void create(const std::string &quad_file_name, const std::string graph_file_name, const bool reverse) { @@ -145,7 +145,7 @@ public: } // create // ---------------------------------------------------------------------- /** Cleans up the quad graph. It is possible that this function is called - * even if no instance exists (e.g. in battle mode). So it is not an + * even if no instance exists (e.g. in battle mode). So it is not an * error if there is no instance. */ static void destroy() { @@ -157,19 +157,19 @@ public: } // destroy // ---------------------------------------------------------------------- /** Returns the number of nodes in the graph. */ - unsigned int getNumNodes() const { return m_all_nodes.size(); } + unsigned int getNumNodes() const { return m_all_nodes.size(); } // ---------------------------------------------------------------------- /** Return the distance to the j-th successor of node n. */ float getDistanceToNext(int n, int j) const { return m_all_nodes[n]->getDistanceToSuccessor(j);} // ---------------------------------------------------------------------- - /** Returns the angle of the line between node n and its j-th. + /** Returns the angle of the line between node n and its j-th. * successor. */ float getAngleToNext(int n, int j) const { return m_all_nodes[n]->getAngleToSuccessor(j); } // ---------------------------------------------------------------------- /** Returns the number of successors of a node n. */ - int getNumberOfSuccessors(int n) const + int getNumberOfSuccessors(int n) const { return m_all_nodes[n]->getNumberOfSuccessors(); } // ---------------------------------------------------------------------- /** Returns the quad that belongs to a graph node. */ diff --git a/src/tracks/quad_set.hpp b/src/tracks/quad_set.hpp index c87803f94..3e33ea48a 100644 --- a/src/tracks/quad_set.hpp +++ b/src/tracks/quad_set.hpp @@ -43,7 +43,7 @@ private: /** Pointer to the one instance of a quad set. */ static QuadSet *m_quad_set; - void getPoint(const XMLNode *xml, const std::string &attribute_name, + void getPoint(const XMLNode *xml, const std::string &attribute_name, Vec3 *result) const; QuadSet(); ~QuadSet(); @@ -73,15 +73,15 @@ public: const Quad& getQuad(int n) const {return *(m_all_quads[n]); } // ------------------------------------------------------------------------ /** Return the minimum and maximum coordinates of this quad set. */ - void getBoundingBox(Vec3 *min, Vec3 *max) + void getBoundingBox(Vec3 *min, Vec3 *max) { *min=m_min; *max=m_max; } // ------------------------------------------------------------------------ /** Returns the number of quads. */ - unsigned int getNumberOfQuads() const + unsigned int getNumberOfQuads() const {return (unsigned int)m_all_quads.size(); } // ------------------------------------------------------------------------ /** Returns the center of quad n. */ - const Vec3& getCenterOfQuad(int n) const + const Vec3& getCenterOfQuad(int n) const {return m_all_quads[n]->getCenter(); } // ------------------------------------------------------------------------ /** Returns the n-th. quad. */ diff --git a/src/tracks/terrain_info.hpp b/src/tracks/terrain_info.hpp index 0d9286c11..670be49bf 100644 --- a/src/tracks/terrain_info.hpp +++ b/src/tracks/terrain_info.hpp @@ -45,12 +45,12 @@ public: virtual ~TerrainInfo() {}; virtual void update(const Vec3 &pos); - bool getSurfaceInfo(const Vec3 &from, Vec3 *position, + bool getSurfaceInfo(const Vec3 &from, Vec3 *position, const Material **m); // ------------------------------------------------------------------------ /** Returns the height of the terrain. we're currently above */ - float getHoT() const {return m_hit_point.getY(); } + float getHoT() const {return m_hit_point.getY(); } // ------------------------------------------------------------------------ /** Returns the current material the kart is on. */ const Material *getMaterial() const {return m_material; } diff --git a/src/tracks/track.hpp b/src/tracks/track.hpp index 0291413e3..5a134b95d 100644 --- a/src/tracks/track.hpp +++ b/src/tracks/track.hpp @@ -70,11 +70,11 @@ struct OverworldForceField core::vector3df m_position; bool m_is_locked; int m_required_points; - + OverworldForceField() { } - + OverworldForceField(core::vector3df position, bool is_locked, int required_points) { m_position = position; @@ -88,31 +88,31 @@ private: OverworldForceField m_force_field; bool m_force_field_set; public: - + core::vector3df m_position; std::string m_challenge_id; - + OverworldChallenge(core::vector3df position, std::string challenge_id) { m_position = position; m_challenge_id = challenge_id; m_force_field_set = false; } - + void setForceField(OverworldForceField f) { m_force_field = f; m_force_field_set = true; } - + OverworldForceField& getForceField() { assert(m_force_field_set); return m_force_field; } - + bool isForceFieldSet() const { return m_force_field_set; } - + const OverworldForceField& getForceField() const { assert(m_force_field_set); @@ -125,7 +125,7 @@ struct Subtitle { int m_from, m_to; core::stringw m_text; - + Subtitle(int from, int to, core::stringw text) { m_from = from; @@ -143,11 +143,11 @@ struct Subtitle class Track { private: - + #ifdef DEBUG unsigned int m_magic_number; #endif - + float m_gravity; std::string m_ident; std::string m_screenshot; @@ -155,11 +155,11 @@ private: /** Will only be used on overworld */ std::vector m_challenges; - + std::vector m_force_fields; - + std::vector m_subtitles; - + /** Start transforms of karts (either the default, or the ones taken * from the scene file). */ AlignedArray m_start_transforms; @@ -167,7 +167,7 @@ private: std::string m_item_style; std::string m_description; core::stringw m_designer; - + /** The full filename of the config (xml) file. */ std::string m_filename; @@ -185,7 +185,7 @@ private: * This one assumes the mesh is NOT connected to any node. */ std::vector m_detached_cached_meshes; - + /** A list of all textures loaded by the track, so that they can * be removed from the cache at cleanup time. */ std::vector m_all_cached_textures; @@ -199,7 +199,7 @@ private: bool m_cache_track; #ifdef DEBUG - /** A list of textures that were cached before the track is loaded. + /** A list of textures that were cached before the track is loaded. * After cleanup of ta track it can be tested which new textures * are still in the cache, and print a report of leaked textures * (in debug mode only). */ @@ -218,7 +218,7 @@ private: TriangleMesh* m_track_mesh; /** Used to collect the triangles which do not have a physical * representation, but are needed for some raycast effects. An - * example is a water surface: the karts ignore this (i.e. + * example is a water surface: the karts ignore this (i.e. * allowing the kart to drive in/partly under water), but the * actual surface position is needed for the water splash effect. */ TriangleMesh* m_gfx_effect_mesh; @@ -232,9 +232,9 @@ private: bool m_has_easter_eggs; /** True if this track is a soccer arena. */ bool m_is_soccer; - + bool m_is_cutscene; - + /** The version of this track. A certain STK version will only support * certain track versions. */ int m_version; @@ -246,7 +246,7 @@ private: * in the track seelction screen */ bool m_internal; - + /** Whether this track should be available in reverse version */ bool m_reverse_available; @@ -261,30 +261,30 @@ private: bool m_enable_push_back; /** The type of sky to be used for the track. */ - enum {SKY_NONE, SKY_BOX, + enum {SKY_NONE, SKY_BOX, SKY_DOME, SKY_COLOR} m_sky_type; /** sky rotation speed */ float m_sky_dx, m_sky_dy; - + /** A list of the textures for the sky to use. It contains one texture * in case of a dome, and 6 textures for a box. */ std::vector m_sky_textures; /** Used if m_sky_type is SKY_COLOR only */ irr::video::SColor m_sky_color; - + /** The list of all animated textures. */ std::vector m_animated_textures; /** Manager for all track objects. */ TrackObjectManager *m_track_object_manager; - /** If a sky dome is used, the number of horizontal segments + /** If a sky dome is used, the number of horizontal segments * the sphere should be divided in. */ int m_sky_hori_segments; - /** If a sky dome is used, the number of vertical segments + /** If a sky dome is used, the number of vertical segments * the sphere should be divided in. */ int m_sky_vert_segments; @@ -296,10 +296,10 @@ private: /** Particles emitted from the sky (wheather) */ ParticleKind* m_sky_particles; - + /** Use a special built-in wheather */ WeatherType m_weather_type; - + /** A simple class to keep information about a track mode. */ class TrackMode { @@ -308,20 +308,20 @@ private: std::string m_quad_name; /**< Name of the quad file to use. */ std::string m_graph_name; /**< Name of the graph file to use. */ std::string m_scene; /**< Name of the scene file to use. */ - + #ifdef DEBUG unsigned int m_magic_number; #endif - + /** Default constructor, sets default names for all fields. */ TrackMode() : m_name("default"), m_quad_name("quads.xml"), - m_graph_name("graph.xml"), m_scene("scene.xml") + m_graph_name("graph.xml"), m_scene("scene.xml") { #ifdef DEBUG m_magic_number = 0x46825179; #endif } - + ~TrackMode() { #ifdef DEBUG @@ -329,7 +329,7 @@ private: m_magic_number = 0xDEADBEEF; #endif } - + }; // TrackMode /** List of all modes for a track. */ @@ -337,7 +337,7 @@ private: /** Name of the track to display. */ std::string m_name; - + bool m_use_fog; /** True if this track supports using smoothed normals. */ bool m_smooth_normals; @@ -358,7 +358,7 @@ private: core::dimension2du m_mini_map_size; float m_minimap_x_scale; float m_minimap_y_scale; - + /** List of all bezier curves in the track - for e.g. camera, ... */ std::vector m_all_curves; @@ -367,7 +367,7 @@ private: void convertTrackToBullet(scene::ISceneNode *node); bool loadMainTrack(const XMLNode &node); void createWater(const XMLNode &node); - void getMusicInformation(std::vector& filenames, + void getMusicInformation(std::vector& filenames, std::vector& m_music ); void loadCurves(const XMLNode &node); void handleSky(const XMLNode &root, const std::string &filename); @@ -376,7 +376,7 @@ public: bool reverseAvailable() { return m_reverse_available; } void handleAnimatedTextures(scene::ISceneNode *node, const XMLNode &xml); - + static const float NOHIT; Track (const std::string &filename); @@ -384,25 +384,25 @@ public: void cleanup (); void removeCachedData (); void startMusic () const; - + bool setTerrainHeight(Vec3 *pos) const; void createPhysicsModel(unsigned int main_track_count); void update(float dt); void reset(); void adjustForFog(scene::ISceneNode *node); - void adjustForFog(scene::IMesh* mesh, + void adjustForFog(scene::IMesh* mesh, scene::ISceneNode* parent_scene_node); void itemCommand(const XMLNode *node); const core::vector3df& getSunRotation(); /** Sets the current ambient color for a kart with index k. */ void setAmbientColor(const video::SColor &color, unsigned int k); - void handleExplosion(const Vec3 &pos, + void handleExplosion(const Vec3 &pos, const PhysicalObject *mp, bool secondary_hits=true) const; void loadTrackModel (bool reverse_track = false, unsigned int mode_id=0); - std::vector< std::vector > + std::vector< std::vector > buildHeightMap(); // ------------------------------------------------------------------------ /** Returns the texture with the mini map for this track. */ @@ -417,7 +417,7 @@ public: bool hasEasterEggs() const { return m_has_easter_eggs; } bool isSoccer () const { return m_is_soccer; } // ------------------------------------------------------------------------ - void loadTrackModel (World* parent, + void loadTrackModel (World* parent, bool reverse_track = false, unsigned int mode_id=0); // ------------------------------------------------------------------------ @@ -430,7 +430,7 @@ public: int getVersion () const {return m_version; } // ------------------------------------------------------------------------ /** Returns the length of the main driveline. */ - float getTrackLength () const + float getTrackLength () const {return QuadGraph::get()->getLapLength();} // ------------------------------------------------------------------------ /** Returns a unique identifier for this track (the directory name). */ @@ -438,7 +438,7 @@ public: // ------------------------------------------------------------------------ /** Returns the name of the track, which is e.g. displayed on the screen. \note this is the LTR name, invoke fribidi as needed. */ - const wchar_t* getName () const + const wchar_t* getName () const {return translations->w_gettext(m_name.c_str()); } // ------------------------------------------------------------------------ /** Returns all groups this track belongs to. */ @@ -456,7 +456,7 @@ public: // ------------------------------------------------------------------------ /** Returns the start coordinates for a kart with a given index. * \param index Index of kart ranging from 0 to kart_num-1. */ - btTransform getStartTransform (unsigned int index) const + btTransform getStartTransform (unsigned int index) const { if (index >= m_start_transforms.size()) { @@ -474,12 +474,12 @@ public: * after a rescue, and to detect wrong directions. This function will * always return the angle towards the first successor, i.e. the angle * in the direction of the default way on the track. - * \param n Number of the quad for which the angle is asked. + * \param n Number of the quad for which the angle is asked. */ - float getAngle(int n) const + float getAngle(int n) const { return QuadGraph::get()->getAngleToNext(n, 0); } // ------------------------------------------------------------------------ - /** Returns the 2d coordinates of a point when drawn on the mini map + /** Returns the 2d coordinates of a point when drawn on the mini map * texture. * \param xyz Coordinates of the point to map. * \param draw_at The coordinates in pixel on the mini map of the point, @@ -488,14 +488,14 @@ public: void mapPoint2MiniMap(const Vec3 &xyz, Vec3 *draw_at) const; // ------------------------------------------------------------------------ /** Returns the full path of a given file inside this track directory. */ - std::string getTrackFile(const std::string &s) const + std::string getTrackFile(const std::string &s) const { return m_root+"/"+s; } // ------------------------------------------------------------------------ /** Returns the number of modes available for this track. */ unsigned int getNumberOfModes() const { return m_all_modes.size(); } // ------------------------------------------------------------------------ /** Returns the name of the i-th. mode. */ - const std::string &getModeName(unsigned int i) const + const std::string &getModeName(unsigned int i) const { return m_all_modes[i].m_name; } // ------------------------------------------------------------------------ /** Returns the default ambient color. */ @@ -512,8 +512,8 @@ public: const TriangleMesh& getGFXEffectMesh() const {return *m_gfx_effect_mesh;} // ------------------------------------------------------------------------ /** Get the number of start positions defined in the scene file. */ - unsigned int getNumberOfStartPositions() const - { return m_start_transforms.size(); } + unsigned int getNumberOfStartPositions() const + { return m_start_transforms.size(); } // ------------------------------------------------------------------------ WeatherType getWeatherType () const { return m_weather_type; } // ------------------------------------------------------------------------ @@ -538,16 +538,16 @@ public: bool isPushBackEnabled() const { return m_enable_push_back; } // ------------------------------------------------------------------------ /** Returns true if the normals of this track can be smoothed. */ - bool smoothNormals() const { return m_smooth_normals; } + bool smoothNormals() const { return m_smooth_normals; } // ------------------------------------------------------------------------ TrackObjectManager* getTrackObjectManager() const {return m_track_object_manager;} - + /** Get list of challenges placed on that world. Works only for overworld. */ const std::vector& getChallengeList() const { return m_challenges; } const std::vector& getSubtitles() const { return m_subtitles; } - + }; // class Track #endif diff --git a/src/tracks/track_manager.hpp b/src/tracks/track_manager.hpp index d9ef57ff1..7b7cd59e0 100644 --- a/src/tracks/track_manager.hpp +++ b/src/tracks/track_manager.hpp @@ -34,34 +34,34 @@ class TrackManager private: /** All directories in which tracks are searched. */ static std::vector m_track_search_path; - + /** All directories in which tracks were found. */ std::vector m_all_track_dirs; typedef std::vector Tracks; - + /** All track objects. */ Tracks m_tracks; - + typedef std::map > Group2Indices; /** List of all racing track groups. */ Group2Indices m_track_groups; - + /** List of all arena groups. */ Group2Indices m_arena_groups; - + /** List of all soccer arena groups. */ Group2Indices m_soccer_arena_groups; - + /** List of all groups (for both normal tracks and arenas) */ //std::vector m_all_group_names; - + /** List of the names of all groups containing tracks */ std::vector m_track_group_names; - + /** List of the names of all groups containing arenas */ std::vector m_arena_group_names; - + /** List of the names of all groups containing soccer arenas */ std::vector m_soccer_arena_group_names; @@ -79,7 +79,7 @@ public: static void addTrackSearchDir(const std::string &dir); /** Returns a list of all track identifiers. */ std::vector getAllTrackIdentifiers(); - + /** Load all .track files from all directories */ void loadTrackList(); void removeTrack(const std::string &ident); @@ -87,21 +87,21 @@ public: void removeAllCachedData(); Track* getTrack(const std::string& ident) const; // ------------------------------------------------------------------------ - /** Sets a list of track as being unavailable (e.g. in network mode the - * track is not on all connected machines. + /** Sets a list of track as being unavailable (e.g. in network mode the + * track is not on all connected machines. * \param tracks List of tracks to mark as unavilable. */ void setUnavailableTracks(const std::vector &tracks); // ------------------------------------------------------------------------ /** \brief Returns a list of all directories that contain a track. */ - const std::vector* getAllTrackDirs() const - { - return &m_all_track_dirs; + const std::vector* getAllTrackDirs() const + { + return &m_all_track_dirs; } // getAllTrackDirs // ------------------------------------------------------------------------ /** \brief Returns a list of the names of all used track groups. */ const std::vector& getAllTrackGroups() const { - return m_track_group_names; + return m_track_group_names; } // getAllTrackGroups // ------------------------------------------------------------------------ /** \brief Returns a list of the names of all used arena groups. */ @@ -110,28 +110,28 @@ public: { return soccer_arena ? m_soccer_arena_group_names : m_arena_group_names; } // getAllArenaGroups - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ /** Returns the number of tracks. */ size_t getNumberOfTracks() const { return m_tracks.size(); } // ------------------------------------------------------------------------ - /** Returns the track with a given index number. + /** Returns the track with a given index number. * \param index The index number of the track. */ Track* getTrack(unsigned int index) const { return m_tracks[index];} // ------------------------------------------------------------------------ - /** Checks if a certain track is available. + /** Checks if a certain track is available. * \param n Index of the track to check. */ bool isAvailable(unsigned int n) const {return m_track_avail[n];} // ------------------------------------------------------------------------ /** Returns a list of all tracks in a given group. * \param g Name of the group. */ - const std::vector& getTracksInGroup(const std::string& g) + const std::vector& getTracksInGroup(const std::string& g) { return m_track_groups[g]; } // getTracksInGroup // ------------------------------------------------------------------------ - /** Returns a list of all arenas in a given group. + /** Returns a list of all arenas in a given group. * \param g Name of the group. */ - const std::vector& + const std::vector& getArenasInGroup(const std::string& g, bool soccer_arena=false) { return soccer_arena ? m_soccer_arena_groups[g] : m_arena_groups[g]; diff --git a/src/tracks/track_object.hpp b/src/tracks/track_object.hpp index 4d81106d3..23380c592 100644 --- a/src/tracks/track_object.hpp +++ b/src/tracks/track_object.hpp @@ -42,7 +42,7 @@ class ThreeDAnimation; class TrackObject : public NoCopy { //public: - // The different type of track objects: physical objects, graphical + // The different type of track objects: physical objects, graphical // objects (without a physical representation) - the latter might be // eye candy (to reduce work for physics), ... //enum TrackObjectType {TO_PHYSICAL, TO_GRAPHICAL}; @@ -69,42 +69,42 @@ protected: std::string m_lod_group; std::string m_interaction; - + std::string m_type; - + bool m_soccer_ball; - + PhysicalObject* m_rigid_body; - + ThreeDAnimation* m_animator; - + void init(const XMLNode &xml_node, LODNode* lodNode); - + public: TrackObject(const XMLNode &xml_node, LODNode* lodNode=NULL); - + TrackObject(const core::vector3df& xyz, const core::vector3df& hpr, const core::vector3df& scale, const char* interaction, TrackObjectPresentation* presentation, - bool is_dynamic, + bool is_dynamic, const PhysicalObject::Settings* physicsSettings); ~TrackObject(); virtual void update(float dt); virtual void reset(); - /** To finish object constructions. Called after the track model + /** To finish object constructions. Called after the track model * is ready. */ virtual void init() {}; /** Called when an explosion happens. As a default does nothing, will * e.g. be overwritten by physical objects etc. */ virtual void handleExplosion(const Vec3& pos, bool directHit) {}; void setEnable(bool mode); - + const std::string& getLodGroup() const { return m_lod_group; } - + const std::string& getType() const { return m_type; } - + bool isSoccerBall() const { return m_soccer_ball; } const PhysicalObject* getPhysics() const { return m_rigid_body; } @@ -113,7 +113,7 @@ public: const core::vector3df getInitXYZ() const { return m_init_xyz; } const core::vector3df getInitRotation() const { return m_init_hpr; } const core::vector3df getInitScale() const { return m_init_scale; } - + void move(const core::vector3df& xyz, const core::vector3df& hpr, const core::vector3df& scale, bool updateRigidBody); @@ -122,14 +122,14 @@ public: template const T* getPresentation() const { return dynamic_cast(m_presentation); } - + ThreeDAnimation* getAnimator() { return m_animator; } const ThreeDAnimation* getAnimator() const { return m_animator; } - + const core::vector3df& getPosition() const; const core::vector3df& getRotation() const; const core::vector3df& getScale() const; - + LEAK_CHECK() }; // TrackObject diff --git a/src/tracks/track_object_manager.hpp b/src/tracks/track_object_manager.hpp index 6d561cdb5..04fb5c30f 100644 --- a/src/tracks/track_object_manager.hpp +++ b/src/tracks/track_object_manager.hpp @@ -39,18 +39,18 @@ class TrackObjectManager { protected: /** - * The different type of track objects: physical objects, graphical + * The different type of track objects: physical objects, graphical * objects (without a physical representation) - the latter might be * eye candy (to reduce work for physics), ... */ enum TrackObjectType {TO_PHYSICAL, TO_GRAPHICAL}; PtrVector m_all_objects; - + /** Temporary storage for LOD objects whose XML node was read but whose * scene node is not yet ready */ std::map > m_lod_objects; - + public: TrackObjectManager(); ~TrackObjectManager(); @@ -60,19 +60,19 @@ public: bool secondary_hits=true); void reset(); void init(); - + /** Enable or disable fog on objects */ void enableFog(bool enable); void insertObject(TrackObject* object); - + void removeObject(TrackObject* who); - + void assingLodNodes(const std::vector& lod); - + PtrVector& getObjects() { return m_all_objects; } const PtrVector& getObjects() const { return m_all_objects; } - + }; // class TrackObjectManager #endif diff --git a/src/tracks/track_object_presentation.hpp b/src/tracks/track_object_presentation.hpp index 329131e3b..80fc90a6b 100644 --- a/src/tracks/track_object_presentation.hpp +++ b/src/tracks/track_object_presentation.hpp @@ -42,7 +42,7 @@ protected: public: TrackObjectPresentation(const XMLNode& xml_node); - + TrackObjectPresentation( const core::vector3df& xyz, const core::vector3df& hpr, @@ -52,19 +52,19 @@ public: m_init_hpr = hpr; m_init_scale = scale; } - + virtual ~TrackObjectPresentation() {} - + virtual void reset() {} virtual void setEnable(bool enabled) {} virtual void update(float dt) {} virtual void move(const core::vector3df& xyz, const core::vector3df& hpr, const core::vector3df& scale) {} - + virtual const core::vector3df& getPosition() const { return m_init_xyz; } virtual const core::vector3df& getRotation() const { return m_init_hpr; } virtual const core::vector3df& getScale() const { return m_init_scale; } - + LEAK_CHECK() }; @@ -93,7 +93,7 @@ public: { m_node = NULL; } - + virtual const core::vector3df& getPosition() const OVERRIDE; virtual const core::vector3df& getRotation() const OVERRIDE; virtual const core::vector3df& getScale() const OVERRIDE; @@ -101,7 +101,7 @@ public: const core::vector3df& scale) OVERRIDE; virtual void setEnable(bool enabled) OVERRIDE; virtual void reset() OVERRIDE; - + scene::ISceneNode* getNode() { return m_node; } const scene::ISceneNode* getNode() const { return m_node; } }; @@ -139,10 +139,10 @@ public: class TrackObjectPresentationMesh : public TrackObjectPresentationSceneNode { private: - /** The mesh used here. It needs to be stored so that it can be + /** The mesh used here. It needs to be stored so that it can be * removed from irrlicht's mesh cache when it is deleted. */ scene::IMesh *m_mesh; - + /** True if it is a looped animation. */ bool m_is_looped; @@ -151,18 +151,18 @@ private: /** End frame of the animation to be played. */ unsigned int m_frame_end; - + void init(const XMLNode* xml_node, bool enabled); - + public: TrackObjectPresentationMesh(const XMLNode& xml_node, bool enabled); - + TrackObjectPresentationMesh( const std::string& model_file, const core::vector3df& xyz, const core::vector3df& hpr, const core::vector3df& scale); virtual ~TrackObjectPresentationMesh(); - + virtual void reset() OVERRIDE; }; @@ -180,9 +180,9 @@ private: /** Currently used for sound effects only, in cutscenes only atm */ std::string m_trigger_condition; - + core::vector3df m_xyz; - + public: TrackObjectPresentationSound(const XMLNode& xml_node); @@ -191,10 +191,10 @@ public: virtual void update(float dt) OVERRIDE; void triggerSound(bool loop); void stopSound(); - + /** Currently used for sound effects only, in cutscenes only atm */ const std::string& getTriggerCondition() const { return m_trigger_condition; } - + virtual void move(const core::vector3df& xyz, const core::vector3df& hpr, const core::vector3df& scale) OVERRIDE; }; @@ -229,15 +229,15 @@ private: ParticleEmitter* m_emitter; LODNode* m_lod_emitter_node; std::string m_trigger_condition; - + public: TrackObjectPresentationParticles(const XMLNode& xml_node); virtual ~TrackObjectPresentationParticles(); - + virtual void update(float dt) OVERRIDE; std::string& getTriggerCondition() { return m_trigger_condition; } - + void triggerParticles(); }; @@ -252,13 +252,13 @@ private: /** For action trigger objects */ std::string m_action; - + public: - + TrackObjectPresentationActionTrigger(const XMLNode& xml_node); virtual ~TrackObjectPresentationActionTrigger() {} - + virtual void onTriggerItemApproached(Item* who) OVERRIDE; }; diff --git a/src/tracks/track_sector.hpp b/src/tracks/track_sector.hpp index af6edf129..d67833bfa 100644 --- a/src/tracks/track_sector.hpp +++ b/src/tracks/track_sector.hpp @@ -73,7 +73,7 @@ public: bool isOnRoad() const { return m_on_road; } // ------------------------------------------------------------------------ void setLastTriggeredCheckline(int i) { m_last_triggered_checkline = i; } - + }; // TrackSector #endif diff --git a/src/utils/aligned_array.hpp b/src/utils/aligned_array.hpp index 0e09880c8..f1afffc96 100644 --- a/src/utils/aligned_array.hpp +++ b/src/utils/aligned_array.hpp @@ -20,12 +20,12 @@ #ifndef HEADER_ALIGNED_ARRAY_HPP #define HEADER_ALIGNED_ARRAY_HPP -// Optimised windows compilation should not use std::vector, but +// Optimised windows compilation should not use std::vector, but // btAlignedObjectArray to enable bullet SSE optimisations. // On the other hand, std::vector gives much better debugging features. // So SSE is disabled in bullet on windows debug #if !defined(DEBUG) && (WIN32) -# undef USE_ALIGNED +# undef USE_ALIGNED #else # undef USE_ALIGNED #endif diff --git a/src/utils/constants.hpp b/src/utils/constants.hpp index 03530c282..b6ff8f4da 100644 --- a/src/utils/constants.hpp +++ b/src/utils/constants.hpp @@ -30,7 +30,7 @@ /* For convenience - here are some multipliers for other units. - + eg 30 * MILES_PER_HOUR is 30mph expressed in m/sec */ diff --git a/src/utils/interpolation_array.hpp b/src/utils/interpolation_array.hpp index ff8b86091..b018fc855 100644 --- a/src/utils/interpolation_array.hpp +++ b/src/utils/interpolation_array.hpp @@ -23,9 +23,9 @@ #include #include -/** This class manages a set of (x_i,y_i) points, x_i must be sorted. - * Those values are then used to linearly interpolate the y value for a - * given x. If x is less than the minimum x_0, y_0 is returned, if x is +/** This class manages a set of (x_i,y_i) points, x_i must be sorted. + * Those values are then used to linearly interpolate the y value for a + * given x. If x is less than the minimum x_0, y_0 is returned, if x is * more than the maximum x_n, y_n is returned. */ class InterpolationArray @@ -62,7 +62,7 @@ public: m_delta.push_back( (m_y[last]-m_y[last-1]) / 0.001f ); else - m_delta.push_back( (m_y[last]-m_y[last-1]) + m_delta.push_back( (m_y[last]-m_y[last-1]) /(m_x[last]-m_x[last-1]) ); } return 1; @@ -78,14 +78,14 @@ public: float getY(unsigned int i) const { return m_y[i]; } // ------------------------------------------------------------------------ /** Sets the Y value for a specified point. */ - void setY(unsigned int i, float y) + void setY(unsigned int i, float y) { - m_y[i] = y; + m_y[i] = y; if(i>0) - m_delta[i-1] = (m_y[i]-m_y[i-1]) + m_delta[i-1] = (m_y[i]-m_y[i-1]) /(m_x[i]-m_x[i-1]); if(i - + 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/src/utils/profiler.hpp b/src/utils/profiler.hpp index f8f1d0b55..3434f170b 100644 --- a/src/utils/profiler.hpp +++ b/src/utils/profiler.hpp @@ -35,10 +35,10 @@ extern Profiler profiler; #define PROFILER_POP_CPU_MARKER() \ profiler.popCpuMarker() - + #define PROFILER_SYNC_FRAME() \ profiler.synchronizeFrame() - + #define PROFILER_DRAW() \ profiler.draw() #else @@ -92,7 +92,7 @@ private: int m_write_id; double m_time_last_sync; double m_time_between_sync; - + // Handling freeze/unfreeze by clicking on the display enum FreezeState { @@ -101,9 +101,9 @@ private: FROZEN, WAITING_FOR_UNFREEZE, }; - + FreezeState m_freeze_state; - + public: Profiler(); virtual ~Profiler(); @@ -113,7 +113,7 @@ public: void synchronizeFrame(); void draw(); - + void onClick(const core::vector2di& mouse_pos); protected: diff --git a/src/utils/ptr_vector.hpp b/src/utils/ptr_vector.hpp index 19cb8079e..34ccbda32 100644 --- a/src/utils/ptr_vector.hpp +++ b/src/utils/ptr_vector.hpp @@ -15,8 +15,8 @@ */ /* - * I made this class to work like a regular vector, except that - * m_contents_vector are placed* one the heap so third-party + * I made this class to work like a regular vector, except that + * m_contents_vector are placed* one the heap so third-party * m_contents_vector can keep pointers to them. */ @@ -47,14 +47,14 @@ public: } // PtrVector // ------------------------------------------------------------------------ - + ~PtrVector() { if(type == HOLD) clearAndDeleteAll(); } // ~PtrVector - + // ------------------------------------------------------------------------ - + void push_back(TYPE* t) { m_contents_vector.push_back(t); @@ -202,7 +202,7 @@ public: if(pointer == obj) { #ifdef USE_ALIGNED - const unsigned int amount = + const unsigned int amount = (unsigned int)m_contents_vector.size(); for(unsigned int i=n; i*(m_contents_vector[j+1])) continue; - // Now search the proper place for m_contents_vector[j+1] + // Now search the proper place for m_contents_vector[j+1] // in the sorted section contentsVectot[start:j] TYPE* t=m_contents_vector[j+1]; unsigned int i = j+1; diff --git a/src/utils/string_utils.hpp b/src/utils/string_utils.hpp index 05901aaa5..b1fbc93b2 100644 --- a/src/utils/string_utils.hpp +++ b/src/utils/string_utils.hpp @@ -48,7 +48,7 @@ namespace StringUtils oss << any ; return oss.str(); } - + template irr::core::stringw toWString (const T& any) { @@ -86,26 +86,26 @@ namespace StringUtils std::string toUpperCase(const std::string&); std::string toLowerCase(const std::string&); - std::vector split(const std::string& s, char c, + std::vector split(const std::string& s, char c, bool keepSplitChar=false); - std::vector split(const irr::core::stringw& s, + std::vector split(const irr::core::stringw& s, char c, bool keepSplitChar=false); std::vector splitPath(const std::string& path); - + // ------------------------------------------------------------------------ - /** - * Replaces the first %s or %i/%d in the string with the first value + /** + * Replaces the first %s or %i/%d in the string with the first value * converted to a string), the 2nd %s or %d with the second value etc. * So this is basically a simplified s(n)printf replacement, but doesn't * do any fancy formatting (and no type checks either - so you can print * a string into a %d field). This is basically a replacement for * sprintf (and similar functions), mostly meant for strings that are - * translated (otherwise just use ostringstream) - since e.g. a - * translated string like _("Player %s - chose your kart") would + * translated (otherwise just use ostringstream) - since e.g. a + * translated string like _("Player %s - chose your kart") would * be broken into two strings: * << _("Player ") << name << _(" - chose your kart") * and this is in the best case very confusing for translators (which get - * to see two strings instead of one sentence, see xgettext manual + * to see two strings instead of one sentence, see xgettext manual * for why this is a bad idea) * In order to accomodate translations even more, you can use formats %0, %1, %2, etc... * where %0 is replaced by the first argument, %1 by the second argument, etc... @@ -115,19 +115,19 @@ namespace StringUtils * \param all_vals Value(s) to replace all %s or %d with. */ std::string insertValues(const std::string &s, std::vector& all_vals); - + /** This no-op is useful when using variadic arguments, so that we may support the case with 0 variadic arguments */ template T1 insertValues(const T1& s) { return s; } - + // ------------------------------------------------------------------------ /** Same as above but for wide-strings */ irr::core::stringw insertValues(const irr::core::stringw &s, std::vector& all_vals); - + // ------------------------------------------------------------------------ // Note: the order in which the templates are specified is important, since // otherwise some compilers will not find the right template to use. - + template std::string insertValues(const std::string &s, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, @@ -143,7 +143,7 @@ namespace StringUtils dummy << v6; all_vals.push_back(dummy.str()); return insertValues(s, all_vals); } - + template std::string insertValues(const std::string &s, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, @@ -158,7 +158,7 @@ namespace StringUtils dummy << v5; all_vals.push_back(dummy.str()); return insertValues(s, all_vals); } - + template std::string insertValues(const std::string &s, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4) @@ -171,7 +171,7 @@ namespace StringUtils dummy << v4; all_vals.push_back(dummy.str()); return insertValues(s, all_vals); } - + /** Shortcut insert_values taking three values, see above for * full docs. * \param s String in which all %s or %d are replaced. @@ -188,7 +188,7 @@ namespace StringUtils dummy << v3; all_vals.push_back(dummy.str()); return insertValues(s, all_vals); } - + // ------------------------------------------------------------------------ // Note: the order in which the templates are specified is important, since // otherwise some compilers will not find the right template to use. @@ -205,7 +205,7 @@ namespace StringUtils std::ostringstream dummy; dummy << v1; all_vals.push_back(dummy.str()); dummy.str(""); dummy << v2; all_vals.push_back(dummy.str()); dummy.str(""); - + return insertValues(s, all_vals); } // ------------------------------------------------------------------------ @@ -220,10 +220,10 @@ namespace StringUtils std::vector all_vals; std::ostringstream dummy; dummy << v1; all_vals.push_back(dummy.str()); dummy.str(""); - + return insertValues(s, all_vals); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for wide strings */ template @@ -232,16 +232,16 @@ namespace StringUtils const T5 &v5, const T6 &v6) { std::vector all_vals; - all_vals.push_back( irr::core::stringw(v1) ); - all_vals.push_back( irr::core::stringw(v2) ); - all_vals.push_back( irr::core::stringw(v3) ); - all_vals.push_back( irr::core::stringw(v4) ); - all_vals.push_back( irr::core::stringw(v5) ); - all_vals.push_back( irr::core::stringw(v6) ); + all_vals.push_back( irr::core::stringw(v1) ); + all_vals.push_back( irr::core::stringw(v2) ); + all_vals.push_back( irr::core::stringw(v3) ); + all_vals.push_back( irr::core::stringw(v4) ); + all_vals.push_back( irr::core::stringw(v5) ); + all_vals.push_back( irr::core::stringw(v6) ); return insertValues(s, all_vals); } - - + + // ------------------------------------------------------------------------ /** Like the other ones above but for wide strings */ template @@ -250,14 +250,14 @@ namespace StringUtils const T5 &v5) { std::vector all_vals; - all_vals.push_back( irr::core::stringw(v1) ); - all_vals.push_back( irr::core::stringw(v2) ); - all_vals.push_back( irr::core::stringw(v3) ); - all_vals.push_back( irr::core::stringw(v4) ); - all_vals.push_back( irr::core::stringw(v5) ); + all_vals.push_back( irr::core::stringw(v1) ); + all_vals.push_back( irr::core::stringw(v2) ); + all_vals.push_back( irr::core::stringw(v3) ); + all_vals.push_back( irr::core::stringw(v4) ); + all_vals.push_back( irr::core::stringw(v5) ); return insertValues(s, all_vals); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for wide strings */ template @@ -265,13 +265,13 @@ namespace StringUtils const T2 &v2, const T3 &v3, const T4 &v4) { std::vector all_vals; - all_vals.push_back( irr::core::stringw(v1) ); - all_vals.push_back( irr::core::stringw(v2) ); - all_vals.push_back( irr::core::stringw(v3) ); - all_vals.push_back( irr::core::stringw(v4) ); + all_vals.push_back( irr::core::stringw(v1) ); + all_vals.push_back( irr::core::stringw(v2) ); + all_vals.push_back( irr::core::stringw(v3) ); + all_vals.push_back( irr::core::stringw(v4) ); return insertValues(s, all_vals); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for wide strings */ template @@ -280,12 +280,12 @@ namespace StringUtils { std::vector all_vals; irr::core::stringw dummy; - all_vals.push_back( irr::core::stringw(v1) ); - all_vals.push_back( irr::core::stringw(v2) ); - all_vals.push_back( irr::core::stringw(v3) ); + all_vals.push_back( irr::core::stringw(v1) ); + all_vals.push_back( irr::core::stringw(v2) ); + all_vals.push_back( irr::core::stringw(v3) ); return insertValues(s, all_vals); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for wide strings */ template @@ -293,21 +293,21 @@ namespace StringUtils const T2 &v2) { std::vector all_vals; - all_vals.push_back( irr::core::stringw(v1) ); - all_vals.push_back( irr::core::stringw(v2) ); + all_vals.push_back( irr::core::stringw(v1) ); + all_vals.push_back( irr::core::stringw(v2) ); return insertValues(s, all_vals); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for wide strings */ template irr::core::stringw insertValues(const irr::core::stringw &s, const T1 &v1) { std::vector all_vals; - all_vals.push_back( irr::core::stringw(v1) ); + all_vals.push_back( irr::core::stringw(v1) ); return insertValues(s, all_vals); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for wide strings */ template @@ -318,7 +318,7 @@ namespace StringUtils irr::core::stringw s(chars); return insertValues(s, v1, v2, v3, v4, v5); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for wide strings */ template @@ -328,7 +328,7 @@ namespace StringUtils irr::core::stringw s(chars); return insertValues(s, v1, v2, v3); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for wide strings */ template @@ -338,7 +338,7 @@ namespace StringUtils irr::core::stringw s(chars); return insertValues(s, v1, v2); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for wide strings */ template @@ -347,7 +347,7 @@ namespace StringUtils irr::core::stringw s(chars); return insertValues(s, v1); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for C strings */ template @@ -357,7 +357,7 @@ namespace StringUtils std::string s(chars); return insertValues(s, v1, v2, v3); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for C strings */ template @@ -367,7 +367,7 @@ namespace StringUtils std::string s(chars); return insertValues(s, v1, v2); } - + // ------------------------------------------------------------------------ /** Like the other ones above but for C strings */ template @@ -382,7 +382,7 @@ namespace StringUtils { std::istringstream conv(input); conv >> *output; - + // check reading worked correctly and everything was read if (conv.fail() || !conv.eof()) { @@ -396,7 +396,7 @@ namespace StringUtils { return parseString(input.c_str(), output); } - + /** * \param other string in which to replace stuff * \param from pattern to remove from the string @@ -404,11 +404,11 @@ namespace StringUtils * \return a string with all occurrences of \c from replaced by occurrences of \c to */ std::string replace(const std::string& other, const std::string& from, const std::string& to); - + irr::core::stringw decodeFromHtmlEntities(const std::string& input); - + std::string encodeToHtmlEntities(const irr::core::stringw &output); - + /** Compute a simple hash of a string */ unsigned int simpleHash(const char* input); } // namespace StringUtils diff --git a/src/utils/synchronised.hpp b/src/utils/synchronised.hpp index 1ca9a8293..d3661ce2e 100644 --- a/src/utils/synchronised.hpp +++ b/src/utils/synchronised.hpp @@ -31,7 +31,7 @@ private: /** The mutex to protect this variable with. */ mutable pthread_mutex_t m_mutex; /** The actual data to be used. */ - TYPE m_data; + TYPE m_data; public: // ------------------------------------------------------------------------ /** Initialise the data and the mutex with default constructors. */ @@ -57,8 +57,8 @@ public: } // ~Synchronised // ------------------------------------------------------------------------ - /** Sets the value of this variable using a mutex. - * \param v Value to be set. + /** Sets the value of this variable using a mutex. + * \param v Value to be set. */ void setAtomic(const TYPE &v) { @@ -68,9 +68,9 @@ public: } // set // ------------------------------------------------------------------------ - /** Returns a copy of this variable. + /** Returns a copy of this variable. */ - TYPE getAtomic() const + TYPE getAtomic() const { TYPE v; pthread_mutex_lock(&m_mutex); @@ -99,12 +99,12 @@ public: */ void lock() { pthread_mutex_lock(&m_mutex); } // ------------------------------------------------------------------------ - /** Unlocks the mutex. + /** Unlocks the mutex. */ void unlock() {pthread_mutex_unlock(&m_mutex); } // ------------------------------------------------------------------------ /** Gives access to the mutex, which can then be used in other pthread - * calls (e.g. pthread_cond_wait). + * calls (e.g. pthread_cond_wait). */ pthread_mutex_t* getMutex() { return &m_mutex; } private: diff --git a/src/utils/time.hpp b/src/utils/time.hpp index e5f1b18bb..df8ceacec 100644 --- a/src/utils/time.hpp +++ b/src/utils/time.hpp @@ -79,14 +79,14 @@ public: // ------------------------------------------------------------------------ /** Returns a time based on an arbitrary 'epoch' (e.g. could be start - * time of the application, 1.1.1970, ...). - * The value is a double precision floating point value in seconds. + * time of the application, 1.1.1970, ...). + * The value is a double precision floating point value in seconds. */ static double getRealTime(long startAt=0) { return irr_driver->getDevice()->getTimer()->getRealTime()/1000.0; }; // getTimeSinceEpoch - + class ScopeProfiler { float m_time; @@ -96,14 +96,14 @@ public: printf("%s {\n", name); m_time = (float)getRealTime(); } - + ~ScopeProfiler() { float f2 = (float)getRealTime(); printf("} // took %f s\n", (f2 - m_time)); } }; - + }; // namespace time #endif diff --git a/src/utils/translation.hpp b/src/utils/translation.hpp index 91f981f1b..eace82029 100644 --- a/src/utils/translation.hpp +++ b/src/utils/translation.hpp @@ -42,24 +42,24 @@ class Translations private: tinygettext::DictionaryManager m_dictionary_manager; tinygettext::Dictionary m_dictionary; - + irr::core::stringw m_converted_string; bool m_rtl; - + std::string m_current_language_name; - + public: Translations(); - + const wchar_t *w_gettext(const wchar_t* original, const char* context=NULL); const wchar_t *w_gettext(const char* original, const char* context=NULL); - + bool isRTLLanguage() const; const wchar_t* fribidize(const wchar_t* in_ptr); const wchar_t* fribidize(const irr::core::stringw &str) { return fribidize(str.c_str()); } const std::vector* getLanguageList() const; - + std::string getCurrentLanguageName(); }; // Translations diff --git a/src/utils/vec3.hpp b/src/utils/vec3.hpp index a5db3024d..211ca5458 100644 --- a/src/utils/vec3.hpp +++ b/src/utils/vec3.hpp @@ -39,9 +39,9 @@ private: public: /** Convert an irrlicht vector3df into the internal (bullet) format. * Irrlicht's and STK's axis are different (STK: Z up, irrlicht: Y up). - * We might want to change this as well, makes it easier to work with + * We might want to change this as well, makes it easier to work with * bullet and irrlicht together, without having to swap indices (bullet - * can handle any axis ordering). Note that toIrrVector swaps the + * can handle any axis ordering). Note that toIrrVector swaps the * axis as well (so a vector3df can be stored in and restored from * a vec3). */ @@ -57,7 +57,7 @@ public: inline Vec3(float x, float y, float z) : btVector3(x,y,z) {} // ------------------------------------------------------------------------ /** Creates a 3d vector from three scalars. */ - inline Vec3(float x, float y, float z, float w) : btVector3(x,y,z) + inline Vec3(float x, float y, float z, float w) : btVector3(x,y,z) { setW(w); } // ------------------------------------------------------------------------ /** Initialises a 3d vector from one scalar value, which is used to @@ -67,7 +67,7 @@ public: /** Sets the heading, and computes pitch and roll dependent * on the normal it is displayed on. * \param heading The heading to set. - * \param normal The normal from which pitch and roll should be + * \param normal The normal from which pitch and roll should be * computed. */ inline Vec3(float heading, const Vec3& normal) { @@ -108,7 +108,7 @@ public: /** Sets the roll of a vector that is used to store a rotation. */ inline const void setRoll(float f) { m_floats[2] = f; } // ------------------------------------------------------------------------ - /** Converts a vec3 into an irrlicht vector (which is a simple type + /** Converts a vec3 into an irrlicht vector (which is a simple type * cast). */ const core::vector3df& toIrrVector() const { @@ -142,14 +142,14 @@ public: // ------------------------------------------------------------------------ /** Sets the rotation given by the quaternion as HPR vector. */ Vec3& operator=(const btQuaternion& q) {setHPR(q); return *this;} - + // ------------------------------------------------------------------------ /** Operator== of btQuadWord also compares m_floats[3], which is not * useful (and wrong in certain circumstances). */ bool operator==(const Vec3& other) const { - return ((m_floats[2]==other.m_floats[2]) && - (m_floats[1]==other.m_floats[1]) && + return ((m_floats[2]==other.m_floats[2]) && + (m_floats[1]==other.m_floats[1]) && (m_floats[0]==other.m_floats[0]) ); } @@ -158,7 +158,7 @@ public: * useful (and wrong in certain circumstances). */ bool operator!=(const Vec3& other) const { - return ((m_floats[2]!=other.m_floats[2]) || + return ((m_floats[2]!=other.m_floats[2]) || (m_floats[1]!=other.m_floats[1]) || (m_floats[0]!=other.m_floats[0]) ); } @@ -173,11 +173,11 @@ public: float length2_2d() const { return m_floats[0]*m_floats[0] + m_floats[2]*m_floats[2]; } // ------------------------------------------------------------------------ - /** Returns the length of this vector in the plane, i.e. the vector is + /** Returns the length of this vector in the plane, i.e. the vector is * used as a 2d vector. */ // ------------------------------------------------------------------------ /** Returns the length of the vector using only the x/z coordinates. */ - float length_2d() const {return sqrt( m_floats[0]*m_floats[0] + float length_2d() const {return sqrt( m_floats[0]*m_floats[0] + m_floats[2]*m_floats[2]);} // ------------------------------------------------------------------------ /** Sets this = max(this, a) componentwise.