1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-24 00:00:00 +00:00

Merge pull request #656 from erorcun/miami

Peds, Hud, CFO 1/2, fixes - including zone names
This commit is contained in:
erorcun 2020-07-22 18:21:39 +03:00 committed by GitHub
commit b182fa4bb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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_186, // makes same sound with 40
SOUND_187, // makes same sound with 46 SOUND_187, // makes same sound with 46
SOUND_MELEE_ATTACK_START, SOUND_MELEE_ATTACK_START,
SOUND_189, SOUND_SKATING,
SOUND_WEAPON_MINIGUN_ATTACK, SOUND_WEAPON_MINIGUN_ATTACK,
SOUND_WEAPON_MINIGUN_2, SOUND_WEAPON_MINIGUN_2,
SOUND_WEAPON_MINIGUN_3, SOUND_WEAPON_MINIGUN_3,

View file

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

View file

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

View file

@ -24,7 +24,6 @@
#include "GenericGameStorage.h" #include "GenericGameStorage.h"
#include "Script.h" #include "Script.h"
#include "Camera.h" #include "Camera.h"
#include "MenuScreens.h"
#include "ControllerConfig.h" #include "ControllerConfig.h"
#include "Vehicle.h" #include "Vehicle.h"
#include "MBlur.h" #include "MBlur.h"
@ -214,75 +213,6 @@ ScaleAndCenterX(float x)
// --- Functions not in the game/inlined starts // --- 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 inline void
CMenuManager::ScrollUpListByOne() CMenuManager::ScrollUpListByOne()
{ {
@ -349,7 +279,6 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
} }
} }
// TODO(Miami)
inline void inline void
CMenuManager::ThingsToDoBeforeLeavingPage() CMenuManager::ThingsToDoBeforeLeavingPage()
{ {
@ -373,13 +302,123 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
CPlayerSkin::EndFrontendSkinEdit(); CPlayerSkin::EndFrontendSkinEdit();
} }
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) || (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)) { #ifdef CUSTOM_FRONTEND_OPTIONS
m_nTotalListRow = 0; 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 // ------ 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() CMenuManager::CMenuManager()
{ {
m_StatsScrollSpeed = 150.0f; m_StatsScrollSpeed = 150.0f;
@ -463,7 +502,7 @@ CMenuManager::Initialise(void)
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255); DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DoRWStuffEndOfFrame(); DoRWStuffEndOfFrame();
m_AllowNavigation = false; m_AllowNavigation = false;
m_menuTransitionProgress = -50; m_menuTransitionProgress = -50; // to start from black
m_nMenuFadeAlpha = 0; m_nMenuFadeAlpha = 0;
m_nCurrOption = 0; m_nCurrOption = 0;
m_nOptionHighlightTransitionBlend = 0; m_nOptionHighlightTransitionBlend = 0;
@ -1172,6 +1211,32 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
rightText = TheText.Get("FEA_NM3"); rightText = TheText.Get("FEA_NM3");
} }
break; 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 // Highlight trapezoid
@ -1326,6 +1391,24 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
} }
} }
#endif #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 // TODO(Miami): check
// Sliders // Sliders
@ -1955,10 +2038,10 @@ CMenuManager::DrawControllerSetupScreen()
float curOptY = i * rowHeight + yStart; float curOptY = i * rowHeight + yStart;
if (m_nMousePosY > MENU_Y(curOptY) && m_nMousePosY < MENU_Y(rowHeight + curOptY)) { 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); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
m_nPrevOption = i; m_nOptionMouseHovering = i;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) { if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrExLayer = HOVEROPTION_LIST; m_nCurrExLayer = HOVEROPTION_LIST;
m_nSelectedListRow = i; 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_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)) { 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) { if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrExLayer = HOVEROPTION_LIST; m_nCurrExLayer = HOVEROPTION_LIST;
} }
@ -3023,6 +3106,10 @@ CMenuManager::InitialiseChangedLanguageSettings()
default: default:
break; 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)) { m_nMousePosY < MENU_Y(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Y + MENU_DEFAULT_LINE_HEIGHT)) {
static int oldScreen = m_nCurrScreen; static int oldScreen = m_nCurrScreen;
m_nPrevOption = rowToCheck; m_nOptionMouseHovering = rowToCheck;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) { if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrOption = rowToCheck; m_nCurrOption = rowToCheck;
m_bShowMouse = true; m_bShowMouse = true;
@ -3632,7 +3719,7 @@ CMenuManager::ProcessButtonPresses(void)
break; break;
} }
if (m_bShowMouse && m_nMenuFadeAlpha == 255) { if (m_bShowMouse && m_nMenuFadeAlpha == 255) {
m_nPrevOption = oldOption; m_nOptionMouseHovering = oldOption;
m_nCurrOption = oldOption; m_nCurrOption = oldOption;
} }
} }
@ -3641,7 +3728,7 @@ CMenuManager::ProcessButtonPresses(void)
if (oldOption != m_nCurrOption) { if (oldOption != m_nCurrOption) {
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_LABEL) { if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_LABEL) {
++m_nCurrOption; ++m_nCurrOption;
++m_nPrevOption; ++m_nOptionMouseHovering;
} }
m_nOptionHighlightTransitionBlend = 0; m_nOptionHighlightTransitionBlend = 0;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 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 && if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_RESUME &&
#endif #endif
(m_nHoverOption == HOVEROPTION_RANDOM_ITEM)) { (m_nHoverOption == HOVEROPTION_RANDOM_ITEM)) {
m_nCurrOption = m_nPrevOption; m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true; optionSelected = true;
} }
} else if (CPad::GetPad(0)->GetLeftMouseJustDown()) { } else if (CPad::GetPad(0)->GetLeftMouseJustDown()) {
@ -3937,7 +4024,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED"); OutputDebugString("FRONTEND RADIO STATION CHANGED");
} else if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM } else if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) { && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) {
m_nCurrOption = m_nPrevOption; m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true; optionSelected = true;
} }
#else #else
@ -4024,7 +4111,7 @@ CMenuManager::ProcessButtonPresses(void)
break; break;
case HOVEROPTION_RANDOM_ITEM: case HOVEROPTION_RANDOM_ITEM:
if (((m_nCurrOption != 0) || (m_nCurrScreen != MENUPAGE_PAUSE_MENU)) { if (((m_nCurrOption != 0) || (m_nCurrScreen != MENUPAGE_PAUSE_MENU)) {
m_nCurrOption = m_nPrevOption; m_nCurrOption = m_nOptionMouseHovering;
optionSelected = true; optionSelected = true;
} }
break; break;
@ -4358,26 +4445,6 @@ CMenuManager::ProcessButtonPresses(void)
InitialiseChangedLanguageSettings(); InitialiseChangedLanguageSettings();
SaveSettings(); SaveSettings();
break; 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: case MENUACTION_POPULATESLOTS_CHANGEMENU:
PcSaveHelper.PopulateSlotInfo(); PcSaveHelper.PopulateSlotInfo();
@ -4540,7 +4607,6 @@ CMenuManager::ProcessButtonPresses(void)
} else if (m_nCurrScreen == MENUPAGE_CONTROLLER_PC) { } else if (m_nCurrScreen == MENUPAGE_CONTROLLER_PC) {
ControlsManager.MakeControllerActionsBlank(); ControlsManager.MakeControllerActionsBlank();
ControlsManager.InitDefaultControlConfiguration(); ControlsManager.InitDefaultControlConfiguration();
MousePointerStateHelper.GetMouseSetUp();
ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp()); ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp());
#if !defined RW_GL3 #if !defined RW_GL3
if (AllValidWinJoys.m_aJoys[JOYSTICK1].m_bInitialised) { if (AllValidWinJoys.m_aJoys[JOYSTICK1].m_bInitialised) {
@ -4595,6 +4661,33 @@ CMenuManager::ProcessButtonPresses(void)
} }
break; 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(); ProcessOnOffMenuOptions();
@ -4641,6 +4734,9 @@ CMenuManager::ProcessButtonPresses(void)
if (oldScreen != -1) { if (oldScreen != -1) {
ThingsToDoBeforeLeavingPage(); ThingsToDoBeforeLeavingPage();
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) || (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)) {
m_nTotalListRow = 0;
}
#ifdef PS2_LIKE_MENU #ifdef PS2_LIKE_MENU
if (!bottomBarActive && if (!bottomBarActive &&
@ -4797,6 +4893,36 @@ CMenuManager::ProcessButtonPresses(void)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings(); SaveSettings();
break; 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(); ProcessOnOffMenuOptions();
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
@ -4890,13 +5016,6 @@ CMenuManager::ProcessOnOffMenuOptions()
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings(); SaveSettings();
break; 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 void
CMenuManager::SwitchMenuOnAndOff() CMenuManager::SwitchMenuOnAndOff()
{ {
@ -5036,7 +5155,12 @@ CMenuManager::SwitchMenuOnAndOff()
m_bMenuActive = !m_bMenuActive; m_bMenuActive = !m_bMenuActive;
if (m_bMenuActive) { if (m_bMenuActive) {
// TODO(Miami): DxInput?? #if defined RW_D3D9 || defined RWLIBS
if (_InputMouseNeedsExclusive()) {
_InputShutdownMouse();
_InputInitialiseMouse(false);
}
#endif
Initialise(); Initialise();
LoadAllTextures(); LoadAllTextures();
@ -5049,8 +5173,12 @@ CMenuManager::SwitchMenuOnAndOff()
DoRWStuffEndOfFrame(); DoRWStuffEndOfFrame();
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255); DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DoRWStuffEndOfFrame(); DoRWStuffEndOfFrame();
#if defined RW_D3D9 || defined RWLIBS
// TODO(Miami): DxInput?? if (_InputMouseNeedsExclusive()) {
_InputShutdownMouse();
_InputInitialiseMouse(true);
}
#endif
#ifdef PS2_LIKE_MENU #ifdef PS2_LIKE_MENU
bottomBarActive = false; bottomBarActive = false;
@ -5095,7 +5223,12 @@ CMenuManager::SwitchMenuOnAndOff()
m_bMenuActive = true; m_bMenuActive = true;
m_OnlySaveMenu = true; m_OnlySaveMenu = true;
// TODO(Miami): DxInput?? #if defined RW_D3D9 || defined RWLIBS
if (_InputMouseNeedsExclusive()) {
_InputShutdownMouse();
_InputInitialiseMouse(false);
}
#endif
Initialise(); Initialise();
LoadAllTextures(); LoadAllTextures();

View file

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

View file

@ -108,7 +108,7 @@ public:
if (angle >= TWOPI) if (angle >= TWOPI)
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 // 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[] = { CMenuScreen aScreens[] = {
// MENUPAGE_STATS = 0 // MENUPAGE_STATS = 0
@ -341,3 +343,5 @@ CMenuScreen aScreens[] = {
}, },
#endif #endif
}; };
#endif

View file

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

View file

@ -778,8 +778,8 @@ void CRadar::DrawRadarMap()
DrawRadarMask(); DrawRadarMask();
// top left ist (0, 0) // top left ist (0, 0)
int x = floorf((vec2DRadarOrigin.x - RADAR_MIN_X) / RADAR_TILE_SIZE); int x = Floor((vec2DRadarOrigin.x - RADAR_MIN_X) / RADAR_TILE_SIZE);
int y = ceilf((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - RADAR_MIN_Y) / RADAR_TILE_SIZE); int y = Ceil((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - RADAR_MIN_Y) / RADAR_TILE_SIZE);
StreamRadarSections(x, y); StreamRadarSections(x, y);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
@ -1332,7 +1332,7 @@ void CRadar::Shutdown()
void CRadar::StreamRadarSections(const CVector &posn) 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) void CRadar::StreamRadarSections(int32 x, int32 y)

