removed most 'herring' names
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2392 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
67091ed534
commit
c834005143
data
src
callback_manager.hpp
challenges
file_manager.cppfile_manager.hppgrand_prix_data.cppgrand_prix_data.hppgui
items
attachment.cppattachment.hppcollectable.cppcollectable.hppcollectable_manager.hppitem.cppitem.hppitem_manager.cppitem_manager.hpp
kart.cppkart.hppmain.cppmaterial_manager.hppmodes
moveable.hppnetwork
player_kart.cppplayer_kart.hpprace_manager.hppsdldrv.cpptrack.cpptrack.hppuser_config.cppuser_config.hpp@ -1,6 +1,6 @@
|
||||
;; -*- mode: lisp -*-
|
||||
|
||||
(herring
|
||||
(item
|
||||
(gold "goldcoin" )
|
||||
(silver "silvercoin")
|
||||
(green "banana" )
|
@ -1,11 +0,0 @@
|
||||
;; -*- mode: lisp -*-
|
||||
|
||||
;; nothing specified --> chose the default models
|
||||
(herring
|
||||
(gold "OLD_GOLD")
|
||||
(silver "OLD_SILVER")
|
||||
(green "OLD_GREEN")
|
||||
(red "OLD_RED")
|
||||
)
|
||||
|
||||
;; EOF ;;
|
@ -30,7 +30,7 @@
|
||||
// gets loaded once, and deleted at the end (and when switching windows /
|
||||
// fullscreen). Sinace it's not much overhead, a separate class is provided
|
||||
// for every model that might contain a callback.
|
||||
enum CallbackType { CB_COLLECTABLE, CB_ATTACHMENT, CB_EXPLOSION, CB_HERRING,
|
||||
enum CallbackType { CB_COLLECTABLE, CB_ATTACHMENT, CB_EXPLOSION, CB_ITEM,
|
||||
CB_KART, CB_TRACK, CB_MAX };
|
||||
|
||||
class CallbackManager
|
||||
|
@ -223,7 +223,7 @@ bool ChallengeData::raceFinished()
|
||||
if((int)race_manager->getNumKarts()<m_num_karts) return false; // not enough AI karts
|
||||
|
||||
Kart* kart = RaceManager::getPlayerKart(0);
|
||||
if(m_energy>0 && kart->getNumHerring()<m_energy) return false; // not enough energy
|
||||
if(m_energy>0 && kart->getNumItems()<m_energy) return false; // not enough energy
|
||||
if(m_position>0 && kart->getPosition()>m_position) return false; // too far behind
|
||||
|
||||
// Follow the leader
|
||||
|
@ -206,10 +206,10 @@ std::string FileManager::getKartDir() const
|
||||
} // getKartDir
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string FileManager::getHerringDir() const
|
||||
std::string FileManager::getItemsDir() const
|
||||
{
|
||||
return m_root_dir+"/data/herrings";
|
||||
} // getHerringDir
|
||||
return m_root_dir+"/data/items";
|
||||
} // getItemsDir
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string FileManager::getTranslationDir() const
|
||||
{
|
||||
@ -253,9 +253,9 @@ std::string FileManager::getConfigFile(const std::string& fname) const
|
||||
} // getConfigFile
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string FileManager::getHerringFile(const std::string& fname) const
|
||||
std::string FileManager::getItemFile(const std::string& fname) const
|
||||
{
|
||||
return getHerringDir()+"/"+fname;
|
||||
return getItemsDir()+"/"+fname;
|
||||
} // getConfigFile
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
std::string getHomeDir () const;
|
||||
std::string getTrackDir () const;
|
||||
std::string getKartDir () const;
|
||||
std::string getHerringDir () const;
|
||||
std::string getItemsDir () const;
|
||||
std::string getTranslationDir() const;
|
||||
std::vector<std::string>getMusicDirs() const;
|
||||
std::string getTextureFile (const std::string& fname) const;
|
||||
@ -54,7 +54,7 @@ public:
|
||||
std::string getConfigFile (const std::string& fname) const;
|
||||
std::string getHighscoreFile (const std::string& fname) const;
|
||||
std::string getLogFile (const std::string& fname) const;
|
||||
std::string getHerringFile (const std::string& fname) const;
|
||||
std::string getItemFile (const std::string& fname) const;
|
||||
std::string getMusicFile (const std::string& fname) const;
|
||||
std::string getSFXFile (const std::string& fname) const;
|
||||
std::string getFontFile (const std::string& fname) const;
|
||||
|
@ -45,7 +45,7 @@ GrandPrixData::GrandPrixData(const std::string filename)
|
||||
|
||||
lisp->get ("name", m_name );
|
||||
lisp->get ("description", m_description );
|
||||
lisp->get ("herring", m_herring_style);
|
||||
lisp->get ("item", m_item_style);
|
||||
lisp->getVector("tracks", m_tracks );
|
||||
lisp->getVector("laps", m_laps );
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class GrandPrixData
|
||||
std::string m_id; // Internal name of the grand prix, not translated
|
||||
std::string m_filename; // Original filename, only for error handling needed
|
||||
std::string m_description; // Description for this track
|
||||
std::string m_herring_style; // herring style which overwrites the track default
|
||||
std::string m_item_style; // item style which overwrites the track default
|
||||
/** The ident of the tracks in this grand prix in their right order, ident
|
||||
means the filename of the .track file without .track extension
|
||||
(ie. 'volcano') */
|
||||
@ -52,7 +52,7 @@ public:
|
||||
const std::string& getName () const { return m_name; }
|
||||
const std::string& getId () const { return m_id; }
|
||||
const std::string& getDescription () const { return m_description; }
|
||||
const std::string& getHerringStyle() const { return m_herring_style; }
|
||||
const std::string& getItemStyle () const { return m_item_style; }
|
||||
const std::string& getFilename () const { return m_filename; }
|
||||
const std::string& getTrack(size_t track_index) const { assert(track_index < m_tracks.size());
|
||||
return m_tracks[track_index]; }
|
||||
|
@ -77,25 +77,25 @@ HelpPageOne::HelpPageOne()
|
||||
widget_manager->breakLine();
|
||||
|
||||
/*Rotating 3D models*/
|
||||
ssgEntity* hm = herring_manager->getHerringModel(HE_RED);
|
||||
ssgEntity* hm = item_manager->getItemModel(ITEM_BONUS_BOX);
|
||||
ssgDeRefDelete(m_box);
|
||||
m_box = new ssgTransform;
|
||||
m_box->ref();
|
||||
m_box->addKid(hm);
|
||||
|
||||
hm = herring_manager->getHerringModel(HE_SILVER);
|
||||
hm = item_manager->getItemModel(ITEM_SILVER_COIN);
|
||||
ssgDeRefDelete(m_silver_coin);
|
||||
m_silver_coin = new ssgTransform;
|
||||
m_silver_coin->ref();
|
||||
m_silver_coin->addKid(hm);
|
||||
|
||||
hm = herring_manager->getHerringModel(HE_GOLD);
|
||||
hm = item_manager->getItemModel(ITEM_GOLD_COIN);
|
||||
ssgDeRefDelete(m_gold_coin);
|
||||
m_gold_coin = new ssgTransform;
|
||||
m_gold_coin->ref();
|
||||
m_gold_coin->addKid(hm);
|
||||
|
||||
hm = herring_manager->getHerringModel(HE_GREEN);
|
||||
hm = item_manager->getItemModel(ITEM_BANANA);
|
||||
ssgDeRefDelete(m_banana);
|
||||
m_banana = new ssgTransform;
|
||||
m_banana->ref();
|
||||
|
@ -463,8 +463,8 @@ void RaceGUI::drawCollectableIcons ( Kart* player_kart, int offset_x,
|
||||
void RaceGUI::drawEnergyMeter ( Kart *player_kart, int offset_x, int offset_y,
|
||||
float ratio_x, float ratio_y )
|
||||
{
|
||||
float state = (float)(player_kart->getNumHerring()) /
|
||||
MAX_HERRING_EATEN;
|
||||
float state = (float)(player_kart->getNumItems()) /
|
||||
MAX_ITEMS_COLLECTED;
|
||||
int x = (int)((user_config->m_width-24) * ratio_x) + offset_x;
|
||||
int y = (int)(250 * ratio_y) + offset_y;
|
||||
int w = (int)(16 * ratio_x);
|
||||
@ -472,10 +472,10 @@ void RaceGUI::drawEnergyMeter ( Kart *player_kart, int offset_x, int offset_y,
|
||||
int wl = (int)(ratio_x);
|
||||
if(wl < 1)
|
||||
wl = 1;
|
||||
const int GRADS = (int)(MAX_HERRING_EATEN/5); // each graduation equals 5 herring
|
||||
const int GRADS = (int)(MAX_ITEMS_COLLECTED/5); // each graduation equals 5 items
|
||||
int gh = (int)(h/GRADS); //graduation height
|
||||
float coin_target = (float)race_manager->getCoinTarget();
|
||||
int th = (int)(h*(coin_target/MAX_HERRING_EATEN));
|
||||
int th = (int)(h*(coin_target/MAX_ITEMS_COLLECTED));
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
// Draw a Meter border
|
||||
|
@ -63,7 +63,7 @@ void Attachment::set(attachmentType _type, float time, Kart *current_kart)
|
||||
} // set
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void Attachment::hitGreenHerring(const Herring &herring, int random_attachment)
|
||||
void Attachment::hitBanana(const Item &item, int random_attachment)
|
||||
{
|
||||
if(user_config->m_profile) return;
|
||||
float leftover_time = 0.0f;
|
||||
@ -93,8 +93,8 @@ void Attachment::hitGreenHerring(const Herring &herring, int random_attachment)
|
||||
// so that the clients can be updated.
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
{
|
||||
race_state->herringCollected(m_kart->getWorldKartId(),
|
||||
herring.getHerringId(),
|
||||
race_state->itemCollected(m_kart->getWorldKartId(),
|
||||
item.getItemId(),
|
||||
random_attachment);
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ void Attachment::hitGreenHerring(const Herring &herring, int random_attachment)
|
||||
m_kart->adjustSpeedWeight(stk_config->m_anvil_speed_factor);
|
||||
break ;
|
||||
} // switch
|
||||
} // hitGreenHerring
|
||||
} // hitBanana
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//** Moves a bomb from kart FROM to kart TO.
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "utils/random_generator.hpp"
|
||||
|
||||
class Kart;
|
||||
class Herring;
|
||||
class Item;
|
||||
|
||||
// Some loop in Attachment.cpp depend on PARACHUTE being the first element,
|
||||
// and TINYTUX being the last one. So if new elemts are added, make sure
|
||||
@ -77,11 +77,11 @@ public:
|
||||
}
|
||||
/** Randomly selects the new attachment. For a server process, the
|
||||
* attachment can be passed into this function.
|
||||
\param herring The herring that was collected.
|
||||
\param item The item that was collected.
|
||||
\param random_attachment Optional: only used on the clients, it
|
||||
specifies the new attachment to use
|
||||
*/
|
||||
void hitGreenHerring(const Herring &herring, int random_attachment=-1);
|
||||
void hitBanana(const Item &item, int random_attachment=-1);
|
||||
void update (float dt);
|
||||
void moveBombFromTo(Kart *from, Kart *to);
|
||||
};
|
||||
|
@ -154,7 +154,7 @@ void Collectable::use()
|
||||
} // use
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Collectable::hitRedHerring(int n, const Herring &herring, int add_info)
|
||||
void Collectable::hitBonusBox(int n, const Item &item, int add_info)
|
||||
{
|
||||
//The probabilities of getting the anvil or the parachute increase
|
||||
//depending on how bad the owner's position is. For the first
|
||||
@ -186,9 +186,9 @@ void Collectable::hitRedHerring(int n, const Herring &herring, int add_info)
|
||||
m_number = 1;
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
{
|
||||
race_state->herringCollected(m_owner->getWorldKartId(),
|
||||
herring.getHerringId(),
|
||||
m_type);
|
||||
race_state->itemCollected(m_owner->getWorldKartId(),
|
||||
item.getItemId(),
|
||||
m_type);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -198,9 +198,9 @@ void Collectable::hitRedHerring(int n, const Herring &herring, int add_info)
|
||||
m_number = 1;
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
{
|
||||
race_state->herringCollected(m_owner->getWorldKartId(),
|
||||
herring.getHerringId(),
|
||||
(char)m_type);
|
||||
race_state->itemCollected(m_owner->getWorldKartId(),
|
||||
item.getItemId(),
|
||||
(char)m_type);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -238,9 +238,9 @@ void Collectable::hitRedHerring(int n, const Herring &herring, int add_info)
|
||||
// so that the clients can be updated.
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
{
|
||||
race_state->herringCollected(m_owner->getWorldKartId(),
|
||||
herring.getHerringId(),
|
||||
newC);
|
||||
race_state->itemCollected(m_owner->getWorldKartId(),
|
||||
item.getItemId(),
|
||||
newC);
|
||||
}
|
||||
|
||||
if(m_type==COLLECT_NOTHING)
|
||||
@ -254,4 +254,4 @@ void Collectable::hitRedHerring(int n, const Herring &herring, int add_info)
|
||||
if(m_number > MAX_COLLECTABLES) m_number = MAX_COLLECTABLES;
|
||||
}
|
||||
// Ignore new collectable if it is different from the current one
|
||||
} // hitRedHerring
|
||||
} // hitBonusBox
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "utils/random_generator.hpp"
|
||||
|
||||
class Kart;
|
||||
class Herring;
|
||||
class Item;
|
||||
class SFXBase;
|
||||
|
||||
class Collectable
|
||||
@ -49,7 +49,7 @@ public:
|
||||
void reset ();
|
||||
int getNum () const {return m_number;}
|
||||
CollectableType getType () const {return m_type; }
|
||||
void hitRedHerring(int n, const Herring &herring, int newC=-1);
|
||||
void hitBonusBox (int n, const Item &item, int newC=-1);
|
||||
Material* getIcon ();
|
||||
void use ();
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ class Material;
|
||||
class ssgEntity;
|
||||
|
||||
// The anvil and parachute must be at the end of the enum, and the
|
||||
// zipper just before them (see collectable::hitRedHerring).
|
||||
// zipper just before them (see collectable::hitBonusBox).
|
||||
enum CollectableType {COLLECT_NOTHING,
|
||||
COLLECT_MISSILE, COLLECT_CAKE,
|
||||
COLLECT_BOWLING, COLLECT_ZIPPER,
|
||||
|
@ -23,30 +23,30 @@
|
||||
#include "scene.hpp"
|
||||
#include "coord.hpp"
|
||||
|
||||
Herring::Herring(herringType type, const Vec3& xyz, ssgEntity* model,
|
||||
unsigned int herring_id)
|
||||
Item::Item(ItemType type, const Vec3& xyz, ssgEntity* model,
|
||||
unsigned int item_id)
|
||||
: m_coord(xyz, Vec3(0, 0, 0))
|
||||
{
|
||||
m_herring_id = herring_id;
|
||||
m_item_id = item_id;
|
||||
m_type = type;
|
||||
m_eaten = false;
|
||||
m_time_till_return = 0.0f; // not strictly necessary, see isEaten()
|
||||
m_time_till_return = 0.0f; // not strictly necessary, see isCollected()
|
||||
m_root = new ssgTransform();
|
||||
m_root->ref();
|
||||
m_root->setTransform(const_cast<sgCoord*>(&m_coord.toSgCoord()));
|
||||
m_root->addKid(model);
|
||||
scene->add(m_root);
|
||||
|
||||
} // Herring
|
||||
} // Item
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Herring::~Herring()
|
||||
Item::~Item()
|
||||
{
|
||||
ssgDeRefDelete(m_root);
|
||||
} // ~Herring
|
||||
} // ~Item
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Herring::reset()
|
||||
void Item::reset()
|
||||
{
|
||||
m_eaten = false;
|
||||
m_time_till_return = 0.0f;
|
||||
@ -54,13 +54,13 @@ void Herring::reset()
|
||||
} // reset
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int Herring::hitKart(Kart* kart)
|
||||
int Item::hitKart(Kart* kart)
|
||||
{
|
||||
return (kart->getXYZ()-m_coord.getXYZ()).length2()<0.8f;
|
||||
} // hitKart
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Herring::update(float delta)
|
||||
void Item::update(float delta)
|
||||
{
|
||||
if(m_eaten)
|
||||
{
|
||||
@ -90,7 +90,7 @@ void Herring::update(float delta)
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Herring::isEaten()
|
||||
void Item::isCollected()
|
||||
{
|
||||
m_eaten = true;
|
||||
m_time_till_return = 2.0f;
|
||||
|
@ -17,8 +17,8 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef HEADER_HERRING_H
|
||||
#define HEADER_HERRING_H
|
||||
#ifndef HEADER_ITEM_H
|
||||
#define HEADER_ITEM_H
|
||||
|
||||
// num_players triggers 'already defined' messages without the WINSOCKAPI define. Don't ask me :(
|
||||
#define _WINSOCKAPI_
|
||||
@ -29,33 +29,33 @@ class Kart;
|
||||
class ssgTransform;
|
||||
class ssgEntity;
|
||||
|
||||
// HE_RED must be the first, HE_SILVER the last entry. See HerringManager
|
||||
enum herringType { HE_RED, HE_GREEN, HE_GOLD, HE_SILVER, HE_NONE };
|
||||
// ITEM_BONUS_BOX must be the first, ITEM_SILVER_COIN the last entry. See ItemManager
|
||||
enum ItemType { ITEM_BONUS_BOX, ITEM_BANANA, ITEM_GOLD_COIN, ITEM_SILVER_COIN, ITEM_NONE };
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
class Herring
|
||||
class Item
|
||||
{
|
||||
private:
|
||||
herringType m_type; // Herring type
|
||||
bool m_eaten; // true if herring was eaten & is not displayed
|
||||
float m_time_till_return; // time till an eaten herring reappears
|
||||
ItemType m_type; // Item type
|
||||
bool m_eaten; // true if item was collected & is not displayed
|
||||
float m_time_till_return; // time till a collected item reappears
|
||||
Coord m_coord; // Original coordinates, used mainly when
|
||||
// eaten herrings reappear.
|
||||
ssgTransform* m_root; // The actual root of the herring
|
||||
unsigned int m_herring_id; // index in herring_manager field
|
||||
// collected items reappear.
|
||||
ssgTransform* m_root; // The actual root of the item
|
||||
unsigned int m_item_id; // index in item_manager field
|
||||
public:
|
||||
Herring (herringType type, const Vec3& xyz, ssgEntity* model,
|
||||
unsigned int herring_id);
|
||||
~Herring ();
|
||||
unsigned int getHerringId() const {return m_herring_id; }
|
||||
Item (ItemType type, const Vec3& xyz, ssgEntity* model,
|
||||
unsigned int item_id);
|
||||
~Item ();
|
||||
unsigned int getItemId() const {return m_item_id; }
|
||||
void update (float delta);
|
||||
void isEaten ();
|
||||
void isCollected ();
|
||||
int hitKart (Kart* kart );
|
||||
void reset ();
|
||||
ssgTransform* getRoot () const {return m_root;}
|
||||
herringType getType () const {return m_type;}
|
||||
ItemType getType () const {return m_type;}
|
||||
bool wasEaten() const {return m_eaten;}
|
||||
}
|
||||
; // class Herring
|
||||
; // class Item
|
||||
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
/** Simple shadow class, only used here for default herrings. */
|
||||
/** Simple shadow class, only used here for default items. */
|
||||
class Shadow
|
||||
{
|
||||
ssgBranch *sh ;
|
||||
@ -75,63 +75,63 @@ Shadow::Shadow ( float x1, float x2, float y1, float y2 )
|
||||
ssgVtxTable *gs = new ssgVtxTable ( GL_TRIANGLE_STRIP, va, na, ta, ca ) ;
|
||||
|
||||
gs -> clrTraversalMaskBits ( SSGTRAV_ISECT|SSGTRAV_HOT ) ;
|
||||
gs -> setState ( fuzzy_gst ) ;
|
||||
//gs -> setState ( fuzzy_gst ) ;
|
||||
sh -> addKid ( gs ) ;
|
||||
sh -> ref () ; /* Make sure it doesn't get deleted by mistake */
|
||||
} // Shadow
|
||||
|
||||
//=============================================================================
|
||||
HerringManager* herring_manager;
|
||||
ItemManager* item_manager;
|
||||
typedef std::map<std::string,ssgEntity*>::const_iterator CI_type;
|
||||
|
||||
HerringManager::HerringManager()
|
||||
ItemManager::ItemManager()
|
||||
{
|
||||
m_all_models.clear();
|
||||
// The actual loading is done in loadDefaultHerrings
|
||||
} // HerringManager
|
||||
// The actual loading is done in loadDefaultItems
|
||||
} // ItemManager
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HerringManager::removeTextures()
|
||||
void ItemManager::removeTextures()
|
||||
{
|
||||
for(AllHerringType::iterator i =m_all_herrings.begin();
|
||||
i!=m_all_herrings.end(); i++)
|
||||
for(AllItemTypes::iterator i =m_all_items.begin();
|
||||
i!=m_all_items.end(); i++)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
m_all_herrings.clear();
|
||||
m_all_items.clear();
|
||||
|
||||
for(CI_type i=m_all_models.begin(); i!=m_all_models.end(); ++i)
|
||||
{
|
||||
ssgDeRefDelete(i->second);
|
||||
}
|
||||
m_all_models.clear();
|
||||
callback_manager->clear(CB_HERRING);
|
||||
callback_manager->clear(CB_ITEM);
|
||||
} // removeTextures
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HerringManager::~HerringManager()
|
||||
ItemManager::~ItemManager()
|
||||
{
|
||||
for(CI_type i=m_all_models.begin(); i!=m_all_models.end(); ++i)
|
||||
{
|
||||
ssgDeRefDelete(i->second);
|
||||
}
|
||||
} // ~HerringManager
|
||||
} // ~ItemManager
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HerringManager::loadDefaultHerrings()
|
||||
void ItemManager::loadDefaultItems()
|
||||
{
|
||||
// Load all models. This can't be done in the constructor,
|
||||
// since the file_manager isn't ready at that stage.
|
||||
// -------------------------------------------------------
|
||||
std::set<std::string> files;
|
||||
file_manager->listFiles(files, file_manager->getHerringDir(),
|
||||
file_manager->listFiles(files, file_manager->getItemsDir(),
|
||||
/*is_full_path*/true,
|
||||
/*make_full_path*/true);
|
||||
for(std::set<std::string>::iterator i = files.begin();
|
||||
i != files.end(); ++i)
|
||||
{
|
||||
if(!StringUtils::has_suffix(*i, ".ac")) continue;
|
||||
ssgEntity* h = loader->load(*i, CB_HERRING,
|
||||
ssgEntity* h = loader->load(*i, CB_ITEM,
|
||||
/*optimise*/true,
|
||||
/*full_path*/true);
|
||||
std::string shortName = StringUtils::basename(StringUtils::without_extension(*i));
|
||||
@ -143,16 +143,16 @@ void HerringManager::loadDefaultHerrings()
|
||||
|
||||
// Load the old, internal only models
|
||||
// ----------------------------------
|
||||
sgVec3 yellow = { 1.0f, 1.0f, 0.4f }; CreateDefaultHerring(yellow, "OLD_GOLD" );
|
||||
sgVec3 cyan = { 0.4f, 1.0f, 1.0f }; CreateDefaultHerring(cyan , "OLD_SILVER");
|
||||
sgVec3 red = { 0.8f, 0.0f, 0.0f }; CreateDefaultHerring(red , "OLD_RED" );
|
||||
sgVec3 green = { 0.0f, 0.8f, 0.0f }; CreateDefaultHerring(green , "OLD_GREEN" );
|
||||
sgVec3 yellow = { 1.0f, 1.0f, 0.4f }; createDefaultItem(yellow, "OLD_GOLD" );
|
||||
sgVec3 cyan = { 0.4f, 1.0f, 1.0f }; createDefaultItem(cyan , "OLD_SILVER");
|
||||
sgVec3 red = { 0.8f, 0.0f, 0.0f }; createDefaultItem(red , "OLD_RED" );
|
||||
sgVec3 green = { 0.0f, 0.8f, 0.0f }; createDefaultItem(green , "OLD_GREEN" );
|
||||
|
||||
setDefaultHerringStyle();
|
||||
} // loadDefaultHerrings
|
||||
setDefaultItemStyle();
|
||||
} // loadDefaultItems
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HerringManager::setDefaultHerringStyle()
|
||||
void ItemManager::setDefaultItemStyle()
|
||||
{
|
||||
// This should go in an internal, system wide configuration file
|
||||
const std::string DEFAULT_NAMES[4] = {"bonusblock", "banana",
|
||||
@ -160,17 +160,17 @@ void HerringManager::setDefaultHerringStyle()
|
||||
|
||||
bool bError=0;
|
||||
char msg[MAX_ERROR_MESSAGE_LENGTH];
|
||||
for(int i=HE_RED; i<=HE_SILVER; i++)
|
||||
for(int i=ITEM_BONUS_BOX; i<=ITEM_SILVER_COIN; i++)
|
||||
{
|
||||
m_herring_model[i] = m_all_models[DEFAULT_NAMES[i]];
|
||||
if(!m_herring_model[i])
|
||||
m_item_model[i] = m_all_models[DEFAULT_NAMES[i]];
|
||||
if(!m_item_model[i])
|
||||
{
|
||||
snprintf(msg, sizeof(msg),
|
||||
"Herring model '%s' is missing (see herring_manager)!\n",
|
||||
"Item model '%s' is missing (see item_manager)!\n",
|
||||
DEFAULT_NAMES[i].c_str());
|
||||
bError=1;
|
||||
break;
|
||||
} // if !m_herring_model
|
||||
} // if !m_item_model
|
||||
} // for i
|
||||
if(bError)
|
||||
{
|
||||
@ -185,7 +185,7 @@ void HerringManager::setDefaultHerringStyle()
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, " %s in models/herrings/%s.ac.\n",
|
||||
fprintf(stderr, " %s in %s.ac.\n",
|
||||
i->first.c_str(),
|
||||
i->first.c_str());
|
||||
}
|
||||
@ -195,85 +195,86 @@ void HerringManager::setDefaultHerringStyle()
|
||||
exit(-1);
|
||||
} // if bError
|
||||
|
||||
} // setDefaultHerringStyle
|
||||
} // setDefaultItemStyle
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Herring* HerringManager::newHerring(herringType type, const Vec3& xyz)
|
||||
Item* ItemManager::newItem(ItemType type, const Vec3& xyz)
|
||||
{
|
||||
Herring* h = new Herring(type, xyz, m_herring_model[type], m_all_herrings.size());
|
||||
m_all_herrings.push_back(h);
|
||||
Item* h = new Item(type, xyz, m_item_model[type], m_all_items.size());
|
||||
m_all_items.push_back(h);
|
||||
return h;
|
||||
} // newHerring
|
||||
} // newItem
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Set a herring as eaten.
|
||||
* This function is called on the server when a herring is eaten, or on the
|
||||
* client upon receiving information about eaten herrings. */
|
||||
void HerringManager::eatenHerring(int herring_id, Kart *kart,
|
||||
int add_info)
|
||||
/** Set an item as collected.
|
||||
* This function is called on the server when an item is collected, or on the
|
||||
* client upon receiving information about collected items. */
|
||||
void ItemManager::collectedItem(int item_id, Kart *kart, int add_info)
|
||||
{
|
||||
Herring *herring=m_all_herrings[herring_id];
|
||||
herring->isEaten();
|
||||
kart->collectedHerring(*herring, add_info);
|
||||
} // eatenHerring
|
||||
Item *item=m_all_items[item_id];
|
||||
item->isCollected();
|
||||
kart->collectedItem(*item, add_info);
|
||||
} // collectedItem
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HerringManager::hitHerring(Kart* kart)
|
||||
void ItemManager::hitItem(Kart* kart)
|
||||
{
|
||||
// Only do this on the server
|
||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT) return;
|
||||
|
||||
for(AllHerringType::iterator i =m_all_herrings.begin();
|
||||
i!=m_all_herrings.end(); i++)
|
||||
for(AllItemTypes::iterator i =m_all_items.begin();
|
||||
i!=m_all_items.end(); i++)
|
||||
{
|
||||
if((*i)->wasEaten()) continue;
|
||||
if((*i)->hitKart(kart))
|
||||
{
|
||||
eatenHerring(i-m_all_herrings.begin(), kart);
|
||||
collectedItem(i-m_all_items.begin(), kart);
|
||||
} // if hit
|
||||
} // for m_all_herrings
|
||||
} // hitHerring
|
||||
} // for m_all_items
|
||||
} // hitItem
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Remove all herring instances, and the track specific models. This is used
|
||||
/** Remove all item instances, and the track specific models. This is used
|
||||
* just before a new track is loaded and a race is started.
|
||||
*/
|
||||
void HerringManager::cleanup()
|
||||
void ItemManager::cleanup()
|
||||
{
|
||||
for(AllHerringType::iterator i =m_all_herrings.begin();
|
||||
i!=m_all_herrings.end(); i++)
|
||||
for(AllItemTypes::iterator i =m_all_items.begin();
|
||||
i!=m_all_items.end(); i++)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
m_all_herrings.clear();
|
||||
m_all_items.clear();
|
||||
|
||||
setDefaultHerringStyle();
|
||||
setDefaultItemStyle();
|
||||
|
||||
// FIXME - this seems outdated
|
||||
|
||||
// Then load the default style from the user_config file
|
||||
// -----------------------------------------------------
|
||||
// This way if a herring is not defined in the herringstyle-file, the
|
||||
// This way if an item is not defined in the item-style-file, the
|
||||
// default (i.e. old herring) is used.
|
||||
try
|
||||
{
|
||||
// FIXME: This should go in a system-wide configuration file,
|
||||
// and only one of this and the hard-coded settings in
|
||||
// setDefaultHerringStyle are necessary!!!
|
||||
loadHerringStyle(user_config->m_herring_style);
|
||||
// setDefaultItemStyle are necessary!!!
|
||||
loadItemStyle(user_config->m_item_style);
|
||||
}
|
||||
catch(std::runtime_error)
|
||||
{
|
||||
fprintf(stderr,"The herring style '%s' in your configuration file does not exist.\nIt is ignored.\n",
|
||||
user_config->m_herring_style.c_str());
|
||||
user_config->m_herring_style="";
|
||||
fprintf(stderr,"The item style '%s' in your configuration file does not exist.\nIt is ignored.\n",
|
||||
user_config->m_item_style.c_str());
|
||||
user_config->m_item_style="";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
loadHerringStyle(m_user_filename);
|
||||
loadItemStyle(m_user_filename);
|
||||
}
|
||||
catch(std::runtime_error)
|
||||
{
|
||||
fprintf(stderr,"The herring style '%s' specified on the command line does not exist.\nIt is ignored.\n",
|
||||
fprintf(stderr,"The item style '%s' specified on the command line does not exist.\nIt is ignored.\n",
|
||||
m_user_filename.c_str());
|
||||
m_user_filename=""; // reset to avoid further warnings.
|
||||
}
|
||||
@ -281,30 +282,30 @@ void HerringManager::cleanup()
|
||||
} // cleanup
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Remove all herring instances, and the track specific models. This is used
|
||||
/** Remove all item instances, and the track specific models. This is used
|
||||
* just before a new track is loaded and a race is started
|
||||
*/
|
||||
void HerringManager::reset()
|
||||
void ItemManager::reset()
|
||||
{
|
||||
for(AllHerringType::iterator i =m_all_herrings.begin();
|
||||
i!=m_all_herrings.end(); i++)
|
||||
for(AllItemTypes::iterator i =m_all_items.begin();
|
||||
i!=m_all_items.end(); i++)
|
||||
{
|
||||
(*i)->reset();
|
||||
} // for i
|
||||
} // reset
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HerringManager::update(float delta)
|
||||
void ItemManager::update(float delta)
|
||||
{
|
||||
for(AllHerringType::iterator i =m_all_herrings.begin();
|
||||
i!=m_all_herrings.end(); i++)
|
||||
for(AllItemTypes::iterator i =m_all_items.begin();
|
||||
i!=m_all_items.end(); i++)
|
||||
{
|
||||
(*i)->update(delta);
|
||||
} // for m_all_herrings
|
||||
} // for m_all_items
|
||||
} // delta
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HerringManager::CreateDefaultHerring(sgVec3 colour, std::string name)
|
||||
void ItemManager::createDefaultItem(sgVec3 colour, std::string name)
|
||||
{
|
||||
ssgVertexArray *va = new ssgVertexArray () ; sgVec3 v ;
|
||||
ssgNormalArray *na = new ssgNormalArray () ; sgVec3 n ;
|
||||
@ -332,7 +333,8 @@ void HerringManager::CreateDefaultHerring(sgVec3 colour, std::string name)
|
||||
|
||||
ssgLeaf *gset = new ssgVtxTable ( GL_TRIANGLE_STRIP, va, na, ta, ca ) ;
|
||||
|
||||
gset->setState(material_manager->getMaterial("herring.rgb")->getState()) ;
|
||||
// FIXME - this method seems outdated
|
||||
//gset->setState(material_manager->getMaterial("herring.rgb")->getState()) ;
|
||||
|
||||
Shadow* sh = new Shadow ( -0.5f, 0.5f, -0.25f, 0.25f ) ;
|
||||
|
||||
@ -343,42 +345,42 @@ void HerringManager::CreateDefaultHerring(sgVec3 colour, std::string name)
|
||||
tr -> ref () ; /* Make sure it doesn't get deleted by mistake */
|
||||
m_all_models[name] = tr;
|
||||
|
||||
} // CreateDefaultHerring
|
||||
} // createDefaultItem
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HerringManager::loadHerringStyle(const std::string filename)
|
||||
void ItemManager::loadItemStyle(const std::string filename)
|
||||
{
|
||||
if(filename.length()==0) return;
|
||||
const lisp::Lisp* root = 0;
|
||||
lisp::Parser parser;
|
||||
|
||||
root = parser.parse(file_manager->getConfigFile(filename + ".herring"));
|
||||
root = parser.parse(file_manager->getConfigFile(filename + ".items"));
|
||||
|
||||
const lisp::Lisp* herring_node = root->getLisp("herring");
|
||||
if(!herring_node)
|
||||
const lisp::Lisp* item_node = root->getLisp("item");
|
||||
if(!item_node)
|
||||
{
|
||||
char msg[MAX_ERROR_MESSAGE_LENGTH];
|
||||
snprintf(msg, sizeof(msg), "Couldn't load map '%s': no herring node.",
|
||||
snprintf(msg, sizeof(msg), "Couldn't load map '%s': no item node.",
|
||||
filename.c_str());
|
||||
delete root;
|
||||
throw std::runtime_error(msg);
|
||||
delete root;
|
||||
}
|
||||
setHerring(herring_node, "red", HE_RED );
|
||||
setHerring(herring_node, "green", HE_GREEN );
|
||||
setHerring(herring_node, "gold" ,HE_GOLD );
|
||||
setHerring(herring_node, "silver",HE_SILVER);
|
||||
setItem(item_node, "red", ITEM_BONUS_BOX );
|
||||
setItem(item_node, "green", ITEM_BANANA );
|
||||
setItem(item_node, "gold" ,ITEM_GOLD_COIN );
|
||||
setItem(item_node, "silver",ITEM_SILVER_COIN);
|
||||
delete root;
|
||||
} // loadHerringStyle
|
||||
} // loadItemStyle
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HerringManager::setHerring(const lisp::Lisp *herring_node,
|
||||
const char *colour, herringType type)
|
||||
void ItemManager::setItem(const lisp::Lisp *item_node,
|
||||
const char *colour, ItemType type)
|
||||
{
|
||||
std::string name;
|
||||
herring_node->get(colour, name);
|
||||
item_node->get(colour, name);
|
||||
if(name.size()>0)
|
||||
{
|
||||
m_herring_model[type]=m_all_models[name];
|
||||
m_item_model[type]=m_all_models[name];
|
||||
}
|
||||
} // setHerring
|
||||
} // setItem
|
||||
|
@ -17,8 +17,8 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef HEADER_HERRINGMANAGER_H
|
||||
#define HEADER_HERRINGMANAGER_H
|
||||
#ifndef HEADER_ITEMMANAGER_H
|
||||
#define HEADER_ITEMMANAGER_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
@ -29,48 +29,47 @@
|
||||
class Kart;
|
||||
class ssgEntity;
|
||||
|
||||
class HerringManager
|
||||
class ItemManager
|
||||
{
|
||||
|
||||
private:
|
||||
// The vector of all herrings of the current track
|
||||
typedef std::vector<Herring*> AllHerringType;
|
||||
AllHerringType m_all_herrings;
|
||||
// The vector of all items of the current track
|
||||
typedef std::vector<Item*> AllItemTypes;
|
||||
AllItemTypes m_all_items;
|
||||
|
||||
// This stores all herring models defined in the models/herring
|
||||
// subdirectory.
|
||||
ssgEntity *m_herring_model[HE_SILVER+1];
|
||||
// This stores all item models
|
||||
ssgEntity *m_item_model[ITEM_SILVER_COIN+1];
|
||||
|
||||
// This is the active model. It gets determined by first loading the
|
||||
// default, then track models, user models, grand prix models. This means that
|
||||
// a herring style specified in a track overwrites a command line option.
|
||||
// an item style specified in a track overwrites a command line option.
|
||||
std::map<std::string,ssgEntity*> m_all_models;
|
||||
|
||||
std::string m_user_filename;
|
||||
void CreateDefaultHerring(sgVec3 colour, std::string name);
|
||||
void setDefaultHerringStyle();
|
||||
void setHerring(const lisp::Lisp *herring_node, const char *colour,
|
||||
herringType type);
|
||||
void createDefaultItem(sgVec3 colour, std::string name);
|
||||
void setDefaultItemStyle();
|
||||
void setItem(const lisp::Lisp *item_node, const char *colour,
|
||||
ItemType type);
|
||||
|
||||
public:
|
||||
HerringManager();
|
||||
~HerringManager();
|
||||
void loadDefaultHerrings();
|
||||
void loadHerringStyle(const std::string filename);
|
||||
Herring* newHerring (herringType type, const Vec3& xyz);
|
||||
ItemManager();
|
||||
~ItemManager();
|
||||
void loadDefaultItems();
|
||||
void loadItemStyle (const std::string filename);
|
||||
Item* newItem (ItemType type, const Vec3& xyz);
|
||||
void update (float delta);
|
||||
void hitHerring (Kart* kart);
|
||||
void hitItem (Kart* kart);
|
||||
void cleanup ();
|
||||
void reset ();
|
||||
void removeTextures ();
|
||||
void setUserFilename (char *s) {m_user_filename=s;}
|
||||
void eatenHerring (int herring_id, Kart *kart,
|
||||
void collectedItem (int item_id, Kart *kart,
|
||||
int add_info=-1);
|
||||
ssgEntity* getHerringModel (herringType type)
|
||||
{return m_herring_model[type];}
|
||||
ssgEntity* getItemModel (ItemType type)
|
||||
{return m_item_model[type];}
|
||||
};
|
||||
|
||||
extern HerringManager* herring_manager;
|
||||
extern ItemManager* item_manager;
|
||||
|
||||
|
||||
#endif
|
||||
|
38
src/kart.cpp
38
src/kart.cpp
@ -70,7 +70,7 @@ Kart::Kart (const std::string& kart_name, int position,
|
||||
m_kart_properties = kart_properties_manager->getKart(kart_name);
|
||||
//m_grid_position = position;
|
||||
m_initial_position = position;
|
||||
m_num_herrings_gobbled = 0;
|
||||
m_num_items_collected = 0;
|
||||
m_eliminated = false;
|
||||
m_finished_race = false;
|
||||
m_finish_time = 0.0f;
|
||||
@ -358,7 +358,7 @@ void Kart::reset()
|
||||
m_eliminated = false;
|
||||
m_finish_time = 0.0f;
|
||||
m_zipper_time_left = 0.0f;
|
||||
m_num_herrings_gobbled = 0;
|
||||
m_num_items_collected = 0;
|
||||
m_wheel_rotation = 0;
|
||||
m_wheelie_angle = 0.0f;
|
||||
m_bounce_back_time = 0.0f;
|
||||
@ -403,35 +403,35 @@ void Kart::raceFinished(float time)
|
||||
} // raceFinished
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Kart::collectedHerring(const Herring &herring, int add_info)
|
||||
void Kart::collectedItem(const Item &item, int add_info)
|
||||
{
|
||||
const herringType type = herring.getType();
|
||||
const ItemType type = item.getType();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case HE_GREEN : m_attachment.hitGreenHerring(herring, add_info); break;
|
||||
case HE_SILVER : m_num_herrings_gobbled++ ; break;
|
||||
case HE_GOLD : m_num_herrings_gobbled += 3 ; break;
|
||||
case HE_RED : {
|
||||
int n=1 + 4*getNumHerring() / MAX_HERRING_EATEN;
|
||||
m_collectable.hitRedHerring(n, herring,add_info);break;
|
||||
case ITEM_BANANA : m_attachment.hitBanana(item, add_info); break;
|
||||
case ITEM_SILVER_COIN : m_num_items_collected++ ; break;
|
||||
case ITEM_GOLD_COIN : m_num_items_collected += 3 ; break;
|
||||
case ITEM_BONUS_BOX : {
|
||||
int n=1 + 4*getNumItems() / MAX_ITEMS_COLLECTED;
|
||||
m_collectable.hitBonusBox(n, item,add_info);break;
|
||||
}
|
||||
default : break;
|
||||
} // switch TYPE
|
||||
|
||||
// Attachments and collectables are stored in the corresponding
|
||||
// functions (hit{Red,Green}Herring), so only coins need to be
|
||||
// functions (hit{Red,Green}Item), so only coins need to be
|
||||
// stored here.
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER &&
|
||||
(type==HE_SILVER || type==HE_GOLD) )
|
||||
(type==ITEM_SILVER_COIN || type==ITEM_GOLD_COIN) )
|
||||
{
|
||||
race_state->herringCollected(getWorldKartId(), herring.getHerringId());
|
||||
race_state->itemCollected(getWorldKartId(), item.getItemId());
|
||||
}
|
||||
|
||||
if ( m_num_herrings_gobbled > MAX_HERRING_EATEN )
|
||||
m_num_herrings_gobbled = MAX_HERRING_EATEN;
|
||||
if ( m_num_items_collected > MAX_ITEMS_COLLECTED )
|
||||
m_num_items_collected = MAX_ITEMS_COLLECTED;
|
||||
|
||||
} // collectedHerring
|
||||
} // collectedItem
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Simulates gears
|
||||
@ -541,7 +541,7 @@ void Kart::update(float dt)
|
||||
m_rescue_pitch = getHPR().getPitch();
|
||||
m_rescue_roll = getHPR().getRoll();
|
||||
RaceManager::getWorld()->getPhysics()->removeKart(this);
|
||||
race_state->herringCollected(getWorldKartId(), -1, -1);
|
||||
race_state->itemCollected(getWorldKartId(), -1, -1);
|
||||
}
|
||||
btQuaternion q_roll (btVector3(0.f, 1.f, 0.f),
|
||||
-m_rescue_roll*dt/rescue_time*M_PI/180.0f);
|
||||
@ -613,8 +613,8 @@ void Kart::update(float dt)
|
||||
} // neither reset nor zipper material
|
||||
} // if there is material
|
||||
|
||||
// Check if any herring was hit.
|
||||
herring_manager->hitHerring(this);
|
||||
// Check if any item was hit.
|
||||
item_manager->hitItem(this);
|
||||
|
||||
processSkidMarks();
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "terrain_info.hpp"
|
||||
|
||||
class SkidMark;
|
||||
class Herring;
|
||||
class Item;
|
||||
class Smoke;
|
||||
class SFXBase;
|
||||
|
||||
@ -68,7 +68,7 @@ protected:
|
||||
btUprightConstraint *m_uprightConstraint;
|
||||
|
||||
private:
|
||||
int m_num_herrings_gobbled;
|
||||
int m_num_items_collected;
|
||||
ssgSimpleState* m_smokepuff;
|
||||
// don't delete the following 2 vars (they're kids in the hirarchy)
|
||||
Smoke *m_smoke_system;
|
||||
@ -130,7 +130,7 @@ public:
|
||||
{ m_attachment.set(t, time_left, k); }
|
||||
Collectable *getCollectable () { return &m_collectable; }
|
||||
int getNumCollectables () const { return m_collectable.getNum();}
|
||||
int getNumHerring () const { return m_num_herrings_gobbled;}
|
||||
int getNumItems () const { return m_num_items_collected;}
|
||||
int getPosition () const { return m_race_position; }
|
||||
int getInitialPosition () const { return m_initial_position; }
|
||||
float getFinishTime () const { return m_finish_time; }
|
||||
@ -211,7 +211,7 @@ public:
|
||||
virtual bool isPlayerKart () const {return false; }
|
||||
// addMessages gets called by world to add messages to the gui
|
||||
virtual void addMessages () {};
|
||||
virtual void collectedHerring (const Herring &herring, int random_attachment);
|
||||
virtual void collectedItem (const Item &item, int random_attachment);
|
||||
virtual void reset ();
|
||||
virtual void handleZipper ();
|
||||
virtual void crashed (Kart *k);
|
||||
|
10
src/main.cpp
10
src/main.cpp
@ -99,7 +99,7 @@ void cmdLineHelp (char* invocation)
|
||||
//FIXME" --players n Define number of players to between 1 and 4.\n"
|
||||
//FIXME " --reverse Enable reverse mode\n"
|
||||
//FIXME " --mirror Enable mirror mode (when supported)\n"
|
||||
" --herring STYLE Use STYLE as your herring style\n"
|
||||
" --item STYLE Use STYLE as your item style\n"
|
||||
" -f, --fullscreen Fullscreen display\n"
|
||||
" -w, --windowed Windowed display (default)\n"
|
||||
" -s, --screensize WxH Set the screen size (e.g. 320x200)\n"
|
||||
@ -403,9 +403,9 @@ int handleCmdLine(int argc, char **argv)
|
||||
{
|
||||
history->doReplayHistory(History::HISTORY_POSITION);
|
||||
}
|
||||
else if( !strcmp(argv[i], "--herring") && i+1<argc )
|
||||
else if( !strcmp(argv[i], "--item") && i+1<argc )
|
||||
{
|
||||
herring_manager->setUserFilename(argv[i+1]);
|
||||
item_manager->setUserFilename(argv[i+1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -445,7 +445,7 @@ void InitTuxkart()
|
||||
projectile_manager = new ProjectileManager ();
|
||||
collectable_manager = new CollectableManager ();
|
||||
callback_manager = new CallbackManager ();
|
||||
herring_manager = new HerringManager ();
|
||||
item_manager = new ItemManager ();
|
||||
attachment_manager = new AttachmentManager ();
|
||||
highscore_manager = new HighscoreManager ();
|
||||
grand_prix_manager = new GrandPrixManager ();
|
||||
@ -512,7 +512,7 @@ int main(int argc, char *argv[] )
|
||||
kart_properties_manager -> loadKartData ();
|
||||
projectile_manager -> loadData ();
|
||||
collectable_manager -> loadCollectables ();
|
||||
herring_manager -> loadDefaultHerrings();
|
||||
item_manager -> loadDefaultItems();
|
||||
attachment_manager -> loadModels ();
|
||||
scene = new Scene();
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
void popTempMaterial ();
|
||||
};
|
||||
|
||||
extern ssgState *fuzzy_gst, *herringbones_gst;
|
||||
//extern ssgState *fuzzy_gst, *herringbones_gst;
|
||||
|
||||
ssgState *getAppState ( char *fname ) ;
|
||||
extern MaterialManager *material_manager;
|
||||
|
@ -99,9 +99,9 @@ void StandardRace::getDefaultCollectibles(int& collectible_type, int& amount)
|
||||
else World::getDefaultCollectibles(collectible_type, amount);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
bool StandardRace::useRedHerring()
|
||||
bool StandardRace::enableBonusBoxes()
|
||||
{
|
||||
// in time trial mode, don't use "red herrings"
|
||||
// in time trial mode, don't use bonus boxes
|
||||
return race_manager->getMinorMode() != RaceManager::MINOR_MODE_TIME_TRIAL;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
virtual void update(float delta);
|
||||
virtual void restartRace();
|
||||
virtual void getDefaultCollectibles(int& collectible_type, int& amount);
|
||||
virtual bool useRedHerring();
|
||||
virtual bool enableBonusBoxes();
|
||||
virtual std::string getInternalCode() const;
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
virtual void update(float delta);
|
||||
virtual void restartRace();
|
||||
//virtual void getDefaultCollectibles(int& collectible_type, int& amount);
|
||||
//virtual bool useRedHerring();
|
||||
//virtual bool enableBonusBoxes();
|
||||
virtual bool useFastMusicNearEnd() const { return false; }
|
||||
virtual KartIconDisplayInfo* getKartsDisplayInfo(const RaceGUI* caller);
|
||||
virtual bool raceHasLaps(){ return false; }
|
||||
|
@ -274,7 +274,7 @@ void World::update(float dt)
|
||||
}
|
||||
|
||||
projectile_manager->update(dt);
|
||||
herring_manager->update(dt);
|
||||
item_manager->update(dt);
|
||||
|
||||
/* Routine stuff we do even when paused */
|
||||
callback_manager->update(dt);
|
||||
@ -426,25 +426,25 @@ void World::removeKart(int kart_number)
|
||||
|
||||
} // removeKart
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Cleans up old herrings (from a previous race), removes old track specific
|
||||
* herring models, and loads the actual track.
|
||||
/** Cleans up old items (from a previous race), removes old track specific
|
||||
* item models, and loads the actual track.
|
||||
*/
|
||||
void World::loadTrack()
|
||||
{
|
||||
// remove old herrings (from previous race), and remove old
|
||||
// track specific herring models
|
||||
herring_manager->cleanup();
|
||||
// remove old items (from previous race), and remove old
|
||||
// track specific item models
|
||||
item_manager->cleanup();
|
||||
if(race_manager->getMajorMode()== RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
{
|
||||
try
|
||||
{
|
||||
herring_manager->loadHerringStyle(race_manager->getHerringStyle());
|
||||
item_manager->loadItemStyle(race_manager->getItemStyle());
|
||||
}
|
||||
catch(std::runtime_error)
|
||||
{
|
||||
fprintf(stderr, "The grand prix '%s' contains an invalid herring style '%s'.\n",
|
||||
fprintf(stderr, "The grand prix '%s' contains an invalid item style '%s'.\n",
|
||||
race_manager->getGrandPrix()->getName().c_str(),
|
||||
race_manager->getHerringStyle().c_str());
|
||||
race_manager->getItemStyle().c_str());
|
||||
fprintf(stderr, "Please fix the file '%s'.\n",
|
||||
race_manager->getGrandPrix()->getFilename().c_str());
|
||||
}
|
||||
@ -453,12 +453,12 @@ void World::loadTrack()
|
||||
{
|
||||
try
|
||||
{
|
||||
herring_manager->loadHerringStyle(m_track->getHerringStyle());
|
||||
item_manager->loadItemStyle(m_track->getItemStyle());
|
||||
}
|
||||
catch(std::runtime_error)
|
||||
{
|
||||
fprintf(stderr, "The track '%s' contains an invalid herring style '%s'.\n",
|
||||
m_track->getName(), m_track->getHerringStyle().c_str());
|
||||
fprintf(stderr, "The track '%s' contains an invalid item style '%s'.\n",
|
||||
m_track->getName(), m_track->getItemStyle().c_str());
|
||||
fprintf(stderr, "Please fix the file '%s'.\n",
|
||||
m_track->getFilename().c_str());
|
||||
}
|
||||
@ -494,7 +494,7 @@ void World::restartRace()
|
||||
// Enable SFX again
|
||||
sfx_manager->resumeAll();
|
||||
|
||||
herring_manager->reset();
|
||||
item_manager->reset();
|
||||
projectile_manager->cleanup();
|
||||
race_manager->reset();
|
||||
callback_manager->reset();
|
||||
|
@ -42,7 +42,7 @@ class btRigidBody;
|
||||
* by the race manager on the start of each race (so a new world is created
|
||||
* for each race of a Grand Prix). It creates the
|
||||
* physics, loads the track, creates all karts, and initialises the race
|
||||
* specific managers (HerringManager, ProjectilManager, highscores, ...).
|
||||
* specific managers (ItemManager, ProjectilManager, highscores, ...).
|
||||
* It uses the information from the race manager to get information like
|
||||
* what and how many karts, track to load etc. This class does not really
|
||||
* know about Grand Prixs, a GP is created
|
||||
@ -154,9 +154,9 @@ public:
|
||||
*/
|
||||
virtual void getDefaultCollectibles(int& collectible_type, int& amount );
|
||||
|
||||
/** Called to determine whether this race mode uses "red herring".
|
||||
/** Called to determine whether this race mode uses bonus boxes.
|
||||
*/
|
||||
virtual bool useRedHerring(){ return true; }
|
||||
virtual bool enableBonusBoxes(){ return true; }
|
||||
|
||||
/** Each game mode should have a unique internal code. Override
|
||||
* this method in child classes to provide it.
|
||||
|
@ -32,7 +32,7 @@ class Material;
|
||||
/* Limits of Kart performance */
|
||||
#define CRASH_PITCH -45.0f
|
||||
|
||||
#define MAX_HERRING_EATEN 20
|
||||
#define MAX_ITEMS_COLLECTED 20
|
||||
|
||||
|
||||
class Moveable
|
||||
|
@ -19,38 +19,38 @@
|
||||
|
||||
#ifndef HEADER_HERRING_INFO_HPP
|
||||
#define HEADER_HERRING_INFO_HPP
|
||||
/** Class used to transfer information about collected herrings from
|
||||
/** Class used to transfer information about collected items from
|
||||
* server to client.
|
||||
*/
|
||||
class HerringInfo
|
||||
class ItemInfo
|
||||
{
|
||||
public:
|
||||
/** Kart id (in world) of the kart collecting the herring. */
|
||||
/** Kart id (in world) of the kart collecting the item. */
|
||||
unsigned char m_kart_id;
|
||||
/** Index of the collected herring. This is set to -1 if a kart
|
||||
/** Index of the collected item. This is set to -1 if a kart
|
||||
* triggers a rescue (i.e. attaches the butterfly).]
|
||||
*/
|
||||
short m_herring_id;
|
||||
/** Additional info used, depending on herring type. This is usually
|
||||
* the type of the collected herring.
|
||||
short m_item_id;
|
||||
/** Additional info used, depending on item type. This is usually
|
||||
* the type of the collected item.
|
||||
*/
|
||||
char m_add_info;
|
||||
|
||||
/** Constructor to initialise all fields. */
|
||||
HerringInfo(int kart, int herring, char add_info) :
|
||||
m_kart_id(kart), m_herring_id(herring),
|
||||
ItemInfo(int kart, int item, char add_info) :
|
||||
m_kart_id(kart), m_item_id(item),
|
||||
m_add_info(add_info)
|
||||
{}
|
||||
// -------------------------------------------------------------
|
||||
/** Construct HerringInfo from a message (which is unpacked). */
|
||||
HerringInfo(Message *m)
|
||||
/** Construct ItemInfo from a message (which is unpacked). */
|
||||
ItemInfo(Message *m)
|
||||
{
|
||||
m_kart_id = m->getChar();
|
||||
m_herring_id = m->getShort();
|
||||
m_item_id = m->getShort();
|
||||
m_add_info = m->getChar();
|
||||
}
|
||||
// -------------------------------------------------------------
|
||||
/*** Returns size in bytes necessary to store HerringInfo. */
|
||||
/*** Returns size in bytes necessary to store ItemInfo. */
|
||||
static int getLength() {return 2*Message::getCharLength()
|
||||
+ Message::getShortLength();}
|
||||
// -------------------------------------------------------------
|
||||
@ -58,10 +58,10 @@ public:
|
||||
void serialise(Message *m)
|
||||
{
|
||||
m->addChar(m_kart_id);
|
||||
m->addShort(m_herring_id);
|
||||
m->addShort(m_item_id);
|
||||
m->addChar(m_add_info);
|
||||
} // serialise
|
||||
}; // HerringInfo
|
||||
}; // ItemInfo
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -42,9 +42,9 @@ void RaceState::serialise()
|
||||
+ getVec3Length()+getQuaternionLength()
|
||||
+ getFloatLength()) ;
|
||||
|
||||
// 2. Add information about eaten herrings
|
||||
// 2. Add information about collected items
|
||||
// ---------------------------------------
|
||||
len += 1 + m_herring_info.size()* HerringInfo::getLength();
|
||||
len += 1 + m_item_info.size()* ItemInfo::getLength();
|
||||
|
||||
// 3. Add rocket positions
|
||||
// -----------------------
|
||||
@ -70,12 +70,12 @@ void RaceState::serialise()
|
||||
addFloat(kart->getSpeed());
|
||||
} // for i
|
||||
|
||||
// 2. Eaten herrings
|
||||
// 2. Collected items
|
||||
// -----------------
|
||||
addChar(m_herring_info.size());
|
||||
for(unsigned int i=0; i<m_herring_info.size(); i++)
|
||||
addChar(m_item_info.size());
|
||||
for(unsigned int i=0; i<m_item_info.size(); i++)
|
||||
{
|
||||
m_herring_info[i].serialise(this);
|
||||
m_item_info[i].serialise(this);
|
||||
}
|
||||
|
||||
// 3. Projectiles
|
||||
@ -100,7 +100,7 @@ void RaceState::serialise()
|
||||
// ----------------------------------------------------------------------------
|
||||
void RaceState::clear()
|
||||
{
|
||||
m_herring_info.clear();
|
||||
m_item_info.clear();
|
||||
} // clear
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -131,16 +131,16 @@ void RaceState::receive(ENetPacket *pkt)
|
||||
kart->setSpeed(getFloat());
|
||||
} // for i
|
||||
|
||||
// 2. Eaten herrings
|
||||
// 2. Collected Items
|
||||
// -----------------
|
||||
unsigned short num_herrings=getChar();
|
||||
for(unsigned int i=0; i<num_herrings; i++)
|
||||
unsigned short num_items=getChar();
|
||||
for(unsigned int i=0; i<num_items; i++)
|
||||
{
|
||||
HerringInfo hi(this);
|
||||
if(hi.m_herring_id==-1) // Rescue triggered
|
||||
ItemInfo hi(this);
|
||||
if(hi.m_item_id==-1) // Rescue triggered
|
||||
RaceManager::getKart(hi.m_kart_id)->forceRescue();
|
||||
else
|
||||
herring_manager->eatenHerring(hi.m_herring_id,
|
||||
item_manager->collectedItem(hi.m_item_id,
|
||||
RaceManager::getKart(hi.m_kart_id),
|
||||
hi.m_add_info);
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ class RaceState : public Message
|
||||
{
|
||||
private:
|
||||
|
||||
/** Updates about collected herrings. */
|
||||
std::vector<HerringInfo> m_herring_info;
|
||||
/** Updates about collected items. */
|
||||
std::vector<ItemInfo> m_item_info;
|
||||
/** Updates about existing flyables. */
|
||||
std::vector<FlyableInfo> m_flyable_info;
|
||||
/** Stores the controls of each kart at the beginning of its update(). */
|
||||
@ -57,10 +57,10 @@ private:
|
||||
m_kart_controls.resize(race_manager->getNumKarts());
|
||||
} // RaceState()
|
||||
// --------------------------------------------------------------------
|
||||
void herringCollected(int kartid, int herring_id, char add_info=-1)
|
||||
void itemCollected(int kartid, int item_id, char add_info=-1)
|
||||
{
|
||||
m_herring_info.push_back(HerringInfo(kartid, herring_id, add_info));
|
||||
} // herringCollected
|
||||
m_item_info.push_back(ItemInfo(kartid, item_id, add_info));
|
||||
} // itemCollected
|
||||
// --------------------------------------------------------------------
|
||||
/** Collects information about collision in which at least one kart was
|
||||
* involved. Other collision (e.g. projectiles, moving physics) are
|
||||
|
@ -285,31 +285,32 @@ void PlayerKart::handleZipper()
|
||||
} // handleZipper
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Called when a kart hits a herring.
|
||||
* \param herring Herring that was collected.
|
||||
* \param add_info Additional info to be used then handling the herring. If
|
||||
* this is -1 (default), the herring type is selected
|
||||
/** Called when a kart hits an item.
|
||||
* \param item Item that was collected.
|
||||
* \param add_info Additional info to be used then handling the item. If
|
||||
* this is -1 (default), the item type is selected
|
||||
* randomly. Otherwise it contains the collectable or
|
||||
* attachment for the kart. This is used in network mode to
|
||||
* let the server determine the collectable/attachment for
|
||||
* the clients.
|
||||
*/
|
||||
void PlayerKart::collectedHerring(const Herring &herring, int add_info)
|
||||
void PlayerKart::collectedItem(const Item &item, int add_info)
|
||||
{
|
||||
const int old_herring_gobbled = getNumHerring();
|
||||
Kart::collectedHerring(herring, add_info);
|
||||
// FIXME - how does the old item relate to the total amount of items?
|
||||
const int old_item_collected = getNumItems();
|
||||
Kart::collectedItem(item, add_info);
|
||||
|
||||
if(old_herring_gobbled < MAX_HERRING_EATEN &&
|
||||
getNumHerring() == MAX_HERRING_EATEN)
|
||||
if(old_item_collected < MAX_ITEMS_COLLECTED &&
|
||||
getNumItems() == MAX_ITEMS_COLLECTED)
|
||||
{
|
||||
m_full_sound->play();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(herring.getType() == HE_GREEN)
|
||||
if(item.getType() == ITEM_BANANA)
|
||||
m_ugh_sound->play();
|
||||
else
|
||||
m_grab_sound->play();
|
||||
}
|
||||
} // collectedHerring
|
||||
} // collectedItem
|
||||
|
||||
|
@ -57,10 +57,10 @@ public:
|
||||
void update (float);
|
||||
void action (KartAction action, int value);
|
||||
void handleZipper ();
|
||||
void collectedHerring (const Herring &herring, int add_info=-1);
|
||||
void collectedItem (const Item &item, int add_info=-1);
|
||||
virtual void crashed (Kart *k);
|
||||
virtual void setPosition (int p);
|
||||
virtual void raceFinished (float time);
|
||||
virtual void setPosition (int p);
|
||||
virtual void raceFinished (float time);
|
||||
bool isPlayerKart () const {return true;}
|
||||
Camera* getCamera () {return m_camera;}
|
||||
void reset();
|
||||
|
@ -193,7 +193,7 @@ public:
|
||||
const GrandPrixData *getGrandPrix() const { return &m_grand_prix; }
|
||||
unsigned int getFinishedKarts() const { return m_num_finished_karts; }
|
||||
unsigned int getFinishedPlayers() const { return m_num_finished_players; }
|
||||
const std::string& getHerringStyle() const { return m_grand_prix.getHerringStyle(); }
|
||||
const std::string& getItemStyle() const { return m_grand_prix.getItemStyle(); }
|
||||
const std::string&
|
||||
getKartName(int kart) const { return m_kart_status[kart].m_ident;}
|
||||
int getKartScore(int krt) const { return m_kart_status[krt].m_score; }
|
||||
|
@ -314,7 +314,7 @@ void SDLDriver::setVideoMode(bool resetTextures)
|
||||
// startScreen -> removeTextures();
|
||||
attachment_manager -> removeTextures();
|
||||
projectile_manager -> removeTextures();
|
||||
herring_manager -> removeTextures();
|
||||
item_manager -> removeTextures();
|
||||
kart_properties_manager -> removeTextures();
|
||||
collectable_manager -> removeTextures();
|
||||
|
||||
@ -323,7 +323,7 @@ void SDLDriver::setVideoMode(bool resetTextures)
|
||||
|
||||
collectable_manager -> loadCollectables();
|
||||
kart_properties_manager -> loadKartData();
|
||||
herring_manager -> loadDefaultHerrings();
|
||||
item_manager -> loadDefaultItems();
|
||||
projectile_manager -> loadData();
|
||||
attachment_manager -> loadModels();
|
||||
|
||||
|
@ -58,7 +58,7 @@ const int Track::UNKNOWN_SECTOR = -1;
|
||||
Track::Track( std::string filename_, float w, float h, bool stretch )
|
||||
{
|
||||
m_filename = filename_;
|
||||
m_herring_style = "";
|
||||
m_item_style = "";
|
||||
m_track_2d_width = w;
|
||||
m_track_2d_height = h;
|
||||
m_do_stretch = stretch;
|
||||
@ -839,7 +839,7 @@ void Track::loadTrack(std::string filename_)
|
||||
std::vector<std::string> filenames;
|
||||
LISP->getVector("music", filenames);
|
||||
getMusicInformation(filenames, m_music);
|
||||
LISP->get ("herring", m_herring_style);
|
||||
LISP->get ("item", m_item_style);
|
||||
LISP->get ("screenshot", m_screenshot);
|
||||
LISP->get ("topview", m_top_view);
|
||||
LISP->get ("sky-color", m_sky_color);
|
||||
@ -1186,12 +1186,12 @@ void Track::loadTrackModel()
|
||||
if ( sscanf ( s, "%cHERRING,%f,%f,%f", &htype,
|
||||
&(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 4 )
|
||||
{
|
||||
herring_command(&loc.xyz, htype, false) ;
|
||||
item_command(&loc.xyz, htype, false) ;
|
||||
}
|
||||
else if ( sscanf ( s, "%cHERRING,%f,%f", &htype,
|
||||
&(loc.xyz[0]), &(loc.xyz[1]) ) == 3 )
|
||||
{
|
||||
herring_command (&loc.xyz, htype, true) ;
|
||||
item_command (&loc.xyz, htype, true) ;
|
||||
}
|
||||
else if ( sscanf ( s, "START,%f,%f,%f",
|
||||
&(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 3 )
|
||||
@ -1337,26 +1337,26 @@ void Track::loadTrackModel()
|
||||
} // loadTrack
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Track::herring_command (sgVec3 *xyz, char htype, int bNeedHeight )
|
||||
void Track::item_command (sgVec3 *xyz, char htype, int bNeedHeight )
|
||||
{
|
||||
|
||||
// if only 2d coordinates are given, let the herring fall from very heigh
|
||||
// if only 2d coordinates are given, let the item fall from very high
|
||||
if(bNeedHeight) (*xyz)[2] = 1000000.0f;
|
||||
|
||||
// Even if 3d data are given, make sure that the herring is on the ground
|
||||
// Even if 3d data are given, make sure that the item is on the ground
|
||||
(*xyz)[2] = getHeight ( m_model, *xyz ) + 0.06f;
|
||||
herringType type=HE_GREEN;
|
||||
if ( htype=='Y' || htype=='y' ) { type = HE_GOLD ;}
|
||||
if ( htype=='G' || htype=='g' ) { type = HE_GREEN ;}
|
||||
if ( htype=='R' || htype=='r' ) { type = HE_RED ;}
|
||||
if ( htype=='S' || htype=='s' ) { type = HE_SILVER ;}
|
||||
ItemType type=ITEM_BANANA;
|
||||
if ( htype=='Y' || htype=='y' ) { type = ITEM_GOLD_COIN ;}
|
||||
if ( htype=='G' || htype=='g' ) { type = ITEM_BANANA ;}
|
||||
if ( htype=='R' || htype=='r' ) { type = ITEM_BONUS_BOX ;}
|
||||
if ( htype=='S' || htype=='s' ) { type = ITEM_SILVER_COIN ;}
|
||||
|
||||
// Time trial does not have any red herrings
|
||||
if(type==HE_RED && !RaceManager::getWorld()->useRedHerring())
|
||||
// Some modes (e.g. time trial) don't have any bonus boxes
|
||||
if(type==ITEM_BONUS_BOX && !RaceManager::getWorld()->enableBonusBoxes())
|
||||
return;
|
||||
Vec3 loc((*xyz));
|
||||
herring_manager->newHerring(type, loc);
|
||||
} // herring_command
|
||||
item_manager->newItem(type, loc);
|
||||
} // item_command
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void Track::getTerrainInfo(const Vec3 &pos, float *hot, Vec3 *normal,
|
||||
|
@ -46,7 +46,7 @@ private:
|
||||
std::string m_top_view;
|
||||
std::vector<MusicInformation*> m_music;
|
||||
std::vector<float> m_start_x, m_start_y, m_start_z, m_start_heading;
|
||||
std::string m_herring_style;
|
||||
std::string m_item_style;
|
||||
std::string m_description;
|
||||
std::string m_designer;
|
||||
std::string m_filename;
|
||||
@ -178,7 +178,7 @@ public:
|
||||
const std::string& getTopviewFile () const {return m_top_view; }
|
||||
const std::string& getScreenshotFile () const {return m_screenshot; }
|
||||
const std::vector<SGfloat>& getWidth () const {return m_path_width; }
|
||||
const std::string& getHerringStyle () const {return m_herring_style; }
|
||||
const std::string& getItemStyle () const {return m_item_style; }
|
||||
bool hasFinalCamera () const {return m_has_final_camera; }
|
||||
const Vec3& getCameraPosition () const {return m_camera_final_position;}
|
||||
const Vec3& getCameraHPR () const {return m_camera_final_hpr; }
|
||||
@ -195,7 +195,7 @@ public:
|
||||
|
||||
private:
|
||||
void loadTrack (std::string filename);
|
||||
void herring_command (sgVec3 *xyz, char htype, int bNeedHeight);
|
||||
void item_command (sgVec3 *xyz, char htype, int bNeedHeight);
|
||||
void loadDriveline ();
|
||||
void readDrivelineFromFile (std::vector<Vec3>& line,
|
||||
const std::string& file_ext );
|
||||
|
@ -101,7 +101,7 @@ void UserConfig::setDefaults()
|
||||
m_music = UC_ENABLE;
|
||||
m_smoke = false;
|
||||
m_display_fps = false;
|
||||
m_herring_style = "new";
|
||||
m_item_style = "items";
|
||||
m_background_music = "";
|
||||
m_profile = 0;
|
||||
m_print_kart_sizes = false;
|
||||
@ -421,7 +421,7 @@ void UserConfig::loadConfig(const std::string& filename)
|
||||
m_music = doMusic ? UC_ENABLE : UC_DISABLE;
|
||||
lisp->get("smoke", m_smoke);
|
||||
lisp->get("displayFPS", m_display_fps);
|
||||
lisp->get("herringStyle", m_herring_style);
|
||||
lisp->get("itemStyle", m_item_style);
|
||||
lisp->get("background-music", m_background_music);
|
||||
lisp->get("max-fps", m_max_fps);
|
||||
lisp->get("sfx-volume", m_sfx_volume);
|
||||
@ -662,8 +662,8 @@ void UserConfig::saveConfig(const std::string& filename)
|
||||
writer->write("smoke\t", m_smoke);
|
||||
writer->writeComment("Display frame per seconds");
|
||||
writer->write("displayFPS\t", m_display_fps);
|
||||
writer->writeComment("Name of the .herring file to use.");
|
||||
writer->write("herringStyle\t", m_herring_style);
|
||||
writer->writeComment("Name of the .items file to use.");
|
||||
writer->write("itemStyle\t", m_item_style);
|
||||
writer->writeComment("Background music file to use,");
|
||||
writer->write("background-music\t", m_background_music);
|
||||
writer->writeComment("Use of kilometers per hours (km/h) instead of mph");
|
||||
|
@ -171,7 +171,7 @@ public:
|
||||
bool m_skidding;
|
||||
float m_sfx_volume;
|
||||
int m_max_fps;
|
||||
std::string m_herring_style;
|
||||
std::string m_item_style;
|
||||
std::string m_username;
|
||||
std::string m_background_music;
|
||||
std::string m_kart_group; // Kart group used last
|
||||
|
Loading…
Reference in New Issue
Block a user