Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
CMenuManager done and CHud fixes
  • Loading branch information
erorcun committed Apr 10, 2020
1 parent 3a4442e commit 70cdf53aa9ad4c0cccebdb64a92167cd5780b6e3
BIN +0 Bytes (100%) gamefiles/menu.txd
Binary file not shown.

Large diffs are not rendered by default.

@@ -9,7 +9,7 @@


#define MENUACTION_X_MARGIN 40.0f #define MENUACTION_X_MARGIN 40.0f
#define MENUACTION_POS_Y 60.0f #define MENUACTION_POS_Y 60.0f
#define MENUACTION_WIDTH 0.38f #define MENUACTION_WIDTH 38.0f
#define MENUACTION_SCALE_MULT 0.9f #define MENUACTION_SCALE_MULT 0.9f


#define MENUCOLUMN_POS_X MENUHEADER_POS_X + 16.0f #define MENUCOLUMN_POS_X MENUHEADER_POS_X + 16.0f
@@ -67,6 +67,33 @@
#define PLAYERSETUP_LIST_BODY_TOP 47 #define PLAYERSETUP_LIST_BODY_TOP 47
#define PLAYERSETUP_ROW_HEIGHT 9 #define PLAYERSETUP_ROW_HEIGHT 9


#define STATS_SLIDE_Y_PER_SECOND 30.0f
#define STATS_ROW_HEIGHT 20.0f
#define STATS_ROW_X_MARGIN 50.0f
#define STATS_BOTTOM_MARGIN 135.0f
#define STATS_TOP_MARGIN 40.0f
#define STATS_TOP_DIMMING_AREA_LENGTH (93.0f - STATS_TOP_MARGIN)
#define STATS_BOTTOM_DIMMING_AREA_LENGTH 55.0f
#define STATS_PUT_BACK_TO_BOTTOM_Y 50.0f
#define STATS_RATING_X 24.0f
#define STATS_RATING_Y 20.0f

#define CONTSETUP_STANDARD_ROW_HEIGHT 10.7f
#define CONTSETUP_CLASSIC_ROW_HEIGHT 9.0f
#define CONTSETUP_BOUND_HIGHLIGHT_HEIGHT 10
#define CONTSETUP_BOUND_COLUMN_WIDTH 190.0f
#define CONTSETUP_LIST_HEADER_HEIGHT 20.0f
#define CONTSETUP_LIST_TOP 28.0f
#define CONTSETUP_LIST_RIGHT 18.0f
#define CONTSETUP_LIST_BOTTOM 120.0f
#define CONTSETUP_LIST_LEFT 18.0f
#define CONTSETUP_COLUMN_1_X 40.0f
#define CONTSETUP_COLUMN_2_X 210.0f
#define CONTSETUP_COLUMN_3_X (CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH + 10.0f)
#define CONTSETUP_BACK_RIGHT 35.0f
#define CONTSETUP_BACK_BOTTOM 122.0f
#define CONTSETUP_BACK_HEIGHT 25.0f

