djcev.com

//

Git Repos / fte_dogmode / commit bbed149

Commit: bbed149398d54162c1a2399766856efb96a3c535
Parent: 675fa9ab1cf7bc70bcb59470fae33221ebf5df5d
Author: Cameron Vanderzanden, 2024-03-24 17:34
Committer: Cameron Vanderzanden, 2024-03-24 17:34

Commit Message

Fix projectile and func_ blocked interaction

Fixed a bug where projectiles with custom physics (grenades,
rockets) would cause func_ entities with a 'blocked' function
to stop when travelling. I *think* this will work but I haven't
tested the change thoroughly.

Change List

Diff qc/base_monster.qc

diff --git a/qc/base_monster.qc b/qc/base_monster.qc
index 2849d15..cae1589 100644
--- a/qc/base_monster.qc
+++ b/qc/base_monster.qc
@@ -25,6 +25,11 @@ const float AS_MELEE = 3;
const float AS_MISSILE = 4;
const float AS_TURRET = 5;

+const float RANGE_MELEE = 0; // range values; see ai_range ()
+const float RANGE_NEAR = 1;
+const float RANGE_MID = 2;
+const float RANGE_FAR = 3;
+
const float I_AM_TURRET = 262144; // dumptruck_ds

//======================================================================

Return to the top of this page or return to the overview of this repo.

Diff qc/base_proj.qc

diff --git a/qc/base_proj.qc b/qc/base_proj.qc
index 8813c6f..e7e80f0 100644
--- a/qc/base_proj.qc
+++ b/qc/base_proj.qc
@@ -483,6 +483,13 @@ strip void() base_projectile_qcphys;
if (self.flags & FL_ONGROUND)
return;

+ // restore mins/maxs
+ if (self.mins == '0 0 0' || self.maxs == '0 0 0')
+ {
+ self.mins = self.pos1;
+ self.maxs = self.pos2;
+ }
+
// move angles
if (self.avelocity)
self.angles += self.avelocity * frametime;

Return to the top of this page or return to the overview of this repo.

Diff qc/defs_const.qc

diff --git a/qc/defs_const.qc b/qc/defs_const.qc
index 7ec3fc0..75f626e 100644
--- a/qc/defs_const.qc
+++ b/qc/defs_const.qc
@@ -259,10 +259,3 @@ enumflags {
RF_NOSHADOW
};
#endif
-
-// TODO CEV move the definitions below
-
-const float RANGE_MELEE = 0; // range values; see ai_range ()
-const float RANGE_NEAR = 1;
-const float RANGE_MID = 2;
-const float RANGE_FAR = 3;

Return to the top of this page or return to the overview of this repo.

Diff qc/func/button.qc

diff --git a/qc/func/button.qc b/qc/func/button.qc
index 5ad1a03..4ae2346 100644
--- a/qc/func/button.qc
+++ b/qc/func/button.qc
@@ -82,7 +82,7 @@ When a button is touched, it moves some distance in the direction of it's angle,
//--------------------------------------------------------------
void() func_button_blocked =
{
- // do nothing, just don't ome all the way back out
+ // do nothing, just don't come all the way back out
};

//--------------------------------------------------------------

Return to the top of this page or return to the overview of this repo.

Diff qc/func/door.qc

