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:
auria 2008-10-29 15:55:54 +00:00
parent 67091ed534
commit c834005143
45 changed files with 310 additions and 319 deletions

View File

@ -1,6 +1,6 @@
;; -*- mode: lisp -*- ;; -*- mode: lisp -*-
(herring (item
(gold "goldcoin" ) (gold "goldcoin" )
(silver "silvercoin") (silver "silvercoin")
(green "banana" ) (green "banana" )

View File

@ -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 ;;

View File

@ -30,7 +30,7 @@
// gets loaded once, and deleted at the end (and when switching windows / // gets loaded once, and deleted at the end (and when switching windows /
// fullscreen). Sinace it's not much overhead, a separate class is provided // fullscreen). Sinace it's not much overhead, a separate class is provided
// for every model that might contain a callback. // 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 }; CB_KART, CB_TRACK, CB_MAX };
class CallbackManager class CallbackManager

View File

@ -223,7 +223,7 @@ bool ChallengeData::raceFinished()
if((int)race_manager->getNumKarts()<m_num_karts) return false; // not enough AI karts if((int)race_manager->getNumKarts()<m_num_karts) return false; // not enough AI karts
Kart* kart = RaceManager::getPlayerKart(0); 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 if(m_position>0 && kart->getPosition()>m_position) return false; // too far behind
// Follow the leader // Follow the leader

View File

@ -206,10 +206,10 @@ std::string FileManager::getKartDir() const
} // getKartDir } // getKartDir
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
std::string FileManager::getHerringDir() const std::string FileManager::getItemsDir() const
{ {
return m_root_dir+"/data/herrings"; return m_root_dir+"/data/items";
} // getHerringDir } // getItemsDir
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
std::string FileManager::getTranslationDir() const std::string FileManager::getTranslationDir() const
{ {
@ -253,9 +253,9 @@ std::string FileManager::getConfigFile(const std::string& fname) const
} // getConfigFile } // 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 } // getConfigFile
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -43,7 +43,7 @@ public:
std::string getHomeDir () const; std::string getHomeDir () const;
std::string getTrackDir () const; std::string getTrackDir () const;
std::string getKartDir () const; std::string getKartDir () const;
std::string getHerringDir () const; std::string getItemsDir () const;
std::string getTranslationDir() const; std::string getTranslationDir() const;
std::vector<std::string>getMusicDirs() const; std::vector<std::string>getMusicDirs() const;
std::string getTextureFile (const std::string& fname) const; std::string getTextureFile (const std::string& fname) const;
@ -54,7 +54,7 @@ public:
std::string getConfigFile (const std::string& fname) const; std::string getConfigFile (const std::string& fname) const;
std::string getHighscoreFile (const std::string& fname) const; std::string getHighscoreFile (const std::string& fname) const;
std::string getLogFile (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 getMusicFile (const std::string& fname) const;
std::string getSFXFile (const std::string& fname) const; std::string getSFXFile (const std::string& fname) const;
std::string getFontFile (const std::string& fname) const; std::string getFontFile (const std::string& fname) const;

View File

@ -45,7 +45,7 @@ GrandPrixData::GrandPrixData(const std::string filename)
lisp->get ("name", m_name ); lisp->get ("name", m_name );
lisp->get ("description", m_description ); lisp->get ("description", m_description );
lisp->get ("herring", m_herring_style); lisp->get ("item", m_item_style);
lisp->getVector("tracks", m_tracks ); lisp->getVector("tracks", m_tracks );
lisp->getVector("laps", m_laps ); lisp->getVector("laps", m_laps );
} }

View File

@ -35,7 +35,7 @@ class GrandPrixData
std::string m_id; // Internal name of the grand prix, not translated 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_filename; // Original filename, only for error handling needed
std::string m_description; // Description for this track 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 /** The ident of the tracks in this grand prix in their right order, ident
means the filename of the .track file without .track extension means the filename of the .track file without .track extension
(ie. 'volcano') */ (ie. 'volcano') */
@ -52,7 +52,7 @@ public:
const std::string& getName () const { return m_name; } const std::string& getName () const { return m_name; }
const std::string& getId () const { return m_id; } const std::string& getId () const { return m_id; }
const std::string& getDescription () const { return m_description; } 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& getFilename () const { return m_filename; }
const std::string& getTrack(size_t track_index) const { assert(track_index < m_tracks.size()); const std::string& getTrack(size_t track_index) const { assert(track_index < m_tracks.size());
return m_tracks[track_index]; } return m_tracks[track_index]; }

View File

@ -77,25 +77,25 @@ HelpPageOne::HelpPageOne()
widget_manager->breakLine(); widget_manager->breakLine();
/*Rotating 3D models*/ /*Rotating 3D models*/
ssgEntity* hm = herring_manager->getHerringModel(HE_RED); ssgEntity* hm = item_manager->getItemModel(ITEM_BONUS_BOX);
ssgDeRefDelete(m_box); ssgDeRefDelete(m_box);
m_box = new ssgTransform; m_box = new ssgTransform;
m_box->ref(); m_box->ref();
m_box->addKid(hm); m_box->addKid(hm);
hm = herring_manager->getHerringModel(HE_SILVER); hm = item_manager->getItemModel(ITEM_SILVER_COIN);
ssgDeRefDelete(m_silver_coin); ssgDeRefDelete(m_silver_coin);
m_silver_coin = new ssgTransform; m_silver_coin = new ssgTransform;
m_silver_coin->ref(); m_silver_coin->ref();
m_silver_coin->addKid(hm); m_silver_coin->addKid(hm);
hm = herring_manager->getHerringModel(HE_GOLD); hm = item_manager->getItemModel(ITEM_GOLD_COIN);
ssgDeRefDelete(m_gold_coin); ssgDeRefDelete(m_gold_coin);
m_gold_coin = new ssgTransform; m_gold_coin = new ssgTransform;
m_gold_coin->ref(); m_gold_coin->ref();
m_gold_coin->addKid(hm); m_gold_coin->addKid(hm);
hm = herring_manager->getHerringModel(HE_GREEN); hm = item_manager->getItemModel(ITEM_BANANA);
ssgDeRefDelete(m_banana); ssgDeRefDelete(m_banana);
m_banana = new ssgTransform; m_banana = new ssgTransform;
m_banana->ref(); m_banana->ref();

View File

@ -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, void RaceGUI::drawEnergyMeter ( Kart *player_kart, int offset_x, int offset_y,
float ratio_x, float ratio_y ) float ratio_x, float ratio_y )
{ {
float state = (float)(player_kart->getNumHerring()) / float state = (float)(player_kart->getNumItems()) /
MAX_HERRING_EATEN; MAX_ITEMS_COLLECTED;
int x = (int)((user_config->m_width-24) * ratio_x) + offset_x; int x = (int)((user_config->m_width-24) * ratio_x) + offset_x;
int y = (int)(250 * ratio_y) + offset_y; int y = (int)(250 * ratio_y) + offset_y;
int w = (int)(16 * ratio_x); 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); int wl = (int)(ratio_x);
if(wl < 1) if(wl < 1)
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 int gh = (int)(h/GRADS); //graduation height
float coin_target = (float)race_manager->getCoinTarget(); 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); glDisable(GL_TEXTURE_2D);
// Draw a Meter border // Draw a Meter border

View File

@ -63,7 +63,7 @@ void Attachment::set(attachmentType _type, float time, Kart *current_kart)
} // set } // 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; if(user_config->m_profile) return;
float leftover_time = 0.0f; 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. // so that the clients can be updated.
if(network_manager->getMode()==NetworkManager::NW_SERVER) if(network_manager->getMode()==NetworkManager::NW_SERVER)
{ {
race_state->herringCollected(m_kart->getWorldKartId(), race_state->itemCollected(m_kart->getWorldKartId(),
herring.getHerringId(), item.getItemId(),
random_attachment); random_attachment);
} }
@ -117,7 +117,7 @@ void Attachment::hitGreenHerring(const Herring &herring, int random_attachment)
m_kart->adjustSpeedWeight(stk_config->m_anvil_speed_factor); m_kart->adjustSpeedWeight(stk_config->m_anvil_speed_factor);
break ; break ;
} // switch } // switch
} // hitGreenHerring } // hitBanana
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//** Moves a bomb from kart FROM to kart TO. //** Moves a bomb from kart FROM to kart TO.

