mirror of
https://github.com/halpz/re3.git
synced 2025-07-14 01:48:10 +00:00
changes to RW layer so loading foreign files works
This commit is contained in:
@ -332,6 +332,16 @@ CFileLoader::FindRelatedModelInfoCB(RpAtomic *atomic, void *data)
|
||||
return atomic;
|
||||
}
|
||||
|
||||
#ifdef LIBRW
|
||||
void
|
||||
InitClump(RpClump *clump)
|
||||
{
|
||||
RpClumpForAllAtomics(clump, ConvertPlatformAtomic, nil);
|
||||
}
|
||||
#else
|
||||
#define InitClump(clump)
|
||||
#endif
|
||||
|
||||
void
|
||||
CFileLoader::LoadModelFile(const char *filename)
|
||||
{
|
||||
@ -343,6 +353,7 @@ CFileLoader::LoadModelFile(const char *filename)
|
||||
if(RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)){
|
||||
clump = RpClumpStreamRead(stream);
|
||||
if(clump){
|
||||
InitClump(clump);
|
||||
RpClumpForAllAtomics(clump, FindRelatedModelInfoCB, clump);
|
||||
RpClumpDestroy(clump);
|
||||
}
|
||||
@ -368,6 +379,7 @@ CFileLoader::LoadClumpFile(const char *filename)
|
||||
GetNameAndLOD(nodename, name, &n);
|
||||
mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(name, nil);
|
||||
if(mi){
|
||||
InitClump(clump);
|
||||
assert(mi->IsClump());
|
||||
mi->SetClump(clump);
|
||||
}else
|
||||
@ -393,6 +405,7 @@ CFileLoader::LoadClumpFile(RwStream *stream, uint32 id)
|
||||
if (mi->GetModelType() == MITYPE_PED && id != 0 && RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)) {
|
||||
// Read LOD ped
|
||||
clump = RpClumpStreamRead(stream);
|
||||
InitClump(clump);
|
||||
if(clump){
|
||||
((CPedModelInfo*)mi)->SetLowDetailClump(clump);
|
||||
RpClumpDestroy(clump);
|
||||
@ -423,6 +436,7 @@ CFileLoader::FinishLoadClumpFile(RwStream *stream, uint32 id)
|
||||
clump = RpClumpGtaStreamRead2(stream);
|
||||
|
||||
if(clump){
|
||||
InitClump(clump);
|
||||
mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(id);
|
||||
mi->SetClump(clump);
|
||||
return true;
|
||||
@ -443,6 +457,7 @@ CFileLoader::LoadAtomicFile(RwStream *stream, uint32 id)
|
||||
clump = RpClumpStreamRead(stream);
|
||||
if(clump == nil)
|
||||
return false;
|
||||
InitClump(clump);
|
||||
gpRelatedModelInfo = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id);
|
||||
RpClumpForAllAtomics(clump, SetRelatedModelInfoCB, clump);
|
||||
RpClumpDestroy(clump);
|
||||
@ -806,6 +821,8 @@ CFileLoader::LoadAtomicFile2Return(const char *filename)
|
||||
stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, filename);
|
||||
if(RwStreamFindChunk(stream, rwID_CLUMP, nil, nil))
|
||||
clump = RpClumpStreamRead(stream);
|
||||
if(clump)
|
||||
InitClump(clump);
|
||||
RwStreamClose(stream, nil);
|
||||
return clump;
|
||||
}
|
||||
|
@ -390,6 +390,7 @@ CStreaming::LoadCdDirectory(const char *dirname, int n)
|
||||
assert(sizeof(direntry) == 32);
|
||||
while(CFileMgr::Read(fd, (char*)&direntry, sizeof(direntry))){
|
||||
dot = strchr(direntry.name, '.');
|
||||
assert(dot);
|
||||
if(dot) *dot = '\0';
|
||||
if(direntry.size > (uint32)ms_streamingBufferSize)
|
||||
ms_streamingBufferSize = direntry.size;
|
||||
|
@ -89,7 +89,11 @@ RwRGBA gColourTop;
|
||||
bool gameAlreadyInitialised;
|
||||
|
||||
float NumberOfChunksLoaded;
|
||||
#ifdef GTA_PS2
|
||||
#define TOTALNUMCHUNKS 48.0f
|
||||
#else
|
||||
#define TOTALNUMCHUNKS 73.0f
|
||||
#endif
|
||||
|
||||
bool g_SlowMode = false;
|
||||
char version_name[64];
|
||||
|
Reference in New Issue
Block a user