diff --git a/cl_dll/ammo.cpp b/cl_dll/ammo.cpp index 0eb1cc92..31892234 100644 --- a/cl_dll/ammo.cpp +++ b/cl_dll/ammo.cpp @@ -152,7 +152,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) pWeapon->hInactive = SPR_Load( sz ); pWeapon->rcInactive = p->rc; - gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); } else pWeapon->hInactive = 0; @@ -174,7 +174,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) pWeapon->hAmmo = SPR_Load( sz ); pWeapon->rcAmmo = p->rc; - gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); } else pWeapon->hAmmo = 0; @@ -186,7 +186,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) pWeapon->hAmmo2 = SPR_Load( sz ); pWeapon->rcAmmo2 = p->rc; - gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); } else pWeapon->hAmmo2 = 0; @@ -321,7 +321,7 @@ int CHudAmmo::VidInit( void ) giBucketWidth = gHUD.GetSpriteRect( m_HUD_bucket0 ).right - gHUD.GetSpriteRect( m_HUD_bucket0 ).left; giBucketHeight = gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top; - gHR.iHistoryGap = max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top ); // If we've already loaded weapons, let's get new sprites gWR.LoadAllWeaponSprites(); @@ -856,7 +856,7 @@ int CHudAmmo::Draw( float flTime ) AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left; - a = (int)max( MIN_ALPHA, m_fFade); + a = (int)Q_max( MIN_ALPHA, m_fFade ); if( m_fFade > 0 ) m_fFade -= ( gHUD.m_flTimeDelta * 20 ); diff --git a/cl_dll/ammo_secondary.cpp b/cl_dll/ammo_secondary.cpp index 954ff211..786f862d 100644 --- a/cl_dll/ammo_secondary.cpp +++ b/cl_dll/ammo_secondary.cpp @@ -61,7 +61,7 @@ int CHudAmmoSecondary::Draw( float flTime ) // draw secondary ammo icons above normal ammo readout int a, x, y, r, g, b, AmmoWidth; UnpackRGB( r, g, b, RGB_YELLOWISH ); - a = (int) max( MIN_ALPHA, m_fFade ); + a = (int)Q_max( MIN_ALPHA, m_fFade ); if( m_fFade > 0 ) m_fFade -= ( gHUD.m_flTimeDelta * 20 ); // slowly lower alpha to fade out icons ScaleColors( r, g, b, a ); @@ -142,7 +142,7 @@ int CHudAmmoSecondary::MsgFunc_SecAmmoVal( const char *pszName, int iSize, void int count = 0; for( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ ) { - count += max( 0, m_iAmmoAmounts[i] ); + count += Q_max( 0, m_iAmmoAmounts[i] ); } if( count == 0 ) diff --git a/cl_dll/ammohistory.cpp b/cl_dll/ammohistory.cpp index 4b1e6745..a3961da7 100644 --- a/cl_dll/ammohistory.cpp +++ b/cl_dll/ammohistory.cpp @@ -111,7 +111,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) { if( rgAmmoHistory[i].type ) { - rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME ); + rgAmmoHistory[i].DisplayTime = Q_min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME ); if( rgAmmoHistory[i].DisplayTime <= flTime ) { @@ -127,7 +127,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) int r, g, b; UnpackRGB( r, g, b, RGB_YELLOWISH ); float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80; - ScaleColors( r, g, b, min( scale, 255 ) ); + ScaleColors( r, g, b, Q_min( scale, 255 ) ); // Draw the pic int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i)); @@ -158,7 +158,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) UnpackRGB( r, g, b, RGB_REDISH ); // if the weapon doesn't have ammo, display it as red float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80; - ScaleColors( r, g, b, min( scale, 255 ) ); + ScaleColors( r, g, b, Q_min( scale, 255 ) ); int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) ); int xpos = ScreenWidth - ( weap->rcInactive.right - weap->rcInactive.left ); @@ -176,7 +176,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) UnpackRGB( r, g, b, RGB_YELLOWISH ); float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80; - ScaleColors( r, g, b, min( scale, 255 ) ); + ScaleColors( r, g, b, Q_min( scale, 255 ) ); int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) ); int xpos = ScreenWidth - ( rect.right - rect.left ) - 10; diff --git a/cl_dll/cl_util.h b/cl_dll/cl_util.h index 0cb65f32..7ba3bc7e 100644 --- a/cl_dll/cl_util.h +++ b/cl_dll/cl_util.h @@ -148,8 +148,8 @@ inline void CenterPrint( const char *string ) inline void PlaySound( const char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); } inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); } -#define max(a, b) (((a) > (b)) ? (a) : (b)) -#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define Q_max(a, b) (((a) > (b)) ? (a) : (b)) +#define Q_min(a, b) (((a) < (b)) ? (a) : (b)) #define fabs(x) ((x) > 0 ? (x) : 0 - (x)) void ScaleColors( int &r, int &g, int &b, int a ); diff --git a/cl_dll/death.cpp b/cl_dll/death.cpp index 579fc255..b0667ec2 100644 --- a/cl_dll/death.cpp +++ b/cl_dll/death.cpp @@ -106,7 +106,7 @@ int CHudDeathNotice::Draw( float flTime ) continue; } - rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME ); + rgDeathNoticeList[i].flDisplayTime = Q_min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME ); // Only draw if the viewport will let me // vgui dropped out diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index f301fa2a..ff69871d 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -276,25 +276,25 @@ void CHudHealth::CalcDamageDirection( vec3_t vecFrom ) if( side > 0 ) { if( side > 0.3 ) - m_fAttackFront = max( m_fAttackFront, side ); + m_fAttackFront = Q_max( m_fAttackFront, side ); } else { float f = fabs( side ); if( f > 0.3 ) - m_fAttackRear = max( m_fAttackRear, f ); + m_fAttackRear = Q_max( m_fAttackRear, f ); } if( front > 0 ) { if( front > 0.3 ) - m_fAttackRight = max( m_fAttackRight, front ); + m_fAttackRight = Q_max( m_fAttackRight, front ); } else { float f = fabs( front ); if( f > 0.3 ) - m_fAttackLeft = max( m_fAttackLeft, f ); + m_fAttackLeft = Q_max( m_fAttackLeft, f ); } } } @@ -316,28 +316,28 @@ int CHudHealth::DrawPain( float flTime ) if( m_fAttackFront > 0.4 ) { GetPainColor( r, g, b ); - shade = a * max( m_fAttackFront, 0.5 ); + shade = a * Q_max( m_fAttackFront, 0.5 ); ScaleColors( r, g, b, shade ); SPR_Set( m_hSprite, r, g, b ); x = ScreenWidth / 2 - SPR_Width( m_hSprite, 0 ) / 2; y = ScreenHeight / 2 - SPR_Height( m_hSprite, 0 ) * 3; SPR_DrawAdditive( 0, x, y, NULL ); - m_fAttackFront = max( 0, m_fAttackFront - fFade ); + m_fAttackFront = Q_max( 0, m_fAttackFront - fFade ); } else m_fAttackFront = 0; if( m_fAttackRight > 0.4 ) { GetPainColor( r, g, b ); - shade = a * max( m_fAttackRight, 0.5 ); + shade = a * Q_max( m_fAttackRight, 0.5 ); ScaleColors( r, g, b, shade ); SPR_Set( m_hSprite, r, g, b ); x = ScreenWidth / 2 + SPR_Width( m_hSprite, 1 ) * 2; y = ScreenHeight / 2 - SPR_Height( m_hSprite,1 ) / 2; SPR_DrawAdditive( 1, x, y, NULL ); - m_fAttackRight = max( 0, m_fAttackRight - fFade ); + m_fAttackRight = Q_max( 0, m_fAttackRight - fFade ); } else m_fAttackRight = 0; @@ -345,14 +345,14 @@ int CHudHealth::DrawPain( float flTime ) if( m_fAttackRear > 0.4 ) { GetPainColor( r, g, b ); - shade = a * max( m_fAttackRear, 0.5 ); + shade = a * Q_max( m_fAttackRear, 0.5 ); ScaleColors( r, g, b, shade ); SPR_Set( m_hSprite, r, g, b ); x = ScreenWidth / 2 - SPR_Width( m_hSprite, 2 ) / 2; y = ScreenHeight / 2 + SPR_Height( m_hSprite, 2 ) * 2; SPR_DrawAdditive( 2, x, y, NULL ); - m_fAttackRear = max( 0, m_fAttackRear - fFade ); + m_fAttackRear = Q_max( 0, m_fAttackRear - fFade ); } else m_fAttackRear = 0; @@ -360,7 +360,7 @@ int CHudHealth::DrawPain( float flTime ) if( m_fAttackLeft > 0.4 ) { GetPainColor( r, g, b ); - shade = a * max( m_fAttackLeft, 0.5 ); + shade = a * Q_max( m_fAttackLeft, 0.5 ); ScaleColors( r, g, b, shade ); SPR_Set( m_hSprite, r, g, b ); @@ -368,7 +368,7 @@ int CHudHealth::DrawPain( float flTime ) y = ScreenHeight / 2 - SPR_Height( m_hSprite,3 ) / 2; SPR_DrawAdditive( 3, x, y, NULL ); - m_fAttackLeft = max( 0, m_fAttackLeft - fFade ); + m_fAttackLeft = Q_max( 0, m_fAttackLeft - fFade ); } else m_fAttackLeft = 0; @@ -400,7 +400,7 @@ int CHudHealth::DrawDamage( float flTime ) SPR_Set( gHUD.GetSprite( m_HUD_dmg_bio + i ), r, g, b ); SPR_DrawAdditive( 0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect( m_HUD_dmg_bio + i ) ); - pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire ); + pdmg->fExpire = Q_min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire ); if( pdmg->fExpire <= flTime // when the time has expired && a < 40 ) // and the flash is at the low point of the cycle diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index f63b6832..c6e98004 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -75,7 +75,7 @@ void CHud::Think( void ) if( m_iFOV == 0 ) { // only let players adjust up in fov, and only if they are not overriden by something else - m_iFOV = max( default_fov->value, 90 ); + m_iFOV = Q_max( default_fov->value, 90 ); } } diff --git a/cl_dll/saytext.cpp b/cl_dll/saytext.cpp index 8f2e2520..b084f44b 100644 --- a/cl_dll/saytext.cpp +++ b/cl_dll/saytext.cpp @@ -96,10 +96,7 @@ int CHudSayText::Draw( float flTime ) int y = Y_START; // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset - flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value ); - - // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset - flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value ); + flScrollTime = Q_min( flScrollTime, flTime + m_HUD_saytext_time->value ); if( flScrollTime <= flTime ) { @@ -126,8 +123,8 @@ int CHudSayText::Draw( float flTime ) static char buf[MAX_PLAYER_NAME_LENGTH + 32]; // draw the first x characters in the player color - strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) ); - buf[min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0; + strncpy( buf, g_szLineBuffer[i], Q_min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) ); + buf[Q_min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0; DrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] ); int x = DrawConsoleString( LINE_START, y, buf ); @@ -196,7 +193,7 @@ void CHudSayText::SayTextPrint( const char *pszBuf, int iBufSize, int clientInde } } - strncpy( g_szLineBuffer[i], pszBuf, max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) ); + strncpy( g_szLineBuffer[i], pszBuf, Q_max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) ); // make sure the text fits in one line EnsureTextFitsInOneLineAndWrapIfHaveTo( i ); diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index d4bdecb8..3361aa0a 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -561,7 +561,7 @@ int CHudScoreboard::MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf if( g_TeamInfo[j].name[0] == '\0' ) break; } - m_iNumTeams = max( j, m_iNumTeams ); + m_iNumTeams = Q_max( j, m_iNumTeams ); strncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME ); g_TeamInfo[j].players = 0; diff --git a/cl_dll/statusbar.cpp b/cl_dll/statusbar.cpp index 98b317c5..79f30b7e 100644 --- a/cl_dll/statusbar.cpp +++ b/cl_dll/statusbar.cpp @@ -197,7 +197,7 @@ int CHudStatusBar::Draw( float fTime ) // let user set status ID bar centering if( ( i == STATUSBAR_ID_LINE ) && CVAR_GET_FLOAT( "hud_centerid" ) ) { - x = max( 0, max( 2, ( ScreenWidth - TextWidth ) ) / 2 ); + x = Q_max( 0, Q_max( 2, ( ScreenWidth - TextWidth ) ) / 2 ); y = ( ScreenHeight / 2 ) + ( TextHeight * CVAR_GET_FLOAT( "hud_centerid" ) ); } diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index 63d526ce..f1a1cc7b 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -214,8 +214,8 @@ float V_CalcBob( struct ref_params_s *pparams ) bob = sqrt( vel[0] * vel[0] + vel[1] * vel[1] ) * cl_bob->value; bob = bob * 0.3 + bob * 0.7 * sin(cycle); - bob = min( bob, 4 ); - bob = max( bob, -7 ); + bob = Q_min( bob, 4 ); + bob = Q_max( bob, -7 ); return bob; } @@ -709,7 +709,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams ) if( dt > 0.0 ) { frac = ( t - ViewInterp.OriginTime[foundidx & ORIGIN_MASK] ) / dt; - frac = min( 1.0, frac ); + frac = Q_min( 1.0, frac ); VectorSubtract( ViewInterp.Origins[( foundidx + 1 ) & ORIGIN_MASK], ViewInterp.Origins[foundidx & ORIGIN_MASK], delta ); VectorMA( ViewInterp.Origins[foundidx & ORIGIN_MASK], frac, delta, neworg ); @@ -1561,7 +1561,7 @@ void V_DropPunchAngle( float frametime, float *ev_punchangle ) len = VectorNormalize( ev_punchangle ); len -= ( 10.0 + len * 0.5 ) * frametime; - len = max( len, 0.0 ); + len = Q_max( len, 0.0 ); VectorScale( ev_punchangle, len, ev_punchangle ); } diff --git a/dlls/player.h b/dlls/player.h index 476863be..50531a08 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -307,8 +307,6 @@ public: void SetCustomDecalFrames( int nFrames ); int GetCustomDecalFrames( void ); - Vector m_vecLastViewAngles; - float m_flStartCharge; float m_flAmmoStartCharge; float m_flPlayAftershock; @@ -325,6 +323,8 @@ public: float m_flNextChatTime; + Vector m_vecLastViewAngles; + bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message. }; diff --git a/dlls/util.h b/dlls/util.h index 9a6b56bf..40d53c94 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -108,7 +108,11 @@ typedef int BOOL; // The _declspec forces them to be exported by name so we can do a lookup with GetProcAddress() // The function is used to intialize / allocate the object for the entity +#if defined(CLIENT_DLL) +#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) +#else // CLIENT_DLL #define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) extern "C" EXPORT void mapClassName( entvars_t *pev ); void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); } +#endif // CLIENT_DLL // // Conversion among the three types of "entity", including identity-conversions. diff --git a/scripts/waifulib/xcompile.py b/scripts/waifulib/xcompile.py index 3244a95a..d6bb1a8b 100644 --- a/scripts/waifulib/xcompile.py +++ b/scripts/waifulib/xcompile.py @@ -64,7 +64,7 @@ class Android: else: self.ndk_rev = 10 - if self.ndk_rev not in [10, 19]: + if self.ndk_rev not in [10, 19, 20]: ctx.fatal('Unknown NDK revision: {}'.format(self.ndk_rev)) self.arch = arch @@ -197,7 +197,10 @@ class Android: return os.path.abspath(os.path.join(self.ndk_home, path)) def cflags(self): - cflags = ['--sysroot={0}'.format(self.sysroot()), '-DANDROID', '-D__ANDROID__'] + cflags = [] + if self.ndk_rev < 20: + cflags = ['--sysroot={0}'.format(self.sysroot())] + cflags += ['-DANDROID', '-D__ANDROID__'] cflags += ['-I{0}'.format(self.system_stl())] if self.is_arm(): if self.arch == 'armeabi-v7a': @@ -218,7 +221,9 @@ class Android: # they go before object list def linkflags(self): - linkflags = ['--sysroot={0}'.format(self.sysroot())] + linkflags = [] + if self.ndk_rev < 20: + linkflags = ['--sysroot={0}'.format(self.sysroot())] return linkflags def ldflags(self): @@ -277,7 +282,7 @@ def configure(conf): def post_compiler_cxx_configure(conf): if conf.options.ANDROID_OPTS: - if conf.android.ndk_rev >= 19: + if conf.android.ndk_rev == 19: conf.env.CXXFLAGS_cxxshlib += ['-static-libstdc++'] conf.env.LDFLAGS_cxxshlib += ['-static-libstdc++'] return