Radar, WaterCannon, win/glfw skels

This commit is contained in:
eray orçunus 2020-10-14 18:07:05 +03:00
parent 7bf2373fed
commit b98864d134
12 changed files with 622 additions and 350 deletions

View File

@ -332,14 +332,12 @@ project "reVC"
links { "rw" }
filter "platforms:*d3d9*"
defines { "USE_D3D9" }
links { "d3d9" }
filter "platforms:*x86*d3d*"
includedirs { "sdk/dx8sdk/include" }
libdirs { "sdk/dx8sdk/lib" }
filter "platforms:*amd64*d3d9*"
defines { "USE_D3D9" }
filter "platforms:win-x86*gl3_glfw*"
libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") }

View File

@ -288,8 +288,8 @@ class CTheScripts
static uint16 ScriptsUpdated;
static uint32 LastMissionPassedTime;
static uint16 NumberOfExclusiveMissionScripts;
static bool bPlayerIsInTheStatium;
public:
static bool bPlayerIsInTheStatium;
static uint8 RiotIntensity;
static bool bPlayerHasMetDebbieHarry;
public:
@ -562,4 +562,4 @@ void RetryMission(int, int);
#ifdef USE_DEBUG_SCRIPT_LOADER
extern int scriptToLoad;
#endif
#endif

View File

@ -4578,19 +4578,13 @@ CMenuManager::UnloadTextures()
CUserDisplay::PlaceName.ProcessAfterFrontEndShutDown();
}
// --MIAMI: Done
void
CMenuManager::WaitForUserCD()
{
CSprite2d *splash;
char *splashscreen = nil;
#if (!(defined RANDOMSPLASH) && !(defined GTA3_1_1_PATCH))
if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
splashscreen = "mainsc2";
else
splashscreen = "mainsc1";
#endif
splash = LoadSplash(splashscreen);
if (RsGlobal.quit)
@ -4742,6 +4736,53 @@ CMenuManager::PrintMap(void)
}
CRadar::DrawBlips();
if (m_PrefsShowLegends) {
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(40.0f));
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(84.0f));
CFont::SetBackGroundOnlyTextOff();
CFont::SetColor(CRGBA(255, 150, 225, FadeIn(255)));
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::SetCentreOn();
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(SCREEN_SCALE_X(0.65f), SCREEN_SCALE_Y(0.95f));
int secondColumnStart = (CRadar::MapLegendCounter - 1) / 2;
int boxBottom = MENU_Y(100.0f);
// + 3, because we want 19*3 px padding
for (int i = 0; i < secondColumnStart + 3; i++) {
boxBottom += MENU_Y(19.f);
}
CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(95.0f), MENU_Y(100.0f), MENU_X_LEFT_ALIGNED(555.f), boxBottom),
CRGBA(0, 0, 0, FadeIn(190)));
CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), MENU_Y(102.0f), TheText.Get("FE_MLG"));
CFont::SetRightJustifyOff();
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
if (m_PrefsLanguage == LANGUAGE_AMERICAN)
CFont::SetScale(SCREEN_SCALE_X(0.55f), SCREEN_SCALE_Y(0.55f));
else
CFont::SetScale(SCREEN_SCALE_X(0.45f), SCREEN_SCALE_Y(0.55f));
CFont::SetColor(CRGBA(225, 225, 225, FadeIn(255)));
CFont::SetDropShadowPosition(0);
int y = MENU_Y(127.0f);
int x = MENU_X_LEFT_ALIGNED(160.0f);
for (int16 i = 0; i < CRadar::MapLegendCounter; i++) {
CRadar::DrawLegend(x, y, CRadar::MapLegendList[i]);
if (i == secondColumnStart) {
x = MENU_X_LEFT_ALIGNED(350.0f);
y = MENU_Y(127.0f);
} else {
y += MENU_Y(19.0f);
}
}
}
#ifdef CUSTOM_MAP
CVector2D mapPoint;
@ -4820,7 +4861,7 @@ CMenuManager::PrintMap(void)
#endif
m_bMenuMapActive = false;
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(5.0f));
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(10.0f));
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(10.0f));
DisplayHelperText("FEH_MPH");
}

File diff suppressed because it is too large Load Diff

View File

