mirror of
https://github.com/halpz/re3.git
synced 2024-12-26 18:15:27 +00:00
rw stuff done & other small things
This commit is contained in:
parent
30dadcfb22
commit
764af8735c
|
@ -3049,6 +3049,18 @@ CColModel::GetTrianglePoint(CVector &v, int i) const
|
||||||
v = vertices[i].Get();
|
v = vertices[i].Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void*
|
||||||
|
CColModel::operator new(size_t){
|
||||||
|
CColModel *node = CPools::GetColModelPool()->New();
|
||||||
|
assert(node);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CColModel::operator delete(void *p, size_t){
|
||||||
|
CPools::GetColModelPool()->Delete((CColModel*)p);
|
||||||
|
}
|
||||||
|
|
||||||
CColModel&
|
CColModel&
|
||||||
CColModel::operator=(const CColModel &other)
|
CColModel::operator=(const CColModel &other)
|
||||||
{
|
{
|
||||||
|
|
|
@ -181,7 +181,6 @@ struct CStoredCollPoly
|
||||||
bool valid;
|
bool valid;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--MIAMI: done struct
|
|
||||||
struct CColModel
|
struct CColModel
|
||||||
{
|
{
|
||||||
CSphere boundingSphere;
|
CSphere boundingSphere;
|
||||||
|
@ -208,6 +207,8 @@ struct CColModel
|
||||||
void SetLinkPtr(CLink<CColModel*>*);
|
void SetLinkPtr(CLink<CColModel*>*);
|
||||||
void GetTrianglePoint(CVector &v, int i) const;
|
void GetTrianglePoint(CVector &v, int i) const;
|
||||||
|
|
||||||
|
void *operator new(size_t);
|
||||||
|
void operator delete(void *p, size_t);
|
||||||
CColModel& operator=(const CColModel& other);
|
CColModel& operator=(const CColModel& other);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,21 +22,25 @@ CTreadablePool *CPools::ms_pTreadablePool;
|
||||||
CObjectPool *CPools::ms_pObjectPool;
|
CObjectPool *CPools::ms_pObjectPool;
|
||||||
CDummyPool *CPools::ms_pDummyPool;
|
CDummyPool *CPools::ms_pDummyPool;
|
||||||
CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
|
CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
|
||||||
|
CColModelPool *CPools::ms_pColModelPool;
|
||||||
|
|
||||||
|
//--MIAMI: done
|
||||||
void
|
void
|
||||||
CPools::Initialise(void)
|
CPools::Initialise(void)
|
||||||
{
|
{
|
||||||
ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES);
|
ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES, "PtrNode");
|
||||||
ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS);
|
ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS, "EntryInfoNode");
|
||||||
ms_pPedPool = new CPedPool(NUMPEDS);
|
ms_pPedPool = new CPedPool(NUMPEDS, "Peds");
|
||||||
ms_pVehiclePool = new CVehiclePool(NUMVEHICLES);
|
ms_pVehiclePool = new CVehiclePool(NUMVEHICLES, "Vehicles");
|
||||||
ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS);
|
ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS, "Buildings");
|
||||||
ms_pTreadablePool = new CTreadablePool(NUMTREADABLES);
|
ms_pTreadablePool = new CTreadablePool(NUMTREADABLES, "Treadables");
|
||||||
ms_pObjectPool = new CObjectPool(NUMOBJECTS);
|
ms_pObjectPool = new CObjectPool(NUMOBJECTS, "Objects");
|
||||||
ms_pDummyPool = new CDummyPool(NUMDUMMIES);
|
ms_pDummyPool = new CDummyPool(NUMDUMMIES, "Dummys");
|
||||||
ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS);
|
ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS, "AudioScriptObj");
|
||||||
|
ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--MIAMI: done
|
||||||
void
|
void
|
||||||
CPools::ShutDown(void)
|
CPools::ShutDown(void)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +53,7 @@ CPools::ShutDown(void)
|
||||||
debug("Objects left %d\n", ms_pObjectPool->GetNoOfUsedSpaces());
|
debug("Objects left %d\n", ms_pObjectPool->GetNoOfUsedSpaces());
|
||||||
debug("Dummys left %d\n", ms_pDummyPool->GetNoOfUsedSpaces());
|
debug("Dummys left %d\n", ms_pDummyPool->GetNoOfUsedSpaces());
|
||||||
debug("AudioScriptObjects left %d\n", ms_pAudioScriptObjectPool->GetNoOfUsedSpaces());
|
debug("AudioScriptObjects left %d\n", ms_pAudioScriptObjectPool->GetNoOfUsedSpaces());
|
||||||
|
debug("ColModels left %d\n", ms_pColModelPool->GetNoOfUsedSpaces());
|
||||||
printf("Shutdown pool started\n");
|
printf("Shutdown pool started\n");
|
||||||
|
|
||||||
delete ms_pPtrNodePool;
|
delete ms_pPtrNodePool;
|
||||||
|
@ -60,6 +65,7 @@ CPools::ShutDown(void)
|
||||||
delete ms_pObjectPool;
|
delete ms_pObjectPool;
|
||||||
delete ms_pDummyPool;
|
delete ms_pDummyPool;
|
||||||
delete ms_pAudioScriptObjectPool;
|
delete ms_pAudioScriptObjectPool;
|
||||||
|
delete ms_pColModelPool;
|
||||||
|
|
||||||
printf("Shutdown pool done\n");
|
printf("Shutdown pool done\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ typedef CPool<CTreadable> CTreadablePool;
|
||||||
typedef CPool<CObject, CCutsceneObject> CObjectPool;
|
typedef CPool<CObject, CCutsceneObject> CObjectPool;
|
||||||
typedef CPool<CDummy, CDummyPed> CDummyPool;
|
typedef CPool<CDummy, CDummyPed> CDummyPool;
|
||||||
typedef CPool<cAudioScriptObject> CAudioScriptObjectPool;
|
typedef CPool<cAudioScriptObject> CAudioScriptObjectPool;
|
||||||
|
typedef CPool<CColModel> CColModelPool;
|
||||||
|
|
||||||
class CPools
|
class CPools
|
||||||
{
|
{
|
||||||
|
@ -31,6 +32,7 @@ class CPools
|
||||||
static CObjectPool *ms_pObjectPool;
|
static CObjectPool *ms_pObjectPool;
|
||||||
static CDummyPool *ms_pDummyPool;
|
static CDummyPool *ms_pDummyPool;
|
||||||
static CAudioScriptObjectPool *ms_pAudioScriptObjectPool;
|
static CAudioScriptObjectPool *ms_pAudioScriptObjectPool;
|
||||||
|
static CColModelPool *ms_pColModelPool;
|
||||||
public:
|
public:
|
||||||
static CCPtrNodePool *GetPtrNodePool(void) { return ms_pPtrNodePool; }
|
static CCPtrNodePool *GetPtrNodePool(void) { return ms_pPtrNodePool; }
|
||||||
static CEntryInfoNodePool *GetEntryInfoNodePool(void) { return ms_pEntryInfoNodePool; }
|
static CEntryInfoNodePool *GetEntryInfoNodePool(void) { return ms_pEntryInfoNodePool; }
|
||||||
|
@ -41,6 +43,7 @@ public:
|
||||||
static CObjectPool *GetObjectPool(void) { return ms_pObjectPool; }
|
static CObjectPool *GetObjectPool(void) { return ms_pObjectPool; }
|
||||||
static CDummyPool *GetDummyPool(void) { return ms_pDummyPool; }
|
static CDummyPool *GetDummyPool(void) { return ms_pDummyPool; }
|
||||||
static CAudioScriptObjectPool *GetAudioScriptObjectPool(void) { return ms_pAudioScriptObjectPool; }
|
static CAudioScriptObjectPool *GetAudioScriptObjectPool(void) { return ms_pAudioScriptObjectPool; }
|
||||||
|
static CColModelPool *GetColModelPool(void) { return ms_pColModelPool; }
|
||||||
|
|
||||||
static void Initialise(void);
|
static void Initialise(void);
|
||||||
static void ShutDown(void);
|
static void ShutDown(void);
|
||||||
|
|
|
@ -27,16 +27,16 @@ enum Config {
|
||||||
|
|
||||||
// Pool sizes
|
// Pool sizes
|
||||||
NUMPTRNODES = 50000,
|
NUMPTRNODES = 50000,
|
||||||
NUMENTRYINFOS = 5400, // only 3200 in VC???
|
NUMENTRYINFOS = 3200,
|
||||||
NUMPEDS = 140,
|
NUMPEDS = 140,
|
||||||
NUMVEHICLES = 110,
|
NUMVEHICLES = 110,
|
||||||
NUMBUILDINGS = 7000,
|
NUMBUILDINGS = 7000,
|
||||||
NUMTREADABLES = 1214, // 1 in VC
|
NUMTREADABLES = 1,
|
||||||
NUMOBJECTS = 460,
|
NUMOBJECTS = 460,
|
||||||
NUMDUMMIES = 2802, // 2340 in VC
|
NUMDUMMIES = 2340,
|
||||||
NUMAUDIOSCRIPTOBJECTS = 256, // 192 in VC
|
NUMAUDIOSCRIPTOBJECTS = 192,
|
||||||
|
NUMCOLMODELS = 4400,
|
||||||
NUMCUTSCENEOBJECTS = 50, // does not exist in VC
|
NUMCUTSCENEOBJECTS = 50, // does not exist in VC
|
||||||
// TODO(MIAMI): colmodel pool
|
|
||||||
|
|
||||||
NUMANIMBLOCKS = 35,
|
NUMANIMBLOCKS = 35,
|
||||||
NUMANIMATIONS = 450,
|
NUMANIMATIONS = 450,
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
#include "rphanim.h"
|
#include "rphanim.h"
|
||||||
#include "rpskin.h"
|
#include "rpskin.h"
|
||||||
#include "rtbmp.h"
|
#include "rtbmp.h"
|
||||||
|
#ifndef LIBRW
|
||||||
|
#include "rpanisot.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "CdStream.h"
|
#include "CdStream.h"
|
||||||
|
@ -384,6 +387,9 @@ PluginAttach(void)
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#ifndef LIBRW
|
||||||
|
RpAnisotPluginAttach();
|
||||||
|
#endif
|
||||||
#ifdef EXTENDED_PIPELINES
|
#ifdef EXTENDED_PIPELINES
|
||||||
CustomPipes::CustomPipeRegister();
|
CustomPipes::CustomPipeRegister();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,6 +20,9 @@ extern bool gbShowTimebars;
|
||||||
|
|
||||||
class CSprite2d;
|
class CSprite2d;
|
||||||
|
|
||||||
|
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
||||||
|
bool DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
||||||
|
void DoRWStuffEndOfFrame(void);
|
||||||
void InitialiseGame(void);
|
void InitialiseGame(void);
|
||||||
void LoadingScreen(const char *str1, const char *str2, const char *splashscreen);
|
void LoadingScreen(const char *str1, const char *str2, const char *splashscreen);
|
||||||
void LoadingIslandScreen(const char *levelName);
|
void LoadingIslandScreen(const char *levelName);
|
||||||
|
|
|
@ -45,7 +45,7 @@ class CPool
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// TODO(MIAMI): remove ctor without name argument
|
// TODO(MIAMI): remove ctor without name argument
|
||||||
CPool(int size){
|
CPool(int size, const char *name){
|
||||||
// TODO: use new here
|
// TODO: use new here
|
||||||
m_entries = (U*)malloc(sizeof(U)*size);
|
m_entries = (U*)malloc(sizeof(U)*size);
|
||||||
m_flags = (Flags*)malloc(sizeof(Flags)*size);
|
m_flags = (Flags*)malloc(sizeof(Flags)*size);
|
||||||
|
@ -56,8 +56,6 @@ public:
|
||||||
m_flags[i].free = 1;
|
m_flags[i].free = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CPool(int size, const char *name)
|
|
||||||
: CPool(size) {}
|
|
||||||
~CPool() {
|
~CPool() {
|
||||||
Flush();
|
Flush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
//--MIAMI: done
|
||||||
|
|
||||||
struct rpGeometryList
|
struct rpGeometryList
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "Frontend.h"
|
#include "Frontend.h"
|
||||||
#include "MBlur.h"
|
#include "MBlur.h"
|
||||||
|
|
||||||
|
//--MIAMI: done
|
||||||
|
|
||||||
RpLight *pAmbient;
|
RpLight *pAmbient;
|
||||||
RpLight *pDirect;
|
RpLight *pDirect;
|
||||||
RpLight *pExtraDirectionals[4] = { nil };
|
RpLight *pExtraDirectionals[4] = { nil };
|
||||||
|
@ -30,7 +32,6 @@ RwRGBAReal DirectionalLightColour;
|
||||||
#define USEBLURCOLORS CMBlur::BlurOn
|
#define USEBLURCOLORS CMBlur::BlurOn
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
SetLightsWithTimeOfDayColour(RpWorld *)
|
SetLightsWithTimeOfDayColour(RpWorld *)
|
||||||
{
|
{
|
||||||
|
@ -309,6 +310,14 @@ ActivateDirectional(void)
|
||||||
RpLightSetFlags(pDirect, rpLIGHTLIGHTATOMICS);
|
RpLightSetFlags(pDirect, rpLIGHTLIGHTATOMICS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RwRGBAReal FullLight = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
|
|
||||||
|
void
|
||||||
|
SetFullAmbient(void)
|
||||||
|
{
|
||||||
|
RpLightSetColor(pAmbient, &FullLight);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SetAmbientColours(void)
|
SetAmbientColours(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,8 +50,8 @@ NodeNameStreamWrite(RwStream *stream, RwInt32 binaryLength, const void *object,
|
||||||
RwInt32
|
RwInt32
|
||||||
NodeNameStreamGetSize(const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
|
NodeNameStreamGetSize(const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
|
||||||
{
|
{
|
||||||
// game checks for null pointer on node name extension but that really happen
|
char *name = NODENAMEEXT(object); // can't be nil
|
||||||
return (RwInt32)rwstrlen(NODENAMEEXT(object));
|
return name ? (RwInt32)rwstrlen(name) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -209,24 +209,11 @@ GetFirstTexture(RwTexDictionary *txd)
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PED_SKIN
|
bool
|
||||||
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*
|
|
||||||
IsClumpSkinned(RpClump *clump)
|
IsClumpSkinned(RpClump *clump)
|
||||||
{
|
{
|
||||||
RpAtomic *atomic = nil;
|
RpAtomic *atomic = GetFirstAtomic(clump);
|
||||||
RpClumpForAllAtomics(clump, isSkinnedCb, &atomic);
|
return atomic ? RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic)) : nil;
|
||||||
return atomic;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static RpAtomic*
|
static RpAtomic*
|
||||||
|
@ -264,17 +251,6 @@ GetAnimHierarchyFromClump(RpClump *clump)
|
||||||
return hier;
|
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
|
void
|
||||||
SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable)
|
SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable)
|
||||||
{
|
{
|
||||||
|
@ -290,8 +266,7 @@ SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable)
|
||||||
if(boneTable == nil)
|
if(boneTable == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// atomic = GetFirstAtomic(clump); // mobile, also VC
|
atomic = GetFirstAtomic(clump); // mobile, also VC
|
||||||
atomic = IsClumpSkinned(clump); // xbox, seems safer
|
|
||||||
assert(atomic);
|
assert(atomic);
|
||||||
skin = RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic));
|
skin = RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic));
|
||||||
assert(skin);
|
assert(skin);
|
||||||
|
@ -397,7 +372,6 @@ RenderSkeleton(RpHAnimHierarchy *hier)
|
||||||
par = stack[--sp];
|
par = stack[--sp];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
RwBool Im2DRenderQuad(RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal z, RwReal recipCamZ, RwReal uvOffset)
|
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 ))
|
if (( origSize.w != rect->w ) && ( origSize.h != rect->h ))
|
||||||
{
|
{
|
||||||
RwRaster *raster;
|
RwRaster *raster;
|
||||||
|
|
|
@ -18,16 +18,13 @@ RwObject *GetFirstObject(RwFrame *frame);
|
||||||
RpAtomic *GetFirstAtomic(RpClump *clump);
|
RpAtomic *GetFirstAtomic(RpClump *clump);
|
||||||
RwTexture *GetFirstTexture(RwTexDictionary *txd);
|
RwTexture *GetFirstTexture(RwTexDictionary *txd);
|
||||||
|
|
||||||
#ifdef PED_SKIN
|
bool IsClumpSkinned(RpClump *clump);
|
||||||
RpAtomic *IsClumpSkinned(RpClump *clump);
|
|
||||||
RpHAnimHierarchy *GetAnimHierarchyFromSkinClump(RpClump *clump); // get from atomic
|
RpHAnimHierarchy *GetAnimHierarchyFromSkinClump(RpClump *clump); // get from atomic
|
||||||
RpHAnimHierarchy *GetAnimHierarchyFromClump(RpClump *clump); // get from frame
|
RpHAnimHierarchy *GetAnimHierarchyFromClump(RpClump *clump); // get from frame
|
||||||
RwFrame *GetHierarchyFromChildNodesCB(RwFrame *frame, void *data);
|
|
||||||
void SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable);
|
void SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable);
|
||||||
RpHAnimAnimation *HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier);
|
RpHAnimAnimation *HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier);
|
||||||
RpAtomic *AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data);
|
RpAtomic *AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data);
|
||||||
void RenderSkeleton(RpHAnimHierarchy *hier);
|
void RenderSkeleton(RpHAnimHierarchy *hier);
|
||||||
#endif
|
|
||||||
|
|
||||||
RwBool Im2DRenderQuad(RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal z, RwReal recipCamZ, RwReal uvOffset);
|
RwBool Im2DRenderQuad(RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal z, RwReal recipCamZ, RwReal uvOffset);
|
||||||
RpClump *RpClumpGetBoundingSphere(RpClump *clump, RwSphere *sphere, bool useLTM);
|
RpClump *RpClumpGetBoundingSphere(RpClump *clump, RwSphere *sphere, bool useLTM);
|
||||||
|
@ -38,6 +35,7 @@ RwTexDictionary *RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary
|
||||||
void ReadVideoCardCapsFile(uint32&, uint32&, uint32&, uint32&);
|
void ReadVideoCardCapsFile(uint32&, uint32&, uint32&, uint32&);
|
||||||
bool CheckVideoCardCaps(void);
|
bool CheckVideoCardCaps(void);
|
||||||
void WriteVideoCardCapsFile(void);
|
void WriteVideoCardCapsFile(void);
|
||||||
|
bool CanVideoCardDoDXT(void);
|
||||||
void ConvertingTexturesScreen(uint32, uint32, const char*);
|
void ConvertingTexturesScreen(uint32, uint32, const char*);
|
||||||
void DealWithTxdWriteError(uint32, uint32, const char*);
|
void DealWithTxdWriteError(uint32, uint32, const char*);
|
||||||
bool CreateTxdImageForVideoCard();
|
bool CreateTxdImageForVideoCard();
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
#pragma warning( push )
|
#pragma warning( push )
|
||||||
#pragma warning( disable : 4005)
|
#pragma warning( disable : 4005)
|
||||||
#pragma warning( pop )
|
#pragma warning( pop )
|
||||||
|
#define WITHD3D
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#ifndef LIBRW
|
||||||
|
#include "rpanisot.h"
|
||||||
|
#endif
|
||||||
#include "crossplatform.h"
|
#include "crossplatform.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
@ -47,6 +51,15 @@ RwTextureGtaStreamRead(RwStream *stream)
|
||||||
texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1);
|
texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1);
|
||||||
texNumLoaded++;
|
texNumLoaded++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tex == nil)
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
#ifndef LIBRW
|
||||||
|
if(RpAnisotTextureGetMaxAnisotropy(tex) > 1)
|
||||||
|
RpAnisotTextureSetMaxAnisotropy(tex, RpAnisotTextureGetMaxAnisotropy(tex));
|
||||||
|
#endif
|
||||||
|
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +165,7 @@ RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict)
|
||||||
#ifdef GTA_PC
|
#ifdef GTA_PC
|
||||||
#ifdef RWLIBS
|
#ifdef RWLIBS
|
||||||
extern "C" RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags);
|
extern "C" RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags);
|
||||||
|
extern "C" RwBool _rwD3D8CheckValidTextureFormat(RwInt32 format);
|
||||||
#else
|
#else
|
||||||
RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags);
|
RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags);
|
||||||
#endif
|
#endif
|
||||||
|
@ -202,8 +216,16 @@ WriteVideoCardCapsFile(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
bool
|
||||||
void DoRWStuffEndOfFrame(void);
|
CanVideoCardDoDXT(void)
|
||||||
|
{
|
||||||
|
#ifdef LIBRW
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return _rwD3D8CheckValidTextureFormat(D3DFMT_DXT1) && _rwD3D8CheckValidTextureFormat(D3DFMT_DXT3);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ConvertingTexturesScreen(uint32 num, uint32 count, const char *text)
|
ConvertingTexturesScreen(uint32 num, uint32 count, const char *text)
|
||||||
|
@ -229,6 +251,7 @@ ConvertingTexturesScreen(uint32 num, uint32 count, const char *text)
|
||||||
CFont::SetBackgroundOff();
|
CFont::SetBackgroundOff();
|
||||||
CFont::SetPropOn();
|
CFont::SetPropOn();
|
||||||
CFont::SetScale(SCREEN_SCALE_X(0.45f), SCREEN_SCALE_Y(0.7f));
|
CFont::SetScale(SCREEN_SCALE_X(0.45f), SCREEN_SCALE_Y(0.7f));
|
||||||
|
CFont::SetCentreOff();
|
||||||
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f));
|
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f));
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
CFont::SetColor(CRGBA(255, 217, 106, 255));
|
CFont::SetColor(CRGBA(255, 217, 106, 255));
|
||||||
|
|
|
@ -13,7 +13,7 @@ void
|
||||||
CTxdStore::Initialise(void)
|
CTxdStore::Initialise(void)
|
||||||
{
|
{
|
||||||
if(ms_pTxdPool == nil)
|
if(ms_pTxdPool == nil)
|
||||||
ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE);
|
ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE, "TexDictionary");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -58,11 +58,10 @@ CTxdStore::RemoveTxdSlot(int slot)
|
||||||
int
|
int
|
||||||
CTxdStore::FindTxdSlot(const char *name)
|
CTxdStore::FindTxdSlot(const char *name)
|
||||||
{
|
{
|
||||||
char *defname;
|
|
||||||
int size = ms_pTxdPool->GetSize();
|
int size = ms_pTxdPool->GetSize();
|
||||||
for(int i = 0; i < size; i++){
|
for(int i = 0; i < size; i++){
|
||||||
defname = GetTxdName(i);
|
TxdDef *def = GetSlot(i);
|
||||||
if(defname && !CGeneral::faststricmp(defname, name))
|
if(def && !CGeneral::faststricmp(def->name, name))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -71,8 +70,7 @@ CTxdStore::FindTxdSlot(const char *name)
|
||||||
char*
|
char*
|
||||||
CTxdStore::GetTxdName(int slot)
|
CTxdStore::GetTxdName(int slot)
|
||||||
{
|
{
|
||||||
TxdDef *def = GetSlot(slot);
|
return GetSlot(slot)->name;
|
||||||
return def ? def->name : nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -91,9 +89,7 @@ CTxdStore::PopCurrentTxd(void)
|
||||||
void
|
void
|
||||||
CTxdStore::SetCurrentTxd(int slot)
|
CTxdStore::SetCurrentTxd(int slot)
|
||||||
{
|
{
|
||||||
TxdDef *def = GetSlot(slot);
|
RwTexDictionarySetCurrent(GetSlot(slot)->texDict);
|
||||||
if(def)
|
|
||||||
RwTexDictionarySetCurrent(def->texDict);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -118,7 +114,7 @@ void
|
||||||
CTxdStore::RemoveRef(int slot)
|
CTxdStore::RemoveRef(int slot)
|
||||||
{
|
{
|
||||||
if(--GetSlot(slot)->refCount <= 0)
|
if(--GetSlot(slot)->refCount <= 0)
|
||||||
CStreaming::RemoveModel(slot + STREAM_OFFSET_TXD);
|
CStreaming::RemoveTxd(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue