Peds, Hud, CFO 1/2, fixes - including zone names

This commit is contained in:
eray orçunus 2020-07-21 05:59:31 +03:00
parent 5bedca7692
commit f40f44b14e
30 changed files with 1467 additions and 818 deletions

View File

@ -188,7 +188,7 @@ enum eSound : uint16
SOUND_186, // makes same sound with 40
SOUND_187, // makes same sound with 46
SOUND_MELEE_ATTACK_START,
SOUND_189,
SOUND_SKATING,
SOUND_WEAPON_MINIGUN_ATTACK,
SOUND_WEAPON_MINIGUN_2,
SOUND_WEAPON_MINIGUN_3,

View File

@ -284,7 +284,6 @@ CPhoneInfo::Initialise(void)
CBuilding *building = pool->GetSlot(i);
if (building) {
if (building->GetModelIndex() == MI_PHONEBOOTH1) {
assert(m_nMax < ARRAY_SIZE(m_aPhones) && "NUMPHONES should be increased");
CPhone *maxPhone = &m_aPhones[m_nMax];
maxPhone->m_nState = PHONE_STATE_FREE;
maxPhone->m_vecPos = building->GetPosition();

View File

@ -3225,9 +3225,8 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
UpdateCompareFlag(ped->IsWithinArea(x1, y1, x2, y2));
else
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, x2, y2));
if (!ScriptParams[5])
return 0;
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (ScriptParams[5])
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
return 0;
@ -3246,9 +3245,8 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
else
UpdateCompareFlag(ped->IsWithinArea(x1, y1, z1, x2, y2, z2));
if (!ScriptParams[7])
return 0;
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2);
if (ScriptParams[7])
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
return 0;
@ -4061,9 +4059,8 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
float x2 = *(float*)&ScriptParams[3];
float y2 = *(float*)&ScriptParams[4];
UpdateCompareFlag(vehicle->IsWithinArea(x1, y1, x2, y2));
if (!ScriptParams[5])
return 0;
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (ScriptParams[5])
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
return 0;
@ -4080,9 +4077,8 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
float y2 = *(float*)&ScriptParams[5];
float z2 = *(float*)&ScriptParams[6];
UpdateCompareFlag(vehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
if (!ScriptParams[7])
return 0;
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2);
if (ScriptParams[7])
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
return 0;
@ -4799,9 +4795,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
float y2 = *(float*)&ScriptParams[4];
UpdateCompareFlag(pVehicle->GetStatus() == STATUS_WRECKED &&
pVehicle->IsWithinArea(x1, y1, x2, y2));
if (!ScriptParams[5])
return 0;
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (ScriptParams[5])
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
return 0;
@ -4819,9 +4814,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
float z2 = *(float*)&ScriptParams[6];
UpdateCompareFlag(pVehicle->GetStatus() == STATUS_WRECKED &&
pVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
if (!ScriptParams[7])
return 0;
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2);
if (ScriptParams[7])
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
return 0;
@ -7676,9 +7670,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
float x2 = *(float*)&ScriptParams[3];
float y2 = *(float*)&ScriptParams[4];
UpdateCompareFlag(pPed->bIsShooting && pPed->IsWithinArea(x1, y1, x2, y2));
if (!ScriptParams[5])
return 0;
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (ScriptParams[5])
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
return 0;
@ -7693,9 +7686,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
float x2 = *(float*)&ScriptParams[3];
float y2 = *(float*)&ScriptParams[4];
UpdateCompareFlag(pPed->bIsShooting && pPed->IsWithinArea(x1, y1, x2, y2));
if (!ScriptParams[5])
return 0;
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (ScriptParams[5])
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
return 0;

View File

