Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIP and TDM Game modes #588

Merged
merged 26 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
390a41f
some easy fixes, new smac loadout picture
AdamTadeusz Sep 14, 2024
a02b013
working vip gamemode
AdamTadeusz Sep 14, 2024
1c3369c
count votes for game type once only
AdamTadeusz Sep 15, 2024
13cff17
fixes to menu logic, fixes to menu logic with regards to vip
AdamTadeusz Sep 15, 2024
7942144
hud support for tdm, scoring for tdm
AdamTadeusz Sep 15, 2024
95b45ee
TDM hud, win condition
AdamTadeusz Sep 16, 2024
0e00343
smac item flags to allow selecting on empty and closer to other weapons
AdamTadeusz Sep 16, 2024
f950efc
resolve conflict
AdamTadeusz Sep 16, 2024
1de6c17
cleanup, vip weapon list looks uneven so gave two more weapons
AdamTadeusz Sep 16, 2024
e480a8a
wrong texture name for jitte scoped no
AdamTadeusz Sep 16, 2024
12aaff7
Merge branch 'master' into 038_VIPFixes
AdamTadeusz Sep 16, 2024
a9b9058
remove smac loadout pic png and pdn files
AdamTadeusz Sep 16, 2024
8d322a7
SMAC weapon spray to mirror SRM weapon spray (placeholder), allow tog…
AdamTadeusz Sep 16, 2024
7ab7222
Capzones only allow capping when round is live
AdamTadeusz Sep 17, 2024
b3d3d6b
oops
AdamTadeusz Sep 17, 2024
756abaa
add game objective below the round status box
AdamTadeusz Sep 17, 2024
e63ebd0
option to spawn ghost on vip corpse
AdamTadeusz Sep 17, 2024
9fde37a
Do not award ghost cap bonus to team escorting vip if vip died
AdamTadeusz Sep 17, 2024
04e95c6
move smac pictures to neoAssets
AdamTadeusz Sep 21, 2024
dd0f760
merge master
AdamTadeusz Sep 21, 2024
04b1046
Give VIP default items again
AdamTadeusz Sep 21, 2024
6b0336f
review comments
AdamTadeusz Sep 22, 2024
0f1e2a3
const getRoundRemainingTime, GetLocalNEOPlayer
AdamTadeusz Sep 22, 2024
4d7b2ef
reset objective text
AdamTadeusz Sep 22, 2024
e1d11a6
merge
AdamTadeusz Oct 3, 2024
5186835
Merge branch 'master' into 038_VIPFixes
AdamTadeusz Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions mp/game/neo/scripts/weapon_smac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ WeaponData
"anim_prefix" "smac"
"bucket" "0"
"bucket_position" "0"
"Damage" "0"
"Penetration" "0.0"
"Damage" "12"
"Penetration" "12.0"
"CycleTime" "0.085" // time between shots

"TPMuzzleFlashScale" "0.5"
Expand All @@ -20,9 +20,14 @@ WeaponData
"primary_ammo" "AMMO_SMAC"
"secondary_ammo" "None"

"weight" "3"
"item_flags" "0"
"autoswitchfrom" "0"

"weight" "3"
// ITEM_FLAG_SELECTONEMPTY = 1
// ITEM_FLAG_NOAUTOSWITCHEMPTY = (1 << 2)
// ITEM_FLAG_DOHITLOCATIONDMG = (1 << 5)
// Combined as int = 37
"item_flags" "37"

"AimType" "1"

