Renamed ZetaGlest to Glest

This commit is contained in:
mathusummut
2019-01-31 02:40:31 +01:00
parent 94493ab109
commit d5775734d7
536 changed files with 2372 additions and 2411 deletions

View File

@@ -0,0 +1,166 @@
# common libraries
OPTION(BUILD_MAP_EDITOR "Build map editor" ON)
SET(TARGET_NAME "glest_editor")
MESSAGE(STATUS "Build ${TARGET_NAME} = ${BUILD_MAP_EDITOR}")
IF(BUILD_MAP_EDITOR)
SET(EXTERNAL_LIBS "")
SET(TARGET_NAME_MANPAGE "${TARGET_NAME}.6")
ADD_DEFINITIONS("-std=c++11")
FIND_PACKAGE(${SDL_VERSION_NAME} REQUIRED)
INCLUDE_DIRECTORIES(${${SDL_VERSION_NAME}_INCLUDE_DIR})
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${${SDL_VERSION_NAME}_LIBRARY})
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${OPENGL_LIBRARY})
IF(STATIC_wxWidgets)
SET(wxWidgets_USE_STATIC ON)
# ^ This is not needed here (once, globally is enough) if every find run returns the same status.
# With wx this is not so 100% sure.
ENDIF()
# It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'.
# Optimal order most likely is gl > core > base, in some cases it may do difference.
FIND_PACKAGE(wxWidgets REQUIRED COMPONENTS gl core base)
IF(UNIX)
# wxWidgets include (this will do all the magic to configure everything)
INCLUDE( ${wxWidgets_USE_FILE} )
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${wxWidgets_LIBRARIES})
IF(STATIC_wxWidgets)
IF(wxWidgets_USE_STATIC)
MESSAGE(STATUS "==========> wxWidgets using STATIC libs:")
ELSE()
MESSAGE(STATUS "==========> wxWidgets STATIC libs NOT found:")
ENDIF()
ENDIF()
MESSAGE(STATUS " wxWidgets: ${wxWidgets_INCLUDE_DIRS} ;/; ${wxWidgets_LIBRARIES}")
ENDIF()
find_package(PkgConfig REQUIRED)
IF(FORCE_STREFLOP_SOFTWRAPPER)
pkg_search_module(STREFLOP streflop-soft)
ELSE()
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0")
pkg_search_module(STREFLOP streflop-sse)
ELSE()
IF(HAS_X87_SUPPORT)
pkg_search_module(STREFLOP streflop-x87)
ELSE()
pkg_search_module(STREFLOP streflop-soft)
ENDIF()
ENDIF()
ENDIF()
IF(NOT STREFLOP_FOUND)
pkg_search_module(STREFLOP streflop)
ENDIF()
MESSAGE(STATUS "Search for Library STREFLOP result = ${STREFLOP_FOUND} libs: ${STREFLOP_LIBRARIES} include dirs: ${STREFLOP_INCLUDE_DIRS}")
IF(FORCE_EMBEDDED_LIBS)
SET(STREFLOP_FOUND OFF)
MESSAGE(STATUS "FORCING USE of EMBEDDED Libraries...")
ENDIF()
IF(WANT_USE_STREFLOP)
IF(STREFLOP_FOUND)
INCLUDE_DIRECTORIES(${STREFLOP_INCLUDE_DIRS} ${STREFLOP_INCLUDE_DIRS}/streflop)
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${STREFLOP_LIBRARIES})
ADD_DEFINITIONS("-DUSE_STREFLOP_PKG")
ENDIF()
ENDIF()
#########################################################################################
# glest map editor
SET(DIRS_WITH_SRC
. )
SET(GLEST_MAIN_INCLUDE_ROOT "../game/")
SET(GLEST_LIB_INCLUDE_ROOT "../shared_lib/include/")
SET(GLEST_LIB_INCLUDE_DIRS
${GLEST_LIB_INCLUDE_ROOT}platform/common
# ${GLEST_LIB_INCLUDE_ROOT}platform/${SDL_VERSION_SNAME}
${GLEST_LIB_INCLUDE_ROOT}platform/posix
${GLEST_LIB_INCLUDE_ROOT}util
${GLEST_LIB_INCLUDE_ROOT}graphics
${GLEST_LIB_INCLUDE_ROOT}graphics/gl
${GLEST_LIB_INCLUDE_ROOT}map
${GLEST_MAIN_INCLUDE_ROOT}facilities
${GLEST_MAIN_INCLUDE_ROOT}game
${GLEST_LIB_INCLUDE_ROOT}xml/rapidxml
${GLEST_MAIN_INCLUDE_ROOT}global)
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
SET(GLEST_LIB_INCLUDE_DIRS
${GLEST_LIB_INCLUDE_DIRS}
${GLEST_LIB_INCLUDE_ROOT}streflop)
ENDIF()
INCLUDE_DIRECTORIES( ${GLEST_LIB_INCLUDE_DIRS} )
IF(WIN32)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/source/shared_lib/include/platform/win32)
ENDIF()
INCLUDE_DIRECTORIES( ${GLEST_LIB_INCLUDE_ROOT}platform/${SDL_VERSION_SNAME} )
SET(GLEST_SOURCE_FILES "../game/global/config.cpp")
FOREACH(DIR IN LISTS DIRS_WITH_SRC)
INCLUDE_DIRECTORIES( ${DIR} )
set(SRC_DIR_TO_GLOB ${DIR})
FILE(GLOB SRC_FILES_FROM_THIS_DIR ${SRC_DIR_TO_GLOB}/*.cpp)
SET(GLEST_SOURCE_FILES ${GLEST_SOURCE_FILES} ${SRC_FILES_FROM_THIS_DIR})
FILE(GLOB INCLUDE_FILES_FROM_THIS_DIR ${SRC_DIR_TO_GLOB}/*.h)
SET(GLEST_INCLUDE_FILES ${GLEST_INCLUDE_FILES} ${INCLUDE_FILES_FROM_THIS_DIR})
IF(APPLE)
FILE(GLOB SRC_FILES_FROM_THIS_DIR ${SRC_DIR_TO_GLOB}/*.mm)
#MESSAGE(STATUS "SRC_FILES_FROM_THIS_DIR: ${SRC_FILES_FROM_THIS_DIR}")
SET(GLEST_SOURCE_FILES ${GLEST_SOURCE_FILES} ${SRC_FILES_FROM_THIS_DIR})
FILE(GLOB SRC_FILES_FROM_THIS_DIR ${SRC_DIR_TO_GLOB}/*.m)
#MESSAGE(STATUS "SRC_FILES_FROM_THIS_DIR: ${SRC_FILES_FROM_THIS_DIR}")
SET(GLEST_SOURCE_FILES ${GLEST_SOURCE_FILES} ${SRC_FILES_FROM_THIS_DIR})
ENDIF(APPLE)
ENDFOREACH(DIR)
SET_SOURCE_FILES_PROPERTIES(${GLEST_INCLUDE_FILES} PROPERTIES HEADER_FILE_ONLY 1)
ADD_EXECUTABLE(${TARGET_NAME} ${GLEST_SOURCE_FILES} ${GLEST_INCLUDE_FILES})
SET(GLEST_STREFLOP "")
IF(WANT_USE_STREFLOP)
SET(GLEST_STREFLOP "streflop")
ENDIF()
IF(WIN32)
TARGET_LINK_LIBRARIES(${TARGET_NAME} stdc++ gcc odbc32 wsock32 winspool winmm shell32 comctl32 ctl3d32 advapi32 wsock32 opengl32 glu32 ole32 oleaut32 uuid mingw32 ddraw dsound dxguid ws2_32 iphlpapi wsock32 libogg libvorbis libvorbisfile zlib jpeg libpng xerces-c2_8_0 OpenAL32 libcurl winmm gdi32 opengl32 glu32 ${SDL_VERSION_NAME} ${SDL_VERSION_NAME}main lua5.1 ${GLEST_STREFLOP} libglest stdc++ moldname mingwex msvcrt user32 kernel32)
ENDIF()
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${GLEST_STREFLOP})
ENDIF()
TARGET_LINK_LIBRARIES(${TARGET_NAME} libglest)
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${EXTERNAL_LIBS})
# Installation of the program
INSTALL(TARGETS
${TARGET_NAME}
DESTINATION "${INSTALL_DIR_BIN}")
# Installation of the program manpage file
INSTALL(FILES
"${PROJECT_SOURCE_DIR}/man/${TARGET_NAME_MANPAGE}"
DESTINATION ${INSTALL_DIR_MAN})
# Installation of the program config and image files
INSTALL(FILES
"${PROJECT_SOURCE_DIR}/mk/shared/map_editor.ico"
DESTINATION ${INSTALL_DIR_INI})
ENDIF()

88
source/map_editor/icons.h Normal file
View File

@@ -0,0 +1,88 @@
// ==============================================================
// This file is part of Glest (www.glest.org)
//
// Copyright (C) 2010 Frank Tetzel
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version
// ==============================================================
#ifndef _MAPEDITOR_ICONS_H_
#define _MAPEDITOR_ICONS_H_
#include "icons/radius_1.xpm"
#include "icons/radius_2.xpm"
#include "icons/radius_3.xpm"
#include "icons/radius_4.xpm"
#include "icons/radius_5.xpm"
#include "icons/radius_6.xpm"
#include "icons/radius_7.xpm"
#include "icons/radius_8.xpm"
#include "icons/radius_9.xpm"
#include "icons/brush_surface_custom.xpm"
#include "icons/brush_surface_grass1.xpm"
#include "icons/brush_surface_grass2.xpm"
#include "icons/brush_surface_road.xpm"
#include "icons/brush_surface_stone.xpm"
#include "icons/brush_none.xpm"
#include "icons/brush_object_bush.xpm"
#include "icons/brush_object_dead-tree.xpm"
#include "icons/brush_object_stone.xpm"
#include "icons/brush_object_tree.xpm"
#include "icons/brush_object_water-object.xpm"
#include "icons/brush_object_c1-bigtree.xpm"
#include "icons/brush_object_c2-hanged.xpm"
#include "icons/brush_object_c4-bigrock.xpm"
#include "icons/brush_object_c5-blocking.xpm"
#include "icons/brush_object_c3-statue.xpm"
#include "icons/brush_gradient_0.xpm"
#include "icons/brush_gradient_n1.xpm"
#include "icons/brush_gradient_n2.xpm"
#include "icons/brush_gradient_n3.xpm"
#include "icons/brush_gradient_n4.xpm"
#include "icons/brush_gradient_n5.xpm"
#include "icons/brush_gradient_p1.xpm"
#include "icons/brush_gradient_p2.xpm"
#include "icons/brush_gradient_p3.xpm"
#include "icons/brush_gradient_p4.xpm"
#include "icons/brush_gradient_p5.xpm"
#include "icons/brush_height_0.xpm"
#include "icons/brush_height_n1.xpm"
#include "icons/brush_height_n2.xpm"
#include "icons/brush_height_n3.xpm"
#include "icons/brush_height_n4.xpm"
#include "icons/brush_height_n5.xpm"
#include "icons/brush_height_p1.xpm"
#include "icons/brush_height_p2.xpm"
#include "icons/brush_height_p3.xpm"
#include "icons/brush_height_p4.xpm"
#include "icons/brush_height_p5.xpm"
#include "icons/brush_players_blue.xpm"
#include "icons/brush_players_player.xpm"
#include "icons/brush_players_green.xpm"
#include "icons/brush_players_yellow.xpm"
#include "icons/brush_players_red.xpm"
#include "icons/brush_players_white.xpm"
#include "icons/brush_players_cyan.xpm"
#include "icons/brush_players_orange.xpm"
#include "icons/brush_players_pink.xpm"
#include "icons/brush_resource_1-gold.xpm"
#include "icons/brush_resource_2-stone.xpm"
#include "icons/brush_resource_3.xpm"
#include "icons/brush_resource_4.xpm"
#include "icons/brush_resource_5.xpm"
#include "icons/edit_randomize-heights.xpm"
// #include "icons/edit_randomize.xpm"
#include "icons/edit_redo.xpm"
#include "icons/edit_switch-surfaces.xpm"
#include "icons/edit_undo.xpm"
#endif

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_0[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_n1[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXX X XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" XXXXXXX ",
"... ......",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_n2[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXX X X",
"XXXXXXXXXXX XXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" XXXXXXXXX ",
".. XXXXXXX .....",
"... ......",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_n3[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXX X X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" XXXXXXXXX ",
".. XXXXXXX .....",
"... XXXXX ......",
".... .......",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_n4[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX XX X",
"XXXXXXX X X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" XXXXXXXXXXX ",
". XXXXXXXXX ....",
".. XXXXXXX .....",
"... XXXXX ......",
".... .......",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_n5[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXX XXXX",
"XXXXXXX X X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" XXXXXXXXXXX ",
". XXXXXXXXX ....",
".. XXXXXXX .....",
"... XXXXX ......",
".... XXX .......",
"..... ........",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_p1[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXX XXXXXX",
" ....... ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_p2[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXX XXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXX XXXXXX",
"XX ....... XXXXX",
" ......... ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_p3[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXX X",
"XXXX XXXXXXX",
"XXX ..... XXXXXX",
"XX ....... XXXXX",
" ......... ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_p4[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXX XXXXX X",
"XXX ..... XXXXXX",
"XX ....... XXXXX",
"X ......... XXXX",
" ........... ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_gradient_p5[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #FF0000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXX XXXX",
"XXXXXXXXXXX X",
"XXXXX XXXXXX X",
"XXXX ... XX X",
"XXX ..... XXXXXX",
"XX ....... XXXXX",
"X ......... XXXX",
" ........... ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_0[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_n1[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXX X XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" XXXXXXX ",
"... ......",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_n2[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXX X X",
"XXXXXXXXXXX XXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" XXXXXXX ",
"...XXXXXXX......",
"... ......",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_n3[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXX X X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" XXXXXXX ",
"...XXXXXXX......",
"...XXXXXXX......",
"... ......",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_n4[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX XX X",
"XXXXXXX X X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" XXXXXXX ",
"...XXXXXXX......",
"...XXXXXXX......",
"...XXXXXXX......",
"... ......",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_n5[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXX XXXX",
"XXXXXXX X X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
" XXXXXXX ",
"...XXXXXXX......",
"...XXXXXXX......",
"...XXXXXXX......",
"...XXXXXXX......",
"... ......",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_p1[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXX XXXXXX",
" ....... ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_p2[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXX XXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXXXX",
"XXX XXXXXX",
"XXX.......XXXXXX",
" ....... ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_p3[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXXXXXXXXXX X",
"XXX XXXXXX",
"XXX.......XXXXXX",
"XXX.......XXXXXX",
" ....... ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_p4[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX XX X",
"XXXXXXXXXXX X",
"XXXXXXXXXXXXXX X",
"XXX XXXX X",
"XXX.......XXXXXX",
"XXX.......XXXXXX",
"XXX.......XXXXXX",
" ....... ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *brush_height_p5[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #0000FF",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXX X",
"XXXXXXXXXXX XXXX",
"XXXXXXXXXXX X",
"XXX XXXX X",
"XXX.......X X",
"XXX.......XXXXXX",
"XXX.......XXXXXX",
"XXX.......XXXXXX",
" ....... ",
"................",
"................",
"................",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_none[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #FF0000",
". c #008000",
"X c #000080",
"o c None",
/* pixels */
"oo oooXXooo oo",
"oo oXXXXo oo",
"ooo XXXX ooo",
"oooo XX oooo",
"ooooo ooooo",
"oooooo oooooo",
"oooooo oooooo",
"ooooo ooooo",
"oooo XX oooo",
"ooo XXXX ooo",
"oo oXXXXo oo",
"oo ooXXXXoo oo",
"ooooo......ooooo",
"................",
"................",
"................"
};

