Skip to content

Commit 59db546

Browse files
Merge pull request #112 from etapomom/all-in-one-vs2022-wpo
A handful of miscellaneous changes (cherry picked from commit ecb0294)
1 parent 34dda4f commit 59db546

16 files changed

+213
-21
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,19 @@ How to compile exes:
184184
6. For successful compilation, **the latest build tools with MFC and ATL libraries is required**
185185
186186
## Changelog
187+
**2024.12.10**
188+
* momopate (https://github.com/themrdemonized/xray-monolith/pull/112):
189+
* Added console commands:
190+
* `fix_avelocity_spread` -> Bool; Fixes moving the camera not affecting accuracy.
191+
* `apply_pdm_to_ads` -> Bool; Makes it so that PDM values from the weapon are properly applied when aiming down sights.
192+
* `smooth_ads_transition` -> Bool; Makes it so that going in and out of ADS smoothly changes the accuracy bonus instead of changing only at full ADS.
193+
* `allow_silencer_hide_tracer` -> Bool; Optionally disables silencers being able to hide tracers completely. (Defaults to true)
194+
* Added `silenced_tracers` (bool) field to weapons sections. If the ammo type can be hidden when using a silenced weapon, setting this field to true makes the tracer visible again.
195+
* Added `GetZoomRotateTime()` and `SetZoomRotateTime(float val)`.
196+
* Added `senderweapon` to the table used for `level.add_bullet()` to improve compatibility with modding. Defaults to sender.
197+
* Added `bkeep_speed` to `SetActorPosition()`.
198+
* Added `SetMovementSpeed()`. Exported as `set_movement_speed(vector vel)` for scripting.
199+
187200
**2024.12.09**
188201
* SSS 22 Update
189202

gamedata/configs/text/eng/ui_mm_modded_exes.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@
7777
<text>Particle update rate (1 - 30hz, 0.5 - 60hz, etc) (particle_update_mod)</text>
7878
</string>
7979

80+
<string id="ui_mm_modded_exes_render_short_tracers">
81+
<text>Cap and render tracers to their minimum length (render_short_tracers)</text>
82+
</string>
83+
<string id="ui_mm_modded_exes_allow_silencer_hide_tracer">
84+
<text>Allow silencers to hide tracers (allow_silencer_hide_tracer)</text>
85+
</string>
86+
8087
<string id="ui_mm_modded_exes_pda_map_zoom_in_to_mouse">
8188
<text>PDA Map Zoom In Relative To Mouse (pda_map_zoom_in_to_mouse)</text>
8289
</string>
@@ -146,6 +153,23 @@
146153
<string id="ui_mm_modded_exes_keyboard_buffer_size">
147154
<text>Keyboard Input Buffer Size (keyboard_buffer_size)</text>
148155
</string>
156+
157+
<string id="ui_mm_modded_exes_allow_outfit_control_inertion_factor">
158+
<text>Enable outfits affecting mouse sensitivity (allow_outfit_control_inertion_factor)</text>
159+
</string>
160+
<string id="ui_mm_modded_exes_allow_weapon_control_inertion_factor">
161+
<text>Enable weapons affecting mouse sensitivity (allow_weapon_control_inertion_factor)</text>
162+
</string>
163+
<string id="ui_mm_modded_exes_fix_avelocity_spread">
164+
<text>Fix moving the camera not affecting accuracy (fix_avelocity_spread)</text>
165+
</string>
166+
<string id="ui_mm_modded_exes_apply_pdm_to_ads">
167+
<text>Apply PDM (handling) values when ADS (apply_pdm_to_ads)</text>
168+
</string>
169+
<string id="ui_mm_modded_exes_smooth_ads_transition">
170+
<text>Smoothly apply the ADS accuracy bonus (smooth_ads_transition)</text>
171+
</string>
172+
149173
<!-- HDR10 -->
150174
<string id="ui_mm_modded_exes_hdr10_enabled">
151175
<text>Enable HDR10 (Requires Restart) (r4_hdr10_on)</text>

gamedata/configs/text/rus/ui_mm_modded_exes.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@
7777
<text>×àñòîòà ïàðòèêëåé (1 - 30ãö, 0.5 - 60ãö è ò.ä.) (particle_update_mod)</text>
7878
</string>
7979

80+
<string id="ui_mm_modded_exes_render_short_tracers">
81+
<text>Îãðàíè÷üòå è îòðèñóéòå òðàññåðû äî èõ ìèíèìàëüíîé äëèíû (render_short_tracers)</text>
82+
</string>
83+
<string id="ui_mm_modded_exes_allow_silencer_hide_tracer">
84+
<text>Ïîçâîëÿþò ãëóøèòåëÿì ñêðûâàòü òðàññèðóþùèå ýëåìåíòû (allow_silencer_hide_tracer)</text>
85+
</string>
86+
8087
<string id="ui_mm_modded_exes_pda_map_zoom_in_to_mouse">
8188
<text>Çóì íà êàðòó îòíîñèòåëüíî êóðñîðà (pda_map_zoom_in_to_mouse)</text>
8289
</string>
@@ -146,6 +153,23 @@
146153
<string id="ui_mm_modded_exes_keyboard_buffer_size">
147154
<text>Áóôåð ââîäà äëÿ êëàâèàòóðû (keyboard_buffer_size)</text>
148155
</string>
156+
157+
<string id="ui_mm_modded_exes_allow_outfit_control_inertion_factor">
158+
<text>Âêëþ÷èòü íàðÿäû, âëèÿþùèå íà ÷óâñòâèòåëüíîñòü ìûøè (allow_outfit_control_inertion_factor)</text>
159+
</string>
160+
<string id="ui_mm_modded_exes_allow_weapon_control_inertion_factor">
161+
<text>Âêëþ÷èòü îðóæèå, âëèÿþùåå íà ÷óâñòâèòåëüíîñòü ìûøè (allow_weapon_control_inertion_factor)</text>
162+
</string>
163+
<string id="ui_mm_modded_exes_fix_avelocity_spread">
164+
<text>Èñïðàâüòå ïåðåìåùåíèå êàìåðû, íå âëèÿþùåå íà òî÷íîñòü (fix_avelocity_spread)</text>
165+
</string>
166+
<string id="ui_mm_modded_exes_apply_pdm_to_ads">
167+
<text>Ïðèìåíÿéòå çíà÷åíèÿ PDM (îáðàáîòêè) ïðè ðàçìåùåíèè ðåêëàìû (apply_pdm_to_ads)</text>
168+
</string>
169+
<string id="ui_mm_modded_exes_smooth_ads_transition">
170+
<text>Ïëàâíî ïðèìåíÿéòå áîíóñ çà òî÷íîñòü ðåêëàìû (smooth_ads_transition)</text>
171+
</string>
172+
149173
<!-- HDR10 -->
150174
<string id="ui_mm_modded_exes_hdr10_enabled">
151175
<text>Âêëþ÷èòü HDR10 (òðåáóåòñÿ ïåðåçàãðóçêà) (r4_hdr10_on)</text>

gamedata/scripts/ltx_help_ex.script

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,20 @@
1616
base_hud_offset_pos_16x9 - Editable variables that allow weapon position adjustements that don't require aim tweaks
1717
base_hud_offset_rot - Editable variables that allow weapon position adjustements that don't require aim tweaks
1818
base_hud_offset_rot_16x9 - Editable variables that allow weapon position adjustements that don't require aim tweaks
19+
silenced_tracers - Option to disable silencers hiding the tracer on a per weapon basis
1920

2021
Grenades
21-
frags_ap - Explosive shrapnel (frags) customization
22-
frags_air_resistance - Explosive shrapnel (frags) customization
23-
frags_tracer - Explosive shrapnel (frags) customization
24-
frags_4to1_tracer - Explosive shrapnel (frags) customization
25-
frags_magnetic_beam_shot - Explosive shrapnel (frags) customization
26-
frags_tracer_color_ID - Explosive shrapnel (frags) customization
22+
frags_ap - AP power for shrapnel
23+
frags_air_resistance - Air resistance for shrapnel
24+
frags_tracer - Tracer flag for shrapnel
25+
frags_4to1_tracer - 4 to 1 tracer flag for shrapnel
26+
frags_magnetic_beam_shot - Magnetic beam flag for shrapnel
27+
frags_tracer_color_ID - Tracer color ID for shrapnel
2728
ammo_grenade_vel - Specify velocity of underbarrel grenade launcher ammo
2829
explode_effector_sect_name - customizable explode_effector per grenade section
2930

3031
Ammo
31-
tracer_silenced - Silencers can hide bullet tracers
32+
tracer_silenced - Silencers can hide bullet tracers on a per ammo type basis
3233
tracer_length_k - Tracer length modifier
3334

3435
Detectors

gamedata/scripts/lua_help_ex.script

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@
4545

4646
allow_outfit_control_inertion_factor
4747
allow_weapon_control_inertion_factor // Weapon and outfit control_inertion_factor can affect mouse sens
48-
render_short_tracers // Tracers will be capped to their minimum length instead of not rendering
48+
render_short_tracers // Tracers will be capped to their minimum length instead of not rendering
49+
fix_avelocity_spread // Fixes moving the camera around not worsening accuracy
50+
apply_pdm_to_ads // Enables PDM (handling) values to be applied properly during ADS
51+
smooth_ads_transition // Smoothly applies the ADS accuracy bonus instead of only being applied when fully ADS
52+
allow_silencer_hide_tracer // Controls wether or not silencers can hide tracers at all
4953

5054
viewport_near [0.0, 1.0] // Adjust the camera near value
5155

@@ -201,6 +205,7 @@
201205
// power = 1,
202206
// impulse = 1,
203207
// sender = AC_ID,
208+
// senderweapon = db.actor:active_item():id(), // Defaults to what's set for sender if not specified
204209
// hit_type = 1,
205210
// max_dist = 100,
206211
// ammo_sect = "ammo_5.56x45_fmj",
@@ -313,6 +318,8 @@
313318
function update_weight()
314319
function get_total_weight_force_update()
315320
function get_talking_npc()
321+
function set_actor_position(vector pos, bool bskip_collision_correct, bool bkeep_speed)
322+
function set_movement_speed(vector)
316323

317324
// Stalker NPCs
318325
function get_enable_anomalies_pathfinding()
@@ -460,6 +467,10 @@
460467
}
461468
table get_scope_ui()
462469
function set_scope_ui(string)
470+
471+
// Get and set the zoom_rotate_time (time in seconds to fully ADS) field for a given weapon
472+
function GetZoomRotateTime()
473+
function SetZoomRotateTime(float)
463474
}
464475