@ -24,7 +24,6 @@
#include "GenericGameStorage.h"
#include "Script.h"
#include "Camera.h"
#include "MenuScreens.h"
#include "ControllerConfig.h"
#include "Vehicle.h"
#include "MBlur.h"
@ -214,75 +213,6 @@ 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 = aScreens[m_nCurrScreen].m_PreviousPage;
int oldOption = (m_nCurrScreen == MENUPAGE_NEW_GAME ? 0 : (m_nCurrScreen == MENUPAGE_OPTIONS ? 1 : (m_nCurrScreen == MENUPAGE_EXIT ? 2 : aScreens[m_nCurrScreen].m_ParentEntry)));
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;
m_nOptionHighlightTransitionBlend = 0;
m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
}
#endif
inline void
CMenuManager::ScrollUpListByOne()
{
@ -349,7 +279,6 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
}
}
// TODO(Miami)
inline void
CMenuManager::ThingsToDoBeforeLeavingPage()
{
@ -373,13 +302,123 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
CPlayerSkin::EndFrontendSkinEdit();
}
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) || (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)) {
m_nTotalListRow = 0;
#ifdef CUSTOM_FRONTEND_OPTIONS
for (int i = 0; i < numCustomFrontendOptions; i++) {
FrontendOption& option = customFrontendOptions[i];
if (option.type != FEOPTION_REDIRECT && option.type != FEOPTION_GOBACK && m_nCurrScreen == option.screen) {
if (option.returnPrevPageFunc)
option.returnPrevPageFunc();
if (m_nCurrOption == option.screenOptionOrder && option.type == FEOPTION_DYNAMIC)
option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
if (option.onlyApplyOnEnter)
option.displayedValue = *option.value;
}
}
#endif
}
int8
CMenuManager::GetPreviousPageOption()
{
#ifndef CUSTOM_FRONTEND_OPTIONS
return (!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry :
(m_nCurrScreen == MENUPAGE_NEW_GAME ? 0 : (m_nCurrScreen == MENUPAGE_OPTIONS ? 1 : (m_nCurrScreen == MENUPAGE_EXIT ? 2 : aScreens[m_nCurrScreen].m_ParentEntry))));
#else
int8 prevPage = aScreens[m_nCurrScreen].m_PreviousPage;
if (prevPage == -1) // Game also does same
return 0;
prevPage = prevPage == MENUPAGE_NONE ? (!m_bGameNotLoaded ? MENUPAGE_PAUSE_MENU : MENUPAGE_START_MENU) : prevPage;
for (int i = 0; i < NUM_MENUROWS; i++) {
if (aScreens[prevPage].m_aEntries[i].m_TargetMenu == m_nCurrScreen) {
return i;
}
}
// Couldn't find current screen option on previous page, use default behaviour (maybe save-related screen?)
return (!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry :
(m_nCurrScreen == MENUPAGE_NEW_GAME ? 0 : (m_nCurrScreen == MENUPAGE_OPTIONS ? 1 : (m_nCurrScreen == MENUPAGE_EXIT ? 2 : aScreens[m_nCurrScreen].m_ParentEntry))));
#endif
}
// ------ Functions not in the game/inlined ends
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
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 = aScreens[m_nCurrScreen].m_PreviousPage;
int oldOption = GetPreviousPageOption();
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_nPrevScreen == MENUPAGE_SKIN_SELECT || m_nPrevScreen == MENUPAGE_KEYBOARD_CONTROLS)
m_nTotalListRow = 0;
if (m_nCurrScreen == MENUPAGE_CHOOSE_SAVE_SLOT)
m_nCurrOption = 8;
m_nMenuFadeAlpha = 0;
m_nOptionHighlightTransitionBlend = 0;
m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
}
#endif
CMenuManager::CMenuManager()
{
m_StatsScrollSpeed = 150.0f;
@ -463,7 +502,7 @@ CMenuManager::Initialise(void)
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DoRWStuffEndOfFrame();
m_AllowNavigation = false;
m_menuTransitionProgress = -50;
m_menuTransitionProgress = -50; // to start from black
m_nMenuFadeAlpha = 0;
m_nCurrOption = 0;
m_nOptionHighlightTransitionBlend = 0;
@ -1172,6 +1211,32 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
rightText = TheText.Get("FEA_NM3");
}
break;
#ifdef CUSTOM_FRONTEND_OPTIONS
case MENUACTION_TRIGGERFUNC:
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
if (m_nCurrScreen == option.screen && i == option.screenOptionOrder) {
leftText = (wchar*)option.leftText;
if (option.type == FEOPTION_SELECT) {
if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0)
option.displayedValue = 0;
rightText = (wchar*)option.rightTexts[option.displayedValue];
} else if (option.type == FEOPTION_DYNAMIC) {
if (option.drawFunc) {
bool isOptionDisabled = false;
rightText = option.drawFunc(&isOptionDisabled);
if (isOptionDisabled)
CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255)));
}
}
} else {
debug("A- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, i, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu, option.screen, option.screenOptionOrder);
assert(0 && "Custom frontend options is borked");
}
break;
#endif
}
// Highlight trapezoid
@ -1326,6 +1391,24 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
}
}
#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
static int lastOption = m_nCurrOption;
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_TRIGGERFUNC) {
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
if (option.onlyApplyOnEnter && m_nCurrOption != i)
option.displayedValue = *option.value;
if (m_nCurrOption != lastOption && lastOption == i) {
FrontendOption& oldOption = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[lastOption].m_TargetMenu];
if (oldOption.type == FEOPTION_DYNAMIC)
oldOption.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
}
}
if (i == MAX_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[i + 1].m_EntryName[0] == '\0')
lastOption = m_nCurrOption;
#endif
// TODO(Miami): check
// Sliders
@ -1955,10 +2038,10 @@ CMenuManager::DrawControllerSetupScreen()
float curOptY = i * rowHeight + yStart;
if (m_nMousePosY > MENU_Y(curOptY) && m_nMousePosY < MENU_Y(rowHeight + curOptY)) {
if (m_nPrevOption != i && m_nCurrExLayer == HOVEROPTION_LIST)
if (m_nOptionMouseHovering != i && m_nCurrExLayer == HOVEROPTION_LIST)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
m_nPrevOption = i;
m_nOptionMouseHovering = i;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrExLayer = HOVEROPTION_LIST;
m_nSelectedListRow = i;
@ -2660,7 +2743,7 @@ CMenuManager::DrawPlayerSetupScreen()
if (m_nMousePosX > MENU_X_LEFT_ALIGNED(PLAYERSETUP_LIST_LEFT) && m_nMousePosX < MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT)) {
if (m_nMousePosY > MENU_Y(rowStartY) && m_nMousePosY < MENU_Y(rowEndY)) {
m_nPrevOption = rowIdx;
m_nOptionMouseHovering = rowIdx;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrExLayer = HOVEROPTION_LIST;
}
@ -3023,6 +3106,10 @@ CMenuManager::InitialiseChangedLanguageSettings()
default:
break;
}
#ifdef CUSTOM_FRONTEND_OPTIONS
CustomFrontendOptionsPopulate();
#endif
}
}
@ -3618,7 +3705,7 @@ CMenuManager::ProcessButtonPresses(void)
m_nMousePosY < MENU_Y(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Y + MENU_DEFAULT_LINE_HEIGHT)) {
static int oldScreen = m_nCurrScreen;
m_nPrevOption = rowToCheck;
m_nOptionMouseHovering = rowToCheck;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrOption = rowToCheck;
m_bShowMouse = true;
@ -3632,7 +3719,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
}
if (m_bShowMouse && m_nMenuFadeAlpha == 255) {
m_nPrevOption = oldOption;
m_nOptionMouseHovering = oldOption;
m_nCurrOption = oldOption;
}
}
@ -3641,7 +3728,7 @@ CMenuManager::ProcessButtonPresses(void)
if (oldOption != m_nCurrOption) {
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_LABEL) {
++m_nCurrOption;
++m_nPrevOption;
++m_nOptionMouseHovering;
}
m_nOptionHighlightTransitionBlend = 0;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
@ -3923,7 +4010,7 @@ CMenuManager::ProcessButtonPresses(void)
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_RESUME &&
#endif
(m_nHoverOption == HOVEROPTION_RANDOM_ITEM)) {
m_nCurrOption = m_nPrevOption;
m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
}
} else if (CPad::GetPad(0)->GetLeftMouseJustDown()) {
@ -3937,7 +4024,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
} else if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) {
m_nCurrOption = m_nPrevOption;
m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
}
#else
@ -4024,7 +4111,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
case HOVEROPTION_RANDOM_ITEM:
if (((m_nCurrOption != 0) || (m_nCurrScreen != MENUPAGE_PAUSE_MENU)) {
m_nCurrOption = m_nPrevOption;
m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true;
}
break;
@ -4358,26 +4445,6 @@ CMenuManager::ProcessButtonPresses(void)
InitialiseChangedLanguageSettings();
SaveSettings();
break;
#ifdef MORE_LANGUAGES
case MENUACTION_LANG_PL:
m_PrefsLanguage = LANGUAGE_POLISH;
m_bFrontEnd_ReloadObrTxtGxt = true;
InitialiseChangedLanguageSettings();
SaveSettings();
break;
case MENUACTION_LANG_RUS:
m_PrefsLanguage = LANGUAGE_RUSSIAN;
m_bFrontEnd_ReloadObrTxtGxt = true;
CMenuManager::InitialiseChangedLanguageSettings();
SaveSettings();
break;
case MENUACTION_LANG_JAP:
m_PrefsLanguage = LANGUAGE_JAPANESE;
m_bFrontEnd_ReloadObrTxtGxt = true;
InitialiseChangedLanguageSettings();
SaveSettings();
break;
#endif
case MENUACTION_POPULATESLOTS_CHANGEMENU:
PcSaveHelper.PopulateSlotInfo();
@ -4540,7 +4607,6 @@ CMenuManager::ProcessButtonPresses(void)
} else if (m_nCurrScreen == MENUPAGE_CONTROLLER_PC) {
ControlsManager.MakeControllerActionsBlank();
ControlsManager.InitDefaultControlConfiguration();
MousePointerStateHelper.GetMouseSetUp();
ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp());
#if !defined RW_GL3
if (AllValidWinJoys.m_aJoys[JOYSTICK1].m_bInitialised) {
@ -4595,6 +4661,33 @@ CMenuManager::ProcessButtonPresses(void)
}
break;
}
#ifdef CUSTOM_FRONTEND_OPTIONS
case MENUACTION_TRIGGERFUNC:
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
if (option.type == FEOPTION_SELECT) {
if (!option.onlyApplyOnEnter) {
option.displayedValue++;
if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0)
option.displayedValue = 0;
}
option.changeFunc(option.displayedValue);
*option.value = option.displayedValue;
} else if (option.type == FEOPTION_DYNAMIC) {
option.buttonPressFunc(FEOPTION_ACTION_SELECT);
} else if (option.type == FEOPTION_REDIRECT) {
ChangeScreen(option.to, option.option, true, option.fadeIn);
} else if (option.type == FEOPTION_GOBACK) {
goBack = true;
}
} else {
debug("B- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder);
assert(0 && "Custom frontend options are borked");
}
break;
#endif
}
}
ProcessOnOffMenuOptions();
@ -4641,6 +4734,9 @@ CMenuManager::ProcessButtonPresses(void)
if (oldScreen != -1) {
ThingsToDoBeforeLeavingPage();
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) || (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)) {
m_nTotalListRow = 0;
}
#ifdef PS2_LIKE_MENU
if (!bottomBarActive &&
@ -4797,6 +4893,36 @@ CMenuManager::ProcessButtonPresses(void)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
#ifdef CUSTOM_FRONTEND_OPTIONS
case MENUACTION_TRIGGERFUNC:
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
if (option.type == FEOPTION_SELECT) {
if (changeValueBy > 0) {
option.displayedValue++;
if (option.displayedValue >= option.numRightTexts)
option.displayedValue = 0;
} else {
option.displayedValue--;
if (option.displayedValue < 0)
option.displayedValue = option.numRightTexts - 1;
}
if (!option.onlyApplyOnEnter) {
option.changeFunc(option.displayedValue);
*option.value = option.displayedValue;
}
} else if (option.type == FEOPTION_DYNAMIC) {
option.buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT);
}
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
else {
debug("C- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder);
assert(0 && "Custom frontend options are borked");
}
break;
#endif
}
ProcessOnOffMenuOptions();
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
@ -4890,13 +5016,6 @@ CMenuManager::ProcessOnOffMenuOptions()
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
#ifdef FREE_CAM
case MENUACTION_FREECAM:
TheCamera.bFreeCam = !TheCamera.bFreeCam;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
#endif
}
}
@ -5010,7 +5129,7 @@ CMenuManager::ProcessFileActions()
}
}
// --MIAMI: Done except DxInput things, are they even needed?
// --MIAMI: Done
void
CMenuManager::SwitchMenuOnAndOff()
{
@ -5036,7 +5155,12 @@ CMenuManager::SwitchMenuOnAndOff()
m_bMenuActive = !m_bMenuActive;
if (m_bMenuActive) {
// TODO(Miami): DxInput??
#if defined RW_D3D9 || defined RWLIBS
if (_InputMouseNeedsExclusive()) {
_InputShutdownMouse();
_InputInitialiseMouse(false);
}
#endif
Initialise();
LoadAllTextures();
@ -5049,8 +5173,12 @@ CMenuManager::SwitchMenuOnAndOff()
DoRWStuffEndOfFrame();
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DoRWStuffEndOfFrame();
// TODO(Miami): DxInput??
#if defined RW_D3D9 || defined RWLIBS
if (_InputMouseNeedsExclusive()) {
_InputShutdownMouse();
_InputInitialiseMouse(true);
}
#endif
#ifdef PS2_LIKE_MENU
bottomBarActive = false;
@ -5095,7 +5223,12 @@ CMenuManager::SwitchMenuOnAndOff()
m_bMenuActive = true;
m_OnlySaveMenu = true;
// TODO(Miami): DxInput??
#if defined RW_D3D9 || defined RWLIBS
if (_InputMouseNeedsExclusive()) {
_InputShutdownMouse();
_InputInitialiseMouse(false);
}
#endif
Initialise();
LoadAllTextures();

View File

@ -265,17 +265,9 @@ enum eMenuAction
MENUACTION_DYNAMICACOUSTIC,
MENUACTION_MOUSESTEER,
MENUACTION_UNK110,
#ifdef MORE_LANGUAGES
MENUACTION_LANG_PL,
MENUACTION_LANG_RUS,
MENUACTION_LANG_JAP,
#endif
#ifdef IMPROVED_VIDEOMODE
MENUACTION_SCREENMODE,
#endif
#ifdef FREE_CAM
MENUACTION_FREECAM,
#endif
#ifdef LEGACY_MENU_OPTIONS
MENUACTION_CTRLVIBRATION,
MENUACTION_CTRLCONFIG,
@ -547,7 +539,7 @@ public:
int32 m_nMouseOldPosY;
int32 m_nHoverOption;
bool m_bShowMouse;
int32 m_nPrevOption;
int32 m_nOptionMouseHovering;
bool m_bStartWaitingForKeyBind;
bool m_bWaitingForNewKeyBind;
bool m_bKeyChangeNotProcessed;
@ -664,6 +656,7 @@ public:
void ScrollDownListByOne();
void PageUpList(bool);
void PageDownList(bool);
int8 GetPreviousPageOption();
// uint8 GetNumberOfMenuOptions();
};
@ -673,6 +666,6 @@ VALIDATE_SIZE(CMenuManager, 0x688);
#endif
extern CMenuManager FrontEndMenuManager;
extern CMenuScreen aScreens[];
#endif

View File

@ -108,7 +108,7 @@ public:
if (angle >= TWOPI)
angle -= TWOPI;
return (int)floorf(angle / DEGTORAD(45.0f));
return (int)Floor(angle / DEGTORAD(45.0f));
}
// Unlike usual string comparison functions, these don't care about greater or lesser

