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
This commit is contained in:
parent
c5bb98d1e4
commit
57c3cbae3e
src
addons
addon.hppaddons_manager.hppdummy_network_http.hppinetwork_http.hppnetwork_http.hppnews_manager.hpprequest.hpp
animations
audio
dummy_sfx.hppmusic.hppmusic_dummy.hppmusic_information.hppmusic_manager.hppmusic_ogg.hppsfx_base.hppsfx_buffer.hppsfx_manager.hppsfx_openal.hpp
challenges
config
graphics
CBatchingMesh.hppcamera.hppexplosion.hpphardware_skinning.hpphit_effect.hpphit_sfx.hppirr_driver.hpplod_node.hppmaterial.hppmaterial_manager.hppmoving_texture.hppparticle_emitter.hppparticle_kind.hppparticle_kind_manager.hppper_camera_node.hpppost_processing.hpprain.hppreferee.hppshadow.hppshow_curve.hppskid_marks.hppslip_stream.hppstars.hpp
guiengine
abstract_state_manager.hppabstract_top_level_container.hppengine.hppevent_handler.hpplayout_manager.hppmodaldialog.hppscalable_font.hppscreen.hppskin.hppwidget.hpp
input
binding.hppdevice_manager.hppinput.hppinput_device.hppinput_manager.hppwiimote.hppwiimote_manager.hpp
io
items
attachment.hppattachment_manager.hppattachment_plugin.hppbowling.hppcake.hppflyable.hppitem.hppitem_manager.hppplunger.hpppowerup.hpppowerup_manager.hppprojectile_manager.hpprubber_ball.hpprubber_band.hppswatter.hpp
karts
@ -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:
|
||||
|
@ -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; }
|
||||
|
@ -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; }
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -45,8 +45,8 @@ class NetworkHttp : public INetworkHttp
|
||||
private:
|
||||
|
||||
/** The list of pointes to all requests. */
|
||||
Synchronised< std::priority_queue<Request*,
|
||||
std::vector<Request*>,
|
||||
Synchronised< std::priority_queue<Request*,
|
||||
std::vector<Request*>,
|
||||
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);
|
||||
|
@ -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<int> 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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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<Vec3>& 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
|
||||
|
@ -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; }
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
virtual void updateFaster(float percent, float pitch) = 0;
|
||||
virtual void update () = 0;
|
||||
virtual bool isPlaying () = 0;
|
||||
|
||||
|
||||
virtual ~Music () {};
|
||||
};
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
virtual void updateFaster(float percent, float pitch) {}
|
||||
virtual void update () {}
|
||||
virtual bool isPlaying () { return false; }
|
||||
|
||||
|
||||
virtual ~MusicDummy () {}
|
||||
};
|
||||
|
||||
|
@ -45,16 +45,16 @@ private:
|
||||
stringw m_title;
|
||||
std::string m_normal_filename;
|
||||
std::string m_fast_filename;
|
||||
std::vector<std::string> m_all_tracks;
|
||||
std::vector<std::string> 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
|
||||
|
@ -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<std::string, MusicInformation*>
|
||||
bool m_initialized;
|
||||
std::map<std::string, MusicInformation*>
|
||||
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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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()
|
||||
};
|
||||
|
||||
|
@ -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<std::string, SFXBuffer*> m_all_sfx_types;
|
||||
|
||||
|
||||
/** The actual instances (sound sources) */
|
||||
std::vector<SFXBase*> m_all_sfx;
|
||||
|
||||
|
||||
/** To play non-positional sounds without having to create a new object for each */
|
||||
static std::map<std::string, SFXBase*> 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; }
|
||||
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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<UnlockableFeature>&
|
||||
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
|
||||
|
@ -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<std::string, bool> m_locked_features;
|
||||
|
||||
|
||||
/** Recently unlocked features (they are waiting here
|
||||
* until they are shown to the user) */
|
||||
std::vector<const ChallengeData*> m_unlocked_features;
|
||||
|
||||
|
||||
std::map<std::string, Challenge*> 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 ChallengeData*>
|
||||
const std::vector<const ChallengeData*>
|
||||
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<std::string, Challenge*>::const_iterator it =
|
||||
std::map<std::string, Challenge*>::const_iterator it =
|
||||
m_challenges_state.find(id);
|
||||
assert(it!=m_challenges_state.end());
|
||||
return it->second;
|
||||
|
@ -44,19 +44,19 @@ private:
|
||||
SFXBase *m_locked_sound;
|
||||
|
||||
void load ();
|
||||
|
||||
|
||||
typedef std::map<std::string, ChallengeData*> AllChallengesType;
|
||||
AllChallengesType m_all_challenges;
|
||||
|
||||
|
||||
std::map<std::string, GameSlot*> m_game_slots;
|
||||
|
||||
|
||||
void readAllChallengesInDirs(const std::vector<std::string>* 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<std::string>& tracks,
|
||||
std::vector<std::string>& gps);
|
||||
|
||||
|
||||
PlayerProfile* getCurrentPlayer();
|
||||
|
||||
|
||||
void updateActiveChallengeList();
|
||||
|
||||
|
||||
}; // UnlockManager
|
||||
|
||||
extern UnlockManager* unlock_manager;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<RaceManager::KartStatus> &kart_list);
|
||||
void clearKarts();
|
||||
void loadKarts(std::vector<RaceManager::KartStatus> & 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<UserConfigParams::m_saved_grand_prix_list.size(); n++)
|
||||
|
@ -35,7 +35,7 @@ class KartProperties;
|
||||
class MusicInformation;
|
||||
class XMLNode;
|
||||
|
||||
/**
|
||||
/**
|
||||
* \brief Global STK configuration information.
|
||||
* Parameters here can be tuned without recompilation, but the user shouldn't actually modify
|
||||
* them. It also includes the list of default kart physics parameters which are used for
|
||||
@ -46,7 +46,7 @@ class STKConfig : public NoCopy
|
||||
{
|
||||
protected:
|
||||
/** Default kart properties. */
|
||||
KartProperties *m_default_kart_properties;
|
||||
KartProperties *m_default_kart_properties;
|
||||
|
||||
public:
|
||||
/** What to do if a kart already has a powerup when it hits a bonus box:
|
||||
@ -54,9 +54,9 @@ public:
|
||||
* - SAME: give it one more item of the type it currently has.
|
||||
* - ONLY_IF_SAME: only give it one more item if the randomly chosen item
|
||||
* has the same type as the currently held item. */
|
||||
enum {POWERUP_MODE_NEW,
|
||||
POWERUP_MODE_SAME,
|
||||
POWERUP_MODE_ONLY_IF_SAME}
|
||||
enum {POWERUP_MODE_NEW,
|
||||
POWERUP_MODE_SAME,
|
||||
POWERUP_MODE_ONLY_IF_SAME}
|
||||
m_same_powerup_mode;
|
||||
|
||||
static float UNDEFINED;
|
||||
@ -78,7 +78,7 @@ public:
|
||||
before they disappear. */
|
||||
float m_explosion_impulse_objects;/**<Impulse of explosion on moving
|
||||
objects, e.g. road cones, ... */
|
||||
float m_penalty_time; /**< Penalty time when starting too
|
||||
float m_penalty_time; /**< Penalty time when starting too
|
||||
early. */
|
||||
float m_delay_finish_time; /**<Delay after a race finished before
|
||||
the results are displayed. */
|
||||
@ -107,7 +107,7 @@ public:
|
||||
before it is ignored. */
|
||||
bool m_enable_networking;
|
||||
|
||||
/** Disable steering if skidding is stopped. This can help in making
|
||||
/** Disable steering if skidding is stopped. This can help in making
|
||||
* skidding more controllable (since otherwise when trying to steer while
|
||||
* steering is reset to match the graphics it often results in the kart
|
||||
* crashing). */
|
||||
@ -119,11 +119,11 @@ public:
|
||||
|
||||
float m_ai_acceleration; /**<Between 0 and 1, default being 1, can be
|
||||
used to give a handicap to AIs */
|
||||
|
||||
|
||||
std::vector<float>
|
||||
m_leader_intervals; /**<Interval in follow the leader till
|
||||
last kart is reomved. */
|
||||
float m_leader_time_per_kart; /**< Additional time to each leader
|
||||
float m_leader_time_per_kart; /**< Additional time to each leader
|
||||
interval for each additional kart. */
|
||||
std::vector<int> m_switch_items; /**< How to switch items. */
|
||||
/** The number of points a kart on position X has more than the
|
||||
|
@ -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<std::string> m_blacklist_res;
|
||||
|
||||
|
||||
PARAM_PREFIX PtrVector<PlayerProfile> 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
|
||||
|
@ -34,8 +34,8 @@ public:
|
||||
|
||||
//! adds a mesh to the buffers with the given offset
|
||||
/** \Return: Returns an array of ID numbers */
|
||||
core::array<s32> addMesh(IMesh* mesh,
|
||||
core::vector3df pos = core::vector3df(0,0,0),
|
||||
core::array<s32> 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<bool> moveMesh(const core::array<s32>& 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;
|
||||
|
@ -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<EndCameraInformation> 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_all_cameras.size(); i++)
|
||||
delete m_all_cameras[i];
|
||||
m_all_cameras.clear();
|
||||
} // removeAllCameras
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Creates a camera and adds it to the list of all cameras. Also the
|
||||
/** Creates a camera and adds it to the list of all cameras. Also the
|
||||
* camera index (which determines which viewport to use in split screen)
|
||||
* is set.
|
||||
*/
|
||||
@ -275,7 +275,7 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the scaling in x/y direction for this camera. */
|
||||
const core::vector2df& getScaling() const {return m_scaling; }
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the camera scene node. */
|
||||
scene::ICameraSceneNode *getCameraSceneNode() { return m_camera; }
|
||||
|
@ -41,7 +41,7 @@ class Explosion : public HitSFX
|
||||
private:
|
||||
float m_remaining_time;
|
||||
scene::IParticleSystemSceneNode *m_node;
|
||||
|
||||
|
||||
public:
|
||||
Explosion(const Vec3& coord, const char* explosion_sound);
|
||||
~Explosion();
|
||||
|
@ -39,11 +39,11 @@ class HWSkinningCallback : public video::IShaderConstantSetCallBack
|
||||
private:
|
||||
//const video::SMaterial *m_used_material;
|
||||
scene::IAnimatedMeshSceneNode* m_node;
|
||||
|
||||
|
||||
public:
|
||||
HWSkinningCallback(scene::IAnimatedMeshSceneNode* node);
|
||||
virtual ~HWSkinningCallback();
|
||||
|
||||
|
||||
/* virtual void OnSetMaterial(const video::SMaterial& material)
|
||||
{
|
||||
m_used_material=&material;
|
||||
|
@ -26,7 +26,7 @@ class Vec3;
|
||||
/**
|
||||
* \ingroup graphics
|
||||
* A small interface for effects to be used when a kart is hit. That
|
||||
* includes a sound effect only, or a graphical effect (like an
|
||||
* includes a sound effect only, or a graphical effect (like an
|
||||
* explosion).
|
||||
*/
|
||||
class HitEffect: public NoCopy
|
||||
|
@ -31,7 +31,7 @@ class HitSFX : public HitEffect
|
||||
private:
|
||||
/** The sfx to play. */
|
||||
SFXBase* m_sfx;
|
||||
|
||||
|
||||
public:
|
||||
HitSFX(const Vec3& coord, const char* explosion_sound);
|
||||
~HitSFX();
|
||||
|
@ -55,7 +55,7 @@ class PerCameraNode;
|
||||
class PostProcessing;
|
||||
|
||||
/**
|
||||
* \brief class that creates the irrLicht device and offers higher-level
|
||||
* \brief class that creates the irrLicht device and offers higher-level
|
||||
* ways to manage the 3D scene
|
||||
* \ingroup graphics
|
||||
*/
|
||||
@ -74,15 +74,15 @@ private:
|
||||
gui::IGUIFont *m_race_font;
|
||||
/** Post-processing. */
|
||||
PostProcessing *m_post_processing;
|
||||
|
||||
|
||||
/** Flag to indicate if a resolution change is pending (which will be
|
||||
* acted upon in the next update). None means no change, yes means
|
||||
* change to new resolution and trigger confirmation dialog.
|
||||
* change to new resolution and trigger confirmation dialog.
|
||||
* Cancel indicates a change of the resolution (back to the original
|
||||
* one), but no confirmation dialog. */
|
||||
enum {RES_CHANGE_NONE, RES_CHANGE_YES,
|
||||
enum {RES_CHANGE_NONE, RES_CHANGE_YES,
|
||||
RES_CHANGE_CANCEL} m_resolution_changing;
|
||||
|
||||
|
||||
public:
|
||||
/** A simple class to store video resolutions. */
|
||||
class VideoMode
|
||||
@ -100,26 +100,26 @@ private:
|
||||
|
||||
void setupViewports();
|
||||
video::E_DRIVER_TYPE getEngineDriverType(int index);
|
||||
|
||||
|
||||
/** Whether the mouse cursor is currently shown */
|
||||
bool m_pointer_shown;
|
||||
|
||||
|
||||
/** Internal method that applies the resolution in user settings. */
|
||||
void applyResolutionSettings();
|
||||
void createListOfVideoModes();
|
||||
|
||||
bool m_request_screenshot;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
/** Used to visualise skeletons. */
|
||||
std::vector<irr::scene::IAnimatedMeshSceneNode*> 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<video::ITexture*> &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<VideoMode>& getVideoModes() const { return m_modes; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the frame size. */
|
||||
const core::dimension2d<u32>& getFrameSize() const
|
||||
const core::dimension2d<u32>& 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<scene::IMesh, REF>& mesh,
|
||||
void setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
|
||||
AlignedArray<Vec3>& mesh_location,
|
||||
AlignedArray<Vec3>& mesh_scale,
|
||||
const std::vector<int>& 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
|
||||
|
||||
|
@ -53,12 +53,12 @@ private:
|
||||
|
||||
std::vector<int> m_detail;
|
||||
std::vector<irr::scene::ISceneNode*> m_nodes;
|
||||
|
||||
|
||||
std::set<scene::ISceneNode*> 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<f32>& 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<scene::ISceneNode*>& 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; }
|
||||
|
@ -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<irr::video::IShaderConstantSetCallBack*> m_shaders;
|
||||
|
||||
/** Only used if bubble effect is enabled */
|
||||
std::map<scene::IMeshBuffer*, BubbleEffectProvider*> 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);
|
||||
|
@ -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
|
||||
|
||||
|
@ -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. */
|
||||
|
@ -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<scene::ISceneNode*> 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
|
||||
|
@ -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; }
|
||||
};
|
||||
|
||||
|
@ -31,23 +31,23 @@
|
||||
class ParticleKindManager : public NoCopy
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
std::map<std::string, ParticleKind*> m_per_track_kinds;
|
||||
|
||||
std::map<std::string, ParticleKind*> m_kinds;
|
||||
static ParticleKindManager* singleton;
|
||||
|
||||
|
||||
ParticleKindManager();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
virtual ~ParticleKindManager();
|
||||
|
||||
ParticleKind* getParticles(const std::string &name);
|
||||
|
||||
|
||||
void cleanUpTrackSpecificGfx();
|
||||
void cleanup();
|
||||
|
||||
|
||||
static ParticleKindManager* get();
|
||||
};
|
||||
#endif
|
||||
|
@ -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<f32>& 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; }
|
||||
};
|
||||
|
||||
|
@ -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<Quad> 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);
|
||||
};
|
||||
|
@ -39,21 +39,21 @@ class Rain
|
||||
PerCameraNode* m_node[RAIN_RING_COUNT];
|
||||
|
||||
std::vector<irr::video::SMaterial*> 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);
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -35,22 +35,22 @@ using namespace irr;
|
||||
class Stars : public NoCopy
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
/** Vector containing the stars */
|
||||
std::vector<scene::ISceneNode*> 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 ();
|
||||
|
@ -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<std::string> 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<typename T>
|
||||
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
|
||||
|
@ -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<Widget, HOLD> 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<Widget>& widgets,
|
||||
void addWidgetsRecursively(PtrVector<Widget>& 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<Widget>* within_vector);
|
||||
static Widget* getWidget(const int id,
|
||||
PtrVector<Widget>* within_vector);
|
||||
|
||||
|
||||
Widget* getFirstWidget(PtrVector<Widget>* within_vector=NULL);
|
||||
Widget* getLastWidget(PtrVector<Widget>* within_vector=NULL);
|
||||
|
||||
void elementsWereDeleted(PtrVector<Widget>* within_vector = NULL);
|
||||
|
||||
|
||||
bool isMyChild(Widget* widget) const;
|
||||
}; // AbstractTopLevelContainer
|
||||
|
||||
|
||||
} // namespace GUIEngine
|
||||
|
||||
#endif
|
||||
|
@ -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<Widget, REF> 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
|
||||
*/
|
||||
|
@ -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
|
||||
|
@ -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<Widget>& 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<Widget>& 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<Widget>& 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)
|
||||
|
@ -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
|
||||
|
@ -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<int /* texture file ID */, TextureInfo> 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<s32>& position,
|
||||
video::SColor color, bool hcenter,
|
||||
bool vcenter, const core::rect<s32>* clip, bool ignoreRTL);
|
||||
|
||||
|
||||
//! returns the dimension of a text
|
||||
virtual core::dimension2d<u32> 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;
|
||||
|
@ -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
|
||||
|
@ -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<s32> m_skin_dest_area_left;
|
||||
core::rect<s32> m_skin_dest_area_center;
|
||||
core::rect<s32> m_skin_dest_area_right;
|
||||
|
||||
|
||||
core::rect<s32> m_skin_dest_area_top;
|
||||
core::rect<s32> m_skin_dest_area_bottom;
|
||||
|
||||
|
||||
core::rect<s32> m_skin_dest_area_top_left;
|
||||
core::rect<s32> m_skin_dest_area_top_right;
|
||||
core::rect<s32> m_skin_dest_area_bottom_left;
|
||||
core::rect<s32> m_skin_dest_area_bottom_right;
|
||||
|
||||
|
||||
// y flip
|
||||
core::rect<s32> m_skin_dest_area_left_yflip;
|
||||
core::rect<s32> m_skin_dest_area_center_yflip;
|
||||
core::rect<s32> m_skin_dest_area_right_yflip;
|
||||
|
||||
|
||||
core::rect<s32> m_skin_dest_area_top_yflip;
|
||||
core::rect<s32> m_skin_dest_area_bottom_yflip;
|
||||
|
||||
|
||||
core::rect<s32> m_skin_dest_area_top_left_yflip;
|
||||
core::rect<s32> m_skin_dest_area_top_right_yflip;
|
||||
core::rect<s32> m_skin_dest_area_bottom_left_yflip;
|
||||
core::rect<s32> m_skin_dest_area_bottom_right_yflip;
|
||||
|
||||
core::rect<s32> 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<s32> m_source_area_left;
|
||||
core::rect<s32> m_source_area_center;
|
||||
core::rect<s32> m_source_area_right;
|
||||
|
||||
|
||||
core::rect<s32> m_source_area_top;
|
||||
core::rect<s32> m_source_area_bottom;
|
||||
|
||||
|
||||
core::rect<s32> m_source_area_top_left;
|
||||
core::rect<s32> m_source_area_top_right;
|
||||
core::rect<s32> m_source_area_bottom_left;
|
||||
core::rect<s32> m_source_area_bottom_right;
|
||||
|
||||
|
||||
core::rect<s32> m_source_area_bottom_right;
|
||||
|
||||
|
||||
// y-flipped coords
|
||||
core::rect<s32> m_source_area_left_yflip;
|
||||
core::rect<s32> m_source_area_center_yflip;
|
||||
core::rect<s32> m_source_area_right_yflip;
|
||||
|
||||
|
||||
core::rect<s32> m_source_area_top_yflip;
|
||||
core::rect<s32> m_source_area_bottom_yflip;
|
||||
|
||||
|
||||
core::rect<s32> m_source_area_top_left_yflip;
|
||||
core::rect<s32> m_source_area_top_right_yflip;
|
||||
core::rect<s32> m_source_area_bottom_left_yflip;
|
||||
core::rect<s32> 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<Widget*> m_tooltips;
|
||||
std::vector<bool> 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<s32>* 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<Widget>* within_vector=NULL);
|
||||
void drawBgImage();
|
||||
@ -342,73 +342,73 @@ namespace GUIEngine
|
||||
void drawBadgeOn(const Widget* widget, const core::rect<s32>& 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<s32>* 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; }
|
||||
|
@ -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<Widget> 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<Property, std::string> 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<Widget>& getChildren() const { return m_children; }
|
||||
|
||||
|
||||
PtrVector<Widget>& 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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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"),
|
||||
|
@ -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,
|
||||
|
@ -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<int> 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;
|
||||
};
|
||||
|
@ -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<irr::SEvent> 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();
|
||||
|
||||
|
@ -47,18 +47,18 @@ class WiimoteManager
|
||||
private:
|
||||
/** List of all connected wiimotes. */
|
||||
std::vector<Wiimote*> 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
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ private:
|
||||
/** Directory to store screenshots in. */
|
||||
std::string m_screenshot_dir;
|
||||
|
||||
std::vector<std::string>
|
||||
std::vector<std::string>
|
||||
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
|
||||
|
@ -60,20 +60,20 @@ private:
|
||||
std::map<std::string, core::stringw> m_attributes;
|
||||
/** List of all sub nodes. */
|
||||
std::vector<XMLNode *> 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<XMLNode*>& 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; }
|
||||
|
@ -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<typename T>
|
||||
XMLWriter& operator<< (const T t)
|
||||
{
|
||||
@ -46,9 +46,9 @@ public:
|
||||
(*this) << tmp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void close();
|
||||
|
||||
|
||||
bool is_open() { return m_base.is_open(); }
|
||||
};
|
||||
|
||||
|
@ -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) */
|
||||
|
@ -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]; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -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() {}
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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; }
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ class ItemManager : public NoCopy
|
||||
private:
|
||||
/** Stores all item models. */
|
||||
static std::vector<scene::IMesh *> m_item_mesh;
|
||||
|
||||
|
||||
/** Stores all low-resolution item models. */
|
||||
static std::vector<scene::IMesh *> 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<int> &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());
|
||||
|
@ -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;}
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -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; }
|
||||
// ------------------------------------------------------------------------
|
||||
};
|
||||
|
@ -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:
|
||||
* <!-- bubble cake bowl zipper plunger switch para anvil -->
|
||||
* <last w="0 1 1 2 2 0 2 2" />
|
||||
* 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;}
|
||||
|
||||
};
|
||||
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
typedef std::vector<Flyable*> Projectiles;
|
||||
typedef std::vector<HitEffect*> 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); }
|
||||
};
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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<ReplayBase::KartReplayEvent> 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);
|
||||
|
@ -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;
|
||||
|
||||
/**<Maximum engine rpm's for the current gear*/
|
||||
float m_max_gear_rpm;
|
||||
|
||||
/** A short time after a collision acceleration is disabled to allow
|
||||
/** A short time after a collision acceleration is disabled to allow
|
||||
* the karts to bounce back*/
|
||||
float m_bounce_back_time;
|
||||
float m_bounce_back_time;
|
||||
|
||||
/** Time a kart is invulnerable. */
|
||||
float m_invulnerable_time;
|
||||
@ -126,7 +126,7 @@ private:
|
||||
/** How long a kart is being squashed. If this is >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. */
|
||||
|
@ -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 <vector>
|
||||
@ -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:
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <IAnimatedMeshSceneNode.h>
|
||||
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
|
||||
|
@ -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<float> 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<float> 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; }
|
||||
|
||||
|
@ -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<std::string>);
|
||||
void selectKartName(const std::string &kart_name);
|
||||
bool testAndSetKart(int kartid);
|
||||
void getRandomKartList(int count,
|
||||
void getRandomKartList(int count,
|
||||
RemoteKartInfoList& existing_karts,
|
||||
std::vector<std::string> *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<std::string>* getAllKartDirs() const
|
||||
const std::vector<std::string>* getAllKartDirs() const
|
||||
{ return &m_all_kart_dirs; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the number of karts. */
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user