Match sv_main.c with dquakeplus

This commit is contained in:
cypress 2024-09-04 18:19:20 -07:00
parent 16a3942676
commit 5686e4f13e
6 changed files with 127 additions and 142 deletions

View file

@ -467,24 +467,10 @@ if (bits&(1<<i))
Sys_Error ("i >= cl.maxclients"); Sys_Error ("i >= cl.maxclients");
} }
#ifdef GLQUAKE
if (bits & U_SKIN)
skin = MSG_ReadByte();
else
skin = ent->baseline.skin;
if (skin != ent->skinnum) {
ent->skinnum = skin;
if (num > 0 && num <= cl.maxclients)
R_TranslatePlayerSkin (num - 1);
}
#else
if (bits & U_SKIN) if (bits & U_SKIN)
ent->skinnum = MSG_ReadByte(); ent->skinnum = MSG_ReadByte();
else else
ent->skinnum = ent->baseline.skin; ent->skinnum = ent->baseline.skin;
#endif
if (bits & U_EFFECTS) if (bits & U_EFFECTS)
ent->effects = MSG_ReadShort(); ent->effects = MSG_ReadShort();

View file

@ -1282,6 +1282,8 @@ void Host_Spawn_f (void)
return; return;
} }
host_client->nomap = false;
// run the entrance script // run the entrance script
if (sv.loadgame) if (sv.loadgame)
{ // loaded games are fully inited allready { // loaded games are fully inited allready

View file

@ -79,7 +79,6 @@ typedef struct
string_t model; string_t model;
float frame; float frame;
float skin; float skin;
float iframetime;
float effects; float effects;
vec3_t mins; vec3_t mins;
vec3_t maxs; vec3_t maxs;

View file

@ -71,7 +71,6 @@ typedef struct entity_s
byte *colormap; byte *colormap;
int effects; // light, particals, etc int effects; // light, particals, etc
int skinnum; // for Alias models int skinnum; // for Alias models
int iframetime; // dummy for dquake parity
int visframe; // last frame this entity was int visframe; // last frame this entity was
// found in an active leaf // found in an active leaf

View file

@ -109,7 +109,8 @@ typedef struct client_s
int old_points; int old_points;
int old_kills; int old_kills;
// joe, from ProQuake: allow clients to connect if they don't have the map
qboolean nomap;
} client_t; } client_t;

View file