View file

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

View file

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

View file

@ -104,7 +104,7 @@ CTheZones::Init(void)
NavigationZoneArray[0].maxy = 2000.0f; NavigationZoneArray[0].maxy = 2000.0f;
NavigationZoneArray[0].maxz = 500.0f; NavigationZoneArray[0].maxz = 500.0f;
NavigationZoneArray[0].level = LEVEL_GENERIC; NavigationZoneArray[0].level = LEVEL_GENERIC;
NavigationZoneArray[0].type = ZONE_NAVIG; NavigationZoneArray[0].type = ZONE_DEFAULT;
m_CurrLevel = LEVEL_GENERIC; 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 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 NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER #define CANCELLABLE_CAR_ENTER
//#define PEDS_REPORT_CRIMES_ON_PHONE
// Camera // Camera
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future #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 void
CEntity::UpdateRpHAnim(void) CEntity::UpdateRpHAnim(void)
{ {

View file

@ -168,6 +168,7 @@ public:
void RegisterReference(CEntity **pent); void RegisterReference(CEntity **pent);
void ResolveReferences(void); void ResolveReferences(void);
void PruneReferences(void); void PruneReferences(void);
void CleanUpOldReference(CEntity **pent);
#ifdef PED_SKIN #ifdef PED_SKIN
void UpdateRpHAnim(void); 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, float y) { return x/Sqrt(y); }
inline float RecipSqrt(float x) { return RecipSqrt(1.0f, x); } inline float RecipSqrt(float x) { return RecipSqrt(1.0f, x); }
inline float Pow(float x, float y) { return powf(x, y); } 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; int m_nMaxRandomDelayTime;
}; };
enum
{
ATTACK_IN_PROGRESS,
CANT_ATTACK,
WATCH_UNTIL_HE_DISAPPEARS,
};
enum eFormation enum eFormation
{ {
FORMATION_UNDEFINED, FORMATION_UNDEFINED,
@ -474,7 +481,7 @@ public:
uint32 bNeverEverTargetThisPed : 1; uint32 bNeverEverTargetThisPed : 1;
uint32 bCrouchWhenScared : 1; uint32 bCrouchWhenScared : 1;
uint32 bKnockedOffBike : 1; uint32 bKnockedOffBike : 1;
//uint32 b158_8 uint32 b158_8 : 1;
uint32 b158_10 : 1; uint32 b158_10 : 1;
uint32 bBoughtIceCream : 1; uint32 bBoughtIceCream : 1;
uint32 b158_40 : 1; uint32 b158_40 : 1;
@ -944,6 +951,8 @@ public:
void ClearWaitState(void); void ClearWaitState(void);
void Undress(const char*); void Undress(const char*);
void Dress(void); 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; } bool HasWeaponSlot(uint8 slot) { return m_weapons[slot].m_eWeaponType != WEAPONTYPE_UNARMED; }
CWeapon& GetWeapon(uint8 slot) { return m_weapons[slot]; } CWeapon& GetWeapon(uint8 slot) { return m_weapons[slot]; }

View file

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

View file

@ -35,7 +35,7 @@ CPlayerPed::~CPlayerPed()
delete m_pWanted; delete m_pWanted;
} }
// --MIAMI: Done except commented out things // --MIAMI: Done
CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1) CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
{ {
m_fMoveSpeed = 0.0f; m_fMoveSpeed = 0.0f;
@ -53,10 +53,8 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
m_nSpeedTimer = 0; m_nSpeedTimer = 0;
m_bSpeedTimerFlag = false; m_bSpeedTimerFlag = false;
// TODO(Miami) if (m_pPointGunAt)
// if (pPointGunAt) m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
// m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
m_pPointGunAt = nil; m_pPointGunAt = nil;
SetPedState(PED_IDLE); SetPedState(PED_IDLE);
#ifndef FIX_BUGS #ifndef FIX_BUGS
@ -69,13 +67,14 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
m_fAttackButtonCounter = 0.0f; m_fAttackButtonCounter = 0.0f;
m_bHaveTargetSelected = false; m_bHaveTargetSelected = false;
m_bHasLockOnTarget = false; m_bHasLockOnTarget = false;
m_bDrunkVisualsWearOff = true;
m_bCanBeDamaged = true; m_bCanBeDamaged = true;
m_bDrunkVisualsWearOff = false;
m_fWalkAngle = 0.0f; m_fWalkAngle = 0.0f;
m_fFPSMoveHeading = 0.0f; m_fFPSMoveHeading = 0.0f;
m_pMinigunTopAtomic = nil; m_pMinigunTopAtomic = nil;
m_fGunSpinSpeed = 0.0; m_fGunSpinSpeed = 0.0;
m_fGunSpinAngle = 0.0; m_fGunSpinAngle = 0.0;
m_nPadDownPressedInMilliseconds = 0;
m_nTargettableObjects[0] = m_nTargettableObjects[1] = m_nTargettableObjects[2] = m_nTargettableObjects[3] = -1; m_nTargettableObjects[0] = m_nTargettableObjects[1] = m_nTargettableObjects[2] = m_nTargettableObjects[3] = -1;
unused1 = false; unused1 = false;
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
@ -85,17 +84,16 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
} }
m_nCheckPlayersIndex = 0; m_nCheckPlayersIndex = 0;
m_nPadUpPressedInMilliseconds = 0; m_nPadUpPressedInMilliseconds = 0;
m_nPadDownPressedInMilliseconds = 0;
idleAnimBlockIndex = CAnimManager::GetAnimationBlockIndex("playidles"); idleAnimBlockIndex = CAnimManager::GetAnimationBlockIndex("playidles");
} }
void CPlayerPed::ClearWeaponTarget() // --MIAMI: Done
void
CPlayerPed::ClearWeaponTarget()
{ {
if (m_nPedType == PEDTYPE_PLAYER1) { if (m_nPedType == PEDTYPE_PLAYER1) {
if (m_pPointGunAt)
// TODO(Miami) m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
// if (m_pPointGunAt)
// m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
m_pPointGunAt = nil; m_pPointGunAt = nil;
TheCamera.ClearPlayerWeaponMode(); TheCamera.ClearPlayerWeaponMode();
@ -1816,6 +1814,7 @@ CPlayerPed::PlayIdleAnimations(CPad *padUsed)
} }
} }
// --MIAMI: Done
void void
CPlayerPed::RemovePedFromMeleeList(CPed *ped) CPlayerPed::RemovePedFromMeleeList(CPed *ped)
{ {
@ -1828,6 +1827,100 @@ CPlayerPed::RemovePedFromMeleeList(CPed *ped)
ped->m_attackTimer = 0; 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 #ifdef COMPATIBLE_SAVES
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data)); #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)); #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 bool m_bDrunkVisualsWearOff; // TODO(Miami): That may be something else
CVector m_vecSafePos[6]; // safe places from the player, for example behind a tree CVector m_vecSafePos[6]; // safe places from the player, for example behind a tree
CPed *m_pPedAtSafePos[6]; CPed *m_pPedAtSafePos[6];
CPlayerPed* m_pMeleeList[6]; CPed *m_pMeleeList[6]; // reachable peds at each direction(6)
char unused1; char unused1;
int16 m_nCheckPlayersIndex; int16 m_nCheckPlayersIndex;
float m_fWalkAngle; //angle between heading and walking direction float m_fWalkAngle; //angle between heading and walking direction
@ -85,6 +85,8 @@ public:
bool DoesPlayerWantNewWeapon(eWeaponType, bool); bool DoesPlayerWantNewWeapon(eWeaponType, bool);
void PlayIdleAnimations(CPad*); void PlayIdleAnimations(CPad*);
void RemovePedFromMeleeList(CPed*); void RemovePedFromMeleeList(CPed*);
void GetMeleeAttackCoords(CVector&, int8, float);
int32 FindMeleeAttackPoint(CPed*, CVector&, uint32&);
static void SetupPlayerPed(int32); static void SetupPlayerPed(int32);
static void DeactivatePlayerPed(int32); static void DeactivatePlayerPed(int32);

