1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Remove NO_EDITOR/NO_CUSTOM_LEVELS, disable editor on Steam Deck

This commit removes the `NO_EDITOR` and `NO_CUSTOM_LEVELS` defines,
which cleans up the code a lot, and they weren't really needed anyways.

This commit also disables the editor on the Steam Deck, and adds a
program argument to re-enable the editor, `-enable-editor`.
This commit is contained in:
AllyTally 2023-08-23 14:51:11 -03:00 committed by Misa Elizabeth Kai
parent 880c7ad8e6
commit a537492d9c
20 changed files with 65 additions and 265 deletions

View file

@ -46,20 +46,6 @@ jobs:
- name: Build (M&P) - name: Build (M&P)
run: ninja -C ${SRC_DIR_PATH}/build run: ninja -C ${SRC_DIR_PATH}/build
- name: CMake configure (no custom levels)
run: |
cd ${SRC_DIR_PATH}/build
cmake -DMAKEANDPLAY=OFF -DCUSTOM_LEVEL_SUPPORT=DISABLED ..
- name: Build (no custom levels)
run: ninja -C ${SRC_DIR_PATH}/build
- name: CMake configure (no editor)
run: |
cd ${SRC_DIR_PATH}/build
cmake -DCUSTOM_LEVEL_SUPPORT=NO_EDITOR ..
- name: Build (no editor)
run: ninja -C ${SRC_DIR_PATH}/build
build-lin: build-lin:
name: Build (CentOS 7) name: Build (CentOS 7)
@ -97,20 +83,6 @@ jobs:
- name: Build (M&P) - name: Build (M&P)
run: make -j $(nproc) -C ${SRC_DIR_PATH}/build run: make -j $(nproc) -C ${SRC_DIR_PATH}/build
- name: CMake configure (no custom levels)
run: |
cd ${SRC_DIR_PATH}/build
cmake -DMAKEANDPLAY=OFF -DCUSTOM_LEVEL_SUPPORT=DISABLED ..
- name: Build (no custom levels)
run: make -j $(nproc) -C ${SRC_DIR_PATH}/build
- name: CMake configure (no editor)
run: |
cd ${SRC_DIR_PATH}/build
cmake -DCUSTOM_LEVEL_SUPPORT=NO_EDITOR ..
- name: Build (no editor)
run: make -j $(nproc) -C ${SRC_DIR_PATH}/build
build-win: build-win:
name: Build (windows-latest) name: Build (windows-latest)
@ -186,21 +158,3 @@ jobs:
run: | run: |
cd $env:SRC_DIR_PATH/build cd $env:SRC_DIR_PATH/build
cmake --build . cmake --build .
- name: CMake configure (no custom levels)
run: |
cd $env:SRC_DIR_PATH/build
cmake -DMAKEANDPLAY=OFF -DCUSTOM_LEVEL_SUPPORT=DISABLED ..
- name: Build (no custom levels)
run: |
cd $env:SRC_DIR_PATH/build
cmake --build .
- name: CMake configure (no editor)
run: |
cd $env:SRC_DIR_PATH/build
cmake -DCUSTOM_LEVEL_SUPPORT=NO_EDITOR ..
- name: Build (no editor)
run: |
cd $env:SRC_DIR_PATH/build
cmake --build .

View file

@ -9,9 +9,6 @@ option(ENABLE_WERROR "Treat compilation warnings as errors" OFF)
option(BUNDLE_DEPENDENCIES "Use bundled TinyXML-2, PhysicsFS, and FAudio (if disabled, TinyXML-2, PhysicsFS, and FAudio will be dynamically linked; LodePNG and C-HashMap will still be statically linked)" ON) option(BUNDLE_DEPENDENCIES "Use bundled TinyXML-2, PhysicsFS, and FAudio (if disabled, TinyXML-2, PhysicsFS, and FAudio will be dynamically linked; LodePNG and C-HashMap will still be statically linked)" ON)
set(CUSTOM_LEVEL_SUPPORT ENABLED CACHE STRING "Optionally disable playing and/or editing of custom levels")
set_property(CACHE CUSTOM_LEVEL_SUPPORT PROPERTY STRINGS ENABLED NO_EDITOR DISABLED)
option(STEAM "Use the Steam API" OFF) option(STEAM "Use the Steam API" OFF)
option(GOG "Use the GOG API" OFF) option(GOG "Use the GOG API" OFF)
@ -72,7 +69,9 @@ set(VVV_SRC
src/BinaryBlob.cpp src/BinaryBlob.cpp
src/BlockV.cpp src/BlockV.cpp
src/ButtonGlyphs.cpp src/ButtonGlyphs.cpp
src/CustomLevels.cpp
src/CWrappers.cpp src/CWrappers.cpp
src/Editor.cpp
src/Ent.cpp src/Ent.cpp
src/Entity.cpp src/Entity.cpp
src/FileSystemUtils.cpp src/FileSystemUtils.cpp
@ -118,12 +117,6 @@ set(VVV_SRC
src/Xoshiro.c src/Xoshiro.c
../third_party/physfs/extras/physfsrwops.c ../third_party/physfs/extras/physfsrwops.c
) )
if(NOT CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED")
list(APPEND VVV_SRC src/CustomLevels.cpp)
if(NOT CUSTOM_LEVEL_SUPPORT STREQUAL "NO_EDITOR")
LIST(APPEND VVV_SRC src/Editor.cpp)
endif()
endif()
if(STEAM) if(STEAM)
list(APPEND VVV_SRC src/SteamNetwork.c) list(APPEND VVV_SRC src/SteamNetwork.c)
endif() endif()
@ -249,12 +242,6 @@ if(ENABLE_WARNINGS)
/W4 $<$<BOOL:${ENABLE_WERROR}>:/WX>>) /W4 $<$<BOOL:${ENABLE_WERROR}>:/WX>>)
endif() endif()
if(CUSTOM_LEVEL_SUPPORT STREQUAL "NO_EDITOR")
target_compile_definitions(VVVVVV PRIVATE -DNO_EDITOR)
elseif(CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED")
target_compile_definitions(VVVVVV PRIVATE -DNO_CUSTOM_LEVELS -DNO_EDITOR)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(SUPPORTS_IMPLICIT_FALLTHROUGH TRUE) set(SUPPORTS_IMPLICIT_FALLTHROUGH TRUE)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

View file

@ -417,6 +417,7 @@
<string english="start from beginning" translation="" explanation="menu option"/> <string english="start from beginning" translation="" explanation="menu option"/>
<string english="delete save" translation="" explanation="menu option"/> <string english="delete save" translation="" explanation="menu option"/>
<string english="back to levels" translation="" explanation="menu option"/> <string english="back to levels" translation="" explanation="menu option"/>
<string english="This version of the game does not support the level editor, but it might be supported in the future." translation="" max="38*3"/>
<string english="To install new player levels, copy the .vvvvvv files to the levels folder." translation="" explanation="" max="38*3"/> <string english="To install new player levels, copy the .vvvvvv files to the levels folder." translation="" explanation="" max="38*3"/>
<string english="Are you sure you want to show the levels path? This may reveal sensitive information if you are streaming." translation="" explanation="" max="38*4"/> <string english="Are you sure you want to show the levels path? This may reveal sensitive information if you are streaming." translation="" explanation="" max="38*4"/>
<string english="The levels path is:" translation="" explanation="" max="40"/> <string english="The levels path is:" translation="" explanation="" max="40"/>

View file

@ -1,5 +1,3 @@
#if !defined(NO_CUSTOM_LEVELS)
#define CL_DEFINITION #define CL_DEFINITION
#include "CustomLevels.h" #include "CustomLevels.h"
@ -996,9 +994,7 @@ bool customlevelclass::load(std::string _path)
tinyxml2::XMLElement* pElem; tinyxml2::XMLElement* pElem;
reset(); reset();
#ifndef NO_EDITOR
ed.reset(); ed.reset();
#endif
static const char *levelDir = "levels/"; static const char *levelDir = "levels/";
if (_path.compare(0, SDL_strlen(levelDir), levelDir) != 0) if (_path.compare(0, SDL_strlen(levelDir), levelDir) != 0)
@ -1037,9 +1033,7 @@ bool customlevelclass::load(std::string _path)
goto fail; goto fail;
} }
#ifndef NO_EDITOR
ed.loaded_filepath = _path; ed.loaded_filepath = _path;
#endif
version = 0; version = 0;
level_font_name = "font"; level_font_name = "font";
@ -1452,7 +1446,6 @@ fail:
return false; return false;
} }
#ifndef NO_EDITOR
bool customlevelclass::save(const std::string& _path) bool customlevelclass::save(const std::string& _path)
{ {
tinyxml2::XMLDocument doc; tinyxml2::XMLDocument doc;
@ -1651,8 +1644,6 @@ bool customlevelclass::save(const std::string& _path)
return FILESYSTEM_saveTiXml2Document(newpath.c_str(), doc); return FILESYSTEM_saveTiXml2Document(newpath.c_str(), doc);
} }
#endif /* NO_EDITOR */
void customlevelclass::generatecustomminimap(void) void customlevelclass::generatecustomminimap(void)
{ {
@ -1923,14 +1914,11 @@ SDL_Color customlevelclass::getonewaycol(const int rx, const int ry)
// This version detects the room automatically // This version detects the room automatically
SDL_Color customlevelclass::getonewaycol(void) SDL_Color customlevelclass::getonewaycol(void)
{ {
#ifndef NO_EDITOR
if (game.gamestate == EDITORMODE) if (game.gamestate == EDITORMODE)
{ {
return getonewaycol(ed.levx, ed.levy); return getonewaycol(ed.levx, ed.levy);
} }
else else if (map.custommode)
#endif
if (map.custommode)
{ {
return getonewaycol(game.roomx - 100, game.roomy - 100); return getonewaycol(game.roomx - 100, game.roomy - 100);
} }
@ -1973,5 +1961,3 @@ int customlevelclass::numcrewmates(void)
} }
return temp; return temp;
} }
#endif /* NO_CUSTOM_LEVELS */