@ -96,6 +96,17 @@ enum eRadarSprite
RADAR_SPRITE_COUNT
};
enum
{
RADAR_TRACE_RED,
RADAR_TRACE_GREEN,
RADAR_TRACE_LIGHT_BLUE,
RADAR_TRACE_GRAY,
RADAR_TRACE_YELLOW,
RADAR_TRACE_MAGENTA,
RADAR_TRACE_CYAN
};
enum
{
BLIP_MODE_TRIANGULAR_UP = 0,
@ -104,6 +115,26 @@ enum
};
struct sRadarTrace
{
uint32 m_nColor;
uint32 m_eBlipType; // eBlipType
int32 m_nEntityHandle;
CVector m_vec2DPos;
CVector m_vecPos;
uint16 m_BlipIndex;
bool m_bDim;
bool m_bInUse;
bool m_bShortRange;
bool m_unused;
float m_Radius;
int16 m_wScale;
uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_eRadarSprite; // eRadarSprite
};
// Either that was a thing while saving/loading blips, or they added sizes of each field one by one. I want to do the former.
#pragma pack(push,1)
struct sRadarTraceSave
{
uint32 m_nColor;
uint32 m_eBlipType; // eBlipType
@ -114,11 +145,13 @@ struct sRadarTrace
bool m_bDim;
bool m_bInUse;
bool m_bShortRange;
bool m_unused;
float m_Radius;
int16 m_wScale;
uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_eRadarSprite; // eRadarSprite
};
#pragma pack(pop)
// Values for screen space
#define RADAR_LEFT (40.0f)
@ -176,7 +209,7 @@ public:
static CRGBA ArrowBlipColour1;
static CRGBA ArrowBlipColour2;
static int16 MapLegendList[NUM_MAP_LEGENDS];
static uint16 MapLegendCounter;
static int16 MapLegendCounter;
#ifdef MAP_ENHANCEMENTS
static int TargetMarkerId;
@ -215,9 +248,9 @@ public:
static void RemoveRadarSections();
static void SaveAllRadarBlips(uint8*, uint32*);
static void SetBlipSprite(int32 i, int32 icon);
static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
static int32 SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay);
static int32 SetShortRangeCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
static int32 SetCoordBlip(eBlipType type, CVector pos, uint32, eBlipDisplay);
static int32 SetEntityBlip(eBlipType type, int32, uint32, eBlipDisplay);
static int32 SetShortRangeCoordBlip(eBlipType type, CVector pos, uint32, eBlipDisplay);
static void SetRadarMarkerState(int32 i, bool flag);
static void ShowRadarMarker(CVector pos, uint32 color, float radius);
static void ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha);
@ -229,7 +262,8 @@ public:
static void TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in);
static void TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in);
static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in);
// no in CRadar in the game:
static void CalculateCachedSinCos();
static void DrawEntityBlip(int32 blipId);
static void DrawCoordBlip(int32 blipId);
static void DrawLegend(int32, int32, int32);
};

View File

@ -172,7 +172,6 @@ enum Config {
# define RANDOMSPLASH
# define VU_COLLISION
#elif defined GTA_PC
# define GTA3_1_1_PATCH
//# define GTA3_STEAM_PATCH
//# define GTAVC_JP_PATCH
# ifdef GTA_PS2_STUFF
@ -263,7 +262,6 @@ enum Config {
// Hud, frontend and radar
//#define BETA_SLIDING_TEXT
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define PC_MENU
#ifndef PC_MENU

View File

@ -88,14 +88,10 @@ public:
if(type == EFFECT_LIGHT){
if(light.corona)
RwTextureDestroy(light.corona);
#ifdef GTA3_1_1_PATCH
light.corona = nil;
#endif
if(light.shadow)
RwTextureDestroy(light.shadow);
#ifdef GTA3_1_1_PATCH
light.shadow = nil;
#endif
}
}
};

View File