Expand Down
17 changes: 15 additions & 2 deletions mp/src/game/client/neo/c_neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,16 @@ class NeoClassMenu_Cb : public ICommandCallback
virtual void CommandCallback(const CCommand& command)
{
auto team = GetLocalPlayerTeam();

if(team < FIRST_GAME_TEAM)
{
return;
}

auto playerNeoClass = C_NEO_Player::GetLocalNEOPlayer()->m_iNeoClass;
if (playerNeoClass == NEO_CLASS_VIP)
{
return;
}

vgui::EditablePanel *panel = dynamic_cast<vgui::EditablePanel*>
(GetClientModeNormal()->GetViewport()->FindChildByName(PANEL_CLASS));
Expand Down Expand Up @@ -456,7 +461,7 @@ void C_NEO_Player::CheckThermOpticButtons()

if ((m_afButtonPressed & IN_THERMOPTIC) && IsAlive())
{
if (GetClass() != NEO_CLASS_RECON && GetClass() != NEO_CLASS_ASSAULT)
if (GetClass() == NEO_CLASS_SUPPORT)
{
return;
}
Expand Down Expand Up @@ -1360,6 +1365,8 @@ float C_NEO_Player::GetCrouchSpeed(void) const
return NEO_ASSAULT_CROUCH_SPEED * GetBackwardsMovementPenaltyScale();
case NEO_CLASS_SUPPORT:
return NEO_SUPPORT_CROUCH_SPEED * GetBackwardsMovementPenaltyScale();
case NEO_CLASS_VIP:
return NEO_VIP_CROUCH_SPEED * GetBackwardsMovementPenaltyScale();
default:
return NEO_BASE_CROUCH_SPEED * GetBackwardsMovementPenaltyScale();
}
Expand All @@ -1375,6 +1382,8 @@ float C_NEO_Player::GetNormSpeed(void) const
return NEO_ASSAULT_NORM_SPEED * GetBackwardsMovementPenaltyScale();
case NEO_CLASS_SUPPORT:
return NEO_SUPPORT_NORM_SPEED * GetBackwardsMovementPenaltyScale();
case NEO_CLASS_VIP:
return NEO_VIP_NORM_SPEED * GetBackwardsMovementPenaltyScale();
default:
return NEO_BASE_NORM_SPEED * GetBackwardsMovementPenaltyScale();
}
Expand All @@ -1390,6 +1399,8 @@ float C_NEO_Player::GetWalkSpeed(void) const
return NEO_ASSAULT_WALK_SPEED * GetBackwardsMovementPenaltyScale();
case NEO_CLASS_SUPPORT:
return NEO_SUPPORT_WALK_SPEED * GetBackwardsMovementPenaltyScale();
case NEO_CLASS_VIP:
return NEO_VIP_WALK_SPEED * GetBackwardsMovementPenaltyScale();
default:
return NEO_BASE_WALK_SPEED * GetBackwardsMovementPenaltyScale();
}
Expand All @@ -1405,6 +1416,8 @@ float C_NEO_Player::GetSprintSpeed(void) const
return NEO_ASSAULT_SPRINT_SPEED * GetBackwardsMovementPenaltyScale();
case NEO_CLASS_SUPPORT:
return NEO_SUPPORT_SPRINT_SPEED * GetBackwardsMovementPenaltyScale();
case NEO_CLASS_VIP:
return NEO_VIP_SPRINT_SPEED * GetBackwardsMovementPenaltyScale();
default:
return NEO_BASE_SPRINT_SPEED * GetBackwardsMovementPenaltyScale();
}
Expand Down
8 changes: 8 additions & 0 deletions mp/src/game/client/neo/game_controls/neo_classmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ void CNeoClassMenu::UpdateSkinImages(int classNumber = -1)
classNumber = player->m_iNeoClass.Get();
}

if (classNumber > NEO_CLASS_SUPPORT || classNumber < NEO_CLASS_RECON)
{
m_pSkinPanel1->SetImage("cm/none");
m_pSkinPanel2->SetImage("cm/none");
m_pSkinPanel3->SetImage("cm/none");
return;
}

