- removed the mostly useless changelevel CCMDs.

It makes more sense to do a real 'map' CCMD instead once the level management is working properly.
This commit is contained in:
Christoph Oelckers 2019-12-10 17:25:45 +01:00
parent 4f04fe66de
commit db29fc1a01
5 changed files with 4 additions and 270 deletions

View file

@ -47,51 +47,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
static int osdcmd_changelevel(osdcmdptr_t parm)
{
int32_t volume,level;
char *p;
if (parm->numparms != 2) return OSDCMD_SHOWHELP;
volume = strtol(parm->parms[0], &p, 10) - 1;
if (p[0]) return OSDCMD_SHOWHELP;
level = strtol(parm->parms[1], &p, 10) - 1;
if (p[0]) return OSDCMD_SHOWHELP;
if (volume < 0) return OSDCMD_SHOWHELP;
if (level < 0) return OSDCMD_SHOWHELP;
if (volume >= 6)
{
OSD_Printf("changelevel: invalid volume number (range 1-%d)\n",6);
return OSDCMD_OK;
}
if (level >= gEpisodeInfo[volume].nLevels)
{
OSD_Printf("changelevel: invalid level number\n");
return OSDCMD_SHOWHELP;
}
if (gDemo.at1)
gDemo.StopPlayback();
if (numplayers > 1)
{
gPacketStartGame.episodeId = volume;
gPacketStartGame.levelId = level;
netBroadcastNewGame();
gStartNewGame = 1;
return OSDCMD_OK;
}
levelSetupOptions(volume, level);
StartLevel(&gGameOptions);
viewResizeView(gViewSize);
return OSDCMD_OK;
}
static int osdcmd_map(osdcmdptr_t parm)
{
char filename[BMAX_PATH];
@ -342,7 +297,6 @@ void onvideomodechange(int32_t newmode)
int32_t registerosdcommands(void)
{
OSD_RegisterFunction("changelevel","changelevel <volume> <level>: warps to the given level", osdcmd_changelevel);
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("crosshaircolor","crosshaircolor: changes the crosshair color", osdcmd_crosshaircolor);

View file

@ -38,68 +38,6 @@ BEGIN_DUKE_NS
struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat = { -1, 0, 0 };
static int osdcmd_changelevel(osdcmdptr_t parm)
{
int volume = 0;
int level;
if (!VOLUMEONE)
{
if (parm->numparms != 2) return OSDCMD_SHOWHELP;
volume = strtol(parm->parms[0], NULL, 10) - 1;
level = strtol(parm->parms[1], NULL, 10) - 1;
}
else
{
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
level = strtol(parm->parms[0], NULL, 10) - 1;
}
if (volume < 0 || level < 0)
return OSDCMD_SHOWHELP;
if (level > MAXLEVELS || mapList[volume * MAXLEVELS + level].fileName.IsEmpty())
{
OSD_Printf("changelevel: no map defined for episode %d level %d\n", volume + 1, level + 1);
return OSDCMD_SHOWHELP;
}
if (numplayers > 1)
{
return OSDCMD_OK;
}
if (g_player[myconnectindex].ps->gm & MODE_GAME)
{
// in-game behave like a cheat
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_SCOTTY;
osdcmd_cheatsinfo_stat.volume = volume;
osdcmd_cheatsinfo_stat.level = level;
}
else
{
// out-of-game behave like a menu command
osdcmd_cheatsinfo_stat.cheatnum = -1;
ud.m_volume_number = volume;
m_level_number = level;
ud.m_monsters_off = 0;
ud.monsters_off = 0;
ud.m_respawn_items = 0;
ud.m_respawn_inventory = 0;
ud.multimode = 1;
G_NewGame_EnterLevel();
}
return OSDCMD_OK;
}
static int osdcmd_map(osdcmdptr_t parm)
{
char filename[BMAX_PATH];
@ -856,11 +794,8 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("playerinfo", "Prints information about the current player", osdcmd_playerinfo);
#endif
if (VOLUMEONE)
OSD_RegisterFunction("changelevel","changelevel <level>: warps to the given level", osdcmd_changelevel);
else
if (!VOLUMEONE)
{
OSD_RegisterFunction("changelevel","changelevel <volume> <level>: warps to the given level", osdcmd_changelevel);
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);
}

View file

@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "duke3d.h"
#include "osdcmds.h"
#include "cheats.h"
#inclide "mapinfo.h"
#include "mapinfo.h"
BEGIN_RR_NS

View file

@ -35,115 +35,6 @@ BEGIN_RR_NS
struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat = { -1, 0, 0 };
static int osdcmd_changelevel(osdcmdptr_t parm)
{
int32_t volume=0,level;
char *p;
if (!VOLUMEONE)
{
if (parm->numparms != 2) return OSDCMD_SHOWHELP;
volume = strtol(parm->parms[0], &p, 10) - 1;
if (p[0]) return OSDCMD_SHOWHELP;
level = strtol(parm->parms[1], &p, 10) - 1;
if (p[0]) return OSDCMD_SHOWHELP;
}
else
{
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
level = strtol(parm->parms[0], &p, 10) - 1;
if (p[0]) return OSDCMD_SHOWHELP;
}
if (volume < 0) return OSDCMD_SHOWHELP;
if (level < 0) return OSDCMD_SHOWHELP;
if (!VOLUMEONE)
{
if (volume > g_volumeCnt)
{
OSD_Printf("changelevel: invalid volume number (range 1-%d)\n",g_volumeCnt);
return OSDCMD_OK;
}
}
if (level > MAXLEVELS || mapList *MAXLEVELS+level].fileName.IsEmpty)
{
OSD_Printf("changelevel: invalid level number\n");
return OSDCMD_SHOWHELP;
}
if (numplayers > 1)
{
/*
if (g_netServer)
Net_NewGame(volume,level);
else if (voting == -1)
{
ud.m_volume_number = volume;
m_level_number = level;
if (g_player[myconnectindex].ps->i)
{
int32_t i;
for (i=0; i<MAXPLAYERS; i++)
{
g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
g_player[myconnectindex].vote = g_player[myconnectindex].gotvote = 1;
voting = myconnectindex;
tempbuf[0] = PACKET_MAP_VOTE_INITIATE;
tempbuf[1] = myconnectindex;
tempbuf[2] = ud.m_volume_number;
tempbuf[3] = m_level_number;
enet_peer_send(g_netClientPeer, CHAN_GAMESTATE, enet_packet_create(tempbuf, 4, ENET_PACKET_FLAG_RELIABLE));
}
if ((g_gametypeFlags[m_coop] & GAMETYPE_PLAYERSFRIENDLY) && !(g_gametypeFlags[m_coop] & GAMETYPE_TDM))
m_noexits = 0;
M_OpenMenu(myconnectindex);
Menu_Change(MENU_NETWAITVOTES);
}
*/
return OSDCMD_OK;
}
if (g_player[myconnectindex].ps->gm & MODE_GAME)
{
// in-game behave like a cheat
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_SCOTTY;
osdcmd_cheatsinfo_stat.volume = volume;
osdcmd_cheatsinfo_stat.level = level;
}
else
{
// out-of-game behave like a menu command
osdcmd_cheatsinfo_stat.cheatnum = -1;
ud.m_volume_number = volume;
m_level_number = level;
ud.m_monsters_off = 0;
ud.monsters_off = 0;
ud.m_respawn_items = 0;
ud.m_respawn_inventory = 0;
ud.multimode = 1;
G_NewGame_EnterLevel();
}
return OSDCMD_OK;
}
static int osdcmd_map(osdcmdptr_t parm)
{
char filename[BMAX_PATH];
@ -170,48 +61,6 @@ static int osdcmd_map(osdcmdptr_t parm)
if (numplayers > 1)
{
/*
if (g_netServer)
{
Net_SendUserMapName();
ud.m_volume_number = 0;
m_level_number = 7;
Net_NewGame(ud.m_volume_number, m_level_number);
}
else if (voting == -1)
{
Net_SendUserMapName();
ud.m_volume_number = 0;
m_level_number = 7;
if (g_player[myconnectindex].ps->i)
{
int32_t i;
for (i=0; i<MAXPLAYERS; i++)
{
g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
g_player[myconnectindex].vote = g_player[myconnectindex].gotvote = 1;
voting = myconnectindex;
tempbuf[0] = PACKET_MAP_VOTE_INITIATE;
tempbuf[1] = myconnectindex;
tempbuf[2] = ud.m_volume_number;
tempbuf[3] = m_level_number;
enet_peer_send(g_netClientPeer, CHAN_GAMESTATE, enet_packet_create(tempbuf, 4, ENET_PACKET_FLAG_RELIABLE));
}
if ((g_gametypeFlags[m_coop] & GAMETYPE_PLAYERSFRIENDLY) && !(g_gametypeFlags[m_coop] & GAMETYPE_TDM))
m_noexits = 0;
M_OpenMenu(myconnectindex);
Menu_Change(MENU_NETWAITVOTES);
}
*/
return OSDCMD_OK;
}
@ -783,11 +632,8 @@ static int osdcmd_printtimes(osdcmdptr_t UNUSED(parm))
int32_t registerosdcommands(void)
{
if (VOLUMEONE)
OSD_RegisterFunction("changelevel","changelevel <level>: warps to the given level", osdcmd_changelevel);
else
if (!VOLUMEONE)
{
OSD_RegisterFunction("changelevel","changelevel <volume> <level>: warps to the given level", osdcmd_changelevel);
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);
}

View file

@ -2876,8 +2876,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
menutext(191, yy, tempbuf);
yy+=yystep;
}
if (mapList[G_LastMapInfoIndex()].designerT
ime)
if (mapList[G_LastMapInfoIndex()].designerTime)
{
G_PrintDesignerTime();
menutext(191, yy, tempbuf);