@ -27,6 +27,7 @@ server_static_t svs;
char localmodels[MAX_MODELS][5]; // inline model names for precache char localmodels[MAX_MODELS][5]; // inline model names for precache
//============================================================================ //============================================================================
cvar_t r_hlbsponly = {"r_hlbsponly","0",true};
/* /*
=============== ===============
@ -251,7 +252,8 @@ void SV_ConnectClient (int clientnum)
client = svs.clients + clientnum; client = svs.clients + clientnum;
Con_DPrintf ("Client %s connected\n", client->netconnection->address); //Con_DPrintf ("Client %s connected\n", client->netconnection->address);
Con_Printf ("Client %s connected\n", client->netconnection->address);
edictnum = clientnum+1; edictnum = clientnum+1;
@ -260,8 +262,14 @@ void SV_ConnectClient (int clientnum)
// set up the client_t // set up the client_t
netconnection = client->netconnection; netconnection = client->netconnection;
if (sv.loadgame) if (sv.loadgame) {
#ifdef PSP_VFPU
memcpy_vfpu(spawn_parms, client->spawn_parms, sizeof(spawn_parms));
#else
memcpy(spawn_parms, client->spawn_parms, sizeof(spawn_parms)); memcpy(spawn_parms, client->spawn_parms, sizeof(spawn_parms));
#endif // PSP_VFPU
}
memset (client, 0, sizeof(*client)); memset (client, 0, sizeof(*client));
client->netconnection = netconnection; client->netconnection = netconnection;
@ -273,14 +281,15 @@ void SV_ConnectClient (int clientnum)
client->message.maxsize = sizeof(client->msgbuf); client->message.maxsize = sizeof(client->msgbuf);
client->message.allowoverflow = true; // we can catch it client->message.allowoverflow = true; // we can catch it
#ifdef IDGODS
client->privileged = IsID(&client->netconnection->addr);
#else
client->privileged = false; client->privileged = false;
#endif
if (sv.loadgame) if (sv.loadgame) {
#ifdef PSP_VFPU
memcpy_vfpu(client->spawn_parms, spawn_parms, sizeof(spawn_parms));
#else
memcpy(client->spawn_parms, spawn_parms, sizeof(spawn_parms)); memcpy(client->spawn_parms, spawn_parms, sizeof(spawn_parms));
#endif // PSP_VFPU
}
else else
{ {
// call the progs to get default spawn parms for the new client // call the progs to get default spawn parms for the new client
@ -424,7 +433,7 @@ SV_WriteEntitiesToClient
============= =============
*/ */
void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg, qboolean nomap)
{ {
int e, i; int e, i;
int bits; int bits;
@ -450,11 +459,9 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
ent = NEXT_EDICT(sv.edicts); ent = NEXT_EDICT(sv.edicts);
for (e=1 ; e<sv.num_edicts ; e++, ent = NEXT_EDICT(ent)) for (e=1 ; e<sv.num_edicts ; e++, ent = NEXT_EDICT(ent))
{ {
#ifdef QUAKE2
// don't send if flagged for NODRAW and there are no lighting effects // don't send if flagged for NODRAW and there are no lighting effects
if (ent->v.effects == EF_NODRAW) if (ent->v.effects == EF_NODRAW)
continue; continue;
#endif
// ignore if not touching a PV leaf // ignore if not touching a PV leaf
if (ent != clent) // clent is ALLWAYS sent if (ent != clent) // clent is ALLWAYS sent
@ -464,19 +471,21 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
continue; continue;
for (i=0 ; i < ent->num_leafs ; i++) for (i=0 ; i < ent->num_leafs ; i++)
{
if (pvs[ent->leafnums[i] >> 3] & (1 << (ent->leafnums[i]&7) )) if (pvs[ent->leafnums[i] >> 3] & (1 << (ent->leafnums[i]&7) ))
break; break;
}
if (i == ent->num_leafs) if (i == ent->num_leafs)
continue; // not visible continue; // not visible
// joe, from ProQuake: don't send updates if the client doesn't have the map
if (nomap)
continue;
} }
if (msg->maxsize - msg->cursize < 16) if (msg->maxsize - msg->cursize < 16)
{ {
Con_Printf ("packet overflow\n"); Con_Printf ("SV_WriteEntitiesToClient: packet overflow->big_value\n");
return; return;
} }
// send an update // send an update
bits = 0; bits = 0;
@ -496,8 +505,8 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
if ( ent->v.angles[2] != ent->baseline.angles[2] ) if ( ent->v.angles[2] != ent->baseline.angles[2] )
bits |= U_ANGLE3; bits |= U_ANGLE3;
if (ent->v.movetype == MOVETYPE_STEP) //if (ent->v.movetype == MOVETYPE_STEP) JUkki removed to test interploation
bits |= U_NOLERP; // don't mess up the step animation // bits |= U_NOLERP; // don't mess up the step animation
if (ent->baseline.colormap != ent->v.colormap) if (ent->baseline.colormap != ent->v.colormap)
bits |= U_COLORMAP; bits |= U_COLORMAP;
@ -657,12 +666,6 @@ void SV_CleanupEnts (void)
================== ==================
SV_WriteClientdataToMessage SV_WriteClientdataToMessage
==================
*/
/*
==================
SV_WriteClientdataToMessage
================== ==================
*/ */
void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
@ -801,9 +804,9 @@ qboolean SV_SendClientDatagram (client_t *client)
MSG_WriteFloat (&msg, sv.time); MSG_WriteFloat (&msg, sv.time);
// add the client specific data to the datagram // add the client specific data to the datagram
SV_WriteClientdataToMessage (client->edict, &msg); SV_WriteClientdataToMessage (client->edict, &msg);//This should be good now
SV_WriteEntitiesToClient (client->edict, &msg); SV_WriteEntitiesToClient (client->edict, &msg, client->nomap);
// copy the server datagram if there is space // copy the server datagram if there is space
if (msg.cursize + sv.datagram.cursize < msg.maxsize) if (msg.cursize + sv.datagram.cursize < msg.maxsize)
@ -908,7 +911,7 @@ void SV_SendClientMessages (void)
{ {
int i; int i;
// update frags, names, etc // update points, names, etc
SV_UpdateToReliableMessages (); SV_UpdateToReliableMessages ();
// build individual updates // build individual updates
@ -996,12 +999,21 @@ int SV_ModelIndex (char *name)
if (!name || !name[0]) if (!name || !name[0])
return 0; return 0;
for (i=0 ; i<MAX_MODELS && sv.model_precache[i] ; i++) for (i=0 ; i<MAX_MODELS ; i++)
{
if (!sv.model_precache[i])
{
Con_Printf ("Model (%s) was not precached, precaching\n", name);
sv.model_precache[i] = name;
sv.models[i] = Mod_ForName (name, true);
return i;
}
if (!strcmp(sv.model_precache[i], name)) if (!strcmp(sv.model_precache[i], name))
return i; return i;
if (i==MAX_MODELS || !sv.model_precache[i]) }
Sys_Error ("SV_ModelIndex: model %s not precached", name); Sys_Error ("SV_ModelIndex: model %s not precached", name);
return i; return -1;
} }
/* /*
@ -1075,7 +1087,7 @@ void SV_SendReconnect (void)
char data[128]; char data[128];
sizebuf_t msg; sizebuf_t msg;
msg.data = data; msg.data = (byte*)data;
msg.cursize = 0; msg.cursize = 0;
msg.maxsize = sizeof(data); msg.maxsize = sizeof(data);
@ -1084,11 +1096,7 @@ void SV_SendReconnect (void)
NET_SendToAll (&msg, 5); NET_SendToAll (&msg, 5);
if (cls.state != ca_dedicated) if (cls.state != ca_dedicated)
#ifdef QUAKE2
Cbuf_InsertText ("reconnect\n");
#else
Cmd_ExecuteString ("reconnect\n", src_command); Cmd_ExecuteString ("reconnect\n", src_command);
#endif
} }
@ -1130,11 +1138,7 @@ This is called at the start of each level
extern float scr_centertime_off; extern float scr_centertime_off;
void Load_Waypoint (); void Load_Waypoint ();
#ifdef QUAKE2
void SV_SpawnServer (char *server, char *startspot)
#else
void SV_SpawnServer (char *server) void SV_SpawnServer (char *server)
#endif
{ {
edict_t *ent; edict_t *ent;
int i; int i;
@ -1176,10 +1180,6 @@ void SV_SpawnServer (char *server)
memset (&sv, 0, sizeof(sv)); memset (&sv, 0, sizeof(sv));
strcpy (sv.name, server); strcpy (sv.name, server);
#ifdef QUAKE2
if (startspot)
strcpy(sv.startspot, startspot);
#endif
// load progs to get entity field count // load progs to get entity field count
PR_LoadProgs (); PR_LoadProgs ();
@ -1225,6 +1225,7 @@ void SV_SpawnServer (char *server)
} }
sv.models[1] = sv.worldmodel; sv.models[1] = sv.worldmodel;
// //
// clear world interaction links // clear world interaction links
// //
@ -1257,9 +1258,6 @@ void SV_SpawnServer (char *server)
pr_global_struct->deathmatch = deathmatch.value; pr_global_struct->deathmatch = deathmatch.value;
pr_global_struct->mapname = sv.name - pr_strings; pr_global_struct->mapname = sv.name - pr_strings;
#ifdef QUAKE2
pr_global_struct->startspot = sv.startspot - pr_strings;
#endif
// serverflags are for cross level information (sigils) // serverflags are for cross level information (sigils)
pr_global_struct->serverflags = svs.serverflags; pr_global_struct->serverflags = svs.serverflags;
@ -1288,6 +1286,8 @@ void SV_SpawnServer (char *server)
Con_DPrintf ("Server spawned.\n"); Con_DPrintf ("Server spawned.\n");
} }
//ZOMBIE AI THINGS BELOVE THIS!!! //ZOMBIE AI THINGS BELOVE THIS!!!
#define W_MAX_TEMPSTRING 2048 #define W_MAX_TEMPSTRING 2048
char *w_string_temp; char *w_string_temp;
@ -1295,8 +1295,6 @@ int W_fopen (void)
{ {
int h = 0; int h = 0;
Con_DPrintf("Loading waypoint file %s\n", va("%s/maps/%s.way",com_gamedir, sv.name));
Sys_FileOpenRead (va("%s/maps/%s.way",com_gamedir, sv.name), &h); Sys_FileOpenRead (va("%s/maps/%s.way",com_gamedir, sv.name), &h);
return h; return h;
} }
@ -1393,6 +1391,7 @@ void W_stov (char *v, vec3_t out)
VectorCopy (d, out); VectorCopy (d, out);
} }
waypoint_ai waypoints[MAX_WAYPOINTS]; waypoint_ai waypoints[MAX_WAYPOINTS];
int n_waypoints; int n_waypoints;
@ -1693,4 +1692,3 @@ void Load_Waypoint () {
int argsort_comparator(const void *lhs, const void *rhs) { int argsort_comparator(const void *lhs, const void *rhs) {
return ((argsort_entry_t*)lhs)->value - ((argsort_entry_t*)rhs)->value; return ((argsort_entry_t*)lhs)->value - ((argsort_entry_t*)rhs)->value;
} }