summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/animation/AnimBlendAssociation.h2
-rw-r--r--src/audio/sampman.cpp6
-rw-r--r--src/control/Script.cpp10
-rw-r--r--src/core/Frontend.cpp758
-rw-r--r--src/core/Frontend.h12
-rw-r--r--src/core/Pad.cpp4
-rw-r--r--src/core/Pad.h2
-rw-r--r--src/core/re3.cpp10
-rw-r--r--src/entities/Entity.h2
-rw-r--r--src/objects/CutsceneHead.cpp3
-rw-r--r--src/peds/Ped.cpp324
-rw-r--r--src/peds/Ped.h6
-rw-r--r--src/render/Renderer.cpp2
-rw-r--r--src/render/Renderer.h2
-rw-r--r--src/vehicles/Automobile.cpp2
15 files changed, 804 insertions, 341 deletions
diff --git a/src/animation/AnimBlendAssociation.h b/src/animation/AnimBlendAssociation.h
index 01d862cc..aec28f56 100644
--- a/src/animation/AnimBlendAssociation.h
+++ b/src/animation/AnimBlendAssociation.h
@@ -16,7 +16,7 @@ enum {
ASSOC_FLAG80 = 0x80, // used for footstep sound calculation
ASSOC_FLAG100 = 0x100,
ASSOC_FLAG200 = 0x200,
- ASSOC_FLAG400 = 0x400, // not seen yet
+ ASSOC_FLAG400 = 0x400, // unused, blending it with move anims makes them stop. 0x800 in VC
ASSOC_FLAG800 = 0x800, // anims that we fall to front. 0x1000 in VC
ASSOC_HAS_X_TRANSLATION = 0x1000,
// 0x2000 is vehicle anims in VC
diff --git a/src/audio/sampman.cpp b/src/audio/sampman.cpp
index c9b4cb32..9c79e1b1 100644
--- a/src/audio/sampman.cpp
+++ b/src/audio/sampman.cpp
@@ -35,7 +35,7 @@ int32 _nSampleDataEndOffset;
int32 nPedSlotSfx [MAX_PEDSFX];
int32 nPedSlotSfxAddr[MAX_PEDSFX];
-int32 nCurrentPedSlot;
+uint8 nCurrentPedSlot;
uint8 nChannelVolume[MAXCHANNELS+MAX2DCHANNELS];
@@ -1437,7 +1437,7 @@ cSampleManager::IsSampleBankLoaded(uint8 nBank)
bool
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
- int32 slot;
+ uint8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ )
{
@@ -1452,7 +1452,7 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
int32
cSampleManager::_GetPedCommentSlot(uint32 nComment)
{
- int32 slot;
+ uint8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ )
{
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 0b5f1105..62f92620 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -200,7 +200,7 @@ void CUpsideDownCarCheck::Init()
{
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
m_sCars[i].m_nVehicleIndex = -1;
- m_sCars[i].m_nVehicleIndex = 0;
+ m_sCars[i].m_nUpsideDownTimer = 0;
}
}
@@ -216,6 +216,10 @@ void CUpsideDownCarCheck::UpdateTimers()
{
uint32 timeStep = CTimer::GetTimeStepInMilliseconds();
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
+#ifdef FIX_BUGS
+ if (m_sCars[i].m_nVehicleIndex == -1)
+ continue;
+#endif
CVehicle* v = CPools::GetVehiclePool()->GetAt(m_sCars[i].m_nVehicleIndex);
if (v){
if (IsCarUpsideDown(m_sCars[i].m_nVehicleIndex))
@@ -3424,7 +3428,7 @@ int8 CRunningScript::ProcessCommandsFrom300To399(int32 command)
assert(pPed);
// Useless call.
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- int handle = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH);
+ int handle = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH);
CRadar::ChangeBlipScale(handle, 3);
ScriptParams[0] = handle;
StoreParameters(&m_nIp, 1);
@@ -3437,7 +3441,7 @@ int8 CRunningScript::ProcessCommandsFrom300To399(int32 command)
assert(pObject);
// Useless call.
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- int handle = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 0, BLIP_DISPLAY_BOTH);
+ int handle = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH);
CRadar::ChangeBlipScale(handle, 3);
ScriptParams[0] = handle;
StoreParameters(&m_nIp, 1);
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 5911433c..05c6b6e8 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -26,6 +26,7 @@
#include "PlayerInfo.h"
#include "World.h"
#include "Renderer.h"
+#include "CdStream.h"
#define ALL_ORIGINAL_FRONTEND 1
@@ -58,13 +59,17 @@ char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74; //[256] "$$\"\""
int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70; // -1
+float &CMenuManager::headingYStart = *(float*)0x5F355C; // don't know the original name
+float &CMenuManager::unkX = *(float*)0x5F2E40;
+float &CMenuManager::unkY = *(float*)0x5F2E44;
+
CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
// Move this somewhere else.
float &CRenderer::ms_lodDistScale = *(float*)0x5F726C; // 1.2
// Stuff not in CMenuManager:
-uint32 &VibrationTime = *(uint32*)0x628CF8;
+uint32 &TimeToStopPadShaking = *(uint32*)0x628CF8;
char *&pEditString = *(char**)0x628D00;
int32 *&pControlEdit = *(int32**)0x628D08;
bool &DisplayComboButtonErrMsg = *(bool*)0x628D14;
@@ -94,87 +99,108 @@ bool GetMouseMoveRight();
bool GetPadInput();
bool GetMouseInput();
-const char *FrontendFilenames[] = {
- "fe2_mainpanel_ul",
- "fe2_mainpanel_ur",
- "fe2_mainpanel_dl",
- "fe2_mainpanel_dr",
- "fe2_mainpanel_dr2",
- "fe2_tabactive",
- "fe_iconbrief",
- "fe_iconstats",
- "fe_iconcontrols",
- "fe_iconsave",
- "fe_iconaudio",
- "fe_icondisplay",
- "fe_iconlanguage",
- "fe_controller",
- "fe_controllersh",
- "fe_arrows1",
- "fe_arrows2",
- "fe_arrows3",
- "fe_arrows4",
- "fe_radio1", // HEAD_RADIO
- "fe_radio2", // DOUBLE_CLEF
- "fe_radio5", // JAH_RADIO
- "fe_radio7", // RISE_FM
- "fe_radio8", // LIPS_106
- "fe_radio3", // GAME_FM
- "fe_radio4", // MSX_FM
- "fe_radio6", // FLASHBACK
- "fe_radio9", // CHATTERBOX
+// 0x5F311C
+const char* FrontendFilenames[][2] = {
+ {"fe2_mainpanel_ul", "" },
+ {"fe2_mainpanel_ur", "" },
+ {"fe2_mainpanel_dl", "" },
+ {"fe2_mainpanel_dr", "" },
+ {"fe2_mainpanel_dr2", "" },
+ {"fe2_tabactive", "" },
+ {"fe_iconbrief", "" },
+ {"fe_iconstats", "" },
+ {"fe_iconcontrols", "" },
+ {"fe_iconsave", "" },
+ {"fe_iconaudio", "" },
+ {"fe_icondisplay", "" },
+ {"fe_iconlanguage", "" },
+ {"fe_controller", "" },
+ {"fe_controllersh", "" },
+ {"fe_arrows1", "" },
+ {"fe_arrows2", "" },
+ {"fe_arrows3", "" },
+ {"fe_arrows4", "" },
+ {"fe_radio1", "" }, // HEAD_RADIO
+ {"fe_radio2", "" }, // DOUBLE_CLEF
+ {"fe_radio3", "" }, // JAH_RADIO
+ {"fe_radio4", "" }, // RISE_FM
+ {"fe_radio5", "" }, // LIPS_106
+ {"fe_radio6", "" }, // GAME_FM
+ {"fe_radio7", "" }, // MSX_FM
+ {"fe_radio8", "" }, // FLASHBACK
+ {"fe_radio9", "" }, // CHATTERBOX
};
-const char *MenuFilenames[] = {
- "connection24", "",
- "findgame24", "",
- "hostgame24", "",
- "mainmenu24", "",
- "Playersetup24", "",
- "singleplayer24", "",
- "multiplayer24", "",
- "dmalogo128", "dmalogo128m",
- "gtaLogo128", "gtaLogo128",
- "rockstarLogo128", "rockstarlogo128m",
- "gamespy256", "gamespy256a",
- "mouse", "mousetimera",
- "mousetimer", "mousetimera",
- "mp3logo", "mp3logoA",
- "downOFF", "buttonA",
- "downON", "buttonA",
- "upOFF", "buttonA",
- "upON", "buttonA",
- "gta3logo256", "gta3logo256m",
- nil, nil
+// 0x5F3344
+const char* MenuFilenames[][2] = {
+ {"connection24", ""},
+ {"findgame24", ""},
+ {"hostgame24", ""},
+ {"mainmenu24", ""},
+ {"Playersetup24", ""},
+ {"singleplayer24", ""},
+ {"multiplayer24", ""},
+ {"dmalogo128", "dmalogo128m"},
+ {"gtaLogo128", "gtaLogo128"},
+ {"rockstarLogo128", "rockstarlogo128m"},
+ {"gamespy256", "gamespy256a"},
+ {"mouse", "mousetimera"},
+ {"mousetimer", "mousetimera"},
+ {"mp3logo", "mp3logoA"},
+ {"downOFF", "buttonA"},
+ {"downON", "buttonA"},
+ {"upOff", "buttonA"},
+ {"upON", "buttonA"},
+ {"gta3logo256", "gta3logo256m"},
+ { nil, nil }
};
-#if 0
-WRAPPER void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2) { EAXJMP(0x483870); }
+#ifdef ASPECT_RATIO_SCALE
+// All of these defines replaces the StretchX function. Otherwise use SCREEN_SCALE_X.
+#define MENU_X_LEFT_ALIGNED(x) ScaleAndCenterX(x)
+#define MENU_X(x) SCREEN_SCALE_X(x)
+#define MENU_Y(y) SCREEN_SCALE_Y(y)
+float
+ScaleAndCenterX(float x)
+{
+ if (SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH)
+ return x;
+ else {
+ if (x > DEFAULT_SCREEN_WIDTH / 2) {
+ return SCREEN_WIDTH / 2 + SCREEN_SCALE_X(x - DEFAULT_SCREEN_WIDTH / 2);
+ } else {
+ return SCREEN_WIDTH / 2 - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH / 2 - x);
+ }
+ }
+}
#else
-void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2)
+#define MENU_X_LEFT_ALIGNED(x) StretchX(x)
+#define MENU_X(x) StretchX(x)
+#define MENU_Y(y) StretchY(y)
+#endif
+
+void
+CMenuManager::BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2)
{
if (!text)
return;
if (stat2) {
if (aFloat)
- sprintf(gString2, " %.2f %s %.2f", *stat, UnicodeToAscii(TheText.Get("FEST_OO")), *stat2);
+ sprintf(gString2, " %.2f %s %.2f", *(float*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(float*)stat2);
else
sprintf(gString2, " %d %s %d", *(int*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(int*)stat2);
- }
- else if (stat) {
+ } else if (stat) {
if (aFloat)
- sprintf(gString2, " %.2f", *stat);
+ sprintf(gString2, " %.2f", *(float*)stat);
else
sprintf(gString2, " %d", *(int*)stat);
- }
- else
+ } else
gString2[0] = '\0';
UnicodeStrcpy(gUString, TheText.Get(text));
AsciiToUnicode(gString2, gUString2);
}
-#endif
#if 0
WRAPPER void CMenuManager::CentreMousePointer() { EAXJMP(0x48ACE0); }
@@ -359,6 +385,7 @@ void CMenuManager::DoSettingsBeforeStartingAGame()
}
#endif
+// WIP - has broken, duplicate and missing codes
#if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::Draw() { EAXJMP(0x47AE00); }
#else
@@ -370,29 +397,27 @@ void CMenuManager::Draw()
CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOn();
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(40.0f));
- CFont::SetRightJustifyWrap(0.0f);
- CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A)));
+ CFont::SetRightJustifyWrap(SCREEN_SCALE_X(38.0f));
+// CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A)));
switch (m_nCurrScreen) {
- case MENUPAGE_STATS:
- PrintStats();
- break;
- case MENUPAGE_BRIEFS:
- PrintBriefs();
- break;
- case MENUPAGE_CONTROLLER_DEBUG:
- DrawControllerScreenExtraText(0, 350, 20);
- break;
+ case MENUPAGE_STATS:
+ PrintStats();
+ break;
+ case MENUPAGE_BRIEFS:
+ PrintBriefs();
+ break;
}
// Header.
+ headingYStart = 40.0f;
if (aScreens[m_nCurrScreen].m_ScreenName[0]) {
- CFont::SetDropShadowPosition(0);
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
- CFont::SetScale(SCREEN_SCALE_X(MENUHEADER_WIDTH), SCREEN_SCALE_Y(MENUHEADER_HEIGHT));
+ CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
+ headingYStart += 24.0f + 10.0f;
}
// Action text.
@@ -422,13 +447,109 @@ void CMenuManager::Draw()
break;
}
- CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
- CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A)));
+// CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
+// CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A)));
CFont::SetFontStyle(FONT_BANK);
- CFont::SetScale(SCREEN_SCALE_X(MENUACTION_WIDTH), SCREEN_SCALE_Y(MENUACTION_HEIGHT));
- CFont::SetAlignment(ALIGN_LEFT);
+ CFont::SetScale(MENU_X(MENUACTION_WIDTH), MENU_Y(MENUACTION_HEIGHT));
+ CFont::SetAlignment(ALIGN_LEFT); // AG's extra. III uses SetRightJustifyOff.
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
- CFont::PrintString(SCREEN_SCALE_X(MENUACTION_POS_X), SCREEN_SCALE_Y(MENUACTION_POS_Y), str);
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(MENUACTION_POS_X), MENU_Y(headingYStart), str);
+ }
+
+ CFont::SetCentreSize(SCREEN_WIDTH);
+
+ bool v360 = false;
+ int v361;
+ int v362;
+ int v20;
+ switch (m_nCurrScreen) {
+ case MENUPAGE_STATS:
+ case MENUPAGE_BRIEFS:
+ v20 = 320;
+ v362 = 240;
+ v361 = 24;
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(StretchX(unkX = 0.75f), StretchY(unkY = 0.9f));
+ CFont::SetCentreOn();
+ break;
+ case MENUPAGE_SOUND_SETTINGS:
+ case MENUPAGE_GRAPHICS_SETTINGS:
+ case MENUPAGE_MULTIPLAYER_CREATE:
+ case MENUPAGE_SKIN_SELECT_OLD:
+ case MENUPAGE_CONTROLLER_PC_OLD1:
+ case MENUPAGE_CONTROLLER_PC_OLD2:
+ case MENUPAGE_CONTROLLER_PC_OLD3:
+ case MENUPAGE_CONTROLLER_PC_OLD4:
+ case MENUPAGE_CONTROLLER_DEBUG:
+ case MENUPAGE_MOUSE_CONTROLS:
+ v20 = 50;
+ v362 = 0;
+ v361 = 20;
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(StretchX(unkX = 0.8f), StretchY(unkY = 0.55f));
+ CFont::SetRightJustifyOff();
+ break;
+ case MENUPAGE_CHOOSE_LOAD_SLOT:
+ case MENUPAGE_CHOOSE_DELETE_SLOT:
+ case MENUPAGE_CHOOSE_SAVE_SLOT:
+ v20 = 120;
+ v362 = 38;
+ v361 = 20;
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetScale(StretchX(unkX = 0.7f), StretchY(unkY = 0.45f));
+ CFont::SetRightJustifyOff();
+ break;
+ case MENUPAGE_NEW_GAME_RELOAD:
+ case MENUPAGE_LOAD_SLOT_CONFIRM:
+ case MENUPAGE_DELETE_SLOT_CONFIRM:
+ case MENUPAGE_SAVE_OVERWRITE_CONFIRM:
+ case MENUPAGE_EXIT:
+ v20 = 320;
+ v362 = 60;
+ v361 = 24;
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(StretchX(unkX = 0.75f), StretchY(unkY = 0.9f));
+ CFont::SetCentreOn();
+ break;
+ case MENUPAGE_START_MENU:
+ v20 = 320;
+ v362 = 140;
+ v361 = 24;
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(StretchX(unkX = 0.75f), StretchY(unkY = 0.9f));
+ CFont::SetCentreOn();
+ break;
+ case MENUPAGE_PAUSE_MENU:
+ v20 = 320;
+ v362 = 117;
+ v361 = 24;
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(StretchX(unkX = 0.75f), StretchY(unkY = 0.9f));
+ CFont::SetCentreOn();
+ break;
+ default:
+ v20 = 320;
+ v362 = 40;
+ v361 = 24;
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(StretchX(unkX = 0.75f), StretchY(unkY = 0.9f));
+ CFont::SetCentreOn();
+ break;
+ }
+
+ switch (m_nCurrScreen) {
+ case MENUPAGE_CONTROLLER_PC_OLD1:
+ case MENUPAGE_CONTROLLER_PC_OLD2:
+ case MENUPAGE_CONTROLLER_PC_OLD3:
+ case MENUPAGE_CONTROLLER_PC_OLD4:
+ case MENUPAGE_CONTROLLER_DEBUG:
+ if (field_113)
+ v360 = 0;
+
+ CMenuManager::DrawControllerScreenExtraText(headingYStart - 8.0f, 350, v361);
+ break;
+ default:
+ break;
}
for (int i = 0; i < NUM_MENUROWS; ++i) {
@@ -437,27 +558,38 @@ void CMenuManager::Draw()
bool Locked = false;
if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot <= SAVESLOT_8) {
+ CFont::SetRightJustifyOff();
textToPrint[MENUCOLUMN_LEFT] = GetNameOfSavedGame(i - 1);
- textToPrint[MENUCOLUMN_RIGHT] = GetSavedGameDateAndTime(i - 1);
- if (!textToPrint[MENUCOLUMN_LEFT][0]) {
+ if (Slots[i-1] != 1)
+ textToPrint[MENUCOLUMN_RIGHT] = GetSavedGameDateAndTime(i - 1);
+
+ if (!textToPrint[MENUCOLUMN_LEFT]) {
sprintf(gString, "FEM_SL%d", i);
textToPrint[MENUCOLUMN_LEFT] = TheText.Get(gString);
}
}
else {
textToPrint[MENUCOLUMN_LEFT] = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName);
-
+ /*
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_SCREENRES) {
if (m_bGameNotLoaded)
Locked = false;
else
Locked = true;
}
+ */
}
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
+ case MENUACTION_CHANGEMENU:
+ assert(0 && "Not implemented");
+ break;
case MENUACTION_CTRLVIBRATION:
+ if (CMenuManager::m_PrefsUseVibration)
+ textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEM_ON");
+ else
+ textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEM_OFF");
break;
case MENUACTION_CTRLCONFIG:
switch (CPad::GetPad(0)->Mode) {
@@ -476,6 +608,10 @@ void CMenuManager::Draw()
}
break;
case MENUACTION_CTRLDISPLAY:
+ if (m_DisplayControllerOnFoot)
+ textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEC_ONF");
+ else
+ textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEC_INC");
break;
case MENUACTION_FRAMESYNC:
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(m_PrefsVsyncDisp ? "FEM_ON" : "FEM_OFF");
@@ -507,6 +643,9 @@ void CMenuManager::Draw()
#endif
break;
case MENUACTION_RADIO:
+ if (m_PrefsRadioStation > 9)
+ break;
+
sprintf(gString, "FEA_FM%d", m_PrefsRadioStation);
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(gString);
break;
@@ -514,29 +653,42 @@ void CMenuManager::Draw()
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(CTheScripts::DbgFlag ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_SWITCHBIGWHITEDEBUGLIGHT:
- textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(CTheScripts::DbgFlag ? "FEM_ON" : "FEM_OFF");
+ textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(gbBigWhiteDebugLightSwitchedOn ? "FEM_ON" : "FEM_OFF");
+ break;
+ case MENUACTION_PEDROADGROUPS:
+ textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(gbShowPedRoadGroups ? "FEM_ON" : "FEM_OFF");
+ break;
+ case MENUACTION_CARROADGROUPS:
+ textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(gbShowCarRoadGroups ? "FEM_ON" : "FEM_OFF");
+ break;
+ case MENUACTION_COLLISIONPOLYS:
+ textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(gbShowCollisionPolys ? "FEM_ON" : "FEM_OFF");
+ break;
+ case MENUACTION_SHOWCULL:
+ textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(gbShowCullZoneDebugStuff ? "FEM_ON" : "FEM_OFF");
+ break;
+ case MENUACTION_SHOWHEADBOB:
+ textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(TheCamera.m_bHeadBob ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_INVVERT:
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(MousePointerStateHelper.bInvertVertically ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_SCREENRES:
- {
char *res = _psGetVideoModeList()[m_nDisplayVideoMode];
-
- if (!res)
- res = "";
-
- AsciiToUnicode(res, gUString);
- textToPrint[MENUCOLUMN_RIGHT] = gUString;
- }
- break;
+ AsciiToUnicode(res, textToPrint[MENUCOLUMN_RIGHT]);
+ break;
case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex == -1)
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEA_NAH");
else {
char *provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
- AsciiToUnicode(provider, gUString);
- textToPrint[MENUCOLUMN_RIGHT] = gUString;
+
+ if (!strcmp(strupr(provider), "DIRECTSOUND3D HARDWARE SUPPORT")) {
+ strcpy(provider, "DSOUND3D HARDWARE SUPPORT");
+ } else if (!strcmp(strupr(provider), "DIRECTSOUND3D SOFTWARE EMULATION")) {
+ strcpy(provider, "DSOUND3D SOFTWARE EMULATION");
+ }
+ AsciiToUnicode(provider, textToPrint[MENUCOLUMN_RIGHT]);
}
break;
case MENUACTION_SPEAKERCONF:
@@ -580,6 +732,7 @@ void CMenuManager::Draw()
CFont::SetWrapx(SCREEN_WIDTH);
CFont::SetRightJustifyWrap(-SCREEN_WIDTH);
+ // !! Most of these are now duplicate(see before the loop) and needs to be deleted.
// Set alignment.
CVector2D vecPositions = { 0.0f, 0.0f };
float fVerticalSpacing;
@@ -768,19 +921,27 @@ void CMenuManager::Draw()
SetHelperText(3);
}
}
-
- switch (m_nCurrScreen) {
- case MENUPAGE_CONTROLLER_SETTINGS:
- case MENUPAGE_SOUND_SETTINGS:
- case MENUPAGE_GRAPHICS_SETTINGS:
- case MENUPAGE_SKIN_SELECT:
- case MENUPAGE_CONTROLLER_PC:
- case MENUPAGE_MOUSE_CONTROLS:
- DisplayHelperText();
- break;
- }
}
}
+
+ switch (m_nCurrScreen) {
+ case MENUPAGE_CONTROLLER_SETTINGS:
+ case MENUPAGE_SOUND_SETTINGS:
+ case MENUPAGE_GRAPHICS_SETTINGS:
+ case MENUPAGE_SKIN_SELECT:
+ case MENUPAGE_CONTROLLER_PC:
+ case MENUPAGE_MOUSE_CONTROLS:
+ DisplayHelperText();
+ break;
+ }
+/*
+ if (m_nCurrScreen == MENUPAGE_CONTROLLER_SETTINGS) {
+ PrintController();
+ } else if (m_nCurrScreen == MENUPAGE_SKIN_SELECT_OLD) {
+ CSprite2d::DrawRect(CRect(StretchX(180), StretchY(98), StretchX(230), StretchY(123)), CRGBA(255, 255, 255, FadeIn(255)));
+ CSprite2d::DrawRect(CRect(StretchX(181), StretchY(99), StretchX(229), StretchY(233)), CRGBA(Player color from PickNewPlayerColour, FadeIn(255)));
+ }
+*/
}
#endif
@@ -811,9 +972,6 @@ void CMenuManager::DrawControllerSetupScreen()
}
#endif
-#if 0
-WRAPPER void CMenuManager::DrawFrontEnd(void) { EAXJMP(0x47A540); }
-#else
void CMenuManager::DrawFrontEnd()
{
CFont::SetAlphaFade(255.0f);
@@ -833,27 +991,73 @@ void CMenuManager::DrawFrontEnd()
CMenuManager::DrawFrontEndNormal();
CMenuManager::PrintErrorMessage();
}
-#endif
-#if 0
-WRAPPER void CMenuManager::DrawFrontEndNormal(void) { EAXJMP(0x47A5B0); }
-#else
void CMenuManager::DrawFrontEndNormal()
{
- RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
-
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
LoadSplash(nil);
- eMenuSprites previousSprite = MENUSPRITE_MAINMENU; // actually uninitialized
+ eMenuSprites previousSprite;
if (m_nMenuFadeAlpha < 255) {
switch (m_nPrevScreen) {
+ case MENUPAGE_STATS:
+ case MENUPAGE_START_MENU:
+ case MENUPAGE_PAUSE_MENU:
+ previousSprite = MENUSPRITE_MAINMENU;
+ break;
+ case MENUPAGE_NEW_GAME:
+ case MENUPAGE_CHOOSE_LOAD_SLOT:
+ case MENUPAGE_CHOOSE_DELETE_SLOT:
+ case MENUPAGE_NEW_GAME_RELOAD:
+ case MENUPAGE_LOAD_SLOT_CONFIRM:
+ case MENUPAGE_DELETE_SLOT_CONFIRM:
+ case MENUPAGE_EXIT:
+ previousSprite = MENUSPRITE_SINGLEPLAYER;
+ break;
+ case MENUPAGE_MULTIPLAYER_MAIN:
+ previousSprite = MENUSPRITE_MULTIPLAYER;
+ break;
+ case MENUPAGE_MULTIPLAYER_MAP:
+ case MENUPAGE_MULTIPLAYER_FIND_GAME:
+ case MENUPAGE_SKIN_SELECT:
+ case MENUPAGE_KEYBOARD_CONTROLS:
+ case MENUPAGE_MOUSE_CONTROLS:
+ previousSprite = MENUSPRITE_FINDGAME;
+ break;
+ case MENUPAGE_MULTIPLAYER_CONNECTION:
+ case MENUPAGE_MULTIPLAYER_MODE:
+ previousSprite = MENUSPRITE_CONNECTION;
+ break;
+ case MENUPAGE_MULTIPLAYER_CREATE:
+ previousSprite = MENUSPRITE_HOSTGAME;
+ break;
+ case MENUPAGE_SKIN_SELECT_OLD:
+ case MENUPAGE_OPTIONS:
+ previousSprite = MENUSPRITE_PLAYERSET;
+ break;
+ default:
+ previousSprite = MENUSPRITE_MAINMENU;
+ break;
+ }
+
+ if (m_nPrevScreen == m_nCurrScreen)
+ CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255-m_nMenuFadeAlpha));
+ else
+ m_aMenuSprites[previousSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255-m_nMenuFadeAlpha));
+ }
+
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+
+ eMenuSprites currentSprite = MENUSPRITE_MAINMENU; // actually uninitialized
+ switch (m_nCurrScreen) {
case MENUPAGE_STATS:
case MENUPAGE_START_MENU:
case MENUPAGE_PAUSE_MENU:
- previousSprite = MENUSPRITE_MAINMENU;
+ currentSprite = MENUSPRITE_MAINMENU;
break;
case MENUPAGE_NEW_GAME:
case MENUPAGE_CHOOSE_LOAD_SLOT:
@@ -862,77 +1066,29 @@ void CMenuManager::DrawFrontEndNormal()
case MENUPAGE_LOAD_SLOT_CONFIRM:
case MENUPAGE_DELETE_SLOT_CONFIRM:
case MENUPAGE_EXIT:
- previousSprite = MENUSPRITE_SINGLEPLAYER;
+ currentSprite = MENUSPRITE_SINGLEPLAYER;
break;
case MENUPAGE_MULTIPLAYER_MAIN:
- previousSprite = MENUSPRITE_MULTIPLAYER;
+ currentSprite = MENUSPRITE_MULTIPLAYER;
break;
case MENUPAGE_MULTIPLAYER_MAP:
case MENUPAGE_MULTIPLAYER_FIND_GAME:
case MENUPAGE_SKIN_SELECT:
case MENUPAGE_KEYBOARD_CONTROLS:
case MENUPAGE_MOUSE_CONTROLS:
- previousSprite = MENUSPRITE_FINDGAME;
+ currentSprite = MENUSPRITE_FINDGAME;
break;
case MENUPAGE_MULTIPLAYER_CONNECTION:
case MENUPAGE_MULTIPLAYER_MODE:
- previousSprite = MENUSPRITE_CONNECTION;
+ currentSprite = MENUSPRITE_CONNECTION;
break;
case MENUPAGE_MULTIPLAYER_CREATE:
- previousSprite = MENUSPRITE_HOSTGAME;
+ currentSprite = MENUSPRITE_HOSTGAME;
break;
case MENUPAGE_SKIN_SELECT_OLD:
case MENUPAGE_OPTIONS:
- previousSprite = MENUSPRITE_PLAYERSET;
+ currentSprite = MENUSPRITE_PLAYERSET;
break;
- }
-
- if (m_nPrevScreen == m_nCurrScreen)
- CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255-m_nMenuFadeAlpha));
- else
- m_aMenuSprites[previousSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255-m_nMenuFadeAlpha));
- }
-
- RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
-
- eMenuSprites currentSprite = MENUSPRITE_MAINMENU; // actually uninitialized
- switch (m_nCurrScreen) {
- case MENUPAGE_STATS:
- case MENUPAGE_START_MENU:
- case MENUPAGE_PAUSE_MENU:
- currentSprite = MENUSPRITE_MAINMENU;
- break;
- case MENUPAGE_NEW_GAME:
- case MENUPAGE_CHOOSE_LOAD_SLOT:
- case MENUPAGE_CHOOSE_DELETE_SLOT:
- case MENUPAGE_NEW_GAME_RELOAD:
- case MENUPAGE_LOAD_SLOT_CONFIRM:
- case MENUPAGE_DELETE_SLOT_CONFIRM:
- case MENUPAGE_EXIT:
- currentSprite = MENUSPRITE_SINGLEPLAYER;
- break;
- case MENUPAGE_MULTIPLAYER_MAIN:
- currentSprite = MENUSPRITE_MULTIPLAYER;
- break;
- case MENUPAGE_MULTIPLAYER_MAP:
- case MENUPAGE_MULTIPLAYER_FIND_GAME:
- case MENUPAGE_SKIN_SELECT:
- case MENUPAGE_KEYBOARD_CONTROLS:
- case MENUPAGE_MOUSE_CONTROLS:
- currentSprite = MENUSPRITE_FINDGAME;
- break;
- case MENUPAGE_MULTIPLAYER_CONNECTION:
- case MENUPAGE_MULTIPLAYER_MODE:
- currentSprite = MENUSPRITE_CONNECTION;
- break;
- case MENUPAGE_MULTIPLAYER_CREATE:
- currentSprite = MENUSPRITE_HOSTGAME;
- break;
- case MENUPAGE_SKIN_SELECT_OLD:
- case MENUPAGE_OPTIONS:
- currentSprite = MENUSPRITE_PLAYERSET;
- break;
}
if (m_nMenuFadeAlpha < 255) {
@@ -954,7 +1110,9 @@ void CMenuManager::DrawFrontEndNormal()
m_aMenuSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
// TODO: what is this? waiting mouse?
if(field_518 == 4){
- if(m_nHoverOption == 3 || m_nHoverOption == 4 || m_nHoverOption == 5 || m_nHoverOption == 6 || m_nHoverOption == 7)
+ if(m_nHoverOption == HOVEROPTION_3 || m_nHoverOption == HOVEROPTION_4 ||
+ m_nHoverOption == HOVEROPTION_5 || m_nHoverOption == HOVEROPTION_6 || m_nHoverOption == HOVEROPTION_7)
+
field_518 = 2;
else
field_518 = 1;
@@ -966,24 +1124,24 @@ void CMenuManager::DrawFrontEndNormal()
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_PAUSE_MENU) {
if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
- m_aMenuSprites[MENUSPRITE_GTA3LOGO].Draw(CRect((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(115.0f), SCREEN_SCALE_Y(70.0f), (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(115.0f), SCREEN_SCALE_Y(180.0f)), CRGBA(255, 255, 255, FadeIn(255)));
+ m_aMenuSprites[MENUSPRITE_GTA3LOGO].Draw(CRect(MENU_X_LEFT_ALIGNED(205.0f), StretchY(70.0f), MENU_X_LEFT_ALIGNED(435.0f), StretchY(180.0f)), CRGBA(255, 255, 255, FadeIn(255)));
else
- m_aMenuSprites[MENUSPRITE_GTALOGO].Draw(CRect((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(95.0f), SCREEN_SCALE_Y(40.0f), (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(95.0f), SCREEN_SCALE_Y(210.0f)), CRGBA(255, 255, 255, FadeIn(255)));
+ m_aMenuSprites[MENUSPRITE_GTALOGO].Draw(CRect(MENU_X_LEFT_ALIGNED(225.0f), StretchY(40.0f), MENU_X_LEFT_ALIGNED(415.0f), StretchY(210.0f)), CRGBA(255, 255, 255, FadeIn(255)));
}
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
switch (m_nCurrScreen) {
- case MENUPAGE_SKIN_SELECT:
- CMenuManager::DrawPlayerSetupScreen();
- break;
- case MENUPAGE_KEYBOARD_CONTROLS:
- CMenuManager::DrawControllerSetupScreen();
- break;
- default:
- CMenuManager::Draw();
- break;
+ case MENUPAGE_SKIN_SELECT:
+ CMenuManager::DrawPlayerSetupScreen();
+ break;
+ case MENUPAGE_KEYBOARD_CONTROLS:
+ CMenuManager::DrawControllerSetupScreen();
+ break;
+ default:
+ CMenuManager::Draw();
+ break;
}
CFont::DrawFonts();
@@ -996,20 +1154,22 @@ void CMenuManager::DrawFrontEndNormal()
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
- CRect mouse(0.0f, 0.0f, SCREEN_SCALE_X(75.0f), SCREEN_SCALE_Y(75.0f));
+ CRect mouse(0.0f, 0.0f, MENU_X(75.0f), MENU_Y(75.0f));
+ CRect shad(MENU_X(10.0f), MENU_Y(3.0f), MENU_X(85.0f), MENU_Y(78.0f));
+
mouse.Translate(m_nMousePosX, m_nMousePosY);
- CRect shad = mouse;
- shad.Translate(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(3.0f));
+ shad.Translate(m_nMousePosX, m_nMousePosY);
if(field_518 == 4){
m_aMenuSprites[MENUSPRITE_MOUSET].Draw(shad, CRGBA(100, 100, 100, 50));
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
m_aMenuSprites[MENUSPRITE_MOUSET].Draw(mouse, CRGBA(255, 255, 255, 255));
}else{
m_aMenuSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50));
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
m_aMenuSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255));
}
}
}
-#endif
#if 1
WRAPPER void CMenuManager::DrawPlayerSetupScreen() { EAXJMP(0x47F2B0); }
@@ -1078,78 +1238,80 @@ void CMenuManager::InitialiseChangedLanguageSettings()
}
#endif
-#if ALL_ORIGINAL_FRONTEND
-WRAPPER void CMenuManager::LoadAllTextures() { EAXJMP(0x47A230); }
-#else
void CMenuManager::LoadAllTextures()
{
- if (!m_bSpritesLoaded) {
- CMenuManager::CentreMousePointer();
- DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
- m_nCurrOption = 0;
- m_PrefsRadioStation = DMAudio.GetRadioInCar();
+ if (m_bSpritesLoaded)
+ return;
- if (DMAudio.IsMP3RadioChannelAvailable()) {
- if (CMenuManager::m_PrefsRadioStation > USERTRACK)
- CMenuManager::m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
- }
- else if (CMenuManager::m_PrefsRadioStation > CHATTERBOX)
- CMenuManager::m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9;
+ CMenuManager::CentreMousePointer();
+ DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
+ m_nCurrOption = 0;
+ m_PrefsRadioStation = DMAudio.GetRadioInCar();
+
+ if (DMAudio.IsMP3RadioChannelAvailable()) {
+ if (CMenuManager::m_PrefsRadioStation > USERTRACK)
+ CMenuManager::m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
+ } else if (CMenuManager::m_PrefsRadioStation > CHATTERBOX)
+ CMenuManager::m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9;
- CFileMgr::SetDir("");
- CTimer::Stop();
- CStreaming::MakeSpaceFor(700 * 1024);
- CStreaming::ImGonnaUseStreamingMemory();
- CTxdStore::PushCurrentTxd();
-
- int frontend = CTxdStore::AddTxdSlot("frontend");
- CTxdStore::LoadTxd(frontend, "MODELS/FRONTEND.TXD");
- CTxdStore::AddRef(frontend);
- CTxdStore::SetCurrentTxd(frontend);
- CStreaming::IHaveUsedStreamingMemory();
- CTimer::Update();
-
- debug("LOAD frontend\n");
- for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); i++) {
- m_aFrontEndSprites[i].SetTexture(FrontendFilenames[i]);
- m_aFrontEndSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
- }
-
- CTxdStore::PopCurrentTxd();
+ CFileMgr::SetDir("");
+ //CFileMgr::SetDir("");
+ CTimer::Stop();
+ CStreaming::MakeSpaceFor(350 * CDSTREAM_SECTOR_SIZE); // twice of it in mobile
+ CStreaming::ImGonnaUseStreamingMemory();
+ CGame::TidyUpMemory(false, true);
+ CTxdStore::PushCurrentTxd();
+ int frontendTxdSlot = CTxdStore::FindTxdSlot("frontend");
+
+ if(frontendTxdSlot == -1)
+ frontendTxdSlot = CTxdStore::AddTxdSlot("frontend");
+
+ printf("LOAD frontend\n");
+ CTxdStore::LoadTxd(frontendTxdSlot, "MODELS/FRONTEND.TXD");
+ CTxdStore::AddRef(frontendTxdSlot);
+ CTxdStore::SetCurrentTxd(frontendTxdSlot);
+ CStreaming::IHaveUsedStreamingMemory();
+ CTimer::Update();
+
+ for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); i++) {
+ m_aFrontEndSprites[i].SetTexture(FrontendFilenames[i][0], FrontendFilenames[i][1]);
+ m_aFrontEndSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
+ }
- int menu = CTxdStore::AddTxdSlot("menu");
- CTxdStore::LoadTxd(menu, "MODELS/MENU.TXD");
- CTxdStore::AddRef(menu);
- CTxdStore::SetCurrentTxd(menu);
+ int menuTxdSlot = CTxdStore::FindTxdSlot("menu");
- debug("LOAD sprite\n");
- for (int i = 0; i < ARRAY_SIZE(MenuFilenames)/2; i++) {
- m_aMenuSprites[i].SetTexture(MenuFilenames[i*2], MenuFilenames[i*2+1]);
- m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
- }
+ if (menuTxdSlot == -1)
+ menuTxdSlot = CTxdStore::AddTxdSlot("menu");
- CTxdStore::PopCurrentTxd();
+ printf("LOAD sprite\n");
+ CTxdStore::LoadTxd(menuTxdSlot, "MODELS/MENU.TXD");
+ CTxdStore::AddRef(menuTxdSlot);
+ CTxdStore::SetCurrentTxd(menuTxdSlot);
- m_bSpritesLoaded = true;
+ for (int i = 0; i < ARRAY_SIZE(MenuFilenames); i++) {
+ m_aMenuSprites[i].SetTexture(MenuFilenames[i][0], MenuFilenames[i][1]);
+ m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
}
-}
-#endif
+ m_bSpritesLoaded = true;
+ CTxdStore::PopCurrentTxd();
+}
#if 0
WRAPPER void CMenuManager::LoadSettings() { EAXJMP(0x488EE0); }
#else
void CMenuManager::LoadSettings()
{
-
CFileMgr::SetDirMyDocuments();
+ int fileHandle = CFileMgr::OpenFile("gta3.set", "r");
int32 prevLang = m_PrefsLanguage;
CMBlur::BlurOn = true;
MousePointerStateHelper.bInvertVertically = true;
+ // 50 is silly
char Ver[50];
- int fileHandle = CFileMgr::OpenFile("gta3.set", "r");
+
if (fileHandle) {
CFileMgr::Read(fileHandle, Ver, 29);
@@ -1206,14 +1368,14 @@ void CMenuManager::LoadSettings()
m_bFrontEnd_ReloadObrTxtGxt = true;
InitialiseChangedLanguageSettings();
- debug("The previously saved language is now in use");
+ OutputDebugString("The previously saved language is now in use");
}
- struct _WIN32_FIND_DATAA FindFileData;
- char skinfile[256+16]; // ?? + 16?
+ WIN32_FIND_DATA FindFileData;
+ char skinfile[256+16]; // Stack analysis shows 16 bits gap, but I don't trust it. It may very well be MAX_PATH(260).
bool SkinFound = false;
- HANDLE handle = FindFirstFileA("skins\\*.bmp", &FindFileData);
- for (int i = 1; handle != (HANDLE)-1 && i; i = FindNextFileA(handle, &FindFileData)) {
+ HANDLE handle = FindFirstFile("skins\\*.bmp", &FindFileData);
+ for (int i = 1; handle != INVALID_HANDLE_VALUE && i; i = FindNextFile(handle, &FindFileData)) {
strcpy(skinfile, m_PrefsSkinFile);
strcat(skinfile, ".bmp");
if (strcmp(FindFileData.cFileName, skinfile) == 0)
@@ -1222,7 +1384,7 @@ void CMenuManager::LoadSettings()
FindClose(handle);
if (!SkinFound) {
- debug("Default skin set as no other skins are available OR saved skin not found!");
+ OutputDebugString("Default skin set as no other skins are available OR saved skin not found!");
strcpy(m_PrefsSkinFile, "$$\"\"");
strcpy(m_aSkinName, "$$\"\"");
}
@@ -1238,9 +1400,8 @@ void CMenuManager::SaveSettings()
CFileMgr::SetDirMyDocuments();
- int fileHandle = CFileMgr::OpenFile("gta3.set", "w");
+ int fileHandle = CFileMgr::OpenFile("gta3.set", "w+");
if (fileHandle) {
-
ControlsManager.SaveSettings(fileHandle);
CFileMgr::Write(fileHandle, RubbishString, 20);
CFileMgr::Write(fileHandle, RubbishString, 20);
@@ -1266,7 +1427,7 @@ void CMenuManager::SaveSettings()
CFileMgr::Write(fileHandle, (char*)&m_PrefsUseWideScreen, 1);
CFileMgr::Write(fileHandle, (char*)&m_PrefsVsyncDisp, 1);
CFileMgr::Write(fileHandle, (char*)&m_PrefsFrameLimiter, 1);
- CFileMgr::Write(fileHandle, (char*)&m_nDisplayVideoMode, 1);
+ CFileMgr::Write(fileHandle, (char*)&m_nPrefsVideoMode, 1);
CFileMgr::Write(fileHandle, (char*)&CMBlur::BlurOn, 1);
CFileMgr::Write(fileHandle, m_PrefsSkinFile, 256);
CFileMgr::Write(fileHandle, (char*)&m_ControlMethod, 1);
@@ -1398,10 +1559,10 @@ void CMenuManager::Process(void)
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service();
- m_bStartGameLoading = 1;
+ m_bStartGameLoading = true;
RequestFrontEndShutdown();
- m_bLoadingSavedGame = 1;
- b_FoundRecentSavedGameWantToLoad = 1;
+ m_bLoadingSavedGame = true;
+ b_FoundRecentSavedGameWantToLoad = true;
DMAudio.SetEffectsFadeVol(0);
DMAudio.SetMusicFadeVol(0);
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
@@ -1483,9 +1644,9 @@ void CMenuManager::Process(void)
}
// Reset pad shaking.
- if (VibrationTime && CTimer::GetTimeInMillisecondsPauseMode() > VibrationTime) {
+ if (TimeToStopPadShaking && TimeToStopPadShaking < CTimer::GetTimeInMillisecondsPauseMode()) {
CPad::StopPadsShaking();
- VibrationTime = 0;
+ TimeToStopPadShaking = 0;
}
} else {
@@ -1780,7 +1941,7 @@ void CMenuManager::ProcessOnOffMenuOptions()
if (m_PrefsUseVibration) {
CPad::GetPad(0)->StartShake(350, 150);
- VibrationTime = CTimer::GetTimeInMillisecondsPauseMode() + 500;
+ TimeToStopPadShaking = CTimer::GetTimeInMillisecondsPauseMode() + 500;
}
SaveSettings();
break;
@@ -2155,40 +2316,44 @@ void CMenuManager::ResetHelperText()
}
#endif
-#if ALL_ORIGINAL_FRONTEND
-WRAPPER void CMenuManager::SaveLoadFileError_SetUpErrorScreen() { EAXJMP(0x488930); }
-#else
void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
{
+ // TO-DO: Enum
switch (PcSaveHelper.m_nHelper) {
- case 1:
- case 2:
- case 3:
- SwitchToNewScreen(MENUPAGE_SAVE_FAILED);
- m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
- break;
- break;
- case 4:
- case 5:
- case 6:
- SwitchToNewScreen(MENUPAGE_LOAD_FAILED);
- m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
- break;
- case 7:
- SwitchToNewScreen(MENUPAGE_LOAD_FAILED_2);
- m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
- break;
- case 8:
- case 9:
- case 10:
- SwitchToNewScreen(MENUPAGE_DELETE_FAILED);
- m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
- break;
- default:
- return;
+ case 1:
+ case 2:
+ case 3:
+ m_nPrevScreen = m_nCurrScreen;
+ m_nCurrScreen = MENUPAGE_SAVE_FAILED;
+ m_nCurrOption = 0;
+ m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
+ break;
+ case 4:
+ case 5:
+ case 6:
+ m_nPrevScreen = m_nCurrScreen;
+ m_nCurrScreen = MENUPAGE_LOAD_FAILED;
+ m_nCurrOption = 0;
+ m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
+ break;
+ case 7:
+ m_nPrevScreen = m_nCurrScreen;
+ m_nCurrScreen = MENUPAGE_LOAD_FAILED_2;
+ m_nCurrOption = 0;
+ m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
+ break;
+ case 8:
+ case 9:
+ case 10:
+ m_nPrevScreen = m_nCurrScreen;
+ m_nCurrScreen = MENUPAGE_DELETE_FAILED;
+ m_nCurrOption = 0;
+ m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
+ break;
+ default:
+ return;
}
}
-#endif
#if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::SetHelperText(int text) { EAXJMP(0x48B450); }
@@ -2210,33 +2375,23 @@ void CMenuManager::ShutdownJustMenu()
}
#endif
-#if ALL_ORIGINAL_FRONTEND
-WRAPPER float CMenuManager::StretchX(float) { EAXJMP(0x48ABE0); }
-#else
float CMenuManager::StretchX(float x)
{
- if (SCREEN_WIDTH == 640)
+ if (SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH)
return x;
else
-#ifndef ASPECT_RATIO_SCALE
- return SCREEN_WIDTH * x * 0.0015625f;
-#else
- return SCREEN_SCALE_X(x);
-#endif
+ // We won't make this SCREEN_SCALE, because many cases relies on stretching and we want the code to be portable.
+ // Instead we will use MENU_X_LEFT_ALIGNED or SCREEN_SCALE_X when needed.
+ return SCREEN_STRETCH_X(x);
}
-#endif
-#if ALL_ORIGINAL_FRONTEND
-WRAPPER float CMenuManager::StretchY(float) { EAXJMP(0x48AC20); }
-#else
float CMenuManager::StretchY(float y)
{
- if (SCREEN_HEIGHT == 448)
+ if (SCREEN_HEIGHT == DEFAULT_SCREEN_HEIGHT)
return y;
else
- return SCREEN_HEIGHT * y * 0.002232143f;
+ return SCREEN_STRETCH_Y(y);
}
-#endif
#if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::SwitchMenuOnAndOff() { EAXJMP(0x488790); }
@@ -2580,20 +2735,19 @@ bool GetMouseInput()
STARTPATCHES
#if ALL_ORIGINAL_FRONTEND
#else
- InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP);
InjectHook(0x47A440, &CMenuManager::UnloadTextures, PATCH_JUMP);
- InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP);
InjectHook(0x4856F0, &CMenuManager::ProcessButtonPresses, PATCH_JUMP);
InjectHook(0x48AE60, &CMenuManager::ProcessOnOffMenuOptions, PATCH_JUMP);
- InjectHook(0x488EE0, &CMenuManager::LoadSettings, PATCH_JUMP);
- InjectHook(0x488CC0, &CMenuManager::SaveSettings, PATCH_JUMP);
- InjectHook(0x48ABE0, &CMenuManager::StretchX, PATCH_JUMP);
- InjectHook(0x48AC20, &CMenuManager::StretchY, PATCH_JUMP);
for (int i = 1; i < ARRAY_SIZE(aScreens); i++)
Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]);
#endif
+ InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP);
+ InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP);
+ InjectHook(0x47A540, &CMenuManager::DrawFrontEnd, PATCH_JUMP);
+ InjectHook(0x48ABE0, &CMenuManager::StretchX, PATCH_JUMP);
+ InjectHook(0x48AC20, &CMenuManager::StretchY, PATCH_JUMP);
InjectHook(0x488EE0, &CMenuManager::LoadSettings, PATCH_JUMP);
InjectHook(0x488CC0, &CMenuManager::SaveSettings, PATCH_JUMP);
ENDPATCHES \ No newline at end of file
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index e1ee5b31..ed7cd2c3 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -7,10 +7,10 @@
#define MENUHEADER_WIDTH 0.84f
#define MENUHEADER_HEIGHT 1.6f
-#define MENUACTION_POS_X 20.0f
+#define MENUACTION_POS_X 40.0f
#define MENUACTION_POS_Y 37.5f
-#define MENUACTION_WIDTH 0.675f
-#define MENUACTION_HEIGHT 0.81f
+#define MENUACTION_WIDTH 0.405f
+#define MENUACTION_HEIGHT 0.63f
#define MENUCOLUMN_POS_X MENUHEADER_POS_X + 16.0f
#define MENUCOLUMN_MAX_Y 149.0f
@@ -466,9 +466,13 @@ public:
static bool &m_bStartUpFrontEndRequested;
static bool &m_bShutDownFrontEndRequested;
static bool &m_PrefsAllowNastyGame;
+
+ static float &headingYStart;
+ static float &unkX;
+ static float &unkY;
public:
- void BuildStatLine(char *text, float *stat, bool aFloat, float* stat2);
+ static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2);
static void CentreMousePointer();
int CheckCodesForControls(int32);
bool CheckHover(int x1, int x2, int y1, int y2);
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index e5178ef3..51102c7b 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -36,7 +36,7 @@ CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70;
CKeyboardState &CPad::NewKeyState = *(CKeyboardState*)0x6E60D0;
CKeyboardState &CPad::TempKeyState = *(CKeyboardState*)0x774DE8;
-char CPad::KeyBoardCheatString[18];
+char CPad::KeyBoardCheatString[20];
CMouseControllerState &CPad::OldMouseControllerState = *(CMouseControllerState*)0x8472A0;
CMouseControllerState &CPad::NewMouseControllerState = *(CMouseControllerState*)0x8809F0;
@@ -427,7 +427,7 @@ void CPad::StartShake_Train(float fX, float fY)
void CPad::AddToPCCheatString(char c)
{
- for ( int32 i = ARRAY_SIZE(KeyBoardCheatString); i >= 0; i-- )
+ for ( int32 i = ARRAY_SIZE(KeyBoardCheatString) - 2; i >= 0; i-- )
KeyBoardCheatString[i + 1] = KeyBoardCheatString[i];
KeyBoardCheatString[0] = c;
diff --git a/src/core/Pad.h b/src/core/Pad.h
index 89ec4aa2..eadbd299 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -166,7 +166,7 @@ public:
static CKeyboardState &OldKeyState;
static CKeyboardState &NewKeyState;
static CKeyboardState &TempKeyState;
- static char KeyBoardCheatString[18];
+ static char KeyBoardCheatString[20];
static CMouseControllerState &OldMouseControllerState;
static CMouseControllerState &NewMouseControllerState;
static CMouseControllerState &PCTempMouseControllerState;
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index d6bc8148..ab099726 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -29,12 +29,10 @@ void **rwengine = *(void***)0x5A10E1;
DebugMenuAPI gDebugMenuAPI;
-WRAPPER void *gtanew(uint32 sz) { EAXJMP(0x5A0690); }
-WRAPPER void gtadelete(void *p) { EAXJMP(0x5A07E0); }
-
-// overload our own new/delete with GTA's functions
-void *operator new(size_t sz) { return gtanew(sz); }
-void operator delete(void *ptr) noexcept { gtadelete(ptr); }
+STARTPATCHES
+ InjectHook(0x5A07E0, (void (*)(void*)) &operator delete, PATCH_JUMP);
+ InjectHook(0x5A0690, (void* (*)(size_t)) &operator new, PATCH_JUMP);
+ENDPATCHES
#ifdef USE_PS2_RAND
unsigned __int64 myrand_seed = 1;
diff --git a/src/entities/Entity.h b/src/entities/Entity.h
index 11d3e8cd..99cc7f17 100644
--- a/src/entities/Entity.h
+++ b/src/entities/Entity.h
@@ -84,7 +84,7 @@ public:
uint32 m_flagE2 : 1;
uint16 m_scanCode;
- int16 m_randomSeed;
+ uint16 m_randomSeed;
int16 m_modelIndex;
uint16 m_level; // int16
CReference *m_pFirstReference;
diff --git a/src/objects/CutsceneHead.cpp b/src/objects/CutsceneHead.cpp
index c423d0b8..8c417973 100644
--- a/src/objects/CutsceneHead.cpp
+++ b/src/objects/CutsceneHead.cpp
@@ -9,6 +9,7 @@
#include "CutsceneMgr.h"
#include "Streaming.h"
#include "CutsceneHead.h"
+#include "CdStream.h"
CCutsceneHead::CCutsceneHead(CObject *obj)
@@ -94,7 +95,7 @@ CCutsceneHead::PlayAnimation(const char *animName)
stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "ANIM\\CUTS.IMG");
assert(stream);
- CStreaming::MakeSpaceFor(size*2048);
+ CStreaming::MakeSpaceFor(size * CDSTREAM_SECTOR_SIZE);
CStreaming::ImGonnaUseStreamingMemory();
RwStreamSkip(stream, offset*2048);
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 4e64c1db..04cc3edf 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -49,11 +49,8 @@
#include "ParticleObject.h"
#include "Floater.h"
-WRAPPER void CPed::SetMoveAnim(void) { EAXJMP(0x4C5A40); }
WRAPPER void CPed::WanderPath(void) { EAXJMP(0x4D28D0); }
-WRAPPER void CPed::SetEnterCar_AllClear(CVehicle*, uint32, uint32) { EAXJMP(0x4E0A40); }
WRAPPER bool CPed::WarpPedToNearEntityOffScreen(CEntity*) { EAXJMP(0x4E5570); }
-WRAPPER void CPed::SetObjective(eObjective, CVector) { EAXJMP(0x4D8A90); }
WRAPPER void CPed::SetObjective(eObjective, CVector, float) { EAXJMP(0x4D8770); }
WRAPPER void CPed::SetCarJack(CVehicle*) { EAXJMP(0x4E0220); }
WRAPPER void CPed::WarpPedToNearLeaderOffScreen(void) { EAXJMP(0x4E52A0); }
@@ -574,9 +571,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_fAngleToEvent = 0.0f;
m_numNearPeds = 0;
- for (int i = 0; i < 10; i++) {
+ for (int i = 0; i < ARRAY_SIZE(m_nearPeds); i++) {
m_nearPeds[i] = nil;
- if (i < 8) {
+ if (i < ARRAY_SIZE(m_pPathNodesStates)) {
m_pPathNodesStates[i] = nil;
}
}
@@ -2148,7 +2145,7 @@ CPed::BuildPedLists(void)
{
if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) % 16) {
- for(int i = 0; i < 10; ) {
+ for(int i = 0; i < ARRAY_SIZE(m_nearPeds); ) {
if (m_nearPeds[i]) {
if (m_nearPeds[i]->IsPointerValid()) {
float distSqr = (GetPosition() - m_nearPeds[i]->GetPosition()).MagnitudeSqr2D();
@@ -2159,7 +2156,7 @@ CPed::BuildPedLists(void)
}
// If we arrive here, the ped we're checking isn't "near", so we should remove it.
- for (int j = i; j < 9; j++) {
+ for (int j = i; j < ARRAY_SIZE(m_nearPeds) - 1; j++) {
m_nearPeds[j] = m_nearPeds[j + 1];
m_nearPeds[j + 1] = nil;
}
@@ -2194,14 +2191,14 @@ CPed::BuildPedLists(void)
}
gapTempPedList[gnNumTempPedList] = nil;
SortPeds(gapTempPedList, 0, gnNumTempPedList - 1);
- for (m_numNearPeds = 0; m_numNearPeds < 10; m_numNearPeds++) {
+ for (m_numNearPeds = 0; m_numNearPeds < ARRAY_SIZE(m_nearPeds); m_numNearPeds++) {
CPed *ped = gapTempPedList[m_numNearPeds];
if (!ped)
break;
m_nearPeds[m_numNearPeds] = ped;
}
- for (int pedToClear = m_numNearPeds; pedToClear < 10; pedToClear++)
+ for (int pedToClear = m_numNearPeds; pedToClear < ARRAY_SIZE(m_nearPeds); pedToClear++)
m_nearPeds[pedToClear] = nil;
}
}
@@ -3946,7 +3943,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
}
*/
}
- for (int i = 0; i < 8; i++) {
+ for (int i = 0; i < ARRAY_SIZE(m_pMyVehicle->pPassengers); i++) {
CPed* passenger = m_pMyVehicle->pPassengers[i];
if (passenger && passenger != this && damagedBy)
passenger->ReactToAttack(damagedBy);
@@ -5499,7 +5496,7 @@ CPed::CollideWithPed(CPed *collideWith)
int colliderIsAtPlayerSafePosID = -1;
int weAreAtPlayerSafePosID = -1;
- for (int i = 0; i < 6; i++) {
+ for (int i = 0; i < ARRAY_SIZE(((CPlayerPed*)m_pedInObjective)->m_pPedAtSafePos); i++) {
CPed *pedAtSafePos = ((CPlayerPed*)m_pedInObjective)->m_pPedAtSafePos[i];
if (pedAtSafePos == this) {
weAreAtPlayerSafePosID = i;
@@ -5924,7 +5921,12 @@ void
CPed::SetSeek(CVector pos, float distanceToCountDone)
{
if (!IsPedInControl()
+ // FIX: Directly comparing floats are bad.
+#ifdef FIX_BUGS
+ || (m_nPedState == PED_SEEK_POS && Abs(m_vecSeekPos.x - pos.x) < 0.01f && Abs(m_vecSeekPos.y - pos.y) < 0.01f))
+#else
|| (m_nPedState == PED_SEEK_POS && m_vecSeekPos.x == pos.x && m_vecSeekPos.y == pos.y))
+#endif
return;
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_M16
@@ -10334,6 +10336,29 @@ CPed::ProcessControl(void)
break;
}
+ CPad* pad = CPad::GetPad(0);
+
+#ifdef CAR_AIRBREAK
+ if (!pad->ArePlayerControlsDisabled()) {
+ if (pad->GetHorn()) {
+ if (pad->GetAccelerate()) {
+ m_pMyVehicle->ApplyMoveForce(GetForward() * 30.0f);
+ } else if (pad->GetBrake()) {
+ m_pMyVehicle->ApplyMoveForce(-GetForward() * 30.0f);
+ } else {
+ int16 lr = pad->GetSteeringLeftRight();
+ if (lr < 0) {
+ //m_pMyVehicle->ApplyTurnForce(20.0f * -GetRight(), GetForward());
+ m_pMyVehicle->ApplyMoveForce(-GetRight() * 30.0f);
+ } else if (lr > 0) {
+ m_pMyVehicle->ApplyMoveForce(GetRight() * 30.0f);
+ } else {
+ m_pMyVehicle->ApplyMoveForce(0.0f, 0.0f, 50.0f);
+ }
+ }
+ }
+ }
+#endif
float steerAngle = m_pMyVehicle->m_fSteerAngle;
CAnimBlendAssociation *lDriveAssoc;
CAnimBlendAssociation *rDriveAssoc;
@@ -11369,7 +11394,11 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
}
}
}
- if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
+ if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER
+#ifdef VC_PED_PORTS
+ || ped->m_nPedState == PED_CARJACK
+#endif
+ )
veh->bIsBeingCarJacked = false;
if (veh->m_nNumGettingIn)
@@ -11380,6 +11409,9 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh->IsBoat()) {
if (ped->IsPlayer()) {
+#ifdef VC_PED_PORTS
+ CCarCtrl::RegisterVehicleOfInterest(veh);
+#endif
if (veh->m_status == STATUS_SIMPLE) {
veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.00001f);
veh->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
@@ -11423,8 +11455,12 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
for (int i = 0; i < veh->m_nNumMaxPassengers; ++i) {
CPed *passenger = veh->pPassengers[i];
- if (passenger && passenger->CharCreatedBy == RANDOM_CHAR)
+ if (passenger && passenger->CharCreatedBy == RANDOM_CHAR) {
passenger->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh);
+#ifdef VC_PED_PORTS
+ passenger->m_leaveCarTimer = CTimer::GetTimeInMilliseconds();
+#endif
+ }
}
} else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
if (ped->m_nPedState == PED_CARJACK) {
@@ -16554,6 +16590,264 @@ CPed::WarpPedIntoCar(CVehicle *car)
bChangedSeat = true;
}
+void
+CPed::SetObjective(eObjective newObj, CVector dest)
+{
+ if (DyingOrDead())
+ return;
+
+ if (m_prevObjective != OBJECTIVE_NONE && m_prevObjective == newObj)
+ return;
+
+ SetObjectiveTimer(0);
+ if (m_objective == newObj) {
+ if (newObj == OBJECTIVE_GOTO_AREA_ANY_MEANS || newObj == OBJECTIVE_GOTO_AREA_ON_FOOT || newObj == OBJECTIVE_RUN_TO_AREA) {
+ if (m_nextRoutePointPos == dest)
+ return;
+ } else if (newObj == OBJECTIVE_GUARD_SPOT) {
+ if (m_vecSeekPosEx == dest)
+ return;
+ }
+ }
+
+#ifdef VC_PED_PORTS
+ ClearPointGunAt();
+#endif
+ bObjectiveCompleted = false;
+ switch (newObj) {
+ case OBJECTIVE_GUARD_SPOT:
+ m_vecSeekPosEx = dest;
+ m_distanceToCountSeekDoneEx = 5.0f;
+ SetMoveState(PEDMOVE_STILL);
+ break;
+ case OBJECTIVE_GUARD_AREA:
+ case OBJECTIVE_WAIT_IN_CAR:
+ case OBJECTIVE_WAIT_IN_CAR_THEN_GETOUT:
+ case OBJECTIVE_KILL_CHAR_ON_FOOT:
+ case OBJECTIVE_KILL_CHAR_ANY_MEANS:
+ case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE:
+ case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS:
+ case OBJECTIVE_GOTO_CHAR_ON_FOOT:
+ case OBJECTIVE_FOLLOW_PED_IN_FORMATION:
+ case OBJECTIVE_LEAVE_VEHICLE:
+ case OBJECTIVE_ENTER_CAR_AS_PASSENGER:
+ case OBJECTIVE_ENTER_CAR_AS_DRIVER:
+ case OBJECTIVE_FOLLOW_CAR_IN_CAR:
+ case OBJECTIVE_FIRE_AT_OBJ_FROM_VEHICLE:
+ case OBJECTIVE_DESTROY_OBJ:
+ case OBJECTIVE_DESTROY_CAR:
+ break;
+ case OBJECTIVE_GOTO_AREA_ANY_MEANS:
+ case OBJECTIVE_GOTO_AREA_ON_FOOT:
+ bIsRunning = false;
+ m_pNextPathNode = nil;
+ m_nextRoutePointPos = dest;
+ m_vecSeekPos = m_nextRoutePointPos;
+ m_distanceToCountSeekDone = 0.5f;
+ bUsePedNodeSeek = true;
+ if (sq(m_distanceToCountSeekDone) > (m_nextRoutePointPos - GetPosition()).MagnitudeSqr2D())
+ return;
+ break;
+ case OBJECTIVE_RUN_TO_AREA:
+ bIsRunning = true;
+ m_pNextPathNode = nil;
+ m_nextRoutePointPos = dest;
+ m_vecSeekPos = m_nextRoutePointPos;
+ m_distanceToCountSeekDone = 0.5f;
+ bUsePedNodeSeek = true;
+ if (sq(m_distanceToCountSeekDone) > (m_nextRoutePointPos - GetPosition()).MagnitudeSqr2D())
+ return;
+ break;
+ }
+
+ if (IsTemporaryObjective(m_objective)) {
+ m_prevObjective = newObj;
+ } else {
+ if (m_objective != newObj)
+ SetStoredObjective();
+
+ m_objective = newObj;
+ }
+}
+
+void
+CPed::SetMoveAnim(void)
+{
+ if (m_nStoredMoveState == m_nMoveState || !IsPedInControl())
+ return;
+
+ if (m_nMoveState == PEDMOVE_NONE) {
+ m_nStoredMoveState = PEDMOVE_NONE;
+ return;
+ }
+
+ AssocGroupId animGroupToUse;
+ if (m_leader && m_leader->IsPlayer())
+ animGroupToUse = ASSOCGRP_PLAYER;
+ else
+ animGroupToUse = m_animGroup;
+
+ CAnimBlendAssociation *animAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG400);
+ if (!animAssoc) {
+ CAnimBlendAssociation *fightIdleAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FIGHT_IDLE);
+ animAssoc = fightIdleAssoc;
+ if (fightIdleAssoc && m_nPedState == PED_FIGHT)
+ return;
+
+ if (fightIdleAssoc) {
+ CAnimBlendAssociation *idleAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_STANCE);
+ if (!idleAssoc || idleAssoc->blendDelta <= 0.0f) {
+ animAssoc->flags |= ASSOC_DELETEFADEDOUT;
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), animGroupToUse, ANIM_IDLE_STANCE, 8.0f);
+ }
+ }
+ }
+ if (!animAssoc) {
+ animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_TIRED);
+ if (animAssoc)
+ if (m_nWaitState == WAITSTATE_STUCK || m_nWaitState == WAITSTATE_FINISH_FLEE)
+ return;
+
+ if (animAssoc) {
+ CAnimBlendAssociation *idleAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_STANCE);
+ if (!idleAssoc || idleAssoc->blendDelta <= 0.0f) {
+ animAssoc->flags |= ASSOC_DELETEFADEDOUT;
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), animGroupToUse, ANIM_IDLE_STANCE, 4.0f);
+ }
+ }
+ }
+ if (!animAssoc) {
+ m_nStoredMoveState = m_nMoveState;
+ if (m_nMoveState == PEDMOVE_WALK || m_nMoveState == PEDMOVE_RUN || m_nMoveState == PEDMOVE_SPRINT) {
+ for (CAnimBlendAssociation *assoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_PARTIAL);
+ assoc; assoc = RpAnimBlendGetNextAssociation(assoc, ASSOC_PARTIAL)) {
+
+ if (!(assoc->flags & ASSOC_FADEOUTWHENDONE)) {
+ assoc->blendDelta = -2.0f;
+ assoc->flags |= ASSOC_DELETEFADEDOUT;
+ }
+ }
+
+ ClearAimFlag();
+ ClearLookFlag();
+ }
+
+ switch (m_nMoveState) {
+ case PEDMOVE_STILL:
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), animGroupToUse, ANIM_IDLE_STANCE, 4.0f);
+ break;
+ case PEDMOVE_WALK:
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), animGroupToUse, ANIM_WALK, 1.0f);
+ break;
+ case PEDMOVE_RUN:
+ if (m_nPedState == PED_FLEE_ENTITY) {
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), animGroupToUse, ANIM_RUN, 3.0f);
+ } else {
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), animGroupToUse, ANIM_RUN, 1.0f);
+ }
+ break;
+ case PEDMOVE_SPRINT:
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), animGroupToUse, ANIM_SPRINT, 1.0f);
+ break;
+ default:
+ break;
+ }
+
+ if (animAssoc) {
+ if (m_leader) {
+ CAnimBlendAssociation *walkAssoc = RpAnimBlendClumpGetAssociation(m_leader->GetClump(), ANIM_WALK);
+ if (!walkAssoc)
+ walkAssoc = RpAnimBlendClumpGetAssociation(m_leader->GetClump(), ANIM_RUN);
+
+ if (!walkAssoc)
+ walkAssoc = RpAnimBlendClumpGetAssociation(m_leader->GetClump(), ANIM_SPRINT);
+
+ if (walkAssoc) {
+ animAssoc->speed = walkAssoc->speed;
+ } else {
+ if (CharCreatedBy == MISSION_CHAR)
+ animAssoc->speed = 1.0f;
+ else
+ animAssoc->speed = 1.2f - m_randomSeed * 0.4f / MYRAND_MAX;
+
+ }
+ } else {
+ if (CharCreatedBy == MISSION_CHAR)
+ animAssoc->speed = 1.0f;
+ else
+ animAssoc->speed = 1.2f - m_randomSeed * 0.4f / MYRAND_MAX;
+ }
+ }
+ }
+}
+
+void
+CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
+{
+ float zDiff = 0.0f;
+ if (!IsPlayer() || GetWeapon()->m_eWeaponType != WEAPONTYPE_UZI) {
+ // RemoveWeaponWhenEnteringVehicle in VC
+ if (IsPlayer() && HasWeapon(WEAPONTYPE_UZI) && GetWeapon(WEAPONTYPE_UZI).m_nAmmoTotal > 0) {
+ if (m_storedWeapon == WEAPONTYPE_UNIDENTIFIED)
+ m_storedWeapon = GetWeapon()->m_eWeaponType;
+ SetCurrentWeapon(WEAPONTYPE_UZI);
+ } else {
+ CWeaponInfo *ourWeapon = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
+ RemoveWeaponModel(ourWeapon->m_nModelId);
+ }
+ }
+ car->m_nGettingInFlags |= doorFlag;
+ bVehEnterDoorIsBlocked = false;
+ if (m_nPedState != PED_SEEK_CAR && m_nPedState != PED_SEEK_IN_BOAT)
+ SetStoredState();
+
+ m_pSeekTarget = car;
+ m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget);
+ m_vehEnterType = doorNode;
+ m_nPedState = PED_ENTER_CAR;
+ if (m_vehEnterType == CAR_DOOR_RF && m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && car->m_vehType != VEHICLE_TYPE_BIKE) {
+ car->bIsBeingCarJacked = true;
+ }
+
+ m_pMyVehicle = (CVehicle*)m_pSeekTarget;
+ m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle);
+ ((CVehicle*)m_pSeekTarget)->m_nNumGettingIn++;
+ bUsesCollision = false;
+ CVector doorOpenPos = GetPositionToOpenCarDoor(car, m_vehEnterType);
+
+ // Because buses have stairs
+ if (!m_pMyVehicle->bIsBus)
+ zDiff = max(0.0f, doorOpenPos.z - GetPosition().z);
+
+ m_vecOffsetSeek = doorOpenPos - GetPosition();
+ m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 600;
+ if (car->IsBoat()) {
+ m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT, 100.0f);
+#ifdef VC_PED_PORTS
+ m_ped_flagI4 = true;
+ PedSetInCarCB(nil, this);
+#else
+ m_pVehicleAnim->SetFinishCallback(PedSetInCarCB, this);
+#endif
+ if (IsPlayer())
+ CWaterLevel::AllocateBoatWakeArray();
+ } else {
+ if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR) {
+ if (zDiff <= 4.4f) {
+ m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGN_RHS, 4.0f);
+ } else {
+ m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGNHI_RHS, 4.0f);
+ }
+ } else if (zDiff <= 4.4f) {
+ m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGN_LHS, 4.0f);
+ } else {
+ m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGNHI_LHS, 4.0f);
+ }
+ m_pVehicleAnim->SetFinishCallback(PedAnimAlignCB, this);
+ car->AutoPilot.m_nCruiseSpeed = 0;
+ }
+}
+
class CPed_ : public CPed
{
public:
@@ -16569,6 +16863,7 @@ public:
void Render_(void) { CPed::Render(); }
void PreRender_(void) { CPed::PreRender(); }
int32 ProcessEntityCollision_(CEntity *collidingEnt, CColPoint *collidingPoints) { return CPed::ProcessEntityCollision(collidingEnt, collidingPoints); }
+ void SetMoveAnim_(void) { CPed::SetMoveAnim(); }
};
STARTPATCHES
@@ -16583,6 +16878,7 @@ STARTPATCHES
InjectHook(0x4D03F0, &CPed_::Render_, PATCH_JUMP);
InjectHook(0x4CBB30, &CPed_::ProcessEntityCollision_, PATCH_JUMP);
InjectHook(0x4CFDD0, &CPed_::PreRender_, PATCH_JUMP);
+ InjectHook(0x4C5A40, &CPed_::SetMoveAnim_, PATCH_JUMP);
InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP);
InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP);
@@ -16622,6 +16918,7 @@ STARTPATCHES
InjectHook(0x4D82C0, (void (CPed::*)(eObjective)) &CPed::SetObjective, PATCH_JUMP);
InjectHook(0x4D83E0, (void (CPed::*)(eObjective, void*)) &CPed::SetObjective, PATCH_JUMP);
InjectHook(0x4D89A0, (void (CPed::*)(eObjective, int16, int16)) &CPed::SetObjective, PATCH_JUMP);
+ InjectHook(0x4D8A90, (void (CPed::*)(eObjective, CVector)) &CPed::SetObjective, PATCH_JUMP);
InjectHook(0x4DDEC0, &CPed::ReactToAttack, PATCH_JUMP);
InjectHook(0x4D0600, &CPed::SetIdle, PATCH_JUMP);
InjectHook(0x4E0E00, &CPed::QuitEnteringCar, PATCH_JUMP);
@@ -16777,4 +17074,5 @@ STARTPATCHES
InjectHook(0x4D8F30, &CPed::UpdateFromLeader, PATCH_JUMP);
InjectHook(0x4D4970, &CPed::SetPedPositionInCar, PATCH_JUMP);
InjectHook(0x4D7D20, &CPed::WarpPedIntoCar, PATCH_JUMP);
+ InjectHook(0x4E0A40, &CPed::SetEnterCar_AllClear, PATCH_JUMP);
ENDPATCHES \ No newline at end of file
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 50a8bfec..edf6b878 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -363,7 +363,7 @@ public:
uint8 bShakeFist : 1; // test shake hand at look entity
uint8 bNoCriticalHits : 1; // if set, limbs won't came off
- uint8 m_ped_flagI4 : 1; // we've been put to car by script? - related with cars
+ uint8 m_ped_flagI4 : 1; // we've been put to car by script or without align phase? - related with cars
uint8 bHasAlreadyBeenRecorded : 1;
uint8 bFallenDown : 1;
#ifdef VC_PED_PORTS
@@ -499,8 +499,8 @@ public:
uint32 m_soundStart;
uint16 m_lastQueuedSound;
uint16 m_queuedSound;
- CVector m_vecSeekPosEx; // used in objectives
- float m_distanceToCountSeekDoneEx; // used in objectives
+ CVector m_vecSeekPosEx; // used for OBJECTIVE_GUARD_SPOT
+ float m_distanceToCountSeekDoneEx; // used for OBJECTIVE_GUARD_SPOT
static void *operator new(size_t);
static void *operator new(size_t, int);
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 8322c22a..78a4e5b4 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -24,6 +24,8 @@ bool gbShowPedRoadGroups;
bool gbShowCarRoadGroups;
bool gbShowCollisionPolys;
bool gbShowCollisionLines;
+bool gbShowCullZoneDebugStuff;
+bool gbBigWhiteDebugLightSwitchedOn;
bool gbDontRenderBuildings;
bool gbDontRenderBigBuildings;
diff --git a/src/render/Renderer.h b/src/render/Renderer.h
index ea49ed4e..89fc23cb 100644
--- a/src/render/Renderer.h
+++ b/src/render/Renderer.h
@@ -6,6 +6,8 @@ extern bool gbShowPedRoadGroups;
extern bool gbShowCarRoadGroups;
extern bool gbShowCollisionPolys;
extern bool gbShowCollisionLines;
+extern bool gbShowCullZoneDebugStuff;
+extern bool gbBigWhiteDebugLightSwitchedOn;
extern bool gbDontRenderBuildings;
extern bool gbDontRenderBigBuildings;
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 30446894..8bd2037e 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -1014,7 +1014,7 @@ CAutomobile::ProcessControl(void)
m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
FlyingControl(FLIGHT_MODEL_DODO);
}else if(GetModelIndex() == MI_MIAMI_RCBARON){
- FlyingControl(FLIGHT_MODEL_HELI);
+ FlyingControl(FLIGHT_MODEL_RCPLANE);
}else if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW || bAllCarCheat){
if(CPad::GetPad(0)->GetCircleJustDown())
m_aWheelSpeed[0] = max(m_aWheelSpeed[0]-0.03f, 0.0f);