Skip to content

Commit bae4968

Browse files
committed
1 parent 7307a24 commit bae4968

File tree

3 files changed

+155
-34
lines changed

3 files changed

+155
-34
lines changed

game/quiver/info_changelog.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,20 @@ Quiver Test 5:
1717
- Fixed a bug where bodyshots counted as armor penetration for weapons that headshot.
1818
- Removed penetrated sniper shots from the list of things that can penetrate armor, due to problems found when implementing the above bug fix.
1919
- The Railgun no longer has a move speed penalty when charging, however headshots are disabled at longer ranges (over 2400 hammer units) and the weapon has a 15% slower move speed penalty regardless if you charge or not.
20-
- Removed the Railgun's 25% charge rate in favor of a 10% charge rate penalty.
20+
- Removed the Railgun's 25% charge rate.
2121
- Removed the Railgun's armor penalty.
2222
- Added an option to enable/disable wall strafing.
2323
- Added the Hitman's Executioner, a revolver for the Spy that allows you to fire close-range headshots if you're behind the enemy, alongside minicrits. In return, more mini-crit damage is taken when active.
2424
- Added loading screen tips.
2525
- Added Team Deathmatch. Maps without a specified gamemode (no gamemode logic or entities), or with dm_ or tdm_ prefixes will be considered Team Deathmatch maps. Disable qf_allow_tdm if you wish to disable Team Deathmatch on your server and restore the original "no gamemode" logic.
2626
- Added dm_ravine, dm_lumberyard, and dm_2fort, the first Team Deathmatch maps, built off the Arena/CTF maps of the same name.
27+
- Added the following Source SDK Pull Requests:
28+
- #1428: Fix steam input not working for the upgrade station menu
29+
- #1424: Auto-equip powerup canteen when ForceUpgrades is enabled (Freaky Fair)
30+
- #1432: Fix joining a new lobby while being revived locking up the camera
31+
- #1433: Add client ConVars for changing viewmodel position and angle offsets
32+
- Updated the following Source SDK Pull Requests:
33+
- #1417: Add inverse kinematics solving in model panels
2734

2835
Quiver Test 4:
2936
- Re-enabled shield break responses.