View file

@ -1,5 +1,3 @@
#if !defined(NO_CUSTOM_LEVELS)
#ifndef CUSTOMLEVELS_H #ifndef CUSTOMLEVELS_H
#define CUSTOMLEVELS_H #define CUSTOMLEVELS_H
@ -138,9 +136,8 @@ public:
int absfree(int x, int y); int absfree(int x, int y);
bool load(std::string _path); bool load(std::string _path);
#ifndef NO_EDITOR
bool save(const std::string& _path); bool save(const std::string& _path);
#endif
void generatecustomminimap(void); void generatecustomminimap(void);
int findtrinket(int t); int findtrinket(int t);
@ -182,4 +179,3 @@ extern customlevelclass cl;
#endif /* CUSTOMLEVELS_H */ #endif /* CUSTOMLEVELS_H */
#endif /* NO_CUSTOM_LEVELS */

View file

@ -1,5 +1,3 @@
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
#define ED_DEFINITION #define ED_DEFINITION
#include "Editor.h" #include "Editor.h"
@ -4161,5 +4159,3 @@ void editorclass::switch_warpdir(const bool reversed)
graphics.backgrounddrawn = false; graphics.backgrounddrawn = false;
} }
#endif /* NO_CUSTOM_LEVELS and NO_EDITOR */

View file

@ -1,5 +1,3 @@
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
#ifndef EDITOR_H #ifndef EDITOR_H
#define EDITOR_H #define EDITOR_H
@ -295,5 +293,3 @@ extern editorclass ed;
#endif #endif
#endif /* EDITOR_H */ #endif /* EDITOR_H */
#endif /* NO_CUSTOM_LEVELS and NO_EDITOR */

View file

@ -1287,7 +1287,6 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
//Rule 6 is a crew member //Rule 6 is a crew member
bool custom_gray; bool custom_gray;
#if !defined(NO_CUSTOM_LEVELS)
// Special case for gray Warp Zone tileset! // Special case for gray Warp Zone tileset!
if (map.custommode) if (map.custommode)
{ {
@ -1295,7 +1294,6 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
custom_gray = room->tileset == 3 && room->tilecol == 6; custom_gray = room->tileset == 3 && room->tilecol == 6;
} }
else else
#endif
{ {
custom_gray = false; custom_gray = false;
} }

View file

@ -548,9 +548,7 @@ void set_level_font_new(void)
} }
} }
#ifndef NO_CUSTOM_LEVELS
cl.level_font_name = get_main_font_name(font_idx_level); cl.level_font_name = get_main_font_name(font_idx_level);
#endif
} }
static void fill_map_name_idx(FontContainer* container) static void fill_map_name_idx(FontContainer* container)

View file

