mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-30 13:21:04 +00:00
- handle console-based map changes directly instead of the cheat handler.
This allows handling user maps again.
This commit is contained in:
parent
532b11467f
commit
8c98d44620
2 changed files with 31 additions and 11 deletions
|
@ -65,7 +65,7 @@ static int osdcmd_map(CCmdFuncPtr parm)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Map has not been defined. Treat as user map.
|
// Map has not been defined. Treat as user map.
|
||||||
StartLevel(SetupUserMap(mapname));
|
StartLevel(SetupUserMap(mapfilename));
|
||||||
}
|
}
|
||||||
|
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
|
|
|
@ -45,9 +45,33 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "menus.h"
|
#include "menus.h"
|
||||||
#include "mapinfo.h"
|
#include "mapinfo.h"
|
||||||
#include "jsector.h"
|
#include "jsector.h"
|
||||||
|
#include "network.h"
|
||||||
|
|
||||||
BEGIN_SW_NS
|
BEGIN_SW_NS
|
||||||
|
|
||||||
|
static void levelwarp(MapRecord *maprec)
|
||||||
|
{
|
||||||
|
if (CommEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto pp = &Player[myconnectindex];
|
||||||
|
if (Skill >= 3)
|
||||||
|
{
|
||||||
|
PutStringInfo(pp, GStrings("TXTS_TOOSKILLFUL"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TEST(pp->Flags, PF_DEAD))
|
||||||
|
return;
|
||||||
|
|
||||||
|
NextLevel = maprec;
|
||||||
|
ExitLevel = TRUE;
|
||||||
|
|
||||||
|
sprintf(ds, "%s %s", GStrings("TXT_ENTERING"), maprec->DisplayName());
|
||||||
|
PutStringInfo(pp, ds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int osdcmd_map(CCmdFuncPtr parm)
|
static int osdcmd_map(CCmdFuncPtr parm)
|
||||||
{
|
{
|
||||||
if (parm->numparms != 1)
|
if (parm->numparms != 1)
|
||||||
|
@ -66,11 +90,11 @@ static int osdcmd_map(CCmdFuncPtr parm)
|
||||||
|
|
||||||
// Check if the map is already defined.
|
// Check if the map is already defined.
|
||||||
auto maprec = FindMapByName(mapname);
|
auto maprec = FindMapByName(mapname);
|
||||||
if (maprec)
|
if (maprec) levelwarp(maprec);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// This needs to be done better...
|
maprec = SetupUserMap(mapfilename);
|
||||||
FStringf cheatcode("activatecheat swtrek%02d", maprec->levelNumber);
|
if (maprec) levelwarp(maprec);
|
||||||
C_DoCommand(cheatcode);
|
|
||||||
}
|
}
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
|
@ -96,12 +120,8 @@ int osdcmd_restartmap(CCmdFuncPtr)
|
||||||
int osdcmd_levelwarp(CCmdFuncPtr parm)
|
int osdcmd_levelwarp(CCmdFuncPtr parm)
|
||||||
{
|
{
|
||||||
if (parm->numparms != 1) return CCMD_SHOWHELP;
|
if (parm->numparms != 1) return CCMD_SHOWHELP;
|
||||||
|
auto maprec = FindMapByLevelNum(atoi(parm->parms[0]));
|
||||||
char cheatcode[] = "activatecheat swtrek##";
|
if (maprec) levelwarp(maprec);
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
|
||||||
cheatcode[20+i] = parm->parms[0][i];
|
|
||||||
C_DoCommand(cheatcode);
|
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue