Skip to content

Commit

Permalink
Fix xrGameLA, part 5
Browse files Browse the repository at this point in the history
  • Loading branch information
St4lker0k765 committed Dec 8, 2024
1 parent 06b1a91 commit 340dd96
Show file tree
Hide file tree
Showing 108 changed files with 653 additions and 963 deletions.
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/states/state_hit_object_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bool CStateMonsterHitObjectAbstract::check_start_conditions()
target = 0;

// получить физ. объекты в радиусе
m_nearest_objects.clear_not_free ();
m_nearest_objects.clear ();
Level().ObjectSpace.GetNearest (m_nearest_objects,object->Position(), object->Radius() - 0.5f, object());

xr_vector<CObject*>::iterator B = m_nearest_objects.begin();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/telekinesis_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void CTelekinesis<_Object>::Activate()
active = true;

// получить список объектов
m_nearest.clear_not_free ();
m_nearest.clear ();
Level().ObjectSpace.GetNearest (m_nearest,control_object->Position(),10.f);
//xr_vector<CObject*> &m_nearest = Level().ObjectSpace.q_nearest;

Expand Down
7 changes: 5 additions & 2 deletions src/xrGameLA/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,8 @@ virtual bool can_validate_position_on_spawn (){return false;}
Fvector IPosS, IPosH, IPosL; //положение актера после интерполяции Бизье, Эрмита, линейной

#ifdef DEBUG
DEF_DEQUE (VIS_POSITION, Fvector);
using VIS_POSITION = xr_deque<Fvector>;
using VIS_POSITION_it = VIS_POSITION::iterator;

VIS_POSITION LastPosS;
VIS_POSITION LastPosH;
Expand All @@ -635,7 +636,9 @@ virtual bool can_validate_position_on_spawn (){return false;}
u32 m_dwILastUpdateTime;

//---------------------------------------------
DEF_DEQUE (PH_STATES, SPHNetState);
using PH_STATES = xr_deque<SPHNetState>;
using PH_STATES_it = PH_STATES::iterator;

PH_STATES m_States;
u16 m_u16NumBones;
void net_ExportDeadBody (NET_Packet &P);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGameLA/ActorEffector.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CActorCameraManager :public CCameraManager
IC void hud_camera_Matrix (Fmatrix& M){M.set(m_cam_info_hud.r, m_cam_info_hud.n, m_cam_info_hud.d, m_cam_info_hud.p);}
};

typedef fastdelegate::FastDelegate0<float> GET_KOEFF_FUNC;
typedef xr_delegate<float()> GET_KOEFF_FUNC;

