X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=common.c;h=35e9610656247eba96b4265fd5f9ec2d95c3380d;hp=7271384055629971b660ffbca44ca1ea8f25bf3f;hb=58c33270c280aafe85a1eacb224efdd9138fdb19;hpb=7ca9ce4420b332de3fa6f2d6beaa437f171ab97c diff --git a/common.c b/common.c index 72713840..35e96106 100644 --- a/common.c +++ b/common.c @@ -1,5 +1,6 @@ /* Copyright (C) 1996-1997 Id Software, Inc. +Copyright (C) 2000-2020 DarkPlaces contributors This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -28,12 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "utf8lib.h" -cvar_t registered = {CVAR_CLIENT | CVAR_SERVER, "registered","0", "indicates if this is running registered quake (whether gfx/pop.lmp was found)"}; -cvar_t cmdline = {CVAR_CLIENT | CVAR_SERVER, "cmdline","0", "contains commandline the engine was launched with"}; +cvar_t registered = {CF_CLIENT | CF_SERVER, "registered","0", "indicates if this is running registered quake (whether gfx/pop.lmp was found)"}; +cvar_t cmdline = {CF_CLIENT | CF_SERVER, "cmdline","0", "contains commandline the engine was launched with"}; // FIXME: Find a better place for these. -cvar_t cl_playermodel = {CVAR_CLIENT | CVAR_SERVER | CVAR_USERINFO | CVAR_SAVE, "playermodel", "", "current player model in Nexuiz/Xonotic"}; -cvar_t cl_playerskin = {CVAR_CLIENT | CVAR_SERVER | CVAR_USERINFO | CVAR_SAVE, "playerskin", "", "current player skin in Nexuiz/Xonotic"}; +cvar_t cl_playermodel = {CF_CLIENT | CF_SERVER | CF_USERINFO | CF_ARCHIVE, "playermodel", "", "current player model in Nexuiz/Xonotic"}; +cvar_t cl_playerskin = {CF_CLIENT | CF_SERVER | CF_USERINFO | CF_ARCHIVE, "playerskin", "", "current player skin in Nexuiz/Xonotic"}; char com_token[MAX_INPUTLINE]; @@ -180,7 +181,7 @@ int COM_Wordwrap(const char *string, size_t length, float continuationWidth, flo // If it fits, append it. Continue. // If it doesn't fit, output current line, advance to next line. Append the word. This is a continuation. Continue. - qboolean isContinuation = false; + qbool isContinuation = false; float spaceWidth; const char *startOfLine = string; const char *cursor = string; @@ -258,7 +259,7 @@ int COM_Wordwrap(const char *string, size_t length, float continuationWidth, flo return result; /* - qboolean isContinuation = false; + qbool isContinuation = false; float currentWordSpace = 0; const char *currentWord = 0; float minReserve = 0; @@ -457,7 +458,7 @@ COM_ParseToken_Simple Parse a token out of a string ============== */ -int COM_ParseToken_Simple(const char **datapointer, qboolean returnnewline, qboolean parsebackslash, qboolean parsecomments) +int COM_ParseToken_Simple(const char **datapointer, qbool returnnewline, qbool parsebackslash, qbool parsecomments) { int len; int c; @@ -570,7 +571,7 @@ COM_ParseToken_QuakeC Parse a token out of a string ============== */ -int COM_ParseToken_QuakeC(const char **datapointer, qboolean returnnewline) +int COM_ParseToken_QuakeC(const char **datapointer, qbool returnnewline) { int len; int c; @@ -684,7 +685,7 @@ COM_ParseToken_VM_Tokenize Parse a token out of a string ============== */ -int COM_ParseToken_VM_Tokenize(const char **datapointer, qboolean returnnewline) +int COM_ParseToken_VM_Tokenize(const char **datapointer, qbool returnnewline) { int len; int c; @@ -869,11 +870,11 @@ Used by view and sv_user */ float Com_CalcRoll (const vec3_t angles, const vec3_t velocity, const vec_t angleval, const vec_t velocityval) { - vec3_t right; + vec3_t forward, right, up; float sign; float side; - AngleVectors (angles, NULL, right, NULL); + AngleVectors (angles, forward, right, up); side = DotProduct (velocity, right); sign = side < 0 ? -1 : 1; side = fabs(side); @@ -902,9 +903,9 @@ void COM_Init_Commands (void) Cvar_RegisterVariable (®istered); Cvar_RegisterVariable (&cmdline); Cvar_RegisterVariable(&cl_playermodel); - Cvar_RegisterAlias(&cl_playermodel, "_cl_playermodel"); + Cvar_RegisterVirtual(&cl_playermodel, "_cl_playermodel"); Cvar_RegisterVariable(&cl_playerskin); - Cvar_RegisterAlias(&cl_playerskin, "_cl_playerskin"); + Cvar_RegisterVirtual(&cl_playerskin, "_cl_playerskin"); // reconstitute the command line for the cmdline externally visible cvar n = 0; @@ -1163,7 +1164,7 @@ all characters until the zero terminator. ============ */ size_t -COM_StringLengthNoColors(const char *s, size_t size_s, qboolean *valid) +COM_StringLengthNoColors(const char *s, size_t size_s, qbool *valid) { const char *end = size_s ? (s + size_s) : NULL; size_t len = 0; @@ -1236,8 +1237,8 @@ For size_in, specify the maximum number of characters from in to use, or 0 to us all characters until the zero terminator. ============ */ -qboolean -COM_StringDecolorize(const char *in, size_t size_in, char *out, size_t size_out, qboolean escape_carets) +qbool +COM_StringDecolorize(const char *in, size_t size_in, char *out, size_t size_out, qbool escape_carets) { #define APPEND(ch) do { if(--size_out) { *out++ = (ch); } else { *out++ = 0; return false; } } while(0) const char *end = size_in ? (in + size_in) : NULL;