removed 'herring' from .loc files (and thus blender editing)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2397 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2008-10-30 01:32:04 +00:00
parent 7fd5b0fb61
commit 14bd536556
2 changed files with 62 additions and 10 deletions

View File

@ -1183,16 +1183,73 @@ void Track::loadTrackModel()
char htype = '\0' ;
/* the first 2 are for backwards compatibility. Don't use 'herring' names in any new track */
if ( sscanf ( s, "%cHERRING,%f,%f,%f", &htype,
&(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 4 )
{
item_command(&loc.xyz, htype, false) ;
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 ;}
item_command(&loc.xyz, type, false) ;
}
else if ( sscanf ( s, "%cHERRING,%f,%f", &htype,
&(loc.xyz[0]), &(loc.xyz[1]) ) == 3 )
{
item_command (&loc.xyz, htype, true) ;
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 ;}
item_command (&loc.xyz, type, true) ;
}
/* and now the new names */
else if ( sscanf ( s, "BBOX,%f,%f,%f",
&(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 3 )
{
item_command(&loc.xyz, ITEM_BONUS_BOX, false);
}
else if ( sscanf ( s, "BBOX,%f,%f",
&(loc.xyz[0]), &(loc.xyz[1]) ) == 2 )
{
item_command(&loc.xyz, ITEM_BONUS_BOX, true);
}
else if ( sscanf ( s, "BANA,%f,%f,%f",
&(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 3 )
{
item_command(&loc.xyz, ITEM_BANANA, false);
}
else if ( sscanf ( s, "BANA,%f,%f",
&(loc.xyz[0]), &(loc.xyz[1]) ) == 2 )
{
item_command(&loc.xyz, ITEM_BANANA, true);
}
else if ( sscanf ( s, "COIN,%f,%f,%f",
&(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 3 )
{
item_command(&loc.xyz, ITEM_SILVER_COIN, false);
}
else if ( sscanf ( s, "COIN,%f,%f",
&(loc.xyz[0]), &(loc.xyz[1]) ) == 2 )
{
item_command(&loc.xyz, ITEM_SILVER_COIN, true);
}
else if ( sscanf ( s, "GOLD,%f,%f,%f",
&(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 3 )
{
item_command(&loc.xyz, ITEM_GOLD_COIN, false);
}
else if ( sscanf ( s, "GOLD,%f,%f",
&(loc.xyz[0]), &(loc.xyz[1]) ) == 2 )
{
item_command(&loc.xyz, ITEM_GOLD_COIN, true);
}
else if ( sscanf ( s, "START,%f,%f,%f",
&(loc.xyz[0]), &(loc.xyz[1]), &(loc.xyz[2]) ) == 3 )
{
@ -1337,7 +1394,7 @@ void Track::loadTrackModel()
} // loadTrack
//-----------------------------------------------------------------------------
void Track::item_command (sgVec3 *xyz, char htype, int bNeedHeight )
void Track::item_command (sgVec3 *xyz, int type, int bNeedHeight )
{
// if only 2d coordinates are given, let the item fall from very high
@ -1345,17 +1402,12 @@ void Track::item_command (sgVec3 *xyz, char htype, int bNeedHeight )
// Even if 3d data are given, make sure that the item is on the ground
(*xyz)[2] = getHeight ( m_model, *xyz ) + 0.06f;
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 ;}
// Some modes (e.g. time trial) don't have any bonus boxes
if(type==ITEM_BONUS_BOX && !RaceManager::getWorld()->enableBonusBoxes())
return;
Vec3 loc((*xyz));
item_manager->newItem(type, loc);
item_manager->newItem((ItemType)type, loc);
} // item_command
// ----------------------------------------------------------------------------

View File

@ -195,7 +195,7 @@ public:
private:
void loadTrack (std::string filename);
void item_command (sgVec3 *xyz, char htype, int bNeedHeight);
void item_command (sgVec3 *xyz, int item_type, int bNeedHeight);
void loadDriveline ();
void readDrivelineFromFile (std::vector<Vec3>& line,
const std::string& file_ext );