Make the client able to have tee's without weapons

Closed #8758
This commit is contained in:
ChillerDragon 2024-11-11 16:18:11 +08:00
parent 958926348e
commit 32cb056549
5 changed files with 7 additions and 6 deletions

View file

@ -199,7 +199,7 @@ Objects = [
NetIntRange("m_Health", 0, 10), NetIntRange("m_Health", 0, 10),
NetIntRange("m_Armor", 0, 10), NetIntRange("m_Armor", 0, 10),
NetIntRange("m_AmmoCount", 0, 10), NetIntRange("m_AmmoCount", 0, 10),
NetIntRange("m_Weapon", 0, 'NUM_WEAPONS-1'), NetIntRange("m_Weapon", -1, 'NUM_WEAPONS-1'),
NetIntRange("m_Emote", 0, len(Emotes)), NetIntRange("m_Emote", 0, len(Emotes)),
NetIntRange("m_AttackTick", 0, 'max_int'), NetIntRange("m_AttackTick", 0, 'max_int'),
]), ]),

View file

@ -166,7 +166,7 @@ Objects = [
NetIntRange("m_Health", 0, 10), NetIntRange("m_Health", 0, 10),
NetIntRange("m_Armor", 0, 10), NetIntRange("m_Armor", 0, 10),
NetIntAny("m_AmmoCount"), NetIntAny("m_AmmoCount"),
NetIntRange("m_Weapon", 0, 'NUM_WEAPONS-1'), NetIntRange("m_Weapon", -1, 'NUM_WEAPONS-1'),
NetEnum("m_Emote", Emotes), NetEnum("m_Emote", Emotes),
NetTick("m_AttackTick"), NetTick("m_AttackTick"),
NetFlag("m_TriggeredEvents", CoreEventFlags), NetFlag("m_TriggeredEvents", CoreEventFlags),

View file

@ -174,7 +174,7 @@ void CControls::OnMessage(int Msg, void *pRawMsg)
if(g_Config.m_ClAutoswitchWeapons) if(g_Config.m_ClAutoswitchWeapons)
m_aInputData[g_Config.m_ClDummy].m_WantedWeapon = pMsg->m_Weapon + 1; m_aInputData[g_Config.m_ClDummy].m_WantedWeapon = pMsg->m_Weapon + 1;
// We don't really know ammo count, until we'll switch to that weapon, but any non-zero count will suffice here // We don't really know ammo count, until we'll switch to that weapon, but any non-zero count will suffice here
m_aAmmoCount[pMsg->m_Weapon % NUM_WEAPONS] = 10; m_aAmmoCount[maximum(0, pMsg->m_Weapon % NUM_WEAPONS)] = 10;
} }
} }
@ -334,7 +334,7 @@ void CControls::OnRender()
if(g_Config.m_ClAutoswitchWeaponsOutOfAmmo && !GameClient()->m_GameInfo.m_UnlimitedAmmo && m_pClient->m_Snap.m_pLocalCharacter) if(g_Config.m_ClAutoswitchWeaponsOutOfAmmo && !GameClient()->m_GameInfo.m_UnlimitedAmmo && m_pClient->m_Snap.m_pLocalCharacter)
{ {
// Keep track of ammo count, we know weapon ammo only when we switch to that weapon, this is tracked on server and protocol does not track that // Keep track of ammo count, we know weapon ammo only when we switch to that weapon, this is tracked on server and protocol does not track that
m_aAmmoCount[m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS] = m_pClient->m_Snap.m_pLocalCharacter->m_AmmoCount; m_aAmmoCount[maximum(0, m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS)] = m_pClient->m_Snap.m_pLocalCharacter->m_AmmoCount;
// Autoswitch weapon if we're out of ammo // Autoswitch weapon if we're out of ammo
if(m_aInputData[g_Config.m_ClDummy].m_Fire % 2 != 0 && if(m_aInputData[g_Config.m_ClDummy].m_Fire % 2 != 0 &&
m_pClient->m_Snap.m_pLocalCharacter->m_AmmoCount == 0 && m_pClient->m_Snap.m_pLocalCharacter->m_AmmoCount == 0 &&

View file

@ -593,7 +593,7 @@ void CHud::RenderCursor()
RenderTools()->MapScreenToInterface(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y); RenderTools()->MapScreenToInterface(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y);
// render cursor // render cursor
int CurWeapon = m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS; int CurWeapon = maximum(0, m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS);
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f); Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
Graphics()->TextureSet(m_pClient->m_GameSkin.m_aSpriteWeaponCursors[CurWeapon]); Graphics()->TextureSet(m_pClient->m_GameSkin.m_aSpriteWeaponCursors[CurWeapon]);
Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, m_aCursorOffset[CurWeapon], m_pClient->m_Controls.m_aTargetPos[g_Config.m_ClDummy].x, m_pClient->m_Controls.m_aTargetPos[g_Config.m_ClDummy].y); Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, m_aCursorOffset[CurWeapon], m_pClient->m_Controls.m_aTargetPos[g_Config.m_ClDummy].x, m_pClient->m_Controls.m_aTargetPos[g_Config.m_ClDummy].y);
@ -684,7 +684,7 @@ void CHud::RenderAmmoHealthAndArmor(const CNetObj_Character *pCharacter)
// ammo display // ammo display
float AmmoOffsetY = GameClient()->m_GameInfo.m_HudHealthArmor ? 24 : 0; float AmmoOffsetY = GameClient()->m_GameInfo.m_HudHealthArmor ? 24 : 0;
int CurWeapon = pCharacter->m_Weapon % NUM_WEAPONS; int CurWeapon = pCharacter->m_Weapon % NUM_WEAPONS;
if(m_pClient->m_GameSkin.m_aSpriteWeaponProjectiles[CurWeapon].IsValid()) if(CurWeapon >= 0 && m_pClient->m_GameSkin.m_aSpriteWeaponProjectiles[CurWeapon].IsValid())
{ {
Graphics()->TextureSet(m_pClient->m_GameSkin.m_aSpriteWeaponProjectiles[CurWeapon]); Graphics()->TextureSet(m_pClient->m_GameSkin.m_aSpriteWeaponProjectiles[CurWeapon]);
if(AmmoOffsetY > 0) if(AmmoOffsetY > 0)

View file

@ -538,6 +538,7 @@ void CPlayers::RenderPlayer(
} }
// draw gun // draw gun
if(Player.m_Weapon >= 0)
{ {
if(!(RenderInfo.m_TeeRenderFlags & TEE_NO_WEAPON)) if(!(RenderInfo.m_TeeRenderFlags & TEE_NO_WEAPON))
{ {