@ -284,6 +284,7 @@ void Game::init(void)
gameoverdelay = 0; gameoverdelay = 0;
framecounter = 0; framecounter = 0;
seed_use_sdl_getticks = false; seed_use_sdl_getticks = false;
editor_disabled = false;
resetgameclock(); resetgameclock();
gamesaved = false; gamesaved = false;
gamesavefailed = false; gamesavefailed = false;
@ -373,9 +374,8 @@ void Game::init(void)
showingametimer = false; showingametimer = false;
ingame_titlemode = false; ingame_titlemode = false;
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
ingame_editormode = false; ingame_editormode = false;
#endif
kludge_ingametemp = Menu::mainmenu; kludge_ingametemp = Menu::mainmenu;
slidermode = SLIDER_NONE; slidermode = SLIDER_NONE;
@ -1586,14 +1586,13 @@ void Game::updatestate(void)
case 82: case 82:
//Time Trial Complete! //Time Trial Complete!
obj.removetrigger(82); obj.removetrigger(82);
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
if (map.custommode && !map.custommodeforreal) if (map.custommode && !map.custommodeforreal)
{ {
returntoeditor(); returntoeditor();
ed.show_note(loc::gettext("Time trial completed")); ed.show_note(loc::gettext("Time trial completed"));
break; break;
} }
#endif
if (translator_exploring) if (translator_exploring)
{ {
translator_exploring_allowtele = true; translator_exploring_allowtele = true;
@ -2074,13 +2073,11 @@ void Game::updatestate(void)
int max_trinkets; int max_trinkets;
#if !defined(NO_CUSTOM_LEVELS)
if(map.custommode) if(map.custommode)
{ {
max_trinkets = cl.numtrinkets(); max_trinkets = cl.numtrinkets();
} }
else else
#endif
{ {
max_trinkets = 20; max_trinkets = 20;
} }
@ -2127,7 +2124,6 @@ void Game::updatestate(void)
incstate(); incstate();
setstatedelay(15); setstatedelay(15);
break; break;
#if !defined(NO_CUSTOM_LEVELS)
case 1011: case 1011:
{ {
//Found a crewmate! //Found a crewmate!
@ -2183,13 +2179,11 @@ void Game::updatestate(void)
graphics.fademode = FADE_START_FADEOUT; graphics.fademode = FADE_START_FADEOUT;
setstate(1014); setstate(1014);
} }
#ifndef NO_EDITOR
else else
{ {
returntoeditor(); returntoeditor();
ed.show_note(loc::gettext("Level completed")); ed.show_note(loc::gettext("Level completed"));
} }
#endif
} }
else else
{ {
@ -2200,7 +2194,6 @@ void Game::updatestate(void)
} }
graphics.showcutscenebars = false; graphics.showcutscenebars = false;
break; break;
#endif
case 1014: case 1014:
frames--; frames--;
if (graphics.fademode == FADE_FULLY_BLACK) if (graphics.fademode == FADE_FULLY_BLACK)
@ -2209,7 +2202,6 @@ void Game::updatestate(void)
} }
break; break;
case 1015: case 1015:
#if !defined(NO_CUSTOM_LEVELS)
//Update level stats //Update level stats
/* FIXME: Have to add check to not save stats for the dumb hack /* FIXME: Have to add check to not save stats for the dumb hack
* `special/stdin.vvvvvv` filename... see elsewhere, grep for * `special/stdin.vvvvvv` filename... see elsewhere, grep for
@ -2227,7 +2219,7 @@ void Game::updatestate(void)
updatecustomlevelstats(customlevelfilename, 1); updatecustomlevelstats(customlevelfilename, 1);
} }
} }
#endif
quittomenu(); quittomenu();
music.play(Music_PRESENTINGVVVVVV); //should be after quittomenu() music.play(Music_PRESENTINGVVVVVV); //should be after quittomenu()
setstate(0); setstate(0);
@ -6266,9 +6258,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
#if !defined(MAKEANDPLAY) #if !defined(MAKEANDPLAY)
option(loc::gettext("play")); option(loc::gettext("play"));
#endif #endif
#if !defined(NO_CUSTOM_LEVELS)
option(loc::gettext("levels")); option(loc::gettext("levels"));
#endif
option(loc::gettext("options")); option(loc::gettext("options"));
if (loc::show_translator_menu) if (loc::show_translator_menu)
{ {
@ -6279,14 +6269,14 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
menuyoff = -10; menuyoff = -10;
maxspacing = 15; maxspacing = 15;
break; break;
#if !defined(NO_CUSTOM_LEVELS)
case Menu::playerworlds: case Menu::playerworlds:
option(loc::gettext("play a level")); option(loc::gettext("play a level"));
#if !defined(NO_EDITOR) option(loc::gettext("level editor"), !editor_disabled);
option(loc::gettext("level editor")); if (!editor_disabled)
#endif {
option(loc::gettext("open level folder"), FILESYSTEM_openDirectoryEnabled()); option(loc::gettext("open level folder"), FILESYSTEM_openDirectoryEnabled());
option(loc::gettext("show level folder path")); option(loc::gettext("show level folder path"));
}
option(loc::gettext("return")); option(loc::gettext("return"));
menuyoff = -40; menuyoff = -40;
maxspacing = 15; maxspacing = 15;
@ -6398,7 +6388,6 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
return; // skip automatic centering, will turn out bad with levels list return; // skip automatic centering, will turn out bad with levels list
} }
break; break;
#endif
case Menu::quickloadlevel: case Menu::quickloadlevel:
option(loc::gettext("continue from save")); option(loc::gettext("continue from save"));
option(loc::gettext("start from beginning")); option(loc::gettext("start from beginning"));
@ -7026,11 +7015,6 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option(loc::gettext("ok")); option(loc::gettext("ok"));
menuyoff = 50; menuyoff = 50;
break; break;
#ifdef NO_CUSTOM_LEVELS
/* Silence warnings about unhandled cases. */
default:
break;
#endif
} }
// Automatically center the menu. We must check the width of the menu with the initial horizontal spacing. // Automatically center the menu. We must check the width of the menu with the initial horizontal spacing.
@ -7239,18 +7223,15 @@ static void hardreset(void)
script.hardreset(); script.hardreset();
} }
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
static void returntoeditor_callback(void) static void returntoeditor_callback(void)
{ {
extern Game game; extern Game game;
game.returntoeditor(); game.returntoeditor();
ed.show_note(loc::gettext("Level quits to menu")); ed.show_note(loc::gettext("Level quits to menu"));
} }
#endif
void Game::quittomenu(void) void Game::quittomenu(void)
{ {
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
if (gamestate != EDITORMODE && map.custommode && !map.custommodeforreal) if (gamestate != EDITORMODE && map.custommode && !map.custommodeforreal)
{ {
/* We are playtesting! Go back to the editor /* We are playtesting! Go back to the editor
@ -7259,7 +7240,6 @@ void Game::quittomenu(void)
DEFER_CALLBACK(returntoeditor_callback); DEFER_CALLBACK(returntoeditor_callback);
return; return;
} }
#endif
gamestate = TITLEMODE; gamestate = TITLEMODE;
graphics.fademode = FADE_START_FADEIN; graphics.fademode = FADE_START_FADEIN;
@ -7350,7 +7330,6 @@ void Game::returntolab(void)
music.play(Music_PIPEDREAM); music.play(Music_PIPEDREAM);
} }
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
static void resetbg(void) static void resetbg(void)
{ {
graphics.backgrounddrawn = false; graphics.backgrounddrawn = false;
@ -7391,7 +7370,6 @@ void Game::returntoeditor(void)
graphics.backgrounddrawn = false; graphics.backgrounddrawn = false;
graphics.foregrounddrawn = false; graphics.foregrounddrawn = false;
} }
#endif
static void returntoingametemp(void) static void returntoingametemp(void)
{ {
@ -7399,13 +7377,11 @@ static void returntoingametemp(void)
game.returntomenu(game.kludge_ingametemp); game.returntomenu(game.kludge_ingametemp);
} }
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
static void returntoedsettings(void) static void returntoedsettings(void)
{ {
extern Game game; extern Game game;
game.returntomenu(Menu::ed_settings); game.returntomenu(Menu::ed_settings);
} }
#endif
static void nextbgcolor(void) static void nextbgcolor(void)
{ {
@ -7426,7 +7402,7 @@ void Game::returntoingame(void)
{ {
ingame_titlemode = false; ingame_titlemode = false;
mapheld = true; mapheld = true;
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
if (ingame_editormode) if (ingame_editormode)
{ {
ingame_editormode = false; ingame_editormode = false;
@ -7435,7 +7411,6 @@ void Game::returntoingame(void)
ed.settingskey = true; ed.settingskey = true;
} }
else else
#endif
{ {
DEFER_CALLBACK(returntoingametemp); DEFER_CALLBACK(returntoingametemp);
gamestate = MAPMODE; gamestate = MAPMODE;

View file

@ -337,6 +337,7 @@ public:
int framecounter; int framecounter;
bool seed_use_sdl_getticks; bool seed_use_sdl_getticks;
bool editor_disabled;
int frames, seconds, minutes, hours; int frames, seconds, minutes, hours;
bool gamesaved; bool gamesaved;
bool gamesavefailed; bool gamesavefailed;
@ -552,9 +553,7 @@ public:
bool fadetolab; bool fadetolab;
int fadetolabdelay; int fadetolabdelay;
#if !defined(NO_CUSTOM_LEVELS)
void returntoeditor(void); void returntoeditor(void);
#endif
bool inline inspecial(void) bool inline inspecial(void)
{ {
@ -572,9 +571,7 @@ public:
bool showingametimer; bool showingametimer;
bool ingame_titlemode; bool ingame_titlemode;
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
bool ingame_editormode; bool ingame_editormode;
#endif
void returntoingame(void); void returntoingame(void);
void unlockAchievement(const char *name); void unlockAchievement(const char *name);

View file

@ -139,11 +139,9 @@ void Graphics::init(void)
kludgeswnlinewidth = false; kludgeswnlinewidth = false;
#ifndef NO_CUSTOM_LEVELS
tiles1_mounted = false; tiles1_mounted = false;
tiles2_mounted = false; tiles2_mounted = false;
minimap_mounted = false; minimap_mounted = false;
#endif
gamecomplete_mounted = false; gamecomplete_mounted = false;
levelcomplete_mounted = false; levelcomplete_mounted = false;
@ -686,24 +684,20 @@ void Graphics::scroll_texture(SDL_Texture* texture, SDL_Texture* temp, const int
copy_texture(temp, &src, &src); copy_texture(temp, &src, &src);
} }
#ifndef NO_CUSTOM_LEVELS
bool Graphics::shouldrecoloroneway(const int tilenum, const bool mounted) bool Graphics::shouldrecoloroneway(const int tilenum, const bool mounted)
{ {
return (tilenum >= 14 && tilenum <= 17 return (tilenum >= 14 && tilenum <= 17
&& (!mounted && (!mounted
|| cl.onewaycol_override)); || cl.onewaycol_override));
} }
#endif
void Graphics::drawtile(int x, int y, int t) void Graphics::drawtile(int x, int y, int t)
{ {
#if !defined(NO_CUSTOM_LEVELS)
if (shouldrecoloroneway(t, tiles1_mounted)) if (shouldrecoloroneway(t, tiles1_mounted))
{ {
draw_grid_tile(grphx.im_tiles_tint, t, x, y, tiles_rect.w, tiles_rect.h, cl.getonewaycol()); draw_grid_tile(grphx.im_tiles_tint, t, x, y, tiles_rect.w, tiles_rect.h, cl.getonewaycol());
} }
else else
#endif
{ {
draw_grid_tile(grphx.im_tiles, t, x, y, tiles_rect.w, tiles_rect.h); draw_grid_tile(grphx.im_tiles, t, x, y, tiles_rect.w, tiles_rect.h);
} }
@ -712,13 +706,11 @@ void Graphics::drawtile(int x, int y, int t)
void Graphics::drawtile2(int x, int y, int t) void Graphics::drawtile2(int x, int y, int t)
{ {
#if !defined(NO_CUSTOM_LEVELS)
if (shouldrecoloroneway(t, tiles2_mounted)) if (shouldrecoloroneway(t, tiles2_mounted))
{ {
draw_grid_tile(grphx.im_tiles2_tint, t, x, y, tiles_rect.w, tiles_rect.h, cl.getonewaycol()); draw_grid_tile(grphx.im_tiles2_tint, t, x, y, tiles_rect.w, tiles_rect.h, cl.getonewaycol());
} }
else else
#endif
{ {
draw_grid_tile(grphx.im_tiles2, t, x, y, tiles_rect.w, tiles_rect.h); draw_grid_tile(grphx.im_tiles2, t, x, y, tiles_rect.w, tiles_rect.h);
} }
@ -1575,7 +1567,6 @@ void Graphics::drawmenu(int cr, int cg, int cb, enum Menu::MenuName menu)
y = 140 + i * 12 + game.menuyoff; y = 140 + i * 12 + game.menuyoff;
} }
#ifndef NO_CUSTOM_LEVELS
if (menu == Menu::levellist) if (menu == Menu::levellist)
{ {
size_t separator; size_t separator;
@ -1598,7 +1589,7 @@ void Graphics::drawmenu(int cr, int cg, int cb, enum Menu::MenuName menu)
y += 4; y += 4;
} }
} }
#endif
if (menu == Menu::translator_options_cutscenetest) if (menu == Menu::translator_options_cutscenetest)
{ {
size_t separator = 4; size_t separator = 4;
@ -1904,7 +1895,7 @@ void Graphics::drawentity(const int i, const int yoff)
SDL_Rect drawRect; SDL_Rect drawRect;
bool custom_gray; bool custom_gray;
#if !defined(NO_CUSTOM_LEVELS)
// Special case for gray Warp Zone tileset! // Special case for gray Warp Zone tileset!
if (map.custommode) if (map.custommode)
{ {
@ -1912,7 +1903,6 @@ void Graphics::drawentity(const int i, const int yoff)
custom_gray = room->tileset == 3 && room->tilecol == 6; custom_gray = room->tileset == 3 && room->tilecol == 6;
} }
else else
#endif
{ {
custom_gray = false; custom_gray = false;
} }
@ -2681,14 +2671,12 @@ void Graphics::drawmap(void)
{ {
int tile; int tile;
int tileset; int tileset;
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
if (game.gamestate == EDITORMODE) if (game.gamestate == EDITORMODE)
{ {
tile = cl.gettile(ed.levx, ed.levy, x, y); tile = cl.gettile(ed.levx, ed.levy, x, y);
tileset = (cl.getroomprop(ed.levx, ed.levy)->tileset == 0) ? 0 : 1; tileset = (cl.getroomprop(ed.levx, ed.levy)->tileset == 0) ? 0 : 1;
} }
else else
#endif
{ {
tile = map.contents[TILE_IDX(x, y)]; tile = map.contents[TILE_IDX(x, y)];
tileset = map.tileset; tileset = map.tileset;
@ -3467,11 +3455,9 @@ bool Graphics::reloadresources(void)
music.destroy(); music.destroy();
music.init(); music.init();
#ifndef NO_CUSTOM_LEVELS
tiles1_mounted = FILESYSTEM_isAssetMounted("graphics/tiles.png"); tiles1_mounted = FILESYSTEM_isAssetMounted("graphics/tiles.png");
tiles2_mounted = FILESYSTEM_isAssetMounted("graphics/tiles2.png"); tiles2_mounted = FILESYSTEM_isAssetMounted("graphics/tiles2.png");
minimap_mounted = FILESYSTEM_isAssetMounted("graphics/minimap.png"); minimap_mounted = FILESYSTEM_isAssetMounted("graphics/minimap.png");
#endif
gamecomplete_mounted = FILESYSTEM_isAssetMounted("graphics/gamecomplete.png"); gamecomplete_mounted = FILESYSTEM_isAssetMounted("graphics/gamecomplete.png");
levelcomplete_mounted = FILESYSTEM_isAssetMounted("graphics/levelcomplete.png"); levelcomplete_mounted = FILESYSTEM_isAssetMounted("graphics/levelcomplete.png");

View file

@ -263,9 +263,9 @@ public:
void drawbackground(int t); void drawbackground(int t);
void updatebackground(int t); void updatebackground(int t);
#ifndef NO_CUSTOM_LEVELS
bool shouldrecoloroneway(const int tilenum, const bool mounted); bool shouldrecoloroneway(const int tilenum, const bool mounted);
#endif
void drawtile3(int x, int y, int t, int off, int height_subtract = 0); void drawtile3(int x, int y, int t, int off, int height_subtract = 0);
void drawtile2(int x, int y, int t); void drawtile2(int x, int y, int t);
void drawtile(int x, int y, int t); void drawtile(int x, int y, int t);
@ -283,11 +283,10 @@ public:
const char* filename, SDL_Texture* texture, const char* filename, SDL_Texture* texture,
int tilewidth, int tileheight int tilewidth, int tileheight
); );
#ifndef NO_CUSTOM_LEVELS
bool tiles1_mounted; bool tiles1_mounted;
bool tiles2_mounted; bool tiles2_mounted;
bool minimap_mounted; bool minimap_mounted;
#endif
bool gamecomplete_mounted; bool gamecomplete_mounted;
bool levelcomplete_mounted; bool levelcomplete_mounted;

View file

@ -391,9 +391,7 @@ static void menuactionpress(void)
#if !defined(MAKEANDPLAY) #if !defined(MAKEANDPLAY)
OPTION_ID(0) /* play */ OPTION_ID(0) /* play */
#endif #endif
#if !defined(NO_CUSTOM_LEVELS)
OPTION_ID(1) /* levels */ OPTION_ID(1) /* levels */
#endif
OPTION_ID(2) /* options */ OPTION_ID(2) /* options */
if (loc::show_translator_menu) if (loc::show_translator_menu)
{ {
@ -425,14 +423,12 @@ static void menuactionpress(void)
} }
break; break;
#endif #endif
#if !defined(NO_CUSTOM_LEVELS)
case 1: case 1:
//Bring you to the normal playmenu //Bring you to the normal playmenu
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::playerworlds); game.createmenu(Menu::playerworlds);
map.nexttowercolour(); map.nexttowercolour();
break; break;
#endif
case 2: case 2:
//Options //Options
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
@ -459,7 +455,6 @@ static void menuactionpress(void)
} }
break; break;
} }
#if !defined(NO_CUSTOM_LEVELS)
case Menu::levellist: case Menu::levellist:
{ {
const bool nextlastoptions = cl.ListOfMetaData.size() > 8; const bool nextlastoptions = cl.ListOfMetaData.size() > 8;
@ -509,7 +504,6 @@ static void menuactionpress(void)
} }
break; break;
} }
#endif
case Menu::quickloadlevel: case Menu::quickloadlevel:
switch (game.currentmenuoption) switch (game.currentmenuoption)
{ {
@ -533,7 +527,6 @@ static void menuactionpress(void)
break; break;
} }
break; break;
#if !defined(NO_CUSTOM_LEVELS)
case Menu::deletequicklevel: case Menu::deletequicklevel:
switch (game.currentmenuoption) switch (game.currentmenuoption)
{ {
@ -552,15 +545,8 @@ static void menuactionpress(void)
map.nexttowercolour(); map.nexttowercolour();
break; break;
case Menu::playerworlds: case Menu::playerworlds:
#if defined(NO_EDITOR) if (game.currentmenuoption == 0)
#define OFFSET -1
#else
#define OFFSET 0
#endif
switch (game.currentmenuoption)
{ {
case 0:
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.levelpage = 0; game.levelpage = 0;
cl.getDirectoryData(); cl.getDirectoryData();
@ -571,16 +557,23 @@ static void menuactionpress(void)
game.createmenu(Menu::warninglevellist); game.createmenu(Menu::warninglevellist);
} }
map.nexttowercolour(); map.nexttowercolour();
break; }
#if !defined(NO_EDITOR) else if (game.currentmenuoption == 1)
case 1: {
// LEVEL EDITOR HOOK // LEVEL EDITOR HOOK
if (game.editor_disabled)
{
music.playef(Sound_CRY);
}
else
{
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
startmode(Start_EDITOR); startmode(Start_EDITOR);
ed.filename = ""; ed.filename = "";
break; }
#endif }
case OFFSET+2: else if (!game.editor_disabled && game.currentmenuoption == 2)
{
//"OPENFOLDERHOOK" //"OPENFOLDERHOOK"
if (FILESYSTEM_openDirectoryEnabled() if (FILESYSTEM_openDirectoryEnabled()
&& FILESYSTEM_openDirectory(FILESYSTEM_getUserLevelDirectory())) && FILESYSTEM_openDirectory(FILESYSTEM_getUserLevelDirectory()))
@ -592,22 +585,21 @@ static void menuactionpress(void)
{ {
music.playef(Sound_CRY); music.playef(Sound_CRY);
} }
break; }
case OFFSET+3: else if (!game.editor_disabled && game.currentmenuoption == 3)
{
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::confirmshowlevelspath); game.createmenu(Menu::confirmshowlevelspath);
map.nexttowercolour(); map.nexttowercolour();
break; }
case OFFSET+4: else if (game.currentmenuoption == 4 || (game.editor_disabled && game.currentmenuoption == 2))
{
// back // back
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.returnmenu(); game.returnmenu();
map.nexttowercolour(); map.nexttowercolour();
break;
} }
#undef OFFSET
break; break;
#endif
case Menu::confirmshowlevelspath: case Menu::confirmshowlevelspath:
{ {
int prevmenuoption = game.currentmenuoption; /* returnmenu destroys this */ int prevmenuoption = game.currentmenuoption; /* returnmenu destroys this */
@ -2491,7 +2483,6 @@ void gameinput(void)
} }
//Returning to editor mode must always be possible //Returning to editor mode must always be possible
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
if (map.custommode && !map.custommodeforreal) if (map.custommode && !map.custommodeforreal)
{ {
if ((game.press_map || key.isDown(27)) && !game.mapheld) if ((game.press_map || key.isDown(27)) && !game.mapheld)
@ -2510,7 +2501,6 @@ void gameinput(void)
} }
} }
} }
#endif
//Entity type 0 is player controled //Entity type 0 is player controled
bool has_control = false; bool has_control = false;
@ -3066,13 +3056,12 @@ static void mapmenuactionpress(const bool version2_2)
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111) game.savearea = loc::gettext_roomname_special("The Ship"); if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111) game.savearea = loc::gettext_roomname_special("The Ship");
bool success; bool success;
#if !defined(NO_CUSTOM_LEVELS)
if(map.custommodeforreal) if(map.custommodeforreal)
{ {
success = game.customsavequick(cl.ListOfMetaData[game.playcustomlevel].filename); success = game.customsavequick(cl.ListOfMetaData[game.playcustomlevel].filename);
} }
else else
#endif
{ {
success = game.savequick(); success = game.savequick();
} }