465476
enum rq_target { (sum them up to target multiple types)

gamedata/scripts/ui_options_modded_exes.script

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,22 @@ function init_opt_base()
200200
step = 0.01,
201201
cmd = "particle_update_mod",
202202
},
203+
{
204+
id = "render_short_tracers",
205+
type = "list",
206+
val = 0,
207+
curr = {function() return get_console_cmd(0, "render_short_tracers") end},
208+
content = {function() return {{"1", "ON"}, {"0", "OFF"}} end},
209+
cmd = "render_short_tracers",
210+
},
211+
{
212+
id = "allow_silencer_hide_tracer",
213+
type = "list",
214+
val = 0,
215+
curr = {function() return get_console_cmd(0, "allow_silencer_hide_tracer") end},
216+
content = {function() return {{"1", "ON"}, {"0", "OFF"}} end},
217+
cmd = "allow_silencer_hide_tracer",
218+
},
203219

204220
{ id = "divider", type = "line" },
205221

@@ -370,6 +386,46 @@ function init_opt_base()
370386
content = {function() return {{"1", "ON"}, {"0", "OFF"}} end},
371387
cmd = "telekinetic_objects_include_corpses",
372388
},
389+
{
390+
id = "allow_outfit_control_inertion_factor",
391+
type = "list",
392+
val = 0,
393+
curr = {function() return get_console_cmd(0, "allow_outfit_control_inertion_factor") end},
394+
content = {function() return {{"1", "ON"}, {"0", "OFF"}} end},
395+
cmd = "allow_outfit_control_inertion_factor",
396+
},
397+
{
398+
id = "allow_weapon_control_inertion_factor",
399+
type = "list",
400+
val = 0,
401+
curr = {function() return get_console_cmd(0, "allow_weapon_control_inertion_factor") end},
402+
content = {function() return {{"1", "ON"}, {"0", "OFF"}} end},
403+
cmd = "allow_weapon_control_inertion_factor",
404+
},
405+
{
406+
id = "fix_avelocity_spread",
407+
type = "list",
408+
val = 0,
409+
curr = {function() return get_console_cmd(0, "fix_avelocity_spread") end},
410+
content = {function() return {{"1", "ON"}, {"0", "OFF"}} end},
411+
cmd = "fix_avelocity_spread",
412+
},
413+
{
414+
id = "apply_pdm_to_ads",
415+
type = "list",
416+
val = 0,
417+
curr = {function() return get_console_cmd(0, "apply_pdm_to_ads") end},
418+
content = {function() return {{"1", "ON"}, {"0", "OFF"}} end},
419+
cmd = "apply_pdm_to_ads",
420+
},
421+
{
422+
id = "smooth_ads_transition",
423+
type = "list",
424+
val = 0,
425+
curr = {function() return get_console_cmd(0, "smooth_ads_transition") end},
426+
content = {function() return {{"1", "ON"}, {"0", "OFF"}} end},
427+
cmd = "smooth_ads_transition",
428+
},
373429