m_pSkinPanel1->SetImage(playerModels[teamNumber * 9 + (classNumber * 3) + 0]);
m_pSkinPanel2->SetImage(playerModels[teamNumber * 9 + (classNumber * 3) + 1]);
m_pSkinPanel3->SetImage(playerModels[teamNumber * 9 + (classNumber * 3) + 2]);
Expand Down
12 changes: 7 additions & 5 deletions mp/src/game/client/neo/game_controls/neo_loadoutmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,16 @@ void CNeoLoadoutMenu::ChangeMenu(const char* menuName = NULL)
void CNeoLoadoutMenu::OnKeyCodeReleased(vgui::KeyCode code)
{
switch (code) {
case 94: // F3 - Close the menu
case KEY_F3: // F3 - Close the menu
ChangeMenu(NULL);
case 65: // Spacebar - Try to equip weapon in the second slot like in the base game
break;
case KEY_SPACE: // Spacebar - Try to equip weapon in the second slot like in the base game
OnCommand("loadout 1");
break;
default:
// Ignore other key presses
break;
}

// Ignore other Key presses
//BaseClass::OnKeyCodeReleased(code);
}

void CNeoLoadoutMenu::OnButtonPressed(KeyValues *data)
Expand Down
77 changes: 76 additions & 1 deletion mp/src/game/client/neo/ui/neo_hud_round_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ void CNEOHud_RoundState::UpdateStateForNeoHudElementDraw()
memset(m_wszTime, 0, sizeof(m_wszTime));
memset(m_wszLeftTeamScore, 0, sizeof(m_wszLeftTeamScore));
memset(m_wszRightTeamScore, 0, sizeof(m_wszRightTeamScore));
memset(m_wszGameTypeDescription, 0, sizeof(m_wszGameTypeDescription));

// Exactly zero means there's no time limit, so we don't need to draw anything.
if (roundTimeLeft == 0)
Expand Down Expand Up @@ -276,8 +277,72 @@ void CNEOHud_RoundState::UpdateStateForNeoHudElementDraw()
}

char szPlayersAliveANSI[9] = {};
V_sprintf_safe(szPlayersAliveANSI, "%i vs %i", m_iLeftPlayersAlive, m_iRightPlayersAlive);
if (NEORules()->GetGameType() == NEO_GAME_TYPE_TDM)
{
if (localPlayerTeam == TEAM_JINRAI || localPlayerTeam == TEAM_NSF) {
V_sprintf_safe(szPlayersAliveANSI, "%i:%i", GetGlobalTeam(localPlayerTeam)->Get_Score(), GetGlobalTeam(NEORules()->GetOpposingTeam(localPlayerTeam))->Get_Score());
}
else {
V_sprintf_safe(szPlayersAliveANSI, "%i:%i", GetGlobalTeam(TEAM_JINRAI)->Get_Score(), GetGlobalTeam(TEAM_NSF)->Get_Score());
}
}
else
{
V_sprintf_safe(szPlayersAliveANSI, "%i vs %i", m_iLeftPlayersAlive, m_iRightPlayersAlive);
}
g_pVGuiLocalize->ConvertANSIToUnicode(szPlayersAliveANSI, m_wszPlayersAliveUnicode, sizeof(m_wszPlayersAliveUnicode));

// Update Objective
switch (NEORules()->GetGameType()) {
case NEO_GAME_TYPE_TDM:
V_sprintf_safe(szGameTypeDescription, "Score the most Points\n");
break;
case NEO_GAME_TYPE_CTG:
V_sprintf_safe(szGameTypeDescription, "Capture the Ghost\n");
break;
case NEO_GAME_TYPE_VIP:
if (localPlayerTeam == NEORules()->m_iEscortingTeam.Get())
{
if (NEORules()->GhostExists())
{
V_sprintf_safe(szGameTypeDescription, "VIP down, prevent Ghost capture\n");
}
else
{
V_sprintf_safe(szGameTypeDescription, "Escort the VIP\n");
}
}
else
{
if (NEORules()->GhostExists())
{
V_sprintf_safe(szGameTypeDescription, "HVT down, secure the Ghost\n");
}
else
{
V_sprintf_safe(szGameTypeDescription, "Eliminate the HVT\n");
}
}
break;
default:
V_sprintf_safe(szGameTypeDescription, "Await further orders\n");
break;
}