View File

@@ -0,0 +1,27 @@
/* XPM */
static const char *brush_object_bush[] = {
"20 20 4 1",
" c None",
". c #0000FF",
"+ c #008000",
"@ c #00FF00",
"....................",
"....................",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
".. +@+ + ..",
".. +@+@+@@ ..",
".. @+@+@+@ ..",
".. +@ + + ++ ..",
".. @+@+@++ + ..",
".. +@+ +@@+ ..",
".. + +@++@ ..",
".. ++++++++++++++ ..",
".. ..",
"....................",
"...................."};

View File

@@ -0,0 +1,28 @@
/* XPM */
static const char *brush_object_c1_bigtree[] = {
"20 20 5 1",
" c None",
". c #FFCC7F",
"+ c #808000",
"@ c #008000",
"# c #800000",
"....................",
"....................",
".. ++@+ ..",
".. @+++++@+ ..",
".. +++@+@+++@ ..",
".. +@++@++@++ ..",
".. ++++++++++@+ ..",
".. +@@+@++@@@+@ ..",
".. ++++@+++++ ..",
".. ++@+++@@+@ ..",
".. ++++@+++ ..",
".. @+++ ..",
".. #### ..",
".. #### ..",
".. #### ..",
".. #### ..",
".. ###### ..",
".. ######### ..",
"....................",
"...................."};

View File