View File

@ -1,6 +1,8 @@
#pragma once
#include "common.h"
#include "Frontend.h"
#ifdef PC_MENU
// --MIAMI: Done except commented things
// If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp.
CMenuScreen aScreens[] = {
// MENUPAGE_STATS = 0
@ -341,3 +343,5 @@ CMenuScreen aScreens[] = {
},
#endif
};
#endif

View File

@ -39,6 +39,7 @@
#include "General.h"
#include "Fluff.h"
#include "Gangs.h"
#include "platform.h"
#ifdef GTA_PS2
#include "eetypes.h"
@ -671,7 +672,7 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
#if defined RW_D3D9 || defined RWLIBS
if ( PSGLOBAL(mouse) == nil )
_InputInitialiseMouse();
_InputInitialiseMouse(!FrontEndMenuManager.m_bMenuActive && _InputMouseNeedsExclusive());
if ( PSGLOBAL(mouse) != nil )
{
@ -725,7 +726,7 @@ void CPad::UpdateMouse()
{
#if defined RW_D3D9 || defined RWLIBS
if ( PSGLOBAL(mouse) == nil )
_InputInitialiseMouse();
_InputInitialiseMouse(!FrontEndMenuManager.m_bMenuActive && _InputMouseNeedsExclusive());
DIMOUSESTATE2 state;

View File

@ -778,8 +778,8 @@ void CRadar::DrawRadarMap()
DrawRadarMask();
// top left ist (0, 0)
int x = floorf((vec2DRadarOrigin.x - RADAR_MIN_X) / RADAR_TILE_SIZE);
int y = ceilf((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - RADAR_MIN_Y) / RADAR_TILE_SIZE);
int x = Floor((vec2DRadarOrigin.x - RADAR_MIN_X) / RADAR_TILE_SIZE);
int y = Ceil((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - RADAR_MIN_Y) / RADAR_TILE_SIZE);
StreamRadarSections(x, y);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
@ -1332,7 +1332,7 @@ void CRadar::Shutdown()
void CRadar::StreamRadarSections(const CVector &posn)
{
StreamRadarSections(floorf((2000.0f + posn.x) / 500.0f), ceilf(7.0f - (2000.0f + posn.y) / 500.0f));
StreamRadarSections(Floor((2000.0f + posn.x) / 500.0f), Ceil(7.0f - (2000.0f + posn.y) / 500.0f));
}
void CRadar::StreamRadarSections(int32 x, int32 y)

View File

@ -74,6 +74,14 @@ CPlaceName::Display()
CHud::SetZoneName(text);
}
void
CPlaceName::ProcessAfterFrontEndShutDown(void)
{
CHud::m_pLastZoneName = nil;
CHud::m_ZoneState = 0;
m_nAdditionalTimer = 250;
}
CCurrentVehicle::CCurrentVehicle()
{
Init();

View File

@ -16,6 +16,7 @@ public:
void Init();
void Process();
void Display();
void ProcessAfterFrontEndShutDown();
};
class CCurrentVehicle

View File

@ -104,7 +104,7 @@ CTheZones::Init(void)
NavigationZoneArray[0].maxy = 2000.0f;
NavigationZoneArray[0].maxz = 500.0f;
NavigationZoneArray[0].level = LEVEL_GENERIC;
NavigationZoneArray[0].type = ZONE_NAVIG;
NavigationZoneArray[0].type = ZONE_DEFAULT;
m_CurrLevel = LEVEL_GENERIC;

View File

@ -285,7 +285,6 @@ enum Config {
#define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER
//#define PEDS_REPORT_CRIMES_ON_PHONE
// Camera
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future

View File

@ -620,6 +620,23 @@ CEntity::PruneReferences(void)
}
}
// Clean up the reference from *pent -> 'this'
void
CEntity::CleanUpOldReference(CEntity **pent)
{
CReference* ref, ** lastnextp;
lastnextp = &m_pFirstReference;
for (ref = m_pFirstReference; ref; ref = ref->next) {
if (ref->pentity == pent) {
*lastnextp = ref->next;
ref->next = CReferences::pEmptyList;
CReferences::pEmptyList = ref;
break;
}
lastnextp = &ref->next;
}
}
void
CEntity::UpdateRpHAnim(void)
{

View File

@ -168,6 +168,7 @@ public:
void RegisterReference(CEntity **pent);
void ResolveReferences(void);
void PruneReferences(void);
void CleanUpOldReference(CEntity **pent);
#ifdef PED_SKIN
void UpdateRpHAnim(void);

View File

@ -15,3 +15,5 @@ inline float Sqrt(float x) { return sqrtf(x); }
inline float RecipSqrt(float x, float y) { return x/Sqrt(y); }
inline float RecipSqrt(float x) { return RecipSqrt(1.0f, x); }
inline float Pow(float x, float y) { return powf(x, y); }
inline float Floor(float x) { return floorf(x); }
inline float Ceil(float x) { return ceilf(x); }

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,13 @@ struct PedAudioData
int m_nMaxRandomDelayTime;
};
enum
{
ATTACK_IN_PROGRESS,
CANT_ATTACK,
WATCH_UNTIL_HE_DISAPPEARS,
};
enum eFormation
{
FORMATION_UNDEFINED,
@ -474,7 +481,7 @@ public:
uint32 bNeverEverTargetThisPed : 1;
uint32 bCrouchWhenScared : 1;
uint32 bKnockedOffBike : 1;
//uint32 b158_8
uint32 b158_8 : 1;
uint32 b158_10 : 1;
uint32 bBoughtIceCream : 1;
uint32 b158_40 : 1;
@ -944,6 +951,8 @@ public:
void ClearWaitState(void);
void Undress(const char*);
void Dress(void);
int32 KillCharOnFootMelee(CVector&, CVector&, CVector&);
int32 KillCharOnFootArmed(CVector&, CVector&, CVector&);
bool HasWeaponSlot(uint8 slot) { return m_weapons[slot].m_eWeaponType != WEAPONTYPE_UNARMED; }
CWeapon& GetWeapon(uint8 slot) { return m_weapons[slot]; }

View File

@ -7,10 +7,11 @@
#include "Sprite.h"
#include "Text.h"
// TODO(Miami)
static char ObjectiveText[][28] = {
"No Obj",
"Wait on Foot",
"Wait on Foot For Cop",
"Flee on Foot Till Safe",
"Guard Spot",
"Guard Area",
@ -21,6 +22,8 @@ static char ObjectiveText[][28] = {
"Flee Char on Foot Till Safe",
"Flee Char on Foot Always",
"GoTo Char on Foot",
"GoTo Char on Foot Walking",
"Hassle Char",
"Follow Char in Formation",
"Leave Car",
"Enter Car as Passenger",
@ -42,10 +45,9 @@ static char ObjectiveText[][28] = {
"Catch Train",
"Buy IceCream",
"Steal Any Car",
"Steal Any Mission Car",
"Mug Char",
#ifdef VC_PED_PORTS
"Leave Car and Die"
#endif
"Leave Car and Die",
};
static char StateText[][18] = {

View File

@ -35,7 +35,7 @@ CPlayerPed::~CPlayerPed()
delete m_pWanted;
}
// --MIAMI: Done except commented out things
// --MIAMI: Done
CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
{
m_fMoveSpeed = 0.0f;
@ -53,10 +53,8 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
m_nSpeedTimer = 0;
m_bSpeedTimerFlag = false;
// TODO(Miami)
// if (pPointGunAt)
// m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
if (m_pPointGunAt)
m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
m_pPointGunAt = nil;
SetPedState(PED_IDLE);
#ifndef FIX_BUGS
@ -69,13 +67,14 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
m_fAttackButtonCounter = 0.0f;
m_bHaveTargetSelected = false;
m_bHasLockOnTarget = false;
m_bDrunkVisualsWearOff = true;
m_bCanBeDamaged = true;
m_bDrunkVisualsWearOff = false;
m_fWalkAngle = 0.0f;
m_fFPSMoveHeading = 0.0f;
m_pMinigunTopAtomic = nil;
m_fGunSpinSpeed = 0.0;
m_fGunSpinAngle = 0.0;
m_nPadDownPressedInMilliseconds = 0;
m_nTargettableObjects[0] = m_nTargettableObjects[1] = m_nTargettableObjects[2] = m_nTargettableObjects[3] = -1;
unused1 = false;
for (int i = 0; i < 6; i++) {
@ -85,17 +84,16 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
}
m_nCheckPlayersIndex = 0;
m_nPadUpPressedInMilliseconds = 0;
m_nPadDownPressedInMilliseconds = 0;
idleAnimBlockIndex = CAnimManager::GetAnimationBlockIndex("playidles");
}
void CPlayerPed::ClearWeaponTarget()
// --MIAMI: Done
void
CPlayerPed::ClearWeaponTarget()
{
if (m_nPedType == PEDTYPE_PLAYER1) {
// TODO(Miami)
// if (m_pPointGunAt)
// m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
if (m_pPointGunAt)
m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
m_pPointGunAt = nil;
TheCamera.ClearPlayerWeaponMode();
@ -1816,6 +1814,7 @@ CPlayerPed::PlayIdleAnimations(CPad *padUsed)
}
}
// --MIAMI: Done
void
CPlayerPed::RemovePedFromMeleeList(CPed *ped)
{
@ -1828,6 +1827,100 @@ CPlayerPed::RemovePedFromMeleeList(CPed *ped)
ped->m_attackTimer = 0;
}
// --MIAMI: Done
void
CPlayerPed::GetMeleeAttackCoords(CVector& coords, int8 dir, float dist)
{
coords = GetPosition();
switch (dir) {
case 0:
coords.y += dist;
break;
case 1:
coords.x += Sqrt(3.f / 4.f) * dist;
coords.y += 0.5f * dist;
break;
case 2:
coords.x += Sqrt(3.f / 4.f) * dist;
coords.y -= 0.5f * dist;
break;
case 3:
coords.y -= dist;
break;
case 4:
coords.x -= Sqrt(3.f / 4.f) * dist;
coords.y -= 0.5f * dist;
break;
case 5:
coords.x -= Sqrt(3.f / 4.f) * dist;
coords.y += 0.5f * dist;
break;
default:
break;
}
}
// --MIAMI: Done
int32
CPlayerPed::FindMeleeAttackPoint(CPed *victim, CVector &dist, uint32 &endOfAttackOut)
{
endOfAttackOut = 0;
bool thereIsAnEmptySlot = false;
int dirToAttack = -1;
for (int i = 0; i < ARRAY_SIZE(m_pMeleeList); i++) {
CPed* pedAtThisDir = m_pMeleeList[i];
if (pedAtThisDir) {
if (pedAtThisDir == victim) {
dirToAttack = i;
} else {
if (pedAtThisDir->m_attackTimer > endOfAttackOut)
endOfAttackOut = pedAtThisDir->m_attackTimer;
}
} else {
thereIsAnEmptySlot = true;
}
}
// We don't have victim ped in our melee list
if (dirToAttack == -1 && thereIsAnEmptySlot) {
float angle = Atan2(-dist.x, -dist.y);
float adjustedAngle = angle + DEGTORAD(30.0f);
if (adjustedAngle < 0.f)
adjustedAngle += TWOPI;
int wantedDir = Floor(adjustedAngle / DEGTORAD(60.0f));
// And we have another ped at the direction of victim ped, so store victim to next empty direction to it's real direction. (Bollocks)
if (m_pMeleeList[wantedDir]) {
int closestDirToPreferred = -99;
int preferredDir = wantedDir;
for (int i = 0; i < ARRAY_SIZE(m_pMeleeList); i++) {
if (!m_pMeleeList[i]) {
if (Abs(i - preferredDir) < Abs(closestDirToPreferred - preferredDir))
closestDirToPreferred = i;
}
}
if (closestDirToPreferred > 0)
dirToAttack = closestDirToPreferred;
} else {
// Luckily the direction of victim ped is already empty, good
dirToAttack = wantedDir;
}
if (dirToAttack != -1) {
m_pMeleeList[dirToAttack] = victim;
victim->RegisterReference((CEntity**) &m_pMeleeList[dirToAttack]);
if (endOfAttackOut > CTimer::GetTimeInMilliseconds())
victim->m_attackTimer = endOfAttackOut + CGeneral::GetRandomNumberInRange(1000, 2000);
else
victim->m_attackTimer = CTimer::GetTimeInMilliseconds() + CGeneral::GetRandomNumberInRange(500, 1000);
}
}
return dirToAttack;
}
#ifdef COMPATIBLE_SAVES
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); SkipSaveBuf(buf, sizeof(data));

View File

@ -34,7 +34,7 @@ public:
bool m_bDrunkVisualsWearOff; // TODO(Miami): That may be something else
CVector m_vecSafePos[6]; // safe places from the player, for example behind a tree
CPed *m_pPedAtSafePos[6];
CPlayerPed* m_pMeleeList[6];
CPed *m_pMeleeList[6]; // reachable peds at each direction(6)
char unused1;
int16 m_nCheckPlayersIndex;
float m_fWalkAngle; //angle between heading and walking direction
@ -85,6 +85,8 @@ public:
bool DoesPlayerWantNewWeapon(eWeaponType, bool);
void PlayIdleAnimations(CPad*);
void RemovePedFromMeleeList(CPed*);
void GetMeleeAttackCoords(CVector&, int8, float);
int32 FindMeleeAttackPoint(CPed*, CVector&, uint32&);
static void SetupPlayerPed(int32);
static void DeactivatePlayerPed(int32);

View File

@ -71,6 +71,7 @@ bool CHud::m_Wants_To_Draw_3dMarkers;
wchar CHud::m_BigMessage[6][128];
int16 CHud::m_ItemToFlash;
bool CHud::m_HideRadar;
int32 CHud::m_DrawClock;
// These aren't really in CHud
float CHud::BigMessageInUse[6];
@ -519,7 +520,6 @@ void CHud::Draw()
DrawZoneName
*/
if (m_pZoneName) {
float fZoneAlpha = 255.0f;
if (m_pZoneName != m_pLastZoneName) {
switch (m_ZoneState) {
@ -528,6 +528,8 @@ void CHud::Draw()
m_ZoneToPrint = m_pZoneName;
m_ZoneNameTimer = 0;
m_ZoneFadeTimer = 0;
if (m_VehicleState == 1 || m_VehicleState == 2)
m_VehicleState = 3;
break;
case 1:
case 2:
@ -542,19 +544,20 @@ void CHud::Draw()
m_pLastZoneName = m_pZoneName;
}
float fZoneAlpha = 255.0f;
if (m_ZoneState) {
switch (m_ZoneState) {
case 1:
fZoneAlpha = 255.0f;
m_ZoneFadeTimer = 1000;
if (m_ZoneNameTimer > 10000) {
if (m_ZoneNameTimer > 10000.0f) {
m_ZoneFadeTimer = 1000;
m_ZoneState = 3;
}
fZoneAlpha = 255.0f;
break;
case 2:
m_ZoneFadeTimer += CTimer::GetTimeStepInMilliseconds();
if (m_ZoneFadeTimer > 1000) {
if (m_ZoneFadeTimer > 1000.0f) {
m_ZoneState = 1;
m_ZoneFadeTimer = 1000;
}
@ -562,7 +565,7 @@ void CHud::Draw()
break;
case 3:
m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds();
if (m_ZoneFadeTimer < 0) {
if (m_ZoneFadeTimer < 0.0f) {
m_ZoneState = 0;
m_ZoneFadeTimer = 0;
}
@ -570,7 +573,7 @@ void CHud::Draw()
break;
case 4:
m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds();
if (m_ZoneFadeTimer < 0) {
if (m_ZoneFadeTimer < 0.0f) {
m_ZoneFadeTimer = 0;
m_ZoneToPrint = m_pLastZoneName;
m_ZoneState = 2;
@ -582,11 +585,8 @@ void CHud::Draw()
}
#ifndef HUD_ENHANCEMENTS
if (!m_Message[0]) {
#else
if (!m_Message[0] && !m_BigMessage[2][0]) { // Hide zone name if wasted/busted text is displaying
#endif
if (!m_Message[0] && BigMessageInUse[1] == 0.0f && BigMessageInUse[2] == 0.0f) {
m_ZoneNameTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetJustifyOff();
CFont::SetPropOn();
@ -606,11 +606,14 @@ void CHud::Draw()
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, fZoneAlpha));
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha));
CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f), m_ZoneToPrint);
if (!CTheScripts::bPlayerIsInTheStatium)
CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f), m_ZoneToPrint);
CFont::SetSlant(0.f);
} else {
m_ZoneState = 3;
}
}
}
@ -628,6 +631,8 @@ void CHud::Draw()
m_pVehicleNameToPrint = m_VehicleName;
m_VehicleNameTimer = 0;
m_VehicleFadeTimer = 0;
if (m_ZoneState == 1 || m_ZoneState == 2)
m_ZoneState = 3;
break;
case 1:
case 2:
@ -723,23 +728,26 @@ void CHud::Draw()
/*
DrawClock
*/
CFont::SetJustifyOff();
CFont::SetCentreOff();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y));
CFont::SetBackGroundOnlyTextOff();
CFont::SetPropOff();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
if (m_DrawClock) {
CFont::SetJustifyOff();
CFont::SetCentreOff();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y));
CFont::SetBackGroundOnlyTextOff();
CFont::SetPropOff();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes());
AsciiToUnicode(sTemp, sPrint);
sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes());
AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(CLOCK_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint);
CFont::SetColor(CLOCK_COLOR);
if (FrontEndMenuManager.m_PrefsShowHud)
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint);
}
/*
DrawOnScreenTimer
@ -1011,6 +1019,11 @@ void CHud::Draw()
DrawSubtitles
*/
if (m_Message[0] && !m_BigMessage[2][0]) {
if (m_VehicleState != 0)
m_VehicleState = 3;
if (m_ZoneState != 0)
m_ZoneState = 3;
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128));
@ -1049,6 +1062,119 @@ void CHud::Draw()
CFont::SetDropShadowPosition(0);
}
/*
HelpMessage
*/
if (m_HelpMessage[0]) {
if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, 256)) {
switch (m_HelpMessageState) {
case 0:
m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 2;
m_HelpMessageTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256);
m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0);
break;
case 1:
case 2:
case 3:
case 4:
m_HelpMessageTimer = 5;
m_HelpMessageState = 4;
break;
default:
break;
}
CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256);
}
float fAlpha = 225.0f;
if (m_HelpMessageState != 0) {
switch (m_HelpMessageState) {
case 1:
fAlpha = 225.0f;
m_HelpMessageFadeTimer = 600;
if (m_HelpMessageTimer > m_fHelpMessageTime * 1000.0f || m_HelpMessageQuick && m_HelpMessageTimer > 1500.0f) {
m_HelpMessageFadeTimer = 600;
m_HelpMessageState = 3;
}
break;
case 2:
if (TheCamera.m_WideScreenOn)
break;
m_HelpMessageFadeTimer += 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer > 0) {
m_HelpMessageState = 1;
m_HelpMessageFadeTimer = 0;
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
case 3:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer < 0 || TheCamera.m_WideScreenOn) {
m_HelpMessageState = 0;
m_HelpMessageFadeTimer = 0;
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
case 4:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 2;
m_HelpMessageFadeTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 256);
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
default:
break;
}
if (!TheCamera.m_WideScreenOn) {
m_HelpMessageTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetAlphaFade(fAlpha);
CFont::SetCentreOff();
CFont::SetPropOn();
if (CGame::germanGame)
CFont::SetScale(SCREEN_SCALE_X(0.52f * 0.85f), SCREEN_SCALE_Y(1.1f * 0.85f));
#ifdef MORE_LANGUAGES
else if (CFont::IsJapanese())
CFont::SetScale(SCREEN_SCALE_X(0.52f) * 1.35f, SCREEN_SCALE_Y(1.1f) * 1.25f);
#endif
else
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
CFont::DrawFonts();
// CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetJustifyOff();
#ifdef MORE_LANGUAGES
if (CFont::IsJapanese())
CFont::SetWrapx(SCREEN_SCALE_X(229.0f + 34.0f - 4.0f));
else
#endif
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 34.0f - 4.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff();
CFont::SetDropShadowPosition(0);
CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f));
CFont::PrintString(SCREEN_SCALE_X(34.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
CFont::SetAlphaFade(255.0f);
CFont::SetWrapx(SCREEN_WIDTH);
}
}
} else
m_HelpMessageState = 0;
/*
DrawBigMessage
*/
@ -1058,10 +1184,15 @@ void CHud::Draw()
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackGroundOnlyTextOff();
CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f));
if (CGame::frenchGame || CGame::germanGame) {
CFont::SetScale(SCREEN_SCALE_X(1.6f), SCREEN_SCALE_Y(1.8f));
} else {
CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f));
}
CFont::SetPropOn();
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_X(615.0f));
CFont::SetCentreSize(SCREEN_SCALE_X(590.0f));
CFont::SetColor(CRGBA(255, 255, 0, BigMessageAlpha[0])); // unused color
CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[0] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
@ -1084,14 +1215,9 @@ void CHud::Draw()
if (BigMessageAlpha[0] > 255.0f)
BigMessageAlpha[0] = 255.0f;
}
CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[0]));
#ifdef FIX_BUGS
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(18.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[0]);
#else
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[0]);
#endif
CFont::DrawFonts();
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, BigMessageAlpha[0]));
CFont::SetColor(CRGBA(BIGMESSAGE_COLOR.r, BIGMESSAGE_COLOR.g, BIGMESSAGE_COLOR.b, BigMessageAlpha[0]));
CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(18.0f), m_BigMessage[0]);
}
@ -1131,8 +1257,12 @@ void CHud::Draw()
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]);
}
else {
BigMessageAlpha[2] = 0.0f;
BigMessageInUse[2] = 1.0f;
BigMessageAlpha[2] = 0.0f;
if (CHud::m_VehicleState != 0)
CHud::m_VehicleState = 0;
if (CHud::m_ZoneState != 0)
CHud::m_ZoneState = 0;
}
}
else {
@ -1143,108 +1273,13 @@ void CHud::Draw()
void CHud::DrawAfterFade()
{
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
if (CTimer::GetIsUserPaused() || CReplay::IsPlayingBack())
return;
if (m_HelpMessage[0]) {
if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, 256)) {
switch (m_HelpMessageState) {
case 0:
m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 2;
m_HelpMessageTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256);
m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0);
break;
case 1:
case 2:
case 3:
case 4:
m_HelpMessageTimer = 5;
m_HelpMessageState = 4;
break;
default:
break;
}
CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256);
}
float fAlpha = 225.0f;
if (m_HelpMessageState != 0) {
switch (m_HelpMessageState) {
case 1:
fAlpha = 225.0f;
m_HelpMessageFadeTimer = 600;
if (m_HelpMessageTimer > m_fHelpMessageTime * 1000.0f || m_HelpMessageQuick && m_HelpMessageTimer > 1500.0f) {
m_HelpMessageFadeTimer = 600;
m_HelpMessageState = 3;
}
break;
case 2:
m_HelpMessageFadeTimer += 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer > 0) {
m_HelpMessageState = 1;
m_HelpMessageFadeTimer = 0;
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
case 3:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 0;
m_HelpMessageFadeTimer = 0;
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
case 4:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 2;
m_HelpMessageFadeTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 256);
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
default:
break;
}
m_HelpMessageTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetAlphaFade(fAlpha);
CFont::SetCentreOff();
CFont::SetPropOn();
if (CGame::germanGame)
CFont::SetScale(SCREEN_SCALE_X(0.52f * 0.85f), SCREEN_SCALE_Y(1.1f * 0.85f));
#ifdef MORE_LANGUAGES
else if (CFont::IsJapanese())
CFont::SetScale(SCREEN_SCALE_X(0.52f) * 1.35f, SCREEN_SCALE_Y(1.1f) * 1.25f);
#endif
else
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetJustifyOff();
#ifdef MORE_LANGUAGES
if (CFont::IsJapanese())
CFont::SetWrapx(SCREEN_SCALE_X(229.0f + 26.0f - 4.0f));
else
#endif
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f));
CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
CFont::SetAlphaFade(255.0f);
}
}
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) {
intro_text_line &line = CTheScripts::IntroTextLines[i];
if (line.m_Text[0] != '\0' && !line.m_bTextBeforeFade) {
@ -1315,12 +1350,10 @@ void CHud::DrawAfterFade()
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_X(600.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]);
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetColor(ODDJOB_COLOR);
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[3]);
CFont::PrintString((SCREEN_WIDTH / 2), SCREEN_SCALE_Y(140.0f) - SCREEN_SCALE_Y(16.0f), m_BigMessage[3]);
}
if (!m_BigMessage[1][0] && m_BigMessage[4][0]) {
@ -1330,13 +1363,11 @@ void CHud::DrawAfterFade()
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]);
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetColor(ODDJOB_COLOR);
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[4]);
CFont::PrintString((SCREEN_WIDTH / 2), SCREEN_SCALE_Y(140.0f), m_BigMessage[4]);
}
// Oddjob result
@ -1418,7 +1449,7 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));
CFont::SetPropOn();
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(-500.0f));
CFont::SetRightJustifyWrap(0.0f);
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_BANK);
if (BigMessageX[1] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
@ -1452,6 +1483,7 @@ void CHud::DrawAfterFade()
BigMessageAlpha[1] = 0.0f;
BigMessageX[1] = -60.0f;
BigMessageInUse[1] = 1.0f;
m_ZoneState = 0;
}
}
else {
@ -1541,6 +1573,7 @@ void CHud::Initialise()
if (gpRocketSightTex == nil)
gpRocketSightTex = RwTextureRead("siterocket", nil);
m_DrawClock = 1;
CounterOnLastFrame = false;
m_ItemToFlash = ITEM_NONE;
OddJob2Timer = 0;
@ -1591,6 +1624,7 @@ void CHud::ReInitialise() {
CounterOnLastFrame = false;
m_ItemToFlash = ITEM_NONE;
m_DrawClock = 1;
OddJob2Timer = 0;
OddJob2OffTimer = 0.0f;
OddJob2On = 0;

View File

@ -86,6 +86,7 @@ public:
static wchar m_BigMessage[6][128];
static int16 m_ItemToFlash;
static bool m_HideRadar;
static int32 m_DrawClock;
// These aren't really in CHud
static float BigMessageInUse[6];

View File

@ -922,9 +922,9 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
// prestep x1 and x2 to next integer y
deltaA = CalcNewDelta(&poly[a1], &poly[a2]);
xA = deltaA * (ceilf(poly[a1].y) - poly[a1].y) + poly[a1].x;
xA = deltaA * (Ceil(poly[a1].y) - poly[a1].y) + poly[a1].x;
deltaB = CalcNewDelta(&poly[b1], &poly[b2]);
xB = deltaB * (ceilf(poly[b1].y) - poly[b1].y) + poly[b1].x;
xB = deltaB * (Ceil(poly[b1].y) - poly[b1].y) + poly[b1].x;
if(y != yend){
if(deltaB < 0.0f && (int)xB < xstart)
@ -969,7 +969,7 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
xstart = poly[b1].x;
}while(y == (int)poly[b2].y);
deltaB = CalcNewDelta(&poly[b1], &poly[b2]);
xB = deltaB * (ceilf(poly[b1].y) - poly[b1].y) + poly[b1].x;
xB = deltaB * (Ceil(poly[b1].y) - poly[b1].y) + poly[b1].x;
if(deltaB < 0.0f && (int)xB < xstart)
xstart = xB;
}
@ -1005,7 +1005,7 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
xend = poly[a1].x;
}while(y == (int)poly[a2].y);
deltaA = CalcNewDelta(&poly[a1], &poly[a2]);
xA = deltaA * (ceilf(poly[a1].y) - poly[a1].y) + poly[a1].x;
xA = deltaA * (Ceil(poly[a1].y) - poly[a1].y) + poly[a1].x;
if(deltaA >= 0.0f && (int)xA > xend)
xend = xA;
}

