Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,39 @@
*.dll
*.def
*.exe
*.so
*.a
*.pc
*.cmake
/lib/slang*
/mapslang/pkg/*
mapslang/mapslang
mapslang/map
map
.vs/
.git
/.cproject
/.project
/.settings/
/tmp/
/build/
Makefile
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
install_manifest.txt
libadikted/CMakeFiles/
libadikted/CMakeCache.txt
libadikted/Makefile
libadikted/cmake_install.cmake
libadikted/install_manifest.txt
mapslang/CMakeFiles/
mapslang/CMakeCache.txt
mapslang/cmake_install.cmake
mapslang/Makefile
mapslang/install_manifest.txt
mapslang/map
putemple
puttrain
putgems
viewmap
71 changes: 71 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
cmake_minimum_required( VERSION 3.1 )

project( ADiKtED LANGUAGES C )
set(PROJECT_DESCRIPTION "Dungeon Keeper 1 map editor")

include(GNUInstallDirs)
include(FindPkgConfig)

if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE )
endif()

set( CMAKE_C_STANDARD 99 )
set( CMAKE_C_STANDARD_REQUIRED ON )
set( CMAKE_C_STANDARD_LIBRARIES_INIT "-lm ${CMAKE_DL_LIBS}" )

set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-switch" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror-implicit-function-declaration -Wno-conversion -Wno-traditional-conversion -Wno-sign-compare" )

add_subdirectory(libadikted)
add_subdirectory(mapslang)

function( add_example ARG_NAME )
list( APPEND ARG_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/examples/${ARG_NAME}" )
set( SOURCES "" )
set( RESOURCES "" )
foreach( DIR ${ARG_DIRECTORIES} )
file( GLOB GLOB_SOURCES ${DIR}/*.c ${DIR}/*.h )
list( APPEND SOURCES ${GLOB_SOURCES} )
file( GLOB GLOB_RESOURCES ${DIR}/*.rc )
list( APPEND RESOURCES ${GLOB_RESOURCES} )
endforeach()
add_executable( ${ARG_NAME} ${SOURCES} )
target_link_libraries( ${ARG_NAME} PUBLIC
adikted ${CMAKE_C_STANDARD_LIBRARIES} )
find_package( SDL REQUIRED )
target_link_libraries( ${ARG_NAME} PUBLIC ${SDL_LIBRARY} ${CMAKE_C_STANDARD_LIBRARIES} )
target_compile_definitions( ${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_SDL )
target_link_libraries( ${ARG_NAME} PUBLIC X11 )
target_include_directories(${ARG_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/examples/putgems>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/lib${TARGET_NAME}>
${SDL_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/.)

# Directory name
set_target_properties( ${ARG_NAME} PROPERTIES FOLDER
"${CMAKE_CURRENT_SOURCE_DIR}/examples" )
add_test(${ARG_NAME} ${ARG_NAME})
endfunction()

option( ADIKTED_BUILD_EXAMPLES "Build ADiKtEd examples" ON )
if( ADIKTED_BUILD_EXAMPLES )
# Add examples
set(
ADIKTED_EXAMPLES
putgems
puttrain
viewmap
putemple
)

foreach( EXAMPLE ${ADIKTED_EXAMPLES} )
add_example( ${EXAMPLE} )
endforeach()
endif()

install( TARGETS ${ADIKTED_EXAMPLES} RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT binaries)
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Adikted Dungeon Keeper Map Editor

Note - there is now a manual available for ADiKtEd.
It even includes a basic tutorial to quickly learn the program.
A version of it is included within this distribution,
called `dk_adikted_manual.htm`. You may wish to print this out.
## Build

### Unix-like systems

#### CMake

Run
`cmake --install-prefix=/usr . && make install`
and copy the examples to the keeperfx directory

### Windows

#### make

Run `make -f Makefile.win`

Here's the Win32 version executable. Just put all the
files in the same directory, edit map.ini as appropriate (you should
change paths to your DK files; you can also change other parameters
if you want), and run it.

## Usage

Run `map [mapfile] [-m <logfile>] [-v] [-r] [-n] [-s [mapfile]] [-q]`

When ADiKtEd saves a map, it will ask you what you wish to call it
(unless you're not using quick save). I suggest you don't save
directly over the Dungeon Keeper original levels, but keep it
in the current directory until you're finished.
Then, at end, save it on `map00001` to access it easily in the game.

You'll need a level script for your newly created level. You may be
able to get by with the script which comes with the original level 1
- ie just copy it and paste into TXT file of your new map - but
if not, study the level scripts reference from `dk_scripting_ref.htm`.
You can also try looking at the original DK and DD levels for examples.

Press F1 for help.

## TODO before final
Fixations in room things parameters (height,other)
Fixations in room corner graphics

## Author
Jon Skeet, skeet@pobox.com

Dev-C++ IDE version,
rewritten most of the code:
Tomasz Lis
File renamed without changes.
10 changes: 5 additions & 5 deletions example4/putemple.c → examples/putemple/putemple.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/******************************************************************************/
/** @file putemple.c
* ADiKtEd library example 4.
* ADiKtEd library putemple example.
* @par Purpose:
* Demonstrates fast drawing routines and putting slabs with mouse.
* Also, shows how to draw ADiKtEd messages using DK font.
Expand All @@ -23,7 +23,7 @@
#include <string.h>
#include <SDL/SDL.h>

#include "../libadikted/adikted.h"
#include "libadikted/adikted.h"

#define ONE_LOOP_DELAY 20
/**
Expand Down Expand Up @@ -404,7 +404,7 @@ static void process_events()
// contains error message.
// Release the error message.
message_release();
message_info("example4 finished with map load error");
message_info("putemple finished with map load error");
reload_data=0;
level_redraw=0;
clip_view=0;
Expand All @@ -425,7 +425,7 @@ static void process_events()
{
// Release the error message.
message_release();
message_info("example4 finished with data files load error");
message_info("putemple finished with data files load error");
level_redraw=0;
clip_view=0;
done = 1;
Expand Down Expand Up @@ -493,7 +493,7 @@ int main (int argc, char *argv[])
free_messages();
return 2;
}
SDL_WM_SetCaption ("ADiKtEd Libray example 4", NULL);
SDL_WM_SetCaption ("ADiKtEd Libray putemple example", NULL);

message_log("Preparing data structures");
// create object for storing map
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions example1/putgems.c → examples/putgems/putgems.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/******************************************************************************/
/** @file putgems.c
* ADiKtEd library example 1.
* ADiKtEd library putgems example.
* @par Purpose:
* This example puts gems on center of gold vein in map 1.
* Demonstrates how to load/save map, and how to change slabs.
Expand All @@ -19,7 +19,7 @@
#include <stdio.h>
#include <stdlib.h>

#include "../libadikted/adikted.h"
#include "libadikted/adikted.h"

int main(int argc, char *argv[])
{
Expand All @@ -34,7 +34,7 @@ int main(int argc, char *argv[])
// but still they have to be initialized)
init_messages();

printf("\nexample1: how to put gems on map\n\n");
printf("\nputgems: how to put gems on map\n\n");

// Setting file name of the map to load
format_lvl_fname(lvl,"Levels/MAP00001");
Expand All @@ -46,7 +46,7 @@ int main(int argc, char *argv[])
if (result!=ERR_NONE)
{
printf("cannot load map\n");
printf("example1 finished with error\n");
printf("putgems finished with error\n");
system("pause");

// The following two commands should be used to free memory
Expand All @@ -72,7 +72,7 @@ int main(int argc, char *argv[])
if (result!=ERR_NONE)
{
printf("cannot save map\n");
printf("example1 finished with error\n");
printf("putgems finished with error\n");
system("pause");

// The following two commands should be used to free memory
Expand All @@ -85,7 +85,7 @@ int main(int argc, char *argv[])
return 1;
}
printf("map \"%s\" saved\n", get_lvl_savfname(lvl));
printf("example1 finished successfully\n");
printf("putgems finished successfully\n");
system("pause");

// The following two commands should be used to free memory
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions example2/puttrain.c → examples/puttrain/puttrain.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/******************************************************************************/
/** @file puttrain.c
* ADiKtEd library example 2.
* ADiKtEd library puttrain example.
* @par Purpose:
* This example puts 3x5 training room in bottom right part of map 1.
* Demonstrates how to change many slabs at once,
Expand All @@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>

#include "../libadikted/adikted.h"
#include "libadikted/adikted.h"

int main(int argc, char *argv[])
{
Expand All @@ -36,7 +36,7 @@ int main(int argc, char *argv[])

// Instead of printing the message directly, we will send it
// to the internal messages system.
message_info("example2: how to put a larger room on map");
message_info("puttrain: how to put a larger room on map");
// Now we can easily get the message back, even multiple times.
printf("%s\n",message_get());

Expand Down Expand Up @@ -74,7 +74,7 @@ int main(int argc, char *argv[])

// Now, as the buffer is released, the message_info() function
// can be used to store next message.
message_info("example2 finished with load error");
message_info("puttrain finished with load error");
printf("%s\n",message_get());
system("pause");

Expand Down Expand Up @@ -118,7 +118,7 @@ int main(int argc, char *argv[])

// Now, as the buffer is released, the message_info() function
// can be used to store next message.
message_info("example2 finished with save error");
message_info("puttrain finished with save error");
printf("%s\n",message_get());
system("pause");

Expand All @@ -138,7 +138,7 @@ int main(int argc, char *argv[])
printf("%s\n",message_get());
message_release();

message_info("example2 finished successfully");
message_info("puttrain finished successfully");
printf("%s\n",message_get());
system("pause");

Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions example3/viewmap.c → examples/viewmap/viewmap.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/******************************************************************************/
/** @file viewmap.c
* ADiKtEd library example 3.
* ADiKtEd library viewmap example.
* @par Purpose:
* This example shows how to view maps graphically using libAdikted.
* Move with mouse, zoom with numpad +/-.
Expand All @@ -22,7 +22,7 @@
#include <string.h>
#include <SDL/SDL.h>

#include "../libadikted/adikted.h"
#include "libadikted/adikted.h"

#define ONE_LOOP_DELAY 32
/**
Expand Down Expand Up @@ -279,7 +279,7 @@ static void process_events()
// Release the error message.
message_release();

message_info("example3 finished with data files load error");
message_info("viewmap finished with data files load error");

clip_view=0;
done = 1;
Expand Down Expand Up @@ -339,7 +339,7 @@ int main (int argc, char *argv[])
free_messages();
return 2;
}
SDL_WM_SetCaption ("ADiKtEd Libray example 3", NULL);
SDL_WM_SetCaption ("ADiKtEd Libray viewmap example", NULL);

// create object for storing map
level_init(&lvl,MFV_DKGOLD,NULL);
Expand All @@ -365,7 +365,7 @@ int main (int argc, char *argv[])
// Release the error message.
message_release();

message_info("example3 finished with map load error");
message_info("viewmap finished with map load error");

level_free(lvl);
level_deinit(&lvl);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading