2019-08-27 06:08:18 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
|
|
|
|
|
|
|
This file is part of EDuke32.
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-11-22 23:11:37 +00:00
|
|
|
#include "ns.h"
|
2019-08-27 06:08:18 +00:00
|
|
|
#include "compat.h"
|
|
|
|
#include "build.h"
|
2019-08-31 09:08:38 +00:00
|
|
|
#include "common.h"
|
2019-08-27 06:08:18 +00:00
|
|
|
#include "keyboard.h"
|
2019-08-31 09:08:38 +00:00
|
|
|
#include "control.h"
|
2019-08-27 06:08:18 +00:00
|
|
|
#include "exhumed.h"
|
|
|
|
#include "config.h"
|
|
|
|
#include "osdcmds.h"
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
|
|
|
|
2019-08-27 06:08:18 +00:00
|
|
|
int osdcmd_restartvid(osdcmdptr_t UNUSED(parm))
|
|
|
|
{
|
|
|
|
UNREFERENCED_CONST_PARAMETER(parm);
|
|
|
|
videoResetMode();
|
|
|
|
if (videoSetGameMode(gSetup.fullscreen,gSetup.xdim,gSetup.ydim,gSetup.bpp,0))
|
2019-11-24 09:03:19 +00:00
|
|
|
I_Error("restartvid: Reset failed...\n");
|
2019-08-27 06:08:18 +00:00
|
|
|
onvideomodechange(gSetup.bpp>8);
|
|
|
|
UpdateScreenSize();
|
|
|
|
|
|
|
|
return OSDCMD_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int osdcmd_vidmode(osdcmdptr_t parm)
|
|
|
|
{
|
|
|
|
int32_t newbpp = gSetup.bpp, newwidth = gSetup.xdim,
|
|
|
|
newheight = gSetup.ydim, newfs = gSetup.fullscreen;
|
|
|
|
int32_t tmp;
|
|
|
|
|
|
|
|
if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP;
|
|
|
|
|
|
|
|
switch (parm->numparms)
|
|
|
|
{
|
|
|
|
case 1: // bpp switch
|
|
|
|
tmp = Batol(parm->parms[0]);
|
|
|
|
if (!(tmp==8 || tmp==16 || tmp==32))
|
|
|
|
return OSDCMD_SHOWHELP;
|
|
|
|
newbpp = tmp;
|
|
|
|
break;
|
|
|
|
case 2: // res switch
|
|
|
|
newwidth = Batol(parm->parms[0]);
|
|
|
|
newheight = Batol(parm->parms[1]);
|
|
|
|
break;
|
|
|
|
case 3: // res & bpp switch
|
|
|
|
case 4:
|
|
|
|
newwidth = Batol(parm->parms[0]);
|
|
|
|
newheight = Batol(parm->parms[1]);
|
|
|
|
tmp = Batol(parm->parms[2]);
|
|
|
|
if (!(tmp==8 || tmp==16 || tmp==32))
|
|
|
|
return OSDCMD_SHOWHELP;
|
|
|
|
newbpp = tmp;
|
|
|
|
if (parm->numparms == 4)
|
|
|
|
newfs = (Batol(parm->parms[3]) != 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor))
|
|
|
|
{
|
|
|
|
initprintf("vidmode: Mode change failed!\n");
|
|
|
|
if (videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, upscalefactor))
|
2019-11-24 09:03:19 +00:00
|
|
|
I_Error("vidmode: Reset failed!\n");
|
2019-08-27 06:08:18 +00:00
|
|
|
}
|
|
|
|
gSetup.bpp = newbpp;
|
|
|
|
gSetup.xdim = newwidth;
|
|
|
|
gSetup.ydim = newheight;
|
|
|
|
gSetup.fullscreen = newfs;
|
|
|
|
onvideomodechange(gSetup.bpp>8);
|
|
|
|
UpdateScreenSize();
|
|
|
|
return OSDCMD_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void onvideomodechange(int32_t newmode)
|
|
|
|
{
|
2019-10-12 22:27:12 +00:00
|
|
|
uint8_t palid = BASEPAL;
|
|
|
|
videoSetPalette(0, palid, 0);
|
2019-08-27 06:08:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int32_t registerosdcommands(void)
|
|
|
|
{
|
|
|
|
//if (VOLUMEONE)
|
|
|
|
// OSD_RegisterFunction("changelevel","changelevel <level>: warps to the given level", osdcmd_changelevel);
|
|
|
|
//else
|
|
|
|
//{
|
|
|
|
// 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("cmenu","cmenu <#>: jumps to menu", osdcmd_cmenu);
|
|
|
|
//OSD_RegisterFunction("crosshaircolor","crosshaircolor: changes the crosshair color", osdcmd_crosshaircolor);
|
|
|
|
|
|
|
|
|
|
|
|
//OSD_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", osdcmd_give);
|
|
|
|
//OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god);
|
|
|
|
//OSD_RegisterFunction("activatecheat","activatecheat <id>: activates a cheat code", osdcmd_activatecheat);
|
|
|
|
|
|
|
|
//OSD_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap);
|
|
|
|
//OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound);
|
|
|
|
OSD_RegisterFunction("restartvid","restartvid: reinitializes the video mode",osdcmd_restartvid);
|
|
|
|
|
|
|
|
//OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
|
|
|
|
|
|
|
|
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim> <bpp> <fullscreen>: change the video mode",osdcmd_vidmode);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-08-31 09:08:38 +00:00
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|