X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=common.c;h=e981b779a0796f18594857007a2794d0ee6041e3;hb=64cdec7e5861924eb9aff7df36e419884e975c44;hp=a0d291e2cc14e99d79a45c269c6a60867b765ae5;hpb=cfee52a1ec9db338098789cae89ae5cf1f7a6fbf;p=xonotic%2Fdarkplaces.git diff --git a/common.c b/common.c index a0d291e2..e981b779 100644 --- a/common.c +++ b/common.c @@ -364,7 +364,7 @@ void MSG_WriteCoord (sizebuf_t *sb, float f, protocolversion_t protocol) MSG_WriteCoord32f (sb, f); } -void MSG_WriteVector (sizebuf_t *sb, float *v, protocolversion_t protocol) +void MSG_WriteVector (sizebuf_t *sb, const vec3_t v, protocolversion_t protocol) { MSG_WriteCoord (sb, v[0], protocol); MSG_WriteCoord (sb, v[1], protocol); @@ -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; @@ -536,7 +544,7 @@ float MSG_ReadCoord (sizebuf_t *sb, protocolversion_t protocol) return MSG_ReadCoord32f(sb); } -void MSG_ReadVector (sizebuf_t *sb, float *v, protocolversion_t protocol) +void MSG_ReadVector (sizebuf_t *sb, vec3_t v, protocolversion_t protocol) { v[0] = MSG_ReadCoord(sb, protocol); v[1] = MSG_ReadCoord(sb, protocol); @@ -734,7 +742,6 @@ int COM_Wordwrap(const char *string, size_t length, float continuationWidth, flo { case 0: // end of string result += processLine(passthroughPL, startOfLine, cursor - startOfLine, spaceUsedInLine, isContinuation); - isContinuation = false; goto out; case '\n': // end of line result += processLine(passthroughPL, startOfLine, cursor - startOfLine, spaceUsedInLine, isContinuation); @@ -989,7 +996,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 +1031,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++; @@ -1442,6 +1449,7 @@ static const gamemode_info_t gamemode_info [GAME_COUNT] = { GAME_HIPNOTIC, GAME_NORMAL, "hipnotic", "-hipnotic", "Darkplaces-Hipnotic", "id1", "hipnotic", "dp", "darkplaces" }, // COMMANDLINEOPTION: Game: -hipnotic runs Quake mission pack 1: The Scourge of Armagon { GAME_ROGUE, GAME_NORMAL, "rogue", "-rogue", "Darkplaces-Rogue", "id1", "rogue", "dp", "darkplaces" }, // COMMANDLINEOPTION: Game: -rogue runs Quake mission pack 2: The Dissolution of Eternity { GAME_NEHAHRA, GAME_NORMAL, "nehahra", "-nehahra", "DarkPlaces-Nehahra", "id1", "nehahra", "dp", "darkplaces" }, // COMMANDLINEOPTION: Game: -nehahra runs The Seal of Nehahra movie and game +{ GAME_QUOTH, GAME_NORMAL, "quoth", "-quoth", "Darkplaces-Quoth", "id1", "quoth", "dp", "darkplaces" }, // COMMANDLINEOPTION: Game: -quoth runs the Quoth mod for playing community maps made for it { GAME_NEXUIZ, GAME_NEXUIZ, "nexuiz", "-nexuiz", "Nexuiz", "data", NULL, "nexuiz", "nexuiz" }, // COMMANDLINEOPTION: Game: -nexuiz runs the multiplayer game Nexuiz { GAME_XONOTIC, GAME_XONOTIC, "xonotic", "-xonotic", "Xonotic", "data", NULL, "xonotic", "xonotic" }, // COMMANDLINEOPTION: Game: -xonotic runs the multiplayer game Xonotic { GAME_TRANSFUSION, GAME_TRANSFUSION, "transfusion", "-transfusion", "Transfusion", "basetf", NULL, "transfusion", "transfusion" }, // COMMANDLINEOPTION: Game: -transfusion runs Transfusion (the recreation of Blood in Quake) @@ -1450,7 +1458,6 @@ static const gamemode_info_t gamemode_info [GAME_COUNT] = { GAME_BATTLEMECH, GAME_BATTLEMECH, "battlemech", "-battlemech", "Battlemech", "base", NULL, "battlemech", "battlemech" }, // COMMANDLINEOPTION: Game: -battlemech runs the multiplayer topdown deathmatch game BattleMech { GAME_ZYMOTIC, GAME_ZYMOTIC, "zymotic", "-zymotic", "Zymotic", "basezym", NULL, "zymotic", "zymotic" }, // COMMANDLINEOPTION: Game: -zymotic runs the singleplayer game Zymotic { GAME_SETHERAL, GAME_SETHERAL, "setheral", "-setheral", "Setheral", "data", NULL, "setheral", "setheral" }, // COMMANDLINEOPTION: Game: -setheral runs the multiplayer game Setheral -{ GAME_SOM, GAME_NORMAL, "sonofman", "-som", "Son of Man", "id1", "sonofman", "som", "darkplaces" }, // COMMANDLINEOPTION: Game: -som runs the multiplayer game Son Of Man { GAME_TENEBRAE, GAME_NORMAL, "tenebrae", "-tenebrae", "DarkPlaces-Tenebrae", "id1", "tenebrae", "dp", "darkplaces" }, // COMMANDLINEOPTION: Game: -tenebrae runs the graphics test mod known as Tenebrae (some features not implemented) { GAME_NEOTERIC, GAME_NORMAL, "neoteric", "-neoteric", "Neoteric", "id1", "neobase", "neo", "darkplaces" }, // COMMANDLINEOPTION: Game: -neoteric runs the game Neoteric { GAME_OPENQUARTZ, GAME_NORMAL, "openquartz", "-openquartz", "OpenQuartz", "id1", NULL, "openquartz", "darkplaces" }, // COMMANDLINEOPTION: Game: -openquartz runs the game OpenQuartz, a standalone GPL replacement of the quake content @@ -1461,9 +1468,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 +1489,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;