1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-26 18:15:27 +00:00

Merge pull request #583 from erorcun/miami

Menu borders and weapon fixes
This commit is contained in:
aap 2020-05-24 10:47:17 +02:00 committed by GitHub
commit 19a0c8b462
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 384 additions and 225 deletions

View file

@ -1596,7 +1596,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
CWorld::pIgnoreEntity = nil;
float ViewPlaneHeight = Tan(DEGTORAD(FOV) / 2.0f);
float ViewPlaneWidth = ViewPlaneHeight * CDraw::FindAspectRatio() * fTweakFOV;
float ViewPlaneWidth = ViewPlaneHeight * CDraw::CalculateAspectRatio() * fTweakFOV;
float Near = RwCameraGetNearClipPlane(Scene.camera);
float radius = ViewPlaneWidth*Near;
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
@ -4574,7 +4574,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
CWorld::pIgnoreEntity = nil;
float ViewPlaneHeight = Tan(DEGTORAD(FOV) / 2.0f);
float ViewPlaneWidth = ViewPlaneHeight * CDraw::FindAspectRatio() * fTweakFOV;
float ViewPlaneWidth = ViewPlaneHeight * CDraw::CalculateAspectRatio() * fTweakFOV;
float Near = RwCameraGetNearClipPlane(Scene.camera);
float radius = ViewPlaneWidth*Near;
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);

View file

@ -3117,15 +3117,6 @@ CCamera::Fade(float timeout, int16 direction)
m_iMusicFadingDirection = direction;
m_fTimeToFadeMusic = timeout;
m_uiFadeTimeStartedMusic = CTimer::GetTimeInMilliseconds();
// Not on PS2
if(!m_bJustJumpedOutOf1stPersonBecauseOfTarget && m_iMusicFadingDirection == FADE_OUT){
unknown++;
if(unknown >= 2){
m_bJustJumpedOutOf1stPersonBecauseOfTarget = true;
unknown = 0;
}else
m_bMoveCamToAvoidGeom = true;
}
}
}
@ -3314,8 +3305,9 @@ CCamera::CalculateDerivedValues(void)
// left plane
m_vecFrustumNormals[1] = CVector(-c, -s, 0.0f);
c /= CDraw::FindAspectRatio();
s /= CDraw::FindAspectRatio();
CDraw::CalculateAspectRatio();
c /= SCREEN_ASPECT_RATIO;
s /= SCREEN_ASPECT_RATIO;
// bottom plane
m_vecFrustumNormals[2] = CVector(0.0f, -s, -c);
// top plane

View file

