diff --git a/engine/src/cmd/drawable.cpp b/engine/src/cmd/drawable.cpp index 9ff8f8aca..5a6da6772 100644 --- a/engine/src/cmd/drawable.cpp +++ b/engine/src/cmd/drawable.cpp @@ -46,7 +46,7 @@ #include "vega_cast_utils.h" // Required definition of static variable -std::string VSDrawable::root; +std::string Drawable::root; // Dupe to same function in unit.cpp // TODO: remove duplication @@ -58,7 +58,7 @@ inline static float perspectiveFactor(float d) { } } -VSDrawable::VSDrawable() : +Drawable::Drawable() : halos(new HaloSystem()), animatedMesh(true), activeAnimation(0), @@ -71,7 +71,7 @@ VSDrawable::VSDrawable() : curtime(0.0) { } -VSDrawable::~VSDrawable() { +Drawable::~Drawable() { for (Mesh *mesh : meshdata) { if (mesh != nullptr) { delete mesh; @@ -82,8 +82,8 @@ VSDrawable::~VSDrawable() { clear(); } -bool VSDrawable::DrawableInit(const char *filename, int faction, - Flightgroup *flightgrp, const char *animationExt) { +bool Drawable::DrawableInit(const char *filename, int faction, + Flightgroup *flightgrp, const char *animationExt) { string fnam(filename); string::size_type pos = fnam.find('.'); string anifilename = fnam.substr(0, pos); @@ -144,7 +144,7 @@ bool VSDrawable::DrawableInit(const char *filename, int faction, addAnimation(meshes, animationName.c_str()); int numFrames = meshes->size(); - ++VSDrawable::unitCount; + ++Drawable::unitCount; sprintf(count, "%u", unitCount); uniqueUnitName = drawableGetName() + string(count); Units[uniqueUnitName] = vega_dynamic_cast_ptr(this); @@ -167,7 +167,7 @@ extern double calc_blend_factor(double frac, unsigned int when_it_will_be_simulated, unsigned int cur_simulation_frame); -void VSDrawable::Draw(const Transformation &parent, const Matrix &parentMatrix) { +void Drawable::Draw(const Transformation &parent, const Matrix &parentMatrix) { Unit *unit = vega_dynamic_cast_ptr(this); //Quick shortcut for camera setup phase @@ -348,7 +348,7 @@ void VSDrawable::Draw(const Transformation &parent, const Matrix &parentMatrix) Sparkle(On_Screen, ctm); } -void VSDrawable::AnimationStep() { +void Drawable::AnimationStep() { #ifdef DEBUG_MESH_ANI VS_LOG(debug, (boost::format("Starting animation step of Unit: %1%") % uniqueUnitName)); #endif @@ -378,7 +378,7 @@ void VSDrawable::AnimationStep() { #endif } -void VSDrawable::DrawNow(const Matrix &mato, float lod) { +void Drawable::DrawNow(const Matrix &mato, float lod) { Unit *unit = vega_dynamic_cast_ptr(this); static const void *rootunit = NULL; @@ -503,7 +503,7 @@ void VSDrawable::DrawNow(const Matrix &mato, float lod) { } } -void VSDrawable::UpdateFrames() { +void Drawable::UpdateFrames() { std::map::iterator pos; for (pos = Units.begin(); pos != Units.end(); ++pos) { pos->second->curtime += GetElapsedTime(); @@ -514,14 +514,14 @@ void VSDrawable::UpdateFrames() { } } -void VSDrawable::addAnimation(std::vector *meshes, const char *name) { +void Drawable::addAnimation(std::vector *meshes, const char *name) { if ((meshes->size() > 0) && animatedMesh) { vecAnimations.push_back(meshes); vecAnimationNames.push_back(string(name)); } } -void VSDrawable::StartAnimation(unsigned int how_many_times, int numAnimation) { +void Drawable::StartAnimation(unsigned int how_many_times, int numAnimation) { if (animationRuns()) { StopAnimation(); } @@ -529,15 +529,15 @@ void VSDrawable::StartAnimation(unsigned int how_many_times, int numAnimation) { done = false; } -void VSDrawable::StopAnimation() { +void Drawable::StopAnimation() { done = true; } -string VSDrawable::getAnimationName(unsigned int animationNumber) const { +string Drawable::getAnimationName(unsigned int animationNumber) const { return vecAnimationNames.at(animationNumber); } -unsigned int VSDrawable::getAnimationNumber(const char *name) const { +unsigned int Drawable::getAnimationNumber(const char *name) const { string strname(name); for (unsigned int i = 0; i < vecAnimationNames.size(); i++) { if (strname == vecAnimationNames[i]) { @@ -548,48 +548,48 @@ unsigned int VSDrawable::getAnimationNumber(const char *name) const { return 0; //NOT FOUND! } -void VSDrawable::ChangeAnimation(const char *name) { +void Drawable::ChangeAnimation(const char *name) { unsigned int AnimNumber = getAnimationNumber(name); if ((AnimNumber < numAnimations()) && isAnimatedMesh()) { activeAnimation = AnimNumber; } } -void VSDrawable::ChangeAnimation(unsigned int AnimNumber) { +void Drawable::ChangeAnimation(unsigned int AnimNumber) { if ((AnimNumber < numAnimations()) && isAnimatedMesh()) { activeAnimation = AnimNumber; } } -bool VSDrawable::isAnimatedMesh() const { +bool Drawable::isAnimatedMesh() const { return animatedMesh; } -double VSDrawable::framesPerSecond() const { +double Drawable::framesPerSecond() const { return 1 / timeperframe; } -double VSDrawable::timePerFrame() const { +double Drawable::timePerFrame() const { return timeperframe; } -unsigned int VSDrawable::numAnimations() { +unsigned int Drawable::numAnimations() { return vecAnimations.size(); } -void VSDrawable::ToggleAnimatedMesh(bool on) { +void Drawable::ToggleAnimatedMesh(bool on) { animatedMesh = on; } -bool VSDrawable::isContinuousLoop() const { +bool Drawable::isContinuousLoop() const { return infiniteLoop; } -void VSDrawable::SetAniSpeed(float speed) { +void Drawable::SetAniSpeed(float speed) { timeperframe = speed; } -void VSDrawable::clear() { +void Drawable::clear() { StopAnimation(); for (unsigned int i = 0; i < vecAnimations.size(); i++) { @@ -605,7 +605,7 @@ void VSDrawable::clear() { Units.erase(uniqueUnitName); } -bool VSDrawable::animationRuns() const { +bool Drawable::animationRuns() const { return !done; } @@ -628,9 +628,9 @@ Matrix *GetCumulativeTransformationMatrix(Unit *unit, const Matrix &parentMatrix } /** - * @brief VSDrawable::Sparkle caused damaged units to emit sparks + * @brief Drawable::Sparkle caused damaged units to emit sparks */ -void VSDrawable::Sparkle(bool on_screen, Matrix *ctm) { +void Drawable::Sparkle(bool on_screen, Matrix *ctm) { Unit *unit = vega_dynamic_cast_ptr(this); const Vector velocity = unit->GetVelocity(); @@ -696,7 +696,7 @@ void VSDrawable::Sparkle(bool on_screen, Matrix *ctm) { } } -void VSDrawable::DrawHalo(bool on_screen, float apparent_size, Matrix wmat, Cloak cloak) { +void Drawable::DrawHalo(bool on_screen, float apparent_size, Matrix wmat, Cloak cloak) { Unit *unit = vega_dynamic_cast_ptr(this); // Units not shown don't emit a halo @@ -740,7 +740,7 @@ void VSDrawable::DrawHalo(bool on_screen, float apparent_size, Matrix wmat, Cloa } -void VSDrawable::DrawSubunits(bool on_screen, Matrix wmat, Cloak cloak, float average_scale, unsigned char char_damage) { +void Drawable::DrawSubunits(bool on_screen, Matrix wmat, Cloak cloak, float average_scale, unsigned char char_damage) { Unit *unit = vega_dynamic_cast_ptr(this); Transformation *ct = &unit->cumulative_transformation; @@ -825,7 +825,7 @@ void VSDrawable::DrawSubunits(bool on_screen, Matrix wmat, Cloak cloak, float av } } -void VSDrawable::Split(int level) { +void Drawable::Split(int level) { Unit *unit = vega_dynamic_cast_ptr(this); if (game_options()->split_dead_subunits) { @@ -952,7 +952,7 @@ void VSDrawable::Split(int level) { unit->Mass *= game_options()->debris_mass; } -void VSDrawable::LightShields(const Vector &pnt, const Vector &normal, float amt, const GFXColor &color) { +void Drawable::LightShields(const Vector &pnt, const Vector &normal, float amt, const GFXColor &color) { Unit *unit = vega_dynamic_cast_ptr(this); // Not sure about shield percentage - more variance for more damage? @@ -972,7 +972,7 @@ void VSDrawable::LightShields(const Vector &pnt, const Vector &normal, float amt std::min(1.0f, std::max(0.0f, amt)), color); } -Matrix VSDrawable::WarpMatrix(const Matrix &ctm) const { +Matrix Drawable::WarpMatrix(const Matrix &ctm) const { const Unit *unit = vega_dynamic_const_cast_ptr(this); if (unit->GetWarpVelocity().MagnitudeSquared() @@ -1010,7 +1010,7 @@ Matrix VSDrawable::WarpMatrix(const Matrix &ctm) const { } } -void VSDrawable::UpdateHudMatrix(int whichcam) { +void Drawable::UpdateHudMatrix(int whichcam) { Unit *unit = vega_dynamic_cast_ptr(this); Matrix m; @@ -1028,7 +1028,7 @@ void VSDrawable::UpdateHudMatrix(int whichcam) { unit->GetAcceleration()); } -VSSprite *VSDrawable::getHudImage() const { +VSSprite *Drawable::getHudImage() const { const Unit *unit = vega_dynamic_const_cast_ptr(this); return unit->pImage->pHudImage; } diff --git a/engine/src/cmd/drawable.h b/engine/src/cmd/drawable.h index 8a7b63576..08a9f0298 100644 --- a/engine/src/cmd/drawable.h +++ b/engine/src/cmd/drawable.h @@ -43,7 +43,7 @@ using std::vector; using std::string; using std::map; -class VSDrawable { +class Drawable { public: //number of meshes (each with separate texture) this unit has std::vector meshdata; @@ -74,8 +74,8 @@ class VSDrawable { static std::map Units; - VSDrawable(); - ~VSDrawable(); + Drawable(); + ~Drawable(); bool DrawableInit(const char *filename, int faction, @@ -90,9 +90,9 @@ class VSDrawable { protected: // forbidden - VSDrawable(const VSDrawable &) = delete; + Drawable(const Drawable &) = delete; // forbidden - VSDrawable &operator=(const VSDrawable &) = delete; + Drawable &operator=(const Drawable &) = delete; public: string getAnimationName(unsigned int animationNumber) const; diff --git a/engine/src/cmd/unit_generic.cpp b/engine/src/cmd/unit_generic.cpp index f50b8fa4a..8a72dfaa1 100644 --- a/engine/src/cmd/unit_generic.cpp +++ b/engine/src/cmd/unit_generic.cpp @@ -278,7 +278,7 @@ char *GetUnitDir(const char *filename) { ********************************************************************************** */ // Called by Planet -Unit::Unit(int dummy) : VSDrawable(), Damageable(), Movable() { +Unit::Unit(int dummy) : Drawable(), Damageable(), Movable() { pImage = (new UnitImages); pImage->cockpit_damage = NULL; pilot = new Pilot(FactionUtil::GetNeutralFaction()); @@ -287,7 +287,7 @@ Unit::Unit(int dummy) : VSDrawable(), Damageable(), Movable() { } -Unit::Unit() : VSDrawable(), Damageable(), Movable() //: cumulative_transformation_matrix( identity_matrix ) +Unit::Unit() : Drawable(), Damageable(), Movable() //: cumulative_transformation_matrix( identity_matrix ) { pImage = (new UnitImages); pImage->cockpit_damage = NULL; @@ -298,7 +298,7 @@ Unit::Unit() : VSDrawable(), Damageable(), Movable() //: cumulative_transformati // Called by Missile Unit::Unit(std::vector &meshes, bool SubU, int fact) - : VSDrawable(), Damageable(), Movable() //: cumulative_transformation_matrix( identity_matrix ) + : Drawable(), Damageable(), Movable() //: cumulative_transformation_matrix( identity_matrix ) { pImage = (new UnitImages); pilot = new Pilot(fact); @@ -324,7 +324,7 @@ Unit::Unit(const char *filename, std::string unitModifications, Flightgroup *flightgrp, int fg_subnumber) - : VSDrawable(), Damageable(), Movable() //: cumulative_transformation_matrix( identity_matrix ) + : Drawable(), Damageable(), Movable() //: cumulative_transformation_matrix( identity_matrix ) { pImage = (new UnitImages); pilot = new Pilot(faction); @@ -4250,11 +4250,11 @@ void Unit::applyTechniqueOverrides(const std::map &ove } } -std::map VSDrawable::Units; +std::map Drawable::Units; -unsigned int VSDrawable::unitCount = 0; +unsigned int Drawable::unitCount = 0; void Unit::ActTurn() { // Dock diff --git a/engine/src/cmd/unit_generic.h b/engine/src/cmd/unit_generic.h index 8680cf685..2783484fa 100644 --- a/engine/src/cmd/unit_generic.h +++ b/engine/src/cmd/unit_generic.h @@ -137,7 +137,7 @@ struct PlanetaryOrbitData; */ // TODO: move Armed to subclasses -class Unit : public Armed, public Audible, public VSDrawable, public Damageable, public Energetic, +class Unit : public Armed, public Audible, public Drawable, public Damageable, public Energetic, public Intelligent, public Movable, public JumpCapable, public Carrier, public UpgradeableUnit { protected: diff --git a/engine/src/gldrv/gl_globals.h b/engine/src/gldrv/gl_globals.h index 4c0aafeb5..0e78b8184 100644 --- a/engine/src/gldrv/gl_globals.h +++ b/engine/src/gldrv/gl_globals.h @@ -104,7 +104,7 @@ struct GFXStats #endif #if defined(__APPLE__) && defined(__MACH__) #include -#include +//#include //#include //#include //#include diff --git a/engine/src/star_system.cpp b/engine/src/star_system.cpp index c368e744a..c6049d2f7 100644 --- a/engine/src/star_system.cpp +++ b/engine/src/star_system.cpp @@ -453,7 +453,7 @@ void StarSystem::Draw(bool DrawCockpit) { _Universe->AccessCockpit()->Draw(); } - VSDrawable::UpdateFrames(); + Drawable::UpdateFrames(); // And now we're done with the occluder set Occlusion::end(); diff --git a/engine/src/vegastrike.h b/engine/src/vegastrike.h index 75ed8eccf..9fc7e4b47 100644 --- a/engine/src/vegastrike.h +++ b/engine/src/vegastrike.h @@ -71,7 +71,7 @@ extern float AUDIO_ATOM; #ifndef NO_GFX #if defined(__APPLE__) && defined(__MACH__) #include - #include +// #include #include #else //defined (__APPLE__) || defined (MACOSX) #define __glext_h_