Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0fe1014
Add the ability to sound backup indoor sounds
Kutez Apr 15, 2025
4920094
Merge branch 'all-in-one-vs2022-wpo' of https://github.com/Kutez/xray…
Kutez Apr 15, 2025
07ef211
Indoor Explosion Sounds
Kutez Apr 16, 2025
dc3fd28
Fix1
Kutez Apr 16, 2025
a1427cc
Fix2
Kutez Apr 18, 2025
0ed5aab
fix333
Kutez Apr 18, 2025
e0c74ad
0.
Kutez Apr 18, 2025
8a61e0b
Merge branch 'themrdemonized:all-in-one-vs2022-wpo' into all-in-one-v…
Kutez Apr 18, 2025
587fe36
sfx
Kutez Apr 18, 2025
7c5960b
Merge branch 'all-in-one-vs2022-wpo' of https://github.com/Kutez/xray…
Kutez Apr 18, 2025
dd112b1
w
Kutez Apr 18, 2025
a2008fb
dammit
Kutez Apr 18, 2025
db0887e
Indoor Actor sounds
Kutez Apr 19, 2025
d125f88
fuck me
Kutez Apr 20, 2025
c506f29
Optimize stuff
Kutez Apr 20, 2025
c343919
Merge branch 'themrdemonized:all-in-one-vs2022-wpo' into all-in-one-v…
Kutez Apr 20, 2025
f6bda2d
adjust the priority, lower the _bak sound
Kutez Apr 20, 2025
daefcc7
Merge branch 'all-in-one-vs2022-wpo' of https://github.com/Kutez/xray…
Kutez Apr 20, 2025
0167b45
Merge branch 'themrdemonized:all-in-one-vs2022-wpo' into all-in-one-v…
Kutez Apr 21, 2025
9c7ad4f
Revert _bak param, apply Demonized hud sound callback
Kutez Apr 21, 2025
ef14f05
Merge branch 'all-in-one-vs2022-wpo' of https://github.com/Kutez/xray…
Kutez Apr 21, 2025
ef520b9
More sounds
Kutez Apr 21, 2025
7d3b4e5
Add all snd_shoot type sounds for indoor
Kutez Apr 21, 2025
fb292c4
Build changes to dev
Kutez Apr 21, 2025
35b8f65
Fix
Kutez Apr 21, 2025
61daab0
Revert
Kutez Apr 22, 2025
985fed1
Merge branch 'all-in-one-vs2022-wpo' of https://github.com/Kutez/xray…
Kutez Apr 22, 2025
f566be3
Cleanup unneeded codes
Kutez Apr 22, 2025
34ff721
Add silencer support
Kutez Apr 22, 2025
593f382
Callback update
Kutez Apr 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Indoor Explosion Sounds
  • Loading branch information
Kutez committed Apr 16, 2025
commit 07ef21103f37b9dd0254cb922806a6609aaaf75a
65 changes: 45 additions & 20 deletions src/xrGame/Explosive.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Explosive.cpp: ��������� ��� ������������� ��������
// Explosive.cpp: ��������� ��� ������������� ��������
//
//////////////////////////////////////////////////////////////////////

Expand All @@ -11,7 +11,7 @@
//#include "PSObject.h"
#include "ParticlesObject.h"

//��� ������ ����������� ������� ��������� ���������
//��� ������ ����������� ������� ��������� ���������
#include "Weapon.h"

#include "actor.h"
Expand Down Expand Up @@ -41,6 +41,8 @@
const u16 TEST_RAYS_PER_OBJECT = 5;
const u16 BLASTED_OBJ_PROCESSED_PER_FRAME = 3;
const float exp_dist_extinction_factor = 3.f;
extern float g_gunsnd_indoor;
extern float g_gunsnd_indoor_volume;
//(>1.f, 1.f -means no dist change of exp effect) on the dist of m_fBlastRadius exp. wave effect in exp_dist_extinction_factor times less than maximum

CExplosive::CExplosive(void)
Expand Down Expand Up @@ -77,6 +79,21 @@ CExplosive::CExplosive(void)
m_pExpParticle = NULL;
}

bool CExplosive::SoundExist(LPCSTR section, LPCSTR sound_name)
{
LPCSTR str;
bool sec_exist = process_if_exists_set(section, sound_name, &CInifile::r_string, str, true);
if (sec_exist)
return true;
else
{
#ifdef DEBUG
Msg("~ [WARNING] ------ Sound [%s] does not exist in [%s]", sound_name, section);
#endif
return false;
}
}