@@ -0,0 +1,31 @@
/* XPM */
static const char *brush_object_c2_hanged[] = {
"20 20 8 1",
" c None",
". c #00FFFF",
"+ c #800000",
"@ c #C0C0C0",
"# c #808080",
"$ c #FFFF00",
"% c #0000FF",
"& c #008000",
"....................",
"....................",
".. + ..",
".. +++++++++ ..",
".. @ + + + @ ..",
".. ## +++ @ ..",
".. @@@ + ### ..",
".. @#@#@ + # @ # ..",
".. @@#@@ + #+@ # ..",
".. $@@@$ + #+@+# ..",
".. %$% + #+@+# ..",
".. %$% + # @+# ..",
".. @@@ + ###+#+ ..",
".. @ @ + + + ..",
".. + ..",
".. + ..",
".. &+# ..",
"..&&&&&&&&&&&&&&&&..",
"....................",
"...................."};

View File

@@ -0,0 +1,29 @@
/* XPM */
static const char *brush_object_c3_statue[] = {
"20 20 6 1",
" c None",
". c #B2194C",
"+ c #C0C0C0",
"@ c #808080",
"# c #808000",
"$ c #008000",
"....................",
"....................",
".. ..",
".. + ..",
".. +@@ ..",
".. +@ ..",
".. ###+@ ..",
".. #+#@+@ ..",
".. ###@ ..",
".. @@@ ..",
".. @@@ ..",
".. @ @ ..",
".. @ @ ..",
".. @ @ ..",
".. ++++++ ..",
".. @@@@ ..",
".. @@@@ ..",
"..$$$$$$$$$$$$$$$$..",
"....................",
"...................."};

View File

@@ -0,0 +1,28 @@
/* XPM */
static const char *brush_object_c4_bigrock[] = {
"20 20 5 1",
" c None",
". c #7fff19",
"+ c #808080",
"@ c #C0C0C0",
"# c #008000",
"....................",
"....................",
".. ..",
".. ..",
".. ..",
".. +@ ..",
".. @+++ +@ ..",
".. +++@###++ ..",
".. +@+@###++ ..",
".. @++++@###+ ..",
".. ++@+@+###+@ ..",
".. ++##+++##++ ..",
".. +@##++++@++ ..",
".. @++##+@++@+@ ..",
".. ++++#++###++ ..",
".. +@++++++#### ..",
".. +++++###++++ ..",
"..################..",
"....................",
"...................."};

View File

@@ -0,0 +1,27 @@
/* XPM */
static const char *brush_object_c5_blocking[] = {
"20 20 4 1",
" c None",
". c #FF33CC",
"+ c #C0C0C0",
"@ c #008000",
"....................",
"....................",
".. ..",
".. ++++++++++++ ..",
".. + + ..",
".. + + ..",
".. + + ..",
".. + + ..",
".. + + ..",
".. + + ..",
".. + + ..",
".. + + ..",
".. + + ..",
".. + + ..",
".. + + ..",
".. + + ..",
".. + + ..",
"..@@@@@@@@@@@@@@@@..",
"....................",
"...................."};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_object_dead_tree[] = {
"20 20 3 1",
" c None",
". c #FFFFFF",
"+ c #800000",
"....................",
"....................",
".. ..",
".. + + ..",
".. + + + + ..",
".. + ++ ..",
".. ++++ + + + ..",
".. +++ ++ ..",
".. + ++ +++ ..",
".. + ++++ + ..",
".. +++ +++ ..",
".. +++++ ++ ..",
".. ++++++ ..",
".. ++++ ..",
".. ++++ ..",
".. ++++ ..",
".. ++++++ ..",
".. +++++++++ ..",
"....................",
"...................."};

View File

@@ -0,0 +1,28 @@
/* XPM */
static const char *brush_object_stone[] = {
"20 20 5 1",
" c None",
". c #7F7FFF",
"+ c #808080",
"@ c #C0C0C0",
"# c #008000",
"....................",
"....................",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
".. +@ ..",
".. +++@++ ..",
".. @++++@+@ ..",
".. +++++++++@ ..",
".. +++@+++++@@ ..",
".. ++++++@++@@ ..",
".. +@++++++++@ ..",
".. ############## ..",
".. ..",
"....................",
"...................."};

View File

@@ -0,0 +1,28 @@
/* XPM */
static const char * brush_object_tree[] = {
"20 20 5 1",
" c None",
". c #FF0000",
"+ c #008000",
"@ c #00FF00",
"# c #800000",
"....................",
"....................",
".. ++ ..",
".. ++++++ ..",
".. ++++@+++ ..",
".. ++++++++ ..",
".. +@++@@++@+ ..",
".. ++++++@+++ ..",
".. +++@++++ ..",
".. ++++++++ ..",
".. ++++++ ..",
".. #++# ..",
".. #### ..",
".. #### ..",
".. #### ..",
".. #### ..",
".. ###### ..",
".. ######### ..",
"....................",
"...................."};

View File

