Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Nikolay Korolev 2020-04-18 23:50:58 +03:00
commit 4c133a95bd
7 changed files with 46 additions and 19 deletions

2
librw

@ -1 +1 @@
Subproject commit bc9cb506ecd5abb869292860ed287c1b029b30cc Subproject commit e6c7d910ffc32bc059c4e750a797fde51ee29fd9

View File

@ -118,7 +118,6 @@ const CRGBA TEXT_COLOR = CRGBA(150, 110, 30, 255);
const CRGBA TEXT_COLOR = CRGBA(235, 170, 50, 255); // PC briefs text color const CRGBA TEXT_COLOR = CRGBA(235, 170, 50, 255); // PC briefs text color
#endif #endif
const float menuXYpadding = MENUACTION_POS_Y; // TODO this is non-existant, remove it
float MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE; float MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE;
float MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE; float MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE;
@ -231,8 +230,7 @@ ScaleAndCenterX(float x)
else { else {
if (x > DEFAULT_SCREEN_WIDTH / 2) { if (x > DEFAULT_SCREEN_WIDTH / 2) {
return SCREEN_WIDTH / 2 + SCREEN_SCALE_X(x - DEFAULT_SCREEN_WIDTH / 2); return SCREEN_WIDTH / 2 + SCREEN_SCALE_X(x - DEFAULT_SCREEN_WIDTH / 2);
} } else {
else {
return SCREEN_WIDTH / 2 - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH / 2 - x); return SCREEN_WIDTH / 2 - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH / 2 - x);
} }
} }
@ -289,7 +287,7 @@ ScaleAndCenterX(float x)
#define ProcessSlider(value, increaseAction, decreaseAction, hoverStartX, hoverEndX) \ #define ProcessSlider(value, increaseAction, decreaseAction, hoverStartX, hoverEndX) \
do { \ do { \
lastActiveBarX = DisplaySlider(SCREEN_STRETCH_FROM_RIGHT(MENUSLIDER_X + columnWidth), MENU_Y(bitAboveNextItemY), MENU_Y(smallestSliderBar), MENU_Y(usableLineHeight), MENU_X(MENUSLIDER_UNK), value); \ lastActiveBarX = DisplaySlider(MENU_X_RIGHT_ALIGNED(MENUSLIDER_X + columnWidth), MENU_Y(bitAboveNextItemY), MENU_Y(smallestSliderBar), MENU_Y(usableLineHeight), MENU_X(MENUSLIDER_UNK), value); \
if (i != m_nCurrOption || !itemsAreSelectable) \ if (i != m_nCurrOption || !itemsAreSelectable) \
break; \ break; \
\ \
@ -300,14 +298,16 @@ ScaleAndCenterX(float x)
break; \ break; \
\ \
m_nHoverOption = increaseAction; \ m_nHoverOption = increaseAction; \
if (m_nMousePosX < SCREEN_STRETCH_FROM_RIGHT(MENUSLIDER_X + columnWidth)) \ if (m_nMousePosX < MENU_X_RIGHT_ALIGNED(MENUSLIDER_X + columnWidth)) \
m_nHoverOption = HOVEROPTION_NOT_HOVERING; \ m_nHoverOption = HOVEROPTION_NOT_HOVERING; \
} while(0) } while(0)
#define ProcessRadioIcon(sprite, x, y, radioId, hoverOpt) \ #define ProcessRadioIcon(sprite, x, y, radioId, hoverOpt) \
do { \
sprite.Draw(x, y, MENU_X(MENURADIO_ICON_SCALE), MENU_Y(MENURADIO_ICON_SCALE), radioId == m_PrefsRadioStation ? CRGBA(255, 255, 255, 255) : CRGBA(225, 0, 0, 170)); \ sprite.Draw(x, y, MENU_X(MENURADIO_ICON_SCALE), MENU_Y(MENURADIO_ICON_SCALE), radioId == m_PrefsRadioStation ? CRGBA(255, 255, 255, 255) : CRGBA(225, 0, 0, 170)); \
if (CheckHover(x, x + MENU_X(MENURADIO_ICON_SCALE), y, y + MENU_Y(MENURADIO_ICON_SCALE))) \ if (CheckHover(x, x + MENU_X(MENURADIO_ICON_SCALE), y, y + MENU_Y(MENURADIO_ICON_SCALE))) \
m_nHoverOption = hoverOpt; m_nHoverOption = hoverOpt; \
} while (0)
// --- Functions not in the game/inlined starts // --- Functions not in the game/inlined starts
@ -1237,7 +1237,6 @@ CMenuManager::Draw()
} }
// Sliders // Sliders
// We stretch slider start X here(like original code), because it will always be center of screen
int lastActiveBarX; int lastActiveBarX;
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) { switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
case MENUACTION_BRIGHTNESS: case MENUACTION_BRIGHTNESS:
@ -1257,7 +1256,8 @@ CMenuManager::Draw()
break; break;
} }
nextYToUse += lineHeight * CFont::GetNumberLines(menuXYpadding, nextYToUse, leftText); // 60.0 is silly
nextYToUse += lineHeight * CFont::GetNumberLines(MENU_X_LEFT_ALIGNED(60.0f), MENU_Y(nextYToUse), leftText);
// Radio icons // Radio icons
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_RADIO) { if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_RADIO) {
@ -3385,8 +3385,7 @@ CMenuManager::Process(void)
DMAudio.SetEffectsFadeVol(0); DMAudio.SetEffectsFadeVol(0);
DMAudio.SetMusicFadeVol(0); DMAudio.SetMusicFadeVol(0);
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds()); DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
} } else
else
SaveLoadFileError_SetUpErrorScreen(); SaveLoadFileError_SetUpErrorScreen();
} }

