diff --git a/data/fonts/DomesticManners.xml b/data/fonts/DomesticManners.xml new file mode 100755 index 000000000..6ee6457b9 Binary files /dev/null and b/data/fonts/DomesticManners.xml differ diff --git a/data/fonts/DomesticManners0.png b/data/fonts/DomesticManners0.png new file mode 100755 index 000000000..3f74583a9 Binary files /dev/null and b/data/fonts/DomesticManners0.png differ diff --git a/data/fonts/DomesticManners1.png b/data/fonts/DomesticManners1.png new file mode 100755 index 000000000..4603ecca0 Binary files /dev/null and b/data/fonts/DomesticManners1.png differ diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index aac795427..d4b5262a1 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -16,10 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifdef HAVE_IRRLICHT #include "graphics/irr_driver.hpp" -using namespace core; #include "user_config.hpp" #include "io/file_manager.hpp" @@ -41,7 +39,7 @@ IrrDriver::IrrDriver() for(int bits=32; bits>15; bits -=16) { m_device = createDevice(type, - dimension2d(user_config->m_width, + core::dimension2d(user_config->m_width, user_config->m_height ), bits, //bits per pixel user_config->m_fullscreen, @@ -63,7 +61,7 @@ IrrDriver::IrrDriver() m_device->setWindowCaption(L"SuperTuxKart"); m_scene_manager = m_device->getSceneManager(); m_gui_env = m_device->getGUIEnvironment(); - const std::string &font = file_manager->getFontFile("fonthaettenschweiler.bmp"); + const std::string &font = file_manager->getFontFile("DomesticManners.xml"); m_race_font = m_gui_env->getFont(font.c_str()); } // IrrDriver @@ -201,5 +199,3 @@ bool IrrDriver::OnEvent(const irr::SEvent &event) } // OnEvent // ---------------------------------------------------------------------------- - -#endif // HAVE_IRRLICHT diff --git a/src/graphics/irr_driver.hpp b/src/graphics/irr_driver.hpp index 78484e2bc..b6d1c1fc6 100644 --- a/src/graphics/irr_driver.hpp +++ b/src/graphics/irr_driver.hpp @@ -17,8 +17,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifdef HAVE_IRRLICHT - #ifndef HEADER_IRR_DRIVER_HPP #define HEADER_IRR_DRIVER_HPP @@ -65,5 +63,3 @@ extern IrrDriver *irr_driver; #endif // HEADER_IRR_DRIVER_HPP -#endif // HAVE_IRRLICHT - diff --git a/src/gui/race_gui.cpp b/src/gui/race_gui.cpp index 5b4280273..78d790800 100644 --- a/src/gui/race_gui.cpp +++ b/src/gui/race_gui.cpp @@ -52,8 +52,8 @@ RaceGUI::RaceGUI() #ifdef HAVE_IRRLICHT gui::IGUIEnvironment *gui_env = irr_driver->getGUI(); - core::rect pos(user_config->m_width-60, 10, - user_config->m_width, 50); + core::rect pos(user_config->m_width-160, 10, + user_config->m_width, 150); m_time = gui_env->addStaticText(L"", pos); m_time->setOverrideFont(irr_driver->getRaceFont()); diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index ca2efb5c3..aa4681d3d 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -69,10 +69,8 @@ Track::Track( std::string filename_, float w, float h, bool stretch ) m_version = 0; m_track_mesh = new TriangleMesh(); m_non_collision_mesh = new TriangleMesh(); -#ifdef HAVE_IRRLICHT m_all_nodes.clear(); m_all_meshes.clear(); -#endif m_has_final_camera = false; m_is_arena = false; loadTrack(m_filename); @@ -90,7 +88,6 @@ Track::~Track() */ void Track::cleanup() { -#ifdef HAVE_IRRLICHT for(unsigned int i=0; iremoveNode(m_all_nodes[i]); @@ -99,7 +96,7 @@ void Track::cleanup() { irr_driver->removeMesh(m_all_meshes[i]); } -#endif + delete m_non_collision_mesh; delete m_track_mesh; @@ -860,7 +857,6 @@ void Track::loadTrack(const std::string &filename) m_fog_start = 0.0f; m_fog_end = 1000.0f; m_gravity = 9.80665f; -#ifdef HAVE_IRRLICHT m_sun_position = core::vector3df(0.4f, 0.4f, 0.4f); m_sky_color = video::SColorf(0.3f, 0.7f, 0.9f, 1.0f); m_fog_color = video::SColorf(0.3f, 0.7f, 0.9f, 1.0f); @@ -911,61 +907,6 @@ void Track::loadTrack(const std::string &filename) m_has_final_camera &= node->get("camera-final-hpr", &m_camera_final_hpr) !=1; m_camera_final_hpr.degreeToRad(); -#else - sgSetVec3 ( m_sun_position, 0.4f, 0.4f, 0.4f ); - sgSetVec4 ( m_sky_color, 0.3f, 0.7f, 0.9f, 1.0f ); - sgSetVec4 ( m_fog_color, 0.3f, 0.7f, 0.9f, 1.0f ); - sgSetVec4 ( m_ambient_col, 0.5f, 0.5f, 0.5f, 1.0f ); - sgSetVec4 ( m_specular_col, 1.0f, 1.0f, 1.0f, 1.0f ); - sgSetVec4 ( m_diffuse_col, 1.0f, 1.0f, 1.0f, 1.0f ); - lisp::Parser parser; - const lisp::Lisp* const ROOT = parser.parse(m_filename); - - const lisp::Lisp* const LISP = ROOT->getLisp("tuxkart-track"); - if(!LISP) - { - delete ROOT; - std::ostringstream msg; - msg <<"Couldn't load map '"<get ("name", m_name); - LISP->get ("description", m_description); - LISP->get ("designer", m_designer); - LISP->get ("version", m_version); - std::vector filenames; - LISP->getVector("music", filenames); - getMusicInformation(filenames, m_music); - LISP->get ("item", m_item_style); - LISP->get ("screenshot", m_screenshot); - LISP->get ("topview", m_top_view); - LISP->get ("sky-color", m_sky_color); - LISP->getVector("start-x", m_start_x); - LISP->getVector("start-y", m_start_y); - LISP->getVector("start-z", m_start_z); - LISP->getVector("start-heading", m_start_heading); - LISP->get ("use-fog", m_use_fog); - LISP->get ("fog-color", m_fog_color); - LISP->get ("fog-density", m_fog_density); - LISP->get ("fog-start", m_fog_start); - LISP->get ("fog-end", m_fog_end); - LISP->get ("sun-position", m_sun_position); - LISP->get ("sun-ambient", m_ambient_col); - LISP->get ("sun-specular", m_specular_col); - LISP->get ("sun-diffuse", m_diffuse_col); - LISP->get ("gravity", m_gravity); - LISP->get ("arena", m_is_arena); - LISP->getVector("groups", m_groups); - if(m_groups.size()==0) - m_groups.push_back("standard"); - // if both camera position and rotation are defined, - // set the flag that the track has final camera position - m_has_final_camera = LISP->get("camera-final-position", m_camera_final_position); - m_has_final_camera &= LISP->get("camera-final-hpr", m_camera_final_hpr); - m_camera_final_hpr.degreeToRad(); - delete ROOT; -#endif // Set the correct paths m_screenshot = file_manager->getTrackFile(m_screenshot, getIdent()); @@ -1154,12 +1095,7 @@ Track::readDrivelineFromFile(std::vector& line, const std::string& file_ex //* Convert the ssg track tree into its physics equivalents. void Track::createPhysicsModel() { -#ifndef HAVE_IRRLICHT - if(!m_model) return; -#endif - -#ifdef HAVE_IRRLICHT // Remove the temporary track rigid body, and then convert all objects // (i.e. the track and all additional objects) into a new rigid body // and convert this again. So this way we have an optimised track @@ -1172,12 +1108,6 @@ void Track::createPhysicsModel() { convertTrackToBullet(m_all_meshes[i]); } -#else - // Collect all triangles in the track_mesh - sgMat4 mat; - sgMakeIdentMat4(mat); - convertTrackToBullet(m_model, mat); -#endif m_track_mesh->createBody(); m_non_collision_mesh->createBody(btCollisionObject::CF_NO_CONTACT_RESPONSE); @@ -1185,7 +1115,6 @@ void Track::createPhysicsModel() // ----------------------------------------------------------------------------- //* Convert the ssg track tree into its physics equivalents. -#ifdef HAVE_IRRLICHT void Track::convertTrackToBullet(const scene::IMesh *mesh) { for(unsigned int i=0; igetMeshBufferCount(); i++) { @@ -1220,80 +1149,11 @@ void Track::convertTrackToBullet(const scene::IMesh *mesh) } // for i(track); - if(mp) - { - // If the track contains obect of type MovingPhysics, - // these objects will be real rigid body and are already - // part of the world. So these objects must not be converted - // to triangle meshes. - } - else if(track->isAKindOf(ssgTypeLeaf())) - { - ssgLeaf *leaf = (ssgLeaf*)(track); - Material *material = material_manager->getMaterial(leaf); - // Don't convert triangles with material that is ignored (e.g. fuzzy_sand) - if(!material || material->isIgnore()) return; - - for(int i=0; igetNumTriangles(); i++) - { - short v1,v2,v3; - sgVec3 vv1, vv2, vv3; - - leaf->getTriangle(i, &v1, &v2, &v3); - sgXformPnt3 ( vv1, leaf->getVertex(v1), m ); - sgXformPnt3 ( vv2, leaf->getVertex(v2), m ); - sgXformPnt3 ( vv3, leaf->getVertex(v3), m ); - btVector3 vb1(vv1[0],vv1[1],vv1[2]); - btVector3 vb2(vv2[0],vv2[1],vv2[2]); - btVector3 vb3(vv3[0],vv3[1],vv3[2]); - if(material->isZipper()) - { - m_non_collision_mesh->addTriangle(vb1, vb2, vb3, material); - } - else - { - m_track_mesh->addTriangle(vb1, vb2, vb3, material); - } - } - - } // if(track isAKindOf leaf) - else if(track->isAKindOf(ssgTypeTransform())) - { - ssgBaseTransform *t = (ssgBaseTransform*)(track); - sgMat4 tmpT, tmpM; - t->getTransform(tmpT); - sgCopyMat4(tmpM, m); - sgPreMultMat4(tmpM,tmpT); - for(ssgEntity *e = t->getKid(0); e!=NULL; e=t->getNextKid()) - { - convertTrackToBullet(e, tmpM); - } // for i - } - else if (track->isAKindOf(ssgTypeBranch())) - { - ssgBranch *b =(ssgBranch*)track; - for(ssgEntity* e=b->getKid(0); e!=NULL; e=b->getNextKid()) { - convertTrackToBullet(e, m); - } // for icreateBody(); return true; } // loadMainTrack -#endif + // ---------------------------------------------------------------------------- void Track::loadTrackModel() { @@ -1348,7 +1208,7 @@ void Track::loadTrackModel() // Start building the scene graph #ifdef HAVE_IRRLICHT - std::string path = file_manager->getTrackFile(getIdent()+".irrloc"); + std::string path = file_manager->getTrackFile(getIdent()+".scene"); XMLReader *xml = file_manager->getXMLReader(path); // Make sure that we have a track (which is used for raycasts to @@ -1622,22 +1482,15 @@ void Track::loadTrackModel() file_manager->popTextureSearchPath(); file_manager->popModelSearchPath (); -#ifdef HAVE_IRRLICHT const core::vector3df &sun_pos = getSunPos(); m_light = irr_driver->getSceneManager()->addLightSceneNode(0, sun_pos); video::SLight light; m_light->setLightData(light); // Note: the physics world for irrlicht is created in loadMainTrack -#else - Vec3 min, max; - SSGHelp::MinMax(m_model, &min, &max); - RaceManager::getWorld()->getPhysics()->init(min, max); -#endif createPhysicsModel(); } // loadTrack //----------------------------------------------------------------------------- -#ifdef HAVE_IRRLICHT void Track::itemCommand(const Vec3 &xyz, Item::ItemType type, int bNeedHeight) { @@ -1660,31 +1513,8 @@ void Track::itemCommand(const Vec3 &xyz, Item::ItemType type, Vec3 normal(0, 0, 0.0f); item_manager->newItem(type, loc, normal); } // itemCommand + // ---------------------------------------------------------------------------- -#else -void Track::itemCommand (sgVec3 *xyz, int type, int bNeedHeight ) -{ - - // 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 item is on the ground - (*xyz)[2] = getHeight( m_model, *xyz ) + 0.06f; - - // Some modes (e.g. time trial) don't have any bonus boxes - if(type==Item::ITEM_BONUS_BOX && !RaceManager::getWorld()->enableBonusBoxes()) - return; - Vec3 loc((*xyz)); - - // Don't tilt the items, since otherwise the rotation will look odd, - // i.e. the items will not rotate around the normal, but 'wobble' - // around. - Vec3 normal(0, 0, 0.0f); - item_manager->newItem((Item::ItemType)type, loc, normal); -} // itemCommand -// ---------------------------------------------------------------------------- -#endif - void Track::getTerrainInfo(const Vec3 &pos, float *hot, Vec3 *normal, const Material **material) const { diff --git a/src/tracks/track.hpp b/src/tracks/track.hpp index 4d139a95c..9ea70c5b0 100644 --- a/src/tracks/track.hpp +++ b/src/tracks/track.hpp @@ -29,10 +29,8 @@ #endif #include #include -#ifdef HAVE_IRRLICHT #include "irrlicht.h" using namespace irr; -#endif #include #include #include "LinearMath/btTransform.h" @@ -58,13 +56,9 @@ private: std::string m_designer; std::string m_filename; std::vector m_groups; -#ifdef HAVE_IRRLICHT std::vector m_all_nodes; std::vector m_all_meshes; scene::ILightSceneNode *m_light; -#else - ssgBranch *m_model; -#endif TriangleMesh* m_track_mesh; TriangleMesh* m_non_collision_mesh; bool m_has_final_camera; @@ -72,9 +66,7 @@ private: Vec3 m_camera_final_hpr; bool m_is_arena; int m_version; -#ifdef HAVE_IRRLICHT bool loadMainTrack(const XMLNode &node); -#endif public: enum RoadSide{ RS_DONT_KNOW = -1, RS_LEFT = 0, RS_RIGHT = 1 }; @@ -103,21 +95,12 @@ public: float m_fog_density; float m_fog_start; float m_fog_end; -#ifdef HAVE_IRRLICHT core::vector3df m_sun_position; video::SColorf m_ambient_color; video::SColorf m_specular_color; video::SColorf m_diffuse_color; video::SColorf m_sky_color; video::SColorf m_fog_color; -#else - sgVec4 m_sky_color; - sgVec4 m_fog_color; - sgVec3 m_sun_position; /** Position of the sun */ - sgVec4 m_ambient_col; - sgVec4 m_specular_col; - sgVec4 m_diffuse_col; -#endif //FIXME: Maybe the next 4 vectors should be inside an struct and be used //from a vector of structs? @@ -177,10 +160,6 @@ public: bool isShortcut (const int OLDSEC, const int NEWSEC) const; void addMusic (MusicInformation* mi) {m_music.push_back(mi); } -#ifdef HAVE_IRRLICHT -#else - ssgBranch* getModel () const {return m_model; } -#endif float getGravity () const {return m_gravity; } /** Returns the version of the .track file. */ int getVersion () const {return m_version; } @@ -191,21 +170,12 @@ public: getGroups () const {return m_groups; } void startMusic () const; const std::string& getFilename () const {return m_filename; } -#ifdef HAVE_IRRLICHT const core::vector3df& getSunPos () const {return m_sun_position; } const video::SColorf& getAmbientCol () const {return m_ambient_color; } const video::SColorf& getDiffuseCol () const {return m_diffuse_color; } const video::SColorf& getSpecularCol () const {return m_specular_color; } const video::SColorf& getFogColor () const {return m_fog_color; } const video::SColorf& getSkyColor () const {return m_sky_color; } -#else - const sgVec3& getSunPos () const {return m_sun_position; } - const sgVec4& getAmbientCol () const {return m_ambient_col; } - const sgVec4& getDiffuseCol () const {return m_diffuse_col; } - const sgVec4& getSpecularCol () const {return m_specular_col; } - const sgVec4& getFogColor () const {return m_fog_color; } - const sgVec4& getSkyColor () const {return m_sky_color; } -#endif const bool& useFog () const {return m_use_fog; } const float& getFogDensity () const {return m_fog_density; } const float& getFogStart () const {return m_fog_start; } @@ -233,20 +203,12 @@ public: private: void loadTrack(const std::string &filename); -#ifdef HAVE_IRRLICHT void itemCommand(const Vec3 &xyz, Item::ItemType item_type, int bNeedHeight); -#else - void itemCommand(sgVec3 *xyz, int item_type, int bNeedHeight); -#endif void loadDriveline(); void readDrivelineFromFile(std::vector& line, const std::string& file_ext); -#ifdef HAVE_IRRLICHT void convertTrackToBullet(const scene::IMesh *mesh); -#else - void convertTrackToBullet(ssgEntity *track, sgMat4 m); -#endif float pointSideToLine(const Vec3& L1, const Vec3& L2, const Vec3& P ) const; int pointInQuad(const Vec3& A, const Vec3& B, diff --git a/src/tracks/track_manager.cpp b/src/tracks/track_manager.cpp index 02853182b..699d4e9ce 100644 --- a/src/tracks/track_manager.cpp +++ b/src/tracks/track_manager.cpp @@ -131,11 +131,8 @@ void TrackManager::loadTrackList () try { // getTrackFile appends dir, so it's opening: *dir/*dir.track -#ifdef HAVE_IRRLICHT + // FIXME: rename from .irrtrack to .track config_file = file_manager->getTrackFile((*dir)+".irrtrack"); -#else - config_file = file_manager->getTrackFile((*dir)+".track"); -#endif } catch (std::exception& e) {