mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 01:41:10 +00:00
Make coop play possible in qw. Create a progs variable called 'current_skill'
and you'll get the nq edict pruning behavior.
This commit is contained in:
parent
eae97539c2
commit
dcaa0b205f
2 changed files with 27 additions and 2 deletions
|
@ -62,6 +62,7 @@ typedef struct {
|
|||
float *trace_inopen;
|
||||
float *trace_inwater;
|
||||
int *msg_entity;
|
||||
float *current_skill;
|
||||
} sv_globals_t;
|
||||
|
||||
extern sv_globals_t sv_globals;
|
||||
|
|
|
@ -65,8 +65,25 @@ static int reserved_edicts = MAX_CLIENTS;
|
|||
static int
|
||||
prune_edict (progs_t *pr, edict_t *ent)
|
||||
{
|
||||
if (((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_DEATHMATCH))
|
||||
return 1;
|
||||
if (!sv_globals.current_skill) {
|
||||
if (((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_DEATHMATCH))
|
||||
return 1;
|
||||
} else {
|
||||
// remove things from different skill levels or deathmatch
|
||||
if (deathmatch->int_val) {
|
||||
if (((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_DEATHMATCH)) {
|
||||
return 1;
|
||||
}
|
||||
} else if (
|
||||
(*sv_globals.current_skill == 0
|
||||
&& ((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_EASY))
|
||||
|| (*sv_globals.current_skill == 1
|
||||
&& ((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_MEDIUM))
|
||||
|| (*sv_globals.current_skill >= 2
|
||||
&& ((int) SVFIELD (ent, spawnflags, float) & SPAWNFLAG_NOT_HARD))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -125,6 +142,7 @@ void
|
|||
SV_LoadProgs (void)
|
||||
{
|
||||
dfunction_t *f;
|
||||
ddef_t *def;
|
||||
|
||||
PR_LoadProgs (&sv_pr_state, sv_progs->string);
|
||||
if (!sv_pr_state.progs)
|
||||
|
@ -257,6 +275,12 @@ SV_LoadProgs (void)
|
|||
sv_fields.glow_size = ED_GetFieldIndex (&sv_pr_state, "glow_size");
|
||||
sv_fields.glow_color = ED_GetFieldIndex (&sv_pr_state, "glow_color");
|
||||
sv_fields.colormod = ED_GetFieldIndex (&sv_pr_state, "colormod");
|
||||
|
||||
def = PR_FindGlobal (&sv_pr_state, "current_skill");
|
||||
if (def)
|
||||
sv_globals.current_skill = (float *) &sv_pr_state.pr_globals[def->ofs];
|
||||
else
|
||||
sv_globals.current_skill = 0;
|
||||
}
|
||||
|
||||
extern builtin_t sv_builtins[];
|
||||
|
|
Loading…
Reference in a new issue