- add levelwarp cheat to Redneck and Duke

This commit is contained in:
Rachael Alexanderson 2020-01-27 22:29:47 -05:00
parent 999986e6cd
commit 212cfde186
3 changed files with 73 additions and 2 deletions

View file

@ -2,8 +2,9 @@
/* /*
Copyright (C) 2010-2019 EDuke32 developers and contributors Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 Nuke.YKT Copyright (C) 2019 Nuke.YKT
Copyright (C) 2020 Raze developers and contributors
This file is part of NBlood. This file was part of NBlood.
NBlood is free software; you can redistribute it and/or NBlood is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2 modify it under the terms of the GNU General Public License version 2
@ -245,7 +246,7 @@ static int osdcmd_levelwarp(osdcmdptr_t parm)
int m = atoi(parm->parms[1]); int m = atoi(parm->parms[1]);
if (e == 0 || m == 0) if (e == 0 || m == 0)
{ {
Printf("Invalid level!: E%sM%s\n", parm->parms[0], parm->parms[1]); Printf(OSD_ERROR "Invalid level!: E%sM%s\n", parm->parms[0], parm->parms[1]);
return OSDCMD_OK; return OSDCMD_OK;
} }
LevelWarp(e - 1, m - 1); LevelWarp(e - 1, m - 1);

View file

@ -38,6 +38,39 @@ BEGIN_DUKE_NS
struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat = { -1, 0, 0 }; struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat = { -1, 0, 0 };
static int osdcmd_levelwarp(osdcmdptr_t parm)
{
if (parm->numparms != 2)
return OSDCMD_SHOWHELP;
int e = atoi(parm->parms[0]);
int m = atoi(parm->parms[1]);
if (e == 0 || m == 0)
{
Printf(OSD_ERROR "Invalid level!: E%sL%s\n", parm->parms[0], parm->parms[1]);
return OSDCMD_OK;
}
osdcmd_cheatsinfo_stat.cheatnum = -1;
ud.m_volume_number = e - 1;
m_level_number = m - 1;
ud.m_monsters_off = ud.monsters_off = 0;
ud.m_respawn_items = 0;
ud.m_respawn_inventory = 0;
ud.multimode = 1;
if (g_player[myconnectindex].ps->gm & MODE_GAME)
{
G_NewGame(ud.m_volume_number, m_level_number, ud.m_player_skill);
g_player[myconnectindex].ps->gm = MODE_RESTART;
}
else G_NewGame_EnterLevel();
return OSDCMD_OK;
}
static int osdcmd_map(osdcmdptr_t parm) static int osdcmd_map(osdcmdptr_t parm)
{ {
char filename[BMAX_PATH]; char filename[BMAX_PATH];
@ -691,6 +724,8 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip); OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
OSD_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", osdcmd_levelwarp);
OSD_RegisterFunction("printtimes", "printtimes: prints VM timing statistics", osdcmd_printtimes); OSD_RegisterFunction("printtimes", "printtimes: prints VM timing statistics", osdcmd_printtimes);

View file

@ -1,6 +1,7 @@
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/* /*
Copyright (C) 2010 EDuke32 developers and contributors Copyright (C) 2010 EDuke32 developers and contributors
Copyright (C) 2020 Raze developers and contributors
This file is part of EDuke32. This file is part of EDuke32.
@ -35,6 +36,39 @@ BEGIN_RR_NS
struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat = { -1, 0, 0 }; struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat = { -1, 0, 0 };
static int osdcmd_levelwarp(osdcmdptr_t parm)
{
if (parm->numparms != 2)
return OSDCMD_SHOWHELP;
int e = atoi(parm->parms[0]);
int m = atoi(parm->parms[1]);
if (e == 0 || m == 0)
{
Printf(OSD_ERROR "Invalid level!: E%sL%s\n", parm->parms[0], parm->parms[1]);
return OSDCMD_OK;
}
osdcmd_cheatsinfo_stat.cheatnum = -1;
ud.m_volume_number = e - 1;
m_level_number = m - 1;
ud.m_monsters_off = ud.monsters_off = 0;
ud.m_respawn_items = 0;
ud.m_respawn_inventory = 0;
ud.multimode = 1;
if (g_player[myconnectindex].ps->gm & MODE_GAME)
{
G_NewGame(ud.m_volume_number, m_level_number, ud.m_player_skill);
g_player[myconnectindex].ps->gm = MODE_RESTART;
}
else G_NewGame_EnterLevel();
return OSDCMD_OK;
}
static int osdcmd_map(osdcmdptr_t parm) static int osdcmd_map(osdcmdptr_t parm)
{ {
char filename[BMAX_PATH]; char filename[BMAX_PATH];
@ -523,6 +557,7 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("map","map <mapfile>: loads the given user map", osdcmd_map); OSD_RegisterFunction("map","map <mapfile>: loads the given user map", osdcmd_map);
OSD_RegisterFunction("demo","demo <demofile or demonum>: starts the given demo", osdcmd_demo); OSD_RegisterFunction("demo","demo <demofile or demonum>: starts the given demo", osdcmd_demo);
} }
OSD_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", osdcmd_levelwarp);
#if !defined NETCODE_DISABLE #if !defined NETCODE_DISABLE
OSD_RegisterFunction("connect","connect: connects to a multiplayer game", osdcmd_connect); OSD_RegisterFunction("connect","connect: connects to a multiplayer game", osdcmd_connect);