diff options
author | Fire_Head <Fire-Head@users.noreply.github.com> | 2020-08-27 19:35:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-27 19:35:14 +0200 |
commit | a8999bbf38cae233e39b5995118fa03bca7894ef (patch) | |
tree | ada9bd1935512f4b46fe6b4f42d9160eb2281262 /src/rw | |
parent | bike shooting fix + trace temp fix (diff) | |
parent | update librw (diff) | |
download | re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar.gz re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar.bz2 re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar.lz re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar.xz re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar.zst re3-a8999bbf38cae233e39b5995118fa03bca7894ef.zip |
Diffstat (limited to 'src/rw')
-rw-r--r-- | src/rw/ClumpRead.cpp | 1 | ||||
-rw-r--r-- | src/rw/Lights.cpp | 22 | ||||
-rw-r--r-- | src/rw/Lights.h | 6 | ||||
-rw-r--r-- | src/rw/NodeName.cpp | 4 | ||||
-rw-r--r-- | src/rw/RwHelper.cpp | 37 | ||||
-rw-r--r-- | src/rw/RwHelper.h | 6 | ||||
-rw-r--r-- | src/rw/TexRead.cpp | 38 | ||||
-rw-r--r-- | src/rw/TxdStore.cpp | 16 | ||||
-rw-r--r-- | src/rw/VisibilityPlugins.cpp | 5 |
9 files changed, 83 insertions, 52 deletions
diff --git a/src/rw/ClumpRead.cpp b/src/rw/ClumpRead.cpp index 5f50f52d..b8d72d23 100644 --- a/src/rw/ClumpRead.cpp +++ b/src/rw/ClumpRead.cpp @@ -1,5 +1,6 @@ #include "common.h" +//--MIAMI: done struct rpGeometryList { diff --git a/src/rw/Lights.cpp b/src/rw/Lights.cpp index cd45b81f..3657e2c7 100644 --- a/src/rw/Lights.cpp +++ b/src/rw/Lights.cpp @@ -10,6 +10,8 @@ #include "Frontend.h" #include "MBlur.h" +//--MIAMI: done + RpLight *pAmbient; RpLight *pDirect; RpLight *pExtraDirectionals[4] = { nil }; @@ -23,7 +25,13 @@ RwRGBAReal DirectionalLightColourForFrame; RwRGBAReal AmbientLightColour; RwRGBAReal DirectionalLightColour; -//--MIAMI: done +#ifdef EXTENDED_COLOURFILTER +#include "postfx.h" +#define USEBLURCOLORS CPostFX::UseBlurColours() +#else +#define USEBLURCOLORS CMBlur::BlurOn +#endif + void SetLightsWithTimeOfDayColour(RpWorld *) { @@ -31,7 +39,7 @@ SetLightsWithTimeOfDayColour(RpWorld *) RwMatrix mat; if(pAmbient){ - if(CMBlur::BlurOn){ + if(USEBLURCOLORS){ AmbientLightColourForFrame.red = CTimeCycle::GetAmbientRed_Bl() * CCoronas::LightsMult; AmbientLightColourForFrame.green = CTimeCycle::GetAmbientGreen_Bl() * CCoronas::LightsMult; AmbientLightColourForFrame.blue = CTimeCycle::GetAmbientBlue_Bl() * CCoronas::LightsMult; @@ -41,7 +49,7 @@ SetLightsWithTimeOfDayColour(RpWorld *) AmbientLightColourForFrame.blue = CTimeCycle::GetAmbientBlue() * CCoronas::LightsMult; } - if(CMBlur::BlurOn){ + if(USEBLURCOLORS){ AmbientLightColourForFrame_PedsCarsAndObjects.red = CTimeCycle::GetAmbientRed_Obj_Bl() * CCoronas::LightsMult; AmbientLightColourForFrame_PedsCarsAndObjects.green = CTimeCycle::GetAmbientGreen_Obj_Bl() * CCoronas::LightsMult; AmbientLightColourForFrame_PedsCarsAndObjects.blue = CTimeCycle::GetAmbientBlue_Obj_Bl() * CCoronas::LightsMult; @@ -302,6 +310,14 @@ ActivateDirectional(void) RpLightSetFlags(pDirect, rpLIGHTLIGHTATOMICS); } +RwRGBAReal FullLight = { 1.0f, 1.0f, 1.0f, 1.0f }; + +void +SetFullAmbient(void) +{ + RpLightSetColor(pAmbient, &FullLight); +} + void SetAmbientColours(void) { diff --git a/src/rw/Lights.h b/src/rw/Lights.h index 6fdd51de..b296816b 100644 --- a/src/rw/Lights.h +++ b/src/rw/Lights.h @@ -1,5 +1,11 @@ #pragma once +extern RpLight *pAmbient; +extern RpLight *pDirect; +extern RpLight *pExtraDirectionals[4]; +extern int LightStrengths[4]; +extern int NumExtraDirLightsInWorld; + void SetLightsWithTimeOfDayColour(RpWorld *); RpWorld *LightsCreate(RpWorld *world); void LightsDestroy(RpWorld *world); diff --git a/src/rw/NodeName.cpp b/src/rw/NodeName.cpp index ad4acffb..a7185e4f 100644 --- a/src/rw/NodeName.cpp +++ b/src/rw/NodeName.cpp @@ -50,8 +50,8 @@ NodeNameStreamWrite(RwStream *stream, RwInt32 binaryLength, const void *object, RwInt32 NodeNameStreamGetSize(const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject) { - // game checks for null pointer on node name extension but that really happen - return (RwInt32)rwstrlen(NODENAMEEXT(object)); + char *name = NODENAMEEXT(object); // can't be nil + return name ? (RwInt32)rwstrlen(name) : 0; } bool diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index 58791ce2..9633e56c 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -209,24 +209,11 @@ GetFirstTexture(RwTexDictionary *txd) return tex; } -#ifdef PED_SKIN -static RpAtomic* -isSkinnedCb(RpAtomic *atomic, void *data) -{ - RpAtomic **pAtomic = (RpAtomic**)data; - if(*pAtomic) - return nil; // already found one - if(RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic))) - *pAtomic = atomic; // we could just return nil here directly... - return atomic; -} - -RpAtomic* +bool IsClumpSkinned(RpClump *clump) { - RpAtomic *atomic = nil; - RpClumpForAllAtomics(clump, isSkinnedCb, &atomic); - return atomic; + RpAtomic *atomic = GetFirstAtomic(clump); + return atomic ? RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic)) : nil; } static RpAtomic* @@ -264,17 +251,6 @@ GetAnimHierarchyFromClump(RpClump *clump) return hier; } -RwFrame* -GetHierarchyFromChildNodesCB(RwFrame *frame, void *data) -{ - RpHAnimHierarchy **pHier = (RpHAnimHierarchy**)data; - RpHAnimHierarchy *hier = RpHAnimFrameGetHierarchy(frame); - if(hier == nil) - RwFrameForAllChildren(frame, GetHierarchyFromChildNodesCB, &hier); - *pHier = hier; - return nil; -} - void SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable) { @@ -290,8 +266,7 @@ SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable) if(boneTable == nil) return; -// atomic = GetFirstAtomic(clump); // mobile, also VC - atomic = IsClumpSkinned(clump); // xbox, seems safer + atomic = GetFirstAtomic(clump); // mobile, also VC assert(atomic); skin = RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic)); assert(skin); @@ -397,7 +372,6 @@ RenderSkeleton(RpHAnimHierarchy *hier) par = stack[--sp]; } } -#endif RwBool Im2DRenderQuad(RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal z, RwReal recipCamZ, RwReal uvOffset) @@ -560,6 +534,7 @@ 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 )) { RwRaster *raster; @@ -844,4 +819,4 @@ RestoreAlphaTest() RwD3D8SetRenderState(D3DRS_ALPHAREF, saved_alpharef); #endif } -#endif
\ No newline at end of file +#endif diff --git a/src/rw/RwHelper.h b/src/rw/RwHelper.h index 3f1a3d19..cbcbb2e0 100644 --- a/src/rw/RwHelper.h +++ b/src/rw/RwHelper.h @@ -18,16 +18,13 @@ RwObject *GetFirstObject(RwFrame *frame); RpAtomic *GetFirstAtomic(RpClump *clump); RwTexture *GetFirstTexture(RwTexDictionary *txd); -#ifdef PED_SKIN -RpAtomic *IsClumpSkinned(RpClump *clump); +bool IsClumpSkinned(RpClump *clump); RpHAnimHierarchy *GetAnimHierarchyFromSkinClump(RpClump *clump); // get from atomic RpHAnimHierarchy *GetAnimHierarchyFromClump(RpClump *clump); // get from frame -RwFrame *GetHierarchyFromChildNodesCB(RwFrame *frame, void *data); void SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable); RpHAnimAnimation *HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier); RpAtomic *AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data); void RenderSkeleton(RpHAnimHierarchy *hier); -#endif RwBool Im2DRenderQuad(RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal z, RwReal recipCamZ, RwReal uvOffset); RpClump *RpClumpGetBoundingSphere(RpClump *clump, RwSphere *sphere, bool useLTM); @@ -38,6 +35,7 @@ RwTexDictionary *RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary void ReadVideoCardCapsFile(uint32&, uint32&, uint32&, uint32&); bool CheckVideoCardCaps(void); void WriteVideoCardCapsFile(void); +bool CanVideoCardDoDXT(void); void ConvertingTexturesScreen(uint32, uint32, const char*); void DealWithTxdWriteError(uint32, uint32, const char*); bool CreateTxdImageForVideoCard(); diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 4087029b..ad7d8fec 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -1,7 +1,13 @@ #pragma warning( push ) #pragma warning( disable : 4005) #pragma warning( pop ) +#ifndef LIBRW +#define WITHD3D +#endif #include "common.h" +#ifndef LIBRW +#include "rpanisot.h" +#endif #include "crossplatform.h" #include "platform.h" @@ -47,6 +53,15 @@ RwTextureGtaStreamRead(RwStream *stream) texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1); texNumLoaded++; } + + if(tex == nil) + return nil; + +#ifndef LIBRW + if(RpAnisotTextureGetMaxAnisotropy(tex) > 1) + RpAnisotTextureSetMaxAnisotropy(tex, RpAnisotTextureGetMaxAnisotropy(tex)); +#endif + return tex; } @@ -152,6 +167,7 @@ RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict) #ifdef GTA_PC #ifdef RWLIBS extern "C" RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags); +extern "C" RwBool _rwD3D8CheckValidTextureFormat(RwInt32 format); #else RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags); #endif @@ -202,8 +218,20 @@ WriteVideoCardCapsFile(void) } } -bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); -void DoRWStuffEndOfFrame(void); +bool +CanVideoCardDoDXT(void) +{ +#ifdef LIBRW + // TODO +#ifdef RW_OPENGL + return false; +#else + return true; +#endif +#else + return _rwD3D8CheckValidTextureFormat(D3DFMT_DXT1) && _rwD3D8CheckValidTextureFormat(D3DFMT_DXT3); +#endif +} void ConvertingTexturesScreen(uint32 num, uint32 count, const char *text) @@ -229,6 +257,7 @@ ConvertingTexturesScreen(uint32 num, uint32 count, const char *text) CFont::SetBackgroundOff(); CFont::SetPropOn(); CFont::SetScale(SCREEN_SCALE_X(0.45f), SCREEN_SCALE_Y(0.7f)); + CFont::SetCentreOff(); CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f)); CFont::SetJustifyOff(); CFont::SetColor(CRGBA(255, 217, 106, 255)); @@ -289,6 +318,11 @@ CreateTxdImageForVideoCard() ConvertingTexturesScreen(i, TXDSTORESIZE, "CVT_MSG"); if (CTxdStore::GetSlot(i) != nil && CStreaming::IsObjectInCdImage(i + STREAM_OFFSET_TXD)) { +#ifdef FIX_BUGS + if(strcmp(CTxdStore::GetTxdName(i), "generic") == 0) + continue; +#endif + CStreaming::RequestTxd(i, STREAMFLAGS_KEEP_IN_MEMORY); CStreaming::RequestModelStream(0); CStreaming::FlushChannels(); diff --git a/src/rw/TxdStore.cpp b/src/rw/TxdStore.cpp index 51d018f6..0bd29718 100644 --- a/src/rw/TxdStore.cpp +++ b/src/rw/TxdStore.cpp @@ -13,7 +13,7 @@ void CTxdStore::Initialise(void) { if(ms_pTxdPool == nil) - ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE); + ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE, "TexDictionary"); } void @@ -58,11 +58,10 @@ CTxdStore::RemoveTxdSlot(int slot) int CTxdStore::FindTxdSlot(const char *name) { - char *defname; int size = ms_pTxdPool->GetSize(); for(int i = 0; i < size; i++){ - defname = GetTxdName(i); - if(defname && !CGeneral::faststricmp(defname, name)) + TxdDef *def = GetSlot(i); + if(def && !CGeneral::faststricmp(def->name, name)) return i; } return -1; @@ -71,8 +70,7 @@ CTxdStore::FindTxdSlot(const char *name) char* CTxdStore::GetTxdName(int slot) { - TxdDef *def = GetSlot(slot); - return def ? def->name : nil; + return GetSlot(slot)->name; } void @@ -91,9 +89,7 @@ CTxdStore::PopCurrentTxd(void) void CTxdStore::SetCurrentTxd(int slot) { - TxdDef *def = GetSlot(slot); - if(def) - RwTexDictionarySetCurrent(def->texDict); + RwTexDictionarySetCurrent(GetSlot(slot)->texDict); } void @@ -118,7 +114,7 @@ void CTxdStore::RemoveRef(int slot) { if(--GetSlot(slot)->refCount <= 0) - CStreaming::RemoveModel(slot + STREAM_OFFSET_TXD); + CStreaming::RemoveTxd(slot); } void diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index ac80eff0..36a60117 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -9,6 +9,7 @@ #include "Camera.h" #include "VisibilityPlugins.h" #include "World.h" +#include "custompipes.h" //--MIAMI: file done @@ -193,6 +194,10 @@ CVisibilityPlugins::RenderFadingEntities(CLinkList<AlphaObjectInfo> &list) CEntity *e = node->item.entity; if(e->m_rwObject == nil) continue; +#ifdef EXTENDED_PIPELINES + if(CustomPipes::bRenderingEnvMap && (e->IsPed() || e->IsVehicle())) + continue; +#endif mi = (CSimpleModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex()); if(mi->GetModelType() == MITYPE_SIMPLE && mi->m_noZwrite) RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE); |