View File

@ -24,7 +24,7 @@
#include "utils/random_generator.hpp" #include "utils/random_generator.hpp"
class Kart; class Kart;
class Herring; class Item;
// Some loop in Attachment.cpp depend on PARACHUTE being the first element, // 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 // 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 /** Randomly selects the new attachment. For a server process, the
* attachment can be passed into this function. * 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 \param random_attachment Optional: only used on the clients, it
specifies the new attachment to use 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 update (float dt);
void moveBombFromTo(Kart *from, Kart *to); void moveBombFromTo(Kart *from, Kart *to);
}; };

View File

@ -154,7 +154,7 @@ void Collectable::use()
} // 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 //The probabilities of getting the anvil or the parachute increase
//depending on how bad the owner's position is. For the first //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; m_number = 1;
if(network_manager->getMode()==NetworkManager::NW_SERVER) if(network_manager->getMode()==NetworkManager::NW_SERVER)
{ {
race_state->herringCollected(m_owner->getWorldKartId(), race_state->itemCollected(m_owner->getWorldKartId(),
herring.getHerringId(), item.getItemId(),
m_type); m_type);
} }
return; return;
} }
@ -198,9 +198,9 @@ void Collectable::hitRedHerring(int n, const Herring &herring, int add_info)
m_number = 1; m_number = 1;
if(network_manager->getMode()==NetworkManager::NW_SERVER) if(network_manager->getMode()==NetworkManager::NW_SERVER)
{ {
race_state->herringCollected(m_owner->getWorldKartId(), race_state->itemCollected(m_owner->getWorldKartId(),
herring.getHerringId(), item.getItemId(),
(char)m_type); (char)m_type);
} }
return; return;
} }
@ -238,9 +238,9 @@ void Collectable::hitRedHerring(int n, const Herring &herring, int add_info)
// so that the clients can be updated. // so that the clients can be updated.
if(network_manager->getMode()==NetworkManager::NW_SERVER) if(network_manager->getMode()==NetworkManager::NW_SERVER)
{ {
race_state->herringCollected(m_owner->getWorldKartId(), race_state->itemCollected(m_owner->getWorldKartId(),
herring.getHerringId(), item.getItemId(),
newC); newC);
} }
if(m_type==COLLECT_NOTHING) 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; if(m_number > MAX_COLLECTABLES) m_number = MAX_COLLECTABLES;
} }
// Ignore new collectable if it is different from the current one // Ignore new collectable if it is different from the current one
} // hitRedHerring } // hitBonusBox

View File

@ -26,7 +26,7 @@
#include "utils/random_generator.hpp" #include "utils/random_generator.hpp"
class Kart; class Kart;
class Herring; class Item;
class SFXBase; class SFXBase;
class Collectable class Collectable
@ -49,7 +49,7 @@ public:
void reset (); void reset ();
int getNum () const {return m_number;} int getNum () const {return m_number;}
CollectableType getType () const {return m_type; } 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 (); Material* getIcon ();
void use (); void use ();
}; };

View File

@ -28,7 +28,7 @@ class Material;
class ssgEntity; class ssgEntity;
// The anvil and parachute must be at the end of the enum, and the // 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, enum CollectableType {COLLECT_NOTHING,
COLLECT_MISSILE, COLLECT_CAKE, COLLECT_MISSILE, COLLECT_CAKE,
COLLECT_BOWLING, COLLECT_ZIPPER, COLLECT_BOWLING, COLLECT_ZIPPER,

View File

