support tonik's single player/coop qw port

This commit is contained in:
Bill Currie 2002-10-24 02:45:16 +00:00
parent 3f8920e5a3
commit 9298204208
3 changed files with 17 additions and 13 deletions

View file

@ -63,7 +63,7 @@ typedef struct {
float *trace_inopen;
float *trace_inwater;
int *msg_entity;
float *current_skill;
float *skill;
} sv_globals_t;
extern sv_globals_t sv_globals;

View file

@ -182,6 +182,7 @@ cvar_t *samelevel;
cvar_t *maxclients;
cvar_t *maxspectators;
cvar_t *deathmatch; // 0, 1, or 2
cvar_t *coop;
cvar_t *spawn;
cvar_t *watervis;
@ -2051,6 +2052,8 @@ SV_InitLocal (void)
"a weapon once. Picked up items will not respawn, "
"3 Leaves weapons on the map. You can only pick up "
"a weapon once. Picked up items will respawn.");
coop = Cvar_Get ("coop", "0", CVAR_NONE, NULL, "co-op mode for progs that "
"support it");
spawn = Cvar_Get ("spawn", "0", CVAR_SERVERINFO, Cvar_Info,
"Spawn the player entity");
watervis = Cvar_Get ("watervis", "0", CVAR_SERVERINFO, Cvar_Info,

View file

@ -89,7 +89,7 @@ free_edict (progs_t *pr, edict_t *ent)
static int
prune_edict (progs_t *pr, edict_t *ent)
{
if (!sv_globals.current_skill) {
if (!sv_globals.skill) {
if (((int) SVfloat (ent, spawnflags) & SPAWNFLAG_NOT_DEATHMATCH))
return 1;
} else {
@ -98,14 +98,15 @@ prune_edict (progs_t *pr, edict_t *ent)
if (((int) SVfloat (ent, spawnflags) & SPAWNFLAG_NOT_DEATHMATCH)) {
return 1;
}
} else if (
(*sv_globals.current_skill == 0
&& ((int) SVfloat (ent, spawnflags) & SPAWNFLAG_NOT_EASY))
|| (*sv_globals.current_skill == 1
&& ((int) SVfloat (ent, spawnflags) &
SPAWNFLAG_NOT_MEDIUM)) ||
(*sv_globals.current_skill >= 2
&& ((int) SVfloat (ent, spawnflags) & SPAWNFLAG_NOT_HARD))) {
} else if ((*sv_globals.skill == 0
&& ((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_EASY))
|| (*sv_globals.skill == 1
&& ((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_MEDIUM))
|| (*sv_globals.skill >= 2
&& ((int) SVfloat (ent, spawnflags)
& SPAWNFLAG_NOT_HARD))) {
return 1;
}
}
@ -334,11 +335,11 @@ SV_LoadProgs (void)
sv_fields.gravity = ED_GetFieldIndex (&sv_pr_state, "gravity");
sv_fields.maxspeed = ED_GetFieldIndex (&sv_pr_state, "maxspeed");
def = PR_FindGlobal (&sv_pr_state, "current_skill");
def = PR_FindGlobal (&sv_pr_state, "skill");
if (def)
sv_globals.current_skill = (float *) &sv_pr_state.pr_globals[def->ofs];
sv_globals.skill = (float *) &sv_pr_state.pr_globals[def->ofs];
else
sv_globals.current_skill = 0;
sv_globals.skill = 0;
}
void