View file

@ -71,6 +71,7 @@ bool CHud::m_Wants_To_Draw_3dMarkers;
wchar CHud::m_BigMessage[6][128]; wchar CHud::m_BigMessage[6][128];
int16 CHud::m_ItemToFlash; int16 CHud::m_ItemToFlash;
bool CHud::m_HideRadar; bool CHud::m_HideRadar;
int32 CHud::m_DrawClock;
// These aren't really in CHud // These aren't really in CHud
float CHud::BigMessageInUse[6]; float CHud::BigMessageInUse[6];
@ -519,7 +520,6 @@ void CHud::Draw()
DrawZoneName DrawZoneName
*/ */
if (m_pZoneName) { if (m_pZoneName) {
float fZoneAlpha = 255.0f;
if (m_pZoneName != m_pLastZoneName) { if (m_pZoneName != m_pLastZoneName) {
switch (m_ZoneState) { switch (m_ZoneState) {
@ -528,6 +528,8 @@ void CHud::Draw()
m_ZoneToPrint = m_pZoneName; m_ZoneToPrint = m_pZoneName;
m_ZoneNameTimer = 0; m_ZoneNameTimer = 0;
m_ZoneFadeTimer = 0; m_ZoneFadeTimer = 0;
if (m_VehicleState == 1 || m_VehicleState == 2)
m_VehicleState = 3;
break; break;
case 1: case 1:
case 2: case 2:
@ -542,19 +544,20 @@ void CHud::Draw()
m_pLastZoneName = m_pZoneName; m_pLastZoneName = m_pZoneName;
} }
float fZoneAlpha = 255.0f;
if (m_ZoneState) { if (m_ZoneState) {
switch (m_ZoneState) { switch (m_ZoneState) {
case 1: case 1:
fZoneAlpha = 255.0f;
m_ZoneFadeTimer = 1000; m_ZoneFadeTimer = 1000;
if (m_ZoneNameTimer > 10000) { if (m_ZoneNameTimer > 10000.0f) {
m_ZoneFadeTimer = 1000; m_ZoneFadeTimer = 1000;
m_ZoneState = 3; m_ZoneState = 3;
} }
fZoneAlpha = 255.0f;
break; break;
case 2: case 2:
m_ZoneFadeTimer += CTimer::GetTimeStepInMilliseconds(); m_ZoneFadeTimer += CTimer::GetTimeStepInMilliseconds();
if (m_ZoneFadeTimer > 1000) { if (m_ZoneFadeTimer > 1000.0f) {
m_ZoneState = 1; m_ZoneState = 1;
m_ZoneFadeTimer = 1000; m_ZoneFadeTimer = 1000;
} }
@ -562,7 +565,7 @@ void CHud::Draw()
break; break;
case 3: case 3:
m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds(); m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds();
if (m_ZoneFadeTimer < 0) { if (m_ZoneFadeTimer < 0.0f) {
m_ZoneState = 0; m_ZoneState = 0;
m_ZoneFadeTimer = 0; m_ZoneFadeTimer = 0;
} }
@ -570,7 +573,7 @@ void CHud::Draw()
break; break;
case 4: case 4:
m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds(); m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds();
if (m_ZoneFadeTimer < 0) { if (m_ZoneFadeTimer < 0.0f) {
m_ZoneFadeTimer = 0; m_ZoneFadeTimer = 0;
m_ZoneToPrint = m_pLastZoneName; m_ZoneToPrint = m_pLastZoneName;
m_ZoneState = 2; m_ZoneState = 2;
@ -582,11 +585,8 @@ void CHud::Draw()
} }
#ifndef HUD_ENHANCEMENTS if (!m_Message[0] && BigMessageInUse[1] == 0.0f && BigMessageInUse[2] == 0.0f) {
if (!m_Message[0]) {
#else
if (!m_Message[0] && !m_BigMessage[2][0]) { // Hide zone name if wasted/busted text is displaying
#endif
m_ZoneNameTimer += CTimer::GetTimeStepInMilliseconds(); m_ZoneNameTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetPropOn(); CFont::SetPropOn();
@ -606,11 +606,14 @@ void CHud::Draw()
CFont::SetDropShadowPosition(2); CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, fZoneAlpha)); CFont::SetDropColor(CRGBA(0, 0, 0, fZoneAlpha));
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha)); CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha));
if (!CTheScripts::bPlayerIsInTheStatium)
CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f), m_ZoneToPrint); CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f), m_ZoneToPrint);
CFont::SetSlant(0.f); CFont::SetSlant(0.f);
} else {
m_ZoneState = 3;
} }
} }
} }
@ -628,6 +631,8 @@ void CHud::Draw()
m_pVehicleNameToPrint = m_VehicleName; m_pVehicleNameToPrint = m_VehicleName;
m_VehicleNameTimer = 0; m_VehicleNameTimer = 0;
m_VehicleFadeTimer = 0; m_VehicleFadeTimer = 0;
if (m_ZoneState == 1 || m_ZoneState == 2)
m_ZoneState = 3;
break; break;
case 1: case 1:
case 2: case 2:
@ -723,6 +728,7 @@ void CHud::Draw()
/* /*
DrawClock DrawClock
*/ */
if (m_DrawClock) {
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetCentreOff(); CFont::SetCentreOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
@ -739,7 +745,9 @@ void CHud::Draw()
AsciiToUnicode(sTemp, sPrint); AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(CLOCK_COLOR); CFont::SetColor(CLOCK_COLOR);
if (FrontEndMenuManager.m_PrefsShowHud)
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint);
}
/* /*
DrawOnScreenTimer DrawOnScreenTimer
@ -1011,6 +1019,11 @@ void CHud::Draw()
DrawSubtitles DrawSubtitles
*/ */
if (m_Message[0] && !m_BigMessage[2][0]) { 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::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128)); CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128));
@ -1050,101 +1063,8 @@ void CHud::Draw()
} }
/* /*
DrawBigMessage HelpMessage
*/ */
// MissionCompleteFailedText
if (m_BigMessage[0][0]) {
if (BigMessageInUse[0] != 0.0f) {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackGroundOnlyTextOff();
CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f));
CFont::SetPropOn();
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_X(615.0f));
CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[0] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
BigMessageInUse[0] += CTimer::GetTimeStep();
if (BigMessageInUse[0] >= 120.0f) {
BigMessageInUse[0] = 120.0f;
BigMessageAlpha[0] -= (CTimer::GetTimeStepInMilliseconds() * 0.3f);
}
if (BigMessageAlpha[0] <= 0.0f) {
m_BigMessage[0][0] = 0;
BigMessageAlpha[0] = 0.0f;
}
}
else {
BigMessageX[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
BigMessageAlpha[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
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::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]);
}
else {
BigMessageAlpha[0] = 0.0f;
BigMessageX[0] = -60.0f;
BigMessageInUse[0] = 1.0f;
}
}
else {
BigMessageInUse[0] = 0.0f;
}
// WastedBustedText
if (m_BigMessage[2][0]) {
if (BigMessageInUse[2] != 0.0f) {
BigMessageAlpha[2] += (CTimer::GetTimeStepInSeconds() * 255.0f);
if (BigMessageAlpha[2] > 255.0f)
BigMessageAlpha[2] = 255.0f;
CFont::SetBackgroundOff();
if (CGame::frenchGame || CGame::germanGame)
CFont::SetScale(SCREEN_SCALE_X(1.4f), SCREEN_SCALE_Y(1.4f));
else
CFont::SetScale(SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(2.0f));
CFont::SetPropOn();
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f - 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]);
CFont::SetColor(CRGBA(WASTEDBUSTED_COLOR.r, WASTEDBUSTED_COLOR.g, WASTEDBUSTED_COLOR.b, BigMessageAlpha[2]));
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;
}
}
else {
BigMessageInUse[2] = 0.0f;
}
}
}
void CHud::DrawAfterFade()
{
if (CTimer::GetIsUserPaused() || CReplay::IsPlayingBack())
return;
if (m_HelpMessage[0]) { if (m_HelpMessage[0]) {
if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, 256)) { if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, 256)) {
@ -1185,6 +1105,9 @@ void CHud::DrawAfterFade()
} }
break; break;
case 2: case 2:
if (TheCamera.m_WideScreenOn)
break;
m_HelpMessageFadeTimer += 2 * CTimer::GetTimeStepInMilliseconds(); m_HelpMessageFadeTimer += 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer > 0) { if (m_HelpMessageFadeTimer > 0) {
m_HelpMessageState = 1; m_HelpMessageState = 1;
@ -1194,7 +1117,7 @@ void CHud::DrawAfterFade()
break; break;
case 3: case 3:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds(); m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer < 0) { if (m_HelpMessageFadeTimer < 0 || TheCamera.m_WideScreenOn) {
m_HelpMessageState = 0; m_HelpMessageState = 0;
m_HelpMessageFadeTimer = 0; m_HelpMessageFadeTimer = 0;
} }
@ -1213,6 +1136,7 @@ void CHud::DrawAfterFade()
break; break;
} }
if (!TheCamera.m_WideScreenOn) {
m_HelpMessageTimer += CTimer::GetTimeStepInMilliseconds(); m_HelpMessageTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetAlphaFade(fAlpha); CFont::SetAlphaFade(fAlpha);
@ -1228,22 +1152,133 @@ void CHud::DrawAfterFade()
else else
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f)); CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
CFont::SetColor(CRGBA(175, 175, 175, 255)); CFont::DrawFonts();
// CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetJustifyOff(); CFont::SetJustifyOff();
#ifdef MORE_LANGUAGES #ifdef MORE_LANGUAGES
if (CFont::IsJapanese()) if (CFont::IsJapanese())
CFont::SetWrapx(SCREEN_SCALE_X(229.0f + 26.0f - 4.0f)); CFont::SetWrapx(SCREEN_SCALE_X(229.0f + 34.0f - 4.0f));
else else
#endif #endif
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f)); CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 34.0f - 4.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetBackgroundOn(); CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
CFont::SetDropShadowPosition(0);
CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f)); 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::PrintString(SCREEN_SCALE_X(34.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
CFont::SetAlphaFade(255.0f); CFont::SetAlphaFade(255.0f);
CFont::SetWrapx(SCREEN_WIDTH);
} }
} }
} else
m_HelpMessageState = 0;
/*
DrawBigMessage
*/
// MissionCompleteFailedText
if (m_BigMessage[0][0]) {
if (BigMessageInUse[0] != 0.0f) {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackGroundOnlyTextOff();
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(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)) {
BigMessageInUse[0] += CTimer::GetTimeStep();
if (BigMessageInUse[0] >= 120.0f) {
BigMessageInUse[0] = 120.0f;
BigMessageAlpha[0] -= (CTimer::GetTimeStepInMilliseconds() * 0.3f);
}
if (BigMessageAlpha[0] <= 0.0f) {
m_BigMessage[0][0] = 0;
BigMessageAlpha[0] = 0.0f;
}
}
else {
BigMessageX[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
BigMessageAlpha[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
if (BigMessageAlpha[0] > 255.0f)
BigMessageAlpha[0] = 255.0f;
}
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]);
}
else {
BigMessageAlpha[0] = 0.0f;
BigMessageX[0] = -60.0f;
BigMessageInUse[0] = 1.0f;
}
}
else {
BigMessageInUse[0] = 0.0f;
}
// WastedBustedText
if (m_BigMessage[2][0]) {
if (BigMessageInUse[2] != 0.0f) {
BigMessageAlpha[2] += (CTimer::GetTimeStepInSeconds() * 255.0f);
if (BigMessageAlpha[2] > 255.0f)
BigMessageAlpha[2] = 255.0f;
CFont::SetBackgroundOff();
if (CGame::frenchGame || CGame::germanGame)
CFont::SetScale(SCREEN_SCALE_X(1.4f), SCREEN_SCALE_Y(1.4f));
else
CFont::SetScale(SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(2.0f));
CFont::SetPropOn();
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f - 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]);
CFont::SetColor(CRGBA(WASTEDBUSTED_COLOR.r, WASTEDBUSTED_COLOR.g, WASTEDBUSTED_COLOR.b, BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]);
}
else {
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 {
BigMessageInUse[2] = 0.0f;
}
}
}
void CHud::DrawAfterFade()
{
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
if (CTimer::GetIsUserPaused() || CReplay::IsPlayingBack())
return;
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) { for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) {
intro_text_line &line = CTheScripts::IntroTextLines[i]; intro_text_line &line = CTheScripts::IntroTextLines[i];
@ -1315,12 +1350,10 @@ void CHud::DrawAfterFade()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_X(600.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(600.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetDropShadowPosition(2);
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetDropColor(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::SetColor(ODDJOB_COLOR); 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]) { if (!m_BigMessage[1][0] && m_BigMessage[4][0]) {
@ -1330,13 +1363,11 @@ void CHud::DrawAfterFade()
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_X(620.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetDropShadowPosition(2);
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::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetColor(ODDJOB_COLOR); 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 // Oddjob result
@ -1418,7 +1449,7 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f)); CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(-500.0f)); CFont::SetRightJustifyWrap(0.0f);
CFont::SetRightJustifyOn(); CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
if (BigMessageX[1] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) { if (BigMessageX[1] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
@ -1452,6 +1483,7 @@ void CHud::DrawAfterFade()
BigMessageAlpha[1] = 0.0f; BigMessageAlpha[1] = 0.0f;
BigMessageX[1] = -60.0f; BigMessageX[1] = -60.0f;
BigMessageInUse[1] = 1.0f; BigMessageInUse[1] = 1.0f;
m_ZoneState = 0;
} }
} }
else { else {
@ -1541,6 +1573,7 @@ void CHud::Initialise()
if (gpRocketSightTex == nil) if (gpRocketSightTex == nil)
gpRocketSightTex = RwTextureRead("siterocket", nil); gpRocketSightTex = RwTextureRead("siterocket", nil);
m_DrawClock = 1;
CounterOnLastFrame = false; CounterOnLastFrame = false;
m_ItemToFlash = ITEM_NONE; m_ItemToFlash = ITEM_NONE;
OddJob2Timer = 0; OddJob2Timer = 0;
@ -1591,6 +1624,7 @@ void CHud::ReInitialise() {
CounterOnLastFrame = false; CounterOnLastFrame = false;
m_ItemToFlash = ITEM_NONE; m_ItemToFlash = ITEM_NONE;
m_DrawClock = 1;
OddJob2Timer = 0; OddJob2Timer = 0;
OddJob2OffTimer = 0.0f; OddJob2OffTimer = 0.0f;
OddJob2On = 0; OddJob2On = 0;

View file

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

View file

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

View file

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

View file

@ -64,10 +64,6 @@ static psGlobalType PsGlobal;
#undef MAKEPOINTS #undef MAKEPOINTS
#define MAKEPOINTS(l) (*((POINTS /*FAR*/ *)&(l))) #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; unsigned long _dwMemAvailPhys;
RwUInt32 gGameState; RwUInt32 gGameState;
@ -830,9 +826,10 @@ void _InputInitialiseJoys()
} }
} }
void _InputInitialiseMouse() long _InputInitialiseMouse(bool exclusive)
{ {
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN); glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
return 0;
} }
void psPostRWinit(void) void psPostRWinit(void)
@ -847,7 +844,7 @@ void psPostRWinit(void)
glfwSetJoystickCallback(joysChangeCB); glfwSetJoystickCallback(joysChangeCB);
_InputInitialiseJoys(); _InputInitialiseJoys();
_InputInitialiseMouse(); _InputInitialiseMouse(false);
if(!(vm.flags & rwVIDEOMODEEXCLUSIVE)) if(!(vm.flags & rwVIDEOMODEEXCLUSIVE))
glfwSetWindowSize(PSGLOBAL(window), RsGlobal.maximumWidth, RsGlobal.maximumHeight); glfwSetWindowSize(PSGLOBAL(window), RsGlobal.maximumWidth, RsGlobal.maximumHeight);

