Skip to content

Commit

Permalink
Merge branch 'all-in-one-vs2022' into all-in-one-vs2022-wpo
Browse files Browse the repository at this point in the history
  • Loading branch information
themrdemonized committed Jan 16, 2025
2 parents 978acda + ca5e876 commit 42860a4
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ How to compile exes:
6. For successful compilation, **the latest build tools with MFC and ATL libraries is required**
## Changelog
**2025.01.17**
* Possibility to set `fire_point_silencer` for weapons. Adjust fire point when silencer is attached, defaults to the value of fire_point
**2025.01.13**
* privatepirate: Fixed HDR Settings UI
Expand Down
1 change: 1 addition & 0 deletions gamedata/scripts/ltx_help_ex.script
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
base_hud_offset_rot - Editable variables that allow weapon position adjustements that don't require aim tweaks
base_hud_offset_rot_16x9 - Editable variables that allow weapon position adjustements that don't require aim tweaks
silenced_tracers - Option to disable silencers hiding the tracer on a per weapon basis
fire_point_silencer - Adjust fire point when silencer is attached, defaults to the value of fire_point
Grenades
frags_ap - AP power for shrapnel
Expand Down
14 changes: 14 additions & 0 deletions src/xrGame/Weapon.h
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,12 @@ class CWeapon : public CHudItemObject,
return m_current_firedeps.vLastFP2;
}

IC const Fvector& get_LastFPSilencer()
{
UpdateFireDependencies();
return m_current_firedeps.vLastFPSilencer;
}

IC const Fvector& get_LastFD()
{
UpdateFireDependencies();
Expand All @@ -568,6 +574,9 @@ class CWeapon : public CHudItemObject,

virtual const Fvector& get_CurrentFirePoint()
{
if (SilencerAttachable() && IsSilencerAttached()) {
return get_LastFPSilencer();
}
return get_LastFP();
}

Expand All @@ -576,6 +585,11 @@ class CWeapon : public CHudItemObject,
return get_LastFP2();
}

virtual const Fvector& get_CurrentFirePointSilencer()
{
return get_LastFPSilencer();
}

virtual const Fmatrix& get_ParticlesXFORM()
{
UpdateFireDependencies();
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/firedeps.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ struct firedeps
Fvector vLastFP2; //fire point2
Fvector vLastFD; //fire direction
Fvector vLastSP; //shell point
Fvector vLastFPSilencer;

firedeps()
{
Expand All @@ -15,5 +16,6 @@ struct firedeps
vLastFP2.set(0, 0, 0);
vLastFD.set(0, 0, 0);
vLastSP.set(0, 0, 0);
vLastFPSilencer.set(0, 0, 0);
}
};
11 changes: 11 additions & 0 deletions src/xrGame/player_hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ void attachable_hud_item::setup_firedeps(firedeps& fd)
m_item_transform.transform_tiny(fd.vLastSP);
VERIFY(_valid(fd.vLastSP));
}

Fmatrix& fire_mat = m_model->LL_GetTransform(m_measures.m_fire_bone_silencer);
fire_mat.transform_tiny(fd.vLastFPSilencer, m_parent->m_adjust_mode ? m_parent->m_adjust_firepoint_shell[0][0] : m_measures.m_fire_point_silencer);
m_item_transform.transform_tiny(fd.vLastFPSilencer);
VERIFY(_valid(fd.vLastFPSilencer));
}

bool attachable_hud_item::need_renderable()
Expand Down Expand Up @@ -271,6 +276,12 @@ void hud_item_measures::load(const shared_str& sect_name, IKinematics* K)
else
m_fire_point2_offset.set(0, 0, 0);

// demonized: fire point for silencer
m_prop_flags.set(e_fire_point_silencer, pSettings->line_exist(sect_name, "fire_bone_silencer"));
bone_name = READ_IF_EXISTS(pSettings, r_string, sect_name, "fire_bone_silencer", READ_IF_EXISTS(pSettings, r_string, sect_name, "fire_bone", "wpn_body"));
m_fire_bone_silencer = K->LL_BoneID(bone_name);
m_fire_point_silencer.set(pSettings->line_exist(sect_name, "fire_point_silencer") ? pSettings->r_fvector3(sect_name, "fire_point_silencer") : m_fire_point_offset);

m_prop_flags.set(e_shell_point, pSettings->line_exist(sect_name, "shell_bone"));
if (m_prop_flags.test(e_shell_point))
{
Expand Down
4 changes: 3 additions & 1 deletion src/xrGame/player_hud.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ enum EBoneCallbackParam

struct hud_item_measures
{
enum { e_fire_point=(1 << 0), e_fire_point2=(1 << 1), e_shell_point=(1 << 2), e_16x9_mode_now=(1 << 3) };
enum { e_fire_point=(1 << 0), e_fire_point2=(1 << 1), e_shell_point=(1 << 2), e_16x9_mode_now=(1 << 3), e_fire_point_silencer=(1 << 4) };

Flags8 m_prop_flags;

Expand All @@ -207,6 +207,8 @@ struct hud_item_measures
Fvector m_fire_point_offset;
u16 m_fire_bone2;
Fvector m_fire_point2_offset;
u16 m_fire_bone_silencer;
Fvector m_fire_point_silencer;
Fvector m_fire_direction;
u16 m_shell_bone;
Fvector m_shell_point_offset;
Expand Down

0 comments on commit 42860a4

Please sign in to comment.