Even more conversion, lots of superfluous macro removal
This commit is contained in:
+25
-23
@@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "quakedef.hpp"
|
||||
#include "arch_def.hpp"
|
||||
|
||||
@@ -40,9 +42,9 @@ int history_line = 0;
|
||||
keydest_t key_dest;
|
||||
|
||||
char *keybindings[MAX_KEYS];
|
||||
qboolean consolekeys[MAX_KEYS]; // if true, can't be rebound while in console
|
||||
qboolean menubound[MAX_KEYS]; // if true, can't be rebound while in menu
|
||||
qboolean keydown[MAX_KEYS];
|
||||
bool consolekeys[MAX_KEYS]; // if true, can't be rebound while in console
|
||||
bool menubound[MAX_KEYS]; // if true, can't be rebound while in menu
|
||||
bool keydown[MAX_KEYS];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -250,8 +252,8 @@ void Key_Console (int key)
|
||||
case K_ENTER:
|
||||
case K_KP_ENTER:
|
||||
key_tabpartial[0] = 0;
|
||||
Cbuf_AddText (workline + 1); // skip the prompt
|
||||
Cbuf_AddText ("\n");
|
||||
command::buffer::add_text (workline + 1); // skip the prompt
|
||||
command::buffer::add_text ("\n");
|
||||
Con_Printf ("%s\n", workline);
|
||||
|
||||
// If the last two lines are identical, skip storing this line in history
|
||||
@@ -318,7 +320,7 @@ void Key_Console (int key)
|
||||
if (x != con_linewidth)
|
||||
break;
|
||||
}
|
||||
con_backscroll = CLAMP(0, con_current-i%con_totallines-2, con_totallines-(glheight>>3)-1);
|
||||
con_backscroll = std::clamp(con_current-i%con_totallines-2, 0, con_totallines-(glheight>>3)-1);
|
||||
}
|
||||
else key_linepos = 1;
|
||||
return;
|
||||
@@ -370,9 +372,9 @@ void Key_Console (int key)
|
||||
}
|
||||
return;
|
||||
|
||||
case K_UPARROW:
|
||||
case K_UPARROW:
|
||||
if (history_line == edit_line)
|
||||
Q_strcpy(current, workline);
|
||||
std::strcpy(current, workline);
|
||||
|
||||
history_line_last = history_line;
|
||||
do
|
||||
@@ -457,7 +459,7 @@ void Char_Console (int key)
|
||||
|
||||
if (key_linepos < MAXCMDLINE-1)
|
||||
{
|
||||
qboolean endpos = !workline[key_linepos];
|
||||
bool endpos = !workline[key_linepos];
|
||||
|
||||
key_tabpartial[0] = 0; //johnfitz
|
||||
// if inserting, move the text to the right
|
||||
@@ -489,7 +491,7 @@ void Char_Console (int key)
|
||||
|
||||
//============================================================================
|
||||
|
||||
qboolean chat_team = false;
|
||||
bool chat_team = false;
|
||||
static char chat_buffer[MAXCMDLINE];
|
||||
static int chat_bufferlen = 0;
|
||||
|
||||
@@ -517,11 +519,11 @@ void Key_Message (int key)
|
||||
case K_ENTER:
|
||||
case K_KP_ENTER:
|
||||
if (chat_team)
|
||||
Cbuf_AddText ("say_team \"");
|
||||
command::buffer::add_text ("say_team \"");
|
||||
else
|
||||
Cbuf_AddText ("say \"");
|
||||
Cbuf_AddText(chat_buffer);
|
||||
Cbuf_AddText("\"\n");
|
||||
command::buffer::add_text ("say \"");
|
||||
command::buffer::add_text(chat_buffer);
|
||||
command::buffer::add_text("\"\n");
|
||||
|
||||
Key_EndChat ();
|
||||
return;
|
||||
@@ -898,7 +900,7 @@ void Key_Init (void)
|
||||
}
|
||||
|
||||
static struct {
|
||||
qboolean active;
|
||||
bool active;
|
||||
int lastkey;
|
||||
int lastchar;
|
||||
} key_inputgrab = { false, -1, -1 };
|
||||
@@ -954,7 +956,7 @@ Called by the system between frames for both key up and key down events
|
||||
Should NOT be called during an interrupt!
|
||||
===================
|
||||
*/
|
||||
void Key_Event (int key, qboolean down)
|
||||
void Key_Event (int key, bool down)
|
||||
{
|
||||
Key_EventWithKeycode (key, down, 0);
|
||||
}
|
||||
@@ -969,7 +971,7 @@ keycode parameter should have the key's actual keycode using the current keyboar
|
||||
not necessarily the US-keyboard-based scancode. Pass 0 if not applicable.
|
||||
===================
|
||||
*/
|
||||
void Key_EventWithKeycode (int key, qboolean down, int keycode)
|
||||
void Key_EventWithKeycode (int key, bool down, int keycode)
|
||||
{
|
||||
char *kb;
|
||||
char cmd[1024];
|
||||
@@ -1053,7 +1055,7 @@ void Key_EventWithKeycode (int key, qboolean down, int keycode)
|
||||
if (kb && kb[0] == '+')
|
||||
{
|
||||
sprintf (cmd, "-%s %i\n", kb+1, key);
|
||||
Cbuf_AddText (cmd);
|
||||
command::buffer::add_text (cmd);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1076,12 +1078,12 @@ void Key_EventWithKeycode (int key, qboolean down, int keycode)
|
||||
if (kb[0] == '+')
|
||||
{ // button commands add keynum as a parm
|
||||
sprintf (cmd, "%s %i\n", kb, key);
|
||||
Cbuf_AddText (cmd);
|
||||
command::buffer::add_text (cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
Cbuf_AddText (kb);
|
||||
Cbuf_AddText ("\n");
|
||||
command::buffer::add_text (kb);
|
||||
command::buffer::add_text ("\n");
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1158,7 +1160,7 @@ void Char_Event (int key)
|
||||
Key_TextEntry
|
||||
===================
|
||||
*/
|
||||
qboolean Key_TextEntry (void)
|
||||
bool Key_TextEntry (void)
|
||||
{
|
||||
if (key_inputgrab.active)
|
||||
{
|
||||
@@ -1208,7 +1210,7 @@ Key_UpdateForDest
|
||||
*/
|
||||
void Key_UpdateForDest (void)
|
||||
{
|
||||
static qboolean forced = false;
|
||||
static bool forced = false;
|
||||
|
||||
if (cls.state == ca_dedicated)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user