mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-22 09:11:33 +00:00
server: support of load original game library
This commit is contained in:
parent
32047010a2
commit
f7dc2777c5
6 changed files with 35 additions and 24 deletions
|
@ -1159,7 +1159,7 @@ CL_ParseConfigString(void)
|
||||||
Q_strlcpy(olds, cl.configstrings[i], sizeof(olds));
|
Q_strlcpy(olds, cl.configstrings[i], sizeof(olds));
|
||||||
|
|
||||||
length = strlen(s);
|
length = strlen(s);
|
||||||
if (length > sizeof(cl.configstrings) - sizeof(cl.configstrings[0])*i - 1)
|
if (length > sizeof(cl.configstrings) - sizeof(cl.configstrings[0]) * i - 1)
|
||||||
{
|
{
|
||||||
Com_Error(ERR_DROP, "%s: oversize configstring", __func__);
|
Com_Error(ERR_DROP, "%s: oversize configstring", __func__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,16 +169,6 @@ typedef unsigned char byte;
|
||||||
#define PRINTF_ATTR(FMT, VARGS) __attribute__((format(printf, FMT , VARGS )))
|
#define PRINTF_ATTR(FMT, VARGS) __attribute__((format(printf, FMT , VARGS )))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* per-level limits Quake 2 Protocol version 26 */
|
|
||||||
#define MAX_CLIENTS_Q2DEMO 256 /* absolute limit */
|
|
||||||
#define MAX_EDICTS_Q2DEMO 1024 /* must change protocol to increase more */
|
|
||||||
#define MAX_LIGHTSTYLES_Q2DEMO 256
|
|
||||||
#define MAX_MODELS_Q2DEMO 256 /* these are sent over the net as bytes */
|
|
||||||
#define MAX_SOUNDS_Q2DEMO 256 /* so they cannot be blindly increased */
|
|
||||||
#define MAX_IMAGES_Q2DEMO 256
|
|
||||||
#define MAX_ITEMS_Q2DEMO 256
|
|
||||||
#define MAX_GENERAL_Q2DEMO (MAX_CLIENTS_Q2DEMO * 2) /* general config strings */
|
|
||||||
|
|
||||||
/* per-level limits */
|
/* per-level limits */
|
||||||
#define MAX_CLIENTS 256 /* absolute limit */
|
#define MAX_CLIENTS 256 /* absolute limit */
|
||||||
#define MAX_EDICTS 1024 /* must change protocol to increase more */
|
#define MAX_EDICTS 1024 /* must change protocol to increase more */
|
||||||
|
@ -1164,16 +1154,6 @@ typedef enum
|
||||||
#define CS_MAXCLIENTS 30
|
#define CS_MAXCLIENTS 30
|
||||||
#define CS_MAPCHECKSUM 31 /* for catching cheater maps */
|
#define CS_MAPCHECKSUM 31 /* for catching cheater maps */
|
||||||
|
|
||||||
/* CS structure Quake 2 Protocol version 26 */
|
|
||||||
#define CS_MODELS_Q2DEMO 32
|
|
||||||
#define CS_SOUNDS_Q2DEMO (CS_MODELS_Q2DEMO + MAX_MODELS_Q2DEMO)
|
|
||||||
#define CS_IMAGES_Q2DEMO (CS_SOUNDS_Q2DEMO + MAX_SOUNDS_Q2DEMO)
|
|
||||||
#define CS_LIGHTS_Q2DEMO (CS_IMAGES_Q2DEMO + MAX_IMAGES_Q2DEMO)
|
|
||||||
#define CS_ITEMS_Q2DEMO (CS_LIGHTS_Q2DEMO + MAX_LIGHTSTYLES_Q2DEMO)
|
|
||||||
#define CS_PLAYERSKINS_Q2DEMO (CS_ITEMS_Q2DEMO + MAX_ITEMS_Q2DEMO)
|
|
||||||
#define CS_GENERAL_Q2DEMO (CS_PLAYERSKINS_Q2DEMO + MAX_CLIENTS_Q2DEMO)
|
|
||||||
#define MAX_CONFIGSTRINGS_Q2DEMO (CS_GENERAL_Q2DEMO + MAX_GENERAL_Q2DEMO)
|
|
||||||
|
|
||||||
#define CS_MODELS 32
|
#define CS_MODELS 32
|
||||||
#define CS_SOUNDS (CS_MODELS + MAX_MODELS)
|
#define CS_SOUNDS (CS_MODELS + MAX_MODELS)
|
||||||
#define CS_IMAGES (CS_SOUNDS + MAX_SOUNDS)
|
#define CS_IMAGES (CS_SOUNDS + MAX_SOUNDS)
|
||||||
|
|
|
@ -27,6 +27,26 @@
|
||||||
#include "header/shared.h"
|
#include "header/shared.h"
|
||||||
#include "header/common.h"
|
#include "header/common.h"
|
||||||
|
|
||||||
|
/* per-level limits Quake 2 Protocol version 26 */
|
||||||
|
#define MAX_CLIENTS_Q2DEMO 256 /* absolute limit */
|
||||||
|
#define MAX_EDICTS_Q2DEMO 1024 /* must change protocol to increase more */
|
||||||
|
#define MAX_LIGHTSTYLES_Q2DEMO 256
|
||||||
|
#define MAX_MODELS_Q2DEMO 256 /* these are sent over the net as bytes */
|
||||||
|
#define MAX_SOUNDS_Q2DEMO 256 /* so they cannot be blindly increased */
|
||||||
|
#define MAX_IMAGES_Q2DEMO 256
|
||||||
|
#define MAX_ITEMS_Q2DEMO 256
|
||||||
|
#define MAX_GENERAL_Q2DEMO (MAX_CLIENTS_Q2DEMO * 2) /* general config strings */
|
||||||
|
|
||||||
|
/* CS structure Quake 2 Protocol version 26 */
|
||||||
|
#define CS_MODELS_Q2DEMO 32
|
||||||
|
#define CS_SOUNDS_Q2DEMO (CS_MODELS_Q2DEMO + MAX_MODELS_Q2DEMO)
|
||||||
|
#define CS_IMAGES_Q2DEMO (CS_SOUNDS_Q2DEMO + MAX_SOUNDS_Q2DEMO)
|
||||||
|
#define CS_LIGHTS_Q2DEMO (CS_IMAGES_Q2DEMO + MAX_IMAGES_Q2DEMO)
|
||||||
|
#define CS_ITEMS_Q2DEMO (CS_LIGHTS_Q2DEMO + MAX_LIGHTSTYLES_Q2DEMO)
|
||||||
|
#define CS_PLAYERSKINS_Q2DEMO (CS_ITEMS_Q2DEMO + MAX_ITEMS_Q2DEMO)
|
||||||
|
#define CS_GENERAL_Q2DEMO (CS_PLAYERSKINS_Q2DEMO + MAX_CLIENTS_Q2DEMO)
|
||||||
|
#define MAX_CONFIGSTRINGS_Q2DEMO (CS_GENERAL_Q2DEMO + MAX_GENERAL_Q2DEMO)
|
||||||
|
|
||||||
/* Convert from current protocol to internal */
|
/* Convert from current protocol to internal */
|
||||||
int
|
int
|
||||||
P_ConvertConfigStringFrom(int i, int protocol)
|
P_ConvertConfigStringFrom(int i, int protocol)
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define GAME_API_R97_VERSION 3
|
||||||
#define GAME_API_VERSION 4
|
#define GAME_API_VERSION 4
|
||||||
|
|
||||||
/* edict->svflags */
|
/* edict->svflags */
|
||||||
|
|
|
@ -458,7 +458,8 @@ SV_InitGameProgs(void)
|
||||||
Com_Error(ERR_DROP, "failed to load game DLL");
|
Com_Error(ERR_DROP, "failed to load game DLL");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ge->apiversion != GAME_API_VERSION)
|
if (ge->apiversion != GAME_API_VERSION &&
|
||||||
|
ge->apiversion != GAME_API_R97_VERSION)
|
||||||
{
|
{
|
||||||
Com_Error(ERR_DROP, "game is version %i, not %i", ge->apiversion,
|
Com_Error(ERR_DROP, "game is version %i, not %i", ge->apiversion,
|
||||||
GAME_API_VERSION);
|
GAME_API_VERSION);
|
||||||
|
|
|
@ -75,9 +75,18 @@ SV_New_f(void)
|
||||||
gamedir = (char *)Cvar_VariableString("gamedir");
|
gamedir = (char *)Cvar_VariableString("gamedir");
|
||||||
|
|
||||||
/* send the serverdata */
|
/* send the serverdata */
|
||||||
sv_client->protocol = PROTOCOL_VERSION;
|
if (ge->apiversion == GAME_API_R97_VERSION)
|
||||||
|
{
|
||||||
|
/* backward compatibility */
|
||||||
|
sv_client->protocol = PROTOCOL_RR97_VERSION;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sv_client->protocol = PROTOCOL_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
MSG_WriteByte(&sv_client->netchan.message, svc_serverdata);
|
MSG_WriteByte(&sv_client->netchan.message, svc_serverdata);
|
||||||
MSG_WriteLong(&sv_client->netchan.message, PROTOCOL_VERSION);
|
MSG_WriteLong(&sv_client->netchan.message, sv_client->protocol);
|
||||||
MSG_WriteLong(&sv_client->netchan.message, svs.spawncount);
|
MSG_WriteLong(&sv_client->netchan.message, svs.spawncount);
|
||||||
MSG_WriteByte(&sv_client->netchan.message, sv.attractloop);
|
MSG_WriteByte(&sv_client->netchan.message, sv.attractloop);
|
||||||
MSG_WriteString(&sv_client->netchan.message, gamedir);
|
MSG_WriteString(&sv_client->netchan.message, gamedir);
|
||||||
|
|
Loading…
Reference in a new issue