From b7e3e55cf18c5cce81011b428dfd1a62481669a3 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Wed, 15 Feb 2017 00:56:00 +0100 Subject: [PATCH] Remove some unnecessary includes of glpng --- Aquaria/DSQ.cpp | 1 - Aquaria/Game.h | 248 ++----------------------------------- Aquaria/SceneEditor.cpp | 15 +-- Aquaria/SceneEditor.h | 246 ++++++++++++++++++++++++++++++++++++ ExternalLibs/glpng/glpng.c | 3 +- 5 files changed, 260 insertions(+), 253 deletions(-) create mode 100644 Aquaria/SceneEditor.h diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index 0e379ff..9e1a58b 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -19,7 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "../BBGE/DebugFont.h" -#include #include "../BBGE/AfterEffect.h" #include "DSQ.h" diff --git a/Aquaria/Game.h b/Aquaria/Game.h index 07d28ac..86a355a 100644 --- a/Aquaria/Game.h +++ b/Aquaria/Game.h @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define GAME_H #include "../BBGE/DebugFont.h" -#include #include "DSQ.h" #include "AquariaMenuItem.h" @@ -30,6 +29,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "TileVector.h" #include "AquariaProgressBar.h" +#ifdef AQUARIA_DEMO +#undef AQUARIA_BUILD_SCENEEDITOR +#endif + +#ifdef AQUARIA_BUILD_SCENEEDITOR +#include "SceneEditor.h" +#endif + #include using namespace tinyxml2; @@ -56,9 +63,6 @@ const char CHAR_RIGHT = 'r'; const float MIN_SIZE = 0.1f; -#ifdef AQUARIA_DEMO - #undef AQUARIA_BUILD_SCENEEDITOR -#endif class GridRender; @@ -71,32 +75,6 @@ class Beam; #include "Path.h" -#ifdef AQUARIA_BUILD_SCENEEDITOR -struct EntityGroupEntity -{ - std::string name; - std::string gfx; -}; - -typedef std::vector EntityGroupEntities; - -struct EntityGroup -{ - std::string name; - EntityGroupEntities entities; -}; - -typedef std::vector EntityGroups; - -enum EditTypes -{ - ET_ELEMENTS =0, - ET_ENTITIES =1, - ET_PATHS =2, - ET_SELECTENTITY =4, - ET_MAX -}; -#endif // impl is in Minimap.cpp struct MinimapIcon @@ -142,18 +120,6 @@ enum FlagCheckType OR =1 }; -#ifdef AQUARIA_BUILD_SCENEEDITOR -enum EditorStates -{ - ES_SELECTING =0, - ES_SCALING =1, - ES_ROTATING =2, - ES_MOVING =3, - ES_MAX -}; - -#endif - class EntityClass { public: @@ -166,204 +132,6 @@ public: int idx; }; -#ifdef AQUARIA_BUILD_SCENEEDITOR - -class SceneEditorMenuReceiver : public DebugButtonReceiver -{ -public: - void buttonPress(DebugButton *db); -}; - -struct SelectedEntity -{ - SelectedEntity(); - void clear(); - void setIndex(int idx); - void setName(const std::string &name, const std::string &prevGfx); - void setSelectEntity(const SelectedEntity &ent); - - bool nameBased; - int index, typeListIndex; - std::string name; - std::string prevGfx; - float prevScale; -}; - -class SceneEditor : public ActionMapper -{ -public: - SceneEditor(); - void init(); - void shutdown(); - void toggle(); - void toggle(bool on); - void update(float dt); - void prevElement(); - void nextElement(); - void doPrevElement(); - Element *cycleElementNext(Element *e); - Element *cycleElementPrev(Element *e); - void selectZero(); - void selectEnd(); - void placeElement(); - void flipElementHorz(); - void flipElementVert(); - void deleteSelectedElement(); - void deleteElement(int selectedIdx); - virtual void action(int id, int state, int source, InputDevice device); - void scaleElementUp(); - void scaleElementDown(); - void scaleElement1(); - void placeAvatar(); - - void executeButtonID(int bid); - - void openMainMenu(); - void closeMainMenu(); - - void setBackgroundGradient(); - - bool isOn(); - - void generateLevel(); - void skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int maxY); - void skinLevel(); - - void regenLevel(); - - void updateSaveFileEnemyPosition(Entity *ent); - void startMoveEntity(); - void endMoveEntity(); - - void down(); - void up(); - - void exitMoveState(); - - void alignHorz(); - void alignVert(); - - EditTypes editType; - EditorStates state; - - Element *getElementAtCursor(); - Entity *getEntityAtCursor(); - - void mouseButtonLeftUp(); - void mouseButtonRightUp(); - void moveToBack(); - void moveToFront(); - int bgLayer; - Element *editingElement; - Entity *editingEntity; - Path *editingPath; - - size_t selectedIdx; - size_t selectedNode; - - Path *getSelectedPath(); - void changeDepth(); - void updateEntitySaveData(Entity *editingEntity); - void moveLayer(); - void moveElementToLayer(Element *e, int bgLayer); - void toggleElementRepeat(); - bool multiSelecting; - Vector multiSelectPoint; - std::vector selectedElements; - - Vector groupCenter; - Vector getSelectedElementsCenter(); - - Quad dummy; - - void updateSelectedElementPosition(Vector position); - int selectedEntityType; - - SelectedEntity selectedEntity; - - size_t entityPageNum; - - void checkForRebuild(); - void createAquarian(); - void dumpObs(); - - DebugButton *btnMenu; -protected: - - void reversePath(); - - void updateEntityPlacer(); - void updateMultiSelect(); - float autoSaveTimer; - int autoSaveFile; - - void enterName(); - void changeShape(); - int skinMinX, skinMinY, skinMaxX, skinMaxY; - - void setGridPattern(int gi); - void setGridPattern0(); - void setGridPattern1(); - void setGridPattern2(); - void setGridPattern3(); - void setGridPattern4(); - void setGridPattern5(); - void setGridPattern6(); - void setGridPattern7(); - void setGridPattern8(); - void setGridPattern9(); - void toggleElementSolid(); - void toggleElementHurt(); - void editModeElements(); - void editModeEntities(); - void editModePaths(); - - void deleteSelected(); - void cloneSelectedElement(); - void enterScaleState(); - void enterRotateState(); - void enterMoveState(); - - Vector oldPosition, oldRotation, oldScale, cursorOffset, oldRepeatScale; - - Entity *movingEntity; - - void nextEntityType(); - void prevEntityType(); - - void removeEntity(); - - void selectEntityFromGroups(); - - Vector zoom; - - void rotateElement(); - void rotateElement2(); - void updateText(); - - void saveScene(); - void loadScene(); - - SceneEditorMenuReceiver menuReceiver; - - void addMainMenuItem(const std::string &label, int bid); - - void loadSceneByName(); - void reloadScene(); - - void mouseButtonLeft(); - void mouseButtonRight(); - - size_t curElement, selectedVariation, possibleSelectedIdx; - - Quad *placer; - DebugFont *text; - bool on; - InterpolatedVector oldGlobalScale; -}; - -#endif // AQUARIA_BUILD_SCENEEDITOR - typedef std::vector QuadList; typedef std::vector QuadArray; diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index 3e3f3b8..b6e1a9a 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -18,6 +18,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. */ + +#include "SceneEditor.h" #include "../BBGE/MathFunctions.h" #include #include "../BBGE/Gradient.h" @@ -1525,18 +1527,11 @@ void SceneEditor::skinLevel() dsq->screenMessage("Cannot skin without generated level."); return; } - pngRawInfo rawinfo; - std::string file = getMapTemplateFilename(); - bool success = pngLoadRaw(file.c_str(), &rawinfo); - if (success) - { - skinLevel(&rawinfo, skinMinX, skinMinY, skinMaxX, skinMaxY); - if (rawinfo.Data != NULL) - free(rawinfo.Data); - } + + skinLevel(skinMinX, skinMinY, skinMaxX, skinMaxY); } -void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int maxY) +void SceneEditor::skinLevel(int minX, int minY, int maxX, int maxY) { std::vector deleteElements; size_t i = 0; diff --git a/Aquaria/SceneEditor.h b/Aquaria/SceneEditor.h new file mode 100644 index 0000000..7b270c3 --- /dev/null +++ b/Aquaria/SceneEditor.h @@ -0,0 +1,246 @@ +#ifndef AQUARIA_SCENEEDITOR_H +#define AQUARIA_SCENEEDITOR_H + +#include "Base.h" +#include "AquariaCompileConfig.h" +#include "DebugFont.h" +#include "ActionMapper.h" +#include "Quad.h" + +#ifdef AQUARIA_BUILD_SCENEEDITOR + +class Element; +class Entity; +class Path; + +struct EntityGroupEntity +{ + std::string name; + std::string gfx; +}; + +typedef std::vector EntityGroupEntities; + +struct EntityGroup +{ + std::string name; + EntityGroupEntities entities; +}; + +typedef std::vector EntityGroups; + +enum EditTypes +{ + ET_ELEMENTS =0, + ET_ENTITIES =1, + ET_PATHS =2, + ET_SELECTENTITY =4, + ET_MAX +}; + +enum EditorStates +{ + ES_SELECTING =0, + ES_SCALING =1, + ES_ROTATING =2, + ES_MOVING =3, + ES_MAX +}; + +class SceneEditorMenuReceiver : public DebugButtonReceiver +{ +public: + void buttonPress(DebugButton *db); +}; + +struct SelectedEntity +{ + SelectedEntity(); + void clear(); + void setIndex(int idx); + void setName(const std::string &name, const std::string &prevGfx); + void setSelectEntity(const SelectedEntity &ent); + + bool nameBased; + int index, typeListIndex; + std::string name; + std::string prevGfx; + float prevScale; +}; + +class SceneEditor : public ActionMapper +{ +public: + SceneEditor(); + void init(); + void shutdown(); + void toggle(); + void toggle(bool on); + void update(float dt); + void prevElement(); + void nextElement(); + void doPrevElement(); + Element *cycleElementNext(Element *e); + Element *cycleElementPrev(Element *e); + void selectZero(); + void selectEnd(); + void placeElement(); + void flipElementHorz(); + void flipElementVert(); + void deleteSelectedElement(); + void deleteElement(int selectedIdx); + virtual void action(int id, int state, int source, InputDevice device); + void scaleElementUp(); + void scaleElementDown(); + void scaleElement1(); + void placeAvatar(); + + void executeButtonID(int bid); + + void openMainMenu(); + void closeMainMenu(); + + void setBackgroundGradient(); + + bool isOn(); + + void generateLevel(); + void skinLevel(int minX, int minY, int maxX, int maxY); + void skinLevel(); + + void regenLevel(); + + void updateSaveFileEnemyPosition(Entity *ent); + void startMoveEntity(); + void endMoveEntity(); + + void down(); + void up(); + + void exitMoveState(); + + void alignHorz(); + void alignVert(); + + EditTypes editType; + EditorStates state; + + Element *getElementAtCursor(); + Entity *getEntityAtCursor(); + + void mouseButtonLeftUp(); + void mouseButtonRightUp(); + void moveToBack(); + void moveToFront(); + int bgLayer; + Element *editingElement; + Entity *editingEntity; + Path *editingPath; + + size_t selectedIdx; + size_t selectedNode; + + Path *getSelectedPath(); + void changeDepth(); + void updateEntitySaveData(Entity *editingEntity); + void moveLayer(); + void moveElementToLayer(Element *e, int bgLayer); + void toggleElementRepeat(); + bool multiSelecting; + Vector multiSelectPoint; + std::vector selectedElements; + + Vector groupCenter; + Vector getSelectedElementsCenter(); + + Quad dummy; + + void updateSelectedElementPosition(Vector position); + int selectedEntityType; + + SelectedEntity selectedEntity; + + size_t entityPageNum; + + void checkForRebuild(); + void createAquarian(); + void dumpObs(); + + DebugButton *btnMenu; +protected: + + void reversePath(); + + void updateEntityPlacer(); + void updateMultiSelect(); + float autoSaveTimer; + int autoSaveFile; + + void enterName(); + void changeShape(); + int skinMinX, skinMinY, skinMaxX, skinMaxY; + + void setGridPattern(int gi); + void setGridPattern0(); + void setGridPattern1(); + void setGridPattern2(); + void setGridPattern3(); + void setGridPattern4(); + void setGridPattern5(); + void setGridPattern6(); + void setGridPattern7(); + void setGridPattern8(); + void setGridPattern9(); + void toggleElementSolid(); + void toggleElementHurt(); + void editModeElements(); + void editModeEntities(); + void editModePaths(); + + void deleteSelected(); + void cloneSelectedElement(); + void enterScaleState(); + void enterRotateState(); + void enterMoveState(); + + Vector oldPosition, oldRotation, oldScale, cursorOffset, oldRepeatScale; + + Entity *movingEntity; + + void nextEntityType(); + void prevEntityType(); + + void removeEntity(); + + void selectEntityFromGroups(); + + Vector zoom; + + void rotateElement(); + void rotateElement2(); + void updateText(); + + void saveScene(); + void loadScene(); + + SceneEditorMenuReceiver menuReceiver; + + void addMainMenuItem(const std::string &label, int bid); + + void loadSceneByName(); + void reloadScene(); + + void mouseButtonLeft(); + void mouseButtonRight(); + + size_t curElement, selectedVariation, possibleSelectedIdx; + + Quad *placer; + DebugFont *text; + bool on; + InterpolatedVector oldGlobalScale; +}; + +#endif // AQUARIA_BUILD_SCENEEDITOR + +#endif // AQUARIA_SCENEEDITOR_H diff --git a/ExternalLibs/glpng/glpng.c b/ExternalLibs/glpng/glpng.c index 314e37c..af861bf 100644 --- a/ExternalLibs/glpng/glpng.c +++ b/ExternalLibs/glpng/glpng.c @@ -30,8 +30,7 @@ //#define GL_GLEXT_PROTOTYPES -//#include -#include "GL/glpng.h" +#include #include #include #include