mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Add option to allow custom levels when the editor is disabled
This commit is contained in:
parent
7d35c5ce4e
commit
1b00d12600
10 changed files with 59 additions and 27 deletions
|
@ -7,6 +7,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
|
||||||
OPTION(ENABLE_WARNINGS "Enable compilation warnings" ON)
|
OPTION(ENABLE_WARNINGS "Enable compilation warnings" ON)
|
||||||
OPTION(ENABLE_WERROR "Treat compilation warnings as errors" OFF)
|
OPTION(ENABLE_WERROR "Treat compilation warnings as errors" OFF)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
# Architecture Flags
|
# Architecture Flags
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
# Wow, Apple is a huge jerk these days huh?
|
# Wow, Apple is a huge jerk these days huh?
|
||||||
|
@ -24,7 +27,6 @@ IF(APPLE)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
PROJECT(VVVVVV)
|
PROJECT(VVVVVV)
|
||||||
OPTION(NO_EDITOR "Compile without the level editor" OFF)
|
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
MESSAGE(STATUS "Using macOS SDK at ${CMAKE_OSX_SYSROOT}")
|
MESSAGE(STATUS "Using macOS SDK at ${CMAKE_OSX_SYSROOT}")
|
||||||
|
@ -96,10 +98,8 @@ SET(VVV_SRC
|
||||||
src/SteamNetwork.c
|
src/SteamNetwork.c
|
||||||
src/GOGNetwork.c
|
src/GOGNetwork.c
|
||||||
)
|
)
|
||||||
IF (NOT NO_EDITOR)
|
IF(NOT CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED")
|
||||||
LIST(APPEND VVV_SRC src/editor.cpp)
|
LIST(APPEND VVV_SRC src/editor.cpp)
|
||||||
ELSE()
|
|
||||||
ADD_DEFINITIONS(-DNO_EDITOR)
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(XML_SRC
|
SET(XML_SRC
|
||||||
|
@ -144,6 +144,12 @@ IF(ENABLE_WARNINGS)
|
||||||
/W4 $<$<BOOL:${ENABLE_WERROR}>:/WX>>)
|
/W4 $<$<BOOL:${ENABLE_WERROR}>:/WX>>)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF(CUSTOM_LEVEL_SUPPORT STREQUAL "NO_EDITOR")
|
||||||
|
ADD_DEFINITIONS(-DNO_EDITOR)
|
||||||
|
ELSEIF(CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED")
|
||||||
|
ADD_DEFINITIONS(-DNO_CUSTOM_LEVELS -DNO_EDITOR)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# Library information
|
# Library information
|
||||||
ADD_LIBRARY(tinyxml-static STATIC ${XML_SRC})
|
ADD_LIBRARY(tinyxml-static STATIC ${XML_SRC})
|
||||||
ADD_LIBRARY(physfs-static STATIC ${PFS_SRC} ${PFSP_SRC})
|
ADD_LIBRARY(physfs-static STATIC ${PFS_SRC} ${PFSP_SRC})
|
||||||
|
|
|
@ -2057,7 +2057,7 @@ void Game::updatestate( Graphics& dwgfx, mapclass& map, entityclass& obj, Utilit
|
||||||
dwgfx.textboxcenterx();
|
dwgfx.textboxcenterx();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
case 1013:
|
case 1013:
|
||||||
dwgfx.textboxremove();
|
dwgfx.textboxremove();
|
||||||
hascontrol = true;
|
hascontrol = true;
|
||||||
|
@ -6772,7 +6772,7 @@ void Game::createmenu( std::string t )
|
||||||
menuxoff = -16;
|
menuxoff = -16;
|
||||||
menuyoff = -10;
|
menuyoff = -10;
|
||||||
#elif !defined(MAKEANDPLAY)
|
#elif !defined(MAKEANDPLAY)
|
||||||
#if defined(NO_EDITOR)
|
#if defined(NO_CUSTOM_LEVELS)
|
||||||
menuoptions[0] = "start game";
|
menuoptions[0] = "start game";
|
||||||
menuoptionsactive[0] = true;
|
menuoptionsactive[0] = true;
|
||||||
menuoptions[1] = "graphic options";
|
menuoptions[1] = "graphic options";
|
||||||
|
@ -6805,9 +6805,10 @@ void Game::createmenu( std::string t )
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
else if (t == "playerworlds")
|
else if (t == "playerworlds")
|
||||||
{
|
{
|
||||||
|
#if !defined(NO_EDITOR)
|
||||||
menuoptions[0] = "play a level";
|
menuoptions[0] = "play a level";
|
||||||
menuoptionsactive[0] = true;
|
menuoptionsactive[0] = true;
|
||||||
menuoptions[1] = "level editor";
|
menuoptions[1] = "level editor";
|
||||||
|
@ -6819,6 +6820,15 @@ void Game::createmenu( std::string t )
|
||||||
nummenuoptions = 3;
|
nummenuoptions = 3;
|
||||||
menuxoff = -30;
|
menuxoff = -30;
|
||||||
menuyoff = -40;
|
menuyoff = -40;
|
||||||
|
#else
|
||||||
|
menuoptions[0] = "play a level";
|
||||||
|
menuoptionsactive[0] = true;
|
||||||
|
menuoptions[1] = "back to menu";
|
||||||
|
menuoptionsactive[1] = true;
|
||||||
|
nummenuoptions = 2;
|
||||||
|
menuxoff = -30;
|
||||||
|
menuyoff = -40;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (t == "levellist")
|
else if (t == "levellist")
|
||||||
{
|
{
|
||||||
|
|
|
@ -274,7 +274,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif !defined(MAKEANDPLAY)
|
#elif !defined(MAKEANDPLAY)
|
||||||
#if defined(NO_EDITOR)
|
#if defined(NO_CUSTOM_LEVELS)
|
||||||
if (game.currentmenuoption == 0)
|
if (game.currentmenuoption == 0)
|
||||||
{
|
{
|
||||||
//Play
|
//Play
|
||||||
|
@ -394,7 +394,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
else if(game.currentmenuname=="levellist")
|
else if(game.currentmenuname=="levellist")
|
||||||
{
|
{
|
||||||
if(game.currentmenuoption==game.nummenuoptions-1){
|
if(game.currentmenuoption==game.nummenuoptions-1){
|
||||||
|
@ -448,9 +448,10 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
|
||||||
map.nexttowercolour();
|
map.nexttowercolour();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
else if(game.currentmenuname=="playerworlds")
|
else if(game.currentmenuname=="playerworlds")
|
||||||
{
|
{
|
||||||
|
#if !defined(NO_EDITOR)
|
||||||
if(game.currentmenuoption==0){
|
if(game.currentmenuoption==0){
|
||||||
|
|
||||||
music.playef(11, 10);
|
music.playef(11, 10);
|
||||||
|
@ -481,6 +482,21 @@ SDL_assert(0 && "Remove open level dir");
|
||||||
game.createmenu("mainmenu");
|
game.createmenu("mainmenu");
|
||||||
map.nexttowercolour();
|
map.nexttowercolour();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if(game.currentmenuoption==0){
|
||||||
|
music.playef(11, 10);
|
||||||
|
game.levelpage=0;
|
||||||
|
ed.getDirectoryData();
|
||||||
|
game.loadcustomlevelstats(); //Should only load a file if it's needed
|
||||||
|
game.createmenu("levellist");
|
||||||
|
map.nexttowercolour();
|
||||||
|
}else if(game.currentmenuoption==1){
|
||||||
|
//back
|
||||||
|
music.playef(11, 10);
|
||||||
|
game.createmenu("mainmenu");
|
||||||
|
map.nexttowercolour();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if(game.currentmenuname=="errornostart"){
|
else if(game.currentmenuname=="errornostart"){
|
||||||
|
@ -1955,7 +1971,7 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returning to editor mode must always be possible
|
//Returning to editor mode must always be possible
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
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){
|
||||||
game.mapheld = true;
|
game.mapheld = true;
|
||||||
|
@ -2402,7 +2418,7 @@ void mapinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
|
|
||||||
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111) game.savearea = "The Ship";
|
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111) game.savearea = "The Ship";
|
||||||
|
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
if(map.custommodeforreal)
|
if(map.custommodeforreal)
|
||||||
{
|
{
|
||||||
game.customsavequick(ed.ListOfMetaData[game.playcustomlevel].filename, map, obj, music);
|
game.customsavequick(ed.ListOfMetaData[game.playcustomlevel].filename, map, obj, music);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "MakeAndPlay.h"
|
#include "MakeAndPlay.h"
|
||||||
|
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
extern editorclass ed;
|
extern editorclass ed;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -978,7 +978,7 @@ void mapclass::gotoroom(int rx, int ry, Graphics& dwgfx, Game& game, entityclass
|
||||||
if (game.roomx == 46 && game.roomy == 54) music.niceplay(15); //Final level remix
|
if (game.roomx == 46 && game.roomy == 54) music.niceplay(15); //Final level remix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
else if (custommode)
|
else if (custommode)
|
||||||
{
|
{
|
||||||
game.roomx = rx;
|
game.roomx = rx;
|
||||||
|
@ -1589,7 +1589,7 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
case 12: //Custom level
|
case 12: //Custom level
|
||||||
int curlevel=(rx-100)+((ry-100)*ed.maxwidth);
|
int curlevel=(rx-100)+((ry-100)*ed.maxwidth);
|
||||||
game.customcol=ed.getlevelcol(curlevel)+1;
|
game.customcol=ed.getlevelcol(curlevel)+1;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "Music.h"
|
#include "Music.h"
|
||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
|
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
extern editorclass ed;
|
extern editorclass ed;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
obj.entities[player].yp += ss_toi(words[2]);
|
obj.entities[player].yp += ss_toi(words[2]);
|
||||||
scriptdelay = 1;
|
scriptdelay = 1;
|
||||||
}
|
}
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
if (words[0] == "warpdir")
|
if (words[0] == "warpdir")
|
||||||
{
|
{
|
||||||
int temprx=ss_toi(words[1])-1;
|
int temprx=ss_toi(words[1])-1;
|
||||||
|
@ -3158,7 +3158,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
|
|
||||||
load("intermission_2");
|
load("intermission_2");
|
||||||
break;
|
break;
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
case 20:
|
case 20:
|
||||||
//Level editor
|
//Level editor
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset(key, dwgfx, game, map, obj, help, music);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
|
|
||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
|
|
||||||
|
@ -5386,4 +5386,4 @@ void editorinput( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map, enti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* NO_EDITOR */
|
#endif /* NO_CUSTOM_LEVELS */
|
|
@ -1,4 +1,4 @@
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
|
|
||||||
#ifndef EDITOR_H
|
#ifndef EDITOR_H
|
||||||
#define EDITOR_H
|
#define EDITOR_H
|
||||||
|
@ -264,4 +264,4 @@ void editorinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
|
|
||||||
#endif /* EDITOR_H */
|
#endif /* EDITOR_H */
|
||||||
|
|
||||||
#endif /* NO_EDITOR */
|
#endif /* NO_CUSTOM_LEVELS */
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
scriptclass script;
|
scriptclass script;
|
||||||
|
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
edentities edentity[3000];
|
edentities edentity[3000];
|
||||||
editorclass ed;
|
editorclass ed;
|
||||||
#endif
|
#endif
|
||||||
|
@ -369,7 +369,7 @@ int main(int argc, char *argv[])
|
||||||
//Render
|
//Render
|
||||||
preloaderrender(graphics, game, help);
|
preloaderrender(graphics, game, help);
|
||||||
break;
|
break;
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
case EDITORMODE:
|
case EDITORMODE:
|
||||||
graphics.flipmode = false;
|
graphics.flipmode = false;
|
||||||
//Input
|
//Input
|
||||||
|
@ -514,7 +514,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
//Mute button
|
//Mute button
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
bool inEditor = ed.textentry || ed.scripthelppage == 1;
|
bool inEditor = ed.textentry || ed.scripthelppage == 1;
|
||||||
#else
|
#else
|
||||||
bool inEditor = false;
|
bool inEditor = false;
|
||||||
|
|
|
@ -92,7 +92,7 @@ void titlerender(Graphics& dwgfx, mapclass& map, Game& game, entityclass& obj, U
|
||||||
dwgfx.Print( 10, 230, "[MMMMMM Mod Installed]", tr/2, tg/2, tb/2);
|
dwgfx.Print( 10, 230, "[MMMMMM Mod Installed]", tr/2, tg/2, tb/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
else if (game.currentmenuname == "levellist")
|
else if (game.currentmenuname == "levellist")
|
||||||
{
|
{
|
||||||
if(ed.ListOfMetaData.size()==0){
|
if(ed.ListOfMetaData.size()==0){
|
||||||
|
@ -2301,7 +2301,7 @@ void maprender(Graphics& dwgfx, Game& game, mapclass& map, entityclass& obj, Uti
|
||||||
|
|
||||||
dwgfx.Print(0, 105, "Press ACTION to warp to the ship.", 196, 196, 255 - help.glow, true);
|
dwgfx.Print(0, 105, "Press ACTION to warp to the ship.", 196, 196, 255 - help.glow, true);
|
||||||
}
|
}
|
||||||
#if !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
else if(map.custommode){
|
else if(map.custommode){
|
||||||
dwgfx.Print(30, 220, "MAP", 64,64,64);
|
dwgfx.Print(30, 220, "MAP", 64,64,64);
|
||||||
dwgfx.Print(103-8, 220, "[CREW]", 196, 196, 255 - help.glow);
|
dwgfx.Print(103-8, 220, "[CREW]", 196, 196, 255 - help.glow);
|
||||||
|
|
Loading…
Reference in a new issue