void CExplosive::LightCreate()
{
m_pLight = ::Render->light_create();
Expand Down Expand Up @@ -129,10 +146,12 @@ void CExplosive::Load(CInifile const* ini, LPCSTR section)
m_fLightRange = ini->r_float(section, "light_range");
m_fLightTime = ini->r_float(section, "light_time");

//������ ��� ������� ��������
//������ ��� ������� ��������
m_fFragmentSpeed = ini->r_float(section, "fragment_speed");

m_layered_sounds.LoadSound(ini, section, "snd_explode", "sndExplode", false, m_eSoundExplode);
if (SoundExist(section, "snd_explode_indoor"))
m_sounds.LoadSound(section, "snd_explode_indoor", "sndExplodeIndoor", false, m_eSoundShot);

m_fExplodeDurationMax = ini->r_float(section, "explode_duration");
if( ini->line_exist(section,"explode_effector_sect_name") )
Expand Down Expand Up @@ -195,7 +214,7 @@ struct SExpQParams
float shoot_factor;
};

//�������� �� ��������� "��������" �� �������
//�������� �� ��������� "��������" �� �������
ICF static BOOL grenade_hit_callback(collide::rq_result& result, LPVOID params)
{
SExpQParams& ep = *(SExpQParams*)params;
Expand All @@ -211,7 +230,7 @@ ICF static BOOL grenade_hit_callback(collide::rq_result& result, LPVOID params)
}
else
{
//�������� ����������� � ������ ��� ��������
//�������� ����������� � ������ ��� ��������
CDB::TRI* T = Level().ObjectSpace.GetStaticTris() + result.element;
mtl_idx = T->material;
}
Expand Down Expand Up @@ -365,11 +384,17 @@ void CExplosive::Explode()

// Msg("---------CExplosive Explode [%d] frame[%d]",cast_game_object()->ID(), Device.dwFrame);
OnBeforeExplosion();
//������ ���� ������

//������ ���� ������
// Indoor explodesion sounds
if (g_gunsnd_indoor>0.f) {
if (m_layered_sounds.FindSoundItem("sndExplodeIndoor", false))
{
m_layered_sounds.PlaySound("sndExplodeIndoor", pos, smart_cast<CObject*>(this), false, false, (u8)-1);
}
} else {
m_layered_sounds.PlaySound("sndExplode", pos, smart_cast<CObject*>(this), false, false, (u8)-1);

//���������� �������
}
//���������� �������

m_wallmark_manager.PlaceWallmarks(pos);

Expand All @@ -388,14 +413,14 @@ void CExplosive::Explode()
pStaticPG->UpdateParent(explode_matrix, vel);
pStaticPG->Play(false);

//�������� ��������� �� ������
//�������� ��������� �� ������
StartLight();

//trace frags
Fvector frag_dir;

//////////////////////////////
//�������
//�������
//////////////////////////////
//-------------------------------------
bool SendHits = false;
Expand Down Expand Up @@ -432,7 +457,7 @@ void CExplosive::Explode()
if (cast_game_object()->Remote()) return;