C_NEO_Player* localPlayer = C_NEO_Player::GetLocalNEOPlayer();
if (localPlayer);
{
if (NEORules()->IsRoundPreRoundFreeze() || localPlayer->m_nButtons & IN_SCORE)
{
m_iGameTypeDescriptionState = MIN(m_iGameTypeDescriptionState + 1, Q_UnicodeLength(szGameTypeDescription));
}
else
{
m_iGameTypeDescriptionState = MAX(m_iGameTypeDescriptionState - 1, 0);
}

g_pVGuiLocalize->ConvertANSIToUnicode(szGameTypeDescription, m_wszGameTypeDescription, m_iGameTypeDescriptionState * sizeof(wchar_t));
}
}

void CNEOHud_RoundState::DrawNeoHudElement()
Expand Down Expand Up @@ -462,6 +527,16 @@ void CNEOHud_RoundState::DrawNeoHudElement()
surface()->DrawSetTextPos(m_iXpos - (fontWidth / 2), neo_cl_squad_hud_original.GetBool() ? Y_POS : m_iSmallFontHeight);
surface()->DrawPrintText(m_wszTime, 6);

// Draw Game Type Description
if (m_iGameTypeDescriptionState)
{
surface()->DrawSetTextFont(m_hOCRFont);
surface()->GetTextSize(m_hOCRFont, m_wszGameTypeDescription, fontWidth, fontHeight);
surface()->DrawSetTextColor(COLOR_WHITE);
surface()->DrawSetTextPos(m_iXpos - (fontWidth / 2), m_iBoxYEnd);
surface()->DrawPrintText(m_wszGameTypeDescription, Q_UnicodeLength(m_wszGameTypeDescription));
}

CheckActiveStar();
}

Expand Down
7 changes: 7 additions & 0 deletions mp/src/game/client/neo/ui/neo_hud_round_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class ImagePanel;
class ImageList;
}

constexpr int MAX_GAME_TYPE_OBJECTIVE_LENGTH = 33;

class CNEOHud_RoundState : public CNEOHud_ChildElement, public CHudElement, public vgui::Panel
{
DECLARE_CLASS_SIMPLE(CNEOHud_RoundState, Panel);
Expand Down Expand Up @@ -64,6 +66,11 @@ class CNEOHud_RoundState : public CNEOHud_ChildElement, public CHudElement, publ
wchar_t m_wszRightTeamScore[3] = {};
wchar_t m_wszPlayersAliveUnicode[9] = {};
wchar_t m_wszStatusUnicode[24] = {};
wchar_t m_wszGameTypeDescription[MAX_GAME_TYPE_OBJECTIVE_LENGTH] = {};
char szGameTypeDescription[MAX_GAME_TYPE_OBJECTIVE_LENGTH] = {};

// Game Description
short m_iGameTypeDescriptionState = 0;

// Totals info
int m_iLeftPlayersAlive = 0;
Expand Down
3 changes: 3 additions & 0 deletions mp/src/game/client/viewpostprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2963,6 +2963,9 @@ void DoEnginePostProcessing( int x, int y, int w, int h, bool bFlashlightIsOn, b
DoThermalVision(x, y, w, h);
break;
}
case NEO_CLASS_VIP:
// Cry a little
break;
default:
Assert(false);
}
Expand Down
2 changes: 2 additions & 0 deletions mp/src/game/server/hl2/hl2_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ static inline float GetAuxChargeRate(CBaseCombatCharacter *player)
return 5.0f; // 100 units in 20 seconds
case NEO_CLASS_ASSAULT:
return 2.5f; // 100 units in 40 seconds
case NEO_CLASS_VIP:
return 2.5f; // 100 units in 40 seconds
default:
break;
}
Expand Down
2 changes: 2 additions & 0 deletions mp/src/game/server/hl2mp/hl2mp_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,9 @@ void CHL2MP_Player::Event_Killed( const CTakeDamageInfo &info )
iScoreToAdd = -1;
}

#ifndef NEO
GetGlobalTeam( pAttacker->GetTeamNumber() )->AddScore( iScoreToAdd );
#endif
}

FlashlightTurnOff();
Expand Down
Loading