From: Mario Date: Sat, 10 Aug 2019 12:44:45 +0000 (+1000) Subject: Reset swamp status on respawn X-Git-Tag: xonotic-v0.8.5~1421 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ec68068e1a6c0d6164796d7e344501c94762f170;p=xonotic%2Fxonotic-data.pk3dir.git Reset swamp status on respawn --- diff --git a/qcsrc/common/mapobjects/misc/corner.qc b/qcsrc/common/mapobjects/misc/corner.qc index a0f67b759..729f7e236 100644 --- a/qcsrc/common/mapobjects/misc/corner.qc +++ b/qcsrc/common/mapobjects/misc/corner.qc @@ -10,12 +10,26 @@ bool corner_send(entity this, entity to, int sf) WriteVector(MSG_ENTITY, this.origin); - WriteString(MSG_ENTITY, this.target); - WriteString(MSG_ENTITY, this.target2); - WriteString(MSG_ENTITY, this.target3); - WriteString(MSG_ENTITY, this.target4); - WriteString(MSG_ENTITY, this.targetname); - WriteByte(MSG_ENTITY, this.target_random); + sf = 0; + sf = BITSET(sf, BIT(0), this.target_random); + + sf = BITSET(sf, BIT(1), this.target && this.target != ""); + sf = BITSET(sf, BIT(2), this.target2 && this.target2 != ""); + sf = BITSET(sf, BIT(3), this.target3 && this.target3 != ""); + sf = BITSET(sf, BIT(4), this.target4 && this.target4 != ""); + sf = BITSET(sf, BIT(5), this.targetname && this.targetname != ""); + + WriteByte(MSG_ENTITY, sf); + if(sf & BIT(1)) + WriteString(MSG_ENTITY, this.target); + if(sf & BIT(2)) + WriteString(MSG_ENTITY, this.target2); + if(sf & BIT(3)) + WriteString(MSG_ENTITY, this.target3); + if(sf & BIT(4)) + WriteString(MSG_ENTITY, this.target4); + if(sf & BIT(5)) + WriteString(MSG_ENTITY, this.targetname); WriteByte(MSG_ENTITY, this.wait); @@ -54,12 +68,14 @@ NET_HANDLE(ENT_CLIENT_CORNER, bool isnew) this.origin = ReadVector(); setorigin(this, this.origin); - this.target = strzone(ReadString()); - this.target2 = strzone(ReadString()); - this.target3 = strzone(ReadString()); - this.target4 = strzone(ReadString()); - this.targetname = strzone(ReadString()); - this.target_random = ReadByte(); + int targbits = ReadByte(); + this.target_random = (targbits & BIT(0)); + + this.target = ((targbits & BIT(1)) ? strzone(ReadString()) : string_null); + this.target2 = ((targbits & BIT(2)) ? strzone(ReadString()) : string_null); + this.target3 = ((targbits & BIT(3)) ? strzone(ReadString()) : string_null); + this.target4 = ((targbits & BIT(4)) ? strzone(ReadString()) : string_null); + this.targetname = ((targbits & BIT(5)) ? strzone(ReadString()) : string_null); this.wait = ReadByte(); diff --git a/qcsrc/common/mapobjects/misc/dynlight.qc b/qcsrc/common/mapobjects/misc/dynlight.qc index 7c70b8444..6e9f02b87 100644 --- a/qcsrc/common/mapobjects/misc/dynlight.qc +++ b/qcsrc/common/mapobjects/misc/dynlight.qc @@ -46,7 +46,7 @@ void dynlight_think(entity this) void dynlight_find_aiment(entity this) { entity targ; - if (!this.target) + if (!this.target || this.target == "") objerror (this, "dynlight: no target to follow"); targ = find(NULL, targetname, this.target); @@ -62,7 +62,7 @@ void dynlight_find_aiment(entity this) void dynlight_find_path(entity this) { entity targ; - if (!this.target) + if (!this.target || this.target == "") objerror (this, "dynlight: no target to follow"); targ = find(NULL, targetname, this.target); @@ -74,7 +74,7 @@ void dynlight_find_path(entity this) void dynlight_find_target(entity this) { entity targ; - if (!this.target) + if (!this.target || this.target == "") objerror (this, "dynlight: no target to follow"); targ = find(NULL, targetname, this.target); diff --git a/qcsrc/common/mapobjects/trigger/magicear.qc b/qcsrc/common/mapobjects/trigger/magicear.qc index 16118cb9d..7321fe23f 100644 --- a/qcsrc/common/mapobjects/trigger/magicear.qc +++ b/qcsrc/common/mapobjects/trigger/magicear.qc @@ -1,7 +1,7 @@ #include "magicear.qh" #ifdef SVQC -float magicear_matched; -float W_Tuba_HasPlayed(entity pl, .entity weaponentity, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo); +#include +bool magicear_matched; string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin) { float domatch, dotrigger, matchstart, l; diff --git a/qcsrc/common/mapobjects/trigger/swamp.qc b/qcsrc/common/mapobjects/trigger/swamp.qc index 0717f4bea..f7d9df290 100644 --- a/qcsrc/common/mapobjects/trigger/swamp.qc +++ b/qcsrc/common/mapobjects/trigger/swamp.qc @@ -10,23 +10,12 @@ /* * t_swamp.c -* Adds spawnfunc_trigger_swamp and suppoart routines for xonotic 1.2.1+ +* Adds spawnfunc_trigger_swamp and support routines for nexuiz 1.2.1+ and xonotic * Author tZork (Jakob MG) * jakob@games43.se * 2005 11 29 */ -.float swamp_interval; //Hurt players in swamp with this interval -.float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?) -.float swamp_lifetime; // holds the points remaining until slug dies (not quite health!) -.entity swampslug; - -#ifdef SVQC -spawnfunc(trigger_swamp); -#endif -void swamp_touch(entity this, entity toucher); -void swampslug_think(entity this); - /* * Uses a entity calld swampslug to handle players in the swamp @@ -46,7 +35,11 @@ void swampslug_think(entity this) //Slug dead? then remove curses. if(GetResource(this, RES_HEALTH) <= 0) { - this.owner.in_swamp = 0; + if(this.owner.swampslug == this) + { + this.owner.in_swamp = false; + this.owner.swampslug = NULL; + } delete(this); //centerprint(this.owner,"Killing slug...\n"); return; @@ -72,11 +65,12 @@ void swamp_touch(entity this, entity toucher) EXACTTRIGGER_TOUCH(this, toucher); // Chech if player alredy got a swampslug. - if(toucher.in_swamp != 1) + if(!toucher.in_swamp) { // If not attach one. //centerprint(toucher,"Entering swamp!\n"); - toucher.swampslug = spawn(); + if(!toucher.swampslug) // just incase + toucher.swampslug = spawn(); toucher.swampslug.swamp_lifetime = 2; setthink(toucher.swampslug, swampslug_think); toucher.swampslug.nextthink = time; @@ -84,11 +78,11 @@ void swamp_touch(entity this, entity toucher) toucher.swampslug.dmg = this.dmg; toucher.swampslug.swamp_interval = this.swamp_interval; toucher.swamp_slowdown = this.swamp_slowdown; - toucher.in_swamp = 1; + toucher.in_swamp = true; return; } - //toucher.in_swamp = 1; + //toucher.in_swamp = true; //Revitalize players swampslug toucher.swampslug.swamp_lifetime = 2; @@ -116,8 +110,8 @@ void swamp_link(entity this) } /*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ? -Players gettin into the swamp will -get slowd down and damaged +Players in the swamp will be +slowed down and damaged over time */ spawnfunc(trigger_swamp) { diff --git a/qcsrc/common/mapobjects/trigger/swamp.qh b/qcsrc/common/mapobjects/trigger/swamp.qh index f4df98378..bfe860ed0 100644 --- a/qcsrc/common/mapobjects/trigger/swamp.qh +++ b/qcsrc/common/mapobjects/trigger/swamp.qh @@ -2,7 +2,16 @@ .float swamp_interval; //Hurt players in swamp with this interval .float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?) -.entity swampslug; -.float in_swamp; // bool +.bool in_swamp; .entity swampslug; // Uses this to release from swamp ("untouch" fix) + +.float swamp_interval; //Hurt players in swamp with this interval +.float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?) +.float swamp_lifetime; // holds the points remaining until slug dies (not quite health!) + +#ifdef SVQC +spawnfunc(trigger_swamp); +#endif +void swamp_touch(entity this, entity toucher); +void swampslug_think(entity this); diff --git a/qcsrc/common/weapons/weapon/tuba.qh b/qcsrc/common/weapons/weapon/tuba.qh index f0cb6d249..335326514 100644 --- a/qcsrc/common/weapons/weapon/tuba.qh +++ b/qcsrc/common/weapons/weapon/tuba.qh @@ -51,3 +51,7 @@ classfield(Tuba) .float tuba_volume; classfield(Tuba) .float tuba_volume_initial; classfield(Tuba) .int tuba_instrument; #endif + +#ifdef SVQC +bool W_Tuba_HasPlayed(entity pl, .entity weaponentity, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo); +#endif diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index f43785bbb..209958389 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -40,6 +40,7 @@ #include "../common/mapobjects/teleporters.qh" #include "../common/mapobjects/target/spawnpoint.qh" #include +#include #include "../common/vehicles/all.qh" @@ -678,6 +679,9 @@ void PutPlayerInServer(entity this) if(this.conveyor) IL_REMOVE(g_conveyed, this); this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player + if(this.swampslug) + delete(this.swampslug); + this.in_swamp = false; STAT(HUD, this) = HUD_NORMAL; this.event_damage = PlayerDamage;