This commit is contained in:
Fire-Head
2020-12-19 22:33:17 +03:00
98 changed files with 2783 additions and 2201 deletions

View File

@@ -415,6 +415,63 @@ PluginAttach(void)
return TRUE;
}
#ifdef GTA_PS2
#define NUM_PREALLOC_ATOMICS 3245
#define NUM_PREALLOC_CLUMPS 101
#define NUM_PREALLOC_FRAMES 2821
#define NUM_PREALLOC_GEOMETRIES 1404
#define NUM_PREALLOC_TEXDICTS 106
#define NUM_PREALLOC_TEXTURES 1900
#define NUM_PREALLOC_MATERIALS 3300
bool preAlloc;
void
PreAllocateRwObjects(void)
{
int i;
void **tmp = new void*[0x8000];
preAlloc = true;
for(i = 0; i < NUM_PREALLOC_ATOMICS; i++)
tmp[i] = RpAtomicCreate();
for(i = 0; i < NUM_PREALLOC_ATOMICS; i++)
RpAtomicDestroy((RpAtomic*)tmp[i]);
for(i = 0; i < NUM_PREALLOC_CLUMPS; i++)
tmp[i] = RpClumpCreate();
for(i = 0; i < NUM_PREALLOC_CLUMPS; i++)
RpClumpDestroy((RpClump*)tmp[i]);
for(i = 0; i < NUM_PREALLOC_FRAMES; i++)
tmp[i] = RwFrameCreate();
for(i = 0; i < NUM_PREALLOC_FRAMES; i++)
RwFrameDestroy((RwFrame*)tmp[i]);
for(i = 0; i < NUM_PREALLOC_GEOMETRIES; i++)
tmp[i] = RpGeometryCreate(0, 0, 0);
for(i = 0; i < NUM_PREALLOC_GEOMETRIES; i++)
RpGeometryDestroy((RpGeometry*)tmp[i]);
for(i = 0; i < NUM_PREALLOC_TEXDICTS; i++)
tmp[i] = RwTexDictionaryCreate();
for(i = 0; i < NUM_PREALLOC_TEXDICTS; i++)
RwTexDictionaryDestroy((RwTexDictionary*)tmp[i]);
for(i = 0; i < NUM_PREALLOC_TEXTURES; i++)
tmp[i] = RwTextureCreate(RwRasterCreate(0, 0, 0, 0));
for(i = 0; i < NUM_PREALLOC_TEXDICTS; i++)
RwTextureDestroy((RwTexture*)tmp[i]);
for(i = 0; i < NUM_PREALLOC_MATERIALS; i++)
tmp[i] = RpMaterialCreate();
for(i = 0; i < NUM_PREALLOC_MATERIALS; i++)
RpMaterialDestroy((RpMaterial*)tmp[i]);
delete[] tmp;
preAlloc = false;
}
#endif
static RwBool
Initialise3D(void *param)
{
@@ -621,8 +678,10 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
AsciiToUnicode(str1, tmpstr);
CFont::PrintString(hpos, vpos, tmpstr);
vpos += 22*yscale;
AsciiToUnicode(str2, tmpstr);
CFont::PrintString(hpos, vpos, tmpstr);
if (str2) {
AsciiToUnicode(str2, tmpstr);
CFont::PrintString(hpos, vpos, tmpstr);
}
#endif
}
@@ -1581,15 +1640,6 @@ AppEventHandler(RsEvent event, void *param)
return rsEVENTPROCESSED;
}
#ifndef MASTER
case rsANIMVIEWER:
{
TheModelViewer();
return rsEVENTPROCESSED;
}
#endif
default:
{
return rsEVENTNOTPROCESSED;
@@ -1604,8 +1654,11 @@ TheModelViewer(void)
#if (defined(GTA_PS2) || defined(GTA_XBOX))
//TODO
#else
// This is III Mobile code. III Xbox code run it like main function, which is impossible to implement on PC's state machine implementation.
// Also we want 2D things initialized in here to print animation ids etc., our additions for that marked with X
#ifdef ASPECT_RATIO_SCALE
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
CDraw::SetAspectRatio(CDraw::FindAspectRatio()); // X
#endif
CAnimViewer::Update();
CTimer::Update();
@@ -1615,12 +1668,12 @@ TheModelViewer(void)
CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
255);
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
CSprite2d::InitPerFrame(); // X
CFont::InitPerFrame(); // X
DefinedState();
CVisibilityPlugins::InitAlphaEntityList();
CAnimViewer::Render();
Render2dStuff();
Render2dStuff(); // X
DoRWStuffEndOfFrame();
#endif
}