@ -11,6 +11,9 @@
#include "Fire.h"
#include "WaterLevel.h"
#include "Camera.h"
#include "Particle.h"
// --MIAMI: file done
#define WATERCANNONVERTS 4
#define WATERCANNONINDEXES 12
@ -64,7 +67,7 @@ void CWaterCannon::Update_OncePerFrame(int16 index)
if (CTimer::GetTimeInMilliseconds() > m_nTimeCreated + WATERCANNON_LIFETIME )
{
m_nCur = (m_nCur + 1) % -NUM_SEGMENTPOINTS;
m_nCur = (m_nCur + 1) % NUM_SEGMENTPOINTS;
m_abUsed[m_nCur] = false;
}
@ -128,7 +131,7 @@ void CWaterCannon::Render(void)
RwIm3DVertexSetV(&WaterCannonVertices[2], v);
RwIm3DVertexSetV(&WaterCannonVertices[3], v);
int16 pointA = m_nCur % -NUM_SEGMENTPOINTS;
int16 pointA = m_nCur % NUM_SEGMENTPOINTS;
int16 pointB = pointA - 1;
if ( (pointA - 1) < 0 )
@ -235,11 +238,16 @@ void CWaterCannon::PushPeds(void)
ped->m_vecMoveSpeed.x = (0.6f * m_avecVelocity[j].x + ped->m_vecMoveSpeed.x) * 0.5f;
ped->m_vecMoveSpeed.y = (0.6f * m_avecVelocity[j].y + ped->m_vecMoveSpeed.y) * 0.5f;
ped->SetFall(2000, AnimationId(ANIM_KO_SKID_FRONT + localDir), 0);
CFire *fire = ped->m_pFire;
if ( fire )
fire->Extinguish();
float pedSpeed2D = ped->m_vecMoveSpeed.Magnitude2D();
if ( pedSpeed2D > 0.2f ) {
ped->m_vecMoveSpeed.x *= (0.2f / pedSpeed2D);
ped->m_vecMoveSpeed.y *= (0.2f / pedSpeed2D);
}
ped->SetFall(2000, (AnimationId)(localDir + ANIM_KO_SKID_FRONT), 0);
CParticle::AddParticle(PARTICLE_STEAM_NY_SLOWMOTION, ped->GetPosition(), ped->m_vecMoveSpeed * 0.3f, 0, 0.5f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, ped->GetPosition(), ped->m_vecMoveSpeed * -0.3f + CVector(0.f, 0.f, 0.5f), 0, 0.5f,
CGeneral::GetRandomNumberInRange(0.f, 10.f), CGeneral::GetRandomNumberInRange(0.f, 90.f), 1);
j = NUM_SEGMENTPOINTS;
}

View File

@ -534,12 +534,13 @@ CameraSize(RwCamera * camera, RwRect * rect,
}
}
// BUG: game just changes camera raster's sizes, but this is a hack
if (( origSize.w != rect->w ) && ( origSize.h != rect->h ))
if (( origSize.w != rect->w ) || ( origSize.h != rect->h ))
{
RwRaster *raster;
RwRaster *zRaster;
// BUG: game just changes camera raster's sizes, but this is a hack
#ifdef FIX_BUGS
/*
* Destroy rasters...
*/
@ -597,6 +598,13 @@ CameraSize(RwCamera * camera, RwRect * rect,
RwCameraSetRaster(camera, raster);
RwCameraSetZRaster(camera, zRaster);
}
#else
raster = RwCameraGetRaster(camera);
zRaster = RwCameraGetZRaster(camera);
raster->width = zRaster->width = rect->w;
raster->height = zRaster->height = rect->h;
#endif
}
/* Figure out the view window */

View File