void AddEffector (CActor* A, int type, const shared_str& sect_name);
void AddEffector (CActor* A, int type, const shared_str& sect_name, float factor);
Expand Down
12 changes: 6 additions & 6 deletions src/xrGameLA/Actor_Feel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ ICF static BOOL info_trace_callback(collide::rq_result& result, LPVOID params)
BOOL& bOverlaped = *(BOOL*)params;
if(result.O){
if (Level().CurrentEntity()!=result.O){
bOverlaped = TRUE; //tatarinrafa: ðàñêîìåíòèë, ÷òîáû íåëüçÿ áûëî ïîäáèðàòü è âèäåòü ïðåäìåòû ÷åðåç äâåðè è òä. Íàäî òåñòèòü.| Uncomented so that actor cant pick up through dynamic objects. Needs tests
bOverlaped = TRUE; //tatarinrafa: раскоментил, чтобы нельзя было подбирать и видеть предметы через двери и тд. Надо тестить.| Uncomented so that actor cant pick up through dynamic objects. Needs tests
return TRUE;//FALSE;
}else{

return TRUE;
}
}
else{
//ïîëó÷èòü òðåóãîëüíèê è óçíàòü åãî ìàòåðèàë
//получить треугольник и узнать его материал
CDB::TRI* T = Level().ObjectSpace.GetStaticTris() + result.element;
if (GMLib.GetMaterialByIdx(T->material)->Flags.is(SGameMtl::flPassable) && !GMLib.GetMaterialByIdx(T->material)->Flags.is(SGameMtl::flDynamic)){
return TRUE;
Expand Down Expand Up @@ -126,7 +126,7 @@ void CActor::PickupModeUpdate()
if(!m_bPickupMode) return;
if (GameID() != GAME_SINGLE) return;

//ïîäáèðàíèå îáúåêòà
//подбирание объекта
if(inventory().m_pTarget && inventory().m_pTarget->Useful() &&
m_pUsableObject && m_pUsableObject->nonscript_usable() &&
!Level().m_feel_deny.is_object_denied(smart_cast<CGameObject*>(inventory().m_pTarget)) )
Expand Down Expand Up @@ -166,7 +166,7 @@ void CActor::PickupModeUpdate_COD ()
frustum.CreateFromMatrix(Device.mFullTransform,FRUSTUM_P_LRTB|FRUSTUM_P_FAR);

//---------------------------------------------------------------------------
ISpatialResult.clear_not_free ();
ISpatialResult.clear ();
g_SpatialSpace->q_frustum(ISpatialResult, 0, STYPE_COLLIDEABLE, frustum);
//---------------------------------------------------------------------------

Expand Down Expand Up @@ -223,7 +223,7 @@ void CActor::PickupModeUpdate_COD ()

if (pNearestItem && m_bPickupMode)
{
//ïîäáèðàíèå îáúåêòà
//подбирание объекта
Game().SendPickUpEvent(ID(), pNearestItem->object().ID());

PickupModeOff();
Expand All @@ -232,7 +232,7 @@ void CActor::PickupModeUpdate_COD ()

void CActor::PickupInfoDraw(CObject* object)
{
//tatarinrafa: Íåìíîãî èçìåíèë òî, êàê ðàáîàòåò ïîäñâå÷èâàíèå/Added some changes to how highlighting works
//tatarinrafa: Немного изменил то, как рабоатет подсвечивание/Added some changes to how highlighting works
CInventoryItem* item = smart_cast<CInventoryItem*>(object);
if(!item || !item->IsPickUpVisible()) return;

Expand Down
2 changes: 1 addition & 1 deletion src/xrGameLA/BoneProtections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void SBoneProtections::reload(const shared_str& bone_sect, IKinematics* kinemati

s16 bone_id = kinematics->LL_BoneID(i->first);
R_ASSERT2 (BI_NONE != bone_id, i->first.c_str());
m_bones_koeff.insert (mk_pair(bone_id,BP));
m_bones_koeff.insert (std::make_pair(bone_id,BP));
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/xrGameLA/Car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ CCar::CCar()
m_exhaust_particles ="vehiclefx\\exhaust_1";
m_car_sound = new SCarSound(this);

//ó ìàøèíû ñëîòîâ â èíâåíòàðå íåò
//у машины слотов в инвентаре нет
inventory().SetSlotsUseful(false);
m_doors_torque_factor = 2.f;
m_power_increment_factor=0.5f;
Expand Down Expand Up @@ -835,7 +835,7 @@ void CCar::ParseDefinitions()
bone_map.clear();

IKinematics* pKinematics=smart_cast<IKinematics*>(Visual());
bone_map.insert(mk_pair(pKinematics->LL_GetBoneRoot(),physicsBone()));
bone_map.insert(std::make_pair(pKinematics->LL_GetBoneRoot(),physicsBone()));
CInifile* ini = pKinematics->LL_UserData();
R_ASSERT2(ini,"Car has no description !!! See ActorEditor Object - UserData");
CExplosive::Load(ini,"explosion");
Expand All @@ -856,11 +856,11 @@ void CCar::ParseDefinitions()
u16 bone_id = pKinematics->LL_BoneID(ini->r_string("car_definition","trunk_bone"));
SDoor door(this);
door.bone_id= bone_id;
m_doors.insert (mk_pair(bone_id,door));
m_doors.insert (std::make_pair(bone_id,door));
BONE_P_PAIR_IT J = bone_map.find(bone_id);
if (J == bone_map.end())
{
bone_map.insert(mk_pair(bone_id,physicsBone()));
bone_map.insert(std::make_pair(bone_id,physicsBone()));
}
}

Expand Down Expand Up @@ -1832,7 +1832,7 @@ void CCar::OnEvent(NET_Packet& P, u16 type)
inherited::OnEvent (P,type);
CExplosive::OnEvent (P,type);

//îáðàáîòêà ñîîáùåíèé, íóæíûõ äëÿ ðàáîòû ñ áàãàæíèêîì ìàøèíû
//обработка сообщений, нужных для работы с багажником машины
u16 id;
switch (type)
{
Expand Down Expand Up @@ -2029,10 +2029,10 @@ template <class T> IC void CCar::fill_wheel_vector(LPCSTR S,xr_vector<T>& type_w
BONE_P_PAIR_IT J = bone_map.find(bone_id);
if (J == bone_map.end())
{
bone_map.insert(mk_pair(bone_id,physicsBone()));
bone_map.insert(std::make_pair(bone_id,physicsBone()));


SWheel& wheel = (m_wheels_map.insert(mk_pair(bone_id,SWheel(this)))).first->second;
SWheel& wheel = (m_wheels_map.insert(std::make_pair(bone_id,SWheel(this)))).first->second;
wheel.bone_id = bone_id;
twheel.pwheel = &wheel;
wheel .Load(S1);
Expand Down Expand Up @@ -2064,7 +2064,7 @@ IC void CCar::fill_exhaust_vector(LPCSTR S,xr_vector<SExhaust>& exhausts)
BONE_P_PAIR_IT J = bone_map.find(bone_id);
if (J == bone_map.end())
{
bone_map.insert(mk_pair(bone_id,physicsBone()));
bone_map.insert(std::make_pair(bone_id,physicsBone()));
}

}
Expand All @@ -2082,11 +2082,11 @@ IC void CCar::fill_doors_map(LPCSTR S,xr_map<u16,SDoor>& doors)
u16 bone_id = pKinematics->LL_BoneID(S1);
SDoor door(this);
door.bone_id= bone_id;
doors.insert (mk_pair(bone_id,door));
doors.insert (std::make_pair(bone_id,door));
BONE_P_PAIR_IT J = bone_map.find(bone_id);
if (J == bone_map.end())
{
bone_map.insert(mk_pair(bone_id,physicsBone()));
bone_map.insert(std::make_pair(bone_id,physicsBone()));
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/xrGameLA/GamePersistent.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CGamePersistent:
EVENT eQuickLoad;
Fvector m_dof [4]; // 0-dest 1-current 2-from 3-original

fastdelegate::FastDelegate0<> m_intro_event;
xr_delegate<void()> m_intro_event;

void start_logo_intro ();
void update_logo_intro ();
Expand Down
4 changes: 2 additions & 2 deletions src/xrGameLA/HangingLamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@ void CHangingLamp::CreateBody(CSE_ALifeObjectHangingLamp *lamp)
_GetItem (fixed_bones,i,fixed_bone) ;
u16 fixed_bone_id=pKinematics->LL_BoneID(fixed_bone) ;
R_ASSERT2(BI_NONE!=fixed_bone_id,"wrong fixed bone") ;
bone_map.insert(mk_pair(fixed_bone_id,physicsBone())) ;
bone_map.insert(std::make_pair(fixed_bone_id,physicsBone())) ;
}
}else{
bone_map.insert(mk_pair(pKinematics->LL_GetBoneRoot(),physicsBone())) ;
bone_map.insert(std::make_pair(pKinematics->LL_GetBoneRoot(),physicsBone())) ;
}


Expand Down
20 changes: 10 additions & 10 deletions src/xrGameLA/Level_Bullet_Manager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Level_Bullet_Manager.cpp: äëÿ îáåñïå÷åíèÿ ïîëåòà ïóëè ïî òðàåêòîðèè
// âñå ïóëè è îñêîëêè ïåðåäàþòñÿ ñþäà
// Level_Bullet_Manager.cpp: для обеспечения полета пули по траектории
// все пули и осколки передаются сюда
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
Expand Down Expand Up @@ -715,14 +715,14 @@ BOOL CBulletManager::firetrace_callback (collide::rq_result& result, LPVOID para
if ( fis_zero(data.collide_time) )
return (TRUE);

//ñòàòè÷åñêèé îáúåêò
//статический объект
if (!result.O) {
CDB::TRI const& triangle = *(Level().ObjectSpace.GetStaticTris() + result.element);
bullet_manager.RegisterEvent(EVENT_HIT, FALSE, &bullet, collide_position, result, triangle.material);
return (FALSE);
}

//äèíàìè÷åñêèé îáúåêò
//динамический объект
VERIFY ( !(result.O->ID() == bullet.parent_id && bullet.fly_dist < parent_ignore_distance) );
IKinematics* const kinematics = smart_cast<IKinematics*>(result.O->Visual());
if (!kinematics)
Expand Down Expand Up @@ -938,14 +938,14 @@ void CBulletManager::Render ()
}

if (m_bullet_points.size() > 32768)
m_bullet_points.clear_not_free ();
m_bullet_points.clear ();
}
else
m_bullet_points.clear_not_free ();
m_bullet_points.clear ();

//0-ðèêîøåò
//1-çàñòðÿâàíèå ïóëè â ìàòåðèàëå
//2-ïðîáèâàíèå ìàòåðèàëà
//0-рикошет
//1-застрявание пули в материале
//2-пробивание материала
if (g_bDrawBulletHit) {
extern FvectorVec g_hit[];
FvectorIt it;
Expand Down Expand Up @@ -1049,7 +1049,7 @@ void CBulletManager::CommitEvents () // @ the start of frame
}break;
}
}
m_Events.clear_and_reserve () ;
m_Events.clear () ;
}

void CBulletManager::RegisterEvent (EventType Type, BOOL _dynamic, SBullet* bullet, const Fvector& end_point, collide::rq_result& R, u16 tgt_material)
Expand Down
4 changes: 3 additions & 1 deletion src/xrGameLA/Level_network_Demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
};
};