diff --git a/qc/func/door.qc b/qc/func/door.qc
index e72cc57..4e4f643 100644
--- a/qc/func/door.qc
+++ b/qc/func/door.qc
@@ -179,11 +179,20 @@ Key doors are always wait -1.
//--------------------------------------------------------------
void() func_door_blocked =
{
- // TODO CEV
- dprint ("entering func_door_blocked...\n");
// don't block on projectiles -- CEV
if (other.classgroup & CG_PROJECTILE)
+ {
+ if (other.mins != '0 0 0' || other.maxs != '0 0 0')
+ setsize (other, '0 0 0', '0 0 0');
+
+ // continue on the current path -- CEV
+ if (self.state == FUNC_STATE_DOWN)
+ func_door_think_go_down ();
+ else
+ func_door_think_go_up ();
+
return;
+ }

t_damage2 (other, self, self, self.dmg);

Return to the top of this page or return to the overview of this repo.

Diff qc/func/door_secret.qc

diff --git a/qc/func/door_secret.qc b/qc/func/door_secret.qc
index 11419fb..8cdc43a 100644
--- a/qc/func/door_secret.qc
+++ b/qc/func/door_secret.qc
@@ -51,6 +51,11 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
//--------------------------------------------------------------
void() func_door_secret_blocked =
{
+ // handle projectiles blockers -- CEV
+ if (other.classgroup & CG_PROJECTILE)
+ if (other.mins != '0 0 0' || other.maxs != '0 0 0')
+ setsize (other, '0 0 0', '0 0 0');
+
if (time < self.attack_finished)
return;

Return to the top of this page or return to the overview of this repo.

Diff qc/func/new_plat.qc

diff --git a/qc/func/new_plat.qc b/qc/func/new_plat.qc
index 070a26f..764274b 100644
--- a/qc/func/new_plat.qc
+++ b/qc/func/new_plat.qc
@@ -270,6 +270,13 @@ Set "sounds" to one of the following:
//--------------------------------------------------------------
void() func_new_plat_downandwait_blocked =
{
+ // handle projectiles -- CEV
+ if (other.classgroup & CG_PROJECTILE)
+ {
+ if (other.mins != '0 0 0' || other.maxs != '0 0 0')
+ setsize (other, '0 0 0', '0 0 0');
+ }
+
t_damage2 (other, self, self, 1);

if (self.state == FUNC_STATE_UP)
@@ -329,6 +336,13 @@ Set "sounds" to one of the following:
//--------------------------------------------------------------
void() func_new_plat_toggle_blocked =
{
+ // handle projectiles -- CEV
+ if (other.classgroup & CG_PROJECTILE)
+ {
+ if (other.mins != '0 0 0' || other.maxs != '0 0 0')
+ setsize (other, '0 0 0', '0 0 0');
+ }
+
t_damage2 (other, self, self, 1);

if (self.state == FUNC_STATE_UP)
@@ -383,6 +397,13 @@ Set "sounds" to one of the following:
//--------------------------------------------------------------
void() func_new_plat_elvtr_blocked =
{
+ // handle projectiles -- CEV
+ if (other.classgroup & CG_PROJECTILE)
+ {
+ if (other.mins != '0 0 0' || other.maxs != '0 0 0')
+ setsize (other, '0 0 0', '0 0 0');
+ }
+
local float tmp;

// T_Damage (other, self, self, 1);
@@ -551,6 +572,13 @@ Set "sounds" to one of the following:
//--------------------------------------------------------------
void() func_new_plat_plat2_blocked =
{
+ // handle projectiles -- CEV
+ if (other.classgroup & CG_PROJECTILE)
+ {
+ if (other.mins != '0 0 0' || other.maxs != '0 0 0')
+ setsize (other, '0 0 0', '0 0 0');
+ }
+
t_damage2 (other, self, self, 1);

if (self.state == FUNC_STATE_UP)

Return to the top of this page or return to the overview of this repo.

Diff qc/func/plat.qc

diff --git a/qc/func/plat.qc b/qc/func/plat.qc
index 9bc7bb6..207b0a9 100644
--- a/qc/func/plat.qc
+++ b/qc/func/plat.qc
@@ -156,8 +156,23 @@ Set "sounds" to one of the following:
//--------------------------------------------------------------
void() func_plat_blocked =
{
+ // handle projectiles -- CEV
+ if (other.classgroup & CG_PROJECTILE)
+ {
+ if (other.mins != '0 0 0' || other.maxs != '0 0 0')
+ setsize (other, '0 0 0', '0 0 0');
+
+ // continue on the same path
+ if (self.state == FUNC_STATE_UP)
+ func_plat_go_up ();
+ else if (self.state == FUNC_STATE_DOWN)
+ func_plat_go_down ();
+ return;
+ }
+
t_damage2 (other, self, self, 1);

+ // reverse direction
if (self.state == FUNC_STATE_UP)
func_plat_go_down ();
else if (self.state == FUNC_STATE_DOWN)

Return to the top of this page or return to the overview of this repo.

Diff qc/func/rotate.qc

diff --git a/qc/func/rotate.qc b/qc/func/rotate.qc
index da460b1..c85954b 100644
--- a/qc/func/rotate.qc
+++ b/qc/func/rotate.qc
@@ -18,7 +18,6 @@ const float ROTATE_STATE_ACTIVE = 0;
const float ROTATE_STATE_INACTIVE = 1;
const float ROTATE_STATE_SPEEDINGUP = 2;
const float ROTATE_STATE_SLOWINGDOWN = 3;
-
const float ROTATE_STATE_CLOSED = 4;
const float ROTATE_STATE_OPEN = 5;
const float ROTATE_STATE_OPENING = 6;
@@ -1043,6 +1042,13 @@ NONBLOCKING makes the brush non-solid. This is useless if VISIBLE is set.
//--------------------------------------------------------------
void() func_movewall_blocked =
{
+ // handle projectiles -- CEV
+ if (other.classgroup & CG_PROJECTILE)
+ {
+ if (other.mins != '0 0 0' || other.maxs != '0 0 0')
+ setsize (other, '0 0 0', '0 0 0');
+ }
+
if (time < self.owner.attack_finished)
return;

Return to the top of this page or return to the overview of this repo.

Diff qc/func/train.qc

diff --git a/qc/func/train.qc b/qc/func/train.qc
index 5168087..8add9e9 100644
--- a/qc/func/train.qc
+++ b/qc/func/train.qc
@@ -45,6 +45,15 @@ void() func_train;
//--------------------------------------------------------------
void() base_func_train_blocked =
{
+ // don't block on projectiles -- CEV
+ if (other.classgroup & CG_PROJECTILE)
+ {
+ if (other.mins != '0 0 0' || other.maxs != '0 0 0')
+ setsize (other, '0 0 0', '0 0 0');
+
+ return;
+ }
+
if (time < self.attack_finished)
return;

Return to the top of this page or return to the overview of this repo.