From 7a3ee349da51543f5e273df1a7d932a25602ea2a Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sat, 9 Jan 2021 01:01:41 +0300 Subject: sync with re3 -radardisc shadow fix -fix for the dimension where moon is round -correct radar based on the early gta 3 screenshot -proper scaling based on ps2 gta 3 -ini and debugmenu options --- src/core/FrontEndControls.cpp | 2 +- src/core/Frontend.cpp | 1 + src/core/Frontend_PS2.cpp | 2 +- src/core/Radar.h | 20 +++++++++++++++++++ src/core/common.h | 45 ++++++++++++++++++++++++++++++++++++------- src/core/config.h | 5 +++++ src/core/re3.cpp | 30 +++++++++++++++++++++++++++++ src/render/Draw.cpp | 22 +++++++++++++-------- src/render/Draw.h | 13 +++++++++++++ src/render/Hud.cpp | 23 ++++++++++++++++------ src/render/Sprite.cpp | 4 ++++ 11 files changed, 144 insertions(+), 23 deletions(-) diff --git a/src/core/FrontEndControls.cpp b/src/core/FrontEndControls.cpp index 68992e16..18f6b3b2 100644 --- a/src/core/FrontEndControls.cpp +++ b/src/core/FrontEndControls.cpp @@ -7,7 +7,7 @@ #include "FrontEndControls.h" #define X SCREEN_SCALE_X -#define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL))) +#define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(SCREEN_HEIGHT_PAL))) void CPlaceableShText::Draw(float x, float y) diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 11488aec..d14f15d4 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3,6 +3,7 @@ #include #endif +#define FORCE_PC_SCALING #define WITHWINDOWS #include "common.h" #ifndef PS2_MENU diff --git a/src/core/Frontend_PS2.cpp b/src/core/Frontend_PS2.cpp index 1ccb658b..c0fcc652 100644 --- a/src/core/Frontend_PS2.cpp +++ b/src/core/Frontend_PS2.cpp @@ -43,7 +43,7 @@ void DoRWStuffEndOfFrame(void); #define X SCREEN_SCALE_X #define Y SCREEN_SCALE_Y -#define YF(x) Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL))) +#define YF(x) Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(SCREEN_HEIGHT_PAL))) //#define X(x) ((x)/640.0f*SCRW) //#define Y(y) ((y)/448.0f*SCRH) diff --git a/src/core/Radar.h b/src/core/Radar.h index 8f2e7069..0829dda6 100644 --- a/src/core/Radar.h +++ b/src/core/Radar.h @@ -156,8 +156,28 @@ struct sRadarTraceSave // Values for screen space #define RADAR_LEFT (40.0f) #define RADAR_BOTTOM (40.0f) + +#ifdef FIX_RADAR +/* + The values are from an early screenshot taken before R* broke radar + #define RADAR_WIDTH (82.0f) + #define RADAR_HEIGHT (82.0f) +*/ +#define RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (94.0f)) +#define RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (76.0f)) +#else +/* + broken since forever, someone tried to fix size for 640x512(PAL) + http://aap.rockstarvision.com/pics/gta3/ps2screens/gta3_interface.jpg + but failed: + http://aap.rockstarvision.com/pics/gta3/artwork/gta3_artwork_16.jpg + most likely the guy used something like this: + int y = 82 * (640.0/512.0)/(640.0/480.0); + int x = y * (640.0/512.0); +*/ #define RADAR_WIDTH (94.0f) #define RADAR_HEIGHT (76.0f) +#endif class CRadar { diff --git a/src/core/common.h b/src/core/common.h index 3fb2e963..2391f5fb 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -123,17 +123,43 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w) #include "skeleton.h" #include "Draw.h" -#define DEFAULT_SCREEN_WIDTH (640) -#define DEFAULT_SCREEN_HEIGHT (448) -#define DEFAULT_SCREEN_HEIGHT_PAL (512) -#define DEFAULT_SCREEN_HEIGHT_NTSC (448) +#if defined(PROPER_SCALING) + #ifdef FORCE_PC_SCALING + #define DEFAULT_SCREEN_WIDTH (640) + #define DEFAULT_SCREEN_HEIGHT (448) + #else + #define DEFAULT_SCREEN_WIDTH (640) + #define DEFAULT_SCREEN_HEIGHT (480) + #endif +#elif defined(GTA_PS2) + #define DEFAULT_SCREEN_WIDTH (640) + #define DEFAULT_SCREEN_HEIGHT (480) +#else //elif defined(GTA_PC) + #define DEFAULT_SCREEN_WIDTH (640) + #define DEFAULT_SCREEN_HEIGHT (448) +#endif + #define DEFAULT_ASPECT_RATIO (4.0f/3.0f) #define DEFAULT_VIEWWINDOW (0.7f) // game uses maximumWidth/Height, but this probably won't work // with RW windowed mode -#define SCREEN_WIDTH ((float)RsGlobal.width) +#ifdef GTA_PS2 + #ifdef GTA_PAL + #define SCREEN_WIDTH ((float)640) + #define SCREEN_HEIGHT ((float)512) + #else + #define SCREEN_WIDTH ((float)640) + #define SCREEN_HEIGHT ((float)448) + #endif +#else +#define SCREEN_WIDTH ((float)RsGlobal.width) #define SCREEN_HEIGHT ((float)RsGlobal.height) +#endif + +#define SCREEN_HEIGHT_PAL ((float)512) +#define SCREEN_HEIGHT_NTSC ((float)448) + #define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio()) #define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f))) @@ -151,8 +177,13 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w) #ifdef ASPECT_RATIO_SCALE #define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO) -extern float ScaleAndCenterX(float x); -#define SCALE_AND_CENTER_X(x) ScaleAndCenterX(x) +#define SCALE_AND_CENTER_X(x) ((SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) ? (x) : (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X((x))) +#ifdef PROPER_SCALING + #ifndef FORCE_PC_SCALING + #undef SCREEN_SCALE_Y + #define SCREEN_SCALE_Y(a) CDraw::ScaleY(SCREEN_STRETCH_Y(a)) + #endif +#endif #else #define SCREEN_SCALE_AR(a) (a) #define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x) diff --git a/src/core/config.h b/src/core/config.h index 874ff39a..38ee9712 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -252,6 +252,7 @@ enum Config { // Rendering/display #define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios +#define PROPER_SCALING // use original DEFAULT_SCREEN_WIDTH/DEFAULT_SCREEN_HEIGHT from PS2 instead of PC(R* changed HEIGHT here to make radar look better, but broke other hud elements aspect ratio). #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #define USE_TXD_CDIMAGE // generate and load textures from txd.img #define PS2_ALPHA_TEST // emulate ps2 alpha test @@ -266,6 +267,8 @@ enum Config { #define NEW_RENDERER // leeds-like world rendering, needs librw #endif +#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc) + #ifndef EXTENDED_COLOURFILTER #undef SCREEN_DROPLETS // we need the backbuffer for this effect #endif @@ -296,6 +299,8 @@ enum Config { // Hud, frontend and radar #define PC_MENU +#define FIX_RADAR // use radar size from early version before R* broke it + #ifndef PC_MENU # define PS2_MENU //# define PS2_MENU_USEALLPAGEICONS diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 0e5ed2af..80e8cb6b 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -220,6 +220,16 @@ void LoadINISettings() CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult); #endif gBackfaceCulling = CheckAndReadIniInt("Rendering", "BackfaceCulling", gBackfaceCulling); + +#ifdef PROPER_SCALING + CDraw::ms_bProperScaling = CheckAndReadIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling); +#endif +#ifdef FIX_RADAR + CDraw::ms_bFixRadar = CheckAndReadIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar); +#endif +#ifdef FIX_SPRITES + CDraw::ms_bFixSprites = CheckAndReadIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites); +#endif } void SaveINISettings() @@ -259,6 +269,16 @@ void SaveINISettings() #endif CheckAndSaveIniInt("Rendering", "BackfaceCulling", gBackfaceCulling, changed); +#ifdef PROPER_SCALING + CheckAndSaveIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling, changed); +#endif +#ifdef FIX_RADAR + CheckAndSaveIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar, changed); +#endif +#ifdef FIX_SPRITES + CheckAndSaveIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites, changed); +#endif + if (changed) cfg.write_file("reVC.ini"); } @@ -673,6 +693,16 @@ extern bool gbRenderWorld2; DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil); DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil); DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil); + +#ifdef PROPER_SCALING + DebugMenuAddVarBool8("Draw", "Proper Scaling", &CDraw::ms_bProperScaling, nil); +#endif +#ifdef FIX_RADAR + DebugMenuAddVarBool8("Draw", "Fix Radar", &CDraw::ms_bFixRadar, nil); +#endif +#ifdef FIX_SPRITES + DebugMenuAddVarBool8("Draw", "Fix Sprites", &CDraw::ms_bFixSprites, nil); +#endif #ifndef FINAL DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil); diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index 912399c9..507653f6 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -20,6 +20,16 @@ uint8 CDraw::FadeRed; uint8 CDraw::FadeGreen; uint8 CDraw::FadeBlue; +#ifdef PROPER_SCALING +bool CDraw::ms_bProperScaling = true; +#endif +#ifdef FIX_RADAR +bool CDraw::ms_bFixRadar = true; +#endif +#ifdef FIX_SPRITES +bool CDraw::ms_bFixSprites = true; +#endif + float CDraw::CalculateAspectRatio(void) { @@ -75,13 +85,9 @@ CDraw::SetFOV(float fov) ms_fFOV = fov; } -#ifdef ASPECT_RATIO_SCALE -float -ScaleAndCenterX(float x) +#ifdef PROPER_SCALING +float CDraw::ScaleY(float y) { - if (SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) - return x; - else - return (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X(x); + return ms_bProperScaling ? y : y * ((float)DEFAULT_SCREEN_HEIGHT/SCREEN_HEIGHT_NTSC); } -#endif \ No newline at end of file +#endif \ No newline at end of file diff --git a/src/render/Draw.h b/src/render/Draw.h index 2976dc34..1a63c980 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -30,6 +30,16 @@ public: static uint8 FadeRed; static uint8 FadeGreen; static uint8 FadeBlue; + +#ifdef PROPER_SCALING + static bool ms_bProperScaling; +#endif +#ifdef FIX_RADAR + static bool ms_bFixRadar; +#endif +#ifdef FIX_SPRITES + static bool ms_bFixSprites; +#endif static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; } static float GetNearClipZ(void) { return ms_fNearClipZ; } @@ -50,4 +60,7 @@ public: #endif static float GetAspectRatio(void) { return ms_fAspectRatio; } static void SetAspectRatio(float ratio) { ms_fAspectRatio = ratio; } +#ifdef PROPER_SCALING + static float ScaleY(float y); +#endif }; diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 3432f32c..b3cc5deb 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -28,6 +28,16 @@ // --MIAMI: file done +#if defined(FIX_BUGS) + #define SCREEN_SCALE_X_FIX(a) SCREEN_SCALE_X(a) + #define SCREEN_SCALE_Y_FIX(a) SCREEN_SCALE_Y(a) + #define SCALE_AND_CENTER_X_FIX(a) SCALE_AND_CENTER_X(a) +#else + #define SCREEN_SCALE_X_FIX(a) (a) + #define SCREEN_SCALE_Y_FIX(a) (a) + #define SCALE_AND_CENTER_X_FIX(a) (a) +#endif + // Game has colors inlined in code. // For easier modification we collect them here: CRGBA MONEY_COLOR(0, 207, 133, 255); @@ -1052,16 +1062,17 @@ void CHud::Draw() CRadar::DrawMap(); if (FrontEndMenuManager.m_PrefsRadarMode != 1) { CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); + + rect.Translate(SCREEN_SCALE_X_FIX(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + #ifdef FIX_BUGS - rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + rect.Grow(SCREEN_SCALE_X(6.0f), SCREEN_SCALE_X(6.0f), SCREEN_SCALE_Y(6.0f), SCREEN_SCALE_Y(6.0f)); #else - rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); -#endif - rect.Grow(6.0f); - rect.Translate(0.0f, 2.0f); +#endif + rect.Translate(SCREEN_SCALE_X_FIX(0.0f), SCREEN_SCALE_Y_FIX(2.0f)); Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); - rect.Translate(0.0f, -2.0f); + rect.Translate(SCREEN_SCALE_X_FIX(0.0f), SCREEN_SCALE_Y_FIX(-2.0f)); Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR); } CRadar::DrawBlips(); diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 401eebd0..ba6ab291 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -33,7 +33,11 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, // this is used to scale correctly if you zoom in with sniper rifle float fovScale = fov / CDraw::GetFOV(); +#ifdef FIX_SPRITES + *outw = CDraw::ms_bFixSprites ? (fovScale * recip * SCREEN_HEIGHT) : (fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH); +#else *outw = fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH; +#endif *outh = fovScale * recip * SCREEN_HEIGHT; return true; -- cgit v1.2.3 From b7f9bfda4a88393b78f0f2e09489865413f69167 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Sat, 9 Jan 2021 02:41:27 +0300 Subject: fail --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 23527e55..8cac88d6 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -3108,7 +3108,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) CollectParameters(&m_nIp, 1); script_assert(ScriptParams[0] >= 0); CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]); - m_bIsActive = true; + pNew->m_bIsActive = true; int8 type = CTheScripts::Read1ByteFromScript(&m_nIp); float tmp; for (int i = 0; type != ARGUMENT_END; type = CTheScripts::Read1ByteFromScript(&m_nIp), i++) { -- cgit v1.2.3 From 8e7cce0634a88f2794e203f97c7375b64fee4f9f Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sat, 9 Jan 2021 03:37:59 +0300 Subject: useless fix --- src/render/ParticleType.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/ParticleType.h b/src/render/ParticleType.h index 0af9a1e1..9578083d 100644 --- a/src/render/ParticleType.h +++ b/src/render/ParticleType.h @@ -88,5 +88,5 @@ enum tParticleType MAX_PARTICLES, PARTICLE_FIRST = PARTICLE_SPARK, - PARTICLE_LAST = PARTICLE_RAINDROP_2D + PARTICLE_LAST = PARTICLE_HEATHAZE_IN_DIST }; \ No newline at end of file -- cgit v1.2.3 From e473d234fd39495c92c2705ce3b129542992c8d4 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 9 Jan 2021 12:11:20 +0100 Subject: cam sector fix --- src/core/Cam.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index d4188299..731537ef 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -3947,11 +3947,11 @@ CCam::Process_Debug(const CVector&, float, float, float) } // stay inside sectors - while(CWorld::GetSectorX(Source.x) > 75.0f) + while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f) Source.x -= 1.0f; while(CWorld::GetSectorX(Source.x) < 5.0f) Source.x += 1.0f; - while(CWorld::GetSectorY(Source.y) > 75.0f) + while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f) Source.y -= 1.0f; while(CWorld::GetSectorY(Source.y) < 5.0f) Source.y += 1.0f; @@ -4018,11 +4018,11 @@ CCam::Process_Debug(const CVector&, float, float, float) } // stay inside sectors - while(CWorld::GetSectorX(Source.x) > 75.0f) + while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f) Source.x -= 1.0f; while(CWorld::GetSectorX(Source.x) < 5.0f) Source.x += 1.0f; - while(CWorld::GetSectorY(Source.y) > 75.0f) + while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f) Source.y -= 1.0f; while(CWorld::GetSectorY(Source.y) < 5.0f) Source.y += 1.0f; @@ -4099,11 +4099,11 @@ CCam::Process_Editor(const CVector&, float, float, float) } // stay inside sectors - while(CWorld::GetSectorX(Source.x) > 75.0f) + while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f) Source.x -= 1.0f; while(CWorld::GetSectorX(Source.x) < 5.0f) Source.x += 1.0f; - while(CWorld::GetSectorY(Source.y) > 75.0f) + while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f) Source.y -= 1.0f; while(CWorld::GetSectorY(Source.y) < 5.0f) Source.y += 1.0f; -- cgit v1.2.3 From 322d93ab0cbbcf8f568d113b4460f943b90b587d Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 9 Jan 2021 16:55:45 +0200 Subject: Fix font --- src/render/Font.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 3517031d..04b1e074 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -432,7 +432,7 @@ CFont::PrintChar(float x, float y, wchar c) bDontPrint = c == '\0'; float w = GetCharacterWidth(c) / 32.0f; - if (Details.bFontHalfTexture && c == 208) + if (RenderState.bFontHalfTexture && c == 208) c = '\0'; float xoff = c % 16; float yoff = c / 16; @@ -444,7 +444,7 @@ CFont::PrintChar(float x, float y, wchar c) } #endif - if(Details.style == FONT_BANK || Details.style == FONT_STANDARD){ + if(RenderState.style == FONT_BANK || RenderState.style == FONT_STANDARD){ if (bDontPrint) return; if (RenderState.slant == 0.0f) { #ifdef FIX_BUGS -- cgit v1.2.3 From f6f0cb708ec5dee32e14c7ecf04441757de01325 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 9 Jan 2021 16:13:38 +0100 Subject: boat fix --- src/vehicles/Boat.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 695d380f..c8eb05f3 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -32,15 +32,15 @@ #define INVALID_ORIENTATION (-9999.99f) -float fShapeLength = 0.4f; -float fShapeTime = 0.05f; -float fRangeMult = 0.6f; -float fTimeMult; - float CBoat::MAX_WAKE_LENGTH = 50.0f; float CBoat::MIN_WAKE_INTERVAL = 2.0f; float CBoat::WAKE_LIFETIME = 150.0f; +float fShapeLength = 0.4f; +float fShapeTime = 0.05f; +float fRangeMult = 0.6f; +float fTimeMult = 1.0/CBoat::WAKE_LIFETIME; + CBoat *CBoat::apFrameWakeGeneratingBoats[4]; const uint32 CBoat::nSaveStructSize = -- cgit v1.2.3 From 434bc01f0b9f2b483fd996954bc37a26f28136bb Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 9 Jan 2021 16:17:47 +0100 Subject: fix fix --- src/vehicles/Boat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index c8eb05f3..8dec0f89 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -39,7 +39,7 @@ float CBoat::WAKE_LIFETIME = 150.0f; float fShapeLength = 0.4f; float fShapeTime = 0.05f; float fRangeMult = 0.6f; -float fTimeMult = 1.0/CBoat::WAKE_LIFETIME; +float fTimeMult = 1.2f/CBoat::WAKE_LIFETIME; CBoat *CBoat::apFrameWakeGeneratingBoats[4]; -- cgit v1.2.3 From e906a807f197d962fc4a2154b1bddf8a99241984 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 9 Jan 2021 18:22:09 +0100 Subject: moved new renderer --- src/control/SceneEdit.cpp | 4 +- src/extras/custompipes.h | 8 + src/extras/custompipes_d3d9.cpp | 168 +++++++++++++++++++- src/extras/custompipes_gl.cpp | 171 ++++++++++++++++++++- src/render/Renderer.cpp | 328 ++-------------------------------------- 5 files changed, 354 insertions(+), 325 deletions(-) diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp index 20f09cb4..c793e027 100644 --- a/src/control/SceneEdit.cpp +++ b/src/control/SceneEdit.cpp @@ -331,7 +331,7 @@ void CSceneEdit::Draw(void) #ifdef FIX_BUGS CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr); #else - CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr); + CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT, wstr); #endif if (nCommandDrawn == m_nCurrentCommand) CFont::SetColor(CRGBA(156, 91, 40, 255)); @@ -340,7 +340,7 @@ void CSceneEdit::Draw(void) #ifdef FIX_BUGS CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr); #else - CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT), wstr); + CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT, wstr); #endif } } diff --git a/src/extras/custompipes.h b/src/extras/custompipes.h index ca3f0fb4..183b85da 100644 --- a/src/extras/custompipes.h +++ b/src/extras/custompipes.h @@ -134,4 +134,12 @@ void AttachRimPipe(rw::Clump *clump); } #endif + +namespace WorldRender{ +extern int numBlendInsts[3]; +void AtomicFirstPass(RpAtomic *atomic, int pass); +void AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha); +void RenderBlendPass(int pass); +} + #endif diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp index a195a4cc..d0984ffe 100644 --- a/src/extras/custompipes_d3d9.cpp +++ b/src/extras/custompipes_d3d9.cpp @@ -2,8 +2,6 @@ #include "common.h" #ifdef RW_D3D9 -#ifdef EXTENDED_PIPELINES - #include "main.h" #include "RwHelper.h" #include "Lights.h" @@ -16,6 +14,8 @@ #include "World.h" #include "custompipes.h" +#ifdef EXTENDED_PIPELINES + #ifndef LIBRW #error "Need librw for EXTENDED_PIPELINES" #endif @@ -554,4 +554,168 @@ DestroyRimLightPipes(void) } #endif + +#ifdef NEW_RENDERER +#ifndef LIBRW +#error "Need librw for NEW_PIPELINES" +#endif + +namespace WorldRender +{ + +struct BuildingInst +{ + rw::RawMatrix combinedMat; + rw::d3d9::InstanceDataHeader *instHeader; + uint8 fadeAlpha; + bool lighting; +}; +BuildingInst blendInsts[3][2000]; +int numBlendInsts[3]; + +static RwRGBAReal black; + +static void +SetMatrix(BuildingInst *building, rw::Matrix *worldMat) +{ + using namespace rw; + RawMatrix world, worldview; + Camera *cam = engine->currentCamera; + convMatrix(&world, worldMat); + RawMatrix::mult(&worldview, &world, &cam->devView); + RawMatrix::mult(&building->combinedMat, &worldview, &cam->devProj); +} + +static bool +IsTextureTransparent(RwTexture *tex) +{ + if(tex == nil || tex->raster == nil) + return false; + return PLUGINOFFSET(rw::d3d::D3dRaster, tex->raster, rw::d3d::nativeRasterOffset)->hasAlpha; +} + +// Render all opaque meshes and put atomics that needs blending +// into the deferred list. +void +AtomicFirstPass(RpAtomic *atomic, int pass) +{ + using namespace rw; + using namespace rw::d3d; + using namespace rw::d3d9; + + BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; + + atomic->getPipeline()->instance(atomic); + building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData; + assert(building->instHeader != nil); + assert(building->instHeader->platform == PLATFORM_D3D9); + building->fadeAlpha = 255; + building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); + + bool setupDone = false; + bool defer = false; + SetMatrix(building, atomic->getFrame()->getLTM()); + + InstanceData *inst = building->instHeader->inst; + for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){ + Material *m = inst->material; + + if(inst->vertexAlpha || m->color.alpha != 255 || + IsTextureTransparent(m->texture)){ + defer = true; + continue; + } + + // alright we're rendering this atomic + if(!setupDone){ + setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); + setIndices(building->instHeader->indexBuffer); + setVertexDeclaration(building->instHeader->vertexDeclaration); + setVertexShader(default_amb_VS); + d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4); + if(building->lighting) + setAmbient(pAmbient->color); + else + setAmbient(black); + setupDone = true; + } + + setMaterial(m->color, m->surfaceProps); + + if(m->texture){ + d3d::setTexture(0, m->texture); + setPixelShader(default_tex_PS); + }else + setPixelShader(default_PS); + + drawInst(building->instHeader, inst); + } + if(defer) + numBlendInsts[pass]++; +} + +void +AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha) +{ + using namespace rw; + using namespace rw::d3d; + using namespace rw::d3d9; + + BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; + + atomic->getPipeline()->instance(atomic); + building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData; + assert(building->instHeader != nil); + assert(building->instHeader->platform == PLATFORM_D3D9); + building->fadeAlpha = fadeAlpha; + building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); + SetMatrix(building, atomic->getFrame()->getLTM()); + numBlendInsts[pass]++; +} + +void +RenderBlendPass(int pass) +{ + using namespace rw; + using namespace rw::d3d; + using namespace rw::d3d9; + + setVertexShader(default_amb_VS); + + int i; + for(i = 0; i < numBlendInsts[pass]; i++){ + BuildingInst *building = &blendInsts[pass][i]; + + setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); + setIndices(building->instHeader->indexBuffer); + setVertexDeclaration(building->instHeader->vertexDeclaration); + d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4); + if(building->lighting) + setAmbient(pAmbient->color); + else + setAmbient(black); + + InstanceData *inst = building->instHeader->inst; + for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){ + Material *m = inst->material; + if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255) + continue; // already done this one + + rw::RGBA color = m->color; + color.alpha = (color.alpha * building->fadeAlpha)/255; + setMaterial(color, m->surfaceProps); + + if(m->texture){ + d3d::setTexture(0, m->texture); + setPixelShader(default_tex_PS); + }else + setPixelShader(default_PS); + + drawInst(building->instHeader, inst); + } + } +} +} +#endif + #endif diff --git a/src/extras/custompipes_gl.cpp b/src/extras/custompipes_gl.cpp index 5f372530..67be4afd 100644 --- a/src/extras/custompipes_gl.cpp +++ b/src/extras/custompipes_gl.cpp @@ -1,8 +1,6 @@ #include "common.h" #ifdef RW_OPENGL -#ifdef EXTENDED_PIPELINES - #include "main.h" #include "RwHelper.h" #include "Lights.h" @@ -15,6 +13,8 @@ #include "World.h" #include "custompipes.h" +#ifdef EXTENDED_PIPELINES + #ifndef LIBRW #error "Need librw for EXTENDED_PIPELINES" #endif @@ -615,4 +615,171 @@ CustomPipeRegisterGL(void) } #endif + +#ifdef NEW_RENDERER +#ifndef LIBRW +#error "Need librw for NEW_PIPELINES" +#endif + +namespace WorldRender +{ + +struct BuildingInst +{ + rw::Matrix matrix; + rw::gl3::InstanceDataHeader *instHeader; + uint8 fadeAlpha; + bool lighting; +}; +BuildingInst blendInsts[3][2000]; +int numBlendInsts[3]; + +static RwRGBAReal black; + +static bool +IsTextureTransparent(RwTexture *tex) +{ + if(tex == nil || tex->raster == nil) + return false; + return PLUGINOFFSET(rw::gl3::Gl3Raster, tex->raster, rw::gl3::nativeRasterOffset)->hasAlpha; +} + +// Render all opaque meshes and put atomics that needs blending +// into the deferred list. +void +AtomicFirstPass(RpAtomic *atomic, int pass) +{ + using namespace rw; + using namespace rw::gl3; + + BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; + + atomic->getPipeline()->instance(atomic); + building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData; + assert(building->instHeader != nil); + assert(building->instHeader->platform == PLATFORM_GL3); + building->fadeAlpha = 255; + building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); + + WorldLights lights; + lights.numAmbients = 1; + lights.numDirectionals = 0; + lights.numLocals = 0; + if(building->lighting) + lights.ambient = pAmbient->color; + else + lights.ambient = black; + + bool setupDone = false; + bool defer = false; + building->matrix = *atomic->getFrame()->getLTM(); + + InstanceData *inst = building->instHeader->inst; + for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){ + Material *m = inst->material; + + if(inst->vertexAlpha || m->color.alpha != 255 || + IsTextureTransparent(m->texture)){ + defer = true; + continue; + } + + // alright we're rendering this atomic + if(!setupDone){ + defaultShader->use(); + setWorldMatrix(&building->matrix); +#ifdef RW_GL_USE_VAOS + glBindVertexArray(building->instHeader->vao); +#else + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo); + glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo); + setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); +#endif + setLights(&lights); + setupDone = true; + } + + setMaterial(m->color, m->surfaceProps); + + setTexture(0, m->texture); + + drawInst(building->instHeader, inst); + } +#ifndef RW_GL_USE_VAOS + disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); +#endif + if(defer) + numBlendInsts[pass]++; +} + +void +AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha) +{ + using namespace rw; + using namespace rw::gl3; + + BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; + + atomic->getPipeline()->instance(atomic); + building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData; + assert(building->instHeader != nil); + assert(building->instHeader->platform == PLATFORM_GL3); + building->fadeAlpha = fadeAlpha; + building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); + building->matrix = *atomic->getFrame()->getLTM(); + numBlendInsts[pass]++; +} + +void +RenderBlendPass(int pass) +{ + using namespace rw; + using namespace rw::gl3; + + defaultShader->use(); + WorldLights lights; + lights.numAmbients = 1; + lights.numDirectionals = 0; + lights.numLocals = 0; + + int i; + for(i = 0; i < numBlendInsts[pass]; i++){ + BuildingInst *building = &blendInsts[pass][i]; + +#ifdef RW_GL_USE_VAOS + glBindVertexArray(building->instHeader->vao); +#else + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo); + glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo); + setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); +#endif + setWorldMatrix(&building->matrix); + if(building->lighting) + lights.ambient = pAmbient->color; + else + lights.ambient = black; + setLights(&lights); + + InstanceData *inst = building->instHeader->inst; + for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){ + Material *m = inst->material; + if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255) + continue; // already done this one + + rw::RGBA color = m->color; + color.alpha = (color.alpha * building->fadeAlpha)/255; + setMaterial(color, m->surfaceProps); + + setTexture(0, m->texture); + + drawInst(building->instHeader, inst); + } +#ifndef RW_GL_USE_VAOS + disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); +#endif + } +} +} +#endif + #endif diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 660b05fe..91a34592 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -347,8 +347,6 @@ enum { PASS_BLEND // normal blend }; -static RwRGBAReal black; - static void SetStencilState(int state) { @@ -377,314 +375,6 @@ SetStencilState(int state) } } -#ifdef RW_D3D9 -struct BuildingInst -{ - rw::RawMatrix combinedMat; - rw::d3d9::InstanceDataHeader *instHeader; - uint8 fadeAlpha; - bool lighting; -}; -static BuildingInst blendInsts[3][2000]; -static int numBlendInsts[3]; - -static void -SetMatrix(BuildingInst *building, rw::Matrix *worldMat) -{ - using namespace rw; - RawMatrix world, worldview; - Camera *cam = engine->currentCamera; - convMatrix(&world, worldMat); - RawMatrix::mult(&worldview, &world, &cam->devView); - RawMatrix::mult(&building->combinedMat, &worldview, &cam->devProj); -} - -static bool -IsTextureTransparent(RwTexture *tex) -{ - if(tex == nil || tex->raster == nil) - return false; - return PLUGINOFFSET(rw::d3d::D3dRaster, tex->raster, rw::d3d::nativeRasterOffset)->hasAlpha; -} - -// Render all opaque meshes and put atomics that needs blending -// into the deferred list. -static void -AtomicFirstPass(RpAtomic *atomic, int pass) -{ - using namespace rw; - using namespace rw::d3d; - using namespace rw::d3d9; - - BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; - - atomic->getPipeline()->instance(atomic); - building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData; - assert(building->instHeader != nil); - assert(building->instHeader->platform == PLATFORM_D3D9); - building->fadeAlpha = 255; - building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - - bool setupDone = false; - bool defer = false; - SetMatrix(building, atomic->getFrame()->getLTM()); - - InstanceData *inst = building->instHeader->inst; - for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){ - Material *m = inst->material; - - if(inst->vertexAlpha || m->color.alpha != 255 || - IsTextureTransparent(m->texture)){ - defer = true; - continue; - } - - // alright we're rendering this atomic - if(!setupDone){ - setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); - setIndices(building->instHeader->indexBuffer); - setVertexDeclaration(building->instHeader->vertexDeclaration); - setVertexShader(default_amb_VS); - d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4); - if(building->lighting) - setAmbient(pAmbient->color); - else - setAmbient(black); - setupDone = true; - } - - setMaterial(m->color, m->surfaceProps); - - if(m->texture){ - d3d::setTexture(0, m->texture); - setPixelShader(default_tex_PS); - }else - setPixelShader(default_PS); - - drawInst(building->instHeader, inst); - } - if(defer) - numBlendInsts[pass]++; -} - -static void -AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha) -{ - using namespace rw; - using namespace rw::d3d; - using namespace rw::d3d9; - - BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; - - atomic->getPipeline()->instance(atomic); - building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData; - assert(building->instHeader != nil); - assert(building->instHeader->platform == PLATFORM_D3D9); - building->fadeAlpha = fadeAlpha; - building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - SetMatrix(building, atomic->getFrame()->getLTM()); - numBlendInsts[pass]++; -} - -static void -RenderBlendPass(int pass) -{ - using namespace rw; - using namespace rw::d3d; - using namespace rw::d3d9; - - setVertexShader(default_amb_VS); - - int i; - for(i = 0; i < numBlendInsts[pass]; i++){ - BuildingInst *building = &blendInsts[pass][i]; - - setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); - setIndices(building->instHeader->indexBuffer); - setVertexDeclaration(building->instHeader->vertexDeclaration); - d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4); - if(building->lighting) - setAmbient(pAmbient->color); - else - setAmbient(black); - - InstanceData *inst = building->instHeader->inst; - for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){ - Material *m = inst->material; - if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255) - continue; // already done this one - - rw::RGBA color = m->color; - color.alpha = (color.alpha * building->fadeAlpha)/255; - setMaterial(color, m->surfaceProps); - - if(m->texture){ - d3d::setTexture(0, m->texture); - setPixelShader(default_tex_PS); - }else - setPixelShader(default_PS); - - drawInst(building->instHeader, inst); - } - } -} -#endif -#ifdef RW_GL3 -struct BuildingInst -{ - rw::Matrix matrix; - rw::gl3::InstanceDataHeader *instHeader; - uint8 fadeAlpha; - bool lighting; -}; -static BuildingInst blendInsts[3][2000]; -static int numBlendInsts[3]; - -static bool -IsTextureTransparent(RwTexture *tex) -{ - if(tex == nil || tex->raster == nil) - return false; - return PLUGINOFFSET(rw::gl3::Gl3Raster, tex->raster, rw::gl3::nativeRasterOffset)->hasAlpha; -} - -// Render all opaque meshes and put atomics that needs blending -// into the deferred list. -static void -AtomicFirstPass(RpAtomic *atomic, int pass) -{ - using namespace rw; - using namespace rw::gl3; - - BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; - - atomic->getPipeline()->instance(atomic); - building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData; - assert(building->instHeader != nil); - assert(building->instHeader->platform == PLATFORM_GL3); - building->fadeAlpha = 255; - building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - - WorldLights lights; - lights.numAmbients = 1; - lights.numDirectionals = 0; - lights.numLocals = 0; - if(building->lighting) - lights.ambient = pAmbient->color; - else - lights.ambient = black; - - bool setupDone = false; - bool defer = false; - building->matrix = *atomic->getFrame()->getLTM(); - - InstanceData *inst = building->instHeader->inst; - for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){ - Material *m = inst->material; - - if(inst->vertexAlpha || m->color.alpha != 255 || - IsTextureTransparent(m->texture)){ - defer = true; - continue; - } - - // alright we're rendering this atomic - if(!setupDone){ - defaultShader->use(); - setWorldMatrix(&building->matrix); -#ifdef RW_GL_USE_VAOS - glBindVertexArray(building->instHeader->vao); -#else - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo); - glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo); - setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); -#endif - setLights(&lights); - setupDone = true; - } - - setMaterial(m->color, m->surfaceProps); - - setTexture(0, m->texture); - - drawInst(building->instHeader, inst); - } -#ifndef RW_GL_USE_VAOS - disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); -#endif - if(defer) - numBlendInsts[pass]++; -} - -static void -AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha) -{ - using namespace rw; - using namespace rw::gl3; - - BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; - - atomic->getPipeline()->instance(atomic); - building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData; - assert(building->instHeader != nil); - assert(building->instHeader->platform == PLATFORM_GL3); - building->fadeAlpha = fadeAlpha; - building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - building->matrix = *atomic->getFrame()->getLTM(); - numBlendInsts[pass]++; -} - -static void -RenderBlendPass(int pass) -{ - using namespace rw; - using namespace rw::gl3; - - defaultShader->use(); - WorldLights lights; - lights.numAmbients = 1; - lights.numDirectionals = 0; - lights.numLocals = 0; - - int i; - for(i = 0; i < numBlendInsts[pass]; i++){ - BuildingInst *building = &blendInsts[pass][i]; - -#ifdef RW_GL_USE_VAOS - glBindVertexArray(building->instHeader->vao); -#else - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo); - glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo); - setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); -#endif - setWorldMatrix(&building->matrix); - if(building->lighting) - lights.ambient = pAmbient->color; - else - lights.ambient = black; - setLights(&lights); - - InstanceData *inst = building->instHeader->inst; - for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){ - Material *m = inst->material; - if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255) - continue; // already done this one - - rw::RGBA color = m->color; - color.alpha = (color.alpha * building->fadeAlpha)/255; - setMaterial(color, m->surfaceProps); - - setTexture(0, m->texture); - - drawInst(building->instHeader, inst); - } -#ifndef RW_GL_USE_VAOS - disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); -#endif - } -} -#endif - void CRenderer::RenderOneBuilding(CEntity *ent, float camdist) { @@ -715,16 +405,16 @@ CRenderer::RenderOneBuilding(CEntity *ent, float camdist) alpha = mi->m_alpha * fadefactor; if(alpha == 255) - AtomicFirstPass(atomic, pass); + WorldRender::AtomicFirstPass(atomic, pass); else{ // not quite sure what this is about, do we have to do that? RpGeometry *geo = RpAtomicGetGeometry(lodatm); if(geo != RpAtomicGetGeometry(atomic)) RpAtomicSetGeometry(atomic, geo, rpATOMICSAMEBOUNDINGSPHERE); - AtomicFullyTransparent(atomic, pass, alpha); + WorldRender::AtomicFullyTransparent(atomic, pass, alpha); } }else - AtomicFirstPass(atomic, pass); + WorldRender::AtomicFirstPass(atomic, pass); ent->bImBeingRendered = false; // TODO: this seems wrong, but do we even need it? } @@ -779,16 +469,16 @@ CRenderer::RenderWorld(int pass) RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE); - RenderBlendPass(PASS_NOZ); + WorldRender::RenderBlendPass(PASS_NOZ); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); break; case 2: // Transparent RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); - RenderBlendPass(PASS_ADD); + WorldRender::RenderBlendPass(PASS_ADD); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); - RenderBlendPass(PASS_BLEND); + WorldRender::RenderBlendPass(PASS_BLEND); break; } } @@ -872,9 +562,9 @@ CRenderer::ClearForFrame(void) ms_nNoOfInVisibleEntities = 0; gSortedVehiclesAndPeds.Clear(); - numBlendInsts[PASS_NOZ] = 0; - numBlendInsts[PASS_ADD] = 0; - numBlendInsts[PASS_BLEND] = 0; + WorldRender::numBlendInsts[PASS_NOZ] = 0; + WorldRender::numBlendInsts[PASS_ADD] = 0; + WorldRender::numBlendInsts[PASS_BLEND] = 0; } #endif -- cgit v1.2.3 From c2265e29d2f2b487add06b1e03ddc8bcce58f643 Mon Sep 17 00:00:00 2001 From: Seemann Date: Sat, 9 Jan 2021 23:59:47 -0500 Subject: Update command definitions --- src/control/Script.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 8cac88d6..1bbed8b1 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -225,7 +225,7 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_GOSUB, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_RETURN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_LINE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_CREATE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), REGISTER_COMMAND(COMMAND_GET_PLAYER_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), REGISTER_COMMAND(COMMAND_SET_PLAYER_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""), @@ -290,10 +290,10 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), - REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), - REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), - REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), - REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_ABS_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), REGISTER_COMMAND(COMMAND_CREATE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), false, -1, ""), @@ -922,8 +922,8 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_CHAR_IN_FORMATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_PLAYER_MADE_PROGRESS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_SET_PROGRESS_TOTAL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PLAYER_MADE_PROGRESS, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PROGRESS_TOTAL, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_REGISTER_JUMP_DISTANCE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_REGISTER_JUMP_HEIGHT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_REGISTER_JUMP_FLIPS, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), -- cgit v1.2.3 From ebca91e0d0e84c19198e7e9968050d8a3b1c3960 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 10 Jan 2021 18:43:35 +0100 Subject: update librw --- src/core/main.cpp | 2 +- vendor/librw | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index d9579fee..d0663c30 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1172,7 +1172,7 @@ if(gbRenderWater) if(gbRenderEverythingBarRoads) CRenderer::RenderEverythingBarRoads(); - // get env map here? + // seam fixer // moved this: // CRenderer::RenderFadingInEntities(); } diff --git a/vendor/librw b/vendor/librw index ed9cb45e..61b288a9 160000 --- a/vendor/librw +++ b/vendor/librw @@ -1 +1 @@ -Subproject commit ed9cb45ee9a2749a0a89231bf16f09a5c53bfc92 +Subproject commit 61b288a9fe72ae4073c0ac5fd2a5815ed510c8c8 -- cgit v1.2.3 From adc712705522a6719d13851740f150712a1a8376 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sun, 10 Jan 2021 22:24:21 +0300 Subject: fix pickup coronas --- src/control/Pickups.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 3470e475..5186a8d2 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1186,7 +1186,9 @@ CPickups::DoPickUpEffects(CEntity *entity) CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, - 0.0f); + 0.0f, + false, + -0.5f); } } @@ -1253,7 +1255,7 @@ CPickups::DoCollectableEffects(CEntity *entity) int32 color = (MAXDIST - dist) * (0.5f * s + 0.5f) / MAXDIST * 255.0f; CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, color, color, color, 4.0f, 1.0f, 40.0f, false, 0.0f); - CCoronas::RegisterCorona((uintptr)entity, color, color, color, 255, pos, 0.6f, 40.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + CCoronas::RegisterCorona((uintptr)entity, color, color, color, 255, pos, 0.6f, 40.0f, CCoronas::TYPE_HEX, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); } entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0xFFF) * DEGTORAD(360.0f / 0x1000)); -- cgit v1.2.3 From 585300cd335abe6cc13519daaab3ed30266b02a5 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 10 Jan 2021 22:37:11 +0200 Subject: More font fix --- src/render/Font.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 04b1e074..6d569591 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -432,7 +432,7 @@ CFont::PrintChar(float x, float y, wchar c) bDontPrint = c == '\0'; float w = GetCharacterWidth(c) / 32.0f; - if (RenderState.bFontHalfTexture && c == 208) + if (Details.bFontHalfTexture && c == 208) c = '\0'; float xoff = c % 16; float yoff = c / 16; @@ -1051,10 +1051,10 @@ CFont::GetCharacterWidth(wchar c) return Size[LanguageSet][Details.style][192]; #else - if (Details.proportional) - return Size[Details.style][c]; + if (RenderState.proportional) + return Size[RenderState.style][c]; else - return Size[Details.style][209]; + return Size[RenderState.style][209]; #endif // MORE_LANGUAGES } -- cgit v1.2.3 From b5711b21dc6843b9146a9f1d12a99473a0873f35 Mon Sep 17 00:00:00 2001 From: erorcun Date: Mon, 11 Jan 2021 01:10:24 +0300 Subject: Automobile: fix --- src/vehicles/Automobile.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 16d29b26..3a0121ec 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -288,17 +288,17 @@ CAutomobile::ProcessControl(void) // Improve grip of vehicles in certain cases bool strongGrip1 = false; bool strongGrip2 = false; - if(FindPlayerVehicle() && this != FindPlayerVehicle() && + if(FindPlayerVehicle() && this != FindPlayerVehicle() && FindPlayerPed()->m_pWanted->m_nWantedLevel > 3 && (AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE || - AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE)){ - if(FindPlayerSpeed().Magnitude() > 0.3f){ - strongGrip1 = true; - if(FindPlayerSpeed().Magnitude() > 0.4f && - m_vecMoveSpeed.Magnitude() < 0.3f) - strongGrip2 = true; - else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f) - strongGrip2 = true; - } + AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE) && + FindPlayerSpeed().Magnitude() > 0.3f){ + + strongGrip1 = true; + if(FindPlayerSpeed().Magnitude() > 0.4f && + m_vecMoveSpeed.Magnitude() < 0.3f) + strongGrip2 = true; + else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f) + strongGrip2 = true; }else if(GetModelIndex() == MI_RCBANDIT && GetStatus() != STATUS_PLAYER_REMOTE) strongGrip1 = true; -- cgit v1.2.3 From 81b5e66dd40fd9e14cb52e71859c9383e89f7d09 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 11 Jan 2021 17:18:25 +0300 Subject: fixes --- src/control/Script.cpp | 8 ++++---- src/control/Script3.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 1bbed8b1..3566e0a6 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -284,12 +284,12 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_SET_LVAR_INT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="), REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), - REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), - REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"), REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), - REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), - REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"), REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp index 7476d8de..67d6fdda 100644 --- a/src/control/Script3.cpp +++ b/src/control/Script3.cpp @@ -816,7 +816,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CCoronas::RegisterCorona((uintptr)this + m_nIp, ScriptParams[6], ScriptParams[7], ScriptParams[8], - 255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f); + 255, pos, *(float*)&ScriptParams[3], 450.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f); return 0; } case COMMAND_DRAW_LIGHT: -- cgit v1.2.3 From 4a8a1af8858edeef949d8f2ecbd25d3c93ccd042 Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 11 Jan 2021 18:42:54 +0100 Subject: fix CPed struct, GetWantedLevel --- src/core/Wanted.h | 1 + src/peds/Ped.h | 7 ++++++- src/vehicles/Automobile.cpp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/Wanted.h b/src/core/Wanted.h index 057b5407..f2da23e3 100644 --- a/src/core/Wanted.h +++ b/src/core/Wanted.h @@ -41,6 +41,7 @@ public: int32 NumOfHelisRequired(); void SetWantedLevel(int32); void SetWantedLevelNoDrop(int32 level); + int32 GetWantedLevel() { return m_nWantedLevel; } void CheatWantedLevel(int32 level); void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare); void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare); diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 6c0d9987..7798483f 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -492,10 +492,15 @@ public: uint32 bDonePositionOutOfCollision : 1; uint32 bCanAttackPlayerWithCops : 1; +#ifdef KANGAROO_CHEAT // our own flags uint32 m_ped_flagI80 : 1; // KANGAROO_CHEAT define makes use of this as cheat toggle +#endif uint8 m_gangFlags; + uint8 m_unused15D; // these 3 can't be padding but had to actually have been members ... + uint8 m_unused15E; + uint8 m_unused15F; uint8 CharCreatedBy; eObjective m_objective; eObjective m_prevObjective; @@ -536,7 +541,7 @@ public: uint32 m_pathNodeTimer; CPathNode m_pathNodeObjPool[8]; CPathNode* m_pCurPathNode; - char m_nPathDir; + int8 m_nPathDir; CPathNode* m_pLastPathNode; CPathNode* m_pNextPathNode; CVector m_followPathDestPos; diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 3a0121ec..65e3f313 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -288,7 +288,7 @@ CAutomobile::ProcessControl(void) // Improve grip of vehicles in certain cases bool strongGrip1 = false; bool strongGrip2 = false; - if(FindPlayerVehicle() && this != FindPlayerVehicle() && FindPlayerPed()->m_pWanted->m_nWantedLevel > 3 && + if(FindPlayerVehicle() && this != FindPlayerVehicle() && FindPlayerPed()->m_pWanted->GetWantedLevel() > 3 && (AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE) && FindPlayerSpeed().Magnitude() > 0.3f){ -- cgit v1.2.3 From c7052b3d6f39264177e5af9c8ea2290d49ceaf72 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 11 Jan 2021 20:51:18 +0300 Subject: fuck --- src/control/CarCtrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 1023f2a3..6f47db05 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -2930,7 +2930,7 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic *pHandbrake = true; float maxAngle = FindMaxSteerAngle(pVehicle); steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle)); - float speedMultiplier = FindSpeedMultiplier(angleToTarget - angleForward, + float speedMultiplier = FindSpeedMultiplier(CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y) - angleForward, MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT); float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier; float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED; -- cgit v1.2.3 From e2095bf70bec9abf8528cffbf8c3c802f4bc0898 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Mon, 11 Jan 2021 21:10:24 +0300 Subject: fix explosion jet --- src/render/Particle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index 0ad4681d..51249844 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -2331,9 +2331,9 @@ void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize vecStepPos, CVector ( - CGeneral::GetRandomNumberInRange(-0.2f, 0.2f), - CGeneral::GetRandomNumberInRange(-0.2f, 0.2f), - CGeneral::GetRandomNumberInRange(-0.2f, 0.0f) + CGeneral::GetRandomNumberInRange(-0.02f, 0.02f), + CGeneral::GetRandomNumberInRange(-0.02f, 0.02f), + CGeneral::GetRandomNumberInRange(-0.02f, 0.0f) ), nil, fSize, color, 0, 0, 0, 0); -- cgit v1.2.3 From 42e4e7c063cf1af9ed910f5e4435c07c61259e58 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 12 Jan 2021 00:43:26 +0300 Subject: fix --- src/control/Script3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp index 67d6fdda..aba06d03 100644 --- a/src/control/Script3.cpp +++ b/src/control/Script3.cpp @@ -2400,7 +2400,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CPed* pLeader = CPools::GetPedPool()->GetAt(ScriptParams[1]); script_assert(pPed); script_assert(pLeader); - UpdateCompareFlag(pPed->m_leader == pLeader); + UpdateCompareFlag(pPed->m_leader == pLeader && !pPed->bWaitForLeaderToComeCloser); return 0; } default: -- cgit v1.2.3 From 7e888a6379247d1c0be055eb27626c9bb53590d2 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 12 Jan 2021 02:25:51 +0200 Subject: Fix collective commands --- src/control/Script5.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp index f970cf89..b03ff49d 100644 --- a/src/control/Script5.cpp +++ b/src/control/Script5.cpp @@ -2531,7 +2531,7 @@ int CTheScripts::FindFreeSlotInCollectiveArray() void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2) { for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CollectiveArray[i].colIndex = colIndex) { + if (CollectiveArray[i].colIndex == colIndex) { CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); if (pPed == nil) { CollectiveArray[i].colIndex = -1; @@ -2548,7 +2548,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2) { for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CollectiveArray[i].colIndex = colIndex) { + if (CollectiveArray[i].colIndex == colIndex) { CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); if (pPed == nil) { CollectiveArray[i].colIndex = -1; @@ -2565,7 +2565,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1) { for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CollectiveArray[i].colIndex = colIndex) { + if (CollectiveArray[i].colIndex == colIndex) { CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); if (pPed == nil) { CollectiveArray[i].colIndex = -1; @@ -2582,7 +2582,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1) { for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CollectiveArray[i].colIndex = colIndex) { + if (CollectiveArray[i].colIndex == colIndex) { CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); if (pPed == nil) { CollectiveArray[i].colIndex = -1; @@ -2599,7 +2599,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective) { for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CollectiveArray[i].colIndex = colIndex) { + if (CollectiveArray[i].colIndex == colIndex) { CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); if (pPed == nil) { CollectiveArray[i].colIndex = -1; -- cgit v1.2.3 From 75367e714adf33dd5d0e046f86917ef8994c6c54 Mon Sep 17 00:00:00 2001 From: withmorten Date: Sun, 10 Jan 2021 20:31:26 +0100 Subject: premake: add startrpoject; add lto option; fix copying of binary to gamedir; update premake5.exe # Conflicts: # premake5.lua --- premake5.exe | Bin 1362432 -> 1395712 bytes premake5.lua | 13 +++++++++++-- premake5Linux | Bin 2035312 -> 2035312 bytes 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/premake5.exe b/premake5.exe index 9048d51e..a8483721 100644 Binary files a/premake5.exe and b/premake5.exe differ diff --git a/premake5.lua b/premake5.lua index 9796b8a9..e62ad6be 100644 --- a/premake5.lua +++ b/premake5.lua @@ -34,6 +34,11 @@ newoption { description = "Build with opus" } +newoption { + trigger = "lto", + description = "Use link time optimization" +} + if(_OPTIONS["with-librw"]) then Librw = "vendor/librw" else @@ -61,6 +66,7 @@ end workspace "reVC" language "C++" configurations { "Debug", "Release" } + startproject "reVC" location "build" symbols "Full" staticruntime "off" @@ -109,7 +115,10 @@ workspace "reVC" filter "configurations:Release" defines { "NDEBUG" } - optimize "On" + optimize "Speed" + if(_OPTIONS["lto"]) then + flags { "LinkTimeOptimization" } + end filter { "platforms:win*" } system "windows" @@ -167,7 +176,7 @@ workspace "reVC" scriptspath = scriptspath or "" if (gamepath) then postbuildcommands { - '{COPY} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"' + '{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"' } debugdir (gamepath) if (exepath) then diff --git a/premake5Linux b/premake5Linux index 2fd412da..1ca75167 100755 Binary files a/premake5Linux and b/premake5Linux differ -- cgit v1.2.3