Even more conversion, lots of superfluous macro removal
This commit is contained in:
+45
-43
@@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "quakedef.hpp"
|
||||
#include "bgmusic.hpp"
|
||||
|
||||
@@ -126,12 +128,12 @@ void M_Help_Key(int key);
|
||||
|
||||
void M_Quit_Key(int key);
|
||||
|
||||
qboolean m_entersound; // play after drawing a frame, so caching
|
||||
bool m_entersound; // play after drawing a frame, so caching
|
||||
// won't disrupt the sound
|
||||
qboolean m_recursiveDraw;
|
||||
bool m_recursiveDraw;
|
||||
|
||||
enum m_state_e m_return_state;
|
||||
qboolean m_return_onerror;
|
||||
bool m_return_onerror;
|
||||
char m_return_reason[32];
|
||||
|
||||
#define StartingGame (m_multiplayer_cursor == 1)
|
||||
@@ -413,11 +415,11 @@ void M_SinglePlayer_Key(int key) {
|
||||
IN_Activate();
|
||||
key_dest = key_game;
|
||||
if (sv.active)
|
||||
Cbuf_AddText("disconnect\n");
|
||||
Cbuf_AddText("maxplayers 1\n");
|
||||
Cbuf_AddText("deathmatch 0\n"); //johnfitz
|
||||
Cbuf_AddText("coop 0\n"); //johnfitz
|
||||
Cbuf_AddText("map start\n");
|
||||
command::buffer::add_text("disconnect\n");
|
||||
command::buffer::add_text("maxplayers 1\n");
|
||||
command::buffer::add_text("deathmatch 0\n"); //johnfitz
|
||||
command::buffer::add_text("coop 0\n"); //johnfitz
|
||||
command::buffer::add_text("map start\n");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@@ -548,7 +550,7 @@ void M_Load_Key(int k) {
|
||||
SCR_BeginLoadingPlaque();
|
||||
|
||||
// issue the load command
|
||||
Cbuf_AddText(va("load s%i\n", load_cursor));
|
||||
command::buffer::add_text(va("load s%i\n", load_cursor));
|
||||
return;
|
||||
|
||||
case K_UPARROW:
|
||||
@@ -583,7 +585,7 @@ void M_Save_Key(int k) {
|
||||
m_state = m_none;
|
||||
IN_Activate();
|
||||
key_dest = key_game;
|
||||
Cbuf_AddText(va("save s%i\n", load_cursor));
|
||||
command::buffer::add_text(va("save s%i\n", load_cursor));
|
||||
return;
|
||||
|
||||
case K_UPARROW:
|
||||
@@ -699,8 +701,8 @@ void M_Menu_Setup_f(void) {
|
||||
key_dest = key_menu;
|
||||
m_state = m_setup;
|
||||
m_entersound = true;
|
||||
Q_strcpy(setup_myname, cl_name.string);
|
||||
Q_strcpy(setup_hostname, hostname.string);
|
||||
std::strcpy(setup_myname, cl_name.string);
|
||||
std::strcpy(setup_hostname, hostname.string);
|
||||
setup_top = setup_oldtop = ((int) cl_color.value) >> 4;
|
||||
setup_bottom = setup_oldbottom = ((int) cl_color.value) & 15;
|
||||
}
|
||||
@@ -795,12 +797,12 @@ void M_Setup_Key(int k) {
|
||||
goto forward;
|
||||
|
||||
// setup_cursor == 4 (OK)
|
||||
if (Q_strcmp(cl_name.string, setup_myname) != 0)
|
||||
Cbuf_AddText(va("name \"%s\"\n", setup_myname));
|
||||
if (Q_strcmp(hostname.string, setup_hostname) != 0)
|
||||
if (std::strcmp(cl_name.string, setup_myname) != 0)
|
||||
command::buffer::add_text(va("name \"%s\"\n", setup_myname));
|
||||
if (std::strcmp(hostname.string, setup_hostname) != 0)
|
||||
convar::set("hostname", setup_hostname);
|
||||
if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
|
||||
Cbuf_AddText(va("color %i %i\n", setup_top, setup_bottom));
|
||||
command::buffer::add_text(va("color %i %i\n", setup_top, setup_bottom));
|
||||
m_entersound = true;
|
||||
M_Menu_MultiPlayer_f();
|
||||
break;
|
||||
@@ -851,7 +853,7 @@ void M_Setup_Char(int k) {
|
||||
}
|
||||
|
||||
|
||||
qboolean M_Setup_TextEntry(void) {
|
||||
bool M_Setup_TextEntry(void) {
|
||||
return (setup_cursor == 0 || setup_cursor == 1);
|
||||
}
|
||||
|
||||
@@ -1059,7 +1061,7 @@ void M_AdjustSliders(int dir) {
|
||||
convar::set_value("bgmvolume", f);
|
||||
break;
|
||||
case OPT_MUSICEXT: // enable external music vs cdaudio
|
||||
convar::set("bgm_extmusic", bgm_extmusic.value ? "0" : "1");
|
||||
convar::set("bgm_extmusic", music::bgm_extmusic.value ? "0" : "1");
|
||||
break;
|
||||
case OPT_SNDVOL: // sfx volume
|
||||
f = sfxvolume.value + dir * 0.1;
|
||||
@@ -1100,9 +1102,9 @@ void M_AdjustSliders(int dir) {
|
||||
|
||||
case OPT_ALWAYSMLOOK:
|
||||
if (in_mlook.state & 1)
|
||||
Cbuf_AddText("-mlook");
|
||||
command::buffer::add_text("-mlook");
|
||||
else
|
||||
Cbuf_AddText("+mlook");
|
||||
command::buffer::add_text("+mlook");
|
||||
break;
|
||||
|
||||
case OPT_LOOKSPRING: // lookspring
|
||||
@@ -1205,7 +1207,7 @@ void M_Options_Draw(void) {
|
||||
|
||||
// OPT_MUSICEXT:
|
||||
M_Print(16, 32 + 8 * OPT_MUSICEXT, " External Music");
|
||||
M_DrawCheckbox(220, 32 + 8 * OPT_MUSICEXT, bgm_extmusic.value);
|
||||
M_DrawCheckbox(220, 32 + 8 * OPT_MUSICEXT, music::bgm_extmusic.value);
|
||||
|
||||
// OPT_ALWAYRUN:
|
||||
M_Print(16, 32 + 8 * OPT_ALWAYRUN, " Always Run");
|
||||
@@ -1263,8 +1265,8 @@ void M_Options_Key(int k) {
|
||||
case OPT_DEFAULTS:
|
||||
if (SCR_ModalMessage("This will reset all controls\n"
|
||||
"and stored cvars. Continue? (y/n)\n", 15.0f)) {
|
||||
Cbuf_AddText("resetcfg\n");
|
||||
Cbuf_AddText("exec default.cfg\n");
|
||||
command::buffer::add_text("resetcfg\n");
|
||||
command::buffer::add_text("exec default.cfg\n");
|
||||
}
|
||||
break;
|
||||
case OPT_VIDEO:
|
||||
@@ -1333,10 +1335,10 @@ const char *bindnames[][2] =
|
||||
{"+movedown", "swim down"}
|
||||
};
|
||||
|
||||
#define NUMCOMMANDS Q_COUNTOF(bindnames)
|
||||
#define NUMCOMMANDS std::size(bindnames)
|
||||
|
||||
static int keys_cursor;
|
||||
static qboolean bind_grab;
|
||||
static bool bind_grab;
|
||||
|
||||
void M_Menu_Keys_f(void) {
|
||||
IN_Deactivate(modestate == MS_WINDOWED);
|
||||
@@ -1444,7 +1446,7 @@ void M_Keys_Key(int k) {
|
||||
S_LocalSound("misc/menu1.wav");
|
||||
if ((k != K_ESCAPE) && (k != '`')) {
|
||||
sprintf(cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString(k), bindnames[keys_cursor][0]);
|
||||
Cbuf_InsertText(cmd);
|
||||
command::buffer::insert_text(cmd);
|
||||
}
|
||||
|
||||
bind_grab = false;
|
||||
@@ -1559,7 +1561,7 @@ void M_Help_Key(int key) {
|
||||
|
||||
int msgNumber;
|
||||
enum m_state_e m_quit_prevstate;
|
||||
qboolean wasInMenus;
|
||||
bool wasInMenus;
|
||||
|
||||
void M_Menu_Quit_f(void) {
|
||||
if (m_state == m_quit)
|
||||
@@ -1615,7 +1617,7 @@ void M_Quit_Char(int key) {
|
||||
}
|
||||
|
||||
|
||||
qboolean M_Quit_TextEntry(void) {
|
||||
bool M_Quit_TextEntry(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1785,7 +1787,7 @@ void M_LanConfig_Key(int key) {
|
||||
IN_Activate();
|
||||
key_dest = key_game;
|
||||
m_state = m_none;
|
||||
Cbuf_AddText(va("connect \"%s\"\n", lanConfig_joinname));
|
||||
command::buffer::add_text(va("connect \"%s\"\n", lanConfig_joinname));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1811,7 +1813,7 @@ void M_LanConfig_Key(int key) {
|
||||
lanConfig_cursor = 0;
|
||||
}
|
||||
|
||||
l = Q_atoi(lanConfig_portname);
|
||||
l = std::atoi(lanConfig_portname);
|
||||
if (l > 65535)
|
||||
l = lanConfig_port;
|
||||
else
|
||||
@@ -1844,7 +1846,7 @@ void M_LanConfig_Char(int key) {
|
||||
}
|
||||
|
||||
|
||||
qboolean M_LanConfig_TextEntry(void) {
|
||||
bool M_LanConfig_TextEntry(void) {
|
||||
return (lanConfig_cursor == 0 || lanConfig_cursor == 2);
|
||||
}
|
||||
|
||||
@@ -1996,7 +1998,7 @@ episode_t rogueepisodes[] =
|
||||
int startepisode;
|
||||
int startlevel;
|
||||
int maxplayers;
|
||||
qboolean m_serverInfoMessage = false;
|
||||
bool m_serverInfoMessage = false;
|
||||
double m_serverInfoMessageTime;
|
||||
|
||||
void M_Menu_GameOptions_f(void) {
|
||||
@@ -2269,18 +2271,18 @@ void M_GameOptions_Key(int key) {
|
||||
S_LocalSound("misc/menu2.wav");
|
||||
if (gameoptions_cursor == 0) {
|
||||
if (sv.active)
|
||||
Cbuf_AddText("disconnect\n");
|
||||
Cbuf_AddText("listen 0\n"); // so host_netport will be re-examined
|
||||
Cbuf_AddText(va("maxplayers %u\n", maxplayers));
|
||||
command::buffer::add_text("disconnect\n");
|
||||
command::buffer::add_text("listen 0\n"); // so host_netport will be re-examined
|
||||
command::buffer::add_text(va("maxplayers %u\n", maxplayers));
|
||||
SCR_BeginLoadingPlaque();
|
||||
|
||||
if (hipnotic)
|
||||
Cbuf_AddText(va(
|
||||
command::buffer::add_text(va(
|
||||
"map %s\n", hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].name));
|
||||
else if (rogue)
|
||||
Cbuf_AddText(va("map %s\n", roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].name));
|
||||
command::buffer::add_text(va("map %s\n", roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].name));
|
||||
else
|
||||
Cbuf_AddText(va("map %s\n", levels[episodes[startepisode].firstLevel + startlevel].name));
|
||||
command::buffer::add_text(va("map %s\n", levels[episodes[startepisode].firstLevel + startlevel].name));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2293,7 +2295,7 @@ void M_GameOptions_Key(int key) {
|
||||
//=============================================================================
|
||||
/* SEARCH MENU */
|
||||
|
||||
qboolean searchComplete = false;
|
||||
bool searchComplete = false;
|
||||
double searchCompleteTime;
|
||||
|
||||
void M_Menu_Search_f(void) {
|
||||
@@ -2348,7 +2350,7 @@ void M_Search_Key(int key) {
|
||||
/* SLIST MENU */
|
||||
|
||||
int slist_cursor;
|
||||
qboolean slist_sorted;
|
||||
bool slist_sorted;
|
||||
|
||||
void M_Menu_ServerList_f(void) {
|
||||
IN_Deactivate(modestate == MS_WINDOWED);
|
||||
@@ -2419,7 +2421,7 @@ void M_ServerList_Key(int k) {
|
||||
IN_Activate();
|
||||
key_dest = key_game;
|
||||
m_state = m_none;
|
||||
Cbuf_AddText(va("connect \"%s\"\n", NET_SlistPrintServerName(slist_cursor)));
|
||||
command::buffer::add_text(va("connect \"%s\"\n", NET_SlistPrintServerName(slist_cursor)));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -2643,7 +2645,7 @@ void M_Charinput(int key) {
|
||||
}
|
||||
|
||||
|
||||
qboolean M_TextEntry(void) {
|
||||
bool M_TextEntry(void) {
|
||||
switch (m_state) {
|
||||
case m_setup:
|
||||
return M_Setup_TextEntry();
|
||||
@@ -2659,7 +2661,7 @@ qboolean M_TextEntry(void) {
|
||||
|
||||
void M_ConfigureNetSubsystem(void) {
|
||||
// enable/disable net systems to match desired config
|
||||
Cbuf_AddText("stopdemo\n");
|
||||
command::buffer::add_text("stopdemo\n");
|
||||
|
||||
if (IPXConfig || TCPIPConfig)
|
||||
net_hostport = lanConfig_port;
|
||||
|
||||
Reference in New Issue
Block a user