From fa87f9274e6d0b1f2f0edce0e8bb8f072546f0e8 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 10 Aug 2020 21:41:06 -0500 Subject: [PATCH] Cleanup of client_weapons preprocessor -removed code referenced to client weapons because no longer needed. ~adjustments to downsample code, and restoring original water frustrum for release. -removed warnings for missing commandmenu, textscheme and bitmap font. --- src/cl_dll/vgui_SchemeManager.cpp | 6 +- src/cl_dll/vgui_TeamFortressViewport.cpp | 2 +- src/dlls/client.cpp | 109 ----------------------- src/dlls/player.cpp | 85 ------------------ src/dlls/weapons.cpp | 19 ---- src/engine/client/gl_downsample.c | 27 ++---- src/engine/client/gl_rmain.c | 7 +- 7 files changed, 15 insertions(+), 240 deletions(-) diff --git a/src/cl_dll/vgui_SchemeManager.cpp b/src/cl_dll/vgui_SchemeManager.cpp index f9d45a8..5b1c33d 100644 --- a/src/cl_dll/vgui_SchemeManager.cpp +++ b/src/cl_dll/vgui_SchemeManager.cpp @@ -191,7 +191,7 @@ CSchemeManager::CSchemeManager( int xRes, int yRes ) if ( !pFile ) { - gEngfuncs.Con_DPrintf( "Unable to find *_textscheme.txt\n"); + //gEngfuncs.Con_DPrintf( "Unable to find *_textscheme.txt\n"); //magic nipples - no missing textscheme warning goto buildDefaultFont; } @@ -397,8 +397,8 @@ CSchemeManager::CSchemeManager( int xRes, int yRes ) { sprintf(fontFilename, "gfx\\vgui\\fonts\\%d_%s.tga", m_xRes, m_pSchemeList[i].schemeName); pFontData = gEngfuncs.COM_LoadFile( fontFilename, 5, &fontFileLength ); - if(!pFontData) - gEngfuncs.Con_Printf("Missing bitmap font: %s\n", fontFilename); + //if(!pFontData) + //gEngfuncs.Con_Printf("Missing bitmap font: %s\n", fontFilename); //magic nipples - no more bitmap font warning } m_pSchemeList[i].font = new vgui::Font( diff --git a/src/cl_dll/vgui_TeamFortressViewport.cpp b/src/cl_dll/vgui_TeamFortressViewport.cpp index 03f70a4..f1e7287 100644 --- a/src/cl_dll/vgui_TeamFortressViewport.cpp +++ b/src/cl_dll/vgui_TeamFortressViewport.cpp @@ -664,7 +664,7 @@ int TeamFortressViewport::CreateCommandMenu( char * menuFile, int direction, int char *pfile = (char*)gEngfuncs.COM_LoadFile( menuFile, 5, NULL); if (!pfile) { - gEngfuncs.Con_DPrintf( "Unable to open %s\n", menuFile); + //gEngfuncs.Con_DPrintf( "Unable to open %s\n", menuFile); //magic nipples - disabled warning for missing command menu SetCurrentCommandMenu( NULL ); return newIndex; } diff --git a/src/dlls/client.cpp b/src/dlls/client.cpp index b141b0d..4719717 100644 --- a/src/dlls/client.cpp +++ b/src/dlls/client.cpp @@ -1492,67 +1492,7 @@ void RegisterEncoders( void ) int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) { -#if defined( CLIENT_WEAPONS ) - int i; - weapon_data_t *item; - entvars_t *pev = &player->v; - CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev ); - CBasePlayerWeapon *gun; - - ItemInfo II; - - memset( info, 0, 32 * sizeof( weapon_data_t ) ); - - if ( !pl ) - return 1; - - // go through all of the weapons and make a list of the ones to pack - for ( i = 0 ; i < MAX_ITEM_TYPES ; i++ ) - { - if ( pl->m_rgpPlayerItems[ i ] ) - { - // there's a weapon here. Should I pack it? - CBasePlayerItem *pPlayerItem = pl->m_rgpPlayerItems[ i ]; - - while ( pPlayerItem ) - { - gun = (CBasePlayerWeapon *)pPlayerItem->GetWeaponPtr(); - if ( gun && gun->UseDecrement() ) - { - // Get The ID. - memset( &II, 0, sizeof( II ) ); - gun->GetItemInfo( &II ); - - if ( II.iId >= 0 && II.iId < 32 ) - { - item = &info[ II.iId ]; - - item->m_iId = II.iId; - item->m_iClip = gun->m_iClip; - - item->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle, -0.001 ); - item->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack, -0.001 ); - item->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack, -0.001 ); - item->m_fInReload = gun->m_fInReload; - item->m_fInSpecialReload = gun->m_fInSpecialReload; - item->fuser1 = max( gun->pev->fuser1, -0.001 ); - item->fuser2 = gun->m_flStartThrow; - item->fuser3 = gun->m_flReleaseThrow; - item->iuser1 = gun->m_chargeReady; - item->iuser2 = gun->m_fInAttack; - item->iuser3 = gun->m_fireState; - - -// item->m_flPumpTime = max( gun->m_flPumpTime, -0.001 ); - } - } - pPlayerItem = pPlayerItem->m_pNext; - } - } - } -#else memset( info, 0, 32 * sizeof( weapon_data_t ) ); -#endif return 1; } @@ -1594,55 +1534,6 @@ void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clien cd->weaponanim = ent->v.weaponanim; cd->pushmsec = ent->v.pushmsec; - -#if defined( CLIENT_WEAPONS ) - if ( sendweapons ) - { - entvars_t *pev = (entvars_t *)&ent->v; - CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev ); - - if ( pl ) - { - cd->m_flNextAttack = pl->m_flNextAttack; - cd->fuser2 = pl->m_flNextAmmoBurn; - cd->fuser3 = pl->m_flAmmoStartCharge; - cd->vuser1.x = pl->ammo_9mm; - cd->vuser1.y = pl->ammo_357; - cd->vuser1.z = pl->ammo_argrens; - cd->ammo_nails = pl->ammo_bolts; - cd->ammo_shells = pl->ammo_buckshot; - cd->ammo_rockets = pl->ammo_rockets; - cd->ammo_cells = pl->ammo_uranium; - cd->vuser2.x = pl->ammo_hornets; - - - if ( pl->m_pActiveItem ) - { - CBasePlayerWeapon *gun; - gun = (CBasePlayerWeapon *)pl->m_pActiveItem->GetWeaponPtr(); - if ( gun && gun->UseDecrement() ) - { - ItemInfo II; - memset( &II, 0, sizeof( II ) ); - gun->GetItemInfo( &II ); - - cd->m_iId = II.iId; - - cd->vuser3.z = gun->m_iSecondaryAmmoType; - cd->vuser4.x = gun->m_iPrimaryAmmoType; - cd->vuser4.y = pl->m_rgAmmo[gun->m_iPrimaryAmmoType]; - cd->vuser4.z = pl->m_rgAmmo[gun->m_iSecondaryAmmoType]; - - if ( pl->m_pActiveItem->m_iId == WEAPON_RPG ) - { - cd->vuser2.y = ( ( CRpg * )pl->m_pActiveItem)->m_fSpotActive; - cd->vuser2.z = ( ( CRpg * )pl->m_pActiveItem)->m_cActiveRockets; - } - } - } - } - } -#endif } /* diff --git a/src/dlls/player.cpp b/src/dlls/player.cpp index 1aecbd3..8e2c0d6 100644 --- a/src/dlls/player.cpp +++ b/src/dlls/player.cpp @@ -2571,73 +2571,7 @@ void CBasePlayer::PostThink() m_afButtonLast = pev->button; pt_end: -#if defined( CLIENT_WEAPONS ) - // Decay timers on weapons - // go through all of the weapons and make a list of the ones to pack - for ( int i = 0 ; i < MAX_ITEM_TYPES ; i++ ) - { - if ( m_rgpPlayerItems[ i ] ) - { - CBasePlayerItem *pPlayerItem = m_rgpPlayerItems[ i ]; - - while ( pPlayerItem ) - { - CBasePlayerWeapon *gun; - - gun = (CBasePlayerWeapon *)pPlayerItem->GetWeaponPtr(); - - if ( gun && gun->UseDecrement() ) - { - gun->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 ); - gun->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 ); - - if ( gun->m_flTimeWeaponIdle != 1000 ) - { - gun->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001 ); - } - - if ( gun->pev->fuser1 != 1000 ) - { - gun->pev->fuser1 = max( gun->pev->fuser1 - gpGlobals->frametime, -0.001 ); - } - - // Only decrement if not flagged as NO_DECREMENT -// if ( gun->m_flPumpTime != 1000 ) - // { - // gun->m_flPumpTime = max( gun->m_flPumpTime - gpGlobals->frametime, -0.001 ); - // } - - } - - pPlayerItem = pPlayerItem->m_pNext; - } - } - } - - m_flNextAttack -= gpGlobals->frametime; - if ( m_flNextAttack < -0.001 ) - m_flNextAttack = -0.001; - - if ( m_flNextAmmoBurn != 1000 ) - { - m_flNextAmmoBurn -= gpGlobals->frametime; - - if ( m_flNextAmmoBurn < -0.001 ) - m_flNextAmmoBurn = -0.001; - } - - if ( m_flAmmoStartCharge != 1000 ) - { - m_flAmmoStartCharge -= gpGlobals->frametime; - - if ( m_flAmmoStartCharge < -0.001 ) - m_flAmmoStartCharge = -0.001; - } - - -#else return; -#endif } @@ -2971,13 +2905,6 @@ int CBasePlayer::Restore( CRestore &restore ) RenewItems(); -#if defined( CLIENT_WEAPONS ) - // HACK: This variable is saved/restored in CBaseMonster as a time variable, but we're using it - // as just a counter. Ideally, this needs its own variable that's saved as a plain float. - // Barring that, we clear it out here instead of using the incorrect restored time value. - m_flNextAttack = UTIL_WeaponTimeBase(); -#endif - return status; } @@ -3751,14 +3678,8 @@ Called every frame by the player PreThink */ void CBasePlayer::ItemPreFrame() { -#if defined( CLIENT_WEAPONS ) - if ( m_flNextAttack > 0 ) -#else if ( gpGlobals->time < m_flNextAttack ) -#endif - { return; - } if (!m_pActiveItem) return; @@ -3782,14 +3703,8 @@ void CBasePlayer::ItemPostFrame() if ( m_pTank != NULL ) return; -#if defined( CLIENT_WEAPONS ) - if ( m_flNextAttack > 0 ) -#else if ( gpGlobals->time < m_flNextAttack ) -#endif - { return; - } ImpulseCommands(); diff --git a/src/dlls/weapons.cpp b/src/dlls/weapons.cpp index 5142ec4..b85fdbc 100644 --- a/src/dlls/weapons.cpp +++ b/src/dlls/weapons.cpp @@ -439,15 +439,9 @@ IMPLEMENT_SAVERESTORE( CBasePlayerItem, CBaseAnimating ); TYPEDESCRIPTION CBasePlayerWeapon::m_SaveData[] = { -#if defined( CLIENT_WEAPONS ) - DEFINE_FIELD( CBasePlayerWeapon, m_flNextPrimaryAttack, FIELD_FLOAT ), - DEFINE_FIELD( CBasePlayerWeapon, m_flNextSecondaryAttack, FIELD_FLOAT ), - DEFINE_FIELD( CBasePlayerWeapon, m_flTimeWeaponIdle, FIELD_FLOAT ), -#else // CLIENT_WEAPONS DEFINE_FIELD( CBasePlayerWeapon, m_flNextPrimaryAttack, FIELD_TIME ), DEFINE_FIELD( CBasePlayerWeapon, m_flNextSecondaryAttack, FIELD_TIME ), DEFINE_FIELD( CBasePlayerWeapon, m_flTimeWeaponIdle, FIELD_TIME ), -#endif // CLIENT_WEAPONS DEFINE_FIELD( CBasePlayerWeapon, m_iPrimaryAmmoType, FIELD_INTEGER ), DEFINE_FIELD( CBasePlayerWeapon, m_iSecondaryAmmoType, FIELD_INTEGER ), DEFINE_FIELD( CBasePlayerWeapon, m_iClip, FIELD_INTEGER ), @@ -626,18 +620,10 @@ void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther ) BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted ) { -#if defined( CLIENT_WEAPONS ) - if ( !isPredicted ) -#else if ( 1 ) -#endif - { return ( attack_time <= curtime ) ? TRUE : FALSE; - } else - { return ( attack_time <= 0.0 ) ? TRUE : FALSE; - } } void CBasePlayerWeapon::ItemPostFrame( void ) @@ -868,11 +854,6 @@ void CBasePlayerWeapon::SendWeaponAnim( int iAnim, int skiplocal, int body ) m_pPlayer->pev->weaponanim = iAnim; -#if defined( CLIENT_WEAPONS ) - if ( skiplocal && ENGINE_CANSKIP( m_pPlayer->edict() ) ) - return; -#endif - MESSAGE_BEGIN( MSG_ONE, SVC_WEAPONANIM, NULL, m_pPlayer->pev ); WRITE_BYTE( iAnim ); // sequence number WRITE_BYTE( pev->body ); // weaponmodel bodygroup. diff --git a/src/engine/client/gl_downsample.c b/src/engine/client/gl_downsample.c index ad87eea..26d0ff8 100644 --- a/src/engine/client/gl_downsample.c +++ b/src/engine/client/gl_downsample.c @@ -63,15 +63,15 @@ static void R_Bloom_InitEffectTexture(void) if (r_downsample->value > 5.0f) r_downsample->value = 5.0f; - if (cl.local.waterlevel >= 3) + /*if (cl.local.waterlevel >= 3) { DOWNSAMPLE_SIZE_X = screen_texture_width / (2.5); DOWNSAMPLE_SIZE_Y = screen_texture_width / (2.5); } - else + else*/ { DOWNSAMPLE_SIZE_X = screen_texture_width / (r_downsample->value * 2); - DOWNSAMPLE_SIZE_Y = screen_texture_width / (r_downsample->value * 2); + DOWNSAMPLE_SIZE_Y = screen_texture_height / (r_downsample->value * 2); } r_sampleeffecttexture = GL_CreateTexture("*sampleeffecttexture", DOWNSAMPLE_SIZE_X, DOWNSAMPLE_SIZE_Y, NULL, TF_NEAREST); @@ -84,17 +84,8 @@ R_Sampling_InitTextures */ static void R_Sampling_InitTextures(void) { - if (GL_Support(GL_ARB_TEXTURE_NPOT_EXT)) - { - screen_texture_width = glState.width; - screen_texture_height = glState.height; - } - else - { - // find closer power of 2 to screen size - for (screen_texture_width = 1; screen_texture_width < glState.width; screen_texture_width <<= 1); - for (screen_texture_height = 1; screen_texture_height < glState.height; screen_texture_height <<= 1); - } + screen_texture_width = glState.width; + screen_texture_height = glState.height; // disable blooms if we can't handle a texture of that size if (screen_texture_width > glConfig.max_2d_texture_size || screen_texture_height > glConfig.max_2d_texture_size) @@ -139,7 +130,8 @@ void R_InitDownSampleTextures(void) r_initsampletexture = r_sampleeffecttexture = 0; r_samplebackuptexture = r_downsampletexture = 0; - if ((!r_downsample->value) && (cl.local.waterlevel < 3)) + //if ((!r_downsample->value) && (cl.local.waterlevel < 3)) + if (!r_downsample->value) return; R_Sampling_InitTextures(); @@ -252,7 +244,8 @@ R_DownSampling */ void R_DownSampling(void) { - if ( (!r_downsample->value) && (cl.local.waterlevel < 3)) + //if ( (!r_downsample->value) && (cl.local.waterlevel < 3)) + if (!r_downsample->value) return; if (!DOWNSAMPLE_SIZE_X && !DOWNSAMPLE_SIZE_Y) @@ -261,8 +254,6 @@ void R_DownSampling(void) if (screen_texture_width < DOWNSAMPLE_SIZE_X || screen_texture_height < DOWNSAMPLE_SIZE_Y) return; - //if ( cl.local.waterlevel <= 3 ) - // set up full screen workspace pglScissor(0, 0, glState.width, glState.height); pglViewport(0, 0, glState.width, glState.height); diff --git a/src/engine/client/gl_rmain.c b/src/engine/client/gl_rmain.c index 91e9116..be0d142 100644 --- a/src/engine/client/gl_rmain.c +++ b/src/engine/client/gl_rmain.c @@ -334,11 +334,8 @@ void R_SetupFrustum( void ) if( RP_NORMALPASS() && ( cl.local.waterlevel >= 3 )) //magic nipples - underwater view stretching { - //RI.fov_x = atan(tan(DEG2RAD(RI.fov_x) / 2) * (0.97 + sin(cl.time * 4.5) * 0.23)) * 2 / (M_PI / 180.0); // :) - //RI.fov_y = atan(tan(DEG2RAD(RI.fov_y) / 2) * (1.03 - sin(cl.time * 5.5) * 0.23)) * 2 / (M_PI / 180.0); // :) - - //RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97 + sin( cl.time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0); - //RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( cl.time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0); + RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97 + sin( cl.time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0); + RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( cl.time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0); } // build the transformation matrix for the given view angles