@@ -0,0 +1,28 @@
/* XPM */
static const char *brush_object_water_object[] = {
"20 20 5 1",
" c None",
". c #7F7F7F",
"+ c #008000",
"@ c #00FFFF",
"# c #0000FF",
"....................",
"....................",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
".. + ..",
".. + + ..",
".. + + + + ..",
".. + ++ + ..",
".. + + + ..",
".. + ++ ..",
"..@@@@@@@++@@@@@@@..",
"..@#@@@#@@@#@@@#@@..",
"..#@#@#@#@#@#@#@#@..",
"..################..",
"....................",
"...................."};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_players_blue[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #000080",
"X c #0000FF",
"o c None",
/* pixels */
"oo oo",
"oo .......... oo",
"oo XXXXXXXXXX oo",
"oo XX.XXXX.XX oo",
"oo X...XX...X oo",
"oo XX.XXXX.XX oo",
"oo XXXXXXXXXX oo",
"oo XXXXXXXXXX oo",
"oo X........X oo",
"oo XXXXXXXXXX oo",
"oo XXXXXXXXXX oo",
"oo XXXX..XXXX oo",
"ooo XX....XX ooo",
"ooo X......X ooo",
"oooo .... oooo",
"oooooo oooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_players_cyan[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #008080",
"X c #00FFFF",
"o c None",
/* pixels */
"oo oo",
"oo .......... oo",
"oo ....XX.... oo",
"oo ...XXXX... oo",
"oo ...XXXX... oo",
"oo ....XX.... oo",
"oo .......... oo",
"oo .XX....XX. oo",
"oo ..XXXXXX.. oo",
"oo ...XXXX... oo",
"oo .......... oo",
"oo .......... oo",
"ooo ........ ooo",
"ooo ........ ooo",
"oooo .... oooo",
"oooooo oooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_players_green[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #008000",
"X c #00FF00",
"o c None",
/* pixels */
"oo oo",
"oo .X.X..X.X. oo",
"oo .X.X..X.X. oo",
"oo .X.X..X.X. oo",
"oo .X.X..X.X. oo",
"oo .X.X..X.X. oo",
"oo .X.X..X.X. oo",
"oo .X.X..X.X. oo",
"oo .X.X..X.X. oo",
"oo .......... oo",
"oo .XXX..XXX. oo",
"oo ...X..X... oo",
"ooo ..XXXX.. ooo",
"ooo ........ ooo",
"oooo .... oooo",
"oooooo oooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_players_orange[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #804000",
"X c #FF8000",
"o c None",
/* pixels */
"oo oo",
"oo XXXX.X.XXX oo",
"oo XXX.X.XXXX oo",
"oo XX.X.XXXXX oo",
"oo X.X.XXXXXX oo",
"oo .X.XXXXXXX oo",
"oo X.XXXXX..X oo",
"oo .XXXXX...X oo",
"oo XXXXX...XX oo",
"oo XXX....XXX oo",
"oo XXXX..XXXX oo",
"oo XXX.X.XXXX oo",
"ooo XXXXXXXX ooo",
"ooo XXXXXXXX ooo",
"oooo XXXX oooo",
"oooooo oooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_players_pink[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #800080",
"X c #FF00FF",
"o c None",
/* pixels */
"oo oo",
"oo ..X....X.. oo",
"oo X...XX...X oo",
"oo XX.XXXX.XX oo",
"oo X...XX...X oo",
"oo ..X....X.. oo",
"oo X...XX...X oo",
"oo XX.XXXX.XX oo",
"oo X...XX...X oo",
"oo ..X....X.. oo",
"oo X...XX...X oo",
"oo XX.XXXX.XX oo",
"ooo ...XX... ooo",
"ooo .X....X. ooo",
"oooo .XX. oooo",
"oooooo oooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_players_player[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #FFFF00",
". c #008080",
"@ c #000000",
"X c None",
/* pixels */
"XXXXX......XXXXX",
"XXX..........XXX",
"XX............XX",
"X..............X",
"X.... ....X",
"...... .. ....",
"...... .. ....",
"...... .. ....",
"...... .....",
"...... ........",
"...... ........",
"X..... .......X",
"X.... @@@@@@@",
"XX........@@@@@X",
"XXX........@@@XX",
"XXXXX......X@XXX"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_players_red[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #800000",
"X c #FF0000",
"o c None",
/* pixels */
"oo oo",
"oo .......... oo",
"oo .......... oo",
"oo .......... oo",
"oo XXXXXXXXXX oo",
"oo .......... oo",
"oo .......... oo",
"oo XXXXXXXXXX oo",
"oo XXXXXXXXXX oo",
"oo .......... oo",
"oo .......... oo",
"oo XXXXXXXXXX oo",
"ooo ........ ooo",
"ooo ........ ooo",
"oooo .... oooo",
"oooooo oooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_players_white[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #808080",
"X c #C0C0C0",
"o c None",
/* pixels */
"oo oo",
"oo XXXXXXXXXX oo",
"oo ....XX.... oo",
"oo X.X.XX.X.X oo",
"oo ....XX.... oo",
"oo XXXXXXXXXX oo",
"oo XX..XX..XX oo",
"oo XXXXXXXXXX oo",
"oo .......... oo",
"oo XXXXXXXXXX oo",
"oo .......... oo",
"oo XXXXXXXXXX oo",
"ooo XXXXXXXX ooo",
"ooo XXXXXXXX ooo",
"oooo XXXX oooo",
"oooooo oooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_players_yellow[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #808000",
"X c #FFFF00",
"o c None",
/* pixels */
"oo oo",
"oo .........X oo",
"oo .XXX....X. oo",
"oo .XXX...X.. oo",
"oo .XXX..X..X oo",
"oo .....X..X. oo",
"oo ....X..X.. oo",
"oo ...X..X..X oo",
"oo ..X..X..X. oo",
"oo .X..X..X.. oo",
"oo X..X..X... oo",
"oo ..X..X.... oo",
"ooo X..X.... ooo",
"ooo ..X..... ooo",
"oooo .... oooo",
"oooooo oooooo"
};

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *brush_resource_1_gold[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c #dddd00",
". c None",
/* pixels */
"................",
". .......... .",
". ........ .",
".. ...... ..",
"... .... ...",
".... .. ....",
"..... .....",
"...... ......",
"...... ......",
"..... .....",
".... .. ....",
"... .... ...",
".. ...... ..",
". ........ .",
". .......... .",
"................"
};

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *brush_resource_2_stone[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c #808080",
". c None",
/* pixels */
"................",
". .......... .",
". ........ .",
".. ...... ..",
"... .... ...",
".... .. ....",
"..... .....",
"...... ......",
"...... ......",
"..... .....",
".... .. ....",
"... .... ...",
".. ...... ..",
". ........ .",
". .......... .",
"................"
};

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *brush_resource_3[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c #FF0000",
". c None",
/* pixels */
"................",
". .......... .",
". ........ .",
".. ...... ..",
"... .... ...",
".... .. ....",
"..... .....",
"...... ......",
"...... ......",
"..... .....",
".... .. ....",
"... .... ...",
".. ...... ..",
". ........ .",
". .......... .",
"................"
};

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *brush_resource_4[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c #0000FF",
". c None",
/* pixels */
"................",
". .......... .",
". ........ .",
".. ...... ..",
"... .... ...",
".... .. ....",
"..... .....",
"...... ......",
"...... ......",
"..... .....",
".... .. ....",
"... .... ...",
".. ...... ..",
". ........ .",
". .......... .",
"................"
};

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *brush_resource_5[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c #008080",
". c None",
/* pixels */
"................",
". .......... .",
". ........ .",
".. ...... ..",
"... .... ...",
".... .. ....",
"..... .....",
"...... ......",
"...... ......",
"..... .....",
".... .. ....",
"... .... ...",
".. ...... ..",
". ........ .",
". .......... .",
"................"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_surface_custom[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #2D2013",
". c #7c4645",
"@ c #C48C54",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"@@@@@@@@@@@@@@@.",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
" ",
"XXXXXXXXXXXXXXXX"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_surface_grass1[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #003300",
". c #00a000",
"@ c #00E000",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"@@@@@@@@@@@@@@@.",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
" ",
"XXXXXXXXXXXXXXXX"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_surface_grass2[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #192600",
". c #536e0b",
"@ c #70A800",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"@@@@@@@@@@@@@@@.",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
" ",
"XXXXXXXXXXXXXXXX"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_surface_road[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #261300",
". c #800000",
"@ c #A85400",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"@@@@@@@@@@@@@@@.",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
" ",
"XXXXXXXXXXXXXXXX"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *brush_surface_stone[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #2D2D2D",
". c #808080",
"@ c #C4C4C4",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"@@@@@@@@@@@@@@@.",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
"@.............. ",
" ",
"XXXXXXXXXXXXXXXX"
};

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *edit_randomize_heights[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c #008000",
". c None",
/* pixels */
"................",
"................",
"................",
"................",
"................",
"................",
"................",
"................",
"...... ..... .",
"... . .",
" ",
" ",
" ",
" ",
" ",
" "
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *edit_randomize[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #008000",
". c #00FF00",
"X c #00FFFF",
/* pixels */
" ",
" XX XX ",
" XX XX . ",
" XXXX ",
" XX ",
" XXXX .",
" XX XX .",
" XX XX ..",
" . ",
" .",
" . ",
" ... . ",
" . ",
" .",
" . .... ",
" ...... "
};

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *edit_redo[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c #000000",
". c None",
/* pixels */
"................",
"........ .....",
"......... ....",
".......... ...",
"........... ..",
".... .",
"... .",
".. ...... ..",
". ...... ...",
". ...... ....",
". ..... .....",
". .............",
". .............",
".. .............",
"................",
"................"
};

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *edit_switch_surfaces[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c #008000",
". c #00FF00",
/* pixels */
"........ ",
"........ ",
"........ ",
"........ ",
"..... .. . ",
".... .. .. ",
"... .. ... ",
".. ...... ",
".. ...... ",
"... .. ... ",
".... .. .. ",
"..... .. . ",
"........ ",
"........ ",
"........ ",
"........ "
};

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *edit_undo[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c #000000",
". c None",
/* pixels */
"................",
"..... ........",
".... .........",
"... ..........",
".. ...........",
". ....",
". ...",
".. ...... ..",
"... ...... .",
".... ...... .",
"..... ..... .",
"............. .",
"............. .",
"............. ..",
"................",
"................"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *radius_1[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #C0C0C0",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXX..XXXXXXX",
"XXXXXX. .XXXXXX",
"XXXXXX. .XXXXXX",
"XXXXXXX..XXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *radius_2[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #808080",
"X c #C0C0C0",
"o c None",
/* pixels */
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooXXooooooo",
"oooooo. .oooooo",
"oooooX Xooooo",
"oooooX Xooooo",
"oooooo. .oooooo",
"oooooooXXooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *radius_3[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #808080",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXX. .XXXXXX",
"XXXXX. .XXXXX",
"XXXXX XXXXX",
"XXXXX XXXXX",
"XXXXX. .XXXXX",
"XXXXXX. .XXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *radius_4[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #808080",
"X c #C0C0C0",
"o c None",
/* pixels */
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"ooooooX..Xoooooo",
"ooooo. .ooooo",
"ooooX Xoooo",
"oooo. .oooo",
"oooo. .oooo",
"ooooX Xoooo",
"ooooo. .ooooo",
"ooooooX..Xoooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *radius_5[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #808080",
"X c #C0C0C0",
"o c None",
/* pixels */
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooXXooooooo",
"oooooX. .Xooooo",
"ooooX Xoooo",
"oooo. .oooo",
"oooX Xooo",
"oooX Xooo",
"oooo. .oooo",
"ooooX Xoooo",
"oooooX. .Xooooo",
"oooooooXXooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *radius_6[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #808080",
"X c #C0C0C0",
"o c None",
/* pixels */
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"ooooooX..Xoooooo",
"ooooo. .ooooo",
"oooo. .oooo",
"oooX Xooo",
"ooo. .ooo",
"ooo. .ooo",
"oooX Xooo",
"oooo. .oooo",
"ooooo. .ooooo",
"ooooooX..Xoooooo",
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooooooooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *radius_7[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #808080",
"X c #C0C0C0",
"o c None",
/* pixels */
"oooooooooooooooo",
"oooooooooooooooo",
"oooooooXXooooooo",
"ooooo. .ooooo",
"oooo oooo",
"ooo. .ooo",
"ooo ooo",
"ooX Xoo",
"ooX Xoo",
"ooo ooo",
"ooo. .ooo",
"oooo oooo",
"ooooo. .ooooo",
"oooooooXXooooooo",
"oooooooooooooooo",
"oooooooooooooooo"
};

View File

@@ -0,0 +1,26 @@
/* XPM */
static const char *radius_8[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c #000000",
". c #808080",
"X c #C0C0C0",
"o c None",
/* pixels */
"oooooooooooooooo",
"oooooooooooooooo",
"oooooo. .oooooo",
"ooooX Xoooo",
"oooX Xooo",
"ooo ooo",
"oo. .oo",
"oo oo",
"oo oo",
"oo. .oo",
"ooo ooo",
"oooX Xooo",
"ooooX Xoooo",
"oooooo. .oooooo",
"oooooooooooooooo",
"oooooooooooooooo"
};

View File

@@ -0,0 +1,25 @@
/* XPM */
static const char *radius_9[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c #000000",
". c #808080",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXX..XXXXXXX",
"XXXXX. .XXXXX",
"XXXX XXXX",
"XXX XXX",
"XX. .XX",
"XX XX",
"X. .X",
"X. .X",
"XX XX",
"XX. .XX",
"XXX XXX",
"XXXX XXXX",
"XXXXX. .XXXXX",
"XXXXXXX..XXXXXXX",
"XXXXXXXXXXXXXXXX"
};

1768
source/map_editor/main.cpp Normal file

File diff suppressed because it is too large Load Diff

392
source/map_editor/main.h Normal file
View File

@@ -0,0 +1,392 @@
// This file is part of Glest <https://github.com/Glest>
//
// Copyright (C) 2018 The Glest team
//
// Glest is a fork of MegaGlest <https://megaglest.org/>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>
#ifndef _MAPEDITOR_MAIN_H_
#define _MAPEDITOR_MAIN_H_
#ifdef WIN32
#include <winsock2.h>
#include <winsock.h>
#endif
#include <string>
#include <vector>
#include <wx/wx.h>
#include <wx/glcanvas.h>
#include "program.h"
#include "util.h"
#include "platform_common.h"
using std::string;
using std::vector;
using std::pair;
using namespace Shared::PlatformCommon;
namespace MapEditor {
class GlCanvas;
enum BrushType {
btHeight,
btGradient,
btSurface,
btObject,
btResource,
btStartLocation
};
enum StatusItems {
siNULL_ENTRY,
siFILE_NAME,
siFILE_TYPE,
siCURR_OBJECT,
siBRUSH_TYPE,
siBRUSH_VALUE,
siBRUSH_RADIUS,
siPOS_VALUE,
siCOUNT
};
const char *object_descs[] = {
"None (Erase)",
"Tree",
"Dead tree",
"Stone (non harvest)",
"Bush",
"Water object",
"Big tree",
"Hanged/Impaled",
"Statues",
"Mountain",
"Invisible blocking"
};
const char *resource_descs[] = {
"None (Erase)", "Gold", "Stone", "Custom 4", "Custom 5", "Custom 6"
};
const char *surface_descs[] = {
"Grass", "Sec. grass", "Road", "Stone", "Ground"
};
class MainToolBar : public wxToolBar {
private:
DECLARE_EVENT_TABLE()
public:
MainToolBar(wxWindow *parent,
wxWindowID id) : wxToolBar(parent, id) {
}
void onMouseMove(wxMouseEvent &event);
};
// =====================================================
// class MainWindow
// =====================================================
class MainWindow : public wxFrame {
private:
DECLARE_EVENT_TABLE()
private:
static const string versionString;
static const string winHeader;
static const int heightCount = 11;
static const int surfaceCount = 5;
static const int objectCount = 11;
static const int resourceCount = 6;
static const int startLocationCount = 8;
static const int radiusCount = 9;
private:
enum MenuId {
miFileLoad,
miFileSave,
miFileSaveAs,
miFileExit,
miEditUndo,
miEditRedo,
miEditReset,
miEditResetPlayers,
miEditResize,
miEditFlipDiagonal,
miEditFlipX,
miEditFlipY,
miEditMirrorX,
miEditMirrorY,
miEditMirrorXY,
miEditRotatecopyX,
miEditRotatecopyY,
miEditRotatecopyXY,
miEditRotatecopyCorner,
miEditMirror,
miEditRandomizeHeights,
miEditRandomize,
miEditSwitchSurfaces,
miEditInfo,
miEditAdvanced,
miViewResetZoomAndPos,
miViewGrid,
miViewHeightMap,
miHideWater,
miViewAbout,
miViewHelp,
toolPlayer,
miBrushHeight,
miBrushGradient = miBrushHeight + heightCount + 1,
miBrushSurface = miBrushGradient + heightCount + 1,
miBrushObject = miBrushSurface + surfaceCount + 1,
miBrushResource = miBrushObject + objectCount + 1,
miBrushStartLocation = miBrushResource + resourceCount + 1,
miRadius = miBrushStartLocation + startLocationCount + 1
};
private:
GlCanvas *glCanvas;
Program *program;
int lastX, lastY;
wxPanel *panel;
wxMenuBar *menuBar;
wxMenu *menuFile;
wxMenu *menuEdit;
wxMenu *menuEditMirror;
wxMenu *menuView;
wxMenu *menuBrush;
wxMenu *menuBrushHeight;
wxMenu *menuBrushGradient;
wxMenu *menuBrushSurface;
wxMenu *menuBrushObject;
wxMenu *menuBrushResource;
wxMenu *menuBrushStartLocation;
wxMenu *menuRadius;
wxFileDialog *fileDialog;
string currentFile;
BrushType currentBrush;
int height;
int surface;
int radius;
int object;
int resource;
int startLocation;
int resourceUnderMouse;
int objectUnderMouse;
bool randomWithReset;
int randomMinimumHeight;
int randomMaximumHeight;
int randomChanceDivider;
int randomRecursions;
ChangeType enabledGroup;
string fileName;
bool fileModified;
Chrono lastPaintEvent;
wxBoxSizer *boxsizer;
bool startupSettingsInited;
string appPath;
public:
explicit MainWindow(string appPath);
~MainWindow();
void refreshMapRender();
void init(string fname);
void onClose(wxCloseEvent &event);
void onMouseDown(wxMouseEvent &event, int x, int y);
void onMouseMove(wxMouseEvent &event, int x, int y);
void onMouseWheelDown(wxMouseEvent &event);
void onMouseWheelUp(wxMouseEvent &event);
void onPaint(wxPaintEvent &event);
void onKeyDown(wxKeyEvent &e);
void onMenuFileLoad(wxCommandEvent &event);
void onMenuFileSave(wxCommandEvent &event);
void onMenuFileSaveAs(wxCommandEvent &event);
void onMenuFileExit(wxCommandEvent &event);
void onMenuEditUndo(wxCommandEvent &event);
void onMenuEditRedo(wxCommandEvent &event);
void onMenuEditReset(wxCommandEvent &event);
void onMenuEditResetPlayers(wxCommandEvent &event);
void onMenuEditResize(wxCommandEvent &event);
void onMenuEditFlipDiagonal(wxCommandEvent &event);
void onMenuEditFlipX(wxCommandEvent &event);
void onMenuEditFlipY(wxCommandEvent &event);
void onMenuEditMirrorX(wxCommandEvent &event); // copy left to right
void onMenuEditMirrorY(wxCommandEvent &event); // copy top to bottom
void onMenuEditMirrorXY(wxCommandEvent &event); // copy bottomleft to topright
void onMenuEditRotatecopyX(wxCommandEvent &event); // copy left to right, rotated
void onMenuEditRotatecopyY(wxCommandEvent &event); // copy top to bottom, rotated
void onMenuEditRotatecopyXY(wxCommandEvent &event); // copy bottomleft to topright, rotated
void onMenuEditRotatecopyCorner(wxCommandEvent &event); // copy top left 1/4 to top right 1/4, rotated
void onMenuEditRandomizeHeights(wxCommandEvent &event);
void onMenuEditRandomize(wxCommandEvent &event);
void onMenuEditSwitchSurfaces(wxCommandEvent &event);
void onMenuEditInfo(wxCommandEvent &event);
void onMenuEditAdvanced(wxCommandEvent &event);
void onMenuViewResetZoomAndPos(wxCommandEvent &event);
void onMenuViewGrid(wxCommandEvent &event);
void onMenuViewHeightMap(wxCommandEvent &event);
void onMenuHideWater(wxCommandEvent &event);
void onMenuViewAbout(wxCommandEvent &event);
void onMenuViewHelp(wxCommandEvent &event);
void onMenuBrushHeight(wxCommandEvent &event);
void onMenuBrushGradient(wxCommandEvent &event);
void onMenuBrushSurface(wxCommandEvent &event);
void onMenuBrushObject(wxCommandEvent &event);
void onMenuBrushResource(wxCommandEvent &event);
void onMenuBrushStartLocation(wxCommandEvent &event);
void onMenuRadius(wxCommandEvent &event);
void onToolPlayer(wxCommandEvent &event);
void change(int x, int y);
void uncheckBrush();
void uncheckRadius();
private:
bool isDirty() const {
return fileModified;
}
void setDirty(bool val = true);
void setExtension();
void setupStartupSettings();
void initGlCanvas();
};
// =====================================================
// class GlCanvas
// =====================================================
class GlCanvas : public wxGLCanvas {
private:
DECLARE_EVENT_TABLE()
public:
GlCanvas(MainWindow *mainWindow, wxWindow *parent, int *args);
~GlCanvas();
void onMouseDown(wxMouseEvent &event);
void onMouseMove(wxMouseEvent &event);
void onMouseWheel(wxMouseEvent &event);
void onKeyDown(wxKeyEvent &event);
void onPaint(wxPaintEvent &event);
void setCurrentGLContext();
private:
MainWindow *mainWindow;
wxGLContext *context;
};
// =====================================================
// class SimpleDialog
// =====================================================
class SimpleDialog : public wxDialog {
private:
typedef vector<pair<string, string> > Values;
private:
Values values;
public:
void addValue(const string &key, const string &value, const string &help = "");
string getValue(const string &key);
bool show(const string &title = "Edit values", bool wide = false);
};
// =====================================================
// class SimpleDialog
// =====================================================
class MsgDialog : public wxDialog {
private:
wxSizer *m_sizerText;
public:
MsgDialog(wxWindow *parent,
const wxString& message,
const wxString& caption,
long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCENTRE,
const wxPoint& pos = wxDefaultPosition);
virtual ~MsgDialog();
};
// =====================================================
// class App
// =====================================================
// =====================================================
// class App
// =====================================================
class App : public wxApp {
private:
MainWindow *mainWindow;
public:
App() : wxApp() {
mainWindow = NULL;
}
virtual ~App() {
}
virtual bool OnInit();
virtual int MainLoop();
virtual int OnExit();
};
} //end namespace
DECLARE_APP(MapEditor::App)
#endif

View File

@@ -0,0 +1,680 @@
// This file is part of Glest <https://github.com/Glest>
//
// Copyright (C) 2018 The Glest team
//
// Glest is a fork of MegaGlest <https://megaglest.org/>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>
#include "program.h"
#include "util.h"
#include <iostream>
#include "platform_util.h"
using namespace Shared::Util;
namespace MapEditor {
////////////////////////////
// class UndoPoint
////////////////////////////
int UndoPoint::w = 0;
int UndoPoint::h = 0;
UndoPoint::UndoPoint()
: change(ctNone)
, surface(0)
, object(0)
, resource(0)
, height(0) {
w = Program::map->getW();
h = Program::map->getH();
}
/*
UndoPoint::UndoPoint(ChangeType change) {
w = Program::map->getW();
h = Program::map->getH();
init(change);
}*/
void UndoPoint::init(ChangeType change) {
this->change = change;
switch (change) {
// Back up everything
case ctAll:
// Back up heights
case ctHeight:
case ctGradient:
// Build an array of heights from the map
//std::cout << "Building an array of heights to use for our UndoPoint" << std::endl;
height = new float[w * h];
for (int i = 0; i < w; ++i) {
for (int j = 0; j < h; ++j) {
height[j * w + i] = Program::map->getHeight(i, j);
}
}
//std::cout << "Built the array" << std::endl;
if (change != ctAll) break;
// Back up surfaces
case ctSurface:
surface = new int[w * h];
for (int i = 0; i < w; ++i) {
for (int j = 0; j < h; ++j) {
surface[j * w + i] = Program::map->getSurface(i, j);
}
}
if (change != ctAll) break;
// Back up both objects and resources if either changes
case ctObject:
case ctResource:
object = new int[w * h];
for (int i = 0; i < w; ++i) {
for (int j = 0; j < h; ++j) {
object[j * w + i] = Program::map->getObject(i, j);
}
}
resource = new int[w * h];
for (int i = 0; i < w; ++i) {
for (int j = 0; j < h; ++j) {
resource[j * w + i] = Program::map->getResource(i, j);
}
}
break;
}
}
UndoPoint::~UndoPoint() {
delete[] height;
delete[] resource;
delete[] object;
delete[] surface;
}
void UndoPoint::revert() {
//std::cout << "attempting to revert last changes to " << undoID << std::endl;
switch (change) {
// Revert Everything
case ctAll:
// Revert Heights
case ctHeight:
case ctGradient:
// Restore the array of heights to the map
//std::cout << "attempting to restore the height array" << std::endl;
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
Program::map->setHeight(i, j, height[j * w + i]);
}
}
if (change != ctAll) break;
// Revert surfaces
case ctSurface:
//std::cout << "attempting to restore the surface array" << std::endl;
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
Program::map->setSurface(i, j, static_cast<MapSurfaceType>(surface[j * w + i]));
}
}
if (change != ctAll) break;
// Revert objects and resources
case ctObject:
case ctResource:
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
Program::map->setObject(i, j, object[j * w + i]);
}
}
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
Program::map->setResource(i, j, resource[j * w + i]);
}
}
break;
}
//std::cout << "reverted changes (we hope)" << std::endl;
}
// ===============================================
// class Program
// ===============================================
MapPreview *Program::map = NULL;
Program::Program(int w, int h, string playerName) {
cellSize = 5;
grid = false;
heightmap = false;
hideWater = false;
ofsetX = 0;
ofsetY = 0;
map = new MapPreview();
resetFactions(8);
renderer.initMapSurface(w, h);
map->setAuthor(playerName);
}
void Program::init() {
undoStack = ChangeStack();
redoStack = ChangeStack();
cellSize = 5;
grid = false;
heightmap = false;
hideWater = false;
ofsetX = 0;
ofsetY = 0;
map = NULL;
}
Program::~Program() {
delete map;
map = NULL;
}
int Program::getObject(int x, int y) {
int i = (x - ofsetX) / cellSize;
int j = (y + ofsetY) / cellSize;
if (map && map->inside(i, j)) {
return map->getObject(i, j);
} else {
return 0;
}
}
int Program::getCellX(int x) {
return (x - ofsetX) / cellSize;
}
int Program::getCellY(int y) {
return (y + ofsetY) / cellSize;
}
int Program::getResource(int x, int y) {
int i = (x - ofsetX) / cellSize;
int j = (y + ofsetY) / cellSize;
if (map && map->inside(i, j)) {
return map->getResource(i, j);
} else {
return 0;
}
}
void Program::glestChangeMapHeight(int x, int y, int Height, int radius) {
if (map) map->glestChangeHeight((x - ofsetX) / cellSize, (y + ofsetY) / cellSize, Height, radius);
}
void Program::pirateChangeMapHeight(int x, int y, int Height, int radius) {
if (map) map->pirateChangeHeight((x - ofsetX) / cellSize, (y + ofsetY) / cellSize, Height, radius);
}
void Program::changeMapSurface(int x, int y, int surface, int radius) {
if (map) map->changeSurface((x - ofsetX) / cellSize, (y + ofsetY) / cellSize, static_cast<MapSurfaceType>(surface), radius);
}
void Program::changeMapObject(int x, int y, int object, int radius) {
if (map) map->changeObject((x - ofsetX) / cellSize, (y + ofsetY) / cellSize, object, radius);
}
void Program::changeMapResource(int x, int y, int resource, int radius) {
if (map) map->changeResource((x - ofsetX) / cellSize, (y + ofsetY) / cellSize, resource, radius);
}
void Program::changeStartLocation(int x, int y, int player) {
if (map) map->changeStartLocation((x - ofsetX) / cellSize, (y + ofsetY) / cellSize, player);
}
void Program::setUndoPoint(ChangeType change) {
if (change == ctLocation) return;
undoStack.push(UndoPoint());
undoStack.top().init(change);
redoStack.clear();
}
bool Program::undo() {
if (undoStack.empty()) {
return false;
}
// push current state onto redo stack
redoStack.push(UndoPoint());
redoStack.top().init(undoStack.top().getChange());
undoStack.top().revert();
undoStack.pop();
return true;
}
bool Program::redo() {
if (redoStack.empty()) {
return false;
}
// push current state onto undo stack
undoStack.push(UndoPoint());
undoStack.top().init(redoStack.top().getChange());
redoStack.top().revert();
redoStack.pop();
return true;
}
void Program::renderMap(int w, int h) {
//printf("Rendering map\n");
if (map) renderer.renderMap(map, ofsetX, ofsetY, w, h, cellSize, grid, heightmap, hideWater);
}
void Program::setRefAlt(int x, int y) {
if (map) map->setRefAlt((x - ofsetX) / cellSize, (y + ofsetY) / cellSize);
}
void Program::flipX() {
if (map) map->flipX();
}
void Program::flipY() {
if (map) map->flipY();
}
void Program::mirrorX() { // copy left to right
if (map) {
int w = map->getW();
int h = map->getH();
for (int i = 0; i < w / 2; i++) {
for (int j = 0; j < h; j++) {
map->copyXY(w - i - 1, j, i, j);
}
}
// move players
for (int i = 0; i < map->getMaxFactions(); ++i) // first remove players from target corner
if (map->getStartLocationX(i) >= w / 2) map->changeStartLocation(0, 0, i);
for (int i = 0; i < map->getMaxFactions(); ++i) {
if ((map->getStartLocationX(i) < w / 2) && (map->getStartLocationX(i) != 0 || map->getStartLocationY(i) != 0)) // any startpositions to copy?
for (int ii = 0; ii < map->getMaxFactions(); ++ii)
if (map->getStartLocationX(ii) == 0 && map->getStartLocationY(ii) == 0) { // first free one
map->changeStartLocation(w - map->getStartLocationX(i) - 1, map->getStartLocationY(i), ii);
break;
}
}
}
}
void Program::mirrorY() { // copy top to bottom
if (map) {
int w = map->getW();
int h = map->getH();
for (int i = 0; i < w; i++) {
for (int j = 0; j < h / 2; j++) {
map->copyXY(i, h - j - 1, i, j);
}
}
// move players
for (int i = 0; i < map->getMaxFactions(); ++i) // first remove players from target corner
if (map->getStartLocationY(i) >= h / 2) map->changeStartLocation(0, 0, i);
for (int i = 0; i < map->getMaxFactions(); ++i) {
if ((map->getStartLocationY(i) < h / 2) && (map->getStartLocationX(i) != 0 || map->getStartLocationY(i) != 0)) // any startpositions to copy?
for (int ii = 0; ii < map->getMaxFactions(); ++ii)
if (map->getStartLocationX(ii) == 0 && map->getStartLocationY(ii) == 0) { // first free one
map->changeStartLocation(map->getStartLocationX(i), h - map->getStartLocationY(i) - 1, ii);
break;
}
}
}
}
void Program::mirrorXY() { // copy leftbottom to topright, can handle non-sqaure maps
if (map) {
int w = map->getW();
int h = map->getH();
if (h == w) {
for (int i = 0; i < w - 1; i++) {
for (int j = i + 1; j < h; j++) {
map->copyXY(j, i, i, j);
}
}
}
// Non-sqaure maps:
else if (h < w) { // copy horizontal strips
int s = w / h; // 2 if twice as wide as heigh
for (int i = 0; i < w / s - 1; i++) {
for (int j = i + 1; j < h; j++) {
for (int p = 0; p < s; p++) map->copyXY(j*s + p, i, i*s + p, j);
}
}
} else { // copy vertical strips
int s = h / w; // 2 if twice as heigh as wide
for (int i = 0; i < w - 1; i++) {
for (int j = i + 1; j < h / s; j++) {
for (int p = 0; p < s; p++) map->copyXY(j, i*s + p, i, j*s + p);
}
}
}
// move players
for (int i = 0; i < map->getMaxFactions(); ++i) // first remove players from target corner
if (map->getStartLocationX(i) > map->getStartLocationY(i)) map->changeStartLocation(0, 0, i);
for (int i = 0; i < map->getMaxFactions(); ++i) {
if (map->getStartLocationX(i) < map->getStartLocationY(i)) // any startpositions to copy?
for (int ii = 0; ii < map->getMaxFactions(); ++ii)
if (map->getStartLocationX(ii) == 0 && map->getStartLocationY(ii) == 0) { // first free one
map->changeStartLocation(map->getStartLocationY(i)*w / h, map->getStartLocationX(i)*h / w, ii);
break;
}
}
}
}
void Program::rotatecopyX() {
if (map) {
int w = map->getW();
int h = map->getH();
for (int i = 0; i < w / 2; i++) {
for (int j = 0; j < h; j++) {
map->copyXY(w - i - 1, h - j - 1, i, j);
}
}
// move players
for (int i = 0; i < map->getMaxFactions(); ++i) // first remove players from target corner
if (map->getStartLocationX(i) >= w / 2) map->changeStartLocation(0, 0, i);
for (int i = 0; i < map->getMaxFactions(); ++i) {
if ((map->getStartLocationX(i) < w / 2) && (map->getStartLocationX(i) != 0 || map->getStartLocationY(i) != 0)) // any startpositions to copy?
for (int ii = 0; ii < map->getMaxFactions(); ++ii)
if (map->getStartLocationX(ii) == 0 && map->getStartLocationY(ii) == 0) { // first free one
map->changeStartLocation(w - map->getStartLocationX(i) - 1, h - map->getStartLocationY(i) - 1, ii);
break;
}
}
}
}
void Program::rotatecopyY() {
if (map) {
int w = map->getW();
int h = map->getH();
for (int i = 0; i < w; i++) {
for (int j = 0; j < h / 2; j++) {
map->copyXY(w - i - 1, h - j - 1, i, j);
}
}
// move players
for (int i = 0; i < map->getMaxFactions(); ++i) // first remove players from target corner
if (map->getStartLocationY(i) >= h / 2) map->changeStartLocation(0, 0, i);
for (int i = 0; i < map->getMaxFactions(); ++i) {
if ((map->getStartLocationY(i) < h / 2) && (map->getStartLocationX(i) != 0 || map->getStartLocationY(i) != 0)) // any startpositions to copy?
for (int ii = 0; ii < map->getMaxFactions(); ++ii)
if (map->getStartLocationX(ii) == 0 && map->getStartLocationY(ii) == 0) { // first free one
map->changeStartLocation(w - map->getStartLocationX(i) - 1, h - map->getStartLocationY(i) - 1, ii);
break;
}
}
}
}
void Program::rotatecopyXY() {
if (map) {
int w = map->getW();
int h = map->getH();
int sw = w / h; if (sw < 1) sw = 1; // x-squares per y
int sh = h / w; if (sh < 1) sh = 1; // y-squares per x
if (sh == 1)
for (int j = 0; j < h - 1; j++) { // row by row!
for (int i = j*sw; i < w; i++) {
map->copyXY(i, j, w - i - 1, h - j - 1);
}
} else
for (int i = 0; i < w; i++) { // column for colum!
for (int j = h - 1 - i*sh; j >= 0; j--) {
map->copyXY(w - i - 1, j, i, h - j - 1);
}
}
// move players
for (int i = 0; i < map->getMaxFactions(); ++i) // first remove players from target corner
if (map->getStartLocationX(i) > map->getStartLocationY(i)) map->changeStartLocation(0, 0, i);
for (int i = 0; i < map->getMaxFactions(); ++i) {
if (map->getStartLocationX(i) < map->getStartLocationY(i)) // any startpositions to copy?
for (int ii = 0; ii < map->getMaxFactions(); ++ii)
if (map->getStartLocationX(ii) == 0 && map->getStartLocationY(ii) == 0) { // first free one
map->changeStartLocation(w - map->getStartLocationX(i) - 1, h - map->getStartLocationY(i) - 1, ii);
break;
}
}
}
}
void Program::rotatecopyCorner() { // rotate top left 1/4 to top right 1/4
if (map) {
int w = map->getW();
int h = map->getH();
if (h == w) {
for (int i = 0; i < w / 2; i++) {
for (int j = 0; j < h / 2; j++) {
map->copyXY(w - j - 1, i, i, j);
}
}
}
// Non-sqaure maps:
else if (h < w) { // copy horizontal strips
int s = w / h; // 2 if twice as wide as heigh
for (int i = 0; i < w / s / 2; i++) {
for (int j = 0; j < h / 2; j++) {
for (int p = 0; p < s; p++) map->copyXY(w - j*s - 1 - p, i, i*s + p, j);
}
}
} else { // copy vertical strips
int s = h / w; // 2 if twice as heigh as wide
for (int i = 0; i < w / 2; i++) {
for (int j = 0; j < h / s / 2; j++) {
for (int p = 0; p < s; p++) map->copyXY(w - j - 1, i*s + p, i, j*s + p);
}
}
}
// move players
for (int i = 0; i < map->getMaxFactions(); ++i) // first remove players from target corner
if (map->getStartLocationX(i) >= w / 2 && map->getStartLocationY(i) < h / 2) map->changeStartLocation(0, 0, i);
for (int i = 0; i < map->getMaxFactions(); ++i) {
if ((map->getStartLocationX(i) < w / 2 && map->getStartLocationY(i) < h / 2) && (map->getStartLocationX(i) != 0 || map->getStartLocationY(i) != 0)) // any startpositions to copy?
for (int ii = 0; ii < map->getMaxFactions(); ++ii)
if (map->getStartLocationX(ii) == 0 && map->getStartLocationY(ii) == 0) { // first free one
map->changeStartLocation(w - map->getStartLocationY(i)*w / h - 1, map->getStartLocationX(i)*h / w, ii);
break;
}
}
}
}
void Program::shiftLeft() {
if (map) {
int w = map->getW() - 1;
int h = map->getH();
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
map->copyXY(i, j, i + 1, j);
for (int i = 0; i < map->getMaxFactions(); ++i) // move players
map->changeStartLocation(map->getStartLocationX(i) - 1, map->getStartLocationY(i), i); // it allready check limits
}
}
void Program::flipDiagonal() {
if (map) {
int w = map->getW();
int h = map->getH();
for (int i = 0; i < w; i++)
for (int j = i; j < h; j++) {
map->swapXY(i, j, j, i);
}
for (int i = 0; i < map->getMaxFactions(); ++i) // move players
if (map->getStartLocationX(i) != 0 || map->getStartLocationY(i) != 0) // don't move the unset ones
map->changeStartLocation(map->getStartLocationY(i), map->getStartLocationX(i), i); // it allready check limits
}
}
void Program::shiftRight() {
if (map) {
int w = map->getW() - 1;
int h = map->getH();
for (int i = w; i > 0; i--)
for (int j = 0; j < h; j++)
map->copyXY(i, j, i - 1, j);
for (int i = 0; i < map->getMaxFactions(); ++i) // move players
if (map->getStartLocationX(i) != 0 || map->getStartLocationY(i) != 0) // don't move the unset ones
map->changeStartLocation(map->getStartLocationX(i) + 1, map->getStartLocationY(i), i); // it allready check limits
}
}
void Program::shiftUp() {
if (map) {
int w = map->getW();
int h = map->getH() - 1;
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
map->copyXY(i, j, i, j + 1);
for (int i = 0; i < map->getMaxFactions(); ++i) // move players
map->changeStartLocation(map->getStartLocationX(i), map->getStartLocationY(i) - 1, i); // it allready check limits
}
}
void Program::shiftDown() {
if (map) {
int w = map->getW();
int h = map->getH() - 1;
for (int i = 0; i < w; i++)
for (int j = h; j > 0; j--)
map->copyXY(i, j, i, j - 1);
for (int i = 0; i < map->getMaxFactions(); ++i) // move players
if (map->getStartLocationX(i) != 0 || map->getStartLocationY(i) != 0) // don't move the unset ones
map->changeStartLocation(map->getStartLocationX(i), map->getStartLocationY(i) + 1, i); // it allready check limits
}
}
void Program::randomizeMapHeights(bool withReset, int minimumHeight, int maximumHeight, int chanceDivider, int smoothRecursions) {
if (map) map->randomizeHeights(withReset, minimumHeight, maximumHeight, chanceDivider, smoothRecursions);
}
void Program::randomizeFactions() {
if (map) map->randomizeFactions();
}
void Program::switchMapSurfaces(int surf1, int surf2) {
if (map) map->switchSurfaces(static_cast<MapSurfaceType>(surf1), static_cast<MapSurfaceType>(surf2));
}
void Program::reset(int w, int h, int alt, int surf) {
undoStack.clear();
redoStack.clear();
if (map) map->reset(w, h, (float) alt, static_cast<MapSurfaceType>(surf));
}
void Program::resize(int w, int h, int alt, int surf) {
if (map) map->resize(w, h, (float) alt, static_cast<MapSurfaceType>(surf));
}
void Program::resetFactions(int maxFactions) {
if (map) map->resetFactions(maxFactions);
randomizeFactions();
}
bool Program::setMapTitle(const string &title) {
if (map) {
if (map->getTitle() != title) {
map->setTitle(title);
return true;
}
}
return false;
}
bool Program::setMapDesc(const string &desc) {
if (map) {
if (map->getDesc() != desc) {
map->setDesc(desc);
return true;
}
}
return false;
}
bool Program::setMapAuthor(const string &author) {
if (map) {
if (map->getAuthor() != author) {
map->setAuthor(author);
return true;
}
}
return false;
}
void Program::setOfset(int x, int y) {
ofsetX += x;
ofsetY -= y;
}
void Program::incCellSize(int i) {
if (map) {
int minInc = 2 - cellSize;
if (i < minInc) {
i = minInc;
}
cellSize += i;
ofsetX -= (map->getW() * i) / 2;
ofsetY += (map->getH() * i) / 2;
}
}
void Program::resetOfset() {
ofsetX = 0;
ofsetY = 0;
cellSize = 5;
}
bool Program::setGridOnOff() {
grid = !grid;
return grid;
}
bool Program::setHeightMapOnOff() {
heightmap = !heightmap;
return heightmap;
}
bool Program::setHideWaterOnOff() {
hideWater = !hideWater;
return hideWater;
}
void Program::setMapAdvanced(int altFactor, int waterLevel, int cliffLevel, int cameraHeight) {
if (map) map->setAdvanced(altFactor, waterLevel, cliffLevel, cameraHeight);
}
void Program::loadMap(const string &path) {
undoStack.clear();
redoStack.clear();
std::string encodedPath = path;
map->loadFromFile(encodedPath);
}
void Program::saveMap(const string &path) {
if (map) {
std::string encodedPath = path;
map->saveToFile(encodedPath);
}
}
} //end namespace

199
source/map_editor/program.h Normal file
View File

@@ -0,0 +1,199 @@
// This file is part of Glest <https://github.com/Glest>
//
// Copyright (C) 2018 The Glest team
//
// Glest is a fork of MegaGlest <https://megaglest.org/>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>
#ifndef _MAPEDITOR_PROGRAM_H_
#define _MAPEDITOR_PROGRAM_H_
//#include "map.h"
#include "map_preview.h"
//#include "renderer.h"
#include "base_renderer.h"
#include <stack>
using std::stack;
using namespace Shared::Map;
using namespace Shared::Graphics;
namespace MapEditor {
class MainWindow;
enum ChangeType {
ctNone = -1,
ctHeight,
ctSurface,
ctObject,
ctResource,
ctLocation,
ctGradient,
ctAll
};
// =============================================
// class Undo Point
// A linked list class that is more of an extension / modification on
// the already existing Cell struct in map.h
// Provides the ability to only specify a certain property of the map to change
// =============================================
class UndoPoint {
private:
// Only keep a certain number of undo points in memory otherwise
// Big projects could hog a lot of memory
const static int MAX_UNDO_LIST_SIZE = 100;
static int undoCount;
ChangeType change;
// Pointers to arrays of each property
int *surface;
int *object;
int *resource;
float *height;
// Map width and height
static int w;
static int h;
public:
UndoPoint();
~UndoPoint();
void init(ChangeType change);
void revert();
inline ChangeType getChange() const {
return change;
}
};
class ChangeStack : public std::stack<UndoPoint> {
public:
static const unsigned int maxSize = 100;
ChangeStack() : std::stack<UndoPoint>() {
}
void clear() {
c.clear();
}
void push(UndoPoint p) {
if (c.size() >= maxSize) {
c.pop_front();
}
stack<UndoPoint>::push(p);
}
};
// ===============================================
// class Program
// ===============================================
class Program {
private:
//Renderer renderer;
BaseRenderer renderer;
int ofsetX, ofsetY;
int cellSize;
bool grid; // show grid option
bool heightmap;
bool hideWater;
//static Map *map;
static MapPreview *map;
friend class UndoPoint;
ChangeStack undoStack, redoStack;
void init();
public:
Program(int w, int h, string playerName);
~Program();
Program(const Program& obj) {
init();
throw runtime_error("class Program is NOT safe to copy!");
}
Program & operator=(const Program& obj) {
init();
throw runtime_error("class Program is NOT safe to assign!");
}
//map cell change
void glestChangeMapHeight(int x, int y, int Height, int radius);
void pirateChangeMapHeight(int x, int y, int Height, int radius);
void changeMapSurface(int x, int y, int surface, int radius);
void changeMapObject(int x, int y, int object, int radius);
void changeMapResource(int x, int y, int resource, int radius);
void changeStartLocation(int x, int y, int player);
void setUndoPoint(ChangeType change);
bool undo();
bool redo();
//map ops
void reset(int w, int h, int alt, int surf);
void resize(int w, int h, int alt, int surf);
void resetFactions(int maxFactions);
void setRefAlt(int x, int y);
void flipX();
void flipY();
void mirrorX();
void mirrorY();
void mirrorXY();
void rotatecopyX();
void rotatecopyY();
void rotatecopyXY();
void rotatecopyCorner();
void flipDiagonal();
void shiftLeft();
void shiftRight();
void shiftUp();
void shiftDown();
void randomizeMapHeights(bool withReset, int minimumHeight, int maximumHeight, int chanceDivider, int smoothRecursions);
void randomizeFactions();
void switchMapSurfaces(int surf1, int surf2);
void loadMap(const string &path);
void saveMap(const string &path);
//map misc
bool setMapTitle(const string &title);
bool setMapDesc(const string &desc);
bool setMapAuthor(const string &author);
void setMapAdvanced(int altFactor, int waterLevel, int minimumCliffHeight, int cameraHeight);
//misc
void renderMap(int w, int h);
void setOfset(int x, int y);
void incCellSize(int i);
void resetOfset();
bool setGridOnOff();
bool setHeightMapOnOff();
bool setHideWaterOnOff();
int getObject(int x, int y);
int getResource(int x, int y);
int getCellX(int x);
int getCellY(int y);
static const MapPreview *getMap() {
return map;
}
};
} //end namespace
#endif