Skip to content

Commit 600fcff

Browse files
authored
Merge branch 'master' into restream
2 parents a10248e + b98c091 commit 600fcff

File tree

15 files changed

+115
-24
lines changed

15 files changed

+115
-24
lines changed

Client/core/CCommandFuncs.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@ void CCommandFuncs::Reconnect(const char* szParameters)
318318
// Start the connect
319319
if (CCore::GetSingleton().GetConnectManager()->Reconnect(strHost.c_str(), usPort, strPassword.c_str(), false))
320320
{
321+
if (CCore::GetSingleton().GetConnectManager()->WasQuickConnect())
322+
{
323+
CCore::GetSingleton().GetConnectManager()->SetQuickConnect(false);
324+
}
321325
CCore::GetSingleton().GetConsole()->Printf(_("reconnect: Reconnecting to %s:%u..."), strHost.c_str(), usPort);
322326
}
323327
else

Client/core/CConnectManager.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ class CConnectManager
2626

2727
bool Abort();
2828

29+
bool WasQuickConnect() const noexcept { return m_quickConnect; }
30+
2931
void DoPulse();
3032

3133
void OnServerExists();
3234

35+
void SetQuickConnect(bool quick) noexcept { m_quickConnect = quick; }
36+
3337
static void OpenServerFirewall(in_addr Address, ushort usHttpPort = 80, bool bHighPriority = false);
3438

3539
static bool StaticProcessPacket(unsigned char ucPacketID, class NetBitStreamInterface& bitStream);
@@ -59,4 +63,5 @@ class CConnectManager
5963
bool m_bNotifyServerBrowser;
6064

6165
bool CheckNickProvided(const char* szNick);
66+
bool m_quickConnect{false};
6267
};

Client/core/CMainMenu.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,9 @@ bool CMainMenu::OnMenuClick(CGUIMouseEventArgs Args)
850850
}
851851

852852
break;
853+
case MENU_ITEM_QUICK_CONNECT:
854+
AskUserIfHeWantsToDisconnect(m_pHoveredItem->menuType);
855+
return true;
853856
default:
854857
break;
855858
}
@@ -914,7 +917,8 @@ bool CMainMenu::OnQuickConnectButtonClick(CGUIElement* pElement, bool left)
914917
ShowNetworkNotReadyWindow();
915918
return true;
916919
}
917-
920+
921+
g_pCore->GetConnectManager()->SetQuickConnect(true);
918922
g_pCore->GetCommands()->Execute("reconnect", "");
919923
}
920924
else
@@ -1262,6 +1266,9 @@ void CMainMenu::WantsToDisconnectCallBack(void* pData, uint uiButton)
12621266
case MENU_ITEM_DISCONNECT:
12631267
OnDisconnectButtonClick();
12641268
break;
1269+
case MENU_ITEM_QUICK_CONNECT:
1270+
OnQuickConnectButtonClick(nullptr, true);
1271+
break;
12651272
default:
12661273
break;
12671274
}

Client/game_sa/CHudSA.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ void CHudSA::InitComponentList()
122122
{1, HUD_VEHICLE_NAME, 1, FUNC_DrawVehicleName, 1, 0xCC, 0xC3},
123123
{1, HUD_AREA_NAME, 1, FUNC_DrawAreaName, 1, 0xCC, 0xC3},
124124
{1, HUD_RADAR, 1, FUNC_DrawRadar, 1, 0xCC, 0xC3},
125+
{1, HUD_RADAR_MAP, 1, FUNC_CRadar_DrawMap, 1, 0xCC, 0xC3},
126+
{1, HUD_RADAR_BLIPS, 1, FUNC_CRadar_DrawBlips, 1, 0xCC, 0xC3},
127+
{1, HUD_RADAR_ALTIMETER, 1, CODE_ShowRadarAltimeter, 2, 0xCC, 0xEB30},
125128
{1, HUD_CLOCK, 0, VAR_DisableClock, 1, 1, 0},
126129
{1, HUD_RADIO, 1, FUNC_DrawRadioName, 1, 0xCC, 0xC3},
127130
{1, HUD_WANTED, 1, FUNC_DrawWantedLevel, 1, 0xCC, 0xC3},

