Skip to content

Commit 9eea6e3

Browse files
committed
Fix map-specific weapon scripts not updating HUD icons
1 parent 6cc2937 commit 9eea6e3

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

sp/src/game/client/weapons_resource.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ void WeaponsResource::LoadWeaponSprites( WEAPON_FILE_INFO_HANDLE hWeaponFileInfo
104104
pWeaponInfo->iconSmall = NULL;
105105

106106
char sz[128];
107+
108+
#ifdef MAPBASE
109+
if ( pWeaponInfo->bCustom )
110+
{
111+
// Load the map-specific script instead
112+
extern const char *g_MapName;
113+
Q_snprintf( sz, sizeof( sz ), "maps/%s_%s", g_MapName, pWeaponInfo->szClassName );
114+
}
115+
else
116+
#endif
107117
Q_snprintf(sz, sizeof( sz ), "scripts/%s", pWeaponInfo->szClassName);
108118

109119
CUtlDict< CHudTexture *, int > tempList;

sp/src/game/shared/weapon_parse.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ bool ReadWeaponDataFromFileForSlot( IFileSystem* filesystem, const char *szWeapo
305305
return false;
306306

307307
#ifdef MAPBASE
308+
// Reload HUD elements if we had a custom script
309+
if ( pFileInfo->bCustom )
310+
pFileInfo->bLoadedHudElements = false;
311+
308312
pFileInfo->bCustom = false;
309313
#endif
310314
pFileInfo->Parse( pKV, szWeaponName );
@@ -349,6 +353,7 @@ bool ReadCustomWeaponDataFromFileForSlot( IFileSystem* filesystem, const char *s
349353
return false;
350354

351355
pFileInfo->bCustom = true;
356+
pFileInfo->bLoadedHudElements = false;
352357
pFileInfo->Parse( pKV, szWeaponName );
353358

354359
pKV->deleteThis();

0 commit comments

Comments
 (0)