@ -37,6 +37,9 @@
#include "Messages.h"
#include "FileLoader.h"
// TODO(Miami): This is -3 on VC but still -1 on AudioManager?!? What the hell?
#define INVALID_AUDIO_PROVIDER -1
// Similar story to Hud.cpp:
// Game has colors inlined in code.
// For easier modification we collect them here:
@ -178,43 +181,6 @@ ScaleAndCenterX(float x)
#define MENU_Y(y) StretchY(y)
#endif
#ifdef PS2_LIKE_MENU
#define ChangeScreen(screen, option, updateDelay, withReverseAlpha) \
do { \
if (reverseAlpha) { \
m_nPrevScreen = m_nCurrScreen; \
m_nCurrScreen = pendingScreen; \
m_nCurrOption = pendingOption; \
reverseAlpha = false; \
if (updateDelay) \
m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode(); \
} \
if (withReverseAlpha) { \
pendingOption = option; \
pendingScreen = screen; \
reverseAlpha = true; \
} else { \
m_nPrevScreen = m_nCurrScreen; \
m_nCurrScreen = screen; \
m_nCurrOption = option; \
if (updateDelay) \
m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode(); \
} \
m_nMenuFadeAlpha = 255; \
} while(0)
#else
#define ChangeScreen(screen, option, updateDelay, clearAlpha) \
do { \
m_nPrevScreen = m_nCurrScreen; \
m_nCurrScreen = screen; \
m_nCurrOption = option; \
if(updateDelay) \
m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode(); \
if(clearAlpha) \
m_nMenuFadeAlpha = 0; \
} while(0)
#endif
#define PREPARE_MENU_HEADER \
CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255))); \
CFont::SetRightJustifyOn(); \
@ -248,6 +214,76 @@ ScaleAndCenterX(float x)
// --- Functions not in the game/inlined starts
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
void DoRWStuffEndOfFrame(void);
#ifdef PS2_LIKE_MENU
void
CMenuManager::SwitchToNewScreen(int8 screen)
{
if (reverseAlpha) {
m_nPrevScreen = m_nCurrScreen;
m_nCurrScreen = pendingScreen;
m_nCurrOption = pendingOption;
reverseAlpha = false;
if (updateDelay)
m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
}
if (withReverseAlpha) {
pendingOption = option;
pendingScreen = screen;
reverseAlpha = true;
} else {
m_nPrevScreen = m_nCurrScreen;
m_nCurrScreen = screen;
m_nCurrOption = option;
if (updateDelay)
m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
}
m_nMenuFadeAlpha = 255;
}
#else
// --MIAMI: Done except using VC's gMenuPages
void
CMenuManager::SwitchToNewScreen(int8 screen)
{
bMenuChangeOngoing = true;
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DrawBackground(true);
DoRWStuffEndOfFrame();
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DrawBackground(true);
DoRWStuffEndOfFrame();
m_nPrevScreen = m_nCurrScreen;
m_ShowEmptyBindingError = false;
ResetHelperText();
ThingsToDoBeforeLeavingPage();
if (screen == -2) {
int oldScreen = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0];
int oldOption = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] :
(m_nCurrScreen == MENUPAGE_NEW_GAME ? 0 : (m_nCurrScreen == MENUPAGE_OPTIONS ? 1 : (m_nCurrScreen == MENUPAGE_EXIT ? 2 : aScreens[m_nCurrScreen].m_ParentEntry[0])));
m_nCurrOption = oldOption;
m_nCurrScreen = oldScreen;
} else if (screen == 0) {
m_nCurrScreen = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu;
m_nCurrOption = 0;
} else {
m_nCurrOption = 0;
m_nCurrScreen = screen;
}
if (m_nCurrScreen == MENUPAGE_CHOOSE_SAVE_SLOT)
m_nCurrOption = 8;
m_nMenuFadeAlpha = 0;
bOptionHighlightTransitionBlend = 0;
m_LastScreenSwitch = CTimer::GetTimeInMilliseconds();
}
#endif
inline void
CMenuManager::ScrollUpListByOne()
{
@ -314,13 +350,14 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
}
}
// TODO(Miami)
inline void
CMenuManager::ThingsToDoBeforeLeavingPage()
{
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
} else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) {
if (m_nPrefsAudio3DProviderIndex != -1)
if (m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER)
m_nPrefsAudio3DProviderIndex = DMAudio.GetCurrent3DProviderIndex();
#ifdef TIDY_UP_PBP
DMAudio.StopFrontEndTrack();
@ -381,7 +418,7 @@ CMenuManager::CMenuManager()
OS_Language = LANG_ENGLISH;
m_ControlMethod = CONTROL_STANDARD;
CCamera::m_bUseMouse3rdPerson = true;
m_3DProviderOnLastSaveLoad = 0;
m_lastWorking3DAudioProvider = 0;
m_nFirstVisibleRowOnList = 0;
m_nScrollbarTopMargin = 0.0f;
m_nSelectedListRow = 0;
@ -421,9 +458,6 @@ CMenuManager::SetFrontEndRenderStates(void)
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
}
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
void DoRWStuffEndOfFrame(void);
void
CMenuManager::Initialise(void)
{
@ -762,11 +796,6 @@ CMenuManager::DrawStandardMenus()
case MENUPAGE_BRIEFS:
PrintBriefs();
break;
#ifdef MENU_MAP
case MENUPAGE_MAP:
PrintMap();
break;
#endif
}
// Header height isn't accounted, we will add that later.
@ -1079,7 +1108,7 @@ CMenuManager::DrawStandardMenus()
break;
#endif
case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex == -1)
if (m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER)
rightText = TheText.Get("FEA_NAH");
else {
char *provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
@ -1094,7 +1123,7 @@ CMenuManager::DrawStandardMenus()
}
break;
case MENUACTION_SPEAKERCONF: {
if (m_nPrefsAudio3DProviderIndex == -1)
if (m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER)
rightText = TheText.Get("FEA_NAH");
else {
switch (m_PrefsSpeakers) {
@ -1233,7 +1262,7 @@ CMenuManager::DrawStandardMenus()
}
if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) {
if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH") != 0
&& m_nCurrScreen == MENUPAGE_SOUND_SETTINGS && m_nPrefsAudio3DProviderIndex != -1) {
&& m_nCurrScreen == MENUPAGE_SOUND_SETTINGS && m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) {
m_nPrefsAudio3DProviderIndex = DMAudio.GetCurrent3DProviderIndex();
SetHelperText(3);
@ -2005,10 +2034,7 @@ CMenuManager::DrawFrontEnd()
if (m_menuTransitionProgress == 255 && m_nMenuFadeAlpha == 255)
bMenuChangeOngoing = false;
DrawBackground();
// TODO(Miami): Delete dis
PrintErrorMessage();
DrawBackground(false);
}
#ifdef PS2_LIKE_MENU
@ -2204,8 +2230,10 @@ CMenuManager::DrawBackground()
}
}
#else
// --MIAMI: Done except commented things
void
CMenuManager::DrawBackground()
CMenuManager::DrawBackground(bool transitionCall)
{
if (!m_bSpritesLoaded)
return;
@ -2216,34 +2244,174 @@ CMenuManager::DrawBackground()
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255));
}
if (m_nMenuFadeAlpha != 0) {
if (m_nMenuFadeAlpha < 255) {
if (m_nMenuFadeAlpha < 255) {
// Famous transparent menu bug
#ifdef FIX_BUGS
static float fadeAlpha = 0.0f;
if (m_nMenuFadeAlpha == 0 && fadeAlpha > 1.0f) fadeAlpha = 0.0f;
menuBg.Translate(m_nMenuFadeAlpha);
SetFrontEndRenderStates();
m_aFrontEndSprites[MENUSPRITE_BACKGROUND].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, FadeIn(255)));
if (m_nCurrScreen == MENUPAGE_MAP)
PrintMap();
// +20 per every 33 ms (1000.f/30.f - original frame limiter fps)
fadeAlpha += (frameTime) * 20.f / 33.f;
m_nMenuFadeAlpha = fadeAlpha;
m_menuTransitionProgress = clamp(fadeAlpha, 0, 255);
#else
static uint32 LastFade = 0;
// Left border
CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT,
SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), 0.0f, 0.0f, CRGBA(0, 0, 0, 255));
if(CTimer::GetTimeInMillisecondsPauseMode() - LastFade > 10){
m_nMenuFadeAlpha += 20;
LastFade = CTimer::GetTimeInMillisecondsPauseMode();
// Top border
CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y),
SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), SCREEN_WIDTH, 0.0f, 0.0f, 0.0f, CRGBA(0, 0, 0, 255));
// Bottom border
CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y),
SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), CRGBA(0, 0, 0, 255));
// Right border
CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y),
SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255));
} else {
m_nMenuFadeAlpha = 255;
m_menuTransitionProgress = 255;
m_aFrontEndSprites[MENUSPRITE_BACKGROUND].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, FadeIn(255)));
if (m_nCurrScreen == MENUPAGE_MAP)
PrintMap();
// Left border
CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT,
SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), 0.0f, 0.0f, CRGBA(0, 0, 0, 255));
// Top border
CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y),
SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), SCREEN_WIDTH, 0.0f, 0.0f, 0.0f, CRGBA(0, 0, 0, 255));
// Bottom border
CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y),
SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), CRGBA(0, 0, 0, 255));
// Right border
CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y),
SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255));
}
#endif
} else {
m_nMenuFadeAlpha = 255;
m_menuTransitionProgress = 255;
menuBg.SaveCurrentCoors();
switch (m_nCurrScreen) {
case MENUPAGE_STATS:
menuBg.topLeft_x = 70.0f;
menuBg.topLeft_y = 75.0f;
menuBg.topRight_x = 550.0f;
menuBg.topRight_y = 16.0f;
menuBg.bottomLeft_x = 74.0f;
menuBg.bottomLeft_y = 354.0f;
menuBg.bottomRight_x = 581.0f;
menuBg.bottomRight_y = 340.0f;
break;
case MENUPAGE_SOUND_SETTINGS:
menuBg.topLeft_x = 26.0f;
menuBg.topLeft_y = 59.0f;
menuBg.topRight_x = 629.0f;
menuBg.topRight_y = 29.0f;
menuBg.bottomLeft_x = 15.0f;
menuBg.bottomLeft_y = 438.0f;
menuBg.bottomRight_x = 610.0f;
menuBg.bottomRight_y = 410.0f;
break;
case MENUPAGE_SKIN_SELECT:
case MENUPAGE_KEYBOARD_CONTROLS:
menuBg.topLeft_x = 14.0f;
menuBg.topLeft_y = 39.0f;
menuBg.topRight_x = 636.0f;
menuBg.topRight_y = 29.0f;
menuBg.bottomLeft_x = 15.0f;
menuBg.bottomLeft_y = 426.0f;
menuBg.bottomRight_x = 630.0f;
menuBg.bottomRight_y = 398.0f;
break;
case MENUPAGE_BRIEFS:
case MENUPAGE_GRAPHICS_SETTINGS:
case MENUPAGE_MAP:
case MENUPAGE_CHOOSE_LOAD_SLOT:
case MENUPAGE_CHOOSE_DELETE_SLOT:
case MENUPAGE_CHOOSE_SAVE_SLOT:
case MENUPAGE_MOUSE_CONTROLS:
menuBg.topLeft_x = 26.0f;
menuBg.topLeft_y = 59.0f;
menuBg.topRight_x = 629.0f;
menuBg.topRight_y = 29.0f;
menuBg.bottomLeft_x = 15.0f;
menuBg.bottomLeft_y = 426.0f;
menuBg.bottomRight_x = 610.0f;
menuBg.bottomRight_y = 398.0f;
break;
default:
menuBg.topLeft_x = CGeneral::GetRandomNumber() % 40 + 65;
menuBg.topLeft_y = CGeneral::GetRandomNumber() % 40 + 21;
menuBg.topRight_x = CGeneral::GetRandomNumber() % 40 + 568;
menuBg.topRight_y = CGeneral::GetRandomNumber() % 40 + 44;
menuBg.bottomLeft_x = CGeneral::GetRandomNumber() % 40 + 36;
menuBg.bottomLeft_y = CGeneral::GetRandomNumber() % 40 + 382;
menuBg.bottomRight_x = CGeneral::GetRandomNumber() % 40 + 593;
menuBg.bottomRight_y = CGeneral::GetRandomNumber() % 40 + 342;
break;
}
menuBg.UpdateMultipliers();
if (m_menuTransitionProgress == 255)
bOptionHighlightTransitionBlend = 0;
}
m_aFrontEndSprites[MENUSPRITE_BACKGROUND].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, FadeIn(255)));
// Congrats R*, instead of solving the bug you just hacked your million dolar product.
#if 0
SetFrontEndRenderStates();
// This is how I fixed it in III, but I can't apply it here because "forceFadeInCounter > 30" gives it a unique effect.
static float fadeAlpha = 0.0f;
if (m_nMenuFadeAlpha == 0 && fadeAlpha > 1.0f) fadeAlpha = 0.0f;
// +20 per every 33 ms (1000.f/30.f - original frame limiter fps)
fadeAlpha += (frameTime) * 20.f / 33.f;
m_nMenuFadeAlpha = clamp(fadeAlpha, 0, 255);
m_menuTransitionProgress = clamp(fadeAlpha, 0, 255);
#else
static uint32 LastFade = 0;
static uint8 forceFadeInCounter = 0;
if (m_nMenuFadeAlpha >= 255) {
if (m_nMenuFadeAlpha > 255)
m_nMenuFadeAlpha = 255;
} else {
if (CTimer::GetTimeInMillisecondsPauseMode() - LastFade > 30 || forceFadeInCounter > 30) {
m_nMenuFadeAlpha += 20;
m_menuTransitionProgress = Min(m_menuTransitionProgress + 20, 255);
LastFade = CTimer::GetTimeInMillisecondsPauseMode();
}
forceFadeInCounter++;
}
#endif
if (!transitionCall && m_menuTransitionProgress == 255) {
float oldAlpha = m_nMenuFadeAlpha;
if (oldAlpha < 255) {
int oldScreen = m_nCurrScreen;
SetFrontEndRenderStates();
m_nCurrScreen = m_nPrevScreen;
m_nMenuFadeAlpha = 255 - m_nMenuFadeAlpha;
switch (m_nCurrScreen) {
case MENUPAGE_SKIN_SELECT:
CMenuManager::DrawPlayerSetupScreen();
break;
case MENUPAGE_KEYBOARD_CONTROLS:
CMenuManager::DrawControllerSetupScreen();
break;
/* case MENUPAGE_OUTRO:
CMenuManager::DrawQuitGameScreen();
break; */ // TODO(Miami)
default:
CMenuManager::DrawStandardMenus();
break;
}
m_nCurrScreen = oldScreen;
m_nMenuFadeAlpha = oldAlpha;
}
}
switch (m_nCurrScreen) {
case MENUPAGE_SKIN_SELECT:
@ -2252,20 +2420,24 @@ CMenuManager::DrawBackground()
case MENUPAGE_KEYBOARD_CONTROLS:
DrawControllerSetupScreen();
break;
/* case MENUPAGE_OUTRO:
CMenuManager::DrawQuitGameScreen();
break; */ // TODO(Miami)
default:
DrawStandardMenus();
break;
}
CFont::DrawFonts();
SetFrontEndRenderStates();
if (m_menuTransitionProgress == 255) {
m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(27.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255));
} else {
m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(27.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255)));
}
// TODO(Miami)
// if (m_nCurrScreen != MENUPAGE_OUTRO)
if (m_menuTransitionProgress == 255) {
m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(27.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255));
} else {
m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(27.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255)));
}
if (m_bShowMouse) {
CRect mouse(0.0f, 0.0f, MENU_X(40.0f), MENU_Y(40.0f));
@ -2936,9 +3108,11 @@ CMenuManager::LoadSettings()
m_PrefsVsync = m_PrefsVsyncDisp;
CRenderer::ms_lodDistScale = m_PrefsLOD;
if (m_nPrefsAudio3DProviderIndex == -1)
if (m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER)
m_nPrefsAudio3DProviderIndex = -2;
m_lastWorking3DAudioProvider = m_nPrefsAudio3DProviderIndex;
if (m_PrefsLanguage == prevLang)
m_bLanguageLoaded = false;
else {
@ -3021,6 +3195,7 @@ CMenuManager::SaveSettings()
CFileMgr::Write(fileHandle, (char*)&TheCamera.bFreeCam, 1);
#endif
}
m_lastWorking3DAudioProvider = m_nPrefsAudio3DProviderIndex;
CFileMgr::CloseFile(fileHandle);
CFileMgr::SetDir("");
@ -3109,30 +3284,6 @@ CMenuManager::PrintBriefs()
#endif
}
// Not sure about name. Not to be confused with CPad::PrintErrorMessage
void
CMenuManager::PrintErrorMessage()
{
if (!CPad::bDisplayNoControllerMessage && !CPad::bObsoleteControllerMessage)
return;
CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f)), CRGBA(64, 16, 16, 224));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetBackgroundOff();
CFont::SetPropOn();
CFont::SetCentreOff();
CFont::SetJustifyOn();
CFont::SetRightJustifyOff();
CFont::SetBackGroundOnlyTextOn();
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(40.0f));
#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_X(50.0f), SCREEN_SCALE_Y(180.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT"));
#else
CFont::PrintString(SCREEN_SCALE_X(50.0f), SCREEN_SCALE_Y(40.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT"));
#endif
CFont::DrawFonts();
}
void
CMenuManager::PrintStats()
{
@ -3224,6 +3375,7 @@ CMenuManager::PrintStats()
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y));
}
// --MIAMI: Done
void
CMenuManager::Process(void)
{
@ -4022,10 +4174,7 @@ CMenuManager::ProcessButtonPresses(void)
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
SaveSettings();
} else {
if (!m_bGameNotLoaded)
ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
else
ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[0], aScreens[m_nCurrScreen].m_ParentEntry[0], true, true);
SwitchToNewScreen(-2);
}
} else if (m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME) {
option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
@ -4125,11 +4274,7 @@ CMenuManager::ProcessButtonPresses(void)
if (changeMenu) {
if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) {
#ifndef TIDY_UP_PBP
ResetHelperText();
if (!m_bGameNotLoaded)
ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
else
ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[0], aScreens[m_nCurrScreen].m_ParentEntry[0], true, true);
RequestFrontEndShutDown();
#else
goBack = true;
break;
@ -4141,7 +4286,7 @@ CMenuManager::ProcessButtonPresses(void)
}
#endif
ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true);
SwitchToNewScreen(0);
}
}
break;
@ -4153,7 +4298,7 @@ CMenuManager::ProcessButtonPresses(void)
if (saveSlot >= 2 && saveSlot <= 9) {
m_nCurrSaveSlot = saveSlot - 2;
if (Slots[m_nCurrSaveSlot + 1] != SLOT_EMPTY && Slots[m_nCurrSaveSlot + 1] != SLOT_CORRUPTED) {
ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true);
SwitchToNewScreen(0);
}
}
break;
@ -4176,7 +4321,7 @@ CMenuManager::ProcessButtonPresses(void)
RequestFrontEndShutDown();
break;
case MENUACTION_REDEFCTRL:
ChangeScreen(MENUPAGE_KEYBOARD_CONTROLS, 0, true, true);
SwitchToNewScreen(MENUPAGE_KEYBOARD_CONTROLS);
m_nSelectedListRow = 0;
m_nCurrExLayer = HOVEROPTION_LIST;
break;
@ -4202,7 +4347,7 @@ CMenuManager::ProcessButtonPresses(void)
#endif
break;
case MENUACTION_DONTCANCEL:
ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
SwitchToNewScreen(-2);
break;
case MENUACTION_SCREENRES:
if (m_nDisplayVideoMode != m_nPrefsVideoMode) {
@ -4231,7 +4376,7 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_AUDIOHW:
{
int selectedProvider = m_nPrefsAudio3DProviderIndex;
if (selectedProvider != -1) {
if (selectedProvider != INVALID_AUDIO_PROVIDER) {
m_nPrefsAudio3DProviderIndex = DMAudio.SetCurrent3DProvider(m_nPrefsAudio3DProviderIndex);
if (selectedProvider == m_nPrefsAudio3DProviderIndex) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
@ -4246,7 +4391,7 @@ CMenuManager::ProcessButtonPresses(void)
}
case MENUACTION_SPEAKERCONF:
#ifndef TIDY_UP_PBP
if (m_nPrefsAudio3DProviderIndex != -1) {
if (m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) {
if (--m_PrefsSpeakers < 0)
m_PrefsSpeakers = 2;
DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
@ -4258,7 +4403,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
case MENUACTION_PLAYERSETUP:
CPlayerSkin::BeginFrontendSkinEdit();
ChangeScreen(MENUPAGE_SKIN_SELECT, 0, true, true);
SwitchToNewScreen(MENUPAGE_SKIN_SELECT);
m_nCurrExLayer = HOVEROPTION_LIST;
m_bSkinsEnumerated = false;
break;
@ -4339,7 +4484,7 @@ CMenuManager::ProcessButtonPresses(void)
#endif
break;
case MENUACTION_LOADRADIO:
ChangeScreen(MENUPAGE_SOUND_SETTINGS, 0, true, true);
SwitchToNewScreen(MENUPAGE_SOUND_SETTINGS);
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("STARTED PLAYING FRONTEND AUDIO TRACK");
break;
@ -4384,7 +4529,6 @@ CMenuManager::ProcessButtonPresses(void)
#endif
int oldScreen = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0];
int oldOption = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0];
if (oldScreen != -1) {
ThingsToDoBeforeLeavingPage();
@ -4396,7 +4540,7 @@ CMenuManager::ProcessButtonPresses(void)
} else
#endif
{
ChangeScreen(oldScreen, oldOption, true, true);
SwitchToNewScreen(-2);
}
// We will go back for sure at this point, why process other things?!
@ -4523,14 +4667,14 @@ CMenuManager::ProcessButtonPresses(void)
break;
#endif
case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex != -1) {
if (m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) {
m_nPrefsAudio3DProviderIndex += changeValueBy;
m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1);
}
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
break;
case MENUACTION_SPEAKERCONF:
if (m_nPrefsAudio3DProviderIndex != -1) {
if (m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) {
m_PrefsSpeakers -= changeValueBy;
m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2);
DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
@ -4679,20 +4823,20 @@ CMenuManager::SaveLoadFileError_SetUpErrorScreen()
case SAVESTATUS_ERR_SAVE_CREATE:
case SAVESTATUS_ERR_SAVE_WRITE:
case SAVESTATUS_ERR_SAVE_CLOSE:
ChangeScreen(MENUPAGE_SAVE_FAILED, 0, true, false);
SwitchToNewScreen(MENUPAGE_SAVE_FAILED);
break;
case SAVESTATUS_ERR_LOAD_OPEN:
case SAVESTATUS_ERR_LOAD_READ:
case SAVESTATUS_ERR_LOAD_CLOSE:
ChangeScreen(MENUPAGE_LOAD_FAILED, 0, true, false);
SwitchToNewScreen(MENUPAGE_LOAD_FAILED);
break;
case SAVESTATUS_ERR_DATA_INVALID:
ChangeScreen(MENUPAGE_LOAD_FAILED_2, 0, true, false);
SwitchToNewScreen(MENUPAGE_LOAD_FAILED_2);
break;
case SAVESTATUS_DELETEFAILED8:
case SAVESTATUS_DELETEFAILED9:
case SAVESTATUS_DELETEFAILED10:
ChangeScreen(MENUPAGE_DELETE_FAILED, 0, true, false);
SwitchToNewScreen(MENUPAGE_DELETE_FAILED);
break;
default: break;
}
@ -4736,7 +4880,7 @@ CMenuManager::ProcessFileActions()
}
if (SlotPopulated)
ChangeScreen(MENUPAGE_DELETE_SUCCESS, 0, true, false);
SwitchToNewScreen(MENUPAGE_DELETE_SUCCESS);
else
SaveLoadFileError_SetUpErrorScreen();
}
@ -4744,7 +4888,7 @@ CMenuManager::ProcessFileActions()
int8 SaveSlot = PcSaveHelper.SaveSlot(m_nCurrSaveSlot);
PcSaveHelper.PopulateSlotInfo();
if (SaveSlot)
ChangeScreen(MENUPAGE_SAVE_SUCCESSFUL, 0, true, false);
SwitchToNewScreen(MENUPAGE_SAVE_SUCCESSFUL);
else
SaveLoadFileError_SetUpErrorScreen();
}
@ -4758,6 +4902,7 @@ CMenuManager::ProcessFileActions()
}
}
// --MIAMI: Done except DxInput things, are they even needed?
void
CMenuManager::SwitchMenuOnAndOff()
{

View file

@ -433,10 +433,10 @@ struct CMenuScreen
struct MenuTrapezoid
{
float topRight_x;
float topRight_y;
float topLeft_x;
float topLeft_y;
float topRight_x;
float topRight_y;
float bottomLeft_x;
float bottomLeft_y;
float bottomRight_x;
@ -459,15 +459,48 @@ struct MenuTrapezoid
float mult_bottomRight_y;
MenuTrapezoid(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) {
topRight_x = x1;
topRight_y = y1;
topLeft_x = x2;
topLeft_y = y2;
topLeft_x = x1;
topLeft_y = y1;
topRight_x = x2;
topRight_y = y2;
bottomLeft_x = x3;
bottomLeft_y = y3;
bottomRight_x = x4;
bottomRight_y = y4;
};
void SaveCurrentCoors() {
old_topLeft_x = topLeft_x;
old_topLeft_y = topLeft_y;
old_topRight_x = topRight_x;
old_topRight_y = topRight_y;
old_bottomLeft_x = bottomLeft_x;
old_bottomLeft_y = bottomLeft_y;
old_bottomRight_x = bottomRight_x;
old_bottomRight_y = bottomRight_y;
}
void Translate(int delta) {
bottomRight_x = delta * mult_bottomRight_x + old_bottomRight_x;
bottomRight_y = delta * mult_bottomRight_y + old_bottomRight_y;
bottomLeft_x = delta * mult_bottomLeft_x + old_bottomLeft_x;
bottomLeft_y = delta * mult_bottomLeft_y + old_bottomLeft_y;
topRight_x = delta * mult_topRight_x + old_topRight_x;
topRight_y = delta * mult_topRight_y + old_topRight_y;
topLeft_x = delta * mult_topLeft_x + old_topLeft_x;
topLeft_y = delta * mult_topLeft_y + old_topLeft_y;
}
void UpdateMultipliers() {
mult_bottomRight_x = (bottomRight_x - old_bottomRight_x) / 255.0f;
mult_bottomRight_y = (bottomRight_y - old_bottomRight_y) / 255.0f;
mult_bottomLeft_x = (bottomLeft_x - old_bottomLeft_x) / 255.0f;
mult_bottomLeft_y = (bottomLeft_y - old_bottomLeft_y) / 255.0f;
mult_topRight_x = (topRight_x - old_topRight_x) / 255.0f;
mult_topRight_y = (topRight_y - old_topRight_y) / 255.0f;
mult_topLeft_x = (topLeft_x - old_topLeft_x) / 255.0f;
mult_topLeft_y = (topLeft_y - old_topLeft_y) / 255.0f;
}
};
class CMenuManager
@ -523,7 +556,7 @@ public:
int32 m_nMouseTempPosX;
int32 m_nMouseTempPosY;
bool m_bGameNotLoaded;
int8 m_3DProviderOnLastSaveLoad;
int8 m_lastWorking3DAudioProvider;
bool m_bFrontEnd_ReloadObrTxtGxt;
int32 *pEditString;
uint8 field_74[4];
@ -625,7 +658,7 @@ public:
void DrawControllerScreenExtraText(int, int, int);
void DrawControllerSetupScreen();
void DrawFrontEnd();
void DrawBackground();
void DrawBackground(bool transitionCall);
void DrawPlayerSetupScreen();
int FadeIn(int alpha);
void FilterOutColorMarkersFromString(wchar*, CRGBA &);
@ -656,6 +689,7 @@ public:
void WaitForUserCD();
int GetNumOptionsCntrlConfigScreens();
int ConstructStatLine(int);
void SwitchToNewScreen(int8);
// New (not in function or inlined in the game)
void ThingsToDoBeforeLeavingPage();

View file

@ -544,7 +544,14 @@ void CGame::InitialiseWhenRestarting(void)
CTimer::Initialise();
CSprite2d::SetRecipNearClip();
if (b_FoundRecentSavedGameWantToLoad || FrontEndMenuManager.m_bWantToLoad)
{
LoadSplash("splash1");
if (FrontEndMenuManager.m_bWantToLoad)
FrontEndMenuManager.MessageScreen("FELD_WR", true);
}
b_FoundRecentSavedGameWantToLoad = false;
TheCamera.Init();
@ -671,14 +678,8 @@ void CGame::Process(void)
void
CGame::InitAfterFocusLoss()
{
/*
byte_869656 = byte_86969D;
result = cDMAudio::SetCurrent3DProvider(byte_86969D);
if ( !bGameStarted && !bMenuVisible )
byte_869642 = 1;
*/
//cDMAudio::SetCurrent3DProvider( ? ? ? );
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = FrontEndMenuManager.m_lastWorking3DAudioProvider;
DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_lastWorking3DAudioProvider);
if (!FrontEndMenuManager.m_bGameNotLoaded && !FrontEndMenuManager.m_bMenuActive)
FrontEndMenuManager.m_bStartUpFrontEndRequested = true;

View file

@ -137,9 +137,10 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
return false;
@ -155,6 +156,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
bool
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
{
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@ -948,15 +950,12 @@ Render2dStuffAfterFade(void)
CHud::DrawAfterFade();
CFont::DrawFonts();
CCredits::Render();
}
void
Idle(void *arg)
{
#ifdef ASPECT_RATIO_SCALE
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
#endif
CTimer::Update();
#ifdef TIMEBARS
@ -1062,6 +1061,7 @@ Idle(void *arg)
tbEndTimer("Render2dStuff");
#endif
}else{
CDraw::CalculateAspectRatio();
#ifdef ASPECT_RATIO_SCALE
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
#else
@ -1090,7 +1090,7 @@ Idle(void *arg)
#ifdef TIMEBARS
tbEndTimer("Render2dStuff-Fade");
#endif
CCredits::Render();
// CCredits::Render(); // They added it to function above and also forgot it here
#ifdef TIMEBARS
tbDisplay();
@ -1105,10 +1105,7 @@ Idle(void *arg)
void
FrontendIdle(void)
{
#ifdef ASPECT_RATIO_SCALE
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
#endif
CDraw::CalculateAspectRatio();
CTimer::Update();
CSprite2d::SetRecipNearClip(); // this should be on InitialiseRenderWare according to PS2 asm. seems like a bug fix
CSprite2d::InitPerFrame();
@ -1119,11 +1116,7 @@ FrontendIdle(void)
if(RsGlobal.quit)
return;
#ifdef ASPECT_RATIO_SCALE
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
#else
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
@ -1133,7 +1126,7 @@ FrontendIdle(void)
RenderMenus();
DoFade();
Render2dStuffAfterFade();
// CFont::DrawFonts(); // redundant
CFont::DrawFonts();
DoRWStuffEndOfFrame();
}
@ -1239,9 +1232,8 @@ TheModelViewer(void)
#if (defined(GTA_PS2) || defined(GTA_XBOX))
//TODO
#else
#ifdef ASPECT_RATIO_SCALE
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
#endif
CDraw::CalculateAspectRatio();
CAnimViewer::Update();
CTimer::Update();
SetLightsWithTimeOfDayColour(Scene.world);

View file

@ -680,7 +680,7 @@ CPlayerPed::ProcessWeaponSwitch(CPad *padUsed)
spentAmmoCheck:
if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_eWeaponFire != WEAPON_FIRE_MELEE
/*&& (!padUsed->GetWeapon() || GetWeapon()->m_eWeaponType != WEAPONTYPE_MINIGUN) */) {
&& (!padUsed->GetWeapon() || GetWeapon()->m_eWeaponType != WEAPONTYPE_MINIGUN)) {
if (GetWeapon()->m_nAmmoTotal <= 0) {
if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER
@ -1019,8 +1019,8 @@ CPlayerPed::ProcessAnimGroups(void)
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER)
groupToSet = ASSOCGRP_ROCKETLEFT;
else if (GetWeapon()->m_eWeaponType == WEAPONTYPE_CHAINSAW ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER
/* || GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN*/ )
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN)
groupToSet = ASSOCGRP_CHAINSAWLEFT;
else
groupToSet = ASSOCGRP_PLAYERLEFT;
@ -1028,8 +1028,8 @@ CPlayerPed::ProcessAnimGroups(void)
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER)
groupToSet = ASSOCGRP_ROCKETRIGHT;
else if (GetWeapon()->m_eWeaponType == WEAPONTYPE_CHAINSAW ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER
/* || GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN*/)
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN)
groupToSet = ASSOCGRP_CHAINSAWRIGHT;
else
groupToSet = ASSOCGRP_PLAYERRIGHT;
@ -1038,8 +1038,8 @@ CPlayerPed::ProcessAnimGroups(void)
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER)
groupToSet = ASSOCGRP_ROCKETBACK;
else if (GetWeapon()->m_eWeaponType == WEAPONTYPE_CHAINSAW ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER
/* || GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN*/)
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN)
groupToSet = ASSOCGRP_CHAINSAWBACK;
else
groupToSet = ASSOCGRP_PLAYERBACK;
@ -1052,16 +1052,15 @@ CPlayerPed::ProcessAnimGroups(void)
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_MACHETE)
groupToSet = ASSOCGRP_PLAYERBBBAT;
else if (GetWeapon()->m_eWeaponType == WEAPONTYPE_CHAINSAW ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER
/* || GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN*/)
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN)
groupToSet = ASSOCGRP_PLAYERCHAINSAW;
else if (GetWeapon()->m_eWeaponType != WEAPONTYPE_COLT45 && GetWeapon()->m_eWeaponType != WEAPONTYPE_UZI
// I hope this was inlined...
/*
&& GetWeapon()->m_eWeaponType != WEAPONTYPE_PYTHON*/ && GetWeapon()->m_eWeaponType != WEAPONTYPE_TEC9
// I hope this is a inlined function...
&& GetWeapon()->m_eWeaponType != WEAPONTYPE_PYTHON && GetWeapon()->m_eWeaponType != WEAPONTYPE_TEC9
&& GetWeapon()->m_eWeaponType != WEAPONTYPE_SILENCED_INGRAM && GetWeapon()->m_eWeaponType != WEAPONTYPE_MP5
&& GetWeapon()->m_eWeaponType != WEAPONTYPE_GOLFCLUB && GetWeapon()->m_eWeaponType != WEAPONTYPE_KATANA
/* && GetWeapon()->m_eWeaponType != WEAPONTYPE_CAMERA */) {
&& GetWeapon()->m_eWeaponType != WEAPONTYPE_CAMERA) {
if (!GetWeapon()->IsType2Handed()) {
groupToSet = ASSOCGRP_PLAYER;
} else {
@ -1093,7 +1092,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || GetWeapon()->m_eWeaponType == WEAPONTYPE_M4 ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_RUGER) {
if (padUsed->TargetJustDown() || TheCamera.m_bJustJumpedOutOf1stPersonBecauseOfTarget) {
if (padUsed->TargetJustDown()/* || TheCamera.m_bAllow1rstPersonWeaponsCamera */) { // TODO(Miami): Cam
SetStoredState();
m_nPedState = PED_SNIPER_MODE;
#ifdef FREE_CAM
@ -1240,7 +1239,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
#else
else if (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson) {
#endif
if (padUsed->TargetJustDown())
if (padUsed->TargetJustDown()/* || TheCamera.m_bAllow1rstPersonWeaponsCamera */) // TODO(Miami): Cam
FindWeaponLockOnTarget();
}
} else if (m_pPointGunAt) {

View file

@ -19,24 +19,23 @@ uint8 CDraw::FadeGreen;
uint8 CDraw::FadeBlue;
float
CDraw::FindAspectRatio(void)
CDraw::CalculateAspectRatio(void)
{
#ifndef ASPECT_RATIO_SCALE
if(FrontEndMenuManager.m_PrefsUseWideScreen)
return 16.0f/9.0f;
else
return 4.0f/3.0f;
if (FrontEndMenuManager.m_PrefsUseWideScreen) {
if (TheCamera.m_WideScreenOn)
CDraw::ms_fAspectRatio = 5.f / 3.f; // It's used on theatrical showings according to Wiki
else
#ifdef ASPECT_RATIO_SCALE
CDraw::ms_fAspectRatio = FrontEndMenuManager.m_PrefsUseWideScreen == AR_AUTO ? SCREEN_WIDTH / SCREEN_HEIGHT : 16.f / 9.f;
#else
switch (FrontEndMenuManager.m_PrefsUseWideScreen) {
case AR_AUTO:
return SCREEN_WIDTH / SCREEN_HEIGHT;
default:
case AR_4_3:
return 4.0f / 3.0f;
case AR_16_9:
return 16.0f / 9.0f;
};
CDraw::ms_fAspectRatio = 16.f / 9.f;
#endif
} else if (TheCamera.m_WideScreenOn) {
CDraw::ms_fAspectRatio = 5.f/4.f;
} else {
CDraw::ms_fAspectRatio = 4.f/3.f;
}
return CDraw::ms_fAspectRatio;
}
#ifdef ASPECT_RATIO_SCALE

View file

@ -38,12 +38,10 @@ public:
static void SetFOV(float fov);
static float GetFOV(void) { return ms_fFOV; }
static float FindAspectRatio(void);
static float CalculateAspectRatio(void);
#ifdef ASPECT_RATIO_SCALE
static float ConvertFOV(float fov);
#endif
static float GetAspectRatio(void) { return ms_fAspectRatio; }
static void SetAspectRatio(float ratio) { ms_fAspectRatio = ratio; }
#else
static float GetAspectRatio(void) { return FindAspectRatio(); }
#endif
};

View file

@ -68,8 +68,8 @@ class CFont
static int16 Size[MAX_FONTS][193];
#endif
static int16 NewLine;
static CSprite2d Sprite[MAX_FONTS];
public:
static CSprite2d Sprite[MAX_FONTS];
static CFontDetails Details;
static void Initialise(void);

View file

@ -4,11 +4,11 @@
#include "Draw.h"
#include "Camera.h"
#include "Sprite2d.h"
#include "Font.h"
RwIm2DVertex CSprite2d::maVertices[8];
float CSprite2d::RecipNearClip;
int32 CSprite2d::mCurrentBank;
RwTexture *CSprite2d::mpBankTextures[10];
int32 CSprite2d::mCurrentSprite[10];
int32 CSprite2d::mBankStart[10];
RwIm2DVertex CSprite2d::maBankVertices[500];
@ -16,7 +16,7 @@ RwIm2DVertex CSprite2d::maBankVertices[500];
void
CSprite2d::SetRecipNearClip(void)
{
RecipNearClip = 1.0f / RwCameraGetNearClipPlane(Scene.camera);
// Used but empty in VC, instead they set in InitPerFrame. Isn't that great?
}
void
@ -24,17 +24,15 @@ CSprite2d::InitPerFrame(void)
{
int i;
RecipNearClip = 1.0f / RwCameraGetNearClipPlane(Scene.camera);
mCurrentBank = 0;
for(i = 0; i < 10; i++)
mCurrentSprite[i] = 0;
for(i = 0; i < 10; i++)
mpBankTextures[i] = nil;
}
int32
CSprite2d::GetBank(int32 n, RwTexture *tex)
{
mpBankTextures[mCurrentBank] = tex;
mCurrentSprite[mCurrentBank] = 0;
mBankStart[mCurrentBank+1] = mBankStart[mCurrentBank] + n;
return mCurrentBank++;
@ -59,13 +57,14 @@ CSprite2d::DrawBank(int32 bank)
{
if(mCurrentSprite[bank] == 0)
return;
RwRenderStateSet(rwRENDERSTATETEXTURERASTER,
mpBankTextures[bank] ? RwTextureGetRaster(mpBankTextures[bank]) : nil);
// This is hacked III function to make it work with VC frontend.
CFont::Sprite[bank].SetRenderState();
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwIm2DRenderPrimitive(rwPRIMTYPETRILIST, &maBankVertices[6*mBankStart[bank]], 6*mCurrentSprite[bank]);
mCurrentSprite[bank] = 0;
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
//RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
}

View file

@ -3030,7 +3030,7 @@ CAutomobile::ProcessBuoyancy(void)
void
CAutomobile::DoDriveByShootings(void)
{
CAnimBlendAssociation *anim;
CAnimBlendAssociation *anim = nil;
CPlayerInfo* playerInfo = ((CPlayerPed*)this)->GetPlayerInfoForThisPlayerPed();
if (playerInfo && !playerInfo->m_bDriveByAllowed)
return;

View file

@ -930,7 +930,7 @@ CBoat::AddWakePoint(CVector point)
void
CBoat::DoDriveByShootings(void)
{
CAnimBlendAssociation *anim;
CAnimBlendAssociation *anim = nil;
CPlayerInfo* playerInfo = ((CPlayerPed*)this)->GetPlayerInfoForThisPlayerPed();
if (playerInfo && !playerInfo->m_bDriveByAllowed)
return;