enum eLanguages enum eLanguages
{ {
LANGUAGE_AMERICAN, LANGUAGE_AMERICAN,
@@ -557,6 +584,7 @@ class CMenuManager


#ifdef MENU_MAP #ifdef MENU_MAP
static bool bMenuMapActive; static bool bMenuMapActive;
static bool bMapMouseShownOnce;
static float fMapSize; static float fMapSize;
static float fMapCenterY; static float fMapCenterY;
static float fMapCenterX; static float fMapCenterX;
@@ -565,9 +593,9 @@ class CMenuManager
#endif #endif


public: public:
static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2); static void BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2);
static void CentreMousePointer(); static void CentreMousePointer();
int CheckCodesForControls(int32); void CheckCodesForControls(int);
bool CheckHover(int x1, int x2, int y1, int y2); bool CheckHover(int x1, int x2, int y1, int y2);
void CheckSliderMovement(int); void CheckSliderMovement(int);
int CostructStatLine(int); int CostructStatLine(int);
@@ -585,13 +613,13 @@ class CMenuManager
#endif #endif
void DrawPlayerSetupScreen(); void DrawPlayerSetupScreen();
int FadeIn(int alpha); int FadeIn(int alpha);
void FilterOutColorMarkersFromString(uint16, CRGBA &); void FilterOutColorMarkersFromString(wchar*, CRGBA &);
int GetStartOptionsCntrlConfigScreens(); int GetStartOptionsCntrlConfigScreens();
static void InitialiseChangedLanguageSettings(); static void InitialiseChangedLanguageSettings();
void LoadAllTextures(); void LoadAllTextures();
void LoadSettings(); void LoadSettings();
static void MessageScreen(char *); void MessageScreen(const char *);
static void PickNewPlayerColour(); void PickNewPlayerColour();
void PrintBriefs(); void PrintBriefs();
static void PrintErrorMessage(); static void PrintErrorMessage();
void PrintStats(); void PrintStats();
@@ -612,6 +640,7 @@ class CMenuManager
void WaitForUserCD(); void WaitForUserCD();
void PrintController(); void PrintController();
int GetNumOptionsCntrlConfigScreens(); int GetNumOptionsCntrlConfigScreens();
int ConstructStatLine(int);


// New (not in function or inlined in the game) // New (not in function or inlined in the game)
void ThingsToDoBeforeLeavingPage(); void ThingsToDoBeforeLeavingPage();
@@ -6,11 +6,11 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_NONE = 0 // MENUPAGE_NONE = 0
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },


// MENUPAGE_STATS = 1 - Both PrintStats and Draw were printing the page name, so deleted the string Draw looked for. // MENUPAGE_STATS = 1
#ifdef MENU_MAP #ifdef MENU_MAP
{ ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3, { "FET_STA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3,
#else #else
{ ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2, { "FET_STA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
#endif #endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
@@ -1412,8 +1412,8 @@ CRadar::DrawYouAreHereSprite(float x, float y)
} }
} else { } else {
if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 200) { if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 200) {
lastChange = CTimer::GetTimeInMillisecondsPauseMode(); lastChange = CTimer::GetTimeInMillisecondsPauseMode();
show = !show; show = !show;
} }
} }


@@ -1422,7 +1422,7 @@ CRadar::DrawYouAreHereSprite(float x, float y)
float top = y - SCREEN_SCALE_Y(2.0f); float top = y - SCREEN_SCALE_Y(2.0f);
float right = SCREEN_SCALE_X(12.0) + x; float right = SCREEN_SCALE_X(12.0) + x;
float bottom = y - SCREEN_SCALE_Y(26.0f); float bottom = y - SCREEN_SCALE_Y(26.0f);
CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 217, 106, 255)); CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255));
} }
MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE; MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE;
} }
@@ -1503,4 +1503,4 @@ STARTPATCHES
InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP); InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP);
//InjectHook(0x4A7000, `global constructor keyed to'Radar.cpp, PATCH_JUMP); //InjectHook(0x4A7000, `global constructor keyed to'Radar.cpp, PATCH_JUMP);
//InjectHook(0x4A7260, sRadarTrace::sRadarTrace, PATCH_JUMP); //InjectHook(0x4A7260, sRadarTrace::sRadarTrace, PATCH_JUMP);
ENDPATCHES ENDPATCHES
@@ -34,6 +34,10 @@ LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318;
//UInt32 suspendDepth; //UInt32 suspendDepth;
uint32 &suspendDepth = *(uint32*)0x62A320; uint32 &suspendDepth = *(uint32*)0x62A320;


#ifdef FIX_BUGS
double frameTime;
#endif