/////////////////////////////////
//�������� �����
//�������� �����
////////////////////////////////
//---------------------------------------------------------------------
xr_vector<ISpatial*> ISpatialResult;
Expand Down Expand Up @@ -519,7 +544,7 @@ void CExplosive::UpdateCL()
OnAfterExplosion();
return;
}
//����� �����, ������� ������ ����������
//����� �����, ������� ������ ����������
if (m_fExplodeDuration < 0.f && m_blasted_objects.empty())
{
m_explosion_flags.set(flExploded,TRUE);
Expand All @@ -543,7 +568,7 @@ void CExplosive::UpdateCL()
UpdateExplosionPos();
UpdateExplosionParticles();
ExplodeWaveProcess();
//�������� ��������� ������
//�������� ��������� ������
if (m_pLight && m_pLight->get_active() && m_fLightTime > 0)
{
if (m_fExplodeDuration > (m_fExplodeDurationMax - m_fLightTime))
Expand All @@ -566,7 +591,7 @@ void CExplosive::OnAfterExplosion()
CParticlesObject::Destroy(m_pExpParticle);
m_pExpParticle = NULL;
}
//������������� ��� ������
//������������� ��� ������
if (cast_game_object()->Local()) cast_game_object()->DestroyObject();

// NET_Packet P;
Expand Down Expand Up @@ -675,8 +700,8 @@ void CExplosive::FindNormal(Fvector& normal)
if (!result || RQ.O)
{
normal.set(0, 1, 0);
//���� ����� �� �������
//����� ����������� � ��������� ������� �� ����
//���� ����� �� �������
//����� ����������� � ��������� ������� �� ����
}
else
{
Expand Down Expand Up @@ -731,7 +756,7 @@ void CExplosive::ExplodeWaveProcessObject(collide::rq_results& storage, CPhysics
{
Fvector l_goPos;
if (l_pGO->Visual()) l_pGO->Center(l_goPos);
else return; //��� ��������� ����� �������� ��� �� ������ �� �������� �� ������� ������ - ������� ����������
else return; //��� ��������� ����� �������� ��� �� ������ �� �������� �� ������� ������ - ������� ����������

#ifdef DEBUG
if(ph_dbg_draw_mask.test(phDbgDrawExplosions))
Expand All @@ -752,8 +777,8 @@ void CExplosive::ExplodeWaveProcessObject(collide::rq_results& storage, CPhysics

float rmag = _sqrt(m_fUpThrowFactor * m_fUpThrowFactor + 1.f + 2.f * m_fUpThrowFactor * l_dir.y);
l_dir.y += m_fUpThrowFactor;
//rmag -������ l_dir ����� l_dir.y += m_fUpThrowFactor, ������=_sqrt(l_dir^2+y^2+2.*(l_dir,y)),y=(0,m_fUpThrowFactor,0) (�� ����� ������ l_dir =1)
l_dir.mul(1.f / rmag); //��������������
//rmag -������ l_dir ����� l_dir.y += m_fUpThrowFactor, ������=_sqrt(l_dir^2+y^2+2.*(l_dir,y)),y=(0,m_fUpThrowFactor,0) (�� ����� ������ l_dir =1)
l_dir.mul(1.f / rmag); //��������������
NET_Packet P;
SHit HS;
HS.GenHeader(GE_HIT, l_pGO->ID()); // cast_game_object()->u_EventGen (P,GE_HIT,l_pGO->ID());
Expand Down
38 changes: 20 additions & 18 deletions src/xrGame/Explosive.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Explosive.h: ��������� ��� ������������� ��������
// Explosive.h: ��������� ��� ������������� ��������
//
//////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -93,43 +93,43 @@ class CExplosive :
HUD_SOUND_COLLECTION_LAYERED m_layered_sounds;

CWalmarkManager m_wallmark_manager;
//ID ��������� ������� ���������� ��������
//ID ��������� ������� ���������� ��������
u16 m_iCurrentParentID;

//bool m_bReadyToExplode;
Fvector m_vExplodePos;
Fvector m_vExplodeSize;
Fvector m_vExplodeDir;

//��������� ������
//��������� ������
float m_fBlastHit;
float m_fBlastHitImpulse;
float m_fBlastRadius;

//��������� � ���������� ��������
//��������� � ���������� ��������
float m_fFragsRadius;
float m_fFragHit;
float m_fFragHitImpulse;
int m_iFragsNum;

//���� ��������� �����
//���� ��������� �����
ALife::EHitType m_eHitTypeBlast;
ALife::EHitType m_eHitTypeFrag;

//������ �������� �������� ����� �������� ������
//������ �������� �������� ����� �������� ������
float m_fUpThrowFactor;

//������ ���������� ��������
//������ ���������� ��������
BLASTED_OBJECTS_V m_blasted_objects;

//������� ����������������� ������
//������� ����������������� ������
float m_fExplodeDuration;
//����� ����� ������
//����� ����� ������
float m_fExplodeDurationMax;
//�����, ����� ������� ���� ������� ���������� ��������, ���� ��� �� ���������� ��������� �� ����� ������
//�����, ����� ������� ���� ������� ���������� ��������, ���� ��� �� ���������� ��������� �� ����� ������
float m_fExplodeHideDurationMax;

//���� ��������� ������
//���� ��������� ������
enum
{
flExploding =1 << 0,
Expand All @@ -140,27 +140,27 @@ class CExplosive :

Flags8 m_explosion_flags;
///////////////////////////////////////////////
//������ �� ������ ���� ����� ����� ������: true - ��� ���� ����� ������� �������
//������ �� ������ ���� ����� ����� ������: true - ��� ���� ����� ������� �������
BOOL m_bHideInExplosion;
bool m_bAlreadyHidden;
virtual void HideExplosive();
//bool m_bExploding;
//bool m_bExplodeEventSent;

//////////////////////////////////////////////
//��� ������� ��������
//��� ������� ��������
float m_fFragmentSpeed;

//�����
//�����
ESoundTypes m_eSoundExplode;

//������ ������� �� ������
//������ ������� �� ������
float fWallmarkSize;

//������� � ���������
//������� � ���������
shared_str m_sExplodeParticles;

//��������� ������
//��������� ������
ref_light m_pLight;
Fcolor m_LightColor;
float m_fLightRange;
Expand All @@ -182,13 +182,15 @@ class CExplosive :
CParticlesObject* m_pExpParticle;
virtual void UpdateExplosionParticles();

// ��������
// ��������
struct
{
shared_str effect_sect_name;
} effector;

DECLARE_SCRIPT_REGISTER_FUNCTION
// Check sounds exist for custom sounds
bool SoundExist(LPCSTR section, LPCSTR sound_name);
};

add_to_type_list(CExplosive)
Expand Down