Skip to content

Commit

Permalink
fix some more things that wanted profile rather than slot number
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLubar committed Oct 13, 2023
1 parent cf50666 commit f981bb8
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 25 deletions.
18 changes: 5 additions & 13 deletions src/game/client/swarm/asw_briefing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,25 +754,17 @@ bool CASW_Briefing::IsWeaponUnlocked( const char *szWeaponClass )
return pPlayer->IsWeaponUnlocked( szWeaponClass );
}

void CASW_Briefing::SelectWeapon( int nProfileIndex, int nInventorySlot, int nEquipIndex, SteamItemInstanceID_t iItemInstance )
void CASW_Briefing::SelectWeapon( int nMarineIndex, int nInventorySlot, int nEquipIndex, SteamItemInstanceID_t iItemInstance )
{
C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
if ( !pPlayer )
return;

for ( int i = 0; i < ASWGameResource()->GetMaxMarineResources(); i++ )
{
C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource( i );
if ( !pMR )
continue;
C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource( nMarineIndex );
if ( !pMR )
return;

if ( pMR->GetProfileIndex() == nProfileIndex )
{
int nMarineResourceIndex = ASWGameResource()->GetIndexFor( pMR );
pPlayer->LoadoutSelectEquip( nMarineResourceIndex, nInventorySlot, nEquipIndex, iItemInstance );
return;
}
}
pPlayer->LoadoutSelectEquip( nMarineIndex, nInventorySlot, nEquipIndex, iItemInstance );
}

void CASW_Briefing::ToggleLocalPlayerReady()
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/swarm/asw_briefing.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class CASW_Briefing : public IBriefing

virtual void SelectMarine( int nOrder, int nProfileIndex, int nPreferredLobbySlot );
virtual void SelectBot( int nOrder, int nProfileIndex );
virtual void SelectWeapon( int nProfileIndex, int nInventorySlot, int nEquipIndex, SteamItemInstanceID_t iItemInstance );
virtual void SelectWeapon( int nMarineIndex, int nInventorySlot, int nEquipIndex, SteamItemInstanceID_t iItemInstance );
virtual void AutoSelectFullSquadForSingleplayer( int nFirstSelectedProfileIndex );

virtual void ResetLastChatterTime() { m_flLastSelectionChatterTime = 0.0f; }
Expand Down
14 changes: 7 additions & 7 deletions src/game/client/swarm/gameui/swarm/vloadouts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,22 +411,22 @@ bool Loadouts::IsWeaponUnlocked( const char *szWeaponClass )
return UTIL_ASW_CommanderLevelAtLeast( NULL, GetWeaponLevelRequirement( szWeaponClass ), -1 );
}

void Loadouts::SelectWeapon( int nProfileIndex, int nInventorySlot, int nEquipIndex, SteamItemInstanceID_t iItemInstance )
void Loadouts::SelectWeapon( int nMarineIndex, int nInventorySlot, int nEquipIndex, SteamItemInstanceID_t iItemInstance )
{
if ( nInventorySlot == ASW_INVENTORY_SLOT_PRIMARY )
{
asw_default_primary[nProfileIndex].SetValue( nEquipIndex );
rd_equipped_weapon_primary[nProfileIndex].SetValue( VarArgs( "%llu", iItemInstance ) );
asw_default_primary[nMarineIndex].SetValue( nEquipIndex );
rd_equipped_weapon_primary[nMarineIndex].SetValue( VarArgs( "%llu", iItemInstance ) );
}
else if ( nInventorySlot == ASW_INVENTORY_SLOT_SECONDARY )
{
asw_default_secondary[nProfileIndex].SetValue( nEquipIndex );
rd_equipped_weapon_secondary[nProfileIndex].SetValue( VarArgs( "%llu", iItemInstance ) );
asw_default_secondary[nMarineIndex].SetValue( nEquipIndex );
rd_equipped_weapon_secondary[nMarineIndex].SetValue( VarArgs( "%llu", iItemInstance ) );
}
else if ( nInventorySlot == ASW_INVENTORY_SLOT_EXTRA )
{
asw_default_extra[nProfileIndex].SetValue( nEquipIndex );
rd_equipped_weapon_extra[nProfileIndex].SetValue( VarArgs( "%llu", iItemInstance ) );
asw_default_extra[nMarineIndex].SetValue( nEquipIndex );
rd_equipped_weapon_extra[nMarineIndex].SetValue( VarArgs( "%llu", iItemInstance ) );
}

engine->ClientCmd_Unrestricted( "host_writeconfig\n" );
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/swarm/gameui/swarm/vloadouts.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Loadouts : public CBaseModFrame, public IBriefing
bool IsCommanderSpeaking( int nLobbySlot ) override { return false; }
void SelectMarine( int nOrder, int nProfileIndex, int nPreferredLobbySlot ) override {}
void SelectBot( int nOrder, int nProfileIndex ) override {}
void SelectWeapon( int nProfileIndex, int nInventorySlot, int nEquipIndex, SteamItemInstanceID_t iItemInstance ) override;
void SelectWeapon( int nMarineIndex, int nInventorySlot, int nEquipIndex, SteamItemInstanceID_t iItemInstance ) override;
void AutoSelectFullSquadForSingleplayer( int nFirstSelectedProfileIndex ) override {}
void ResetLastChatterTime() override {}
const static IBriefing_ItemInstance s_EmptyItemInstance;
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/swarm/ibriefing.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ abstract_class IBriefing

virtual void SelectMarine( int nOrder, int nProfileIndex, int nPreferredLobbySlot ) = 0;
virtual void SelectBot( int nOrder, int nProfileIndex) = 0;
virtual void SelectWeapon( int nProfileIndex, int nInventorySlot, int nEquipIndex, SteamItemInstanceID_t iItemInstance ) = 0;
virtual void SelectWeapon( int nMarineIndex, int nInventorySlot, int nEquipIndex, SteamItemInstanceID_t iItemInstance ) = 0;
virtual void AutoSelectFullSquadForSingleplayer( int nFirstSelectedProfileIndex ) = 0;

virtual void ResetLastChatterTime() = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/swarm/rd_collections_equipment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ void CRD_Collection_Panel_Equipment::OnCommand( const char *command )
pMedalStore->OnSelectedEquipment( m_pWeapon->Extra, m_pWeapon->EquipIndex );
}

m_pTab->m_pBriefing->SelectWeapon( m_pTab->m_pProfile->m_ProfileIndex, m_pTab->m_nInventorySlot, m_pWeapon->EquipIndex, m_ItemInstance.ItemID );
m_pTab->m_pBriefing->SelectWeapon( m_pTab->m_nLobbySlot, m_pTab->m_nInventorySlot, m_pWeapon->EquipIndex, m_ItemInstance.ItemID );

m_pTab->m_pParent->MarkForDeletion();
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/server/swarm/asw_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ bool CASW_Player::ClientCommand( const CCommand &args )
}
}
CASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource( iMarineIndex );
if ( !pMR || pMR->GetCommander() != this || pMR->GetProfileIndex() == iProfileIndex )
if ( !pMR || pMR->GetCommander() != this || pMR->GetProfileIndex() != iProfileIndex )
{
Warning( "Player sent bad loadouta command\n" );
return false;
Expand Down

0 comments on commit f981bb8

Please sign in to comment.