View file

@ -947,10 +947,9 @@ static void loadtext_roomnames(bool custom_level)
{ {
continue; continue;
} }
#if !defined(NO_CUSTOM_LEVELS)
const RoomProperty* const room = cl.getroomprop(x, y); const RoomProperty* const room = cl.getroomprop(x, y);
if (SDL_strcmp(original_roomname, room->roomname.c_str()) != 0) if (SDL_strcmp(original_roomname, room->roomname.c_str()) != 0)
#endif
{ {
continue; continue;
} }

View file

@ -124,24 +124,20 @@ const int mapclass::areamap[] = {
int mapclass::getwidth(void) int mapclass::getwidth(void)
{ {
#ifndef NO_CUSTOM_LEVELS
if (custommode) if (custommode)
{ {
return cl.mapwidth; return cl.mapwidth;
} }
#endif
return 20; return 20;
} }
int mapclass::getheight(void) int mapclass::getheight(void)
{ {
#ifndef NO_CUSTOM_LEVELS
if (custommode) if (custommode)
{ {
return cl.mapheight; return cl.mapheight;
} }
#endif
return 20; return 20;
} }
@ -420,7 +416,6 @@ void mapclass::initcustommapdata(void)
{ {
shinytrinkets.clear(); shinytrinkets.clear();
#if !defined(NO_CUSTOM_LEVELS)
for (size_t i = 0; i < customentities.size(); i++) for (size_t i = 0; i < customentities.size(); i++)
{ {
const CustomEntity& ent = customentities[i]; const CustomEntity& ent = customentities[i];
@ -431,7 +426,6 @@ void mapclass::initcustommapdata(void)
settrinket(ent.rx, ent.ry); settrinket(ent.rx, ent.ry);
} }
#endif
} }
int mapclass::finalat(int x, int y) int mapclass::finalat(int x, int y)
@ -958,7 +952,6 @@ void mapclass::gotoroom(int rx, int ry)
music.niceplay(Music_PREDESTINEDFATEREMIX); music.niceplay(Music_PREDESTINEDFATEREMIX);
} }
} }
#if !defined(NO_CUSTOM_LEVELS)
else if (custommode) else if (custommode)
{ {
game.roomx = rx; game.roomx = rx;
@ -968,7 +961,6 @@ void mapclass::gotoroom(int rx, int ry)
if (game.roomx > 100 + cl.mapwidth-1) game.roomx = 100; if (game.roomx > 100 + cl.mapwidth-1) game.roomx = 100;
if (game.roomy > 100 + cl.mapheight-1) game.roomy = 100; if (game.roomy > 100 + cl.mapheight-1) game.roomy = 100;
} }
#endif
else else
{ {
game.roomx = rx; game.roomx = rx;
@ -1725,7 +1717,6 @@ void mapclass::loadlevel(int rx, int ry)
break; break;
} }
#endif #endif
#if !defined(NO_CUSTOM_LEVELS)
case 12: //Custom level case 12: //Custom level
{ {
const RoomProperty* const room = cl.getroomprop(rx - 100, ry - 100); const RoomProperty* const room = cl.getroomprop(rx - 100, ry - 100);
@ -1961,7 +1952,6 @@ void mapclass::loadlevel(int rx, int ry)
//do the appear/remove roomname here //do the appear/remove roomname here
break; break;
} }
#endif
} }
//The room's loaded: now we fill out damage blocks based on the tiles. //The room's loaded: now we fill out damage blocks based on the tiles.
if (towermode) if (towermode)