@ -152,7 +152,7 @@ const char *_psGetUserFilesFolder()
&KeycbData) == ERROR_SUCCESS )
{
RegCloseKey(hKey);
strcat(szUserFiles, "\\GTA3 User Files");
strcat(szUserFiles, "\\GTA Vice City User Files");
_psCreateFolder(szUserFiles);
return szUserFiles;
}
@ -386,10 +386,6 @@ psInitialize(void)
InitialiseLanguage();
#ifndef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
gGameState = GS_START_UP;
@ -422,7 +418,7 @@ psInitialize(void)
}
else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
{
if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion == 1 )
if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion != 0 )
{
debug("Operating System is Win98\n");
_dwOperatingSystemVersion = OS_WIN98;
@ -439,13 +435,9 @@ psInitialize(void)
#ifndef PS2_MENU
#ifdef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
#ifdef _WIN32
MEMORYSTATUS memstats;
@ -1250,14 +1242,17 @@ void resizeCB(GLFWwindow* window, int width, int height) {
* memory things don't work.
*/
/* redraw window */
if (RwInitialised && (gGameState == GS_PLAYING_GAME
#ifndef MASTER
|| gGameState == GS_ANIMVIEWER
#endif
))
if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER))
{
RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void*)TRUE);
RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE);
}
#else
if (RwInitialised && gGameState == GS_PLAYING_GAME)
{
RsEventHandler(rsIDLE, (void *)TRUE);
}
#endif
if (RwInitialised && height > 0 && width > 0) {
RwRect r;
@ -1765,6 +1760,7 @@ main(int argc, char *argv[])
printf("Into TheGame!!!\n");
#else
LoadingScreen(nil, nil, "loadsc0");
// LoadingScreen(nil, nil, "loadsc0"); // duplicate
#endif
if ( !CGame::InitialiseOnceAfterRW() )
RsGlobal.quit = TRUE;
@ -1781,6 +1777,7 @@ main(int argc, char *argv[])
case GS_INIT_FRONTEND:
{
LoadingScreen(nil, nil, "loadsc0");
// LoadingScreen(nil, nil, "loadsc0"); // duplicate
FrontEndMenuManager.m_bGameNotLoaded = true;

View File

@ -8,7 +8,7 @@
#define IDEXIT 1002
#define IDC_SELECTDEVICE 1005
#define IDI_MAIN_ICON 1042
#define IDI_MAIN_ICON 100
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED

View File

@ -189,7 +189,7 @@ const char *_psGetUserFilesFolder()
&KeycbData) == ERROR_SUCCESS )
{
RegCloseKey(hKey);
strcat(szUserFiles, "\\GTA3 User Files");
strcat(szUserFiles, "\\GTA Vice City User Files");
_psCreateFolder(szUserFiles);
return szUserFiles;
}
@ -650,10 +650,6 @@ psInitialize(void)
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
InitialiseLanguage();
#ifndef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
gGameState = GS_START_UP;
@ -688,7 +684,7 @@ psInitialize(void)
}
else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
{
if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion == 1 )
if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion != 0 )
{
debug("Operating System is Win98\n");
_dwOperatingSystemVersion = OS_WIN98;
@ -701,11 +697,7 @@ psInitialize(void)
}
#ifndef PS2_MENU
#ifdef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
dwDXVersion = GetDXVersion();
@ -945,8 +937,7 @@ void HandleGraphEvent(void)
/*
*****************************************************************************
*/
*/
LRESULT CALLBACK
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
{
@ -1016,10 +1007,17 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
RECT rect;
/* redraw window */
#ifndef MASTER
if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER))
{
RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE);
}
#else
if (RwInitialised && gGameState == GS_PLAYING_GAME)
{
RsEventHandler(rsIDLE, (void *)TRUE);
}
#endif
/* Manually resize window */
rect.left = rect.top = 0;
@ -1327,7 +1325,7 @@ InitApplication(HANDLE instance)
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = (HINSTANCE)instance;
windowClass.hIcon = nil;
windowClass.hIcon = LoadIcon((HINSTANCE)instance, (LPCSTR)IDI_MAIN_ICON);
windowClass.hCursor = LoadCursor(nil, IDC_ARROW);
windowClass.hbrBackground = nil;
windowClass.lpszMenuName = NULL;
@ -1382,17 +1380,17 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
#endif
if ( mode.Width == width && mode.Height == height && mode.Format == format )
{
if ( mode.RefreshRate == 0 )
if ( mode.RefreshRate == 0 ) {
d3d->Release();
return 0;
}
if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 )
refreshRate = mode.RefreshRate;
}
}
#ifdef FIX_BUGS
d3d->Release();
#endif
if ( refreshRate == -1 )
return -1;
@ -2255,6 +2253,8 @@ WinMain(HINSTANCE instance,
if ( startupDeactivate || ControlsManager.GetJoyButtonJustDown() != 0 )
++gGameState;
else if ( CPad::GetPad(0)->NewState.CheckForInput() )
++gGameState;
else if ( CPad::GetPad(0)->GetLeftMouseJustDown() )
++gGameState;
else if ( CPad::GetPad(0)->GetEnterJustDown() )
@ -2292,6 +2292,8 @@ WinMain(HINSTANCE instance,
if ( startupDeactivate || ControlsManager.GetJoyButtonJustDown() != 0 )
++gGameState;
else if ( CPad::GetPad(0)->NewState.CheckForInput() )
++gGameState;
else if ( CPad::GetPad(0)->GetLeftMouseJustDown() )
++gGameState;
else if ( CPad::GetPad(0)->GetEnterJustDown() )
@ -2328,6 +2330,7 @@ WinMain(HINSTANCE instance,
printf("Into TheGame!!!\n");
#else
LoadingScreen(nil, nil, "loadsc0");
// LoadingScreen(nil, nil, "loadsc0"); // duplicate
#endif
if ( !CGame::InitialiseOnceAfterRW() )
RsGlobal.quit = TRUE;
@ -2345,6 +2348,7 @@ WinMain(HINSTANCE instance,
case GS_INIT_FRONTEND:
{
LoadingScreen(nil, nil, "loadsc0");
// LoadingScreen(nil, nil, "loadsc0"); // duplicate
FrontEndMenuManager.m_bGameNotLoaded = true;