View File

@ -208,6 +208,7 @@ enum Config {
#define SCROLLABLE_STATS_PAGE // only draggable by mouse atm #define SCROLLABLE_STATS_PAGE // only draggable by mouse atm
#define TRIANGLE_BACK_BUTTON #define TRIANGLE_BACK_BUTTON
// #define CIRCLE_BACK_BUTTON // #define CIRCLE_BACK_BUTTON
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
// Script // Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default #define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default

View File

@ -634,7 +634,7 @@ RpClump *RpClumpForAllLights(RpClump * clump, RpLightCallBack callback, void *pD
RpClump *RpClumpForAllCameras(RpClump * clump, RwCameraCallBack callback, void *pData); RpClump *RpClumpForAllCameras(RpClump * clump, RwCameraCallBack callback, void *pData);
//RpClump *RpClumpCreateSpace(const RwV3d * position, RwReal radius); //RpClump *RpClumpCreateSpace(const RwV3d * position, RwReal radius);
RpClump *RpClumpRender(RpClump * clump) { clump->render(); return clump; } RpClump *RpClumpRender(RpClump * clump) { clump->render(); return clump; }
RpClump *RpClumpRemoveAtomic(RpClump * clump, RpAtomic * atomic) { atomic->removeFromClump(); return clump; } RpClump *RpClumpRemoveAtomic(RpClump * clump, RpAtomic * atomic) { clump->removeAtomic(atomic); return clump; }
RpClump *RpClumpAddAtomic(RpClump * clump, RpAtomic * atomic) { clump->addAtomic(atomic); return clump; } RpClump *RpClumpAddAtomic(RpClump * clump, RpAtomic * atomic) { clump->addAtomic(atomic); return clump; }
//RpClump *RpClumpRemoveLight(RpClump * clump, RpLight * light); //RpClump *RpClumpRemoveLight(RpClump * clump, RpLight * light);
//RpClump *RpClumpAddLight(RpClump * clump, RpLight * light); //RpClump *RpClumpAddLight(RpClump * clump, RpLight * light);

View File

@ -3038,7 +3038,6 @@ CPed::QuitEnteringCar(void)
if (animAssoc) { if (animAssoc) {
animAssoc->blendDelta = -4.0f; animAssoc->blendDelta = -4.0f;
animAssoc->flags |= ASSOC_DELETEFADEDOUT; animAssoc->flags |= ASSOC_DELETEFADEDOUT;
animAssoc = m_pVehicleAnim;
animAssoc->flags &= ~ASSOC_RUNNING; animAssoc->flags &= ~ASSOC_RUNNING;
} }
} else } else
@ -3047,7 +3046,11 @@ CPed::QuitEnteringCar(void)
m_pVehicleAnim = nil; m_pVehicleAnim = nil;
if (veh) { if (veh) {
#ifdef VC_PED_PORTS
if (veh->AutoPilot.m_nCruiseSpeed == 0 && veh->VehicleCreatedBy == RANDOM_VEHICLE)
#else
if (veh->AutoPilot.m_nCruiseSpeed == 0) if (veh->AutoPilot.m_nCruiseSpeed == 0)
#endif
veh->AutoPilot.m_nCruiseSpeed = 17; veh->AutoPilot.m_nCruiseSpeed = 17;
} }
} }
@ -4146,7 +4149,7 @@ CPed::SetGetUp(void)
CVehicle *veh = (CVehicle*)CPedPlacement::IsPositionClearOfCars(&GetPosition()); CVehicle *veh = (CVehicle*)CPedPlacement::IsPositionClearOfCars(&GetPosition());
if (veh && veh->m_vehType != VEHICLE_TYPE_BIKE || if (veh && veh->m_vehType != VEHICLE_TYPE_BIKE ||
collidingVeh && collidingVeh->IsVehicle() && collidingVeh->m_vehType != VEHICLE_TYPE_BIKE collidingVeh && collidingVeh->IsVehicle() && collidingVeh->m_vehType != VEHICLE_TYPE_BIKE
&& ((CTimer::GetFrameCounter() + m_randomSeed % 256 + 5) % 8 && ((uint8)(CTimer::GetFrameCounter() + m_randomSeed + 5) % 8
|| CCollision::ProcessColModels(GetMatrix(), *CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(), || CCollision::ProcessColModels(GetMatrix(), *CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(),
collidingVeh->GetMatrix(), *CModelInfo::GetModelInfo(collidingVeh->m_modelIndex)->GetColModel(), collidingVeh->GetMatrix(), *CModelInfo::GetModelInfo(collidingVeh->m_modelIndex)->GetColModel(),
aTempPedColPts, nil, nil) > 0)) { aTempPedColPts, nil, nil) > 0)) {
@ -10729,6 +10732,9 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->m_pVehicleAnim->SetFinishCallback(PedSetInCarCB, ped); ped->m_pVehicleAnim->SetFinishCallback(PedSetInCarCB, ped);
} }
} else { } else {
#ifdef VC_PED_PORTS
if (ped->m_nPedState != PED_DRIVING)
#endif
ped->QuitEnteringCar(); ped->QuitEnteringCar();
} }
} }
@ -11014,6 +11020,9 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
return; return;
if (!ped->EnteringCar()) { if (!ped->EnteringCar()) {
#ifdef VC_PED_PORTS
if(ped->m_nPedState != PED_DRIVING)
#endif
ped->QuitEnteringCar(); ped->QuitEnteringCar();
return; return;
} }
@ -13733,7 +13742,12 @@ CPed::ProcessObjective(void)
// fall through // fall through
case OBJECTIVE_LEAVE_VEHICLE: case OBJECTIVE_LEAVE_VEHICLE:
if (CTimer::GetTimeInMilliseconds() > m_leaveCarTimer) { if (CTimer::GetTimeInMilliseconds() > m_leaveCarTimer) {
if (InVehicle()) { if (InVehicle()
#ifdef VC_PED_PORTS
&& (FindPlayerPed() != this || !CPad::GetPad(0)->GetAccelerate()
|| bBusJacked)
#endif
) {
if (m_nPedState != PED_EXIT_CAR && m_nPedState != PED_DRAG_FROM_CAR && m_nPedState != PED_EXIT_TRAIN if (m_nPedState != PED_EXIT_CAR && m_nPedState != PED_DRAG_FROM_CAR && m_nPedState != PED_EXIT_TRAIN
&& (m_nPedType != PEDTYPE_COP && (m_nPedType != PEDTYPE_COP
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS

View File

@ -473,7 +473,12 @@ void CHud::Draw()
break; break;
} }
#ifndef HUD_ENHANCEMENTS
if (!m_Message[0]) { 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();
@ -563,7 +568,11 @@ void CHud::Draw()
break; break;
} }
#ifndef HUD_ENHANCEMENTS
if (!m_Message[0]) { if (!m_Message[0]) {
#else
if (!m_Message[0] && !m_BigMessage[2][0]) { // Hide vehicle name if wasted/busted text is displaying
#endif
m_VehicleNameTimer += CTimer::GetTimeStepInMilliseconds(); m_VehicleNameTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetPropOn(); CFont::SetPropOn();

View File

@ -787,6 +787,10 @@ CVehicle::CanPedExitCar(void)
{ {
CVector up = GetUp(); CVector up = GetUp();
if(up.z > 0.1f || up.z < -0.1f){ if(up.z > 0.1f || up.z < -0.1f){
#ifdef VC_PED_PORTS
if (IsBoat())
return true;
#endif
// can't exit when car is moving too fast // can't exit when car is moving too fast
if(m_vecMoveSpeed.MagnitudeSqr() > 0.005f) if(m_vecMoveSpeed.MagnitudeSqr() > 0.005f)
return false; return false;