View file

@ -225,7 +225,6 @@ static void menurender(void)
} }
break; break;
} }
#if !defined(NO_CUSTOM_LEVELS)
case Menu::levellist: case Menu::levellist:
{ {
if (cl.ListOfMetaData.size()==0) if (cl.ListOfMetaData.size()==0)
@ -261,7 +260,6 @@ static void menurender(void)
} }
break; break;
} }
#endif
case Menu::errornostart: case Menu::errornostart:
font::print_wrap(PR_CEN, -1, 65, loc::gettext("ERROR: This level has no start point!"), tr, tg, tb); font::print_wrap(PR_CEN, -1, 65, loc::gettext("ERROR: This level has no start point!"), tr, tg, tb);
break; break;
@ -1664,7 +1662,14 @@ static void menurender(void)
font::print_wrap(PR_CEN, -1, 125, loc::gettext("You have unlocked the intermission levels."), tr, tg, tb); font::print_wrap(PR_CEN, -1, 125, loc::gettext("You have unlocked the intermission levels."), tr, tg, tb);
break; break;
case Menu::playerworlds: case Menu::playerworlds:
if (game.editor_disabled)
{
font::print_wrap(PR_CEN, -1, 180, loc::gettext("This version of the game does not support the level editor, but it might be supported in the future."), tr, tg, tb);
}
else
{
font::print_wrap(PR_CEN, -1, 180, loc::gettext("To install new player levels, copy the .vvvvvv files to the levels folder."), tr, tg, tb); font::print_wrap(PR_CEN, -1, 180, loc::gettext("To install new player levels, copy the .vvvvvv files to the levels folder."), tr, tg, tb);
}
break; break;
case Menu::confirmshowlevelspath: case Menu::confirmshowlevelspath:
font::print_wrap(PR_CEN, -1, 80, loc::gettext("Are you sure you want to show the levels path? This may reveal sensitive information if you are streaming."), tr, tg, tb); font::print_wrap(PR_CEN, -1, 80, loc::gettext("Are you sure you want to show the levels path? This may reveal sensitive information if you are streaming."), tr, tg, tb);
@ -2079,7 +2084,6 @@ void gamerender(void)
} }
} }
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
if(map.custommode && !map.custommodeforreal && !game.advancetext){ if(map.custommode && !map.custommodeforreal && !game.advancetext){
//Return to level editor //Return to level editor
int alpha = graphics.lerp(ed.old_return_message_timer, ed.return_message_timer); int alpha = graphics.lerp(ed.old_return_message_timer, ed.return_message_timer);
@ -2096,8 +2100,6 @@ void gamerender(void)
font::print(PR_BRIGHTNESS(alpha) | PR_BOR, 5, 5, buffer, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2)); font::print(PR_BRIGHTNESS(alpha) | PR_BOR, 5, 5, buffer, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2));
} }
} }
#endif
graphics.cutscenebars(); graphics.cutscenebars();
graphics.drawfade(); graphics.drawfade();
@ -2465,14 +2467,12 @@ static MapRenderData getmaprenderdata(void)
static void rendermap(void) static void rendermap(void)
{ {
#ifndef NO_CUSTOM_LEVELS
if (map.custommode && map.customshowmm) if (map.custommode && map.customshowmm)
{ {
graphics.drawpixeltextbox(35 + map.custommmxoff, 16 + map.custommmyoff, map.custommmxsize + 10, map.custommmysize + 10, 65, 185, 207); graphics.drawpixeltextbox(35 + map.custommmxoff, 16 + map.custommmyoff, map.custommmxsize + 10, map.custommmysize + 10, 65, 185, 207);
graphics.drawpartimage(graphics.minimap_mounted ? IMAGE_MINIMAP : IMAGE_CUSTOMMINIMAP, 40 + map.custommmxoff, 21 + map.custommmyoff, map.custommmxsize, map.custommmysize); graphics.drawpartimage(graphics.minimap_mounted ? IMAGE_MINIMAP : IMAGE_CUSTOMMINIMAP, 40 + map.custommmxoff, 21 + map.custommmyoff, map.custommmxsize, map.custommmysize);
return; return;
} }
#endif /* NO_CUSTOM_LEVELS */
graphics.drawpixeltextbox(35, 16, 250, 190, 65, 185, 207); graphics.drawpixeltextbox(35, 16, 250, 190, 65, 185, 207);
graphics.drawimage(IMAGE_MINIMAP, 40, 21, false); graphics.drawimage(IMAGE_MINIMAP, 40, 21, false);
@ -2750,7 +2750,6 @@ void maprender(void)
); );
font::print_wrap(PR_CEN, -1, 105, buffer, 196, 196, 255 - help.glow); font::print_wrap(PR_CEN, -1, 105, buffer, 196, 196, 255 - help.glow);
} }
#if !defined(NO_CUSTOM_LEVELS)
else if(map.custommode){ else if(map.custommode){
LevelMetaData& meta = cl.ListOfMetaData[game.playcustomlevel]; LevelMetaData& meta = cl.ListOfMetaData[game.playcustomlevel];
@ -2780,7 +2779,6 @@ void maprender(void)
); );
font::print(PR_CEN, -1, FLIP(165, 8), buffer, 196, 196, 255 - help.glow); font::print(PR_CEN, -1, FLIP(165, 8), buffer, 196, 196, 255 - help.glow);
} }
#endif
else else
{ {
if (graphics.flipmode) if (graphics.flipmode)
@ -2842,13 +2840,11 @@ void maprender(void)
case 2: case 2:
{ {
int max_trinkets; int max_trinkets;
#ifndef NO_CUSTOM_LEVELS
if (map.custommode) if (map.custommode)
{ {
max_trinkets = cl.numtrinkets(); max_trinkets = cl.numtrinkets();
} }
else else
#endif
{ {
max_trinkets = 20; max_trinkets = 20;
} }

View file

@ -131,7 +131,6 @@ void gamerenderfixed(void)
map.updateroomnames(); map.updateroomnames();
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
ed.old_return_message_timer = ed.return_message_timer; ed.old_return_message_timer = ed.return_message_timer;
if (map.custommode && !map.custommodeforreal && ed.return_message_timer > 0) if (map.custommode && !map.custommodeforreal && ed.return_message_timer > 0)
{ {
@ -165,7 +164,6 @@ void gamerenderfixed(void)
} }
} }
} }
#endif
} }
void titlerenderfixed(void) void titlerenderfixed(void)

