X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=common.c;h=3b986194ad7720612a9eeb5b04b91d112f47db9b;hb=ae946773a0fdc85c9fcd22615744a9b0e1b1b0c0;hp=a0d291e2cc14e99d79a45c269c6a60867b765ae5;hpb=cfee52a1ec9db338098789cae89ae5cf1f7a6fbf;p=xonotic%2Fdarkplaces.git diff --git a/common.c b/common.c index a0d291e2..3b986194 100644 --- a/common.c +++ b/common.c @@ -405,6 +405,14 @@ void MSG_WriteAngle (sizebuf_t *sb, float f, protocolversion_t protocol) // reading functions // +void MSG_InitReadBuffer (sizebuf_t *buf, unsigned char *data, int size) +{ + memset(buf, 0, sizeof(*buf)); + buf->data = data; + buf->maxsize = buf->cursize = size; + MSG_BeginReading(buf); +} + void MSG_BeginReading(sizebuf_t *sb) { sb->readcount = 0; @@ -989,7 +997,7 @@ COM_ParseToken_Simple Parse a token out of a string ============== */ -int COM_ParseToken_Simple(const char **datapointer, qboolean returnnewline, qboolean parsebackslash) +int COM_ParseToken_Simple(const char **datapointer, qboolean returnnewline, qboolean parsebackslash, qboolean parsecomments) { int len; int c; @@ -1024,14 +1032,14 @@ skipwhite: if (data[0] == '\r' && data[1] == '\n') data++; - if (data[0] == '/' && data[1] == '/') + if (parsecomments && data[0] == '/' && data[1] == '/') { // comment while (*data && *data != '\n' && *data != '\r') data++; goto skipwhite; } - else if (data[0] == '/' && data[1] == '*') + else if (parsecomments && data[0] == '/' && data[1] == '*') { // comment data++; @@ -1461,9 +1469,11 @@ static const gamemode_info_t gamemode_info [GAME_COUNT] = { GAME_DARSANA, GAME_DARSANA, "darsana", "-darsana", "Darsana", "ddata", NULL, "darsana", "darsana" }, // COMMANDLINEOPTION: Game: -darsana runs the game Darsana { GAME_CONTAGIONTHEORY, GAME_CONTAGIONTHEORY, "contagiontheory", "-contagiontheory", "Contagion Theory", "ctdata", NULL, "ct", "contagiontheory" }, // COMMANDLINEOPTION: Game: -contagiontheory runs the game Contagion Theory { GAME_EDU2P, GAME_EDU2P, "edu2p", "-edu2p", "EDU2 Prototype", "id1", "edu2", "edu2_p", "edu2prototype" }, // COMMANDLINEOPTION: Game: -edu2p runs the game Edu2 prototype -{ GAME_PROPHECY, GAME_PROPHECY, "prophecy", "-prophecy", "Prophecy", "data", NULL, "prophecy", "prophecy" }, // COMMANDLINEOPTION: Game: -prophecy runs the game Prophecy +{ GAME_PROPHECY, GAME_PROPHECY, "prophecy", "-prophecy", "Prophecy", "gamedata", NULL, "phcy", "prophecy" }, // COMMANDLINEOPTION: Game: -prophecy runs the game Prophecy { GAME_BLOODOMNICIDE, GAME_BLOODOMNICIDE, "omnicide", "-omnicide", "Blood Omnicide", "kain", NULL, "omnicide", "omnicide" }, // COMMANDLINEOPTION: Game: -omnicide runs the game Blood Omnicide { GAME_STEELSTORM, GAME_STEELSTORM, "steelstorm", "-steelstorm", "Steel-Storm", "gamedata", NULL, "ss", "steelstorm" }, // COMMANDLINEOPTION: Game: -steelstorm runs the game Steel Storm +{ GAME_STEELSTORM2, GAME_STEELSTORM2, "steelstorm2", "-steelstorm2", "Steel Storm 2", "gamedata", NULL, "ss2", "steelstorm2" }, // COMMANDLINEOPTION: Game: -steelstorm2 runs the game Steel Storm 2 +{ GAME_TOMESOFMEPHISTOPHELES, GAME_TOMESOFMEPHISTOPHELES, "tomesofmephistopheles", "-tomesofmephistopheles", "Tomes of Mephistopheles", "gamedata", NULL, "tom", "tomesofmephistopheles" }, // COMMANDLINEOPTION: Game: -steelstorm runs the game Steel Storm { GAME_STRAPBOMB, GAME_STRAPBOMB, "strapbomb", "-strapbomb", "Strap-on-bomb Car", "id1", NULL, "strap", "strapbomb" }, // COMMANDLINEOPTION: Game: -strapbomb runs the game Strap-on-bomb Car { GAME_MOONHELM, GAME_MOONHELM, "moonhelm", "-moonhelm", "MoonHelm", "data", NULL, "mh", "moonhelm" }, // COMMANDLINEOPTION: Game: -moonhelm runs the game MoonHelm }; @@ -1480,18 +1490,12 @@ void COM_InitGameType (void) COM_ToLowerString(name, name, sizeof (name)); for (i = 1;i < (int)(sizeof (gamemode_info) / sizeof (gamemode_info[0]));i++) if (gamemode_info[i].prog_name && gamemode_info[i].prog_name[0] && strstr (name, gamemode_info[i].prog_name)) - { index = i; - break; - } // check commandline options for keywords for (i = 0;i < (int)(sizeof (gamemode_info) / sizeof (gamemode_info[0]));i++) if (COM_CheckParm (gamemode_info[i].cmdline)) - { index = i; - break; - } com_startupgamemode = gamemode_info[index].mode; com_startupgamegroup = gamemode_info[index].group;