From 92982042084e1931b77b232ef41c536af8d1bc66 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 24 Oct 2002 02:45:16 +0000 Subject: [PATCH] support tonik's single player/coop qw port --- qw/include/sv_progs.h | 2 +- qw/source/sv_main.c | 3 +++ qw/source/sv_progs.c | 25 +++++++++++++------------ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/qw/include/sv_progs.h b/qw/include/sv_progs.h index 1d15b8073..995b9f88b 100644 --- a/qw/include/sv_progs.h +++ b/qw/include/sv_progs.h @@ -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; diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index d30bb2b41..4365ae209 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -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, diff --git a/qw/source/sv_progs.c b/qw/source/sv_progs.c index e56e8c836..7823fbad1 100644 --- a/qw/source/sv_progs.c +++ b/qw/source/sv_progs.c @@ -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