00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef __EDITOR_H__
00031 #define __EDITOR_H__
00032
00034
00035 #include <vector>
00036 #include <string>
00037 #include "player.h"
00038 #include "icons.h"
00039 #ifndef __VEC2I_H__
00040 #include "vec2i.h"
00041 #endif
00042
00043
00044
00045
00046 class CUnitType;
00047
00048
00049 enum EditorRunningType {
00050 EditorNotRunning = 0,
00051 EditorStarted = 1,
00052 EditorCommandLine = 2,
00053 EditorEditing = 4
00054 };
00055
00056 enum EditorStateType {
00057 EditorSelecting,
00058 EditorEditTile,
00059 EditorEditUnit,
00060 EditorSetStartLocation
00061 };
00062
00063 class CEditor {
00064 public:
00065 CEditor() : TerrainEditable(true),
00066 StartUnit(NULL),
00067 UnitIndex(0), CursorUnitIndex(-1), SelectedUnitIndex(-1),
00068 TileIndex(0), CursorTileIndex(-1), SelectedTileIndex(-1),
00069 CursorPlayer(-1), SelectedPlayer(PlayerNumNeutral),
00070 MapLoaded(false), WriteCompressedMaps(true), PopUpX(-1), PopUpY(-1)
00071 {};
00072 ~CEditor() {};
00073
00074 void Init();
00076 void CreateRandomMap() const;
00077
00078
00079 std::vector<std::string> UnitTypes;
00080 std::vector<const CUnitType *> ShownUnitTypes;
00081 std::vector<unsigned int> ShownTileTypes;
00082
00083 bool TerrainEditable;
00084 IconConfig Select;
00085 IconConfig Units;
00086 std::string StartUnitName;
00087 const CUnitType *StartUnit;
00088
00089 int UnitIndex;
00090 int CursorUnitIndex;
00091 int SelectedUnitIndex;
00092
00093 int TileIndex;
00094 int CursorTileIndex;
00095 int SelectedTileIndex;
00096
00097 int CursorPlayer;
00098 int SelectedPlayer;
00099
00100 bool MapLoaded;
00101 bool WriteCompressedMaps;
00102
00103 EditorRunningType Running;
00104
00105 EditorStateType State;
00106
00107 int PopUpX;
00108 int PopUpY;
00109
00110 };
00111
00112
00113
00114
00115
00116 extern CEditor Editor;
00117
00118
00119
00120
00121
00123 extern void StartEditor(const char *filename);
00124
00126 extern void EditorMainLoop();
00128 extern void EditorUpdateDisplay();
00129
00131 extern int EditorSaveMap(const std::string &file);
00132
00134 extern void EditorCclRegister();
00135
00137 extern void EditTile(const Vec2i &pos, int tile);
00139 extern void EditTiles(const Vec2i &pos, int tile, int size);
00140
00142 extern void ChangeTile(const Vec2i &pos, int tile);
00144 extern void EditorTileChanged(const Vec2i &pos);
00145
00146
00148
00149 #endif // !__EDITOR_H__