@ -23,30 +23,30 @@
#include "scene.hpp" #include "scene.hpp"
#include "coord.hpp" #include "coord.hpp"
Herring::Herring(herringType type, const Vec3& xyz, ssgEntity* model, Item::Item(ItemType type, const Vec3& xyz, ssgEntity* model,
unsigned int herring_id) unsigned int item_id)
: m_coord(xyz, Vec3(0, 0, 0)) : m_coord(xyz, Vec3(0, 0, 0))
{ {
m_herring_id = herring_id; m_item_id = item_id;
m_type = type; m_type = type;
m_eaten = false; 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 = new ssgTransform();
m_root->ref(); m_root->ref();
m_root->setTransform(const_cast<sgCoord*>(&m_coord.toSgCoord())); m_root->setTransform(const_cast<sgCoord*>(&m_coord.toSgCoord()));
m_root->addKid(model); m_root->addKid(model);
scene->add(m_root); scene->add(m_root);
} // Herring } // Item
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
Herring::~Herring() Item::~Item()
{ {
ssgDeRefDelete(m_root); ssgDeRefDelete(m_root);
} // ~Herring } // ~Item
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Herring::reset() void Item::reset()
{ {
m_eaten = false; m_eaten = false;
m_time_till_return = 0.0f; m_time_till_return = 0.0f;
@ -54,13 +54,13 @@ void Herring::reset()
} // reset } // reset
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int Herring::hitKart(Kart* kart) int Item::hitKart(Kart* kart)
{ {
return (kart->getXYZ()-m_coord.getXYZ()).length2()<0.8f; return (kart->getXYZ()-m_coord.getXYZ()).length2()<0.8f;
} // hitKart } // hitKart
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Herring::update(float delta) void Item::update(float delta)
{ {
if(m_eaten) if(m_eaten)
{ {
@ -90,7 +90,7 @@ void Herring::update(float delta)
} // update } // update
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Herring::isEaten() void Item::isCollected()
{ {
m_eaten = true; m_eaten = true;
m_time_till_return = 2.0f; m_time_till_return = 2.0f;

View File

@ -17,8 +17,8 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_HERRING_H #ifndef HEADER_ITEM_H
#define HEADER_HERRING_H #define HEADER_ITEM_H
// num_players triggers 'already defined' messages without the WINSOCKAPI define. Don't ask me :( // num_players triggers 'already defined' messages without the WINSOCKAPI define. Don't ask me :(
#define _WINSOCKAPI_ #define _WINSOCKAPI_
@ -29,33 +29,33 @@ class Kart;
class ssgTransform; class ssgTransform;
class ssgEntity; class ssgEntity;
// HE_RED must be the first, HE_SILVER the last entry. See HerringManager // ITEM_BONUS_BOX must be the first, ITEM_SILVER_COIN the last entry. See ItemManager
enum herringType { HE_RED, HE_GREEN, HE_GOLD, HE_SILVER, HE_NONE }; enum ItemType { ITEM_BONUS_BOX, ITEM_BANANA, ITEM_GOLD_COIN, ITEM_SILVER_COIN, ITEM_NONE };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
class Herring class Item
{ {
private: private:
herringType m_type; // Herring type ItemType m_type; // Item type
bool m_eaten; // true if herring was eaten & is not displayed bool m_eaten; // true if item was collected & is not displayed
float m_time_till_return; // time till an eaten herring reappears float m_time_till_return; // time till a collected item reappears
Coord m_coord; // Original coordinates, used mainly when Coord m_coord; // Original coordinates, used mainly when
// eaten herrings reappear. // collected items reappear.
ssgTransform* m_root; // The actual root of the herring ssgTransform* m_root; // The actual root of the item
unsigned int m_herring_id; // index in herring_manager field unsigned int m_item_id; // index in item_manager field
public: public:
Herring (herringType type, const Vec3& xyz, ssgEntity* model, Item (ItemType type, const Vec3& xyz, ssgEntity* model,
unsigned int herring_id); unsigned int item_id);
~Herring (); ~Item ();
unsigned int getHerringId() const {return m_herring_id; } unsigned int getItemId() const {return m_item_id; }
void update (float delta); void update (float delta);
void isEaten (); void isCollected ();
int hitKart (Kart* kart ); int hitKart (Kart* kart );
void reset (); void reset ();
ssgTransform* getRoot () const {return m_root;} ssgTransform* getRoot () const {return m_root;}
herringType getType () const {return m_type;} ItemType getType () const {return m_type;}
bool wasEaten() const {return m_eaten;} bool wasEaten() const {return m_eaten;}
} }
; // class Herring ; // class Item
#endif #endif

View File

@ -35,7 +35,7 @@
#if defined(WIN32) && !defined(__CYGWIN__) #if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf # define snprintf _snprintf
#endif #endif
/** Simple shadow class, only used here for default herrings. */ /** Simple shadow class, only used here for default items. */
class Shadow class Shadow
{ {
ssgBranch *sh ; 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 ) ; ssgVtxTable *gs = new ssgVtxTable ( GL_TRIANGLE_STRIP, va, na, ta, ca ) ;
gs -> clrTraversalMaskBits ( SSGTRAV_ISECT|SSGTRAV_HOT ) ; gs -> clrTraversalMaskBits ( SSGTRAV_ISECT|SSGTRAV_HOT ) ;
gs -> setState ( fuzzy_gst ) ; //gs -> setState ( fuzzy_gst ) ;
sh -> addKid ( gs ) ; sh -> addKid ( gs ) ;
sh -> ref () ; /* Make sure it doesn't get deleted by mistake */ sh -> ref () ; /* Make sure it doesn't get deleted by mistake */
} // Shadow } // Shadow
//============================================================================= //=============================================================================
HerringManager* herring_manager; ItemManager* item_manager;
typedef std::map<std::string,ssgEntity*>::const_iterator CI_type; typedef std::map<std::string,ssgEntity*>::const_iterator CI_type;
HerringManager::HerringManager() ItemManager::ItemManager()
{ {
m_all_models.clear(); m_all_models.clear();
// The actual loading is done in loadDefaultHerrings // The actual loading is done in loadDefaultItems
} // HerringManager } // ItemManager
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void HerringManager::removeTextures() void ItemManager::removeTextures()
{ {
for(AllHerringType::iterator i =m_all_herrings.begin(); for(AllItemTypes::iterator i =m_all_items.begin();
i!=m_all_herrings.end(); i++) i!=m_all_items.end(); i++)
{ {
delete *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) for(CI_type i=m_all_models.begin(); i!=m_all_models.end(); ++i)
{ {
ssgDeRefDelete(i->second); ssgDeRefDelete(i->second);
} }
m_all_models.clear(); m_all_models.clear();
callback_manager->clear(CB_HERRING); callback_manager->clear(CB_ITEM);
} // removeTextures } // removeTextures
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
HerringManager::~HerringManager() ItemManager::~ItemManager()
{ {
for(CI_type i=m_all_models.begin(); i!=m_all_models.end(); ++i) for(CI_type i=m_all_models.begin(); i!=m_all_models.end(); ++i)
{ {
ssgDeRefDelete(i->second); ssgDeRefDelete(i->second);
} }
} // ~HerringManager } // ~ItemManager
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void HerringManager::loadDefaultHerrings() void ItemManager::loadDefaultItems()
{ {
// Load all models. This can't be done in the constructor, // Load all models. This can't be done in the constructor,
// since the file_manager isn't ready at that stage. // since the file_manager isn't ready at that stage.
// ------------------------------------------------------- // -------------------------------------------------------
std::set<std::string> files; std::set<std::string> files;
file_manager->listFiles(files, file_manager->getHerringDir(), file_manager->listFiles(files, file_manager->getItemsDir(),
/*is_full_path*/true, /*is_full_path*/true,
/*make_full_path*/true); /*make_full_path*/true);
for(std::set<std::string>::iterator i = files.begin(); for(std::set<std::string>::iterator i = files.begin();
i != files.end(); ++i) i != files.end(); ++i)
{ {
if(!StringUtils::has_suffix(*i, ".ac")) continue; if(!StringUtils::has_suffix(*i, ".ac")) continue;
ssgEntity* h = loader->load(*i, CB_HERRING, ssgEntity* h = loader->load(*i, CB_ITEM,
/*optimise*/true, /*optimise*/true,
/*full_path*/true); /*full_path*/true);
std::string shortName = StringUtils::basename(StringUtils::without_extension(*i)); std::string shortName = StringUtils::basename(StringUtils::without_extension(*i));
@ -143,16 +143,16 @@ void HerringManager::loadDefaultHerrings()
// Load the old, internal only models // Load the old, internal only models
// ---------------------------------- // ----------------------------------
sgVec3 yellow = { 1.0f, 1.0f, 0.4f }; CreateDefaultHerring(yellow, "OLD_GOLD" ); sgVec3 yellow = { 1.0f, 1.0f, 0.4f }; createDefaultItem(yellow, "OLD_GOLD" );
sgVec3 cyan = { 0.4f, 1.0f, 1.0f }; CreateDefaultHerring(cyan , "OLD_SILVER"); sgVec3 cyan = { 0.4f, 1.0f, 1.0f }; createDefaultItem(cyan , "OLD_SILVER");
sgVec3 red = { 0.8f, 0.0f, 0.0f }; CreateDefaultHerring(red , "OLD_RED" ); sgVec3 red = { 0.8f, 0.0f, 0.0f }; createDefaultItem(red , "OLD_RED" );
sgVec3 green = { 0.0f, 0.8f, 0.0f }; CreateDefaultHerring(green , "OLD_GREEN" ); sgVec3 green = { 0.0f, 0.8f, 0.0f }; createDefaultItem(green , "OLD_GREEN" );
setDefaultHerringStyle(); setDefaultItemStyle();
} // loadDefaultHerrings } // loadDefaultItems
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void HerringManager::setDefaultHerringStyle() void ItemManager::setDefaultItemStyle()
{ {
// This should go in an internal, system wide configuration file // This should go in an internal, system wide configuration file
const std::string DEFAULT_NAMES[4] = {"bonusblock", "banana", const std::string DEFAULT_NAMES[4] = {"bonusblock", "banana",
@ -160,17 +160,17 @@ void HerringManager::setDefaultHerringStyle()
bool bError=0; bool bError=0;
char msg[MAX_ERROR_MESSAGE_LENGTH]; 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]]; m_item_model[i] = m_all_models[DEFAULT_NAMES[i]];
if(!m_herring_model[i]) if(!m_item_model[i])
{ {
snprintf(msg, sizeof(msg), 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()); DEFAULT_NAMES[i].c_str());
bError=1; bError=1;
break; break;
} // if !m_herring_model } // if !m_item_model
} // for i } // for i
if(bError) if(bError)
{ {
@ -185,7 +185,7 @@ void HerringManager::setDefaultHerringStyle()
} }
else 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(),
i->first.c_str()); i->first.c_str());
} }
@ -195,85 +195,86 @@ void HerringManager::setDefaultHerringStyle()
exit(-1); exit(-1);
} // if bError } // 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()); Item* h = new Item(type, xyz, m_item_model[type], m_all_items.size());
m_all_herrings.push_back(h); m_all_items.push_back(h);
return h; return h;
} // newHerring } // newItem
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Set a herring as eaten. /** Set an item as collected.
* This function is called on the server when a herring is eaten, or on the * This function is called on the server when an item is collected, or on the
* client upon receiving information about eaten herrings. */ * client upon receiving information about collected items. */
void HerringManager::eatenHerring(int herring_id, Kart *kart, void ItemManager::collectedItem(int item_id, Kart *kart, int add_info)
int add_info)
{ {
Herring *herring=m_all_herrings[herring_id]; Item *item=m_all_items[item_id];
herring->isEaten(); item->isCollected();
kart->collectedHerring(*herring, add_info); kart->collectedItem(*item, add_info);
} // eatenHerring } // collectedItem
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void HerringManager::hitHerring(Kart* kart) void ItemManager::hitItem(Kart* kart)
{ {
// Only do this on the server // Only do this on the server
if(network_manager->getMode()==NetworkManager::NW_CLIENT) return; if(network_manager->getMode()==NetworkManager::NW_CLIENT) return;
for(AllHerringType::iterator i =m_all_herrings.begin(); for(AllItemTypes::iterator i =m_all_items.begin();
i!=m_all_herrings.end(); i++) i!=m_all_items.end(); i++)
{ {
if((*i)->wasEaten()) continue; if((*i)->wasEaten()) continue;
if((*i)->hitKart(kart)) if((*i)->hitKart(kart))
{ {
eatenHerring(i-m_all_herrings.begin(), kart); collectedItem(i-m_all_items.begin(), kart);
} // if hit } // if hit
} // for m_all_herrings } // for m_all_items
} // hitHerring } // 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. * 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(); for(AllItemTypes::iterator i =m_all_items.begin();
i!=m_all_herrings.end(); i++) i!=m_all_items.end(); i++)
{ {
delete *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 // 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. // default (i.e. old herring) is used.
try try
{ {
// FIXME: This should go in a system-wide configuration file, // FIXME: This should go in a system-wide configuration file,
// and only one of this and the hard-coded settings in // and only one of this and the hard-coded settings in
// setDefaultHerringStyle are necessary!!! // setDefaultItemStyle are necessary!!!
loadHerringStyle(user_config->m_herring_style); loadItemStyle(user_config->m_item_style);
} }
catch(std::runtime_error) catch(std::runtime_error)
{ {
fprintf(stderr,"The herring style '%s' in your configuration file does not exist.\nIt is ignored.\n", fprintf(stderr,"The item style '%s' in your configuration file does not exist.\nIt is ignored.\n",
user_config->m_herring_style.c_str()); user_config->m_item_style.c_str());
user_config->m_herring_style=""; user_config->m_item_style="";
} }
try try
{ {
loadHerringStyle(m_user_filename); loadItemStyle(m_user_filename);
} }
catch(std::runtime_error) 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.c_str());
m_user_filename=""; // reset to avoid further warnings. m_user_filename=""; // reset to avoid further warnings.
} }
@ -281,30 +282,30 @@ void HerringManager::cleanup()
} // 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 * 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(); for(AllItemTypes::iterator i =m_all_items.begin();
i!=m_all_herrings.end(); i++) i!=m_all_items.end(); i++)
{ {
(*i)->reset(); (*i)->reset();
} // for i } // for i
} // reset } // reset
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void HerringManager::update(float delta) void ItemManager::update(float delta)
{ {
for(AllHerringType::iterator i =m_all_herrings.begin(); for(AllItemTypes::iterator i =m_all_items.begin();
i!=m_all_herrings.end(); i++) i!=m_all_items.end(); i++)
{ {
(*i)->update(delta); (*i)->update(delta);
} // for m_all_herrings } // for m_all_items
} // delta } // delta
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void HerringManager::CreateDefaultHerring(sgVec3 colour, std::string name) void ItemManager::createDefaultItem(sgVec3 colour, std::string name)
{ {
ssgVertexArray *va = new ssgVertexArray () ; sgVec3 v ; ssgVertexArray *va = new ssgVertexArray () ; sgVec3 v ;
ssgNormalArray *na = new ssgNormalArray () ; sgVec3 n ; 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 ) ; 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 ) ; 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 */ tr -> ref () ; /* Make sure it doesn't get deleted by mistake */
m_all_models[name] = tr; 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; if(filename.length()==0) return;
const lisp::Lisp* root = 0; const lisp::Lisp* root = 0;
lisp::Parser parser; 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"); const lisp::Lisp* item_node = root->getLisp("item");
if(!herring_node) if(!item_node)
{ {
char msg[MAX_ERROR_MESSAGE_LENGTH]; 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()); filename.c_str());
delete root; delete root;
throw std::runtime_error(msg); throw std::runtime_error(msg);
delete root; delete root;
} }
setHerring(herring_node, "red", HE_RED ); setItem(item_node, "red", ITEM_BONUS_BOX );
setHerring(herring_node, "green", HE_GREEN ); setItem(item_node, "green", ITEM_BANANA );
setHerring(herring_node, "gold" ,HE_GOLD ); setItem(item_node, "gold" ,ITEM_GOLD_COIN );
setHerring(herring_node, "silver",HE_SILVER); setItem(item_node, "silver",ITEM_SILVER_COIN);
delete root; delete root;
} // loadHerringStyle } // loadItemStyle
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void HerringManager::setHerring(const lisp::Lisp *herring_node, void ItemManager::setItem(const lisp::Lisp *item_node,
const char *colour, herringType type) const char *colour, ItemType type)
{ {
std::string name; std::string name;
herring_node->get(colour, name); item_node->get(colour, name);
if(name.size()>0) if(name.size()>0)
{ {
m_herring_model[type]=m_all_models[name]; m_item_model[type]=m_all_models[name];
} }
} // setHerring } // setItem

View File

@ -17,8 +17,8 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_HERRINGMANAGER_H #ifndef HEADER_ITEMMANAGER_H
#define HEADER_HERRINGMANAGER_H #define HEADER_ITEMMANAGER_H
#include <vector> #include <vector>
@ -29,48 +29,47 @@
class Kart; class Kart;
class ssgEntity; class ssgEntity;
class HerringManager class ItemManager
{ {
private: private:
// The vector of all herrings of the current track // The vector of all items of the current track
typedef std::vector<Herring*> AllHerringType; typedef std::vector<Item*> AllItemTypes;
AllHerringType m_all_herrings; AllItemTypes m_all_items;
// This stores all herring models defined in the models/herring // This stores all item models
// subdirectory. ssgEntity *m_item_model[ITEM_SILVER_COIN+1];
ssgEntity *m_herring_model[HE_SILVER+1];
// This is the active model. It gets determined by first loading the // This is the active model. It gets determined by first loading the
// default, then track models, user models, grand prix models. This means that // 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::map<std::string,ssgEntity*> m_all_models;
std::string m_user_filename; std::string m_user_filename;
void CreateDefaultHerring(sgVec3 colour, std::string name); void createDefaultItem(sgVec3 colour, std::string name);
void setDefaultHerringStyle(); void setDefaultItemStyle();
void setHerring(const lisp::Lisp *herring_node, const char *colour, void setItem(const lisp::Lisp *item_node, const char *colour,
herringType type); ItemType type);
public: public:
HerringManager(); ItemManager();
~HerringManager(); ~ItemManager();
void loadDefaultHerrings(); void loadDefaultItems();
void loadHerringStyle(const std::string filename); void loadItemStyle (const std::string filename);
Herring* newHerring (herringType type, const Vec3& xyz); Item* newItem (ItemType type, const Vec3& xyz);
void update (float delta); void update (float delta);
void hitHerring (Kart* kart); void hitItem (Kart* kart);
void cleanup (); void cleanup ();
void reset (); void reset ();
void removeTextures (); void removeTextures ();
void setUserFilename (char *s) {m_user_filename=s;} 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); int add_info=-1);
ssgEntity* getHerringModel (herringType type) ssgEntity* getItemModel (ItemType type)
{return m_herring_model[type];} {return m_item_model[type];}
}; };
extern HerringManager* herring_manager; extern ItemManager* item_manager;
#endif #endif

View File

@ -70,7 +70,7 @@ Kart::Kart (const std::string& kart_name, int position,
m_kart_properties = kart_properties_manager->getKart(kart_name); m_kart_properties = kart_properties_manager->getKart(kart_name);
//m_grid_position = position; //m_grid_position = position;
m_initial_position = position; m_initial_position = position;
m_num_herrings_gobbled = 0; m_num_items_collected = 0;
m_eliminated = false; m_eliminated = false;
m_finished_race = false; m_finished_race = false;
m_finish_time = 0.0f; m_finish_time = 0.0f;
@ -358,7 +358,7 @@ void Kart::reset()
m_eliminated = false; m_eliminated = false;
m_finish_time = 0.0f; m_finish_time = 0.0f;
m_zipper_time_left = 0.0f; m_zipper_time_left = 0.0f;
m_num_herrings_gobbled = 0; m_num_items_collected = 0;
m_wheel_rotation = 0; m_wheel_rotation = 0;
m_wheelie_angle = 0.0f; m_wheelie_angle = 0.0f;
m_bounce_back_time = 0.0f; m_bounce_back_time = 0.0f;
@ -403,35 +403,35 @@ void Kart::raceFinished(float time)
} // raceFinished } // 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) switch (type)
{ {
case HE_GREEN : m_attachment.hitGreenHerring(herring, add_info); break; case ITEM_BANANA : m_attachment.hitBanana(item, add_info); break;
case HE_SILVER : m_num_herrings_gobbled++ ; break; case ITEM_SILVER_COIN : m_num_items_collected++ ; break;
case HE_GOLD : m_num_herrings_gobbled += 3 ; break; case ITEM_GOLD_COIN : m_num_items_collected += 3 ; break;
case HE_RED : { case ITEM_BONUS_BOX : {
int n=1 + 4*getNumHerring() / MAX_HERRING_EATEN; int n=1 + 4*getNumItems() / MAX_ITEMS_COLLECTED;
m_collectable.hitRedHerring(n, herring,add_info);break; m_collectable.hitBonusBox(n, item,add_info);break;
} }
default : break; default : break;
} // switch TYPE } // switch TYPE
// Attachments and collectables are stored in the corresponding // 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. // stored here.
if(network_manager->getMode()==NetworkManager::NW_SERVER && 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 ) if ( m_num_items_collected > MAX_ITEMS_COLLECTED )
m_num_herrings_gobbled = MAX_HERRING_EATEN; m_num_items_collected = MAX_ITEMS_COLLECTED;
} // collectedHerring } // collectedItem
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Simulates gears // Simulates gears
@ -541,7 +541,7 @@ void Kart::update(float dt)
m_rescue_pitch = getHPR().getPitch(); m_rescue_pitch = getHPR().getPitch();
m_rescue_roll = getHPR().getRoll(); m_rescue_roll = getHPR().getRoll();
RaceManager::getWorld()->getPhysics()->removeKart(this); 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), btQuaternion q_roll (btVector3(0.f, 1.f, 0.f),
-m_rescue_roll*dt/rescue_time*M_PI/180.0f); -m_rescue_roll*dt/rescue_time*M_PI/180.0f);
@ -613,8 +613,8 @@ void Kart::update(float dt)
} // neither reset nor zipper material } // neither reset nor zipper material
} // if there is material } // if there is material
// Check if any herring was hit. // Check if any item was hit.
herring_manager->hitHerring(this); item_manager->hitItem(this);
processSkidMarks(); processSkidMarks();

View File

@ -33,7 +33,7 @@
#include "terrain_info.hpp" #include "terrain_info.hpp"
class SkidMark; class SkidMark;
class Herring; class Item;
class Smoke; class Smoke;
class SFXBase; class SFXBase;
@ -68,7 +68,7 @@ protected:
btUprightConstraint *m_uprightConstraint; btUprightConstraint *m_uprightConstraint;
private: private:
int m_num_herrings_gobbled; int m_num_items_collected;
ssgSimpleState* m_smokepuff; ssgSimpleState* m_smokepuff;
// don't delete the following 2 vars (they're kids in the hirarchy) // don't delete the following 2 vars (they're kids in the hirarchy)
Smoke *m_smoke_system; Smoke *m_smoke_system;
@ -130,7 +130,7 @@ public:
{ m_attachment.set(t, time_left, k); } { m_attachment.set(t, time_left, k); }
Collectable *getCollectable () { return &m_collectable; } Collectable *getCollectable () { return &m_collectable; }
int getNumCollectables () const { return m_collectable.getNum();} 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 getPosition () const { return m_race_position; }
int getInitialPosition () const { return m_initial_position; } int getInitialPosition () const { return m_initial_position; }
float getFinishTime () const { return m_finish_time; } float getFinishTime () const { return m_finish_time; }
@ -211,7 +211,7 @@ public:
virtual bool isPlayerKart () const {return false; } virtual bool isPlayerKart () const {return false; }
// addMessages gets called by world to add messages to the gui // addMessages gets called by world to add messages to the gui
virtual void addMessages () {}; 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 reset ();
virtual void handleZipper (); virtual void handleZipper ();
virtual void crashed (Kart *k); virtual void crashed (Kart *k);

View File

@ -99,7 +99,7 @@ void cmdLineHelp (char* invocation)
//FIXME" --players n Define number of players to between 1 and 4.\n" //FIXME" --players n Define number of players to between 1 and 4.\n"
//FIXME " --reverse Enable reverse mode\n" //FIXME " --reverse Enable reverse mode\n"
//FIXME " --mirror Enable mirror mode (when supported)\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" " -f, --fullscreen Fullscreen display\n"
" -w, --windowed Windowed display (default)\n" " -w, --windowed Windowed display (default)\n"
" -s, --screensize WxH Set the screen size (e.g. 320x200)\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); 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 else
{ {
@ -445,7 +445,7 @@ void InitTuxkart()
projectile_manager = new ProjectileManager (); projectile_manager = new ProjectileManager ();
collectable_manager = new CollectableManager (); collectable_manager = new CollectableManager ();
callback_manager = new CallbackManager (); callback_manager = new CallbackManager ();
herring_manager = new HerringManager (); item_manager = new ItemManager ();
attachment_manager = new AttachmentManager (); attachment_manager = new AttachmentManager ();
highscore_manager = new HighscoreManager (); highscore_manager = new HighscoreManager ();
grand_prix_manager = new GrandPrixManager (); grand_prix_manager = new GrandPrixManager ();
@ -512,7 +512,7 @@ int main(int argc, char *argv[] )
kart_properties_manager -> loadKartData (); kart_properties_manager -> loadKartData ();
projectile_manager -> loadData (); projectile_manager -> loadData ();
collectable_manager -> loadCollectables (); collectable_manager -> loadCollectables ();
herring_manager -> loadDefaultHerrings(); item_manager -> loadDefaultItems();
attachment_manager -> loadModels (); attachment_manager -> loadModels ();
scene = new Scene(); scene = new Scene();

View File

@ -48,7 +48,7 @@ public:
void popTempMaterial (); void popTempMaterial ();
}; };
extern ssgState *fuzzy_gst, *herringbones_gst; //extern ssgState *fuzzy_gst, *herringbones_gst;
ssgState *getAppState ( char *fname ) ; ssgState *getAppState ( char *fname ) ;
extern MaterialManager *material_manager; extern MaterialManager *material_manager;

View File

@ -99,9 +99,9 @@ void StandardRace::getDefaultCollectibles(int& collectible_type, int& amount)
else World::getDefaultCollectibles(collectible_type, 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; return race_manager->getMinorMode() != RaceManager::MINOR_MODE_TIME_TRIAL;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ public:
virtual void update(float delta); virtual void update(float delta);
virtual void restartRace(); virtual void restartRace();
virtual void getDefaultCollectibles(int& collectible_type, int& amount); virtual void getDefaultCollectibles(int& collectible_type, int& amount);
virtual bool useRedHerring(); virtual bool enableBonusBoxes();
virtual std::string getInternalCode() const; virtual std::string getInternalCode() const;
}; };

View File

@ -50,7 +50,7 @@ public:
virtual void update(float delta); virtual void update(float delta);
virtual void restartRace(); virtual void restartRace();
//virtual void getDefaultCollectibles(int& collectible_type, int& amount); //virtual void getDefaultCollectibles(int& collectible_type, int& amount);
//virtual bool useRedHerring(); //virtual bool enableBonusBoxes();
virtual bool useFastMusicNearEnd() const { return false; } virtual bool useFastMusicNearEnd() const { return false; }
virtual KartIconDisplayInfo* getKartsDisplayInfo(const RaceGUI* caller); virtual KartIconDisplayInfo* getKartsDisplayInfo(const RaceGUI* caller);
virtual bool raceHasLaps(){ return false; } virtual bool raceHasLaps(){ return false; }

View File

@ -274,7 +274,7 @@ void World::update(float dt)
} }
projectile_manager->update(dt); projectile_manager->update(dt);
herring_manager->update(dt); item_manager->update(dt);
/* Routine stuff we do even when paused */ /* Routine stuff we do even when paused */
callback_manager->update(dt); callback_manager->update(dt);
@ -426,25 +426,25 @@ void World::removeKart(int kart_number)
} // removeKart } // removeKart
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Cleans up old herrings (from a previous race), removes old track specific /** Cleans up old items (from a previous race), removes old track specific
* herring models, and loads the actual track. * item models, and loads the actual track.
*/ */
void World::loadTrack() void World::loadTrack()
{ {
// remove old herrings (from previous race), and remove old // remove old items (from previous race), and remove old
// track specific herring models // track specific item models
herring_manager->cleanup(); item_manager->cleanup();
if(race_manager->getMajorMode()== RaceManager::MAJOR_MODE_GRAND_PRIX) if(race_manager->getMajorMode()== RaceManager::MAJOR_MODE_GRAND_PRIX)
{ {
try try
{ {
herring_manager->loadHerringStyle(race_manager->getHerringStyle()); item_manager->loadItemStyle(race_manager->getItemStyle());
} }
catch(std::runtime_error) 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->getGrandPrix()->getName().c_str(),
race_manager->getHerringStyle().c_str()); race_manager->getItemStyle().c_str());
fprintf(stderr, "Please fix the file '%s'.\n", fprintf(stderr, "Please fix the file '%s'.\n",
race_manager->getGrandPrix()->getFilename().c_str()); race_manager->getGrandPrix()->getFilename().c_str());
} }
@ -453,12 +453,12 @@ void World::loadTrack()
{ {
try try
{ {
herring_manager->loadHerringStyle(m_track->getHerringStyle()); item_manager->loadItemStyle(m_track->getItemStyle());
} }
catch(std::runtime_error) catch(std::runtime_error)
{ {
fprintf(stderr, "The track '%s' contains an invalid herring style '%s'.\n", fprintf(stderr, "The track '%s' contains an invalid item style '%s'.\n",
m_track->getName(), m_track->getHerringStyle().c_str()); m_track->getName(), m_track->getItemStyle().c_str());
fprintf(stderr, "Please fix the file '%s'.\n", fprintf(stderr, "Please fix the file '%s'.\n",
m_track->getFilename().c_str()); m_track->getFilename().c_str());
} }
@ -494,7 +494,7 @@ void World::restartRace()
// Enable SFX again // Enable SFX again
sfx_manager->resumeAll(); sfx_manager->resumeAll();
herring_manager->reset(); item_manager->reset();
projectile_manager->cleanup(); projectile_manager->cleanup();
race_manager->reset(); race_manager->reset();
callback_manager->reset(); callback_manager->reset();

View File

@ -42,7 +42,7 @@ class btRigidBody;
* by the race manager on the start of each race (so a new world is created * by the race manager on the start of each race (so a new world is created
* for each race of a Grand Prix). It creates the * for each race of a Grand Prix). It creates the
* physics, loads the track, creates all karts, and initialises the race * 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 * 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 * what and how many karts, track to load etc. This class does not really
* know about Grand Prixs, a GP is created * know about Grand Prixs, a GP is created
@ -154,9 +154,9 @@ public:
*/ */
virtual void getDefaultCollectibles(int& collectible_type, int& amount ); 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 /** Each game mode should have a unique internal code. Override
* this method in child classes to provide it. * this method in child classes to provide it.

View File

@ -32,7 +32,7 @@ class Material;
/* Limits of Kart performance */ /* Limits of Kart performance */
#define CRASH_PITCH -45.0f #define CRASH_PITCH -45.0f
#define MAX_HERRING_EATEN 20 #define MAX_ITEMS_COLLECTED 20
class Moveable class Moveable

View File

@ -19,38 +19,38 @@
#ifndef HEADER_HERRING_INFO_HPP #ifndef HEADER_HERRING_INFO_HPP
#define 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. * server to client.
*/ */
class HerringInfo class ItemInfo
{ {
public: 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; 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).] * triggers a rescue (i.e. attaches the butterfly).]
*/ */
short m_herring_id; short m_item_id;
/** Additional info used, depending on herring type. This is usually /** Additional info used, depending on item type. This is usually
* the type of the collected herring. * the type of the collected item.
*/ */
char m_add_info; char m_add_info;
/** Constructor to initialise all fields. */ /** Constructor to initialise all fields. */
HerringInfo(int kart, int herring, char add_info) : ItemInfo(int kart, int item, char add_info) :
m_kart_id(kart), m_herring_id(herring), m_kart_id(kart), m_item_id(item),
m_add_info(add_info) m_add_info(add_info)
{} {}
// ------------------------------------------------------------- // -------------------------------------------------------------
/** Construct HerringInfo from a message (which is unpacked). */ /** Construct ItemInfo from a message (which is unpacked). */
HerringInfo(Message *m) ItemInfo(Message *m)
{ {
m_kart_id = m->getChar(); m_kart_id = m->getChar();
m_herring_id = m->getShort(); m_item_id = m->getShort();
m_add_info = m->getChar(); 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() static int getLength() {return 2*Message::getCharLength()
+ Message::getShortLength();} + Message::getShortLength();}
// ------------------------------------------------------------- // -------------------------------------------------------------
@ -58,10 +58,10 @@ public:
void serialise(Message *m) void serialise(Message *m)
{ {
m->addChar(m_kart_id); m->addChar(m_kart_id);
m->addShort(m_herring_id); m->addShort(m_item_id);
m->addChar(m_add_info); m->addChar(m_add_info);
} // serialise } // serialise
}; // HerringInfo }; // ItemInfo
#endif #endif

View File

@ -42,9 +42,9 @@ void RaceState::serialise()
+ getVec3Length()+getQuaternionLength() + getVec3Length()+getQuaternionLength()
+ getFloatLength()) ; + 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 // 3. Add rocket positions
// ----------------------- // -----------------------
@ -70,12 +70,12 @@ void RaceState::serialise()
addFloat(kart->getSpeed()); addFloat(kart->getSpeed());
} // for i } // for i
// 2. Eaten herrings // 2. Collected items
// ----------------- // -----------------
addChar(m_herring_info.size()); addChar(m_item_info.size());
for(unsigned int i=0; i<m_herring_info.size(); i++) 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 // 3. Projectiles
@ -100,7 +100,7 @@ void RaceState::serialise()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void RaceState::clear() void RaceState::clear()
{ {
m_herring_info.clear(); m_item_info.clear();
} // clear } // clear
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -131,16 +131,16 @@ void RaceState::receive(ENetPacket *pkt)
kart->setSpeed(getFloat()); kart->setSpeed(getFloat());
} // for i } // for i
// 2. Eaten herrings // 2. Collected Items
// ----------------- // -----------------
unsigned short num_herrings=getChar(); unsigned short num_items=getChar();
for(unsigned int i=0; i<num_herrings; i++) for(unsigned int i=0; i<num_items; i++)
{ {
HerringInfo hi(this); ItemInfo hi(this);
if(hi.m_herring_id==-1) // Rescue triggered if(hi.m_item_id==-1) // Rescue triggered
RaceManager::getKart(hi.m_kart_id)->forceRescue(); RaceManager::getKart(hi.m_kart_id)->forceRescue();
else else
herring_manager->eatenHerring(hi.m_herring_id, item_manager->collectedItem(hi.m_item_id,
RaceManager::getKart(hi.m_kart_id), RaceManager::getKart(hi.m_kart_id),
hi.m_add_info); hi.m_add_info);
} }