374430
{ id = "divider", type = "line" },
375431

src/xrGame/Actor_Weapon.cpp

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,32 @@ static const float VEL_A_MAX = 10.f;
2626

2727
#define GetWeaponParam(pWeapon, func_name, def_value) ((pWeapon) ? (pWeapon->func_name) : def_value)
2828

29+
BOOL g_fix_avelocity_spread = 0;
30+
BOOL g_apply_pdm_to_ads = 0;
31+
BOOL g_smooth_ads_transition = 0;
2932
//âîçâðàùàåò òåêóøèé ðàçáðîñ ñòðåëüáû (â ðàäèàíàõ)ñ ó÷åòîì äâèæåíèÿ
3033
float CActor::GetWeaponAccuracy() const
3134
{
3235
CWeapon* W = smart_cast<CWeapon*>(inventory().ActiveItem());
33-
34-
if (IsZoomAimingMode() && W && !GetWeaponParam(W, IsRotatingToZoom(), false))
36+
37+
// momopate: optionally make pdm values affect ads, have a smoother transition in and out of the aiming bonus
38+
float disp_aim;
39+
bool is_zooming = (W && ((g_smooth_ads_transition && GetWeaponParam(W, GetInertionAimFactor(), 1.0f) < 1.0f) || (!g_smooth_ads_transition && IsZoomAimingMode() && !GetWeaponParam(W, IsRotatingToZoom(), false))));
40+
if (is_zooming)
3541
{
36-
return m_fDispAim;
42+
if (!g_apply_pdm_to_ads)
43+
return m_fDispAim;
44+
else
45+
{
46+
if (!g_smooth_ads_transition)
47+
disp_aim = m_fDispAim;
48+
else
49+
disp_aim = _lerp(m_fDispAim, 1.0f, GetWeaponParam(W, GetInertionAimFactor(), 1.0f));
50+
}
3751
}
52+
else
53+
disp_aim = 1.0;
54+
3855
float dispersion = m_fDispBase * GetWeaponParam(W, Get_PDM_Base(), 1.0f) *
3956
GetWeaponParam(W, Get_Silencer_PDM_Base(), 1.0f) * GetWeaponParam(W, Get_Scope_PDM_Base(), 1.0f) *
4057
GetWeaponParam(W, Get_Launcher_PDM_Base(), 1.0f);
@@ -43,8 +60,11 @@ float CActor::GetWeaponAccuracy() const
4360
CEntity::SEntityState state;
4461
if (g_State(state))
4562
{
63+
// momopate: fix moving the camera not affecting spread
64+
float AVelocity = (g_fix_avelocity_spread) ? fCurAVelocity : state.fAVelocity;
65+
4666
//fAVelocity = angle velocity
47-
dispersion *= (1.0f + (state.fAVelocity / VEL_A_MAX) * m_fDispVelFactor * GetWeaponParam(
67+
dispersion *= (1.0f + (AVelocity / VEL_A_MAX) * m_fDispVelFactor * GetWeaponParam(
4868
W, Get_PDM_Vel_F(), 1.0f) *
4969
GetWeaponParam(W, Get_Silencer_PDM_Vel(), 1.0f) * GetWeaponParam(W, Get_Scope_PDM_Vel(), 1.0f) *
5070
GetWeaponParam(W, Get_Launcher_PDM_Vel(), 1.0f));
@@ -77,7 +97,7 @@ float CActor::GetWeaponAccuracy() const
7797
if (W && W->m_lastCartridge.param_s.buckShot > 1)
7898
dispersion *= GetWeaponParam(W, Get_PDM_BuckShot(), 1.0f);
7999

80-
return dispersion;
100+
return (dispersion * disp_aim);
81101
}
82102

83103

src/xrGame/Level_Bullet_Manager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ SBullet::~SBullet()
4343
{
4444
}
4545

46+
BOOL g_allow_silencer_hide_tracer = 1;
4647
u32 SBullet::bulletCount = 0;
4748

4849
void SBullet::Init(const Fvector& position,
@@ -102,14 +103,14 @@ void SBullet::Init(const Fvector& position,
102103
//-Alundaio
103104

104105
// demonized: hide tracer when weapon has silencer
105-
if (!cartridge.param_s.tracer_silenced) // momopate: Make it optional
106+
if (!cartridge.param_s.tracer_silenced && g_allow_silencer_hide_tracer) // momopate: Make it optional
106107
{
107108
CObject* g_obj = Level().Objects.net_Find(weapon_id);
108109
if (g_obj)
109110
{
110111
CWeapon* weapon = smart_cast<CWeapon*>(g_obj);
111112
if (weapon && weapon->IsSilencerAttached())
112-
flags.allow_tracer = false;
113+
flags.allow_tracer = (weapon->GetSilencedTracers()); // momopate: customize per weapon
113114
}
114115
}
115116

src/xrGame/Weapon.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,9 @@ void CWeapon::Load(LPCSTR section)
753753
m_bHasTracers = !!READ_IF_EXISTS(pSettings, r_bool, section, "tracers", true);
754754
m_u8TracerColorID = READ_IF_EXISTS(pSettings, r_u8, section, "tracers_color_ID", u8(-1));
755755

756+
// momopate
757+
m_bSilencedTracers = READ_IF_EXISTS(pSettings, r_bool, section, "silenced_tracers", false);
758+
756759
string256 temp;
757760
for (int i = egdNovice; i < egdCount; ++i)
758761
{

src/xrGame/Weapon.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,11 @@ class CWeapon : public CHudItemObject,
971971
{
972972
m_first_bullet_controller.set_fire_dispertion(val);
973973
};
974+
975+
// momopate
976+
float GetZoomRotateTime() { return m_zoom_params.m_fZoomRotateTime; }
977+
virtual void SetZoomRotateTime(float val) { m_zoom_params.m_fZoomRotateTime = val; }
978+
974979
protected:
975980
int iAmmoElapsed; // ammo in magazine, currently
976981
int iMagazineSize; // size (in bullets) of magazine
@@ -995,6 +1000,7 @@ class CWeapon : public CHudItemObject,
9951000
CWeaponAmmo* m_pCurrentAmmo;
9961001
u8 m_ammoType;
9971002
bool m_bHasTracers;
1003+
bool m_bSilencedTracers;
9981004
u8 m_u8TracerColorID;
9991005
u8 m_set_next_ammoType_on_reload;
10001006
// Multitype ammo support
@@ -1003,6 +1009,8 @@ class CWeapon : public CHudItemObject,
10031009
CCartridge m_lastCartridge;
10041010
float m_fCurrentCartirdgeDisp;
10051011

1012+
virtual bool GetSilencedTracers() { return m_bSilencedTracers; }
1013+
10061014
bool unlimited_ammo();
10071015
IC bool can_be_strapped() const
10081016
{

0 commit comments

Comments
 (0)