mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 09:39:43 +01:00
Add option to compile without the level editor
This commit is contained in:
parent
3273b4ab55
commit
7d35c5ce4e
11 changed files with 183 additions and 51 deletions
|
@ -24,6 +24,7 @@ IF(APPLE)
|
|||
ENDIF()
|
||||
|
||||
PROJECT(VVVVVV)
|
||||
OPTION(NO_EDITOR "Compile without the level editor" OFF)
|
||||
|
||||
IF(APPLE)
|
||||
MESSAGE(STATUS "Using macOS SDK at ${CMAKE_OSX_SYSROOT}")
|
||||
|
@ -63,7 +64,6 @@ INCLUDE_DIRECTORIES(
|
|||
SET(VVV_SRC
|
||||
src/BinaryBlob.cpp
|
||||
src/BlockV.cpp
|
||||
src/editor.cpp
|
||||
src/Ent.cpp
|
||||
src/Entity.cpp
|
||||
src/FileSystemUtils.cpp
|
||||
|
@ -96,6 +96,12 @@ SET(VVV_SRC
|
|||
src/SteamNetwork.c
|
||||
src/GOGNetwork.c
|
||||
)
|
||||
IF (NOT NO_EDITOR)
|
||||
LIST(APPEND VVV_SRC src/editor.cpp)
|
||||
ELSE()
|
||||
ADD_DEFINITIONS(-DNO_EDITOR)
|
||||
ENDIF()
|
||||
|
||||
SET(XML_SRC
|
||||
../third_party/tinyxml/tinystr.cpp
|
||||
../third_party/tinyxml/tinyxml.cpp
|
||||
|
|
|
@ -2057,6 +2057,7 @@ void Game::updatestate( Graphics& dwgfx, mapclass& map, entityclass& obj, Utilit
|
|||
dwgfx.textboxcenterx();
|
||||
}
|
||||
break;
|
||||
#if !defined(NO_EDITOR)
|
||||
case 1013:
|
||||
dwgfx.textboxremove();
|
||||
hascontrol = true;
|
||||
|
@ -2087,6 +2088,7 @@ void Game::updatestate( Graphics& dwgfx, mapclass& map, entityclass& obj, Utilit
|
|||
}
|
||||
dwgfx.showcutscenebars = false;
|
||||
break;
|
||||
#endif
|
||||
case 1014:
|
||||
frames--;
|
||||
if(dwgfx.fademode == 1) state++;
|
||||
|
@ -6757,7 +6759,7 @@ void Game::createmenu( std::string t )
|
|||
|
||||
if (t == "mainmenu")
|
||||
{
|
||||
#if defined(MAKEANDPLAY)
|
||||
#if defined(MAKEANDPLAY)
|
||||
menuoptions[0] = "player levels";
|
||||
menuoptionsactive[0] = true;
|
||||
menuoptions[1] = "graphic options";
|
||||
|
@ -6769,7 +6771,22 @@ void Game::createmenu( std::string t )
|
|||
nummenuoptions = 4;
|
||||
menuxoff = -16;
|
||||
menuyoff = -10;
|
||||
#elif !defined(MAKEANDPLAY)
|
||||
#elif !defined(MAKEANDPLAY)
|
||||
#if defined(NO_EDITOR)
|
||||
menuoptions[0] = "start game";
|
||||
menuoptionsactive[0] = true;
|
||||
menuoptions[1] = "graphic options";
|
||||
menuoptionsactive[1] = true;
|
||||
menuoptions[2] = "game options";
|
||||
menuoptionsactive[2] = true;
|
||||
menuoptions[3] = "view credits";
|
||||
menuoptionsactive[3] = true;
|
||||
menuoptions[4] = "quit game";
|
||||
menuoptionsactive[4] = true;
|
||||
nummenuoptions = 5;
|
||||
menuxoff = -16;
|
||||
menuyoff = -10;
|
||||
#else
|
||||
menuoptions[0] = "start game";
|
||||
menuoptionsactive[0] = true;
|
||||
menuoptions[1] = "player levels";
|
||||
|
@ -6786,7 +6803,9 @@ void Game::createmenu( std::string t )
|
|||
menuxoff = -16;
|
||||
menuyoff = -10;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#if !defined(NO_EDITOR)
|
||||
else if (t == "playerworlds")
|
||||
{
|
||||
menuoptions[0] = "play a level";
|
||||
|
@ -6801,36 +6820,6 @@ void Game::createmenu( std::string t )
|
|||
menuxoff = -30;
|
||||
menuyoff = -40;
|
||||
}
|
||||
else if (t == "quickloadlevel")
|
||||
{
|
||||
menuoptions[0] = "continue from save";
|
||||
menuoptionsactive[0] = true;
|
||||
menuoptions[1] = "start from beginning";
|
||||
menuoptionsactive[1] = true;
|
||||
menuoptions[2] = "back to levels";
|
||||
menuoptionsactive[2] = true;
|
||||
nummenuoptions = 3;
|
||||
menuxoff = -40;
|
||||
menuyoff = -30;
|
||||
}
|
||||
else if (t == "youwannaquit")
|
||||
{
|
||||
menuoptions[0] = "yes, quit";
|
||||
menuoptionsactive[0] = true;
|
||||
menuoptions[1] = "no, return";
|
||||
menuoptionsactive[1] = true;
|
||||
nummenuoptions = 2;
|
||||
menuxoff = 0;
|
||||
menuyoff = -20;
|
||||
}
|
||||
else if (t == "errornostart")
|
||||
{
|
||||
menuoptions[0] = "ok";
|
||||
menuoptionsactive[0] = true;
|
||||
nummenuoptions = 1;
|
||||
menuxoff = 0;
|
||||
menuyoff = -20;
|
||||
}
|
||||
else if (t == "levellist")
|
||||
{
|
||||
if(ed.ListOfMetaData.size()==0)
|
||||
|
@ -6903,6 +6892,37 @@ void Game::createmenu( std::string t )
|
|||
menuyoff = 70-(tcount*10);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (t == "quickloadlevel")
|
||||
{
|
||||
menuoptions[0] = "continue from save";
|
||||
menuoptionsactive[0] = true;
|
||||
menuoptions[1] = "start from beginning";
|
||||
menuoptionsactive[1] = true;
|
||||
menuoptions[2] = "back to levels";
|
||||
menuoptionsactive[2] = true;
|
||||
nummenuoptions = 3;
|
||||
menuxoff = -40;
|
||||
menuyoff = -30;
|
||||
}
|
||||
else if (t == "youwannaquit")
|
||||
{
|
||||
menuoptions[0] = "yes, quit";
|
||||
menuoptionsactive[0] = true;
|
||||
menuoptions[1] = "no, return";
|
||||
menuoptionsactive[1] = true;
|
||||
nummenuoptions = 2;
|
||||
menuxoff = 0;
|
||||
menuyoff = -20;
|
||||
}
|
||||
else if (t == "errornostart")
|
||||
{
|
||||
menuoptions[0] = "ok";
|
||||
menuoptionsactive[0] = true;
|
||||
nummenuoptions = 1;
|
||||
menuxoff = 0;
|
||||
menuyoff = -20;
|
||||
}
|
||||
else if (t == "graphicoptions")
|
||||
{
|
||||
menuoptions[0] = "toggle fullscreen";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Input.h"
|
||||
#include "Script.h"
|
||||
|
||||
#include "MakeAndPlay.h"
|
||||
|
||||
|
@ -6,6 +7,8 @@
|
|||
|
||||
#include "FileSystemUtils.h"
|
||||
|
||||
extern scriptclass script;
|
||||
|
||||
// Found in titlerender.cpp
|
||||
void updategraphicsmode(Game& game, Graphics& dwgfx);
|
||||
|
||||
|
@ -231,7 +234,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
|
|||
if (game.currentmenuname == "mainmenu")
|
||||
{
|
||||
|
||||
#if defined(MAKEANDPLAY)
|
||||
#if defined(MAKEANDPLAY)
|
||||
if (game.currentmenuoption == 0)
|
||||
{
|
||||
//Bring you to the normal playmenu
|
||||
|
@ -270,7 +273,8 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
|
|||
dwgfx.fademode = 2;
|
||||
}
|
||||
}
|
||||
#elif !defined(MAKEANDPLAY)
|
||||
#elif !defined(MAKEANDPLAY)
|
||||
#if defined(NO_EDITOR)
|
||||
if (game.currentmenuoption == 0)
|
||||
{
|
||||
//Play
|
||||
|
@ -290,7 +294,62 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
|
|||
}
|
||||
else if (game.currentmenuoption == 1)
|
||||
{
|
||||
//Bring you to the normal playmenu
|
||||
//Options
|
||||
music.playef(11, 10);
|
||||
game.createmenu("graphicoptions");
|
||||
map.nexttowercolour();
|
||||
}
|
||||
else if (game.currentmenuoption == 2)
|
||||
{
|
||||
//Options
|
||||
music.playef(11, 10);
|
||||
game.createmenu("options");
|
||||
|
||||
//Add extra menu for mmmmmm mod
|
||||
if(music.mmmmmm){
|
||||
game.menuoptions[4] = "soundtrack";
|
||||
game.menuoptionsactive[4] = true;
|
||||
game.menuoptions[5] = "return";
|
||||
game.menuoptionsactive[5] = true;
|
||||
game.nummenuoptions = 6;
|
||||
}
|
||||
map.nexttowercolour();
|
||||
}
|
||||
else if (game.currentmenuoption == 3)
|
||||
{
|
||||
//Credits
|
||||
music.playef(11, 10);
|
||||
game.createmenu("credits");
|
||||
map.nexttowercolour();
|
||||
}
|
||||
else if (game.currentmenuoption == 4)
|
||||
{
|
||||
//bye!
|
||||
music.playef(2, 10);
|
||||
game.mainmenu = 100;
|
||||
dwgfx.fademode = 2;
|
||||
}
|
||||
#else
|
||||
if (game.currentmenuoption == 0)
|
||||
{
|
||||
//Play
|
||||
if (game.telesummary == "" && game.quicksummary == "")
|
||||
{
|
||||
//No saves exist, just start a new game
|
||||
game.mainmenu = 0;
|
||||
dwgfx.fademode = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Bring you to the normal playmenu
|
||||
music.playef(11, 10);
|
||||
game.createmenu("play");
|
||||
map.nexttowercolour();
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuoption == 1)
|
||||
{
|
||||
//Bring you to the normal playmenu
|
||||
music.playef(11, 10);
|
||||
game.createmenu("playerworlds");
|
||||
map.nexttowercolour();
|
||||
|
@ -308,14 +367,14 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
|
|||
music.playef(11, 10);
|
||||
game.createmenu("options");
|
||||
|
||||
//Add extra menu for mmmmmm mod
|
||||
if(music.mmmmmm){
|
||||
game.menuoptions[4] = "soundtrack";
|
||||
game.menuoptionsactive[4] = true;
|
||||
game.menuoptions[5] = "return";
|
||||
game.menuoptionsactive[5] = true;
|
||||
game.nummenuoptions = 6;
|
||||
}
|
||||
//Add extra menu for mmmmmm mod
|
||||
if(music.mmmmmm){
|
||||
game.menuoptions[4] = "soundtrack";
|
||||
game.menuoptionsactive[4] = true;
|
||||
game.menuoptions[5] = "return";
|
||||
game.menuoptionsactive[5] = true;
|
||||
game.nummenuoptions = 6;
|
||||
}
|
||||
map.nexttowercolour();
|
||||
}
|
||||
else if (game.currentmenuoption == 4)
|
||||
|
@ -332,8 +391,10 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
|
|||
game.mainmenu = 100;
|
||||
dwgfx.fademode = 2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if !defined(NO_EDITOR)
|
||||
else if(game.currentmenuname=="levellist")
|
||||
{
|
||||
if(game.currentmenuoption==game.nummenuoptions-1){
|
||||
|
@ -371,6 +432,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if(game.currentmenuname=="quickloadlevel")
|
||||
{
|
||||
if(game.currentmenuoption==0){//continue save
|
||||
|
@ -386,6 +448,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
|
|||
map.nexttowercolour();
|
||||
}
|
||||
}
|
||||
#if !defined(NO_EDITOR)
|
||||
else if(game.currentmenuname=="playerworlds")
|
||||
{
|
||||
if(game.currentmenuoption==0){
|
||||
|
@ -419,6 +482,7 @@ SDL_assert(0 && "Remove open level dir");
|
|||
map.nexttowercolour();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if(game.currentmenuname=="errornostart"){
|
||||
music.playef(11, 10);
|
||||
game.createmenu("mainmenu");
|
||||
|
@ -1891,6 +1955,7 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
|||
}
|
||||
|
||||
//Returning to editor mode must always be possible
|
||||
#if !defined(NO_EDITOR)
|
||||
if(map.custommode && !map.custommodeforreal){
|
||||
if ((game.press_map || key.isDown(27)) && !game.mapheld){
|
||||
game.mapheld = true;
|
||||
|
@ -1924,6 +1989,7 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//Entity type 0 is player controled
|
||||
for (int ie = 0; ie < obj.nentity; ++ie)
|
||||
|
@ -2336,9 +2402,14 @@ 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(map.custommodeforreal){
|
||||
#if !defined(NO_EDITOR)
|
||||
if(map.custommodeforreal)
|
||||
{
|
||||
game.customsavequick(ed.ListOfMetaData[game.playcustomlevel].filename, map, obj, music);
|
||||
}else{
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
game.savequick(map, obj, music);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include "Logic.h"
|
||||
#include "Script.h"
|
||||
#include "Network.h"
|
||||
|
||||
extern int temp;
|
||||
extern scriptclass script;
|
||||
|
||||
void titlelogic( Graphics& dwgfx, Game& game, entityclass& obj, UtilityClass& help, musicclass& music, mapclass& map)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
#include "MakeAndPlay.h"
|
||||
|
||||
extern editorclass ed;
|
||||
#if !defined(NO_EDITOR)
|
||||
extern editorclass ed;
|
||||
#endif
|
||||
|
||||
mapclass::mapclass()
|
||||
{
|
||||
|
@ -976,6 +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 !defined(NO_EDITOR)
|
||||
else if (custommode)
|
||||
{
|
||||
game.roomx = rx;
|
||||
|
@ -986,6 +989,7 @@ void mapclass::gotoroom(int rx, int ry, Graphics& dwgfx, Game& game, entityclass
|
|||
if (game.roomx > 100 + ed.mapwidth-1) game.roomx = 100;
|
||||
if (game.roomy > 100 + ed.mapheight-1) game.roomy = 100;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
game.roomx = rx;
|
||||
|
@ -1585,6 +1589,7 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
|
|||
}
|
||||
break;
|
||||
#endif
|
||||
#if !defined(NO_EDITOR)
|
||||
case 12: //Custom level
|
||||
int curlevel=(rx-100)+((ry-100)*ed.maxwidth);
|
||||
game.customcol=ed.getlevelcol(curlevel)+1;
|
||||
|
@ -1772,6 +1777,7 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
|
|||
}
|
||||
}*/
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
//The room's loaded: now we fill out damage blocks based on the tiles.
|
||||
if (towermode)
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
#include "Music.h"
|
||||
#include "editor.h"
|
||||
|
||||
extern editorclass ed;
|
||||
#if !defined(NO_EDITOR)
|
||||
extern editorclass ed;
|
||||
#endif
|
||||
|
||||
class mapclass
|
||||
{
|
||||
|
|
|
@ -92,6 +92,7 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
|||
obj.entities[player].yp += ss_toi(words[2]);
|
||||
scriptdelay = 1;
|
||||
}
|
||||
#if !defined(NO_EDITOR)
|
||||
if (words[0] == "warpdir")
|
||||
{
|
||||
int temprx=ss_toi(words[1])-1;
|
||||
|
@ -138,6 +139,7 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
|||
position--;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (words[0] == "destroy")
|
||||
{
|
||||
if(words[1]=="gravitylines"){
|
||||
|
@ -3156,6 +3158,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
|||
|
||||
load("intermission_2");
|
||||
break;
|
||||
#if !defined(NO_EDITOR)
|
||||
case 20:
|
||||
//Level editor
|
||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
||||
|
@ -3308,6 +3311,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
|||
dwgfx.fademode = 4;
|
||||
//load("intro");
|
||||
break;
|
||||
#endif
|
||||
case 100:
|
||||
game.savestats(map, dwgfx);
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#if !defined(NO_EDITOR)
|
||||
|
||||
#include "editor.h"
|
||||
|
||||
#include "Graphics.h"
|
||||
|
@ -5383,3 +5385,5 @@ void editorinput( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map, enti
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* NO_EDITOR */
|
|
@ -1,3 +1,5 @@
|
|||
#if !defined(NO_EDITOR)
|
||||
|
||||
#ifndef EDITOR_H
|
||||
#define EDITOR_H
|
||||
|
||||
|
@ -261,3 +263,5 @@ void editorinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
|||
entityclass& obj, UtilityClass& help, musicclass& music);
|
||||
|
||||
#endif /* EDITOR_H */
|
||||
|
||||
#endif /* NO_EDITOR */
|
|
@ -30,9 +30,11 @@
|
|||
#include <string.h>
|
||||
|
||||
scriptclass script;
|
||||
edentities edentity[3000];
|
||||
|
||||
editorclass ed;
|
||||
#if !defined(NO_EDITOR)
|
||||
edentities edentity[3000];
|
||||
editorclass ed;
|
||||
#endif
|
||||
|
||||
UtilityClass help;
|
||||
Graphics graphics;
|
||||
|
@ -367,6 +369,7 @@ int main(int argc, char *argv[])
|
|||
//Render
|
||||
preloaderrender(graphics, game, help);
|
||||
break;
|
||||
#if !defined(NO_EDITOR)
|
||||
case EDITORMODE:
|
||||
graphics.flipmode = false;
|
||||
//Input
|
||||
|
@ -376,6 +379,7 @@ int main(int argc, char *argv[])
|
|||
////Logic
|
||||
editorlogic(key, graphics, game, obj, music, map, help);
|
||||
break;
|
||||
#endif
|
||||
case TITLEMODE:
|
||||
//Input
|
||||
titleinput(key, graphics, map, game, obj, help, music);
|
||||
|
@ -510,7 +514,12 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
//Mute button
|
||||
if (key.isDown(KEYBOARD_m) && game.mutebutton<=0 && !ed.textentry && ed.scripthelppage != 1)
|
||||
#if !defined(NO_EDITOR)
|
||||
bool inEditor = ed.textentry || ed.scripthelppage == 1;
|
||||
#else
|
||||
bool inEditor = false;
|
||||
#endif
|
||||
if (key.isDown(KEYBOARD_m) && game.mutebutton<=0 && !inEditor)
|
||||
{
|
||||
game.mutebutton = 8;
|
||||
if (game.muted)
|
||||
|
|
|
@ -92,6 +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);
|
||||
}
|
||||
}
|
||||
#if !defined(NO_EDITOR)
|
||||
else if (game.currentmenuname == "levellist")
|
||||
{
|
||||
if(ed.ListOfMetaData.size()==0){
|
||||
|
@ -112,6 +113,7 @@ void titlerender(Graphics& dwgfx, mapclass& map, Game& game, entityclass& obj, U
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (game.currentmenuname == "errornostart")
|
||||
{
|
||||
dwgfx.Print( -1, 65, "ERROR: This level has", tr, tg, tb, true);
|
||||
|
@ -2299,6 +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);
|
||||
}
|
||||
#if !defined(NO_EDITOR)
|
||||
else if(map.custommode){
|
||||
dwgfx.Print(30, 220, "MAP", 64,64,64);
|
||||
dwgfx.Print(103-8, 220, "[CREW]", 196, 196, 255 - help.glow);
|
||||
|
@ -2336,6 +2339,7 @@ void maprender(Graphics& dwgfx, Game& game, mapclass& map, entityclass& obj, Uti
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
dwgfx.Print(30, 220, "MAP", 64,64,64);
|
||||
|
|
Loading…
Reference in a new issue