View file

@ -195,7 +195,6 @@ void scriptclass::run(void)
} }
scriptdelay = 1; scriptdelay = 1;
} }
#if !defined(NO_CUSTOM_LEVELS)
if (words[0] == "setroomname") if (words[0] == "setroomname")
{ {
++position; ++position;
@ -268,7 +267,6 @@ void scriptclass::run(void)
position--; position--;
} }
} }
#endif
if (words[0] == "destroy") if (words[0] == "destroy")
{ {
if(words[1]=="gravitylines"){ if(words[1]=="gravitylines"){
@ -1412,14 +1410,12 @@ void scriptclass::run(void)
} }
else if (words[0] == "rollcredits") else if (words[0] == "rollcredits")
{ {
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
if (map.custommode && !map.custommodeforreal) if (map.custommode && !map.custommodeforreal)
{ {
game.returntoeditor(); game.returntoeditor();
ed.show_note(loc::gettext("Rolled credits")); ed.show_note(loc::gettext("Rolled credits"));
} }
else else
#endif
{ {
game.gamestate = GAMECOMPLETE; game.gamestate = GAMECOMPLETE;
graphics.fademode = FADE_START_FADEIN; graphics.fademode = FADE_START_FADEIN;
@ -1768,13 +1764,11 @@ void scriptclass::run(void)
int max_trinkets; int max_trinkets;
#if !defined(NO_CUSTOM_LEVELS)
if (map.custommode) if (map.custommode)
{ {
max_trinkets = cl.numtrinkets(); max_trinkets = cl.numtrinkets();
} }
else else
#endif
{ {
max_trinkets = 20; max_trinkets = 20;
} }
@ -2423,7 +2417,6 @@ void scriptclass::run(void)
} }
else if (words[0] == "setfont") else if (words[0] == "setfont")
{ {
#ifndef NO_CUSTOM_LEVELS
if (words[1] == "") if (words[1] == "")
{ {
font::set_level_font(cl.level_font_name.c_str()); font::set_level_font(cl.level_font_name.c_str());
@ -2432,7 +2425,6 @@ void scriptclass::run(void)
{ {
font::set_level_font(raw_words[1].c_str()); font::set_level_font(raw_words[1].c_str());
} }
#endif
} }
position++; position++;
@ -2783,10 +2775,6 @@ void scriptclass::startgamemode(const enum StartMode mode)
} }
break; break;
#ifdef NO_CUSTOM_LEVELS
UNUSED(gotoerrorloadinglevel);
#else
# ifndef NO_EDITOR
case Start_EDITOR: case Start_EDITOR:
cl.reset(); cl.reset();
ed.reset(); ed.reset();
@ -2824,7 +2812,6 @@ void scriptclass::startgamemode(const enum StartMode mode)
music.currentsong = -1; music.currentsong = -1;
} }
break; break;
# endif /* NO_EDITOR */
case Start_CUSTOM: case Start_CUSTOM:
case Start_CUSTOM_QUICKSAVE: case Start_CUSTOM_QUICKSAVE:
@ -2867,8 +2854,6 @@ void scriptclass::startgamemode(const enum StartMode mode)
graphics.fademode = FADE_START_FADEIN; graphics.fademode = FADE_START_FADEIN;
break; break;
} }
#endif /* NO_CUSTOM_LEVELS */
case Start_CUTSCENETEST: case Start_CUTSCENETEST:
music.fadeout(); music.fadeout();
game.translator_exploring = true; game.translator_exploring = true;
@ -2881,12 +2866,7 @@ void scriptclass::startgamemode(const enum StartMode mode)
case Start_QUIT: case Start_QUIT:
VVV_unreachable(); VVV_unreachable();
#if defined(NO_CUSTOM_LEVELS) || defined(NO_EDITOR)
/* Silence warnings about unhandled cases. */
default:
break; break;
#endif
} }
game.gravitycontrol = game.savegc; game.gravitycontrol = game.savegc;
@ -2918,12 +2898,10 @@ void scriptclass::startgamemode(const enum StartMode mode)
map.resetplayer(); map.resetplayer();
map.gotoroom(game.saverx, game.savery); map.gotoroom(game.saverx, game.savery);
map.initmapdata(); map.initmapdata();
#ifndef NO_CUSTOM_LEVELS
if (map.custommode) if (map.custommode)
{ {
cl.generatecustomminimap(); cl.generatecustomminimap();
} }
#endif
/* If we are spawning in a tower, ensure variables are set correctly */ /* If we are spawning in a tower, ensure variables are set correctly */
if (map.towermode) if (map.towermode)

