mirror of
https://github.com/ZDoom/Raze.git
synced 2024-12-16 07:31:23 +00:00
1b0a036995
# Conflicts: # source/exhumed/src/config.cpp # source/exhumed/src/osdcmds.cpp
133 lines
4.5 KiB
C++
133 lines
4.5 KiB
C++
//-------------------------------------------------------------------------
|
|
/*
|
|
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.
|
|
*/
|
|
//-------------------------------------------------------------------------
|
|
#include "ns.h"
|
|
#include "compat.h"
|
|
#include "build.h"
|
|
#include "common.h"
|
|
#include "keyboard.h"
|
|
#include "control.h"
|
|
#include "exhumed.h"
|
|
#include "config.h"
|
|
#include "osdcmds.h"
|
|
#include "view.h"
|
|
|
|
BEGIN_PS_NS
|
|
|
|
|
|
int osdcmd_restartvid(osdcmdptr_t UNUSED(parm))
|
|
{
|
|
UNREFERENCED_CONST_PARAMETER(parm);
|
|
videoResetMode();
|
|
if (videoSetGameMode(gSetup.fullscreen,gSetup.xdim,gSetup.ydim,gSetup.bpp,0))
|
|
I_Error("restartvid: Reset failed...\n");
|
|
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))
|
|
I_Error("vidmode: Reset failed!\n");
|
|
}
|
|
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)
|
|
{
|
|
uint8_t palid = BASEPAL;
|
|
videoSetPalette(0, palid, 0);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
|
|
END_PS_NS
|