Client/game_sa/CHudSA.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@
4949
#define FUNC_CSprite2d_Draw 0x728350
5050
#define FUNC_CSprite_RenderOneXLUSprite 0x70D000
5151

52+
#define FUNC_CRadar_DrawMap 0x586B00
53+
#define FUNC_CRadar_DrawBlips 0x588050
54+
5255
#define CODE_ShowMoney 0x58F47D
56+
#define CODE_ShowRadarAltimeter 0x58A5A6
5357

5458
#define VAR_CTheScripts_bDrawCrossHair 0xA44490
5559
#define VAR_RSGlobal 0xC17040

Client/mods/deathmatch/logic/CClientExplosionManager.cpp

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@ bool CClientExplosionManager::Hook_StaticExplosionCreation(CEntity* pGameExplodi
3939
return g_pExplosionManager->Hook_ExplosionCreation(pGameExplodingEntity, pGameCreator, vecPosition, explosionType);
4040
}
4141

42+
eWeaponType CClientExplosionManager::GetWeaponTypeFromExplosionType(const eExplosionType explosionType)
43+
{
44+
switch (explosionType) {
45+
case EXP_TYPE_GRENADE:
46+
return WEAPONTYPE_GRENADE;
47+
case EXP_TYPE_MOLOTOV:
48+
return WEAPONTYPE_MOLOTOV;
49+
case EXP_TYPE_ROCKET:
50+
case EXP_TYPE_ROCKET_WEAK:
51+
return WEAPONTYPE_ROCKET;
52+
case EXP_TYPE_TANK_GRENADE:
53+
return WEAPONTYPE_TANK_GRENADE;
54+
default:
55+
return WEAPONTYPE_EXPLOSION;
56+
}
57+
}
58+
4259
bool CClientExplosionManager::Hook_ExplosionCreation(CEntity* pGameExplodingEntity, CEntity* pGameCreator, const CVector& vecPosition,
4360
eExplosionType explosionType)
4461
{
@@ -53,7 +70,23 @@ bool CClientExplosionManager::Hook_ExplosionCreation(CEntity* pGameExplodingEnti
5370
CClientEntity* const pResponsible = pPools->GetClientEntity(reinterpret_cast<DWORD*>(pResponsibleGameEntity->GetInterface()));
5471

5572
if (!pResponsible)
56-
return false;
73+
{
74+
if (!pGameCreator)
75+
return false;
76+
77+
CClientPlayer* localPlayer = m_pManager->GetPlayerManager()->GetLocalPlayer();
78+
if (!localPlayer || localPlayer->GetGameEntity() != pGameCreator)
79+
return false;
80+
81+
eWeaponType explosionWeaponType = GetWeaponTypeFromExplosionType(explosionType);
82+
83+
CLuaArguments arguments;
84+
arguments.PushNumber(vecPosition.fX);
85+
arguments.PushNumber(vecPosition.fY);
86+
arguments.PushNumber(vecPosition.fZ);
87+
arguments.PushNumber(explosionWeaponType);
88+
return localPlayer->CallEvent("onClientExplosion", arguments, true);
89+
}
5790

5891
// Determine the used weapon
5992
eWeaponType explosionWeaponType = WEAPONTYPE_EXPLOSION;
@@ -167,25 +200,22 @@ CExplosion* CClientExplosionManager::Create(eExplosionType explosionType, CVecto
167200
if (responsibleWeapon != WEAPONTYPE_UNARMED)
168201
m_LastWeaponType = responsibleWeapon;
169202
else
203+
m_LastWeaponType = GetWeaponTypeFromExplosionType(explosionType);
204+
205+
if (pCreator && pCreator->IsLocalEntity())
170206
{
171-
switch (explosionType)
207+
bool allowExplosion = Hook_ExplosionCreation(nullptr, pGameCreator, vecPosition, explosionType);
208+
if (!allowExplosion)
209+
return nullptr;
210+
}
211+
else if (!pCreator)
212+
{
213+
CClientPlayer* localPlayer = m_pManager->GetPlayerManager()->GetLocalPlayer();
214+
if (localPlayer)
172215
{
173-
case EXP_TYPE_GRENADE:
174-
m_LastWeaponType = WEAPONTYPE_GRENADE;
175-
break;
176-
case EXP_TYPE_MOLOTOV:
177-
m_LastWeaponType = WEAPONTYPE_MOLOTOV;
178-
break;
179-
case EXP_TYPE_ROCKET:
180-
case EXP_TYPE_ROCKET_WEAK:
181-
m_LastWeaponType = WEAPONTYPE_ROCKET;
182-
break;
183-
case EXP_TYPE_TANK_GRENADE:
184-
m_LastWeaponType = WEAPONTYPE_TANK_GRENADE;
185-
break;
186-
default:
187-
m_LastWeaponType = WEAPONTYPE_EXPLOSION;
188-
break;
216+
bool allowExplosion = Hook_ExplosionCreation(nullptr, localPlayer->GetGameEntity(), vecPosition, explosionType);
217+
if (!allowExplosion)
218+
return nullptr;
189219
}
190220
}
191221

Client/mods/deathmatch/logic/CClientExplosionManager.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ class CClientExplosionManager
3434
CClientEntityPtr m_pLastCreator;
3535

3636
private:
37-
CClientManager* m_pManager;
37+
CClientManager* m_pManager;
38+
eWeaponType GetWeaponTypeFromExplosionType(const eExplosionType explosionType);
3839
};

Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ ADD_ENUM(HUD_MONEY, "money")
104104
ADD_ENUM(HUD_VEHICLE_NAME, "vehicle_name")
105105
ADD_ENUM(HUD_AREA_NAME, "area_name")
106106
ADD_ENUM(HUD_RADAR, "radar")
107+
ADD_ENUM(HUD_RADAR_MAP, "radar_map")
108+
ADD_ENUM(HUD_RADAR_BLIPS, "radar_blips")
109+
ADD_ENUM(HUD_RADAR_ALTIMETER, "radar_altimeter")
107110
ADD_ENUM(HUD_CLOCK, "clock")
108111
ADD_ENUM(HUD_RADIO, "radio")
109112
ADD_ENUM(HUD_WANTED, "wanted")

Client/mods/deathmatch/logic/luadefs/CLuaPlayerDefs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,8 @@ bool CLuaPlayerDefs::IsPlayerCrosshairVisible()
653653

654654
bool CLuaPlayerDefs::SetPlayerHudComponentProperty(eHudComponent component, eHudComponentProperty property, std::variant<CVector2D, float, bool, std::string> value)
655655
{
656-
if (component == HUD_ALL || component == HUD_CROSSHAIR || component == HUD_VITAL_STATS || component == HUD_HELP_TEXT || component == HUD_RADAR)
656+
if (component == HUD_ALL || component == HUD_CROSSHAIR || component == HUD_VITAL_STATS || component == HUD_HELP_TEXT || component == HUD_RADAR
657+
|| component == HUD_RADAR_MAP || component == HUD_RADAR_BLIPS || component == HUD_RADAR_ALTIMETER)
657658
return false;
658659

659660
CHud* hud = g_pGame->GetHud();

Client/sdk/game/CHud.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ enum eHudComponent
3131
HUD_ALL,
3232
HUD_VITAL_STATS,
3333
HUD_HELP_TEXT,
34+
HUD_RADAR_MAP,
35+
HUD_RADAR_BLIPS,
36+
HUD_RADAR_ALTIMETER,
3437
};
3538

3639
enum class eHudComponentProperty

0 commit comments

Comments
 (0)