From: Mario Date: Fri, 18 Dec 2015 00:55:41 +0000 (+1000) Subject: Make projectiles and items interact with jumppads in CSQC X-Git-Tag: xonotic-v0.8.2~1476 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=661c5365ee3261447a593813946fb8975a7097b0;p=xonotic%2Fxonotic-data.pk3dir.git Make projectiles and items interact with jumppads in CSQC --- diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 1b79f7d58..04d728480 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -202,6 +202,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) int f = ReadByte(); self.count = (f & 0x80); + self.flags |= FL_PROJECTILE; self.iflags = (self.iflags & IFLAG_INTERNALMASK) | IFLAG_AUTOANGLES | IFLAG_ANGLES | IFLAG_ORIGIN; self.solid = SOLID_TRIGGER; // self.effects = EF_NOMODELFLAGS; diff --git a/qcsrc/client/weapons/projectile.qh b/qcsrc/client/weapons/projectile.qh index 699f48938..a925f34c6 100644 --- a/qcsrc/client/weapons/projectile.qh +++ b/qcsrc/client/weapons/projectile.qh @@ -29,4 +29,6 @@ void loopsound(entity e, int ch, string samp, float vol, float attn); void Ent_RemoveProjectile(); +const int FL_PROJECTILE = BIT(15); + #endif diff --git a/qcsrc/common/movetypes/movetypes.qc b/qcsrc/common/movetypes/movetypes.qc index e03e9fae4..ab7d51fe6 100644 --- a/qcsrc/common/movetypes/movetypes.qc +++ b/qcsrc/common/movetypes/movetypes.qc @@ -587,6 +587,7 @@ void _Movetype_Physics_Frame(entity this, float movedt) case MOVETYPE_FLY: case MOVETYPE_FLY_WORLDONLY: _Movetype_Physics_Toss(this, movedt); + _Movetype_LinkEdict(this, true); break; case MOVETYPE_PHYSICS: break; diff --git a/qcsrc/common/physics.qh b/qcsrc/common/physics.qh index 1062b6830..92891ead2 100644 --- a/qcsrc/common/physics.qh +++ b/qcsrc/common/physics.qh @@ -114,7 +114,7 @@ bool IsFlying(entity a); #define IS_CLIENT(s) (s).isplayermodel #define IS_PLAYER(s) (s).isplayermodel #define IS_NOT_A_CLIENT(s) !(s).isplayermodel - #define isPushable(s) (s).isplayermodel + #define isPushable(s) ((s).isplayermodel || (s).pushable || ((s).flags & FL_PROJECTILE)) //float player_multijump; //float player_jumpheight; diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index 89653e8b8..0ddc83310 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -120,8 +120,12 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle player.iflags |= IFLAG_TELEPORTED | IFLAG_V_ANGLE | IFLAG_ANGLES; player.csqcmodel_teleported = 1; player.v_angle = to_angles; - setproperty(VF_ANGLES, player.move_angles); - setproperty(VF_CL_VIEWANGLES, player.move_angles); + + if(player.isplayermodel) // not for anything but the main player + { + setproperty(VF_ANGLES, player.move_angles); + setproperty(VF_CL_VIEWANGLES, player.move_angles); + } makevectors(player.move_angles); #endif diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 8aa80a031..1f2f84a7d 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -134,10 +134,8 @@ void trigger_push_touch() if (this.active == ACTIVE_NOT) return; -#ifdef SVQC if (!isPushable(other)) return; -#endif if(this.team) if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, other))) @@ -174,6 +172,22 @@ void trigger_push_touch() UNSET_ONGROUND(other); #elif defined(CSQC) other.move_flags &= ~FL_ONGROUND; + + if (other.flags & FL_PROJECTILE) + { + other.move_angles = vectoangles (other.move_velocity); + switch(other.move_movetype) + { + case MOVETYPE_FLY: + other.move_movetype = MOVETYPE_TOSS; + other.gravity = 1; + break; + case MOVETYPE_BOUNCEMISSILE: + other.move_movetype = MOVETYPE_BOUNCE; + other.gravity = 1; + break; + } + } #endif #ifdef SVQC @@ -243,11 +257,11 @@ void trigger_push_touch() UpdateCSQCProjectile(other); } - if (other.flags & FL_ITEM) + /*if (other.flags & FL_ITEM) { ItemUpdate(other); other.SendFlags |= ISF_DROP; - } + }*/ if (this.spawnflags & PUSH_ONCE) { diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc index 48b0341d3..5735f0bb5 100644 --- a/qcsrc/common/triggers/trigger/teleport.qc +++ b/qcsrc/common/triggers/trigger/teleport.qc @@ -26,6 +26,9 @@ void Teleport_Touch () if(IS_TURRET(other)) return; +#elif defined(CSQC) + if(!IS_PLAYER(other)) + return; #endif if(PHYS_DEAD(other)) diff --git a/qcsrc/common/triggers/triggers.qh b/qcsrc/common/triggers/triggers.qh index 31b8be441..5c000cff1 100644 --- a/qcsrc/common/triggers/triggers.qh +++ b/qcsrc/common/triggers/triggers.qh @@ -10,6 +10,8 @@ const float SPAWNFLAG_NOTOUCH = 1; .void() trigger_touch; +.bool pushable; + .float antiwall_flag; // Variable to define what to do with func_clientwall // 0 == do nothing, 1 == deactivate, 2 == activate diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 1674f6d1d..28fd9b0c6 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -129,7 +129,6 @@ const float MAX_DAMAGEEXTRARADIUS = 16; .float iscreature; .float damagedbycontents; .float damagedbytriggers; -.float pushable; .float teleportable; .vector oldvelocity; diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 432bfc366..29c8669bb 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -29,50 +29,50 @@ REGISTER_NET_LINKED(ENT_CLIENT_ITEM) #ifdef CSQC -void ItemDraw(entity self) +void ItemDraw(entity this) { - if(self.gravity) + if(this.gravity) { - Movetype_Physics_MatchServer(self, autocvar_cl_projectiles_sloppy); - if(self.move_flags & FL_ONGROUND) + Movetype_Physics_MatchServer(this, false); + if(this.move_flags & FL_ONGROUND) { // For some reason move_avelocity gets set to '0 0 0' here ... - self.oldorigin = self.origin; - self.gravity = 0; + this.oldorigin = this.origin; + this.gravity = 0; if(autocvar_cl_animate_items) { // ... so reset it if animations are requested. - if(self.ItemStatus & ITS_ANIMATE1) - self.move_avelocity = '0 180 0'; + if(this.ItemStatus & ITS_ANIMATE1) + this.move_avelocity = '0 180 0'; - if(self.ItemStatus & ITS_ANIMATE2) - self.move_avelocity = '0 -90 0'; + if(this.ItemStatus & ITS_ANIMATE2) + this.move_avelocity = '0 -90 0'; } } } else if (autocvar_cl_animate_items) { - if(self.ItemStatus & ITS_ANIMATE1) + if(this.ItemStatus & ITS_ANIMATE1) { - self.angles += self.move_avelocity * frametime; - setorigin(self, '0 0 10' + self.oldorigin + '0 0 8' * sin(time * 2)); + this.angles += this.move_avelocity * frametime; + setorigin(this, '0 0 10' + this.oldorigin + '0 0 8' * sin(time * 2)); } - if(self.ItemStatus & ITS_ANIMATE2) + if(this.ItemStatus & ITS_ANIMATE2) { - self.angles += self.move_avelocity * frametime; - setorigin(self, '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3)); + this.angles += this.move_avelocity * frametime; + setorigin(this, '0 0 8' + this.oldorigin + '0 0 4' * sin(time * 3)); } } } void ItemDrawSimple(entity this) { - if(self.gravity) + if(this.gravity) { - Movetype_Physics_MatchServer(self, autocvar_cl_projectiles_sloppy); + Movetype_Physics_MatchServer(this, false); - if(self.move_flags & FL_ONGROUND) - self.gravity = 0; + if(this.move_flags & FL_ONGROUND) + this.gravity = 0; } } @@ -172,8 +172,9 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) if(sf & ISF_MODEL) { self.drawmask = MASK_NORMAL; - self.move_movetype = self.movetype = MOVETYPE_TOSS; + self.move_movetype = MOVETYPE_TOSS; self.draw = ItemDraw; + self.solid = SOLID_TRIGGER; //self.move_flags |= FL_ITEM; bool use_bigsize = ReadByte(); @@ -214,7 +215,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) if(self.mdl == "") - LOG_TRACE("^1WARNING!^7 self.mdl is unset for item ", self.classname, " tell tZork aboute this!\n"); + LOG_TRACE("^1WARNING!^7 self.mdl is unset for item ", self.classname, ", tell tZork about this!\n"); precache_model(self.mdl); _setmodel(self, self.mdl); @@ -228,6 +229,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) if(sf & ISF_DROP) { self.gravity = 1; + self.pushable = true; //self.move_angles = '0 0 0'; self.move_movetype = MOVETYPE_TOSS; self.move_velocity_x = ReadCoord();