Skip to content

Commit

Permalink
Revert `Enable ai_obstacle for anomalies and damage to stalkers from …
Browse files Browse the repository at this point in the history
…them`

This reverts commit 70ebb86.
  • Loading branch information
Drombeys committed Dec 12, 2024
1 parent fd55fda commit 3363de5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 61 deletions.
2 changes: 1 addition & 1 deletion src/xrGame/CustomZone.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CCustomZone : public CSpaceRestrictor,
virtual void net_Export (NET_Packet& P);
virtual void Load (LPCSTR section);
virtual void net_Destroy ();
virtual bool is_ai_obstacle () const {return true;};

virtual void save (NET_Packet &output_packet);
virtual void load (IReader &input_packet);

Expand Down
9 changes: 3 additions & 6 deletions src/xrGame/ai/stalker/ai_stalker_feel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
#include "../../sight_manager.h"
#include "../../stalker_movement_manager_smart_cover.h"
#include "../../stalker_animation_manager.h"
#include "../../CustomZone.h"

#ifdef DEBUG
# include "../../ai_debug.h"
extern Flags32 psAI_Flags;
#endif // DEBUG


BOOL CAI_Stalker::feel_vision_isRelevant(CObject* O)
{
if (!g_Alive())
Expand All @@ -41,10 +39,9 @@ void CAI_Stalker::renderable_Render ()
CInventoryOwner::renderable_Render ();

#ifdef DEBUG
if (g_Alive())
{
if (g_Alive()) {
if (psAI_Flags.test(aiAnimationStats))
animation().add_animation_stats();
animation().add_animation_stats ();
}
#endif // DEBUG
}
Expand Down Expand Up @@ -81,7 +78,7 @@ BOOL CAI_Stalker::feel_touch_on_contact (CObject *O)
{
VERIFY (O != this);

if ((O->spatial.type | STYPE_VISIBLEFORAI) != O->spatial.type && !smart_cast<CCustomZone*>(O) )
if ((O->spatial.type | STYPE_VISIBLEFORAI) != O->spatial.type)
return (FALSE);

return (inherited::feel_touch_on_contact(O));
Expand Down
54 changes: 1 addition & 53 deletions src/xrGame/ai_obstacle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,55 +98,6 @@ IC bool ai_obstacle::inside (const u32 &vertex_id) const
);
}

#include "../xrEngine/xr_collide_form.h"
void ai_obstacle::compute_matrix_novis(Fmatrix &result, const Fvector &additional)
{
if(!m_object->CFORM())
{
result.scale (0.f,0.f,0.f);
return;
}

Fvector last_half_size = Fvector().set(flt_max,flt_max,flt_max);
Fmatrix before_scale_matrix = Fidentity;
Fmatrix xform = m_object->XFORM();
Fvector *points = (Fvector*)_alloca(1*8*sizeof(Fvector));
Fvector *I = points;

Fobb obb;
m_object->CFORM()->getBBox().get_CD(obb.m_translate,obb.m_halfsize);
obb.m_rotate.identity();

Fmatrix Mbox;
obb.xform_get (Mbox);

result.mul_43 (xform,Mbox);

before_scale_matrix = result;
last_half_size = obb.m_halfsize.mul(1.2f);
result.mulB_43 (Fmatrix().scale(obb.m_halfsize));

for (u32 i=0; i<8; ++i, ++I)
result.transform_tiny (*I,local_points[i]);

MagicBox3 min_box = MagicMinBox(1*8,points);
min_box.ComputeVertices (points);

result.identity ();

result.c = min_box.Center();

result.i.sub(points[3],points[2]).normalize();
result.j.sub(points[2],points[1]).normalize();
result.k.sub(points[2],points[6]).normalize();

Fvector scale;
scale.x = points[3].distance_to(points[2])*.5f + additional.x;
scale.y = points[2].distance_to(points[1])*.5f + additional.y;
scale.z = points[2].distance_to(points[6])*.5f + additional.z;
result.mulB_43 (Fmatrix().scale(scale));
}

void ai_obstacle::compute_matrix(Fmatrix &result, const Fvector &additional)
{
IKinematics *kinematics = smart_cast<IKinematics*>(m_object->Visual());
Expand Down Expand Up @@ -223,10 +174,7 @@ void ai_obstacle::prepare_inside (Fvector &min, Fvector &max)
Fmatrix matrix;
float half_cell_size = (use_additional_radius ? 1.f : 0.f)*ai().level_graph().header().cell_size()*.5f;
Fvector half_size = Fvector().set(half_cell_size,half_cell_size,half_cell_size);
if(smart_cast<IKinematics*>(m_object->Visual()))
compute_matrix (matrix,half_size);
else
compute_matrix_novis (matrix,half_size);
compute_matrix (matrix,half_size);

Fvector points[8];
for (int i=0; i<8; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai_obstacle.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ai_obstacle {
void compute_impl ();
void compute ();
void compute_matrix (Fmatrix &result, const Fvector &additional);
void compute_matrix_novis (Fmatrix &result, const Fvector &additional);

public:
IC ai_obstacle (CGameObject *object);
IC const AREA &area ();
Expand Down

0 comments on commit 3363de5

Please sign in to comment.