void CTimer::Initialise(void) void CTimer::Initialise(void)
{ {
debug("Initialising CTimer...\n"); debug("Initialising CTimer...\n");
@@ -90,17 +94,21 @@ void CTimer::Update(void)


float updInCyclesScaled = updInCycles * ms_fTimeScale; float updInCyclesScaled = updInCycles * ms_fTimeScale;


double upd = updInCyclesScaled / (double)_nCyclesPerMS; // We need that real frame time to fix transparent menu bug.
#ifndef FIX_BUGS
double
#endif
frameTime = updInCyclesScaled / (double)_nCyclesPerMS;


m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd; m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;


if ( GetIsPaused() ) if ( GetIsPaused() )
ms_fTimeStep = 0.0f; ms_fTimeStep = 0.0f;
else else
{ {
m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd; m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd; m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
ms_fTimeStep = updInCyclesScaled / (double)_nCyclesPerMS / 20.0f; ms_fTimeStep = frameTime / 1000.0f * 50.0f;
} }
} }
else else
@@ -109,19 +117,23 @@ void CTimer::Update(void)


uint32 updInMs = timer - oldPcTimer; uint32 updInMs = timer - oldPcTimer;


double upd = (double)updInMs * ms_fTimeScale; // We need that real frame time to fix transparent menu bug.
#ifndef FIX_BUGS
double
#endif
frameTime = (double)updInMs * ms_fTimeScale;


oldPcTimer = timer; oldPcTimer = timer;


m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd; m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;


if ( GetIsPaused() ) if ( GetIsPaused() )
ms_fTimeStep = 0.0f; ms_fTimeStep = 0.0f;
else else
{ {
m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd; m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd; m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
ms_fTimeStep = upd / 1000.0f * 50.0f; ms_fTimeStep = frameTime / 1000.0f * 50.0f;
} }
} }


@@ -53,3 +53,7 @@ class CTimer
static void StartUserPause(void); static void StartUserPause(void);
static void EndUserPause(void); static void EndUserPause(void);
}; };

#ifdef FIX_BUGS
extern double frameTime;
#endif
@@ -28,10 +28,8 @@ CCivilianPed::CivilianAI(void)
return; return;


if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) { if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) {
if (m_pedInObjective) { if (m_pedInObjective && m_pedInObjective->IsPlayer())
if (m_pedInObjective->IsPlayer()) return;
return;
}
} }
if (CTimer::GetTimeInMilliseconds() <= m_lookTimer) if (CTimer::GetTimeInMilliseconds() <= m_lookTimer)
return; return;
@@ -75,7 +73,7 @@ CCivilianPed::CivilianAI(void)
} else { } else {
SetMoveState(PEDMOVE_WALK); SetMoveState(PEDMOVE_WALK);
} }
} else if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops) { } else if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
SetFindPathAndFlee(m_threatEntity, 5000); SetFindPathAndFlee(m_threatEntity, 5000);
if (threatDistSqr < sq(10.0f)) { if (threatDistSqr < sq(10.0f)) {
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
@@ -170,8 +168,8 @@ CCivilianPed::CivilianAI(void)
if (m_threatEntity && m_threatEntity->IsPed()) { if (m_threatEntity && m_threatEntity->IsPed()) {
CPed *threatPed = (CPed*)m_threatEntity; CPed *threatPed = (CPed*)m_threatEntity;
if (m_pedStats->m_fear <= 100 - threatPed->m_pedStats->m_temper && threatPed->m_nPedType != PEDTYPE_COP) { if (m_pedStats->m_fear <= 100 - threatPed->m_pedStats->m_temper && threatPed->m_nPedType != PEDTYPE_COP) {
if (threatPed->GetWeapon()->IsTypeMelee() || !GetWeapon()->IsTypeMelee()) { if (threatPed->GetWeapon(m_currentWeapon).IsTypeMelee() || !GetWeapon()->IsTypeMelee()) {
if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops) { if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) { if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) {
SetFindPathAndFlee(m_threatEntity, 10000); SetFindPathAndFlee(m_threatEntity, 10000);
} }

0 comments on commit 70cdf53

Please sign in to comment.