game/quiver/scripts/items/items_custom.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,6 @@
440440
"attribute_class" "set_weapon_mode"
441441
"value" "2"
442442
}
443-
"sniper charge per sec penalty"
444-
{
445-
"attribute_class" "mult_sniper_charge_per_sec"
446-
"value" "0.80"
447-
}
448443
"sniper classic allow jump"
449444
{
450445
"attribute_class" "sniper_classic_allow_jump"

src/game/shared/tf/tf_viewmodel.cpp

Lines changed: 147 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -129,70 +129,188 @@ ConVar cl_gunlowerspeed( "cl_gunlowerspeed", "2", FCVAR_CLIENTDLL | FCVAR_CHEAT
129129

130130
ConVar tf_use_min_viewmodels( "tf_use_min_viewmodels", "0", FCVAR_ARCHIVE, "Use minimized viewmodels." );
131131

132-
ConVar tf_viewmodels_offset_override( "tf_viewmodels_offset_override", "", FCVAR_CHEAT, "If set, this will override the position of all viewmodels. Usage 'x y z'" );
132+
#ifdef BDSBASE
133+
ConVar tf_viewmodels_offset_override("tf_viewmodels_offset_override", "", FCVAR_CHEAT, "If set, this will override the position and angles of all viewmodels. Usage 'x y z pitch yaw roll'");
134+
135+
ConVar viewmodel_offset_x("viewmodel_offset_x", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE);
136+
ConVar viewmodel_offset_y("viewmodel_offset_y", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE);
137+
ConVar viewmodel_offset_z("viewmodel_offset_z", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE);
138+
ConVar viewmodel_offset_pitch("viewmodel_offset_pitch", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE);
139+
ConVar viewmodel_offset_yaw("viewmodel_offset_yaw", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE);
140+
ConVar viewmodel_offset_roll("viewmodel_offset_roll", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE);
141+
#else
142+
ConVar tf_viewmodels_offset_override("tf_viewmodels_offset_override", "", FCVAR_CHEAT, "If set, this will override the position of all viewmodels. Usage 'x y z'");
143+
#endif
133144
#endif
134145

135-
void CTFViewModel::CalcViewModelView( CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles )
146+
#ifdef BDSBASE
147+
void CTFViewModel::CalcViewModelView(CBasePlayer* owner, const Vector& eyePosition, const QAngle& eyeAngles)
136148
{
137149
#if defined( CLIENT_DLL )
138150

139151
Vector vecNewOrigin = eyePosition;
140152
QAngle vecNewAngles = eyeAngles;
141153

142154
// Check for lowering the weapon
143-
C_TFPlayer *pPlayer = ToTFPlayer( owner );
155+
C_TFPlayer* pPlayer = ToTFPlayer(owner);
144156

145-
Assert( pPlayer );
157+
Assert(pPlayer);
146158

147159
bool bLowered = pPlayer->IsWeaponLowered();
148160

149-
QAngle vecLoweredAngles(0,0,0);
161+
QAngle vecLoweredAngles(0, 0, 0);
150162

151-
m_vLoweredWeaponOffset.x = Approach( bLowered ? cl_gunlowerangle.GetFloat() : 0, m_vLoweredWeaponOffset.x, cl_gunlowerspeed.GetFloat() );
163+
m_vLoweredWeaponOffset.x = Approach(bLowered ? cl_gunlowerangle.GetFloat() : 0, m_vLoweredWeaponOffset.x, cl_gunlowerspeed.GetFloat());
152164
vecLoweredAngles.x += m_vLoweredWeaponOffset.x;
153165

154166
vecNewAngles += vecLoweredAngles;
155167

156-
CTFWeaponBase *pWeapon = assert_cast< CTFWeaponBase* >( GetWeapon() );
157-
if ( pWeapon )
168+
CTFWeaponBase* pWeapon = assert_cast<CTFWeaponBase*>(GetWeapon());
169+
if (pWeapon)
158170
{
159171
bool bInspecting = pWeapon && pWeapon->GetInspectStage() != CTFWeaponBase::INSPECT_INVALID;
160172

161173
static float s_inspectInterp = 0.f;
162-
if ( bInspecting )
174+
if (bInspecting)
163175
{
164-
if ( pWeapon->GetInspectStage() == CTFWeaponBase::INSPECT_END )
176+
if (pWeapon->GetInspectStage() == CTFWeaponBase::INSPECT_END)
165177
{
166178
// use the last second of the anim
167179
const float flOutroDuration = 0.3f;
168-
s_inspectInterp = Clamp( ( pWeapon->GetInspectAnimEndTime() - gpGlobals->curtime ) - flOutroDuration, 0.f, 1.f );
180+
s_inspectInterp = Clamp((pWeapon->GetInspectAnimEndTime() - gpGlobals->curtime) - flOutroDuration, 0.f, 1.f);
169181
}
170182
else
171183
{
172-
s_inspectInterp = Clamp( s_inspectInterp + gpGlobals->frametime, 0.f, 1.f );
184+
s_inspectInterp = Clamp(s_inspectInterp + gpGlobals->frametime, 0.f, 1.f);
173185
}
174186
}
175187
else
176188
{
177-
s_inspectInterp = Clamp( s_inspectInterp - gpGlobals->frametime, 0.f, 1.f );
189+
s_inspectInterp = Clamp(s_inspectInterp - gpGlobals->frametime, 0.f, 1.f);
178190
}
179191

180192
// inspect custom offset
181-
if ( bInspecting )
193+
if (bInspecting)
182194
{
183195
CAttribute_String attrInspectOffsetVMOverride;
184-
CALL_ATTRIB_HOOK_STRING_ON_OTHER( pWeapon, attrInspectOffsetVMOverride, inspect_viewmodel_offset );
185-
const char *pszValue = attrInspectOffsetVMOverride.value().c_str();
186-
if ( pszValue && *pszValue )
196+
CALL_ATTRIB_HOOK_STRING_ON_OTHER(pWeapon, attrInspectOffsetVMOverride, inspect_viewmodel_offset);
197+
const char* pszValue = attrInspectOffsetVMOverride.value().c_str();
198+
if (pszValue && *pszValue)
187199
{
188200
Vector vmOffset;
189-
UTIL_StringToVector( vmOffset.Base(), pszValue );
201+
UTIL_StringToVector(vmOffset.Base(), pszValue);
190202

191203
Vector forward, right, up;
192-
AngleVectors( eyeAngles, &forward, &right, &up );
204+
AngleVectors(eyeAngles, &forward, &right, &up);
193205

194206
Vector vOffset = vmOffset.x * forward + vmOffset.y * right + vmOffset.z * up;
195-
vOffset *= Gain( s_inspectInterp, 0.5f );
207+
vOffset *= Gain(s_inspectInterp, 0.5f);
208+
vecNewOrigin += vOffset;
209+
}
210+
}
211+
212+
// are we overriding vm offset?
213+
const char* pszVMOffsetOverride = tf_viewmodels_offset_override.GetString();
214+
bool bForceOverride = (pszVMOffsetOverride && *pszVMOffsetOverride);
215+
216+
Vector positionOffset(0, 0, 0);
217+
QAngle anglesOffset(0, 0, 0);
218+
219+
if (bForceOverride)
220+
{
221+
float vmOffsets[6];
222+
UTIL_StringToFloatArray(vmOffsets, 6, pszVMOffsetOverride);
223+
positionOffset = Vector(vmOffsets[0], vmOffsets[1], vmOffsets[2]);
224+
anglesOffset = QAngle(vmOffsets[3], vmOffsets[4], vmOffsets[5]);
225+
}
226+
else
227+
{
228+
// min mode custom offset
229+
if (tf_use_min_viewmodels.GetBool())
230+
{
231+
positionOffset = pWeapon->GetViewmodelOffset();
232+
}
233+
234+
positionOffset += Vector(viewmodel_offset_x.GetFloat(), viewmodel_offset_y.GetFloat(), viewmodel_offset_z.GetFloat());
235+
anglesOffset += QAngle(viewmodel_offset_pitch.GetFloat(), viewmodel_offset_yaw.GetFloat(), viewmodel_offset_roll.GetFloat());
236+
}
237+
238+
Vector forward, right, up;
239+
AngleVectors(eyeAngles, &forward, &right, &up);
240+
241+
positionOffset = positionOffset.x * forward + positionOffset.y * right + positionOffset.z * up;
242+
positionOffset *= Gain(1.f - s_inspectInterp, 0.5f);
243+
vecNewOrigin += positionOffset;
244+
245+
vecNewAngles += anglesOffset * Gain(1.f - s_inspectInterp, 0.5f);
246+
}
247+
248+
BaseClass::CalcViewModelView(owner, vecNewOrigin, vecNewAngles);
249+
250+
#endif // CLIENT_DLL
251+
}
252+
#else
253+
void CTFViewModel::CalcViewModelView(CBasePlayer* owner, const Vector& eyePosition, const QAngle& eyeAngles)
254+
{
255+
#if defined( CLIENT_DLL )
256+
257+
Vector vecNewOrigin = eyePosition;
258+
QAngle vecNewAngles = eyeAngles;
259+
260+
// Check for lowering the weapon
261+
C_TFPlayer* pPlayer = ToTFPlayer(owner);
262+
263+
Assert(pPlayer);
264+
265+
bool bLowered = pPlayer->IsWeaponLowered();
266+
267+
QAngle vecLoweredAngles(0, 0, 0);
268+
269+
m_vLoweredWeaponOffset.x = Approach(bLowered ? cl_gunlowerangle.GetFloat() : 0, m_vLoweredWeaponOffset.x, cl_gunlowerspeed.GetFloat());
270+
vecLoweredAngles.x += m_vLoweredWeaponOffset.x;
271+
272+
vecNewAngles += vecLoweredAngles;
273+
274+
CTFWeaponBase* pWeapon = assert_cast<CTFWeaponBase*>(GetWeapon());
275+
if (pWeapon)
276+
{
277+
bool bInspecting = pWeapon && pWeapon->GetInspectStage() != CTFWeaponBase::INSPECT_INVALID;
278+
279+
static float s_inspectInterp = 0.f;
280+
if (bInspecting)
281+
{
282+
if (pWeapon->GetInspectStage() == CTFWeaponBase::INSPECT_END)
283+
{
284+
// use the last second of the anim
285+
const float flOutroDuration = 0.3f;
286+
s_inspectInterp = Clamp((pWeapon->GetInspectAnimEndTime() - gpGlobals->curtime) - flOutroDuration, 0.f, 1.f);
287+
}
288+
else
289+
{
290+
s_inspectInterp = Clamp(s_inspectInterp + gpGlobals->frametime, 0.f, 1.f);
291+
}
292+
}
293+
else
294+
{
295+
s_inspectInterp = Clamp(s_inspectInterp - gpGlobals->frametime, 0.f, 1.f);
296+
}
297+
298+
// inspect custom offset
299+
if (bInspecting)
300+
{
301+
CAttribute_String attrInspectOffsetVMOverride;
302+
CALL_ATTRIB_HOOK_STRING_ON_OTHER(pWeapon, attrInspectOffsetVMOverride, inspect_viewmodel_offset);
303+
const char* pszValue = attrInspectOffsetVMOverride.value().c_str();
304+
if (pszValue && *pszValue)
305+
{
306+
Vector vmOffset;
307+
UTIL_StringToVector(vmOffset.Base(), pszValue);
308+
309+
Vector forward, right, up;
310+
AngleVectors(eyeAngles, &forward, &right, &up);
311+
312+
Vector vOffset = vmOffset.x * forward + vmOffset.y * right + vmOffset.z * up;
313+
vOffset *= Gain(s_inspectInterp, 0.5f);
196314
vecNewOrigin += vOffset;
197315
}
198316
}
@@ -201,35 +319,36 @@ void CTFViewModel::CalcViewModelView( CBasePlayer *owner, const Vector& eyePosit
201319
bool bMinMode = tf_use_min_viewmodels.GetBool();
202320

203321
// are we overriding vm offset?
204-
const char *pszVMOffsetOverride = tf_viewmodels_offset_override.GetString();
205-
bool bForceOverride = ( pszVMOffsetOverride && *pszVMOffsetOverride );
322+
const char* pszVMOffsetOverride = tf_viewmodels_offset_override.GetString();
323+
bool bForceOverride = (pszVMOffsetOverride && *pszVMOffsetOverride);
206324
bMinMode |= bForceOverride;
207325

208326
// min mode custom offset
209-
if ( bMinMode )
327+
if (bMinMode)
210328
{
211329
Vector forward, right, up;
212-
AngleVectors( eyeAngles, &forward, &right, &up );
330+
AngleVectors(eyeAngles, &forward, &right, &up);
213331

214332
Vector viewmodelOffset;
215-
if ( bForceOverride )
333+
if (bForceOverride)
216334
{
217-
UTIL_StringToVector( viewmodelOffset.Base(), pszVMOffsetOverride );
335+
UTIL_StringToVector(viewmodelOffset.Base(), pszVMOffsetOverride);
218336
}
219337
else
220338
{
221339
viewmodelOffset = pWeapon->GetViewmodelOffset();
222340
}
223341
Vector vOffset = viewmodelOffset.x * forward + viewmodelOffset.y * right + viewmodelOffset.z * up;
224-
vOffset *= Gain( 1.f - s_inspectInterp, 0.5f );
342+
vOffset *= Gain(1.f - s_inspectInterp, 0.5f);
225343
vecNewOrigin += vOffset;
226344
}
227345
}
228346

229-
BaseClass::CalcViewModelView( owner, vecNewOrigin, vecNewAngles );
347+
BaseClass::CalcViewModelView(owner, vecNewOrigin, vecNewAngles);
230348

231349
#endif // CLIENT_DLL
232350
}
351+
#endif
233352

234353
#ifdef CLIENT_DLL
235354
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)