Half-Life 2

Half-Life 2

Expand the World of Half-Life 2
Browse the Half-Life 2 Workshop to find the best new addons created by the community.
Episode 2 Flashlight in Base HL2 and Episode 1?
How or why has nobody on the workshop tried to make a port of the Episode 2 styled flashlight into the base game and Episode 1? Is it something to do with the SDK? Doesnt seem like it would make a whole lot of sense for the suits battery powered flashlight to be connected with Gordon's legs moving faster or his lung capacity whilst underwater...
< >
Showing 1-2 of 2 comments
Bob 2 May @ 8:23am 
the hev suit is the reason gordon can run so fast, so of course they use the same power source
Episode One is also Episode Two... they simply share the exact same codebase. The Episode Two flashlight handling all boils down to the internal name of which mod you're using:[github.com]
bool Flashlight_UseLegacyVersion( void ) { // If this is the first run through, cache off what the answer should be (cannot change during a session) if ( g_bCacheLegacyFlashlightStatus ) { char modDir[MAX_PATH]; if ( UTIL_GetModDir( modDir, sizeof(modDir) ) == false ) return false; g_bUseLegacyFlashlight = ( !Q_strcmp( modDir, "hl2" ) || !Q_strcmp( modDir, "episodic" ) || !Q_strcmp( modDir, "lostcoast" ) || !Q_strcmp( modDir, "hl1" )); g_bCacheLegacyFlashlightStatus = false; } // Return the results return g_bUseLegacyFlashlight; }

On mod "episodic" (Episode One):
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3478153926

On mod not specified by check in g_bUseLegacyFlashlight (a la, equivalent to "ep2" or any other mod):
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3478159786

For base HL2, trying to get the Ep2 flashlight working is simply not possible in the form of a Workshop mod, as you would need to modify and rebuild the SDK code to remove the #ifdefs for HL2_EPISODIC in hud_flashlight.cpp function CHudFlashlight::Paint().

In lines 56-58[github.com]:
#ifdef HL2_EPISODIC DECLARE_HUDELEMENT( CHudFlashlight ); #endif // HL2_EPISODIC

In lines 105-162[github.com]:
//----------------------------------------------------------------------------- // Purpose: draws the flashlight icon //----------------------------------------------------------------------------- void CHudFlashlight::Paint() { #ifdef HL2_EPISODIC C_BaseHLPlayer *pPlayer = (C_BaseHLPlayer *)C_BasePlayer::GetLocalPlayer(); if ( !pPlayer ) return; // Only paint if we're using the new flashlight code if ( pPlayer->m_HL2Local.m_flFlashBattery < 0.0f ) { SetPaintBackgroundEnabled( false ); return; } // ... #endif HL2_EPISODIC }

You'll also have to remove additional HL2_EPISODIC ifdefs for property values and handling code related to the Ep2 flashlight variables m_flFlashBattery and m_vecLocatorOrigin in hl2_player.cpp, c_hl2_playerlocaldata.cpp (lines 32/33, 62/65), hl2_playerlocaldata.cpp (lines 37/40, 57/60, 78/80) and flashlighteffect.cpp (lines 271-317).
Last edited by pivotman319 (Trans Rights FTW!); 8 May @ 1:06pm
< >
Showing 1-2 of 2 comments
Per page: 1530 50