View File

@ -40,8 +40,8 @@ class RaceState : public Message
{ {
private: private:
/** Updates about collected herrings. */ /** Updates about collected items. */
std::vector<HerringInfo> m_herring_info; std::vector<ItemInfo> m_item_info;
/** Updates about existing flyables. */ /** Updates about existing flyables. */
std::vector<FlyableInfo> m_flyable_info; std::vector<FlyableInfo> m_flyable_info;
/** Stores the controls of each kart at the beginning of its update(). */ /** Stores the controls of each kart at the beginning of its update(). */
@ -57,10 +57,10 @@ private:
m_kart_controls.resize(race_manager->getNumKarts()); m_kart_controls.resize(race_manager->getNumKarts());
} // RaceState() } // 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)); m_item_info.push_back(ItemInfo(kartid, item_id, add_info));
} // herringCollected } // itemCollected
// -------------------------------------------------------------------- // --------------------------------------------------------------------
/** Collects information about collision in which at least one kart was /** Collects information about collision in which at least one kart was
* involved. Other collision (e.g. projectiles, moving physics) are * involved. Other collision (e.g. projectiles, moving physics) are

View File

@ -285,31 +285,32 @@ void PlayerKart::handleZipper()
} // handleZipper } // handleZipper
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Called when a kart hits a herring. /** Called when a kart hits an item.
* \param herring Herring that was collected. * \param item Item that was collected.
* \param add_info Additional info to be used then handling the herring. If * \param add_info Additional info to be used then handling the item. If
* this is -1 (default), the herring type is selected * this is -1 (default), the item type is selected
* randomly. Otherwise it contains the collectable or * randomly. Otherwise it contains the collectable or
* attachment for the kart. This is used in network mode to * attachment for the kart. This is used in network mode to
* let the server determine the collectable/attachment for * let the server determine the collectable/attachment for
* the clients. * 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(); // FIXME - how does the old item relate to the total amount of items?
Kart::collectedHerring(herring, add_info); const int old_item_collected = getNumItems();
Kart::collectedItem(item, add_info);
if(old_herring_gobbled < MAX_HERRING_EATEN && if(old_item_collected < MAX_ITEMS_COLLECTED &&
getNumHerring() == MAX_HERRING_EATEN) getNumItems() == MAX_ITEMS_COLLECTED)
{ {
m_full_sound->play(); m_full_sound->play();
} }
else else
{ {
if(herring.getType() == HE_GREEN) if(item.getType() == ITEM_BANANA)
m_ugh_sound->play(); m_ugh_sound->play();
else else
m_grab_sound->play(); m_grab_sound->play();
} }
} // collectedHerring } // collectedItem

View File

@ -57,10 +57,10 @@ public:
void update (float); void update (float);
void action (KartAction action, int value); void action (KartAction action, int value);
void handleZipper (); 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 crashed (Kart *k);
virtual void setPosition (int p); virtual void setPosition (int p);
virtual void raceFinished (float time); virtual void raceFinished (float time);
bool isPlayerKart () const {return true;} bool isPlayerKart () const {return true;}
Camera* getCamera () {return m_camera;} Camera* getCamera () {return m_camera;}
void reset(); void reset();

View File

@ -193,7 +193,7 @@ public:
const GrandPrixData *getGrandPrix() const { return &m_grand_prix; } const GrandPrixData *getGrandPrix() const { return &m_grand_prix; }
unsigned int getFinishedKarts() const { return m_num_finished_karts; } unsigned int getFinishedKarts() const { return m_num_finished_karts; }
unsigned int getFinishedPlayers() const { return m_num_finished_players; } 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& const std::string&
getKartName(int kart) const { return m_kart_status[kart].m_ident;} getKartName(int kart) const { return m_kart_status[kart].m_ident;}
int getKartScore(int krt) const { return m_kart_status[krt].m_score; } int getKartScore(int krt) const { return m_kart_status[krt].m_score; }

View File

@ -314,7 +314,7 @@ void SDLDriver::setVideoMode(bool resetTextures)
// startScreen -> removeTextures(); // startScreen -> removeTextures();
attachment_manager -> removeTextures(); attachment_manager -> removeTextures();
projectile_manager -> removeTextures(); projectile_manager -> removeTextures();
herring_manager -> removeTextures(); item_manager -> removeTextures();
kart_properties_manager -> removeTextures(); kart_properties_manager -> removeTextures();
collectable_manager -> removeTextures(); collectable_manager -> removeTextures();
@ -323,7 +323,7 @@ void SDLDriver::setVideoMode(bool resetTextures)
collectable_manager -> loadCollectables(); collectable_manager -> loadCollectables();
kart_properties_manager -> loadKartData(); kart_properties_manager -> loadKartData();
herring_manager -> loadDefaultHerrings(); item_manager -> loadDefaultItems();
projectile_manager -> loadData(); projectile_manager -> loadData();
attachment_manager -> loadModels(); attachment_manager -> loadModels();

View File

@ -58,7 +58,7 @@ const int Track::UNKNOWN_SECTOR = -1;
Track::Track( std::string filename_, float w, float h, bool stretch ) Track::Track( std::string filename_, float w, float h, bool stretch )
{ {
m_filename = filename_; m_filename = filename_;
m_herring_style = ""; m_item_style = "";
m_track_2d_width = w; m_track_2d_width = w;
m_track_2d_height = h; m_track_2d_height = h;
m_do_stretch = stretch; m_do_stretch = stretch;
@ -839,7 +839,7 @@ void Track::loadTrack(std::string filename_)
std::vector<std::string> filenames; std::vector<std::string> filenames;
LISP->getVector("music", filenames); LISP->getVector("music", filenames);
getMusicInformation(filenames, m_music); getMusicInformation(filenames, m_music);
LISP->get ("herring", m_herring_style); LISP->get ("item", m_item_style);
LISP->get ("screenshot", m_screenshot); LISP->get ("screenshot", m_screenshot);
LISP->get ("topview", m_top_view); LISP->get ("topview", m_top_view);
LISP->get ("sky-color", m_sky_color); LISP->get ("sky-color", m_sky_color);
@ -1186,12 +1186,12 @@ void Track::loadTrackModel()
if ( sscanf ( s, "%cHERRING,%f,%f,%f", &htype, if ( sscanf ( s, "%cHERRING,%f,%f,%f", &htype,
&(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 4 ) &(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, else if ( sscanf ( s, "%cHERRING,%f,%f", &htype,
&(loc.xyz[0]), &(loc.xyz[1]) ) == 3 ) &(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", else if ( sscanf ( s, "START,%f,%f,%f",
&(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 3 ) &(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 3 )
@ -1337,26 +1337,26 @@ void Track::loadTrackModel()
} // loadTrack } // 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; 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; (*xyz)[2] = getHeight ( m_model, *xyz ) + 0.06f;
herringType type=HE_GREEN; ItemType type=ITEM_BANANA;
if ( htype=='Y' || htype=='y' ) { type = HE_GOLD ;} if ( htype=='Y' || htype=='y' ) { type = ITEM_GOLD_COIN ;}
if ( htype=='G' || htype=='g' ) { type = HE_GREEN ;} if ( htype=='G' || htype=='g' ) { type = ITEM_BANANA ;}
if ( htype=='R' || htype=='r' ) { type = HE_RED ;} if ( htype=='R' || htype=='r' ) { type = ITEM_BONUS_BOX ;}
if ( htype=='S' || htype=='s' ) { type = HE_SILVER ;} if ( htype=='S' || htype=='s' ) { type = ITEM_SILVER_COIN ;}
// Time trial does not have any red herrings // Some modes (e.g. time trial) don't have any bonus boxes
if(type==HE_RED && !RaceManager::getWorld()->useRedHerring()) if(type==ITEM_BONUS_BOX && !RaceManager::getWorld()->enableBonusBoxes())
return; return;
Vec3 loc((*xyz)); Vec3 loc((*xyz));
herring_manager->newHerring(type, loc); item_manager->newItem(type, loc);
} // herring_command } // item_command
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void Track::getTerrainInfo(const Vec3 &pos, float *hot, Vec3 *normal, void Track::getTerrainInfo(const Vec3 &pos, float *hot, Vec3 *normal,

View File

@ -46,7 +46,7 @@ private:
std::string m_top_view; std::string m_top_view;
std::vector<MusicInformation*> m_music; std::vector<MusicInformation*> m_music;
std::vector<float> m_start_x, m_start_y, m_start_z, m_start_heading; 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_description;
std::string m_designer; std::string m_designer;
std::string m_filename; std::string m_filename;
@ -178,7 +178,7 @@ public:
const std::string& getTopviewFile () const {return m_top_view; } const std::string& getTopviewFile () const {return m_top_view; }
const std::string& getScreenshotFile () const {return m_screenshot; } const std::string& getScreenshotFile () const {return m_screenshot; }
const std::vector<SGfloat>& getWidth () const {return m_path_width; } 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; } bool hasFinalCamera () const {return m_has_final_camera; }
const Vec3& getCameraPosition () const {return m_camera_final_position;} const Vec3& getCameraPosition () const {return m_camera_final_position;}
const Vec3& getCameraHPR () const {return m_camera_final_hpr; } const Vec3& getCameraHPR () const {return m_camera_final_hpr; }
@ -195,7 +195,7 @@ public:
private: private:
void loadTrack (std::string filename); 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 loadDriveline ();
void readDrivelineFromFile (std::vector<Vec3>& line, void readDrivelineFromFile (std::vector<Vec3>& line,
const std::string& file_ext ); const std::string& file_ext );

View File

@ -101,7 +101,7 @@ void UserConfig::setDefaults()
m_music = UC_ENABLE; m_music = UC_ENABLE;
m_smoke = false; m_smoke = false;
m_display_fps = false; m_display_fps = false;
m_herring_style = "new"; m_item_style = "items";
m_background_music = ""; m_background_music = "";
m_profile = 0; m_profile = 0;
m_print_kart_sizes = false; m_print_kart_sizes = false;
@ -421,7 +421,7 @@ void UserConfig::loadConfig(const std::string& filename)
m_music = doMusic ? UC_ENABLE : UC_DISABLE; m_music = doMusic ? UC_ENABLE : UC_DISABLE;
lisp->get("smoke", m_smoke); lisp->get("smoke", m_smoke);
lisp->get("displayFPS", m_display_fps); 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("background-music", m_background_music);
lisp->get("max-fps", m_max_fps); lisp->get("max-fps", m_max_fps);
lisp->get("sfx-volume", m_sfx_volume); 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->write("smoke\t", m_smoke);
writer->writeComment("Display frame per seconds"); writer->writeComment("Display frame per seconds");
writer->write("displayFPS\t", m_display_fps); writer->write("displayFPS\t", m_display_fps);
writer->writeComment("Name of the .herring file to use."); writer->writeComment("Name of the .items file to use.");
writer->write("herringStyle\t", m_herring_style); writer->write("itemStyle\t", m_item_style);
writer->writeComment("Background music file to use,"); writer->writeComment("Background music file to use,");
writer->write("background-music\t", m_background_music); writer->write("background-music\t", m_background_music);
writer->writeComment("Use of kilometers per hours (km/h) instead of mph"); writer->writeComment("Use of kilometers per hours (km/h) instead of mph");

View File

@ -171,7 +171,7 @@ public:
bool m_skidding; bool m_skidding;
float m_sfx_volume; float m_sfx_volume;
int m_max_fps; int m_max_fps;
std::string m_herring_style; std::string m_item_style;
std::string m_username; std::string m_username;
std::string m_background_music; std::string m_background_music;
std::string m_kart_group; // Kart group used last std::string m_kart_group; // Kart group used last