mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-24 21:41:10 +00:00
Implemented coop_elevator_delay
cvar (for func_plat)
In coop it's often hard to get on the same elevator together, because they're immediately triggered once the first player steps on it. This cvar sets a delay (1 second by default) for the elevator to wait before moving, so other players have some time to get on it. If you like elevators/platforms that suck, just set it to `0` :-P Currently only used in func_plat, if it turns out that other entities are used for automatically triggered platforms, we'll have to adapt those as well (I guess wait_and_change() is generally useful for that). We're not bumping the savegame version because they should only break in an uncommon corner case: *Coop* savegames created with clients including this change will not work on older clients - SP savegames are not affected and old savegames on new clients also still work.
This commit is contained in:
parent
1a6dea5a0b
commit
fd0c058b2e
7 changed files with 52 additions and 10 deletions
|
@ -87,6 +87,19 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
|
|||
during gameplay and released otherwise (in menu, videos, console or if
|
||||
game is paused).
|
||||
|
||||
* **coop_pickup_weapons**: In coop a weapon can be picked up only once.
|
||||
For example, if the player already has the shotgun they cannot pickup
|
||||
a second shotgun found at a later time, thus not getting the ammo that
|
||||
comes with it. This breaks the balacing. If set to `1` a weapon can be
|
||||
picked up if a) the player doesn't have it or b) it wasn't already
|
||||
picked up by another player. Defaults to `1`.
|
||||
|
||||
* **coop_elevator_delay**: In coop it's often hard to get on the same
|
||||
elevator together, because they're immediately triggered once the
|
||||
first player steps on it. This cvar sets a delay for the elevator to
|
||||
wait before moving, so other players have some time to get on it.
|
||||
Defaults to `1.0` (seconds).
|
||||
|
||||
* **coop_baseq2 (Ground Zero only)**: In Ground Zero, entity spawnflags
|
||||
(which difficulty modes / game modes level entities spawn in) are
|
||||
interpreted a bit differently. In original Quake 2, if an entity is
|
||||
|
@ -113,14 +126,6 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
|
|||
spawned in maps (in fact, some official Ground Zero maps contain
|
||||
these entities). This cvar is set to 0 by default.
|
||||
|
||||
* **coop_pickup_weapons**: In coop a weapon can be picked up only once.
|
||||
For example, if the player already has the shotgun they cannot pickup
|
||||
a second shotgun found at a later time, thus not getting the ammo that
|
||||
comes with it. This breaks the balacing. If set to `1` a weapon can be
|
||||
picked up if a) the player doesn't have it or b) it wasn't already
|
||||
picked up by another player. Defaults to `0`.
|
||||
|
||||
|
||||
## Audio
|
||||
|
||||
* **al_device**: OpenAL device to use. In most cases there's no need to
|
||||
|
|
|
@ -607,6 +607,38 @@ Use_Plat(edict_t *ent, edict_t *other /* unused */, edict_t *activator /* unused
|
|||
plat_go_down(ent);
|
||||
}
|
||||
|
||||
void
|
||||
wait_and_change_think(edict_t* ent)
|
||||
{
|
||||
void (*afterwaitfunc)(edict_t *) = ent->moveinfo.endfunc;
|
||||
ent->moveinfo.endfunc = NULL;
|
||||
afterwaitfunc(ent);
|
||||
}
|
||||
|
||||
/*
|
||||
* In coop mode, this waits for coop_elevator_delay seconds
|
||||
* before calling afterwaitfunc(ent); otherwise it just calls
|
||||
* afterwaitfunc(ent);
|
||||
*/
|
||||
static void
|
||||
wait_and_change(edict_t* ent, void (*afterwaitfunc)(edict_t *))
|
||||
{
|
||||
float waittime = coop_elevator_delay->value;
|
||||
if (coop->value && waittime > 0.0f)
|
||||
{
|
||||
if(ent->nextthink == 0)
|
||||
{
|
||||
ent->moveinfo.endfunc = afterwaitfunc;
|
||||
ent->think = wait_and_change_think;
|
||||
ent->nextthink = level.time + waittime;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
afterwaitfunc(ent);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Touch_Plat_Center(edict_t *ent, edict_t *other, cplane_t *plane /* unused */,
|
||||
csurface_t *surf /* unused */)
|
||||
|
@ -630,7 +662,7 @@ Touch_Plat_Center(edict_t *ent, edict_t *other, cplane_t *plane /* unused */,
|
|||
|
||||
if (ent->moveinfo.state == STATE_BOTTOM)
|
||||
{
|
||||
plat_go_up(ent);
|
||||
wait_and_change(ent, plat_go_up);
|
||||
}
|
||||
else if (ent->moveinfo.state == STATE_TOP)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ edict_t *g_edicts;
|
|||
cvar_t *deathmatch;
|
||||
cvar_t *coop;
|
||||
cvar_t *coop_pickup_weapons;
|
||||
cvar_t *coop_elevator_delay;
|
||||
cvar_t *dmflags;
|
||||
cvar_t *skill;
|
||||
cvar_t *fraglimit;
|
||||
|
|
|
@ -509,6 +509,7 @@ extern cvar_t *maxentities;
|
|||
extern cvar_t *deathmatch;
|
||||
extern cvar_t *coop;
|
||||
extern cvar_t *coop_pickup_weapons;
|
||||
extern cvar_t *coop_elevator_delay;
|
||||
extern cvar_t *dmflags;
|
||||
extern cvar_t *skill;
|
||||
extern cvar_t *fraglimit;
|
||||
|
|
|
@ -232,7 +232,8 @@ InitGame(void)
|
|||
maxspectators = gi.cvar("maxspectators", "4", CVAR_SERVERINFO);
|
||||
deathmatch = gi.cvar("deathmatch", "0", CVAR_LATCH);
|
||||
coop = gi.cvar("coop", "0", CVAR_LATCH);
|
||||
coop_pickup_weapons = gi.cvar("coop_pickup_weapons", "0", 0);
|
||||
coop_pickup_weapons = gi.cvar("coop_pickup_weapons", "1", CVAR_ARCHIVE);
|
||||
coop_elevator_delay = gi.cvar("coop_elevator_delay", "1.0", CVAR_ARCHIVE);
|
||||
skill = gi.cvar("skill", "1", CVAR_LATCH);
|
||||
maxentities = gi.cvar("maxentities", "1024", CVAR_LATCH);
|
||||
|
||||
|
|
|
@ -1048,3 +1048,4 @@ extern void ai_walk ( edict_t * self , float dist ) ;
|
|||
extern void ai_stand ( edict_t * self , float dist ) ;
|
||||
extern void ai_move ( edict_t * self , float dist ) ;
|
||||
extern void AI_SetSightClient ( void ) ;
|
||||
extern void wait_and_change_think(edict_t* ent);
|
||||
|
|
|
@ -1048,4 +1048,5 @@
|
|||
{"ai_stand", (byte *)ai_stand},
|
||||
{"ai_move", (byte *)ai_move},
|
||||
{"AI_SetSightClient", (byte *)AI_SetSightClient},
|
||||
{"wait_and_change_think", (byte *)wait_and_change_think},
|
||||
{0, 0}
|
||||
|
|
Loading…
Reference in a new issue