View file

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

View file

@ -1602,7 +1602,6 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode)
return TRUE; return TRUE;
} }
/* /*
***************************************************************************** *****************************************************************************
*/ */
@ -2003,7 +2002,7 @@ WinMain(HINSTANCE instance,
if ( _InputInitialise() == S_OK ) if ( _InputInitialise() == S_OK )
{ {
_InputInitialiseMouse(); _InputInitialiseMouse(false);
_InputInitialiseJoys(); _InputInitialiseJoys();
} }
@ -2542,7 +2541,7 @@ HRESULT _InputInitialise()
return S_OK; return S_OK;
} }
HRESULT _InputInitialiseMouse() HRESULT _InputInitialiseMouse(bool exclusive)
{ {
HRESULT hr; HRESULT hr;
@ -2560,7 +2559,7 @@ HRESULT _InputInitialiseMouse()
if( FAILED( hr = PSGLOBAL(mouse)->SetDataFormat( &c_dfDIMouse2 ) ) ) if( FAILED( hr = PSGLOBAL(mouse)->SetDataFormat( &c_dfDIMouse2 ) ) )
return hr; 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; return hr;
// Acquire the newly created device // Acquire the newly created device
@ -2848,6 +2847,23 @@ void _InputShutdown()
SAFE_RELEASE(PSGLOBAL(dinterface)); 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 ) BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext )
{ {
HRESULT hr; HRESULT hr;

View file

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

View file

@ -2523,7 +2523,7 @@ CAutomobile::PreRender(void)
if(GetModelIndex() == MI_RCGOBLIN || GetModelIndex() == MI_RCRAIDER) if(GetModelIndex() == MI_RCGOBLIN || GetModelIndex() == MI_RCRAIDER)
radius = 3.0f; radius = 3.0f;
if(GetPosition().z - groundZ < radius) 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; CMatrix mat;