From 2f931aefc8c52bf47883f8a8a689553f70c5a3e2 Mon Sep 17 00:00:00 2001 From: Mloc-Argent Date: Mon, 13 Jan 2014 22:38:11 +0000 Subject: [PATCH] Big(gish) map reorganization. Moved all main .dmm maps to _maps/map_files Each main map gets a .dm file in _maps, this is what's ticked, -NOT- the .dmm file. This allows use of a MAP_NAME define for various purposes, and lays the groundwork for map customization in the future. Also included a hacky dm.sh script which supports swapping maps. For example, "./dm.sh tgstation.dme -Mmetastation" would compile with metastation. Signed-off-by: Mloc-Argent --- {maps => _maps}/RandomZLevels/Academy.dmm | 0 {maps => _maps}/RandomZLevels/beach.dmm | 0 .../RandomZLevels/blackmarketpackers.dmm | 0 {maps => _maps}/RandomZLevels/centcomAway.dmm | 0 {maps => _maps}/RandomZLevels/challenge.dmm | 0 {maps => _maps}/RandomZLevels/example.dmm | 0 {maps => _maps}/RandomZLevels/fileList.txt | 22 ++--- .../RandomZLevels/listeningpost.dmm | 0 {maps => _maps}/RandomZLevels/spacebattle.dmm | 0 {maps => _maps}/RandomZLevels/spacehotel.dmm | 0 .../RandomZLevels/stationCollision.dmm | 0 {maps => _maps}/RandomZLevels/wildwest.dmm | 0 .../map_files}/MetaStation.v39A.III.dmm | 0 {maps => _maps/map_files}/tgstation.2.1.2.dmm | 0 _maps/metastation.dm | 8 ++ _maps/tgstation2.dm | 8 ++ .../awaymissions/mission_code}/Academy.dm | 0 .../mission_code}/blackmarketpackers.dm | 0 .../awaymissions/mission_code}/centcomAway.dm | 0 .../awaymissions/mission_code}/challenge.dm | 0 .../awaymissions/mission_code}/spacebattle.dm | 0 .../mission_code}/stationCollision.dm | 0 .../awaymissions/mission_code}/wildwest.dm | 0 code/modules/awaymissions/zlevel.dm | 2 +- code/world.dm | 18 ++-- dm.sh | 88 +++++++++++++++++++ tgstation.dme | 16 ++-- 27 files changed, 129 insertions(+), 33 deletions(-) rename {maps => _maps}/RandomZLevels/Academy.dmm (100%) rename {maps => _maps}/RandomZLevels/beach.dmm (100%) rename {maps => _maps}/RandomZLevels/blackmarketpackers.dmm (100%) rename {maps => _maps}/RandomZLevels/centcomAway.dmm (100%) rename {maps => _maps}/RandomZLevels/challenge.dmm (100%) rename {maps => _maps}/RandomZLevels/example.dmm (100%) rename {maps => _maps}/RandomZLevels/fileList.txt (60%) rename {maps => _maps}/RandomZLevels/listeningpost.dmm (100%) rename {maps => _maps}/RandomZLevels/spacebattle.dmm (100%) rename {maps => _maps}/RandomZLevels/spacehotel.dmm (100%) rename {maps => _maps}/RandomZLevels/stationCollision.dmm (100%) rename {maps => _maps}/RandomZLevels/wildwest.dmm (100%) rename {maps => _maps/map_files}/MetaStation.v39A.III.dmm (100%) rename {maps => _maps/map_files}/tgstation.2.1.2.dmm (100%) create mode 100644 _maps/metastation.dm create mode 100644 _maps/tgstation2.dm rename {maps/RandomZLevels => code/modules/awaymissions/mission_code}/Academy.dm (100%) rename {maps/RandomZLevels => code/modules/awaymissions/mission_code}/blackmarketpackers.dm (100%) rename {maps/RandomZLevels => code/modules/awaymissions/mission_code}/centcomAway.dm (100%) rename {maps/RandomZLevels => code/modules/awaymissions/mission_code}/challenge.dm (100%) rename {maps/RandomZLevels => code/modules/awaymissions/mission_code}/spacebattle.dm (100%) rename {maps/RandomZLevels => code/modules/awaymissions/mission_code}/stationCollision.dm (100%) rename {maps/RandomZLevels => code/modules/awaymissions/mission_code}/wildwest.dm (100%) create mode 100644 dm.sh diff --git a/maps/RandomZLevels/Academy.dmm b/_maps/RandomZLevels/Academy.dmm similarity index 100% rename from maps/RandomZLevels/Academy.dmm rename to _maps/RandomZLevels/Academy.dmm diff --git a/maps/RandomZLevels/beach.dmm b/_maps/RandomZLevels/beach.dmm similarity index 100% rename from maps/RandomZLevels/beach.dmm rename to _maps/RandomZLevels/beach.dmm diff --git a/maps/RandomZLevels/blackmarketpackers.dmm b/_maps/RandomZLevels/blackmarketpackers.dmm similarity index 100% rename from maps/RandomZLevels/blackmarketpackers.dmm rename to _maps/RandomZLevels/blackmarketpackers.dmm diff --git a/maps/RandomZLevels/centcomAway.dmm b/_maps/RandomZLevels/centcomAway.dmm similarity index 100% rename from maps/RandomZLevels/centcomAway.dmm rename to _maps/RandomZLevels/centcomAway.dmm diff --git a/maps/RandomZLevels/challenge.dmm b/_maps/RandomZLevels/challenge.dmm similarity index 100% rename from maps/RandomZLevels/challenge.dmm rename to _maps/RandomZLevels/challenge.dmm diff --git a/maps/RandomZLevels/example.dmm b/_maps/RandomZLevels/example.dmm similarity index 100% rename from maps/RandomZLevels/example.dmm rename to _maps/RandomZLevels/example.dmm diff --git a/maps/RandomZLevels/fileList.txt b/_maps/RandomZLevels/fileList.txt similarity index 60% rename from maps/RandomZLevels/fileList.txt rename to _maps/RandomZLevels/fileList.txt index 2213f6a6d1e..8b4138a1c7e 100644 --- a/maps/RandomZLevels/fileList.txt +++ b/_maps/RandomZLevels/fileList.txt @@ -7,14 +7,14 @@ #Do NOT tick the maps during compile -- the game uses this list to decide which map to load. Ticking the maps will result in them ALL being loaded at once. #DO tick the associated code file for the away mission you are enabling. Otherwise, the map will be trying to reference objects which do not exist, which will cause runtime errors! -#maps/RandomZLevels/example.dmm -#maps/RandomZLevels/blackmarketpackers.dmm -#maps/RandomZLevels/stationCollision.dmm -#maps/RandomZLevels/spacebattle.dmm -#maps/RandomZLevels/beach.dmm -#maps/RandomZLevels/Academy.dmm -#maps/RandomZLevels/wildwest.dmm -#maps/RandomZLevels/challenge.dmm -#maps/RandomZLevels/listeningpost.dmm -#maps/RandomZLevels/spacehotel.dmm -#maps/RandomZLevels/centcomAway.dmm \ No newline at end of file +#_maps/RandomZLevels/example.dmm +#_maps/RandomZLevels/blackmarketpackers.dmm +#_maps/RandomZLevels/stationCollision.dmm +#_maps/RandomZLevels/spacebattle.dmm +#_maps/RandomZLevels/beach.dmm +#_maps/RandomZLevels/Academy.dmm +#_maps/RandomZLevels/wildwest.dmm +#_maps/RandomZLevels/challenge.dmm +#_maps/RandomZLevels/listeningpost.dmm +#_maps/RandomZLevels/spacehotel.dmm +#_maps/RandomZLevels/centcomAway.dmm \ No newline at end of file diff --git a/maps/RandomZLevels/listeningpost.dmm b/_maps/RandomZLevels/listeningpost.dmm similarity index 100% rename from maps/RandomZLevels/listeningpost.dmm rename to _maps/RandomZLevels/listeningpost.dmm diff --git a/maps/RandomZLevels/spacebattle.dmm b/_maps/RandomZLevels/spacebattle.dmm similarity index 100% rename from maps/RandomZLevels/spacebattle.dmm rename to _maps/RandomZLevels/spacebattle.dmm diff --git a/maps/RandomZLevels/spacehotel.dmm b/_maps/RandomZLevels/spacehotel.dmm similarity index 100% rename from maps/RandomZLevels/spacehotel.dmm rename to _maps/RandomZLevels/spacehotel.dmm diff --git a/maps/RandomZLevels/stationCollision.dmm b/_maps/RandomZLevels/stationCollision.dmm similarity index 100% rename from maps/RandomZLevels/stationCollision.dmm rename to _maps/RandomZLevels/stationCollision.dmm diff --git a/maps/RandomZLevels/wildwest.dmm b/_maps/RandomZLevels/wildwest.dmm similarity index 100% rename from maps/RandomZLevels/wildwest.dmm rename to _maps/RandomZLevels/wildwest.dmm diff --git a/maps/MetaStation.v39A.III.dmm b/_maps/map_files/MetaStation.v39A.III.dmm similarity index 100% rename from maps/MetaStation.v39A.III.dmm rename to _maps/map_files/MetaStation.v39A.III.dmm diff --git a/maps/tgstation.2.1.2.dmm b/_maps/map_files/tgstation.2.1.2.dmm similarity index 100% rename from maps/tgstation.2.1.2.dmm rename to _maps/map_files/tgstation.2.1.2.dmm diff --git a/_maps/metastation.dm b/_maps/metastation.dm new file mode 100644 index 00000000000..7ca1d076ef0 --- /dev/null +++ b/_maps/metastation.dm @@ -0,0 +1,8 @@ +#ifndef MAP_FILE + + #include "map_files\MetaStation.v39A.III.dmm" + + #define MAP_FILE "MetaStation.v39A.III.dmm" + #define MAP_NAME "MetaStation" + +#endif diff --git a/_maps/tgstation2.dm b/_maps/tgstation2.dm new file mode 100644 index 00000000000..01d34bddb87 --- /dev/null +++ b/_maps/tgstation2.dm @@ -0,0 +1,8 @@ +#ifndef MAP_FILE + + #include "map_files\tgstation.2.1.2.dmm" + + #define MAP_FILE "tgstation.2.1.2.dmm" + #define MAP_NAME "/tg/station 2" + +#endif diff --git a/maps/RandomZLevels/Academy.dm b/code/modules/awaymissions/mission_code/Academy.dm similarity index 100% rename from maps/RandomZLevels/Academy.dm rename to code/modules/awaymissions/mission_code/Academy.dm diff --git a/maps/RandomZLevels/blackmarketpackers.dm b/code/modules/awaymissions/mission_code/blackmarketpackers.dm similarity index 100% rename from maps/RandomZLevels/blackmarketpackers.dm rename to code/modules/awaymissions/mission_code/blackmarketpackers.dm diff --git a/maps/RandomZLevels/centcomAway.dm b/code/modules/awaymissions/mission_code/centcomAway.dm similarity index 100% rename from maps/RandomZLevels/centcomAway.dm rename to code/modules/awaymissions/mission_code/centcomAway.dm diff --git a/maps/RandomZLevels/challenge.dm b/code/modules/awaymissions/mission_code/challenge.dm similarity index 100% rename from maps/RandomZLevels/challenge.dm rename to code/modules/awaymissions/mission_code/challenge.dm diff --git a/maps/RandomZLevels/spacebattle.dm b/code/modules/awaymissions/mission_code/spacebattle.dm similarity index 100% rename from maps/RandomZLevels/spacebattle.dm rename to code/modules/awaymissions/mission_code/spacebattle.dm diff --git a/maps/RandomZLevels/stationCollision.dm b/code/modules/awaymissions/mission_code/stationCollision.dm similarity index 100% rename from maps/RandomZLevels/stationCollision.dm rename to code/modules/awaymissions/mission_code/stationCollision.dm diff --git a/maps/RandomZLevels/wildwest.dm b/code/modules/awaymissions/mission_code/wildwest.dm similarity index 100% rename from maps/RandomZLevels/wildwest.dm rename to code/modules/awaymissions/mission_code/wildwest.dm diff --git a/code/modules/awaymissions/zlevel.dm b/code/modules/awaymissions/zlevel.dm index e89d67cf773..143030c886c 100644 --- a/code/modules/awaymissions/zlevel.dm +++ b/code/modules/awaymissions/zlevel.dm @@ -4,7 +4,7 @@ proc/createRandomZlevel() var/list/potentialRandomZlevels = list() world << "\red \b Searching for away missions..." - var/list/Lines = file2list("maps/RandomZLevels/fileList.txt") + var/list/Lines = file2list("_maps/RandomZLevels/fileList.txt") if(!Lines.len) return for (var/t in Lines) if (!t) diff --git a/code/world.dm b/code/world.dm index 8a041e7dd11..b620dfeff18 100644 --- a/code/world.dm +++ b/code/world.dm @@ -90,19 +90,11 @@ process_ghost_teleport_locs() //Sets up ghost teleport locations. sleep_offline = 1 - var/list/lines = file2list(file('tgstation.dme')) - for(var/l in lines) - if( dd_hassuffix(l, ".dmm\"") ) - var/firstquote = findtext(l, "\"") - var/lastslash = 0 - for(var/j = 1; j < length(l); j++) - var/lastslashtest = findtext(l, "\\", -j) - if(lastslashtest > 0) - lastslash = lastslashtest - break - map_name = copytext(l, max(firstquote+1,lastslash+1), length(l)-4) - if(!map_name) - map_name = "Unknown" + #ifdef MAP_NAME + map_name = "[MAP_NAME]" + #else + map_name = "Unknown" + #endif spawn(3000) //so we aren't adding to the round-start lag if(config.kick_inactive) diff --git a/dm.sh b/dm.sh new file mode 100644 index 00000000000..91690cea137 --- /dev/null +++ b/dm.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +dmepath="" +retval=1 + +for var +do + if [[ $var != -* && $var == *.dme ]] + then + dmepath=`echo $var | sed -r 's/.{4}$//'` + break + fi +done + +if [[ $dmepath == "" ]] +then + echo "No .dme file specified, aborting." + exit 1 +fi + +if [[ -a $dmepath.mdme ]] +then + rm $dmepath.mdme +fi + +cp $dmepath.dme $dmepath.mdme +if [[ $? != 0 ]] +then + echo "Failed to make modified dme, aborting." + exit 2 +fi + +for var +do + arg=`echo $var | sed -r 's/^.{2}//'` + if [[ $var == -D* ]] + then + sed -i '1s/^/#define '$arg'\n/' $dmepath.mdme + continue + fi + if [[ $var == -M* ]] + then + sed -i 's!// BEGIN_INCLUDE!// BEGIN_INCLUDE\n#include "_maps\\'$arg'.dm"!' $dmepath.mdme + continue + fi +done + +#windows +if [[ `uname` == MINGW* ]] +then + dm="" + + if hash dm.exe 2>/dev/null + then + dm='dm.exe' + elif [[ -a '/c/Program Files (x86)/BYOND/bin/dm.exe' ]] + then + dm='/c/Program Files (x86)/BYOND/bin/dm.exe' + elif [[ -a '/c/Program Files/BYOND/bin/dm.exe' ]] + then + dm='/c/Program Files/BYOND/bin/dm.exe' + fi + + if [[ $dm == "" ]] + then + echo "Couldn't find the DreamMaker executable, aborting." + exit 3 + fi + + "$dm" $dmepath.mdme + retval=$? +else + if hash DreamMaker 2>/dev/null + then + DreamMaker $dmepath.mdme + retval=$? + else + echo "Couldn't find the DreamMaker executable, aborting." + exit 3 + fi +fi + +mv $dmepath.mdme.dmb $dmepath.dmb +mv $dmepath.mdme.rsc $dmepath.rsc + +rm $dmepath.mdme + +exit $retval diff --git a/tgstation.dme b/tgstation.dme index 4a1cd48528e..445d6ce7132 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -13,6 +13,7 @@ // END_PREFERENCES // BEGIN_INCLUDE +#include "_maps\tgstation2.dm" #include "code\_compile_options.dm" #include "code\hub.dm" #include "code\world.dm" @@ -729,6 +730,13 @@ #include "code\modules\awaymissions\maploader\reader.dm" #include "code\modules\awaymissions\maploader\swapmaps.dm" #include "code\modules\awaymissions\maploader\writer.dm" +#include "code\modules\awaymissions\mission_code\Academy.dm" +#include "code\modules\awaymissions\mission_code\blackmarketpackers.dm" +#include "code\modules\awaymissions\mission_code\centcomAway.dm" +#include "code\modules\awaymissions\mission_code\challenge.dm" +#include "code\modules\awaymissions\mission_code\spacebattle.dm" +#include "code\modules\awaymissions\mission_code\stationCollision.dm" +#include "code\modules\awaymissions\mission_code\wildwest.dm" #include "code\modules\client\client defines.dm" #include "code\modules\client\client procs.dm" #include "code\modules\client\preferences.dm" @@ -1197,12 +1205,4 @@ #include "interface\interface.dm" #include "interface\stylesheet.dm" #include "interface\skin.dmf" -#include "maps\tgstation.2.1.2.dmm" -#include "maps\RandomZLevels\Academy.dm" -#include "maps\RandomZLevels\blackmarketpackers.dm" -#include "maps\RandomZLevels\centcomAway.dm" -#include "maps\RandomZLevels\challenge.dm" -#include "maps\RandomZLevels\spacebattle.dm" -#include "maps\RandomZLevels\stationCollision.dm" -#include "maps\RandomZLevels\wildwest.dm" // END_INCLUDE