DEF_DEQUE(DemoDeque, DemoDataStruct);
using DemoDeque = xr_deque<DemoDataStruct>;
using DemoDeque_it = DemoDeque::iterator;

DemoDeque m_aDemoData;
void Demo_Load (LPCSTR DemoName);
void Demo_Load_toFrame (LPCSTR FileName, DWORD toFrame, long &ofs);
Expand Down
8 changes: 4 additions & 4 deletions src/xrGameLA/PDA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void CPda::shedule_Update(u32 dt)

void CPda::UpdateActiveContacts ()
{
m_active_contacts.clear_not_free();
m_active_contacts.clear();
xr_vector<CObject*>::iterator it= feel_touch.begin();
for(;it!=feel_touch.end();++it){
CEntityAlive* pEA = smart_cast<CEntityAlive*>(*it);
Expand Down Expand Up @@ -135,7 +135,7 @@ void CPda::OnH_A_Chield()
{
VERIFY(IsOff());

//âêëþ÷èòü PDA òîëüêî åñëè îíî íàõîäèòñÿ ó ïåðâîãî âëàäåëüöà
//включить PDA только если оно находится у первого владельца
if(H_Parent()->ID() == m_idOriginalOwner){
TurnOn ();
if(m_sFullName.empty()){
Expand All @@ -151,7 +151,7 @@ void CPda::OnH_B_Independent(bool just_before_destroy)
{
inherited::OnH_B_Independent(just_before_destroy);

//âûêëþ÷èòü
//выключить
TurnOff();
}

Expand All @@ -168,7 +168,7 @@ CInventoryOwner* CPda::GetOriginalOwner()

void CPda::ActivePDAContacts(xr_vector<CPda*>& res)
{
res.clear_not_free ();
res.clear ();
xr_vector<CObject*>::iterator it = m_active_contacts.begin();
xr_vector<CObject*>::iterator it_e = m_active_contacts.end();

Expand Down
3 changes: 2 additions & 1 deletion src/xrGameLA/PDA.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
class CInventoryOwner;
class CPda;

DEF_VECTOR (PDA_LIST, CPda*);
using PDA_LIST = xr_vector<CPda*>;
using PDA_LIST_it = PDA_LIST::iterator;

class CPda :
public CInventoryItemObject,
Expand Down
2 changes: 1 addition & 1 deletion src/xrGameLA/PHFracture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ element_fracture CPHFracturesHolder::SplitFromEnd(CPHElement* element,u16 fractu
// fract_i->m_break_torque,
// fract_i->m_add_torque_z);
//BodyCutForce(new_element_body,default_l_limit,default_w_limit);
element_fracture ret =mk_pair(new_element,(CShellSplitInfo)(*fract_i));
element_fracture ret =std::make_pair(new_element,(CShellSplitInfo)(*fract_i));

if(m_fractures.size()-fracture>0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrGameLA/PHItemList.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ template<class T>
public:
void push_back (T* item)
{
item->stack_pos=size;
item->stack_pos=this->size;
CPHItemList<T>::push_back(item);
}
};
Expand Down
8 changes: 4 additions & 4 deletions src/xrGameLA/PHMovementControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ int in_dead_area_count;
bool bExernalImpulse;
BOOL bSleep;

BOOL gcontact_Was; // Ïðèçåìëåíèå
float gcontact_Power; // Íàñêîëüêî ñèëüíî óäàðèëèñü
float gcontact_HealthLost; // Ñêîêî çäîðîâüÿ ïîòåðÿëè
BOOL gcontact_Was; // Приземление
float gcontact_Power; // Насколько сильно ударились
float gcontact_HealthLost; // Скоко здоровья потеряли

public:
void AllocateCharacterObject (CharacterType type) ;
Expand Down Expand Up @@ -261,7 +261,7 @@ int in_dead_area_count;
void EnableCharacter () {if(m_character&&m_character->b_exist)m_character->Enable();}
void SetOjectContactCallback (ObjectContactCallbackFun* callback){if(m_character)m_character->SetObjectContactCallback(callback);}
void SetFootCallBack (ObjectContactCallbackFun* callback){VERIFY(m_character);m_character->SetWheelContactCallback(callback);}
static BOOL CPHMovementControl::BorderTraceCallback(collide::rq_result& result, LPVOID params);
static BOOL BorderTraceCallback(collide::rq_result& result, LPVOID params);
ObjectContactCallbackFun* ObjectContactCallback(){if(m_character)return m_character->ObjectContactCallBack();else return NULL; }
u16 ContactBone (){return m_character->ContactBone();}
const ICollisionDamageInfo *CollisionDamageInfo ()const {VERIFY(m_character);return m_character->CollisionDamageInfo ();}
Expand Down
4 changes: 2 additions & 2 deletions src/xrGameLA/PHObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void CPHObject::reinit_single()
CPHObject* obj=static_cast<CPHObject*>(*i);
obj->IslandReinit();
}
result.clear_not_free();
result.clear();
dJointGroupEmpty(ContactGroup);
ContactFeedBacks.empty();
ContactEffectors.empty();
Expand Down Expand Up @@ -172,7 +172,7 @@ bool CPHObject::step_single(dReal step)

void CPHObject:: step( float time ) //it is still not a true step for object because it collide the object only not subsequent collision is doing
{
ph_world->r_spatial.clear_not_free ();
ph_world->r_spatial.clear ();
reinit_single ();
Collide ();
IslandStep ( time );
Expand Down
Loading

0 comments on commit 340dd96

Please sign in to comment.