From 8a4fa58cd42b7cca4a86fe2d9913b839b554bf10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Mon, 11 May 2020 05:55:57 +0300 Subject: Linux build support --- src/render/Console.cpp | 2 +- src/render/ParticleMgr.h | 12 ++++-------- src/render/PlayerSkin.cpp | 2 +- src/render/Shadows.cpp | 6 +++--- src/render/Shadows.h | 12 +++--------- 5 files changed, 12 insertions(+), 22 deletions(-) (limited to 'src/render') diff --git a/src/render/Console.cpp b/src/render/Console.cpp index 5ae5d763..8ea5b7a3 100644 --- a/src/render/Console.cpp +++ b/src/render/Console.cpp @@ -17,7 +17,7 @@ CConsole::AddLine(char *s, uint8 r, uint8 g, uint8 b) char tempstr[MAX_STR_LEN+1]; while (strlen(s) > MAX_STR_LEN) { - strncpy_s(tempstr, s, MAX_STR_LEN); + strncpy(tempstr, s, MAX_STR_LEN); tempstr[MAX_STR_LEN-1] = '\0'; s += MAX_STR_LEN - 1; AddOneLine(tempstr, r, g, b); diff --git a/src/render/ParticleMgr.h b/src/render/ParticleMgr.h index 42e3f132..0100bb65 100644 --- a/src/render/ParticleMgr.h +++ b/src/render/ParticleMgr.h @@ -4,7 +4,7 @@ class CParticle; -enum +enum { ZCHECK_FIRST = BIT(0), ZCHECK_STEP = BIT(1), @@ -60,14 +60,12 @@ struct tParticleSystemData uint8 m_InitialColorVariation; RwRGBA m_FadeDestinationColor; uint32 m_ColorFadeTime; - + RwRaster **m_ppRaster; CParticle *m_pParticles; }; -#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(tParticleSystemData, 0x88); -#endif class cParticleSystemMgr { @@ -121,14 +119,12 @@ public: tParticleSystemData m_aParticles[MAX_PARTICLES]; cParticleSystemMgr(); - + void Initialise(); void LoadParticleData(); void RangeCheck(tParticleSystemData *pData) { } }; -#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(cParticleSystemMgr, 0x2420); -#endif -extern cParticleSystemMgr mod_ParticleSystemManager; \ No newline at end of file +extern cParticleSystemMgr mod_ParticleSystemManager; diff --git a/src/render/PlayerSkin.cpp b/src/render/PlayerSkin.cpp index 94af1fd1..d66f7ce4 100644 --- a/src/render/PlayerSkin.cpp +++ b/src/render/PlayerSkin.cpp @@ -123,7 +123,7 @@ void CPlayerSkin::BeginFrontendSkinEdit(void) { LoadPlayerDff(); - RpClumpForAllAtomics(gpPlayerClump, CClumpModelInfo::SetAtomicRendererCB, CVisibilityPlugins::RenderPlayerCB); + RpClumpForAllAtomics(gpPlayerClump, CClumpModelInfo::SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB); CWorld::Players[0].LoadPlayerSkin(); gOldFov = CDraw::GetFOV(); CDraw::SetFOV(30.0f); diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp index cefc1d9f..69f9dce0 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -645,7 +645,7 @@ CShadows::StoreShadowForPole(CEntity *pPole, float fOffsetX, float fOffsetY, flo PolePos.x += -CTimeCycle::GetSunPosition().x * (fPoleHeight / 2); PolePos.y += -CTimeCycle::GetSunPosition().y * (fPoleHeight / 2); - StoreStaticShadow((uint32)pPole + nID + _TODOCONST(51), SHADOWTYPE_DARK, gpPostShadowTex, &PolePos, + StoreStaticShadow((uintptr)pPole + nID + _TODOCONST(51), SHADOWTYPE_DARK, gpPostShadowTex, &PolePos, -CTimeCycle::GetSunPosition().x * (fPoleHeight / 2), -CTimeCycle::GetSunPosition().y * (fPoleHeight / 2), CTimeCycle::GetShadowSideX() * fPoleWidth, @@ -1516,7 +1516,7 @@ CShadows::UpdatePermanentShadows(void) // timePassed == aPermanentShadows[i].m_nLifeTime -> 0 float fMult = 1.0f - float(timePassed - (aPermanentShadows[i].m_nLifeTime * 3 / 4)) / (aPermanentShadows[i].m_nLifeTime / 4); - StoreStaticShadow((uint32)&aPermanentShadows[i], + StoreStaticShadow((uintptr)&aPermanentShadows[i], aPermanentShadows[i].m_nType, aPermanentShadows[i].m_pTexture, &aPermanentShadows[i].m_vecPos, @@ -1533,7 +1533,7 @@ CShadows::UpdatePermanentShadows(void) } else { - StoreStaticShadow((uint32)&aPermanentShadows[i], + StoreStaticShadow((uintptr)&aPermanentShadows[i], aPermanentShadows[i].m_nType, aPermanentShadows[i].m_pTexture, &aPermanentShadows[i].m_vecPos, diff --git a/src/render/Shadows.h b/src/render/Shadows.h index ef56d336..63aaaaf2 100644 --- a/src/render/Shadows.h +++ b/src/render/Shadows.h @@ -52,9 +52,7 @@ public: { } }; -#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CStoredShadow, 0x30); -#endif class CPolyBunch { @@ -69,9 +67,7 @@ public: { } }; -#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CPolyBunch, 0x6C); -#endif class CStaticShadow { @@ -93,16 +89,14 @@ public: bool m_bRendered; bool m_bTemp; RwTexture *m_pTexture; - + CStaticShadow() { } void Free(); }; -#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CStaticShadow, 0x40); -#endif class CPermanentShadow { @@ -120,7 +114,7 @@ public: uint32 m_nTimeCreated; uint32 m_nLifeTime; RwTexture *m_pTexture; - + CPermanentShadow() { } }; @@ -168,7 +162,7 @@ public: static void GeneratePolysForStaticShadow (int16 nStaticShadowID); static void CastShadowSectorList (CPtrList &PtrList, float fStartX, float fStartY, float fEndX, float fEndY, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, CPolyBunch **ppPolyBunch); - static void CastShadowEntity (CEntity *pEntity, float fStartX, float fStartY, float fEndX, float fEndY, + static void CastShadowEntity (CEntity *pEntity, float fStartX, float fStartY, float fEndX, float fEndY, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, CPolyBunch **ppPolyBunch); static void UpdateStaticShadows (void); static void UpdatePermanentShadows (void); -- cgit v1.2.3 From 98a233da43acfa1bd1144d5b0236783beef30785 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 12 May 2020 16:27:12 +0200 Subject: little fixes to CClouds; disabled object clipping for SA cam --- src/render/Clouds.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/render') diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp index 07688491..9c0fde0f 100644 --- a/src/render/Clouds.cpp +++ b/src/render/Clouds.cpp @@ -93,7 +93,7 @@ CClouds::Render(void) int minute = CClock::GetHours()*60 + CClock::GetMinutes(); RwV3d campos = *(RwV3d*)&TheCamera.GetPosition(); - float coverage = CWeather::CloudCoverage <= CWeather::Foggyness ? CWeather::Foggyness : CWeather::CloudCoverage; + float coverage = Max(CWeather::Foggyness, CWeather::Foggyness); // Moon int moonfadeout = Abs(minute - 180); // fully visible at 3AM @@ -308,20 +308,19 @@ CClouds::Render(void) bool UseDarkBackground(void) { - return RwFrameGetLTM(RwCameraGetFrame(TheCamera.m_pRwCamera))->up.z < -0.9f || - gbShowCollisionPolys; + return TheCamera.GetForward().z < -0.9f || gbShowCollisionPolys; } void CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue, int16 botred, int16 botgreen, int16 botblue, int16 alpha) { - RwMatrix *mat = RwFrameGetLTM(RwCameraGetFrame(TheCamera.m_pRwCamera)); - float c = Sqrt(mat->right.x * mat->right.x + mat->right.y * mat->right.y); + CVector left = TheCamera.GetRight(); + float c = left.Magnitude2D(); if(c > 1.0f) c = 1.0f; ms_cameraRoll = Acos(c); - if(mat->right.z < 0.0f) + if(left.z < 0.0f) ms_cameraRoll = -ms_cameraRoll; if(UseDarkBackground()){ -- cgit v1.2.3