mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Move all editor-specific attributes to a new editorclass
This is a pretty hefty commit! But essentially, I made a new editorclass object, and moved all functions and variables that only get used in the in-game level editor to that class. This cleanly demarcates which things are in the editor and which things are just general custom level stuff. Then I fixed up all the callers. I also fixed up some NO_CUSTOM_LEVELS and NO_EDITOR ifdefs, too, in several places.
This commit is contained in:
parent
987ae88909
commit
a23014350f
13 changed files with 1336 additions and 1268 deletions
File diff suppressed because it is too large
Load diff
|
@ -7,31 +7,6 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Text entry field type
|
||||
enum textmode {
|
||||
TEXT_NONE,
|
||||
|
||||
// In-editor text fields
|
||||
TEXT_LOAD,
|
||||
TEXT_SAVE,
|
||||
TEXT_ROOMNAME,
|
||||
TEXT_SCRIPT,
|
||||
TEXT_ROOMTEXT,
|
||||
TEXT_GOTOROOM,
|
||||
LAST_EDTEXT = TEXT_GOTOROOM,
|
||||
|
||||
// Settings-mode text fields
|
||||
TEXT_TITLE,
|
||||
TEXT_DESC,
|
||||
TEXT_WEBSITE,
|
||||
TEXT_CREATOR,
|
||||
NUM_TEXTMODES,
|
||||
|
||||
// Text modes with an entity
|
||||
FIRST_ENTTEXT = TEXT_SCRIPT,
|
||||
LAST_ENTTEXT = TEXT_ROOMTEXT
|
||||
};
|
||||
|
||||
class edentities{
|
||||
public:
|
||||
int x, y, t;
|
||||
|
@ -104,20 +79,10 @@ class EditorData
|
|||
std::string modifier;
|
||||
};
|
||||
|
||||
struct GhostInfo {
|
||||
int rx; // game.roomx-100
|
||||
int ry; // game.roomy-100
|
||||
int x; // .xp
|
||||
int y; // .yp
|
||||
int col; // .colour
|
||||
Uint32 realcol;
|
||||
int frame; // .drawframe
|
||||
};
|
||||
|
||||
class editorclass{
|
||||
class customlevelclass
|
||||
{
|
||||
public:
|
||||
editorclass(void);
|
||||
|
||||
customlevelclass(void);
|
||||
std::string Desc1;
|
||||
std::string Desc2;
|
||||
std::string Desc3;
|
||||
|
@ -130,7 +95,6 @@ class editorclass{
|
|||
bool getLevelMetaData(std::string& filename, LevelMetaData& _data );
|
||||
|
||||
void reset(void);
|
||||
void getlin(const enum textmode mode, const std::string& prompt, std::string* ptr);
|
||||
const int* loadlevel(int rxi, int ryi);
|
||||
|
||||
int gettileidx(
|
||||
|
@ -161,54 +125,20 @@ class editorclass{
|
|||
ROOM_PROPERTIES
|
||||
#undef FOREACH_PROP
|
||||
|
||||
void placetilelocal(int x, int y, int t);
|
||||
|
||||
int getenemyframe(int t);
|
||||
int base(int x, int y);
|
||||
|
||||
int backbase(int x, int y);
|
||||
|
||||
int at(int x, int y);
|
||||
|
||||
int freewrap(int x, int y);
|
||||
|
||||
int backonlyfree(int x, int y);
|
||||
|
||||
int backfree(int x, int y);
|
||||
|
||||
int spikefree(int x, int y);
|
||||
int free(int x, int y);
|
||||
int absfree(int x, int y);
|
||||
|
||||
int match(int x, int y);
|
||||
int outsidematch(int x, int y);
|
||||
|
||||
int backmatch(int x, int y);
|
||||
|
||||
void switch_tileset(const bool reversed);
|
||||
void switch_tilecol(const bool reversed);
|
||||
void clamp_tilecol(const int rx, const int ry, const bool wrap);
|
||||
void switch_enemy(const bool reversed);
|
||||
void switch_warpdir(const bool reversed);
|
||||
|
||||
bool load(std::string& _path);
|
||||
#ifndef NO_EDITOR
|
||||
bool save(std::string& _path);
|
||||
#endif
|
||||
void generatecustomminimap(void);
|
||||
int edgetile(int x, int y);
|
||||
int outsideedgetile(int x, int y);
|
||||
|
||||
int backedgetile(int x, int y);
|
||||
|
||||
int labspikedir(int x, int y, int t);
|
||||
int spikedir(int x, int y);
|
||||
int findtrinket(int t);
|
||||
int findcrewmate(int t);
|
||||
int findwarptoken(int t);
|
||||
void findstartpoint(void);
|
||||
int getlevelcol(const int tileset, const int tilecol);
|
||||
int getenemycol(int t);
|
||||
int entcol;
|
||||
Uint32 entcolreal;
|
||||
|
||||
//Colouring stuff
|
||||
int getwarpbackground(int rx, int ry);
|
||||
|
@ -220,93 +150,19 @@ class editorclass{
|
|||
int numtrinkets(void);
|
||||
int numcrewmates(void);
|
||||
edlevelclass level[numrooms]; //Maxwidth*maxheight
|
||||
int kludgewarpdir[numrooms]; //Also maxwidth*maxheight
|
||||
|
||||
int notedelay;
|
||||
int oldnotedelay;
|
||||
std::string note;
|
||||
std::string keybuffer;
|
||||
std::string filename;
|
||||
std::string loaded_filepath;
|
||||
|
||||
int drawmode;
|
||||
int tilex, tiley;
|
||||
int keydelay, lclickdelay;
|
||||
bool savekey, loadkey;
|
||||
int levx, levy;
|
||||
int entframe, entframedelay;
|
||||
|
||||
int scripttexttype;
|
||||
std::string oldenttext;
|
||||
|
||||
enum textmode textmod; // In text entry
|
||||
std::string* textptr; // Pointer to text we're changing
|
||||
std::string textdesc; // Description (for editor mode text fields)
|
||||
union {
|
||||
int desc; // Which description row we're changing
|
||||
int textent; // Entity ID for text prompt
|
||||
};
|
||||
bool xmod, zmod, cmod, vmod, bmod, hmod, spacemod, warpmod;
|
||||
bool titlemod, creatormod, desc1mod, desc2mod, desc3mod, websitemod;
|
||||
|
||||
int roomnamehide;
|
||||
bool saveandquit;
|
||||
bool shiftmenu, shiftkey;
|
||||
int spacemenu;
|
||||
bool settingsmod, settingskey;
|
||||
int warpent;
|
||||
bool updatetiles, changeroom;
|
||||
int deletekeyheld;
|
||||
|
||||
int boundarymod, boundarytype;
|
||||
int boundx1, boundx2, boundy1, boundy2;
|
||||
|
||||
int levmusic;
|
||||
int mapwidth, mapheight; //Actual width and height of stage
|
||||
|
||||
int version;
|
||||
|
||||
//Script editor stuff
|
||||
void removeline(int t);
|
||||
void insertline(int t);
|
||||
|
||||
bool scripteditmod;
|
||||
int scripthelppage, scripthelppagedelay;
|
||||
std::vector<std::string> sb;
|
||||
std::string sbscript;
|
||||
int sbx, sby;
|
||||
int pagey;
|
||||
|
||||
//Functions for interfacing with the script:
|
||||
void addhook(std::string t);
|
||||
void removehook(std::string t);
|
||||
void addhooktoscript(std::string t);
|
||||
void removehookfromscript(std::string t);
|
||||
void loadhookineditor(std::string t);
|
||||
void clearscriptbuffer(void);
|
||||
void gethooks(void);
|
||||
bool checkhook(std::string t);
|
||||
std::vector<std::string> hooklist;
|
||||
|
||||
int hookmenupage, hookmenu;
|
||||
|
||||
//Direct Mode variables
|
||||
int dmtile;
|
||||
int dmtileeditor;
|
||||
|
||||
Uint32 getonewaycol(const int rx, const int ry);
|
||||
Uint32 getonewaycol(void);
|
||||
bool onewaycol_override;
|
||||
|
||||
int returneditoralpha;
|
||||
int oldreturneditoralpha;
|
||||
|
||||
std::vector<GhostInfo> ghosts;
|
||||
int currentghosts;
|
||||
};
|
||||
|
||||
#ifndef ED_DEFINITION
|
||||
extern editorclass ed;
|
||||
#ifndef CL_DEFINITION
|
||||
extern customlevelclass cl;
|
||||
#endif
|
||||
|
||||
#endif /* CUSTOMLEVELS_H */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,6 +3,175 @@
|
|||
#ifndef EDITOR_H
|
||||
#define EDITOR_H
|
||||
|
||||
#include "CustomLevels.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Text entry field type
|
||||
enum textmode
|
||||
{
|
||||
TEXT_NONE,
|
||||
|
||||
// In-editor text fields
|
||||
TEXT_LOAD,
|
||||
TEXT_SAVE,
|
||||
TEXT_ROOMNAME,
|
||||
TEXT_SCRIPT,
|
||||
TEXT_ROOMTEXT,
|
||||
TEXT_GOTOROOM,
|
||||
LAST_EDTEXT = TEXT_GOTOROOM,
|
||||
|
||||
// Settings-mode text fields
|
||||
TEXT_TITLE,
|
||||
TEXT_DESC,
|
||||
TEXT_WEBSITE,
|
||||
TEXT_CREATOR,
|
||||
NUM_TEXTMODES,
|
||||
|
||||
// Text modes with an entity
|
||||
FIRST_ENTTEXT = TEXT_SCRIPT,
|
||||
LAST_ENTTEXT = TEXT_ROOMTEXT
|
||||
};
|
||||
|
||||
struct GhostInfo
|
||||
{
|
||||
int rx; // game.roomx-100
|
||||
int ry; // game.roomy-100
|
||||
int x; // .xp
|
||||
int y; // .yp
|
||||
int col; // .colour
|
||||
Uint32 realcol;
|
||||
int frame; // .drawframe
|
||||
};
|
||||
|
||||
class editorclass
|
||||
{
|
||||
public:
|
||||
editorclass(void);
|
||||
void reset(void);
|
||||
|
||||
void getlin(const enum textmode mode, const std::string& prompt, std::string* ptr);
|
||||
|
||||
void placetilelocal(int x, int y, int t);
|
||||
|
||||
int base(int x, int y);
|
||||
|
||||
int backbase(int x, int y);
|
||||
|
||||
int at(int x, int y);
|
||||
|
||||
int freewrap(int x, int y);
|
||||
|
||||
int backonlyfree(int x, int y);
|
||||
|
||||
int backfree(int x, int y);
|
||||
|
||||
int spikefree(int x, int y);
|
||||
int free(int x, int y);
|
||||
|
||||
int match(int x, int y);
|
||||
int outsidematch(int x, int y);
|
||||
|
||||
int backmatch(int x, int y);
|
||||
|
||||
int edgetile(int x, int y);
|
||||
int outsideedgetile(int x, int y);
|
||||
|
||||
int backedgetile(int x, int y);
|
||||
|
||||
int labspikedir(int x, int y, int t);
|
||||
int spikedir(int x, int y);
|
||||
|
||||
int getenemyframe(int t);
|
||||
|
||||
void switch_tileset(const bool reversed);
|
||||
void switch_tilecol(const bool reversed);
|
||||
void clamp_tilecol(const int rx, const int ry, const bool wrap);
|
||||
void switch_enemy(const bool reversed);
|
||||
void switch_warpdir(const bool reversed);
|
||||
|
||||
int entcol;
|
||||
Uint32 entcolreal;
|
||||
|
||||
int kludgewarpdir[customlevelclass::numrooms];
|
||||
|
||||
int notedelay;
|
||||
int oldnotedelay;
|
||||
std::string note;
|
||||
std::string keybuffer;
|
||||
std::string filename;
|
||||
std::string loaded_filepath;
|
||||
|
||||
int drawmode;
|
||||
int tilex, tiley;
|
||||
int keydelay, lclickdelay;
|
||||
bool savekey, loadkey;
|
||||
int levx, levy;
|
||||
int entframe, entframedelay;
|
||||
|
||||
int scripttexttype;
|
||||
std::string oldenttext;
|
||||
|
||||
enum textmode textmod; // In text entry
|
||||
std::string* textptr; // Pointer to text we're changing
|
||||
std::string textdesc; // Description (for editor mode text fields)
|
||||
union
|
||||
{
|
||||
int desc; // Which description row we're changing
|
||||
int textent; // Entity ID for text prompt
|
||||
};
|
||||
bool xmod, zmod, cmod, vmod, bmod, hmod, spacemod, warpmod;
|
||||
bool titlemod, creatormod, desc1mod, desc2mod, desc3mod, websitemod;
|
||||
|
||||
int roomnamehide;
|
||||
bool saveandquit;
|
||||
bool shiftmenu, shiftkey;
|
||||
int spacemenu;
|
||||
bool settingsmod, settingskey;
|
||||
int warpent;
|
||||
bool updatetiles, changeroom;
|
||||
int deletekeyheld;
|
||||
|
||||
int boundarymod, boundarytype;
|
||||
int boundx1, boundx2, boundy1, boundy2;
|
||||
|
||||
//Script editor stuff
|
||||
void removeline(int t);
|
||||
void insertline(int t);
|
||||
|
||||
bool scripteditmod;
|
||||
int scripthelppage, scripthelppagedelay;
|
||||
std::vector<std::string> sb;
|
||||
std::string sbscript;
|
||||
int sbx, sby;
|
||||
int pagey;
|
||||
|
||||
//Functions for interfacing with the script:
|
||||
void addhook(std::string t);
|
||||
void removehook(std::string t);
|
||||
void addhooktoscript(std::string t);
|
||||
void removehookfromscript(std::string t);
|
||||
void loadhookineditor(std::string t);
|
||||
void clearscriptbuffer(void);
|
||||
void gethooks(void);
|
||||
bool checkhook(std::string t);
|
||||
std::vector<std::string> hooklist;
|
||||
|
||||
int hookmenupage, hookmenu;
|
||||
|
||||
//Direct Mode variables
|
||||
int dmtile;
|
||||
int dmtileeditor;
|
||||
|
||||
int returneditoralpha;
|
||||
int oldreturneditoralpha;
|
||||
|
||||
std::vector<GhostInfo> ghosts;
|
||||
int currentghosts;
|
||||
};
|
||||
|
||||
void editorrender(void);
|
||||
|
||||
void editorrenderfixed(void);
|
||||
|
@ -11,6 +180,10 @@ void editorlogic(void);
|
|||
|
||||
void editorinput(void);
|
||||
|
||||
#ifndef ED_DEFINITION
|
||||
extern editorclass ed;
|
||||
#endif
|
||||
|
||||
#endif /* EDITOR_H */
|
||||
|
||||
#endif /* NO_CUSTOM_LEVELS and NO_EDITOR */
|
||||
|
|
|
@ -1257,7 +1257,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
|||
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
// Special case for gray Warp Zone tileset!
|
||||
const edlevelclass* const room = ed.getroomprop(game.roomx - 100, game.roomy - 100);
|
||||
const edlevelclass* const room = cl.getroomprop(game.roomx - 100, game.roomy - 100);
|
||||
bool custom_gray = room->tileset == 3 && room->tilecol == 6;
|
||||
#else
|
||||
bool custom_gray = false;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "CustomLevels.h"
|
||||
#include "DeferCallbacks.h"
|
||||
#include "Editor.h"
|
||||
#include "Entity.h"
|
||||
#include "Enums.h"
|
||||
#include "FileSystemUtils.h"
|
||||
|
@ -1836,7 +1837,7 @@ void Game::updatestate(void)
|
|||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
if(map.custommode)
|
||||
{
|
||||
graphics.createtextboxflipme(" " + help.number(trinkets()) + " out of " + help.number(ed.numtrinkets())+ " ", 50, 135, 174, 174, 174);
|
||||
graphics.createtextboxflipme(" " + help.number(trinkets()) + " out of " + help.number(cl.numtrinkets())+ " ", 50, 135, 174, 174, 174);
|
||||
graphics.textboxcenterx();
|
||||
}
|
||||
else
|
||||
|
@ -1880,17 +1881,17 @@ void Game::updatestate(void)
|
|||
graphics.addline("You have found a lost crewmate!");
|
||||
graphics.textboxcenterx();
|
||||
|
||||
if(ed.numcrewmates()-crewmates()==0)
|
||||
if(cl.numcrewmates()-crewmates()==0)
|
||||
{
|
||||
graphics.createtextboxflipme(" All crewmates rescued! ", 50, 135, 174, 174, 174);
|
||||
}
|
||||
else if(ed.numcrewmates()-crewmates()==1)
|
||||
else if(cl.numcrewmates()-crewmates()==1)
|
||||
{
|
||||
graphics.createtextboxflipme(" " + help.number(ed.numcrewmates()-crewmates())+ " remains ", 50, 135, 174, 174, 174);
|
||||
graphics.createtextboxflipme(" " + help.number(cl.numcrewmates()-crewmates())+ " remains ", 50, 135, 174, 174, 174);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextboxflipme(" " + help.number(ed.numcrewmates()-crewmates())+ " remain ", 50, 135, 174, 174, 174);
|
||||
graphics.createtextboxflipme(" " + help.number(cl.numcrewmates()-crewmates())+ " remain ", 50, 135, 174, 174, 174);
|
||||
}
|
||||
graphics.textboxcenterx();
|
||||
break;
|
||||
|
@ -1908,25 +1909,27 @@ void Game::updatestate(void)
|
|||
completestop = false;
|
||||
state = 0;
|
||||
|
||||
if(ed.numcrewmates()-crewmates()==0)
|
||||
if(cl.numcrewmates()-crewmates()==0)
|
||||
{
|
||||
if(map.custommodeforreal)
|
||||
{
|
||||
graphics.fademode = 2;
|
||||
if(!muted && ed.levmusic>0) music.fadeMusicVolumeIn(3000);
|
||||
if(ed.levmusic>0) music.fadeout();
|
||||
if(!muted && cl.levmusic>0) music.fadeMusicVolumeIn(3000);
|
||||
if(cl.levmusic>0) music.fadeout();
|
||||
state=1014;
|
||||
}
|
||||
#ifndef NO_EDITOR
|
||||
else
|
||||
{
|
||||
returntoeditor();
|
||||
if(!muted && ed.levmusic>0) music.fadeMusicVolumeIn(3000);
|
||||
if(ed.levmusic>0) music.fadeout();
|
||||
if(!muted && cl.levmusic>0) music.fadeMusicVolumeIn(3000);
|
||||
if(cl.levmusic>0) music.fadeout();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!muted && ed.levmusic>0) music.fadeMusicVolumeIn(3000);
|
||||
if(!muted && cl.levmusic>0) music.fadeMusicVolumeIn(3000);
|
||||
}
|
||||
graphics.showcutscenebars = false;
|
||||
break;
|
||||
|
@ -1938,10 +1941,10 @@ void Game::updatestate(void)
|
|||
case 1015:
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
//Update level stats
|
||||
if(ed.numcrewmates()-crewmates()==0)
|
||||
if(cl.numcrewmates()-crewmates()==0)
|
||||
{
|
||||
//Finished level
|
||||
if (trinkets() >= ed.numtrinkets())
|
||||
if (trinkets() >= cl.numtrinkets())
|
||||
{
|
||||
//and got all the trinkets!
|
||||
updatecustomlevelstats(customlevelfilename, 3);
|
||||
|
@ -5914,14 +5917,14 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
|||
maxspacing = 15;
|
||||
break;
|
||||
case Menu::levellist:
|
||||
if(ed.ListOfMetaData.size()==0)
|
||||
if(cl.ListOfMetaData.size()==0)
|
||||
{
|
||||
option("ok");
|
||||
menuyoff = -20;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i=0; i<(int) ed.ListOfMetaData.size(); i++) // FIXME: int/size_t! -flibit
|
||||
for(int i=0; i<(int) cl.ListOfMetaData.size(); i++) // FIXME: int/size_t! -flibit
|
||||
{
|
||||
if(i>=levelpage*8 && i< (levelpage*8)+8)
|
||||
{
|
||||
|
@ -5929,7 +5932,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
|||
int tvar=-1;
|
||||
for(size_t j=0; j<customlevelstats.size(); j++)
|
||||
{
|
||||
if(ed.ListOfMetaData[i].filename.substr(7) == customlevelstats[j].name)
|
||||
if(cl.ListOfMetaData[i].filename.substr(7) == customlevelstats[j].name)
|
||||
{
|
||||
tvar=j;
|
||||
break;
|
||||
|
@ -5970,7 +5973,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
|||
prefix = tmp;
|
||||
}
|
||||
char text[MENU_TEXT_BYTES];
|
||||
SDL_snprintf(text, sizeof(text), "%s%s", prefix, ed.ListOfMetaData[i].title.c_str());
|
||||
SDL_snprintf(text, sizeof(text), "%s%s", prefix, cl.ListOfMetaData[i].title.c_str());
|
||||
for (size_t ii = 0; text[ii] != '\0'; ++ii)
|
||||
{
|
||||
text[ii] = SDL_tolower(text[ii]);
|
||||
|
@ -5978,9 +5981,9 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
|||
option(text);
|
||||
}
|
||||
}
|
||||
if (ed.ListOfMetaData.size() > 8)
|
||||
if (cl.ListOfMetaData.size() > 8)
|
||||
{
|
||||
if((size_t) ((levelpage*8)+8) <ed.ListOfMetaData.size())
|
||||
if((size_t) ((levelpage*8)+8) <cl.ListOfMetaData.size())
|
||||
{
|
||||
option("next page");
|
||||
}
|
||||
|
@ -6754,7 +6757,7 @@ void Game::returntolab(void)
|
|||
music.play(11);
|
||||
}
|
||||
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
|
||||
static void resetbg(void)
|
||||
{
|
||||
graphics.backgrounddrawn = false;
|
||||
|
@ -6781,11 +6784,11 @@ void Game::returntoeditor(void)
|
|||
DEFER_CALLBACK(resetbg);
|
||||
music.fadeout();
|
||||
//If warpdir() is used during playtesting, we need to set it back after!
|
||||
for (int j = 0; j < ed.maxheight; j++)
|
||||
for (int j = 0; j < cl.maxheight; j++)
|
||||
{
|
||||
for (int i = 0; i < ed.maxwidth; i++)
|
||||
for (int i = 0; i < cl.maxwidth; i++)
|
||||
{
|
||||
ed.level[i+(j*ed.maxwidth)].warpdir=ed.kludgewarpdir[i+(j*ed.maxwidth)];
|
||||
cl.level[i+(j*cl.maxwidth)].warpdir=ed.kludgewarpdir[i+(j*cl.maxwidth)];
|
||||
}
|
||||
}
|
||||
graphics.titlebg.scrolldir = 0;
|
||||
|
|
|
@ -867,7 +867,7 @@ bool Graphics::shouldrecoloroneway(const int tilenum, const bool mounted)
|
|||
{
|
||||
return (tilenum >= 14 && tilenum <= 17
|
||||
&& (!mounted
|
||||
|| ed.onewaycol_override));
|
||||
|| cl.onewaycol_override));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -884,7 +884,7 @@ void Graphics::drawtile( int x, int y, int t )
|
|||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
if (shouldrecoloroneway(t, tiles1_mounted))
|
||||
{
|
||||
colourTransform thect = {ed.getonewaycol()};
|
||||
colourTransform thect = {cl.getonewaycol()};
|
||||
BlitSurfaceTinted(tiles[t], NULL, backBuffer, &rect, thect);
|
||||
}
|
||||
else
|
||||
|
@ -908,7 +908,7 @@ void Graphics::drawtile2( int x, int y, int t )
|
|||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
if (shouldrecoloroneway(t, tiles2_mounted))
|
||||
{
|
||||
colourTransform thect = {ed.getonewaycol()};
|
||||
colourTransform thect = {cl.getonewaycol()};
|
||||
BlitSurfaceTinted(tiles2[t], NULL, backBuffer, &rect, thect);
|
||||
}
|
||||
else
|
||||
|
@ -1597,7 +1597,7 @@ void Graphics::drawmenu( int cr, int cg, int cb, bool levelmenu /*= false*/ )
|
|||
if (levelmenu)
|
||||
{
|
||||
size_t separator;
|
||||
if (ed.ListOfMetaData.size() > 8)
|
||||
if (cl.ListOfMetaData.size() > 8)
|
||||
{
|
||||
separator = 3;
|
||||
}
|
||||
|
@ -1896,7 +1896,7 @@ void Graphics::drawentity(const int i, const int yoff)
|
|||
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
// Special case for gray Warp Zone tileset!
|
||||
const edlevelclass* const room = ed.getroomprop(game.roomx - 100, game.roomy - 100);
|
||||
const edlevelclass* const room = cl.getroomprop(game.roomx - 100, game.roomy - 100);
|
||||
const bool custom_gray = room->tileset == 3 && room->tilecol == 6;
|
||||
#else
|
||||
const bool custom_gray = false;
|
||||
|
@ -3368,7 +3368,7 @@ void Graphics::drawforetile(int x, int y, int t)
|
|||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
if (shouldrecoloroneway(t, tiles1_mounted))
|
||||
{
|
||||
colourTransform thect = {ed.getonewaycol()};
|
||||
colourTransform thect = {cl.getonewaycol()};
|
||||
BlitSurfaceTinted(tiles[t], NULL, foregroundBuffer, &rect, thect);
|
||||
}
|
||||
else
|
||||
|
@ -3392,7 +3392,7 @@ void Graphics::drawforetile2(int x, int y, int t)
|
|||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
if (shouldrecoloroneway(t, tiles2_mounted))
|
||||
{
|
||||
colourTransform thect = {ed.getonewaycol()};
|
||||
colourTransform thect = {cl.getonewaycol()};
|
||||
BlitSurfaceTinted(tiles2[t], NULL, foregroundBuffer, &rect, thect);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "Credits.h"
|
||||
#include "CustomLevels.h"
|
||||
#include "Editor.h"
|
||||
#include "Entity.h"
|
||||
#include "Enums.h"
|
||||
#include "FileSystemUtils.h"
|
||||
|
@ -414,7 +415,7 @@ static void menuactionpress(void)
|
|||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
case Menu::levellist:
|
||||
{
|
||||
const bool nextlastoptions = ed.ListOfMetaData.size() > 8;
|
||||
const bool nextlastoptions = cl.ListOfMetaData.size() > 8;
|
||||
if(game.currentmenuoption==(int)game.menuoptions.size()-1){
|
||||
//go back to menu
|
||||
music.playef(11);
|
||||
|
@ -424,7 +425,7 @@ static void menuactionpress(void)
|
|||
//previous page
|
||||
music.playef(11);
|
||||
if(game.levelpage==0){
|
||||
game.levelpage=(ed.ListOfMetaData.size()-1)/8;
|
||||
game.levelpage=(cl.ListOfMetaData.size()-1)/8;
|
||||
}else{
|
||||
game.levelpage--;
|
||||
}
|
||||
|
@ -434,7 +435,7 @@ static void menuactionpress(void)
|
|||
}else if(nextlastoptions && game.currentmenuoption==(int)game.menuoptions.size()-3){
|
||||
//next page
|
||||
music.playef(11);
|
||||
if((size_t) ((game.levelpage*8)+8) >= ed.ListOfMetaData.size()){
|
||||
if((size_t) ((game.levelpage*8)+8) >= cl.ListOfMetaData.size()){
|
||||
game.levelpage=0;
|
||||
}else{
|
||||
game.levelpage++;
|
||||
|
@ -447,10 +448,10 @@ static void menuactionpress(void)
|
|||
//PLAY CUSTOM LEVEL HOOK
|
||||
music.playef(11);
|
||||
game.playcustomlevel=(game.levelpage*8)+game.currentmenuoption;
|
||||
game.customleveltitle=ed.ListOfMetaData[game.playcustomlevel].title;
|
||||
game.customlevelfilename=ed.ListOfMetaData[game.playcustomlevel].filename;
|
||||
game.customleveltitle=cl.ListOfMetaData[game.playcustomlevel].title;
|
||||
game.customlevelfilename=cl.ListOfMetaData[game.playcustomlevel].filename;
|
||||
|
||||
std::string name = "saves/" + ed.ListOfMetaData[game.playcustomlevel].filename.substr(7) + ".vvv";
|
||||
std::string name = "saves/" + cl.ListOfMetaData[game.playcustomlevel].filename.substr(7) + ".vvv";
|
||||
tinyxml2::XMLDocument doc;
|
||||
if (!FILESYSTEM_loadTiXml2Document(name.c_str(), doc)){
|
||||
startmode(22);
|
||||
|
@ -494,7 +495,7 @@ static void menuactionpress(void)
|
|||
game.returnmenu();
|
||||
break;
|
||||
case 1:
|
||||
game.customdeletequick(ed.ListOfMetaData[game.playcustomlevel].filename);
|
||||
game.customdeletequick(cl.ListOfMetaData[game.playcustomlevel].filename);
|
||||
game.returntomenu(Menu::levellist);
|
||||
game.flashlight = 5;
|
||||
game.screenshake = 15;
|
||||
|
@ -515,7 +516,7 @@ static void menuactionpress(void)
|
|||
|
||||
music.playef(11);
|
||||
game.levelpage=0;
|
||||
ed.getDirectoryData();
|
||||
cl.getDirectoryData();
|
||||
game.loadcustomlevelstats(); //Should only load a file if it's needed
|
||||
game.createmenu(Menu::levellist);
|
||||
if (FILESYSTEM_levelDirHasError())
|
||||
|
@ -2039,7 +2040,7 @@ void gameinput(void)
|
|||
}
|
||||
|
||||
//Returning to editor mode must always be possible
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
|
||||
if (map.custommode && !map.custommodeforreal)
|
||||
{
|
||||
if ((game.press_map || key.isDown(27)) && !game.mapheld)
|
||||
|
@ -2601,7 +2602,7 @@ static void mapmenuactionpress(const bool version2_2)
|
|||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
if(map.custommodeforreal)
|
||||
{
|
||||
success = game.customsavequick(ed.ListOfMetaData[game.playcustomlevel].filename);
|
||||
success = game.customsavequick(cl.ListOfMetaData[game.playcustomlevel].filename);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
|
|
@ -993,10 +993,10 @@ void mapclass::gotoroom(int rx, int ry)
|
|||
{
|
||||
game.roomx = rx;
|
||||
game.roomy = ry;
|
||||
if (game.roomx < 100) game.roomx = 100 + ed.mapwidth-1;
|
||||
if (game.roomy < 100) game.roomy = 100 + ed.mapheight-1;
|
||||
if (game.roomx > 100 + ed.mapwidth-1) game.roomx = 100;
|
||||
if (game.roomy > 100 + ed.mapheight-1) game.roomy = 100;
|
||||
if (game.roomx < 100) game.roomx = 100 + cl.mapwidth-1;
|
||||
if (game.roomy < 100) game.roomy = 100 + cl.mapheight-1;
|
||||
if (game.roomx > 100 + cl.mapwidth-1) game.roomx = 100;
|
||||
if (game.roomy > 100 + cl.mapheight-1) game.roomy = 100;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
|
@ -1562,8 +1562,8 @@ void mapclass::loadlevel(int rx, int ry)
|
|||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
case 12: //Custom level
|
||||
{
|
||||
const edlevelclass* const room = ed.getroomprop(rx - 100, ry - 100);
|
||||
game.customcol = ed.getlevelcol(room->tileset, room->tilecol) + 1;
|
||||
const edlevelclass* const room = cl.getroomprop(rx - 100, ry - 100);
|
||||
game.customcol = cl.getlevelcol(room->tileset, room->tilecol) + 1;
|
||||
obj.customplatformtile = game.customcol * 12;
|
||||
|
||||
switch (room->tileset)
|
||||
|
@ -1607,24 +1607,24 @@ void mapclass::loadlevel(int rx, int ry)
|
|||
case 1:
|
||||
warpx = true;
|
||||
background = 3;
|
||||
graphics.rcol = ed.getwarpbackground(rx - 100, ry - 100);
|
||||
graphics.rcol = cl.getwarpbackground(rx - 100, ry - 100);
|
||||
break;
|
||||
case 2:
|
||||
warpy = true;
|
||||
background = 4;
|
||||
graphics.rcol = ed.getwarpbackground(rx - 100, ry - 100);
|
||||
graphics.rcol = cl.getwarpbackground(rx - 100, ry - 100);
|
||||
break;
|
||||
case 3:
|
||||
warpx = true;
|
||||
warpy = true;
|
||||
background = 5;
|
||||
graphics.rcol = ed.getwarpbackground(rx - 100, ry - 100);
|
||||
graphics.rcol = cl.getwarpbackground(rx - 100, ry - 100);
|
||||
break;
|
||||
}
|
||||
|
||||
roomname = room->roomname;
|
||||
extrarow = 1;
|
||||
const int* tmap = ed.loadlevel(rx, ry);
|
||||
const int* tmap = cl.loadlevel(rx, ry);
|
||||
SDL_memcpy(contents, tmap, sizeof(contents));
|
||||
|
||||
|
||||
|
@ -1704,7 +1704,7 @@ void mapclass::loadlevel(int rx, int ry)
|
|||
obj.createentity(ex, ey, 3);
|
||||
break;
|
||||
case 9: // Trinkets
|
||||
obj.createentity(ex, ey, 9, ed.findtrinket(edi));
|
||||
obj.createentity(ex, ey, 9, cl.findtrinket(edi));
|
||||
break;
|
||||
case 10: // Checkpoints
|
||||
obj.createentity(ex, ey, 10, ent.p1, (rx + ry*100) * 20 + tempcheckpoints);
|
||||
|
@ -1724,7 +1724,7 @@ void mapclass::loadlevel(int rx, int ry)
|
|||
obj.createentity(ex, ey, 13, ent.p1, ent.p2);
|
||||
break;
|
||||
case 15: // Collectable crewmate
|
||||
obj.createentity(ex - 4, ey + 1, 55, ed.findcrewmate(edi), ent.p1, ent.p2);
|
||||
obj.createentity(ex - 4, ey + 1, 55, cl.findcrewmate(edi), ent.p1, ent.p2);
|
||||
break;
|
||||
case 17: // Roomtext!
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "Credits.h"
|
||||
#include "CustomLevels.h"
|
||||
#include "Editor.h"
|
||||
#include "Entity.h"
|
||||
#include "FileSystemUtils.h"
|
||||
#include "GlitchrunnerMode.h"
|
||||
|
@ -168,22 +169,22 @@ static void menurender(void)
|
|||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
case Menu::levellist:
|
||||
{
|
||||
if(ed.ListOfMetaData.size()==0){
|
||||
if(cl.ListOfMetaData.size()==0){
|
||||
graphics.Print( -1, 100, "ERROR: No levels found.", tr, tg, tb, true);
|
||||
}
|
||||
int tmp=game.currentmenuoption+(game.levelpage*8);
|
||||
if(INBOUNDS_VEC(tmp, ed.ListOfMetaData)){
|
||||
const bool nextlastoptions = ed.ListOfMetaData.size() > 8;
|
||||
if(INBOUNDS_VEC(tmp, cl.ListOfMetaData)){
|
||||
const bool nextlastoptions = cl.ListOfMetaData.size() > 8;
|
||||
//Don't show next/previous page or return to menu options here!
|
||||
if(nextlastoptions && game.menuoptions.size() - game.currentmenuoption<=3){
|
||||
|
||||
}else{
|
||||
graphics.bigprint( -1, 15, ed.ListOfMetaData[tmp].title, tr, tg, tb, true);
|
||||
graphics.Print( -1, 40, "by " + ed.ListOfMetaData[tmp].creator, tr, tg, tb, true);
|
||||
graphics.Print( -1, 50, ed.ListOfMetaData[tmp].website, tr, tg, tb, true);
|
||||
graphics.Print( -1, 70, ed.ListOfMetaData[tmp].Desc1, tr, tg, tb, true);
|
||||
graphics.Print( -1, 80, ed.ListOfMetaData[tmp].Desc2, tr, tg, tb, true);
|
||||
graphics.Print( -1, 90, ed.ListOfMetaData[tmp].Desc3, tr, tg, tb, true);
|
||||
graphics.bigprint( -1, 15, cl.ListOfMetaData[tmp].title, tr, tg, tb, true);
|
||||
graphics.Print( -1, 40, "by " + cl.ListOfMetaData[tmp].creator, tr, tg, tb, true);
|
||||
graphics.Print( -1, 50, cl.ListOfMetaData[tmp].website, tr, tg, tb, true);
|
||||
graphics.Print( -1, 70, cl.ListOfMetaData[tmp].Desc1, tr, tg, tb, true);
|
||||
graphics.Print( -1, 80, cl.ListOfMetaData[tmp].Desc2, tr, tg, tb, true);
|
||||
graphics.Print( -1, 90, cl.ListOfMetaData[tmp].Desc3, tr, tg, tb, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1767,7 +1768,7 @@ void gamerender(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
|
||||
if(map.custommode && !map.custommodeforreal && !game.advancetext){
|
||||
//Return to level editor
|
||||
int alpha = graphics.lerp(ed.oldreturneditoralpha, ed.returneditoralpha);
|
||||
|
@ -2388,7 +2389,7 @@ void maprender(void)
|
|||
}
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
else if(map.custommode){
|
||||
LevelMetaData& meta = ed.ListOfMetaData[game.playcustomlevel];
|
||||
LevelMetaData& meta = cl.ListOfMetaData[game.playcustomlevel];
|
||||
|
||||
graphics.bigprint( -1, FLIP(45), meta.title, 196, 196, 255 - help.glow, true);
|
||||
graphics.Print( -1, FLIP(70), "by " + meta.creator, 196, 196, 255 - help.glow, true);
|
||||
|
@ -2397,7 +2398,7 @@ void maprender(void)
|
|||
graphics.Print( -1, FLIP(110), meta.Desc2, 196, 196, 255 - help.glow, true);
|
||||
graphics.Print( -1, FLIP(120), meta.Desc3, 196, 196, 255 - help.glow, true);
|
||||
|
||||
int remaining = ed.numcrewmates() - game.crewmates();
|
||||
int remaining = cl.numcrewmates() - game.crewmates();
|
||||
|
||||
if(remaining==1){
|
||||
graphics.Print(1,FLIP(165), help.number(remaining)+ " crewmate remains", 196, 196, 255 - help.glow, true);
|
||||
|
@ -2475,7 +2476,7 @@ void maprender(void)
|
|||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.Print(0, 164, "[Trinkets found]", 196, 196, 255 - help.glow, true);
|
||||
graphics.Print(0, 152, help.number(game.trinkets()) + " out of " + help.number(ed.numtrinkets()), 96,96,96, true);
|
||||
graphics.Print(0, 152, help.number(game.trinkets()) + " out of " + help.number(cl.numtrinkets()), 96,96,96, true);
|
||||
|
||||
graphics.Print(0, 114, "[Number of Deaths]", 196, 196, 255 - help.glow, true);
|
||||
graphics.Print(0, 102,help.String(game.deathcounts), 96,96,96, true);
|
||||
|
@ -2486,7 +2487,7 @@ void maprender(void)
|
|||
else
|
||||
{
|
||||
graphics.Print(0, 52, "[Trinkets found]", 196, 196, 255 - help.glow, true);
|
||||
graphics.Print(0, 64, help.number(game.trinkets()) + " out of "+help.number(ed.numtrinkets()), 96,96,96, true);
|
||||
graphics.Print(0, 64, help.number(game.trinkets()) + " out of "+help.number(cl.numtrinkets()), 96,96,96, true);
|
||||
|
||||
graphics.Print(0, 102, "[Number of Deaths]", 196, 196, 255 - help.glow, true);
|
||||
graphics.Print(0, 114,help.String(game.deathcounts), 96,96,96, true);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "CustomLevels.h"
|
||||
#include "Game.h"
|
||||
#include "Graphics.h"
|
||||
#include "Editor.h"
|
||||
#include "Entity.h"
|
||||
#include "Enums.h"
|
||||
#include "Map.h"
|
||||
|
@ -118,7 +119,7 @@ void gamerenderfixed(void)
|
|||
map.glitchname = map.getglitchname(game.roomx, game.roomy);
|
||||
}
|
||||
|
||||
#ifndef NO_CUSTOM_LEVELS
|
||||
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
|
||||
ed.oldreturneditoralpha = ed.returneditoralpha;
|
||||
if (map.custommode && !map.custommodeforreal && ed.returneditoralpha > 0)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <SDL_timer.h>
|
||||
|
||||
#include "CustomLevels.h"
|
||||
#include "Editor.h"
|
||||
#include "Entity.h"
|
||||
#include "Enums.h"
|
||||
#include "Exit.h"
|
||||
|
@ -159,9 +160,9 @@ void scriptclass::run(void)
|
|||
int temprx=ss_toi(words[1])-1;
|
||||
int tempry=ss_toi(words[2])-1;
|
||||
const edlevelclass* room;
|
||||
ed.setroomwarpdir(temprx, tempry, ss_toi(words[3]));
|
||||
cl.setroomwarpdir(temprx, tempry, ss_toi(words[3]));
|
||||
|
||||
room = ed.getroomprop(temprx, tempry);
|
||||
room = cl.getroomprop(temprx, tempry);
|
||||
|
||||
//Do we update our own room?
|
||||
if(game.roomx-100==temprx && game.roomy-100==tempry){
|
||||
|
@ -182,21 +183,21 @@ void scriptclass::run(void)
|
|||
}else if(room->warpdir==1){
|
||||
map.warpx=true;
|
||||
map.background=3;
|
||||
graphics.rcol = ed.getwarpbackground(temprx,tempry);
|
||||
graphics.rcol = cl.getwarpbackground(temprx,tempry);
|
||||
}else if(room->warpdir==2){
|
||||
map.warpy=true;
|
||||
map.background=4;
|
||||
graphics.rcol = ed.getwarpbackground(temprx,tempry);
|
||||
graphics.rcol = cl.getwarpbackground(temprx,tempry);
|
||||
}else if(room->warpdir==3){
|
||||
map.warpx=true; map.warpy=true;
|
||||
map.background = 5;
|
||||
graphics.rcol = ed.getwarpbackground(temprx,tempry);
|
||||
graphics.rcol = cl.getwarpbackground(temprx,tempry);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (words[0] == "ifwarp")
|
||||
{
|
||||
const edlevelclass* const room = ed.getroomprop(ss_toi(words[1])-1, ss_toi(words[2])-1);
|
||||
const edlevelclass* const room = cl.getroomprop(ss_toi(words[1])-1, ss_toi(words[2])-1);
|
||||
if (room->warpdir == ss_toi(words[3]))
|
||||
{
|
||||
load("custom_"+words[4]);
|
||||
|
@ -1704,7 +1705,7 @@ void scriptclass::run(void)
|
|||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
if (map.custommode)
|
||||
{
|
||||
usethisnum = help.number(ed.numtrinkets());
|
||||
usethisnum = help.number(cl.numtrinkets());
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -2811,10 +2812,12 @@ void scriptclass::startgamemode( int t )
|
|||
|
||||
load("intermission_2");
|
||||
break;
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
#ifndef NO_CUSTOM_LEVELS
|
||||
# ifndef NO_EDITOR
|
||||
case 20:
|
||||
//Level editor
|
||||
hardreset();
|
||||
cl.reset();
|
||||
ed.reset();
|
||||
music.fadeout();
|
||||
map.custommode = true;
|
||||
|
@ -2838,11 +2841,11 @@ void scriptclass::startgamemode( int t )
|
|||
music.fadeout();
|
||||
hardreset();
|
||||
//If warpdir() is used during playtesting, we need to set it back after!
|
||||
for (int j = 0; j < ed.maxheight; j++)
|
||||
for (int j = 0; j < cl.maxheight; j++)
|
||||
{
|
||||
for (int i = 0; i < ed.maxwidth; i++)
|
||||
for (int i = 0; i < cl.maxwidth; i++)
|
||||
{
|
||||
ed.kludgewarpdir[i+(j*ed.maxwidth)]=ed.level[i+(j*ed.maxwidth)].warpdir;
|
||||
ed.kludgewarpdir[i+(j*cl.maxwidth)]=cl.level[i+(j*cl.maxwidth)].warpdir;
|
||||
}
|
||||
}
|
||||
game.customstart();
|
||||
|
@ -2862,23 +2865,24 @@ void scriptclass::startgamemode( int t )
|
|||
map.resetplayer();
|
||||
map.gotoroom(game.saverx, game.savery);
|
||||
map.initmapdata();
|
||||
if(ed.levmusic>0){
|
||||
music.play(ed.levmusic);
|
||||
if(cl.levmusic>0){
|
||||
music.play(cl.levmusic);
|
||||
}else{
|
||||
music.currentsong=-1;
|
||||
}
|
||||
break;
|
||||
# endif /* NO_EDITOR */
|
||||
case 22: //play custom level (in game)
|
||||
{
|
||||
//Initilise the level
|
||||
//First up, find the start point
|
||||
std::string filename = std::string(ed.ListOfMetaData[game.playcustomlevel].filename);
|
||||
if (!ed.load(filename))
|
||||
std::string filename = std::string(cl.ListOfMetaData[game.playcustomlevel].filename);
|
||||
if (!cl.load(filename))
|
||||
{
|
||||
gotoerrorloadinglevel();
|
||||
break;
|
||||
}
|
||||
ed.findstartpoint();
|
||||
cl.findstartpoint();
|
||||
|
||||
game.gamestate = GAMEMODE;
|
||||
music.fadeout();
|
||||
|
@ -2900,10 +2904,10 @@ void scriptclass::startgamemode( int t )
|
|||
map.gotoroom(game.saverx, game.savery);
|
||||
map.initmapdata();
|
||||
|
||||
ed.generatecustomminimap();
|
||||
cl.generatecustomminimap();
|
||||
map.customshowmm=true;
|
||||
if(ed.levmusic>0){
|
||||
music.play(ed.levmusic);
|
||||
if(cl.levmusic>0){
|
||||
music.play(cl.levmusic);
|
||||
}else{
|
||||
music.currentsong=-1;
|
||||
}
|
||||
|
@ -2914,13 +2918,13 @@ void scriptclass::startgamemode( int t )
|
|||
{
|
||||
//Initilise the level
|
||||
//First up, find the start point
|
||||
std::string filename = std::string(ed.ListOfMetaData[game.playcustomlevel].filename);
|
||||
if (!ed.load(filename))
|
||||
std::string filename = std::string(cl.ListOfMetaData[game.playcustomlevel].filename);
|
||||
if (!cl.load(filename))
|
||||
{
|
||||
gotoerrorloadinglevel();
|
||||
break;
|
||||
}
|
||||
ed.findstartpoint();
|
||||
cl.findstartpoint();
|
||||
|
||||
game.gamestate = GAMEMODE;
|
||||
music.fadeout();
|
||||
|
@ -2929,7 +2933,7 @@ void scriptclass::startgamemode( int t )
|
|||
map.custommode = true;
|
||||
|
||||
game.customstart();
|
||||
game.customloadquick(ed.ListOfMetaData[game.playcustomlevel].filename);
|
||||
game.customloadquick(cl.ListOfMetaData[game.playcustomlevel].filename);
|
||||
game.jumpheld = true;
|
||||
game.gravitycontrol = game.savegc;
|
||||
|
||||
|
@ -2944,11 +2948,11 @@ void scriptclass::startgamemode( int t )
|
|||
map.resetplayer();
|
||||
map.gotoroom(game.saverx, game.savery);
|
||||
map.initmapdata();
|
||||
ed.generatecustomminimap();
|
||||
cl.generatecustomminimap();
|
||||
graphics.fademode = 4;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif /* NO_CUSTOM_LEVELS */
|
||||
case 100:
|
||||
VVV_exit(0);
|
||||
break;
|
||||
|
|
|
@ -31,10 +31,13 @@
|
|||
|
||||
scriptclass script;
|
||||
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
#ifndef NO_CUSTOM_LEVELS
|
||||
std::vector<edentities> edentity;
|
||||
customlevelclass cl;
|
||||
# ifndef NO_EDITOR
|
||||
editorclass ed;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
UtilityClass help;
|
||||
Graphics graphics;
|
||||
|
@ -620,14 +623,14 @@ int main(int argc, char *argv[])
|
|||
game.menustart = true;
|
||||
|
||||
LevelMetaData meta;
|
||||
if (ed.getLevelMetaData(playtestname, meta)) {
|
||||
ed.ListOfMetaData.clear();
|
||||
ed.ListOfMetaData.push_back(meta);
|
||||
if (cl.getLevelMetaData(playtestname, meta)) {
|
||||
cl.ListOfMetaData.clear();
|
||||
cl.ListOfMetaData.push_back(meta);
|
||||
} else {
|
||||
ed.loadZips();
|
||||
if (ed.getLevelMetaData(playtestname, meta)) {
|
||||
ed.ListOfMetaData.clear();
|
||||
ed.ListOfMetaData.push_back(meta);
|
||||
cl.loadZips();
|
||||
if (cl.getLevelMetaData(playtestname, meta)) {
|
||||
cl.ListOfMetaData.clear();
|
||||
cl.ListOfMetaData.push_back(meta);
|
||||
} else {
|
||||
vlog_error("Level not found");
|
||||
VVV_exit(1);
|
||||
|
@ -635,8 +638,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
game.loadcustomlevelstats();
|
||||
game.customleveltitle=ed.ListOfMetaData[game.playcustomlevel].title;
|
||||
game.customlevelfilename=ed.ListOfMetaData[game.playcustomlevel].filename;
|
||||
game.customleveltitle=cl.ListOfMetaData[game.playcustomlevel].title;
|
||||
game.customlevelfilename=cl.ListOfMetaData[game.playcustomlevel].filename;
|
||||
if (savefileplaytest) {
|
||||
game.playx = savex;
|
||||
game.playy = savey;
|
||||
|
|
Loading…
Reference in a new issue