View file

@ -37,13 +37,9 @@
scriptclass script; scriptclass script;
#ifndef NO_CUSTOM_LEVELS
std::vector<CustomEntity> customentities; std::vector<CustomEntity> customentities;
customlevelclass cl; customlevelclass cl;
# ifndef NO_EDITOR
editorclass ed; editorclass ed;
# endif
#endif
UtilityClass help; UtilityClass help;
Graphics graphics; Graphics graphics;
@ -107,9 +103,6 @@ static void teleportermodeinput(void)
} }
} }
/* Only gets used in EDITORMODE. I assume the compiler will optimize this away
* if this is a NO_CUSTOM_LEVELS or NO_EDITOR build
*/
static void flipmodeoff(void) static void flipmodeoff(void)
{ {
graphics.flipmode = false; graphics.flipmode = false;
@ -181,9 +174,6 @@ static const inline struct ImplFunc* get_gamestate_funcs(
{Func_fixed, gamecompletelogic2}, {Func_fixed, gamecompletelogic2},
FUNC_LIST_END FUNC_LIST_END
#if defined(NO_CUSTOM_LEVELS) || defined(NO_EDITOR)
UNUSED(flipmodeoff);
#else
FUNC_LIST_BEGIN(EDITORMODE) FUNC_LIST_BEGIN(EDITORMODE)
{Func_fixed, flipmodeoff}, {Func_fixed, flipmodeoff},
{Func_input, editorinput}, {Func_input, editorinput},
@ -191,7 +181,6 @@ static const inline struct ImplFunc* get_gamestate_funcs(
{Func_fixed, editorrenderfixed}, {Func_fixed, editorrenderfixed},
{Func_delta, editorrender}, {Func_delta, editorrender},
FUNC_LIST_END FUNC_LIST_END
#endif
FUNC_LIST_BEGIN(PRELOADER) FUNC_LIST_BEGIN(PRELOADER)
{Func_input, preloaderinput}, {Func_input, preloaderinput},
@ -380,6 +369,7 @@ int main(int argc, char *argv[])
char* langDir = NULL; char* langDir = NULL;
char* fontsDir = NULL; char* fontsDir = NULL;
bool seed_use_sdl_getticks = false; bool seed_use_sdl_getticks = false;
bool editor_disabled = !BUTTONGLYPHS_keyboard_is_available();
#ifdef _WIN32 #ifdef _WIN32
bool open_console = false; bool open_console = false;
#endif #endif
@ -407,12 +397,6 @@ int main(int argc, char *argv[])
"VVVVVV " RELEASE_VERSION "VVVVVV " RELEASE_VERSION
#ifdef MAKEANDPLAY #ifdef MAKEANDPLAY
" [M&P]" " [M&P]"
#endif
#ifdef NO_CUSTOM_LEVELS
" [no custom levels]"
#endif
#ifdef NO_EDITOR
" [no editor]"
#endif #endif
); );
#ifdef INTERIM_VERSION_EXISTS #ifdef INTERIM_VERSION_EXISTS
@ -424,12 +408,6 @@ int main(int argc, char *argv[])
} }
else if (ARG("-addresses")) else if (ARG("-addresses"))
{ {
#ifndef NO_CUSTOM_LEVELS
printf("cl : %p\n", (void*) &cl);
# ifndef NO_EDITOR
printf("ed : %p\n", (void*) &ed);
# endif
#endif
printf("game : %p\n", (void*) &game); printf("game : %p\n", (void*) &game);
printf("gameScreen : %p\n", (void*) &gameScreen); printf("gameScreen : %p\n", (void*) &gameScreen);
printf("graphics : %p\n", (void*) &graphics); printf("graphics : %p\n", (void*) &graphics);
@ -553,6 +531,10 @@ int main(int argc, char *argv[])
{ {
seed_use_sdl_getticks = true; seed_use_sdl_getticks = true;
} }
else if (ARG("-enable-editor"))
{
editor_disabled = false;
}
#undef ARG_INNER #undef ARG_INNER
#undef ARG #undef ARG
else else
@ -626,6 +608,7 @@ int main(int argc, char *argv[])
game.init(); game.init();
game.seed_use_sdl_getticks = seed_use_sdl_getticks; game.seed_use_sdl_getticks = seed_use_sdl_getticks;
game.editor_disabled = editor_disabled;
game.gamestate = PRELOADER; game.gamestate = PRELOADER;
@ -756,7 +739,6 @@ int main(int argc, char *argv[])
obj.init(); obj.init();
#if !defined(NO_CUSTOM_LEVELS)
if (startinplaytest) { if (startinplaytest) {
game.levelpage = 0; game.levelpage = 0;
game.playcustomlevel = 0; game.playcustomlevel = 0;
@ -808,7 +790,6 @@ int main(int argc, char *argv[])
graphics.fademode = FADE_NONE; graphics.fademode = FADE_NONE;
} }
#endif
/* Only create the window after we have loaded all the assets. */ /* Only create the window after we have loaded all the assets. */
SDL_ShowWindow(gameScreen.m_window); SDL_ShowWindow(gameScreen.m_window);