![crosshair overlay for ironsight crosshair overlay for ironsight](https://fasrvoice348.weebly.com/uploads/1/2/5/3/125304749/596941461.jpg)
Now while we are still in the file we need some more. cin: 070105 - ironsighted mode changes Scroll down some and you will find the ViewModel::Spawn Edit it to look like this:
![crosshair overlay for ironsight crosshair overlay for ironsight](https://us.123rf.com/450wm/micelinjo/micelinjo1406/micelinjo140600047/28984543-set-of-thirty-vector-cross-hairs-isolated-on-white.jpg)
Offset = pWeapon->GetHL2MPWpnData().m_expOffset ĪngleVectors(ang, &forward, &right, &up) Offset.Init(cl_exp_test_wpn_offset_x.GetFloat(),ĬWeaponHL2MPBase *pWeapon = dynamic_cast (ToHL2MPPlayer(owner)->GetActiveWeapon()) Īng += pWeapon->GetHL2MPWpnData().m_expOriOffset this is a simple test mode to help determine the proper valuesĪng.x += cl_exp_test_wpn_ori_offset_x.GetFloat() Īng.y += cl_exp_test_wpn_ori_offset_y.GetFloat() Īng.z += cl_exp_test_wpn_ori_offset_z.GetFloat() Void CalcExpWpnOffsets(CBasePlayer *owner, Vector &pos, QAngle &ang) pPlayer->m_Local.m_iHideHUD |= HIDEHUD_CROSSHAIR ) If (gpGlobals->curtime - gIronsightedTime GetLocalPlayer()) Ĭ_BaseViewModel *pVm = pPlayer->GetViewModel() bind [ ironsight_toggle)ĬON_COMMAND(ironsight_toggle, "toggles ironsight mode for the current weapon") I bound this to a key for testing(i.e. last time ironsighted mode was toggled Void ExpWpnTestOffset(ConVar *pConVar, char *pszString)ĬBasePlayer *pPlayer = UTIL_PlayerByIndex(engine->GetLocalPlayer()) ĬWeaponHL2MPBase *pWeapon = dynamic_cast (pPlayer->GetActiveWeapon()) Ĭl_exp_test_wpn_offset_x.SetValue(pWeapon->GetHL2MPWpnData().m_expOffset.x) Ĭl_exp_test_wpn_offset_y.SetValue(pWeapon->GetHL2MPWpnData().m_expOffset.y) Ĭl_exp_test_wpn_offset_z.SetValue(pWeapon->GetHL2MPWpnData().m_expOffset.z) Ĭl_exp_test_wpn_ori_offset_x.SetValue(pWeapon->GetHL2MPWpnData().m_expOriOffset.x) Ĭl_exp_test_wpn_ori_offset_y.SetValue(pWeapon->GetHL2MPWpnData().m_expOriOffset.y) Ĭl_exp_test_wpn_ori_offset_z.SetValue(pWeapon->GetHL2MPWpnData().m_expOriOffset.z) ironsighted mode offests for a particular weapon this mode should only be used for calibrating the entering test mode (this will not be called upon cin: 070105 - applies existing weapon offsets when Void ExpWpnTestOffset(ConVar *pConVar, char *pszString) ĬonVar cl_exp_test_wpn_offset("cl_exp_test_wpn_offset", "0", 0, "Tests weapon offsets",ĬonVar cl_exp_test_wpn_offset_x("cl_exp_test_wpn_offset_x", "0") ĬonVar cl_exp_test_wpn_offset_y("cl_exp_test_wpn_offset_y", "0") ĬonVar cl_exp_test_wpn_offset_z("cl_exp_test_wpn_offset_z", "0") ĬonVar cl_exp_test_wpn_ori_offset_x("cl_exp_test_wpn_ori_offset_x", "0") ĬonVar cl_exp_test_wpn_ori_offset_y("cl_exp_test_wpn_ori_offset_y", "0") ĬonVar cl_exp_test_wpn_ori_offset_z("cl_exp_test_wpn_ori_offset_z", "0") #define SCREEN_OVERLAY_MATERIAL "vgui/screens/vgui_overlay" #define VIEWMODEL_ANIMATION_PARITY_BITS 3 THIS IS ALREADY IN THE CODE, just so you know where we are Then under that add so it should look like this. memdbgon must be the last include file in a. M_expOriOffset.z = pEt->GetFloat("zori", 0.0f) Ĭhange in the beginning of the file so it looks like this M_expOriOffset.y = pEt->GetFloat("yori", 0.0f) M_expOriOffset.x = pEt->GetFloat("xori", 0.0f) M_expOffset.z = pEt->GetFloat("z", 0.0f) M_expOffset.y = pEt->GetFloat("y", 0.0f) M_expOffset.x = pEt->GetFloat("x", 0.0f) KeyValues *pEt = pKeyValuesData->FindKey("ExpOffset") this just saves off the data in the script file for later use Void CHL2MPSWeaponInfo::Parse( KeyValues *pKeyValuesData, const char *szWeaponName ) Hl2mp_weapon_parse.cpp (DM) or weapon_parse.cpp (Singleplayer) Hl2mp_weapon_parse.h (DM) or weapon_parse.h (Singleplayer)Īdd this in the bottom of the file.