View File

@ -1167,8 +1167,8 @@ CWaterLevel::RenderTransparentWater(void)
{
if (m_nRenderWaterLayers != 1 && m_nRenderWaterLayers != 6)
{
float fMaskX = floorf(fCamX / 2.0f) * 2.0f;
float fMaskY = floorf(fCamY / 2.0f) * 2.0f;
float fMaskX = Floor(fCamX / 2.0f) * 2.0f;
float fMaskY = Floor(fCamY / 2.0f) * 2.0f;
float fWaterZ = CWaterLevel::ms_aWaterZs[nBlock];
float fSectorX = WATER_FROM_SMALL_SECTOR_X(BlockX) - 400.0f;
float fSectorY = WATER_FROM_SMALL_SECTOR_Y(BlockY);
@ -1519,8 +1519,8 @@ CWaterLevel::RenderWavyMask(float fX, float fY, float fZ,
return;
#ifndef PC_WATER
float fUOffset = fX - (MAX_LARGE_SECTORS * (int32)floorf(fX / MAX_LARGE_SECTORS));
float fVOffset = fY - (MAX_LARGE_SECTORS * (int32)floorf(fY / MAX_LARGE_SECTORS));
float fUOffset = fX - (MAX_LARGE_SECTORS * (int32)Floor(fX / MAX_LARGE_SECTORS));
float fVOffset = fY - (MAX_LARGE_SECTORS * (int32)Floor(fY / MAX_LARGE_SECTORS));
int32 nSecsX = (int32)((fX - fSectorX) / 2.0f);
int32 nSecsY = (int32)((fY - fSectorY) / 2.0f);
@ -1870,8 +1870,8 @@ CWaterLevel::PreCalcWaterGeometry(void)
if ( _IsColideWithBlock(BlockX, BlockY, nBlock) )
{
float fMaskX = floorf(fCamX / 2.0f) * 2.0f;
float fMaskY = floorf(fCamY / 2.0f) * 2.0f;
float fMaskX = Floor(fCamX / 2.0f) * 2.0f;
float fMaskY = Floor(fCamY / 2.0f) * 2.0f;
float fSectorX = WATER_FROM_SMALL_SECTOR_X(BlockX) - WATER_X_OFFSET;
float fSectorY = WATER_FROM_SMALL_SECTOR_Y(BlockY);
@ -1994,8 +1994,8 @@ CWaterLevel::PreCalcWavyMask(float fX, float fY, float fZ,
if ( COcclusion::IsAABoxOccluded(vecSectorPos, MAX_LARGE_SECTORS, MAX_LARGE_SECTORS, 4.0f) )
return false;
floorf(fX / MAX_LARGE_SECTORS);
floorf(fY / MAX_LARGE_SECTORS);
Floor(fX / MAX_LARGE_SECTORS);
Floor(fY / MAX_LARGE_SECTORS);
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
RpMorphTarget *wavyMorph = RpGeometryGetMorphTarget(wavyGeometry, 0);
@ -2335,7 +2335,7 @@ _GetWindedWave(float fX, float fY)
float y = WATER_HUGE_Y(fY);
float fWindFactor (CWeather::WindClipped * 0.4f + 0.2f);
float fWave = Sin(( (x - floorf(x)) + (y - floorf(y)) ) * TWOPI + fAngle);
float fWave = Sin(( (x - Floor(x)) + (y - Floor(y)) ) * TWOPI + fAngle);
return fWindFactor * fWave;
}
@ -2380,8 +2380,8 @@ CWaterLevel::RenderWakeSegment(CVector2D &vecA, CVector2D &vecB, CVector2D &vecC
float fVD = (PosD.y / 4) + _TEXTURE_WAKE_ADDV;
#define MIN4(a, b, c, d) (Min((a), Min((b), Min((c), (d)))))
float fMinU = floorf(MIN4(fUA, fUB, fUC, fUD));
float fMinV = floorf(MIN4(fVA, fVB, fVC, fVD));
float fMinU = Floor(MIN4(fUA, fUB, fUC, fUD));
float fMinV = Floor(MIN4(fVA, fVB, fVC, fVD));
#undef MIN4
float fZA = _GetWindedWave(PosA.x, PosA.y) + fWakeZ;

View File

@ -64,10 +64,6 @@ static psGlobalType PsGlobal;
#undef MAKEPOINTS
#define MAKEPOINTS(l) (*((POINTS /*FAR*/ *)&(l)))
#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
#define JIF(x) if (FAILED(hr=(x))) \
{debug(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n"), hr); return;}
unsigned long _dwMemAvailPhys;
RwUInt32 gGameState;
@ -830,9 +826,10 @@ void _InputInitialiseJoys()
}
}
void _InputInitialiseMouse()
long _InputInitialiseMouse(bool exclusive)
{
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
return 0;
}
void psPostRWinit(void)
@ -847,7 +844,7 @@ void psPostRWinit(void)
glfwSetJoystickCallback(joysChangeCB);
_InputInitialiseJoys();
_InputInitialiseMouse();
_InputInitialiseMouse(false);
if(!(vm.flags & rwVIDEOMODEEXCLUSIVE))
glfwSetWindowSize(PSGLOBAL(window), RsGlobal.maximumWidth, RsGlobal.maximumHeight);

View File

@ -35,6 +35,7 @@ extern RwBool psInstallFileSystem(void);
extern RwBool psNativeTextureSupport(void);
extern void _InputTranslateShiftKeyUpDown(RsKeyCodes* rs);
extern long _InputInitialiseMouse(bool exclusive); // returns HRESULT on Windows actually
extern void HandleExit();

View File

@ -1602,7 +1602,6 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode)
return TRUE;
}
/*
*****************************************************************************
*/
@ -2003,7 +2002,7 @@ WinMain(HINSTANCE instance,
if ( _InputInitialise() == S_OK )
{
_InputInitialiseMouse();
_InputInitialiseMouse(false);
_InputInitialiseJoys();
}
@ -2542,7 +2541,7 @@ HRESULT _InputInitialise()
return S_OK;
}
HRESULT _InputInitialiseMouse()
HRESULT _InputInitialiseMouse(bool exclusive)
{
HRESULT hr;
@ -2560,7 +2559,7 @@ HRESULT _InputInitialiseMouse()
if( FAILED( hr = PSGLOBAL(mouse)->SetDataFormat( &c_dfDIMouse2 ) ) )
return hr;
if( FAILED( hr = PSGLOBAL(mouse)->SetCooperativeLevel( PSGLOBAL(window), DISCL_NONEXCLUSIVE | DISCL_FOREGROUND ) ) )
if( FAILED( hr = PSGLOBAL(mouse)->SetCooperativeLevel( PSGLOBAL(window), (exclusive ? DISCL_EXCLUSIVE : DISCL_NONEXCLUSIVE) | DISCL_FOREGROUND ) ) )
return hr;
// Acquire the newly created device
@ -2848,6 +2847,23 @@ void _InputShutdown()
SAFE_RELEASE(PSGLOBAL(dinterface));
}
void _InputShutdownMouse()
{
if (PSGLOBAL(mouse) == nil)
return;
PSGLOBAL(mouse)->Unacquire();
SAFE_RELEASE(PSGLOBAL(mouse));
}
BOOL _InputMouseNeedsExclusive(void)
{
RwVideoMode vm;
RwEngineGetVideoModeInfo(&vm, GcurSelVM);
return vm.flags & rwVIDEOMODEEXCLUSIVE;
}
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext )
{
HRESULT hr;

View File

@ -88,13 +88,14 @@ extern LRESULT CALLBACK
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
HRESULT _InputInitialise();
HRESULT _InputInitialiseMouse();
HRESULT CapturePad(RwInt32 padID);
void _InputInitialiseJoys();
void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num);
HRESULT _InputAddJoys();
HRESULT _InputGetMouseState(DIMOUSESTATE2 *state);
void _InputShutdown();
void _InputShutdownMouse();
BOOL _InputMouseNeedsExclusive();
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext );
BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key);
BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown);

View File

@ -2523,7 +2523,7 @@ CAutomobile::PreRender(void)
if(GetModelIndex() == MI_RCGOBLIN || GetModelIndex() == MI_RCRAIDER)
radius = 3.0f;
if(GetPosition().z - groundZ < radius)
HeliDustGenerate(this, radius-(GetPosition().z - groundZ), groundZ, ceilf(rnd));
HeliDustGenerate(this, radius-(GetPosition().z - groundZ), groundZ, Ceil(rnd));
}
CMatrix mat;