diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/Coronas.cpp | 4 | ||||
-rw-r--r-- | src/render/Hud.cpp | 1438 | ||||
-rw-r--r-- | src/render/MBlur.cpp | 2 | ||||
-rw-r--r-- | src/render/Particle.cpp | 160 | ||||
-rw-r--r-- | src/render/Particle.h | 2 | ||||
-rw-r--r-- | src/render/ParticleMgr.cpp | 16 |
6 files changed, 807 insertions, 815 deletions
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index 64053007..61fa1a5a 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -9,7 +9,7 @@ #include "World.h" #include "Weather.h" #include "Collision.h" -#include "TimeCycle.h" +#include "Timecycle.h" #include "Coronas.h" struct FlareDef @@ -388,7 +388,7 @@ CCoronas::Render(void) // streaks for(i = 0; i < NUMCORONAS; i++){ if(aCoronas[i].id == 0 || !aCoronas[i].drawStreak) - break; + continue; for(j = 0; j < 5; j++){ if(!aCoronas[i].hasValue[j] || !aCoronas[i].hasValue[j+1]) diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 97f2362c..83e62ba0 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -125,876 +125,868 @@ WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); } #else void CHud::Draw() { - RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE); - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); - RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); - RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSMIRROR); - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE); - RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); - RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); + if (CReplay::IsPlayingBack()) + return; - if (!CReplay::IsPlayingBack()) { - if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) { - bool Mode_RunAround = 0; - bool Mode_FirstPerson = 0; - - int32 WeaponType = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType; - int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; - - if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKET || Mode == CCam::MODE_M16FIRSTPERSON_34 || Mode == CCam::MODE_EDITOR) - Mode_FirstPerson = 1; - if (Mode == CCam::MODE_FIRSTPERSONPEDONPC_41 || Mode == CCam::MODE_SNIPER_RUN_AROUND) - Mode_RunAround = 1; - - /* - Draw Crosshairs - */ - if (TheCamera.Cams->Using3rdPersonMouseCam() && (!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == 40) { - if (CWorld::Players[CWorld::PlayerInFocus].m_pPed) { - int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState; - if (State != PED_ENTER_CAR && State != PED_CARJACK) { - if ((WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_M16) || WeaponType == WEAPONTYPE_FLAMETHROWER) - Mode_RunAround = 1; - } + if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) { + bool Mode_RunAround = 0; + bool Mode_FirstPerson = 0; + + int32 WeaponType = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType; + int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; + + if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKET || Mode == CCam::MODE_M16FIRSTPERSON_34 || Mode == CCam::MODE_EDITOR) + Mode_FirstPerson = 1; + if (Mode == CCam::MODE_FIRSTPERSONPEDONPC_41 || Mode == CCam::MODE_SNIPER_RUN_AROUND) + Mode_RunAround = 1; + + /* + Draw Crosshairs + */ + if (TheCamera.Cams->Using3rdPersonMouseCam() && (!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == 40) { + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed) { + int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState; + if (State != PED_ENTER_CAR && State != PED_CARJACK) { + if ((WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_M16) || WeaponType == WEAPONTYPE_FLAMETHROWER) + Mode_RunAround = 1; } } + } - if (Mode_FirstPerson || Mode_RunAround) { - RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR); - - int32 SpriteBrightLikeADiamond = SpriteBrightness + 1; - if (SpriteBrightLikeADiamond > 30) - SpriteBrightLikeADiamond = 30; + if (Mode_FirstPerson || Mode_RunAround) { + RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR); - SpriteBrightness = SpriteBrightLikeADiamond; + int32 SpriteBrightLikeADiamond = SpriteBrightness + 1; + if (SpriteBrightLikeADiamond > 30) + SpriteBrightLikeADiamond = 30; - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); + SpriteBrightness = SpriteBrightLikeADiamond; - float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127); - float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f); - CRect rect; + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); - float fWidescreenOffset[2] = { 0.0f, 0.0f }; + float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127); + float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f); + CRect rect; - if (FrontEndMenuManager.m_PrefsUseWideScreen) { - fWidescreenOffset[0] = 0.0f; - fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f); - } + float fWidescreenOffset[2] = { 0.0f, 0.0f }; - if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { - float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; - float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; + if (FrontEndMenuManager.m_PrefsUseWideScreen) { + fWidescreenOffset[0] = 0.0f; + fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f); + } - if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) { - rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f); - rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f); - rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.6f); - rect.bottom = f3rdY + SCREEN_SCALE_Y(32.0f * 0.6f); + if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { + float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; + float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; - Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); - } - else { - rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.4f); - rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.4f); - rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.4f); - rect.bottom = f3rdY + SCREEN_SCALE_Y(32.0f * 0.4f); + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) { + rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f); + rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f); + rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.6f); + rect.bottom = f3rdY + SCREEN_SCALE_Y(32.0f * 0.6f); - Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); - } + Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } else { - if (Mode == CCam::MODE_M16FIRSTPERSON_34 || - Mode == CCam::MODE_FIRSTPERSONPEDONPC_41 || - Mode == CCam::MODE_EDITOR) { - rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f); - rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f); - rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f); - rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f); - Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); - } - else if (Mode == CCam::MODE_ROCKET_RUN_AROUND) { - rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f * 0.7f); - rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f * 0.7f); - rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f * 0.7f); - rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f * 0.7f); + rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.4f); + rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.4f); + rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.4f); + rect.bottom = f3rdY + SCREEN_SCALE_Y(32.0f * 0.4f); - Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); - } - else if (Mode == CCam::MODE_ROCKET || Mode == CCam::MODE_SNIPER_RUN_AROUND) { - RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE); - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE); - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); - RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpRocketSightTex->raster); - - CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, SCREEN_SCALE_X(40.0f), SCREEN_SCALE_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); - } - else { - rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f); - rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f); - rect.right = SCREEN_WIDTH / 2; - rect.bottom = SCREEN_HEIGHT / 2; - Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); - - rect.right = (SCREEN_WIDTH / 2); - rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f); - rect.left = SCREEN_SCALE_X(210.0f) + (SCREEN_WIDTH / 2); - rect.bottom = SCREEN_HEIGHT / 2; - Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); - - rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f); - rect.bottom = (SCREEN_HEIGHT / 2); - rect.right = (SCREEN_WIDTH / 2); - rect.top = SCREEN_SCALE_Y(210.0f) + (SCREEN_HEIGHT / 2); - Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); - - rect.right = (SCREEN_WIDTH / 2); - rect.bottom = (SCREEN_HEIGHT / 2); - rect.left = SCREEN_SCALE_X(210.0f) + (SCREEN_WIDTH / 2); - rect.top = SCREEN_SCALE_Y(210.0f) + (SCREEN_HEIGHT / 2); - Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); - } + Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } - RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR); - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA); } else { - SpriteBrightness = 0; + if (Mode == CCam::MODE_M16FIRSTPERSON_34 || + Mode == CCam::MODE_FIRSTPERSONPEDONPC_41 || + Mode == CCam::MODE_EDITOR) { + rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f); + rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f); + rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f); + Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + } + else if (Mode == CCam::MODE_ROCKET_RUN_AROUND) { + rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f * 0.7f); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f * 0.7f); + rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f * 0.7f); + rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f * 0.7f); + + Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + } + else if (Mode == CCam::MODE_ROCKET || Mode == CCam::MODE_SNIPER_RUN_AROUND) { + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpRocketSightTex->raster); + + CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, SCREEN_SCALE_X(40.0f), SCREEN_SCALE_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); + } + else { + rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f); + rect.right = SCREEN_WIDTH / 2; + rect.bottom = SCREEN_HEIGHT / 2; + Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + + rect.right = (SCREEN_WIDTH / 2); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f); + rect.left = SCREEN_SCALE_X(210.0f) + (SCREEN_WIDTH / 2); + rect.bottom = SCREEN_HEIGHT / 2; + Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + + rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f); + rect.bottom = (SCREEN_HEIGHT / 2); + rect.right = (SCREEN_WIDTH / 2); + rect.top = SCREEN_SCALE_Y(210.0f) + (SCREEN_HEIGHT / 2); + Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + + rect.right = (SCREEN_WIDTH / 2); + rect.bottom = (SCREEN_HEIGHT / 2); + rect.left = SCREEN_SCALE_X(210.0f) + (SCREEN_WIDTH / 2); + rect.top = SCREEN_SCALE_Y(210.0f) + (SCREEN_HEIGHT / 2); + Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + } } + RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA); + } + else { + SpriteBrightness = 0; + } - /* - DrawMoneyCounter - */ - wchar sPrint[16]; - wchar sPrintIcon[16]; - char sTemp[16]; + /* + DrawMoneyCounter + */ + wchar sPrint[16]; + wchar sPrintIcon[16]; + char sTemp[16]; - sprintf(sTemp, "$%08d", CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney); - AsciiToUnicode(sTemp, sPrint); + sprintf(sTemp, "$%08d", CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney); + AsciiToUnicode(sTemp, sPrint); - CFont::SetPropOff(); - CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); - CFont::SetCentreOff(); - CFont::SetRightJustifyOn(); - CFont::SetRightJustifyWrap(0.0f); - CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_HEADING); - CFont::SetPropOff(); - CFont::SetColor(CRGBA(0, 0, 0, 255)); - - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(43.0f + 2.0f), sPrint); + CFont::SetPropOff(); + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); + CFont::SetCentreOff(); + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetFontStyle(FONT_HEADING); + CFont::SetPropOff(); + CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::SetColor(CRGBA(89, 115, 150, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(43.0f + 2.0f), sPrint); - /* - DrawClock - */ - sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes()); - AsciiToUnicode(sTemp, sPrint); + CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint); - CFont::SetColor(CRGBA(0, 0, 0, 255)); + /* + DrawClock + */ + sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes()); + AsciiToUnicode(sTemp, sPrint); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f - 2.0f), SCREEN_SCALE_Y(22.0f + 2.0f), sPrint); + CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::SetColor(CRGBA(194, 165, 120, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f - 2.0f), SCREEN_SCALE_Y(22.0f + 2.0f), sPrint); - /* - DrawAmmo - */ - int16 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition; - int32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip; - int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal; - int32 Ammo, Clip; + CFont::SetColor(CRGBA(194, 165, 120, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint); - if (AmmoAmount <= 1 || AmmoAmount >= 1000) - sprintf(sTemp, "%d", TotalAmmo); - else { - if (WeaponType == WEAPONTYPE_FLAMETHROWER) { - Clip = AmmoInClip / 10; + /* + DrawAmmo + */ + int16 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition; + int32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip; + int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal; + int32 Ammo, Clip; - if ((TotalAmmo - AmmoInClip) / 10 <= 9999) - Ammo = (TotalAmmo - AmmoInClip) / 10; - else - Ammo = 9999; - } - else { - Clip = AmmoInClip; + if (AmmoAmount <= 1 || AmmoAmount >= 1000) + sprintf(sTemp, "%d", TotalAmmo); + else { + if (WeaponType == WEAPONTYPE_FLAMETHROWER) { + Clip = AmmoInClip / 10; - if (TotalAmmo - AmmoInClip > 9999) - Ammo = 9999; - else - Ammo = TotalAmmo - AmmoInClip; - } + if ((TotalAmmo - AmmoInClip) / 10 <= 9999) + Ammo = (TotalAmmo - AmmoInClip) / 10; + else + Ammo = 9999; + } + else { + Clip = AmmoInClip; - sprintf(sTemp, "%d-%d", Ammo, Clip); + if (TotalAmmo - AmmoInClip > 9999) + Ammo = 9999; + else + Ammo = TotalAmmo - AmmoInClip; } - AsciiToUnicode(sTemp, sPrint); + sprintf(sTemp, "%d-%d", Ammo, Clip); + } - CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f)); - CFont::SetJustifyOff(); - CFont::SetCentreOn(); - CFont::SetCentreSize(SCREEN_SCALE_X(640.0f)); - CFont::SetPropOn(); - CFont::SetFontStyle(FONT_BANK); + AsciiToUnicode(sTemp, sPrint); - if (!CDarkel::FrenzyOnGoing()) { - if (WeaponType) { - if (WeaponType != WEAPONTYPE_BASEBALLBAT) { - CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(66.0f), SCREEN_SCALE_Y(73.0f), sPrint); - } + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f)); + CFont::SetJustifyOff(); + CFont::SetCentreOn(); + CFont::SetCentreSize(SCREEN_SCALE_X(640.0f)); + CFont::SetPropOn(); + CFont::SetFontStyle(FONT_BANK); + + if (!CDarkel::FrenzyOnGoing()) { + if (WeaponType) { + if (WeaponType != WEAPONTYPE_BASEBALLBAT) { + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(66.0f), SCREEN_SCALE_Y(73.0f), sPrint); } } + } - /* - DrawWeaponIcon - */ - Sprites[WeaponType].Draw( - CRect(SCREEN_SCALE_FROM_RIGHT(99.0f), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(91.0f)), - CRGBA(255, 255, 255, 255), - 0.015f, - 0.015f, - 1.0f, - 0.0f, - 0.015f, - 1.0f, - 1.0f, - 1.0f); - - /* - DrawHealth - */ - CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); - CFont::SetJustifyOff(); - CFont::SetCentreOff(); - CFont::SetRightJustifyWrap(0.0f); - CFont::SetRightJustifyOn(); - CFont::SetPropOff(); - CFont::SetFontStyle(FONT_HEADING); - - if (m_ItemToFlash == ITEM_HEALTH && CTimer::GetFrameCounter() & 8 - || m_ItemToFlash != ITEM_HEALTH - || CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth < 10 - && CTimer::GetFrameCounter() & 8) { - if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth >= 10 - || CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth < 10 && CTimer::GetFrameCounter() & 8) { + /* + DrawWeaponIcon + */ + Sprites[WeaponType].Draw( + CRect(SCREEN_SCALE_FROM_RIGHT(99.0f), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(91.0f)), + CRGBA(255, 255, 255, 255), + 0.015f, + 0.015f, + 1.0f, + 0.0f, + 0.015f, + 1.0f, + 1.0f, + 1.0f); - AsciiToUnicode("{", sPrintIcon); - sprintf(sTemp, "%03d", (int32)CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth); - AsciiToUnicode(sTemp, sPrint); + /* + DrawHealth + */ + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); + CFont::SetJustifyOff(); + CFont::SetCentreOff(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetRightJustifyOn(); + CFont::SetPropOff(); + CFont::SetFontStyle(FONT_HEADING); + + if (m_ItemToFlash == ITEM_HEALTH && CTimer::GetFrameCounter() & 8 + || m_ItemToFlash != ITEM_HEALTH + || CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth < 10 + && CTimer::GetFrameCounter() & 8) { + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth >= 10 + || CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth < 10 && CTimer::GetFrameCounter() & 8) { + + AsciiToUnicode("{", sPrintIcon); + sprintf(sTemp, "%03d", (int32)CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth); + AsciiToUnicode(sTemp, sPrint); - CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrint); + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrint); - if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); - } - CFont::SetColor(CRGBA(186, 101, 50, 255)); + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); + } + CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(65.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(65.0f), sPrint); - if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); - } + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); } } + } - /* - DrawArmour - */ - if (m_ItemToFlash == ITEM_ARMOUR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_ARMOUR) { - CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); - if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour > 1.0f) { - AsciiToUnicode("[", sPrintIcon); - sprintf(sTemp, "%03d", (int32)CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour); - AsciiToUnicode(sTemp, sPrint); + /* + DrawArmour + */ + if (m_ItemToFlash == ITEM_ARMOUR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_ARMOUR) { + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour > 1.0f) { + AsciiToUnicode("[", sPrintIcon); + sprintf(sTemp, "%03d", (int32)CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour); + AsciiToUnicode(sTemp, sPrint); - CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrint); + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrint); - if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); - } + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) { + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); + } - CFont::SetColor(CRGBA(124, 140, 95, 255)); + CFont::SetColor(CRGBA(124, 140, 95, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint); - if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) { - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); - } + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) { + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); } } + } - /* - DrawWantedLevel - */ - CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); - CFont::SetJustifyOff(); - CFont::SetCentreOff(); - CFont::SetRightJustifyOff(); - CFont::SetPropOn(); - CFont::SetFontStyle(FONT_HEADING); + /* + DrawWantedLevel + */ + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); + CFont::SetJustifyOff(); + CFont::SetCentreOff(); + CFont::SetRightJustifyOff(); + CFont::SetPropOn(); + CFont::SetFontStyle(FONT_HEADING); - AsciiToUnicode("]", sPrintIcon); + AsciiToUnicode("]", sPrintIcon); - for (int i = 0; i < 6; i++) { - CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(2.0f + SCREEN_SCALE_FROM_RIGHT(60.0f - 2.0f + 24.0f * i), SCREEN_SCALE_Y(87.0f + 2.0f), sPrintIcon); - if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel > i - && (CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nLastWantedLevelChange - + 2000 || CTimer::GetFrameCounter() & 4)) { + for (int i = 0; i < 6; i++) { + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(2.0f + SCREEN_SCALE_FROM_RIGHT(60.0f - 2.0f + 24.0f * i), SCREEN_SCALE_Y(87.0f + 2.0f), sPrintIcon); + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel > i + && (CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nLastWantedLevelChange + + 2000 || CTimer::GetFrameCounter() & 4)) { - CFont::SetColor(CRGBA(193, 164, 120, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(60.0f + 24.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon); - } + CFont::SetColor(CRGBA(193, 164, 120, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(60.0f + 24.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon); } + } - /* - DrawZoneName - */ - if (m_pZoneName) { - float fZoneAlpha = 0.0f; + /* + DrawZoneName + */ + if (m_pZoneName) { + float fZoneAlpha = 0.0f; + + if (m_pZoneName != m_pLastZoneName) { + switch (m_ZoneState) { + case 0: + m_ZoneState = 2; + m_ZoneToPrint = m_pZoneName; + m_ZoneNameTimer = 0; + m_ZoneFadeTimer = 0; + break; + case 1: + case 2: + case 3: + case 4: + m_ZoneNameTimer = 0; + m_ZoneState = 4; + break; + default: + break; + } + m_pLastZoneName = m_pZoneName; + } - if (m_pZoneName != m_pLastZoneName) { - switch (m_ZoneState) { - case 0: - m_ZoneState = 2; - m_ZoneToPrint = m_pZoneName; - m_ZoneNameTimer = 0; + if (m_ZoneState) { + switch (m_ZoneState) { + case 1: + if (m_ZoneNameTimer > 10000) { + m_ZoneFadeTimer = 1000; + m_ZoneState = 3; + } + fZoneAlpha = 255.0f; + break; + case 2: + m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + if (m_ZoneFadeTimer > 1000) { + m_ZoneState = 1; + m_ZoneFadeTimer = 1000; + } + fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f; + break; + case 3: + m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + if (m_ZoneFadeTimer < 0) { + m_ZoneState = 0; m_ZoneFadeTimer = 0; - break; - case 1: - case 2: - case 3: - case 4: + } + fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f; + break; + case 4: + m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + if (m_ZoneFadeTimer < 0) { + m_ZoneFadeTimer = 0; + m_ZoneToPrint = m_pLastZoneName; m_ZoneNameTimer = 0; - m_ZoneState = 4; - break; - default: - break; + m_ZoneState = 2; } - m_pLastZoneName = m_pZoneName; + fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f; + break; + default: + break; + } + if (!m_Message[0]) { + m_ZoneNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + CFont::SetJustifyOff(); + CFont::SetPropOn(); + CFont::SetBackgroundOff(); - if (m_ZoneState) { - switch (m_ZoneState) { - case 1: - if (m_ZoneNameTimer > 10000) { - m_ZoneFadeTimer = 1000; - m_ZoneState = 3; - } - fZoneAlpha = 255.0f; - break; - case 2: - m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); - if (m_ZoneFadeTimer > 1000) { - m_ZoneState = 1; - m_ZoneFadeTimer = 1000; - } - fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f; - break; - case 3: - m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); - if (m_ZoneFadeTimer < 0) { - m_ZoneState = 0; - m_ZoneFadeTimer = 0; - } - fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f; - break; - case 4: - m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); - if (m_ZoneFadeTimer < 0) { - m_ZoneFadeTimer = 0; - m_ZoneToPrint = m_pLastZoneName; - m_ZoneNameTimer = 0; - m_ZoneState = 2; - } - fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f; - break; - default: - break; + if (FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_SPANISH) + CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f)); + else + CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); - } - if (!m_Message[0]) { - m_ZoneNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); - CFont::SetJustifyOff(); - CFont::SetPropOn(); - CFont::SetBackgroundOff(); - - if (FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_SPANISH) - CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f)); - else - CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); - - CFont::SetRightJustifyOn(); - CFont::SetRightJustifyWrap(0.0f); - CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); - CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f - 1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f - 1.0f), m_ZoneToPrint); - - CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f), m_ZoneToPrint); - } + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetFontStyle(FONT_BANK); + CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f - 1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f - 1.0f), m_ZoneToPrint); + + CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f), m_ZoneToPrint); } } - else { - m_pLastZoneName = 0; - m_ZoneState = 0; - m_ZoneFadeTimer = 0; - m_ZoneNameTimer = 0; - } + } + else { + m_pLastZoneName = nil; + m_ZoneState = 0; + m_ZoneFadeTimer = 0; + m_ZoneNameTimer = 0; + } - /* - DrawVehicleName - */ - if (m_VehicleName) { - float fVehicleAlpha = 0.0f; + /* + DrawVehicleName + */ + if (m_VehicleName) { + float fVehicleAlpha = 0.0f; + + if (m_VehicleName != m_pLastVehicleName) { + switch (m_VehicleState) { + case 0: + m_VehicleState = 2; + m_pVehicleNameToPrint = m_VehicleName; + m_VehicleNameTimer = 0; + m_VehicleFadeTimer = 0; + break; + case 1: + case 2: + case 3: + case 4: + m_VehicleNameTimer = 0; + m_VehicleState = 4; + break; + default: + break; + } + m_pLastVehicleName = m_VehicleName; + } - if (m_VehicleName != m_pLastVehicleName) { - switch (m_VehicleState) { - case 0: - m_VehicleState = 2; - m_pVehicleNameToPrint = m_VehicleName; - m_VehicleNameTimer = 0; + if (m_VehicleState) { + switch (m_VehicleState) { + case 1: + if (m_VehicleNameTimer > 10000) { + m_VehicleFadeTimer = 1000; + m_VehicleState = 3; + } + fVehicleAlpha = 255.0f; + break; + case 2: + m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + if (m_VehicleFadeTimer > 1000) { + m_VehicleState = 1; + m_VehicleFadeTimer = 1000; + } + fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f; + break; + case 3: + m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + if (m_VehicleFadeTimer < 0) { + m_VehicleState = 0; + m_VehicleFadeTimer = 0; + } + fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f; + break; + case 4: + m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + if (m_VehicleFadeTimer < 0) { m_VehicleFadeTimer = 0; - break; - case 1: - case 2: - case 3: - case 4: + m_pVehicleNameToPrint = m_pLastVehicleName; m_VehicleNameTimer = 0; - m_VehicleState = 4; - break; - default: - break; + m_VehicleState = 2; } - m_pLastVehicleName = m_VehicleName; + fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f; + break; + default: + break; } - if (m_VehicleState) { - switch (m_VehicleState) { - case 1: - if (m_VehicleNameTimer > 10000) { - m_VehicleFadeTimer = 1000; - m_VehicleState = 3; - } - fVehicleAlpha = 255.0f; - break; - case 2: - m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); - if (m_VehicleFadeTimer > 1000) { - m_VehicleState = 1; - m_VehicleFadeTimer = 1000; - } - fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f; - break; - case 3: - m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); - if (m_VehicleFadeTimer < 0) { - m_VehicleState = 0; - m_VehicleFadeTimer = 0; - } - fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f; - break; - case 4: - m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); - if (m_VehicleFadeTimer < 0) { - m_VehicleFadeTimer = 0; - m_pVehicleNameToPrint = m_pLastVehicleName; - m_VehicleNameTimer = 0; - m_VehicleState = 2; - } - fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f; - break; - default: - break; - } + if (!m_Message[0]) { + m_VehicleNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + CFont::SetJustifyOff(); + CFont::SetPropOn(); + CFont::SetBackgroundOff(); - if (!m_Message[0]) { - m_VehicleNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); - CFont::SetJustifyOff(); - CFont::SetPropOn(); - CFont::SetBackgroundOff(); - - if (FrontEndMenuManager.m_PrefsLanguage != LANGUAGE_ITALIAN && FrontEndMenuManager.m_PrefsLanguage != LANGUAGE_SPANISH) - CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); - else - CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f)); - - CFont::SetRightJustifyOn(); - CFont::SetRightJustifyWrap(0.0f); - CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); - CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f - 1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f - 1.0f), m_pVehicleNameToPrint); - - CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f), m_pVehicleNameToPrint); - } - } - } - else { - m_pLastVehicleName = 0; - m_VehicleState = 0; - m_VehicleFadeTimer = 0; - m_VehicleNameTimer = 0; - } + if (FrontEndMenuManager.m_PrefsLanguage != LANGUAGE_ITALIAN && FrontEndMenuManager.m_PrefsLanguage != LANGUAGE_SPANISH) + CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); + else + CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f)); - /* - DrawOnScreenTimer - */ - wchar sTimer[16]; + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetFontStyle(FONT_BANK); + CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f - 1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f - 1.0f), m_pVehicleNameToPrint); - CFont::SetPropOn(); - CFont::SetBackgroundOff(); - CFont::SetBackGroundOnlyTextOn(); - CFont::SetAlignment(ALIGN_RIGHT); - CFont::SetRightJustifyWrap(-SCREENW); - CFont::SetFontStyle(FONT_HEADING); - CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); + CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f), m_pVehicleNameToPrint); + } + } + } + else { + m_pLastVehicleName = nil; + m_VehicleState = 0; + m_VehicleFadeTimer = 0; + m_VehicleNameTimer = 0; + } - if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed) - TimerOnLastFrame = 0; - if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed) - CounterOnLastFrame = 0; + /* + DrawOnScreenTimer + */ + wchar sTimer[16]; - float AlignToHUD = SCREEN_SCALE_X(-12.0f); - if (CUserDisplay::OnscnTimer.m_bProcessed == 1) { - if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed == 1) { - if (!TimerOnLastFrame) - TimerFlashTimer = 1; + CFont::SetPropOn(); + CFont::SetBackgroundOff(); + CFont::SetBackGroundOnlyTextOn(); + CFont::SetAlignment(ALIGN_RIGHT); + CFont::SetRightJustifyWrap(-SCREENW); + CFont::SetFontStyle(FONT_HEADING); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); + + if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed) + TimerOnLastFrame = 0; + if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed) + CounterOnLastFrame = 0; + + float AlignToHUD = SCREEN_SCALE_X(-12.0f); + if (CUserDisplay::OnscnTimer.m_bProcessed == 1) { + if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed == 1) { + if (!TimerOnLastFrame) + TimerFlashTimer = 1; + + TimerOnLastFrame = 1; + + if (TimerFlashTimer) { + if (++TimerFlashTimer > 50) + TimerFlashTimer = 0; + } - TimerOnLastFrame = 1; + if (CTimer::GetFrameCounter() & 4 || !TimerFlashTimer) { + AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerBuffer, sTimer); + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(25.0f) + AlignToHUD, SCREEN_SCALE_Y(112.0f), sTimer); - if (TimerFlashTimer) { - if (++TimerFlashTimer > 50) - TimerFlashTimer = 0; - } + CFont::SetColor(CRGBA(186, 101, 50, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) + AlignToHUD, SCREEN_SCALE_Y(110.0f), sTimer); - if (CTimer::GetFrameCounter() & 4 || !TimerFlashTimer) { - AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerBuffer, sTimer); + if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(25.0f) + AlignToHUD, SCREEN_SCALE_Y(112.0f), sTimer); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(105.0f) + AlignToHUD, SCREEN_SCALE_Y(112.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) + AlignToHUD, SCREEN_SCALE_Y(110.0f), sTimer); - - if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) { - CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(105.0f) + AlignToHUD, SCREEN_SCALE_Y(112.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); - - CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(107.0f) + AlignToHUD, SCREEN_SCALE_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); - } + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(107.0f) + AlignToHUD, SCREEN_SCALE_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); } } - if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed == 1) { - if (!CounterOnLastFrame) - CounterFlashTimer = 1; + } + if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed == 1) { + if (!CounterOnLastFrame) + CounterFlashTimer = 1; - CounterOnLastFrame = 1; + CounterOnLastFrame = 1; - if (CounterFlashTimer) { - if (++CounterFlashTimer > 50) - CounterFlashTimer = 0; - } + if (CounterFlashTimer) { + if (++CounterFlashTimer > 50) + CounterFlashTimer = 0; + } - if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) { - if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) { - CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(73.0f) + AlignToHUD, SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT(23.0f) + AlignToHUD, SCREEN_SCALE_Y(151.0f)), CRGBA(0, 106, 164, 80)); - CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(73.0f) + AlignToHUD, SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT((-atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) * 0.5f) + 73.0f) + AlignToHUD, SCREEN_SCALE_Y(151.0f)), CRGBA(0, 106, 164, 255)); - } - else { - AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer); + if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) { + if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) { + CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(73.0f) + AlignToHUD, SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT(23.0f) + AlignToHUD, SCREEN_SCALE_Y(151.0f)), CRGBA(0, 106, 164, 80)); + CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(73.0f) + AlignToHUD, SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT((-atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) * 0.5f) + 73.0f) + AlignToHUD, SCREEN_SCALE_Y(151.0f)), CRGBA(0, 106, 164, 255)); + } + else { + AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer); - CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(25.0f) + AlignToHUD, SCREEN_SCALE_Y(134.0f), sTimer); + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(25.0f) + AlignToHUD, SCREEN_SCALE_Y(134.0f), sTimer); - CFont::SetColor(CRGBA(0, 106, 164, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) + AlignToHUD, SCREEN_SCALE_Y(132.0f), sTimer); - } + CFont::SetColor(CRGBA(0, 106, 164, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) + AlignToHUD, SCREEN_SCALE_Y(132.0f), sTimer); + } - if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) { - CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(86.0f) + AlignToHUD, SCREEN_SCALE_Y(134.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); + if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) { + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(86.0f) + AlignToHUD, SCREEN_SCALE_Y(134.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); - CFont::SetColor(CRGBA(0, 106, 164, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(88.0f) + AlignToHUD, SCREEN_SCALE_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); - } + CFont::SetColor(CRGBA(0, 106, 164, 255)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(88.0f) + AlignToHUD, SCREEN_SCALE_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); } } } + } - /* - DrawPager - */ - if (!m_PagerMessage[0]) { - if (PagerOn == 1) { - PagerSoundPlayed = false; - PagerOn = 2; - } + /* + DrawPager + */ + if (!m_PagerMessage[0]) { + if (PagerOn == 1) { + PagerSoundPlayed = false; + PagerOn = 2; } - if (m_PagerMessage[0] || PagerOn == 2) { - if (!PagerOn) { - PagerOn = 1; - PagerXOffset = 150.0f; + } + if (m_PagerMessage[0] || PagerOn == 2) { + if (!PagerOn) { + PagerOn = 1; + PagerXOffset = 150.0f; + } + if (PagerOn == 1) { + if (PagerXOffset > 0.0f) { + float fStep = PagerXOffset * 0.05f; + if (fStep > 10.0f) + fStep = 10.0f; + PagerXOffset -= fStep * CTimer::GetTimeStep(); } - if (PagerOn == 1) { - if (PagerXOffset > 0.0f) { - float fStep = PagerXOffset * 0.05f; - if (fStep > 10.0f) - fStep = 10.0f; - PagerXOffset -= fStep * CTimer::GetTimeStep(); - } - if (!PagerSoundPlayed) { - DMAudio.PlayFrontEndSound(96, 0); - PagerSoundPlayed = 1; - } + if (!PagerSoundPlayed) { + DMAudio.PlayFrontEndSound(96, 0); + PagerSoundPlayed = 1; } - else if (PagerOn == 2) { - float fStep = PagerXOffset * 0.05f; - if (fStep < 2.0f) - fStep = 2.0f; - PagerXOffset += fStep * CTimer::GetTimeStep(); - if (PagerXOffset > 150.0f) { - PagerXOffset = 150.0; - PagerOn = 0; - } + } + else if (PagerOn == 2) { + float fStep = PagerXOffset * 0.05f; + if (fStep < 2.0f) + fStep = 2.0f; + PagerXOffset += fStep * CTimer::GetTimeStep(); + if (PagerXOffset > 150.0f) { + PagerXOffset = 150.0; + PagerOn = 0; } - - Sprites[HUD_PAGER].Draw(CRect(SCREEN_SCALE_X(26.0f - PagerXOffset), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_X(160.0 + 26.0f - PagerXOffset), SCREEN_SCALE_Y(80.0f + 27.0f)), CRGBA(255, 255, 255, 255)); - - CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_SCALE_X(0.84f), SCREEN_SCALE_Y(1.0f)); - CFont::SetColor(CRGBA(32, 162, 66, 205)); - CFont::SetRightJustifyOff(); - CFont::SetBackgroundOff(); - CFont::SetCentreOff(); - CFont::SetJustifyOff(); - CFont::SetPropOff(); - CFont::SetFontStyle(FONT_PAGER); - CFont::PrintString(SCREEN_SCALE_X(52.0f - PagerXOffset), SCREEN_SCALE_Y(54.0f), m_PagerMessage); } - /* - DrawRadar - */ - if (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR) { - CRadar::DrawMap(); - CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); - // FIX: game doesn't scale RADAR_LEFT here - rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); - rect.Grow(4.0f); - Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); - CRadar::DrawBlips(); - } + Sprites[HUD_PAGER].Draw(CRect(SCREEN_SCALE_X(26.0f - PagerXOffset), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_X(160.0 + 26.0f - PagerXOffset), SCREEN_SCALE_Y(80.0f + 27.0f)), CRGBA(255, 255, 255, 255)); + + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_SCALE_X(0.84f), SCREEN_SCALE_Y(1.0f)); + CFont::SetColor(CRGBA(32, 162, 66, 205)); + CFont::SetRightJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetCentreOff(); + CFont::SetJustifyOff(); + CFont::SetPropOff(); + CFont::SetFontStyle(FONT_PAGER); + CFont::PrintString(SCREEN_SCALE_X(52.0f - PagerXOffset), SCREEN_SCALE_Y(54.0f), m_PagerMessage); } /* - Draw3dMarkers + DrawRadar */ - if (m_Wants_To_Draw_3dMarkers && !TheCamera.m_WideScreenOn && !m_BigMessage[0][0] && !m_BigMessage[2][0]) { - CRadar::Draw3dMarkers(); + if (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR) { + CRadar::DrawMap(); + CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); + // FIX: game doesn't scale RADAR_LEFT here + rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + rect.Grow(4.0f); + Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); + CRadar::DrawBlips(); } + } - /* - DrawScriptText - */ - if (!CTimer::GetIsUserPaused()) { - CTextLine* IntroText = CTheScripts::IntroTextLines; + /* + Draw3dMarkers + */ + if (m_Wants_To_Draw_3dMarkers && !TheCamera.m_WideScreenOn && !m_BigMessage[0][0] && !m_BigMessage[2][0]) { + CRadar::Draw3dMarkers(); + } - for (int i = 0; i < 2; i++) { - if (CTheScripts::IntroTextLines[i].m_awText[0] && CTheScripts::IntroTextLines[i].field_29) { - CFont::SetScale(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f)); - CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor); + /* + DrawScriptText + */ + if (!CTimer::GetIsUserPaused()) { + CTextLine* IntroText = CTheScripts::IntroTextLines; - if (CTheScripts::IntroTextLines[i].m_bJustify) - CFont::SetJustifyOn(); - else - CFont::SetJustifyOff(); + for (int i = 0; i < 2; i++) { + if (CTheScripts::IntroTextLines[i].m_awText[0] && CTheScripts::IntroTextLines[i].field_29) { + CFont::SetScale(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f)); + CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor); - if (CTheScripts::IntroTextLines[i].m_bRightJustify) - CFont::SetRightJustifyOn(); - else - CFont::SetRightJustifyOff(); + if (CTheScripts::IntroTextLines[i].m_bJustify) + CFont::SetJustifyOn(); + else + CFont::SetJustifyOff(); - if (CTheScripts::IntroTextLines[i].m_bCentered) - CFont::SetCentreOn(); - else - CFont::SetCentreOff(); + if (CTheScripts::IntroTextLines[i].m_bRightJustify) + CFont::SetRightJustifyOn(); + else + CFont::SetRightJustifyOff(); - CFont::SetWrapx(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fWrapX)); - CFont::SetCentreSize(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fCenterSize)); + if (CTheScripts::IntroTextLines[i].m_bCentered) + CFont::SetCentreOn(); + else + CFont::SetCentreOff(); - if (CTheScripts::IntroTextLines[i].m_bBackground) - CFont::SetBackgroundOn(); - else - CFont::SetBackgroundOff(); + CFont::SetWrapx(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fWrapX)); + CFont::SetCentreSize(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fCenterSize)); - CFont::SetBackgroundColor(CTheScripts::IntroTextLines[i].m_sBackgroundColor); + if (CTheScripts::IntroTextLines[i].m_bBackground) + CFont::SetBackgroundOn(); + else + CFont::SetBackgroundOff(); - if (CTheScripts::IntroTextLines[i].m_bBackgroundOnly) - CFont::SetBackGroundOnlyTextOn(); - else - CFont::SetBackGroundOnlyTextOff(); + CFont::SetBackgroundColor(CTheScripts::IntroTextLines[i].m_sBackgroundColor); - if (CTheScripts::IntroTextLines[i].m_bTextProportional) - CFont::SetPropOn(); - else - CFont::SetPropOff(); + if (CTheScripts::IntroTextLines[i].m_bBackgroundOnly) + CFont::SetBackGroundOnlyTextOn(); + else + CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(CTheScripts::IntroTextLines[i].m_nFont); - CFont::PrintString(SCREEN_SCALE_X(640.0f - CTheScripts::IntroTextLines[i].field_36), SCREEN_SCALE_Y(448.0f - CTheScripts::IntroTextLines[i].field_40), IntroText->m_awText); - } + if (CTheScripts::IntroTextLines[i].m_bTextProportional) + CFont::SetPropOn(); + else + CFont::SetPropOff(); + + CFont::SetFontStyle(CTheScripts::IntroTextLines[i].m_nFont); + CFont::PrintString(SCREEN_SCALE_X(640.0f - CTheScripts::IntroTextLines[i].field_36), SCREEN_SCALE_Y(448.0f - CTheScripts::IntroTextLines[i].field_40), IntroText->m_awText); } + } - CScriptRectangle* IntroRect = CTheScripts::IntroRectangles; + CScriptRectangle* IntroRect = CTheScripts::IntroRectangles; - for (int i = 0; i < 16; i++) { - if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bIsAntialiased) { - if (CTheScripts::IntroRectangles[i].m_wTextureId >= 0) { - CRect rect = { - CTheScripts::IntroRectangles[i].m_sRect.left, - CTheScripts::IntroRectangles[i].m_sRect.bottom, - CTheScripts::IntroRectangles[i].m_sRect.right, - CTheScripts::IntroRectangles[i].m_sRect.bottom }; + for (int i = 0; i < 16; i++) { + if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bIsAntialiased) { + if (CTheScripts::IntroRectangles[i].m_wTextureId >= 0) { + CRect rect = { + CTheScripts::IntroRectangles[i].m_sRect.left, + CTheScripts::IntroRectangles[i].m_sRect.bottom, + CTheScripts::IntroRectangles[i].m_sRect.right, + CTheScripts::IntroRectangles[i].m_sRect.bottom }; - CTheScripts::ScriptSprites[CTheScripts::IntroRectangles[i].m_wTextureId].Draw(rect, IntroRect->m_sColor); - } - else { - CRect rect = { - CTheScripts::IntroRectangles[i].m_sRect.left, - CTheScripts::IntroRectangles[i].m_sRect.bottom, - CTheScripts::IntroRectangles[i].m_sRect.right, - CTheScripts::IntroRectangles[i].m_sRect.bottom }; + CTheScripts::ScriptSprites[CTheScripts::IntroRectangles[i].m_wTextureId].Draw(rect, IntroRect->m_sColor); + } + else { + CRect rect = { + CTheScripts::IntroRectangles[i].m_sRect.left, + CTheScripts::IntroRectangles[i].m_sRect.bottom, + CTheScripts::IntroRectangles[i].m_sRect.right, + CTheScripts::IntroRectangles[i].m_sRect.bottom }; - CSprite2d::DrawRect(rect, IntroRect->m_sColor); - } + CSprite2d::DrawRect(rect, IntroRect->m_sColor); } } + } - /* - DrawSubtitles - */ - if (m_Message[0] && !m_BigMessage[2][0] && (FrontEndMenuManager.m_PrefsShowSubtitles == 1 || !TheCamera.m_WideScreenOn)) { - CFont::SetJustifyOff(); - CFont::SetBackgroundOff(); - CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128)); - CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.120f)); - CFont::SetCentreOn(); - CFont::SetPropOn(); - CFont::SetFontStyle(FONT_BANK); - - if (TheCamera.m_WideScreenOn) - CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(120.0f)); - else - CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(280.0f)); + /* + DrawSubtitles + */ + if (m_Message[0] && !m_BigMessage[2][0] && (FrontEndMenuManager.m_PrefsShowSubtitles == 1 || !TheCamera.m_WideScreenOn)) { + CFont::SetJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128)); + CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.120f)); + CFont::SetCentreOn(); + CFont::SetPropOn(); + CFont::SetFontStyle(FONT_BANK); - CFont::SetDropShadowPosition(1); - CFont::SetDropColor(CRGBA(0, 0, 0, 255)); - CFont::SetColor(CRGBA(235, 235, 235, 255)); - CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_FROM_BOTTOM(64.0f), m_Message); - CFont::SetDropShadowPosition(0); - } + if (TheCamera.m_WideScreenOn) + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(120.0f)); + else + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(280.0f)); - /* - DrawBigMessage - */ - // MissionCompleteFailedText - if (m_BigMessage[0][0]) { - if (BigMessageInUse[0] != 0.0f) { - CFont::SetJustifyOff(); - CFont::SetBackgroundOff(); - CFont::SetBackGroundOnlyTextOff(); - CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f)); - CFont::SetPropOn(); - CFont::SetCentreOn(); - CFont::SetCentreSize(SCREEN_SCALE_X(615.0f)); - CFont::SetFontStyle(FONT_HEADING); + CFont::SetDropShadowPosition(1); + CFont::SetDropColor(CRGBA(0, 0, 0, 255)); + CFont::SetColor(CRGBA(235, 235, 235, 255)); + CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_FROM_BOTTOM(64.0f), m_Message); + CFont::SetDropShadowPosition(0); + } - if (BigMessageX[0] >= (SCREENW - 20)) { - BigMessageInUse[0] += (CTimer::GetTimeStep() * 0.02f * 120.0f); + /* + DrawBigMessage + */ + // MissionCompleteFailedText + if (m_BigMessage[0][0]) { + if (BigMessageInUse[0] != 0.0f) { + CFont::SetJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f)); + CFont::SetPropOn(); + CFont::SetCentreOn(); + CFont::SetCentreSize(SCREEN_SCALE_X(615.0f)); + CFont::SetFontStyle(FONT_HEADING); - if (BigMessageInUse[0] >= 120.0f) { - BigMessageInUse[0] = 120.0; - BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * -255.0f); - } + if (BigMessageX[0] >= (SCREENW - 20)) { + BigMessageInUse[0] += (CTimer::GetTimeStep() * 0.02f * 120.0f); - if (BigMessageAlpha[0] <= 0.0f) { - m_BigMessage[0][0] = 0; - BigMessageAlpha[0] = 0.0; - } + if (BigMessageInUse[0] >= 120.0f) { + BigMessageInUse[0] = 120.0; + BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * -255.0f); } - else { - BigMessageX[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f); - BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f); - if (BigMessageAlpha[0] >= 255.0f) - BigMessageAlpha[0] = 255.0f; + if (BigMessageAlpha[0] <= 0.0f) { + m_BigMessage[0][0] = 0; + BigMessageAlpha[0] = 0.0; } - - CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[0])); - CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f - 2.0f), m_BigMessage[0]); - - CFont::SetColor(CRGBA(85, 119, 133, BigMessageAlpha[0])); - CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f), m_BigMessage[0]); } else { - BigMessageAlpha[0] = 0.0f; - BigMessageX[0] = -60.0f; - BigMessageInUse[0] = 1.0f; + BigMessageX[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + + if (BigMessageAlpha[0] >= 255.0f) + BigMessageAlpha[0] = 255.0f; } + + CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[0])); + CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f - 2.0f), m_BigMessage[0]); + + CFont::SetColor(CRGBA(85, 119, 133, BigMessageAlpha[0])); + CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f), m_BigMessage[0]); } else { - BigMessageInUse[0] = 0.0f; + BigMessageAlpha[0] = 0.0f; + BigMessageX[0] = -60.0f; + BigMessageInUse[0] = 1.0f; } + } + else { + BigMessageInUse[0] = 0.0f; + } - // WastedBustedText - if (m_BigMessage[2][0]) { - if (BigMessageInUse[2] != 0.0f) { - BigMessageAlpha[2] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + // WastedBustedText + if (m_BigMessage[2][0]) { + if (BigMessageInUse[2] != 0.0f) { + BigMessageAlpha[2] += (CTimer::GetTimeStep() * 0.02f * 255.0f); - if (BigMessageAlpha[2] > 255.0f) - BigMessageAlpha[2] = 255.0; + if (BigMessageAlpha[2] > 255.0f) + BigMessageAlpha[2] = 255.0; - CFont::SetBackgroundOff(); + CFont::SetBackgroundOff(); - if (CGame::frenchGame || CGame::germanGame) - CFont::SetScale(SCREEN_SCALE_X(1.4f), SCREEN_SCALE_Y(1.4f)); - else - CFont::SetScale(SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(2.0f)); + if (CGame::frenchGame || CGame::germanGame) + CFont::SetScale(SCREEN_SCALE_X(1.4f), SCREEN_SCALE_Y(1.4f)); + else + CFont::SetScale(SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(2.0f)); - CFont::SetPropOn(); - CFont::SetRightJustifyOn(); - CFont::SetFontStyle(FONT_HEADING); + CFont::SetPropOn(); + CFont::SetRightJustifyOn(); + CFont::SetFontStyle(FONT_HEADING); - CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2])); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f + 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]); + CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2])); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f + 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]); - CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2])); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]); - } - else { - BigMessageAlpha[2] = 0.0; - BigMessageInUse[2] = 1.0; - } + CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2])); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]); } else { - BigMessageInUse[2] = 0.0; + BigMessageAlpha[2] = 0.0; + BigMessageInUse[2] = 1.0; } } + else { + BigMessageInUse[2] = 0.0; + } } } #endif @@ -1242,9 +1234,9 @@ WRAPPER void CHud::GetRidOfAllHudMessages(void) { EAXJMP(0x504F90); } void CHud::GetRidOfAllHudMessages() { m_ZoneState = 0; - m_pLastZoneName = 0; + m_pLastZoneName = nil; m_ZoneNameTimer = 0; - m_pZoneName = 0; + m_pZoneName = nil; for (int i = 0; i < 256; i++) { m_HelpMessage[i] = 0; @@ -1257,9 +1249,9 @@ void CHud::GetRidOfAllHudMessages() m_HelpMessageState = 0; m_HelpMessageQuick = 0; m_HelpMessageDisplayTime = 1.0f; - m_VehicleName = 0; - m_pLastVehicleName = 0; - m_pVehicleNameToPrint = 0; + m_VehicleName = nil; + m_pLastVehicleName = nil; + m_pVehicleNameToPrint = nil; m_VehicleNameTimer = 0; m_VehicleFadeTimer = 0; m_VehicleState = 0; @@ -1292,8 +1284,8 @@ void CHud::Initialise() Sprites[i].SetTexture(WeaponFilenames[i * 2]); } - gpSniperSightTex = RwTextureRead("sitesniper", 0); - gpRocketSightTex = RwTextureRead("siterocket", 0); + gpSniperSightTex = RwTextureRead("sitesniper", nil); + gpRocketSightTex = RwTextureRead("siterocket", nil); CTxdStore::PopCurrentTxd(); } @@ -1435,10 +1427,10 @@ void CHud::Shutdown() } RwTextureDestroy(gpSniperSightTex); - gpSniperSightTex = 0; + gpSniperSightTex = nil; RwTextureDestroy(gpRocketSightTex); - gpRocketSightTex = 0; + gpRocketSightTex = nil; int HudTXD = CTxdStore::FindTxdSlot("hud"); CTxdStore::RemoveTxdSlot(HudTXD); diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index 1d344d35..1cf27ee0 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -107,7 +107,7 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect) void CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha) { - RwRGBA color = { red, green, blue, blur }; + RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur }; if(BlurOn){ if(pFrontBuffer){ if(ms_bJustInitialised) diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index 5b25cfa3..416e5af0 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -240,7 +240,7 @@ void CParticle::ReloadConfig() for ( int32 i = 0; i < MAX_PARTICLES_ON_SCREEN; i++ ) { if ( i == MAX_PARTICLES_ON_SCREEN - 1 ) - gParticleArray[i].m_pNext = NULL; + gParticleArray[i].m_pNext = nil; else gParticleArray[i].m_pNext = &gParticleArray[i + 1]; @@ -310,37 +310,37 @@ void CParticle::Initialise() for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ ) { - gpSmokeTex[i] = RwTextureRead(SmokeFiles[i], NULL); + gpSmokeTex[i] = RwTextureRead(SmokeFiles[i], nil); gpSmokeRaster[i] = RwTextureGetRaster(gpSmokeTex[i]); } for ( int32 i = 0; i < MAX_SMOKE2_FILES; i++ ) { - gpSmoke2Tex[i] = RwTextureRead(Smoke2Files[i], NULL); + gpSmoke2Tex[i] = RwTextureRead(Smoke2Files[i], nil); gpSmoke2Raster[i] = RwTextureGetRaster(gpSmoke2Tex[i]); } for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ ) { - gpRubberTex[i] = RwTextureRead(RubberFiles[i], NULL); + gpRubberTex[i] = RwTextureRead(RubberFiles[i], nil); gpRubberRaster[i] = RwTextureGetRaster(gpRubberTex[i]); } for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ ) { - gpRainSplashTex[i] = RwTextureRead(RainSplashFiles[i], NULL); + gpRainSplashTex[i] = RwTextureRead(RainSplashFiles[i], nil); gpRainSplashRaster[i] = RwTextureGetRaster(gpRainSplashTex[i]); } for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ ) { - gpWatersprayTex[i] = RwTextureRead(WatersprayFiles[i], NULL); + gpWatersprayTex[i] = RwTextureRead(WatersprayFiles[i], nil); gpWatersprayRaster[i] = RwTextureGetRaster(gpWatersprayTex[i]); } for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ ) { - gpExplosionMediumTex[i] = RwTextureRead(ExplosionMediumFiles[i], NULL); + gpExplosionMediumTex[i] = RwTextureRead(ExplosionMediumFiles[i], nil); gpExplosionMediumRaster[i] = RwTextureGetRaster(gpExplosionMediumTex[i]); } @@ -352,13 +352,13 @@ void CParticle::Initialise() for ( int32 i = 0; i < MAX_RAINDROP_FILES; i++ ) { - gpRainDropTex[i] = RwTextureRead(RaindropFiles[i], NULL); + gpRainDropTex[i] = RwTextureRead(RaindropFiles[i], nil); gpRainDropRaster[i] = RwTextureGetRaster(gpRainDropTex[i]); } for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ ) { - gpRainSplashupTex[i] = RwTextureRead(RainSplashupFiles[i], NULL); + gpRainSplashupTex[i] = RwTextureRead(RainSplashupFiles[i], nil); gpRainSplashupRaster[i] = RwTextureGetRaster(gpRainSplashupTex[i]); } @@ -370,57 +370,57 @@ void CParticle::Initialise() for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ ) { - gpCarDebrisTex[i] = RwTextureRead(CardebrisFiles[i], NULL); + gpCarDebrisTex[i] = RwTextureRead(CardebrisFiles[i], nil); gpCarDebrisRaster[i] = RwTextureGetRaster(gpCarDebrisTex[i]); } for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ ) { - gpCarSplashTex[i] = RwTextureRead(CarsplashFiles[i], NULL); + gpCarSplashTex[i] = RwTextureRead(CarsplashFiles[i], nil); gpCarSplashRaster[i] = RwTextureGetRaster(gpCarSplashTex[i]); } gpFlame1Tex = RwTextureRead("flame1", NULL); gpFlame1Raster = RwTextureGetRaster(gpFlame1Tex); - gpFlame5Tex = RwTextureRead("flame5", NULL); + gpFlame5Tex = RwTextureRead("flame5", nil); gpFlame5Raster = RwTextureGetRaster(gpFlame1Tex); // copy-paste bug ? - gpRainDropSmallTex = RwTextureRead("rainsmall", NULL); + gpRainDropSmallTex = RwTextureRead("rainsmall", nil); gpRainDropSmallRaster = RwTextureGetRaster(gpRainDropSmallTex); - gpBloodTex = RwTextureRead("blood", NULL); + gpBloodTex = RwTextureRead("blood", nil); gpBloodRaster = RwTextureGetRaster(gpBloodTex); - gpLeafTex = RwTextureRead("gameleaf01_64", NULL); + gpLeafTex = RwTextureRead("gameleaf01_64", nil); gpLeafRaster = RwTextureGetRaster(gpLeafTex); - gpCloudTex1 = RwTextureRead("cloud3", NULL); + gpCloudTex1 = RwTextureRead("cloud3", nil); gpCloudRaster1 = RwTextureGetRaster(gpCloudTex1); - gpCloudTex4 = RwTextureRead("cloudmasked", NULL); + gpCloudTex4 = RwTextureRead("cloudmasked", nil); gpCloudRaster4 = RwTextureGetRaster(gpCloudTex4); - gpBloodSmallTex = RwTextureRead("bloodsplat2", NULL); + gpBloodSmallTex = RwTextureRead("bloodsplat2", nil); gpBloodSmallRaster = RwTextureGetRaster(gpBloodSmallTex); - gpGungeTex = RwTextureRead("gunge", NULL); + gpGungeTex = RwTextureRead("gunge", nil); gpGungeRaster = RwTextureGetRaster(gpGungeTex); - gpCollisionSmokeTex = RwTextureRead("collisionsmoke", NULL); + gpCollisionSmokeTex = RwTextureRead("collisionsmoke", nil); gpCollisionSmokeRaster = RwTextureGetRaster(gpCollisionSmokeTex); - gpBulletHitTex = RwTextureRead("bullethitsmoke", NULL); + gpBulletHitTex = RwTextureRead("bullethitsmoke", nil); gpBulletHitRaster = RwTextureGetRaster(gpBulletHitTex); - gpGunShellTex = RwTextureRead("gunshell", NULL); + gpGunShellTex = RwTextureRead("gunshell", nil); gpGunShellRaster = RwTextureGetRaster(gpGunShellTex); - gpWakeOldTex = RwTextureRead("wake_old", NULL); + gpWakeOldTex = RwTextureRead("wake_old", nil); gpWakeOldRaster = RwTextureGetRaster(gpWakeOldTex); - gpPointlightTex = RwTextureRead("pointlight", NULL); + gpPointlightTex = RwTextureRead("pointlight", nil); gpPointlightRaster = RwTextureGetRaster(gpPointlightTex); CTxdStore::PopCurrentTxd(); @@ -451,7 +451,7 @@ void CParticle::Initialise() case PARTICLE_GUNSMOKE: case PARTICLE_SPLASH: - entry->m_ppRaster = NULL; + entry->m_ppRaster = nil; break; case PARTICLE_FLAME: @@ -584,7 +584,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpSmokeTex[i]); #ifdef GTA3_1_1_PATCH - gpSmokeTex[i] = NULL; + gpSmokeTex[i] = nil; #endif } @@ -592,7 +592,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpSmoke2Tex[i]); #ifdef GTA3_1_1_PATCH - gpSmoke2Tex[i] = NULL; + gpSmoke2Tex[i] = nil; #endif } @@ -600,7 +600,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpRubberTex[i]); #ifdef GTA3_1_1_PATCH - gpRubberTex[i] = NULL; + gpRubberTex[i] = nil; #endif } @@ -608,7 +608,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpRainSplashTex[i]); #ifdef GTA3_1_1_PATCH - gpRainSplashTex[i] = NULL; + gpRainSplashTex[i] = nil; #endif } @@ -616,7 +616,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpWatersprayTex[i]); #ifdef GTA3_1_1_PATCH - gpWatersprayTex[i] = NULL; + gpWatersprayTex[i] = nil; #endif } @@ -624,7 +624,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpExplosionMediumTex[i]); #ifdef GTA3_1_1_PATCH - gpExplosionMediumTex[i] = NULL; + gpExplosionMediumTex[i] = nil; #endif } @@ -632,7 +632,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpGunFlashTex[i]); #ifdef GTA3_1_1_PATCH - gpGunFlashTex[i] = NULL; + gpGunFlashTex[i] = nil; #endif } @@ -640,7 +640,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpRainDropTex[i]); #ifdef GTA3_1_1_PATCH - gpRainDropTex[i] = NULL; + gpRainDropTex[i] = nil; #endif } @@ -648,7 +648,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpRainSplashupTex[i]); #ifdef GTA3_1_1_PATCH - gpRainSplashupTex[i] = NULL; + gpRainSplashupTex[i] = nil; #endif } @@ -656,7 +656,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpBirdfrontTex[i]); #ifdef GTA3_1_1_PATCH - gpBirdfrontTex[i] = NULL; + gpBirdfrontTex[i] = nil; #endif } @@ -664,7 +664,7 @@ void CParticle::Shutdown() { RwTextureDestroy(gpCarDebrisTex[i]); #ifdef GTA3_1_1_PATCH - gpCarDebrisTex[i] = NULL; + gpCarDebrisTex[i] = nil; #endif } @@ -672,78 +672,78 @@ void CParticle::Shutdown() { RwTextureDestroy(gpCarSplashTex[i]); #ifdef GTA3_1_1_PATCH - gpCarSplashTex[i] = NULL; + gpCarSplashTex[i] = nil; #endif } RwTextureDestroy(gpFlame1Tex); #ifdef GTA3_1_1_PATCH - gpFlame1Tex = NULL; + gpFlame1Tex = nil; #endif RwTextureDestroy(gpFlame5Tex); #ifdef GTA3_1_1_PATCH - gpFlame5Tex = NULL; + gpFlame5Tex = nil; #endif RwTextureDestroy(gpRainDropSmallTex); #ifdef GTA3_1_1_PATCH - gpRainDropSmallTex = NULL; + gpRainDropSmallTex = nil; #endif RwTextureDestroy(gpBloodTex); #ifdef GTA3_1_1_PATCH - gpBloodTex = NULL; + gpBloodTex = nil; #endif RwTextureDestroy(gpLeafTex); #ifdef GTA3_1_1_PATCH - gpLeafTex = NULL; + gpLeafTex = nil; #endif RwTextureDestroy(gpCloudTex1); #ifdef GTA3_1_1_PATCH - gpCloudTex1 = NULL; + gpCloudTex1 = nil; #endif RwTextureDestroy(gpCloudTex4); #ifdef GTA3_1_1_PATCH - gpCloudTex4 = NULL; + gpCloudTex4 = nil; #endif RwTextureDestroy(gpBloodSmallTex); #ifdef GTA3_1_1_PATCH - gpBloodSmallTex = NULL; + gpBloodSmallTex = nil; #endif RwTextureDestroy(gpGungeTex); #ifdef GTA3_1_1_PATCH - gpGungeTex = NULL; + gpGungeTex = nil; #endif RwTextureDestroy(gpCollisionSmokeTex); #ifdef GTA3_1_1_PATCH - gpCollisionSmokeTex = NULL; + gpCollisionSmokeTex = nil; #endif RwTextureDestroy(gpBulletHitTex); #ifdef GTA3_1_1_PATCH - gpBulletHitTex = NULL; + gpBulletHitTex = nil; #endif RwTextureDestroy(gpGunShellTex); #ifdef GTA3_1_1_PATCH - gpGunShellTex = NULL; + gpGunShellTex = nil; #endif RwTextureDestroy(gpWakeOldTex); #ifdef GTA3_1_1_PATCH - gpWakeOldTex = NULL; + gpWakeOldTex = nil; #endif RwTextureDestroy(gpPointlightTex); #ifdef GTA3_1_1_PATCH - gpPointlightTex = NULL; + gpPointlightTex = nil; #endif int32 slot; @@ -775,18 +775,18 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe || type == PARTICLE_CARCOLLISION_DUST ) && nParticleCreationInterval & CTimer::GetFrameCounter() ) { - return NULL; + return nil; } CParticle *pParticle = m_pUnusedListHead; - if ( pParticle == NULL ) - return NULL; + if ( pParticle == nil ) + return nil; tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[type]; if ( psystem->m_fCreateRange != 0.0f && psystem->m_fCreateRange < ( TheCamera.GetPosition() - vecPos ).MagnitudeSqr() ) - return NULL; + return nil; pParticle->m_fSize = psystem->m_fDefaultInitialRadius; @@ -918,13 +918,13 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe if ( !CWorld::ProcessVerticalLine( pParticle->m_vecPosition + CVector(0.0f, 0.0f, 0.5f), - -100.0f, point, entity, true, true, false, false, true, false, NULL) ) + -100.0f, point, entity, true, true, false, false, true, false, nil) ) { - return NULL; + return nil; } if ( point.point.z >= pParticle->m_vecPosition.z ) - return NULL; + return nil; pParticle->m_fZGround = point.point.z; bValidGroundFound = true; @@ -944,7 +944,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe Z_Ground = CWorld::FindGroundZFor3DCoord(vecPos.x, vecPos.y, vecPos.z, (bool *)&bZFound); if ( bZFound == false ) - return NULL; + return nil; pParticle->m_fZGround = Z_Ground; } @@ -1009,13 +1009,13 @@ void CParticle::Update() { tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i]; CParticle *particle = psystem->m_pParticles; - CParticle *prevParticle = NULL; + CParticle *prevParticle = nil; bool bRemoveParticle; - if ( particle == NULL ) + if ( particle == nil ) continue; - for ( ; particle != NULL; _Next(particle, prevParticle, psystem, bRemoveParticle) ) + for ( ; particle != nil; _Next(particle, prevParticle, psystem, bRemoveParticle) ) { bRemoveParticle = false; @@ -1121,7 +1121,7 @@ void CParticle::Update() particle->m_vecPosition.y, 0.05f + particle->m_fZGround ), - CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, 0, 0, 0, 0); + CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, 0, 0, 0, 0); } else { @@ -1132,7 +1132,7 @@ void CParticle::Update() particle->m_vecPosition.y, 0.05f + particle->m_fZGround ), - CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, 0, 0, 0, 0); + CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, 0, 0, 0, 0); } continue; @@ -1156,7 +1156,7 @@ void CParticle::Update() particle->m_vecPosition.y, 0.05f + particle->m_fZGround ), - CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, 0, 0, 0, 0); + CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, 0, 0, 0, 0); } else { @@ -1167,7 +1167,7 @@ void CParticle::Update() particle->m_vecPosition.y, 0.05f + particle->m_fZGround ), - CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, 0, 0, 0, 0); + CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, 0, 0, 0, 0); } } @@ -1218,7 +1218,7 @@ void CParticle::Update() CEntity *entity; if ( CWorld::ProcessVerticalLine(particle->m_vecPosition, moveStep.z, point, entity, - true, true, false, false, true, false, NULL) ) + true, true, false, false, true, false, nil) ) { if ( moveStep.z <= point.point.z ) { @@ -1258,7 +1258,7 @@ void CParticle::Update() CGeneral::GetRandomNumberInRange(-0.02f, 0.02f), CGeneral::GetRandomNumberInRange(0.05f, 0.1f) ), - NULL, + nil, particle->m_fSize, color, particle->m_nRotationStep, 0, 0, 0); PlayOneShotScriptObject(_SOUND_BULLET_SHELL_HIT_GROUND_1, particle->m_vecPosition); @@ -1277,7 +1277,7 @@ void CParticle::Update() 0.05f + particle->m_fZGround ), CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.03f, 0.06f)), - NULL, + nil, particle->m_fSize, color, 0, 0, 0, 0); PlayOneShotScriptObject(_SOUND_BULLET_SHELL_HIT_GROUND_2, particle->m_vecPosition); @@ -1309,7 +1309,7 @@ void CParticle::Update() CEntity *entity; if ( CWorld::ProcessVerticalLine(particle->m_vecPosition, moveStep.z, point, entity, - true, false, false, false, true, false, NULL) ) + true, false, false, false, true, false, nil) ) { if ( moveStep.z <= point.point.z ) { @@ -1317,7 +1317,7 @@ void CParticle::Update() if ( psystem->m_Type == PARTICLE_HELI_ATTACK ) { bRemoveParticle = true; - AddParticle(PARTICLE_STEAM, moveStep, CVector(0.0f, 0.0f, 0.05f), NULL, 0.2f, 0, 0, 0, 0); + AddParticle(PARTICLE_STEAM, moveStep, CVector(0.0f, 0.0f, 0.05f), nil, 0.2f, 0, 0, 0, 0); continue; } } @@ -1444,7 +1444,7 @@ void CParticle::Render() uint32 flags = DRAW_OPAQUE; - RwRaster *prevFrame = NULL; + RwRaster *prevFrame = nil; for ( int32 i = 0; i < MAX_PARTICLES; i++ ) { @@ -1495,7 +1495,7 @@ void CParticle::Render() flags = psystem->Flags; } - if ( frames != NULL ) + if ( frames != nil ) { RwRaster *curFrame = *frames; if ( curFrame != prevFrame ) @@ -1507,14 +1507,14 @@ void CParticle::Render() } } - while ( particle != NULL ) + while ( particle != nil ) { bool canDraw = true; if ( particle->m_nAlpha == 0 ) canDraw = false; - if ( canDraw && psystem->m_nFinalAnimationFrame != 0 && frames != NULL ) + if ( canDraw && psystem->m_nFinalAnimationFrame != 0 && frames != nil ) { RwRaster *curFrame = frames[particle->m_nCurrentFrame]; if ( prevFrame != curFrame ) @@ -1754,7 +1754,7 @@ void CParticle::RemovePSystem(tParticleType type) tParticleSystemData *psystemdata = &mod_ParticleSystemManager.m_aParticles[type]; for ( CParticle *particle = psystemdata->m_pParticles; particle; particle = psystemdata->m_pParticles ) - RemoveParticle(particle, NULL, psystemdata); + RemoveParticle(particle, nil, psystemdata); } void CParticle::RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, tParticleSystemData *pPSystemData) @@ -1796,7 +1796,7 @@ void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize CGeneral::GetRandomNumberInRange(-0.2f, 0.2f), CGeneral::GetRandomNumberInRange(-0.2f, 0.0f) ), - NULL, + nil, fSize, color, 0, 0, 0, 0); AddParticle(PARTICLE_EXPLOSION_MFAST, @@ -1807,7 +1807,7 @@ void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize CGeneral::GetRandomNumberInRange(-0.04f, 0.04f), CGeneral::GetRandomNumberInRange(0.0f, 0.07f) ), - NULL, + nil, fSize, color, 0, 0, 0, 0); AddParticle(PARTICLE_EXPLOSION_MFAST, @@ -1818,7 +1818,7 @@ void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize CGeneral::GetRandomNumberInRange(-0.04f, 0.04f), CGeneral::GetRandomNumberInRange(0.0f, 0.07f) ), - NULL, + nil, fSize, color, 0, 0, 0, 0); vecStepPos += vecRandOffset; @@ -1843,7 +1843,7 @@ void CParticle::AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatr AddParticle(PARTICLE_CARCOLLISION_DUST, pos, CVector(0.0f, 0.0f, 0.0f), - NULL, + nil, 0.3f, color, 0, 0, 0, 0); } } diff --git a/src/render/Particle.h b/src/render/Particle.h index 5db91727..92b6809e 100644 --- a/src/render/Particle.h +++ b/src/render/Particle.h @@ -65,7 +65,7 @@ public: static void Initialise(); static void Shutdown(); - static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = NULL, float fSize = 0.0f, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0); + static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = nil, float fSize = 0.0f, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0); static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0); static void Update(); diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp index 440ea9cb..7a1804de 100644 --- a/src/render/ParticleMgr.cpp +++ b/src/render/ParticleMgr.cpp @@ -19,7 +19,7 @@ void cParticleSystemMgr::Initialise() LoadParticleData(); for ( int32 i = 0; i < MAX_PARTICLES; i++ ) - m_aParticles[i].m_pParticles = NULL; + m_aParticles[i].m_pParticles = nil; } void cParticleSystemMgr::LoadParticleData() @@ -28,7 +28,7 @@ void cParticleSystemMgr::LoadParticleData() CFileMgr::LoadFile(ParticleFilename, work_buff, ARRAY_SIZE(work_buff), "r"); CFileMgr::SetDir(""); - tParticleSystemData *entry = NULL; + tParticleSystemData *entry = nil; int32 type = PARTICLE_FIRST; char *lineStart = (char *)work_buff; @@ -39,8 +39,8 @@ void cParticleSystemMgr::LoadParticleData() while ( true ) { - ASSERT(lineStart != NULL); - ASSERT(lineEnd != NULL); + ASSERT(lineStart != nil); + ASSERT(lineEnd != nil); while ( *lineEnd != '\n' ) ++lineEnd; @@ -64,7 +64,7 @@ void cParticleSystemMgr::LoadParticleData() char *value = strtok(line, delims); - ASSERT(value != NULL); + ASSERT(value != nil); do { @@ -73,7 +73,7 @@ void cParticleSystemMgr::LoadParticleData() case CFG_PARAM_PARTICLE_TYPE_NAME: ASSERT(type < MAX_PARTICLES); entry = &m_aParticles[type]; - ASSERT(entry != NULL); + ASSERT(entry != nil); entry->m_Type = (tParticleType)type++; strcpy(entry->m_aName, value); break; @@ -227,14 +227,14 @@ void cParticleSystemMgr::LoadParticleData() break; } - value = strtok(NULL, delims); + value = strtok(nil, delims); param++; if ( param > CFG_PARAM_LAST ) param = CFG_PARAM_FIRST; - } while ( value != NULL ); + } while ( value != nil ); } lineEnd++; |