bit more GTA_VERSION and GTA_PS2

This commit is contained in:
aap 2020-12-04 01:12:58 +01:00
parent 814771c3b5
commit 9714a37769
4 changed files with 61 additions and 18 deletions

View File

@ -170,7 +170,6 @@ void ReplaceAtomicPipeCallback();
#endif // PS2_ALPHA_TEST #endif // PS2_ALPHA_TEST
#endif // !LIBRW #endif // !LIBRW
// missing altogether on PS2, mostly done in GameInit there it seems
bool bool
CGame::InitialiseRenderWare(void) CGame::InitialiseRenderWare(void)
{ {
@ -178,18 +177,32 @@ CGame::InitialiseRenderWare(void)
_TexturePoolsInitialise(); _TexturePoolsInitialise();
#endif #endif
CTxdStore::Initialise(); #if GTA_VERSION > GTA3_PS2_160
CVisibilityPlugins::Initialise(); CTxdStore::Initialise(); // in GameInit on ps2
CVisibilityPlugins::Initialise(); // in plugin attach on ps2
#endif
//InitialiseScene(Scene); // PS2 only, only clears Scene.camera
#ifdef GTA_PS2
RpSkySelectTrueTSClipper(TRUE);
RpSkySelectTrueTLClipper(TRUE);
// PS2ManagerApplyDirectionalLightingCB() uploads the GTA lights
// directly without going through RpWorld and all that
SetupPS2ManagerDefaultLightingCallback();
PreAllocateRwObjects();
#endif
/* Create camera */ /* Create camera */
Scene.camera = CameraCreate(RsGlobal.width, RsGlobal.height, TRUE); Scene.camera = CameraCreate(SCREEN_WIDTH, SCREEN_HEIGHT, TRUE);
ASSERT(Scene.camera != nil); ASSERT(Scene.camera != nil);
if (!Scene.camera) if (!Scene.camera)
{ {
return (false); return (false);
} }
RwCameraSetFarClipPlane(Scene.camera, 2000.0f); RwCameraSetFarClipPlane(Scene.camera, 2000.0f); // 250.0f on PS2 but who cares
RwCameraSetNearClipPlane(Scene.camera, 0.9f); RwCameraSetNearClipPlane(Scene.camera, 0.9f);
CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO); CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
@ -213,7 +226,11 @@ CGame::InitialiseRenderWare(void)
RpWorldAddCamera(Scene.world, Scene.camera); RpWorldAddCamera(Scene.world, Scene.camera);
LightsCreate(Scene.world); LightsCreate(Scene.world);
CreateDebugFont(); #if GTA_VERSION > GTA3_PS2_160
CreateDebugFont(); // in GameInit on PS2
#else
RwImageSetPath("textures");
#endif
#ifdef LIBRW #ifdef LIBRW
#ifdef PS2_MATFX #ifdef PS2_MATFX
@ -230,8 +247,15 @@ CGame::InitialiseRenderWare(void)
#endif // PS2_ALPHA_TEST #endif // PS2_ALPHA_TEST
#endif // LIBRW #endif // LIBRW
#if GTA_VERSION > GTA3_PS2_160
// in GameInit on PS2
PUSH_MEMID(MEMID_TEXTURES);
CFont::Initialise(); CFont::Initialise();
CHud::Initialise(); CHud::Initialise();
POP_MEMID();
#endif
// TODO: define
CPlayerSkin::Initialise(); CPlayerSkin::Initialise();
return (true); return (true);
@ -248,6 +272,7 @@ void CGame::ShutdownRenderWare(void)
for ( int32 i = 0; i < NUMPLAYERS; i++ ) for ( int32 i = 0; i < NUMPLAYERS; i++ )
CWorld::Players[i].DeletePlayerSkin(); CWorld::Players[i].DeletePlayerSkin();
// TODO: define
CPlayerSkin::Shutdown(); CPlayerSkin::Shutdown();
DestroyDebugFont(); DestroyDebugFont();

View File

@ -114,7 +114,7 @@ void DebugMenuPopulate(void);
bool gbPrintMemoryUsage; bool gbPrintMemoryUsage;
#endif #endif
#ifdef GTA_PS2 #ifdef PS2_MENU
#define WANT_TO_LOAD TheMemoryCard.m_bWantToLoad #define WANT_TO_LOAD TheMemoryCard.m_bWantToLoad
#define FOUND_GAME_TO_LOAD TheMemoryCard.b_FoundRecentSavedGameWantToLoad #define FOUND_GAME_TO_LOAD TheMemoryCard.b_FoundRecentSavedGameWantToLoad
#else #else
@ -415,7 +415,6 @@ PluginAttach(void)
return TRUE; return TRUE;
} }
// rather different on PS2
static RwBool static RwBool
Initialise3D(void *param) Initialise3D(void *param)
{ {
@ -1766,7 +1765,7 @@ void SystemInit()
#ifdef GTA_PS2 #ifdef GTA_PS2
CFileMgr::InitCd(); CFileMgr::InitCd();
Char modulepath[256]; char modulepath[256];
strcpy(modulepath, "cdrom0:\\"); strcpy(modulepath, "cdrom0:\\");
strcat(modulepath, "SYSTEM\\"); strcat(modulepath, "SYSTEM\\");
@ -1989,7 +1988,7 @@ void GameInit()
CreateDebugFont(); CreateDebugFont();
#ifdef GTA_PS2 #ifdef GTA_PS2
AddIntcHandler(_TODOCONST(2), VBlankCounter, 0); AddIntcHandler(INTC_VBLANK_S, VBlankCounter, 0);
#endif #endif
CameraSize(Scene.camera, NULL, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO); CameraSize(Scene.camera, NULL, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
@ -2031,8 +2030,7 @@ main(int argc, char *argv[])
#ifdef GTA_PS2 #ifdef GTA_PS2
int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE); int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT )
&& r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
{ {
GameInit(); GameInit();
@ -2042,6 +2040,8 @@ main(int argc, char *argv[])
CFont::Initialise(); CFont::Initialise();
FrontEndMenuManager.DrawMemoryCardStartUpMenus(); FrontEndMenuManager.DrawMemoryCardStartUpMenus();
}else if(r == CMemoryCard::ERR_OPENNOENTRY || r == CMemoryCard::ERR_NONE){
// eh?
} }
#endif #endif
@ -2052,12 +2052,18 @@ main(int argc, char *argv[])
InitMPEGPlayer(); InitMPEGPlayer();
#ifdef GTA_PAL
PlayMPEG("cdrom0:\\MOVIES\\DMAPAL.PSS;1", false); PlayMPEG("cdrom0:\\MOVIES\\DMAPAL.PSS;1", false);
if (CGame::frenchGame || CGame::germanGame) if (CGame::frenchGame || CGame::germanGame)
PlayMPEG("cdrom0:\\MOVIES\\INTROPAF.PSS;1", true); PlayMPEG("cdrom0:\\MOVIES\\INTROPAF.PSS;1", true);
else else
PlayMPEG("cdrom0:\\MOVIES\\INTROPAL.PSS;1", true); PlayMPEG("cdrom0:\\MOVIES\\INTROPAL.PSS;1", true);
#else
PlayMPEG("cdrom0:\\MOVIES\\DMANTSC.PSS;1", false);
PlayMPEG("cdrom0:\\MOVIES\\INTRNTSC.PSS;1", true);
#endif
ShutdownMPEGPlayer(); ShutdownMPEGPlayer();

View File

@ -998,6 +998,8 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpMaterial *material, void *data)
return material; return material;
} }
bool initialised;
RpAtomic* RpAtomic*
CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data) CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data)
{ {
@ -1011,7 +1013,12 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data)
RpGeometryForAllMaterials(geo, SetEnvironmentMapCB, data); RpGeometryForAllMaterials(geo, SetEnvironmentMapCB, data);
RpGeometrySetFlags(geo, RpGeometryGetFlags(geo) | rpGEOMETRYMODULATEMATERIALCOLOR); RpGeometrySetFlags(geo, RpGeometryGetFlags(geo) | rpGEOMETRYMODULATEMATERIALCOLOR);
RpMatFXAtomicEnableEffects(atomic); RpMatFXAtomicEnableEffects(atomic);
// PS2 sets of PS2Manager lighting CB here #ifdef GTA_PS2
if(!initialised){
SetupPS2ManagerLightingCallback(RpAtomicGetInstancePipeline(atomic));
initialised = true;
}
#endif
} }
return atomic; return atomic;
} }

View File

@ -819,6 +819,11 @@ CVisibilityPlugins::PluginAttach(void)
ms_clumpPluginOffset = RpClumpRegisterPlugin(sizeof(ClumpExt), ms_clumpPluginOffset = RpClumpRegisterPlugin(sizeof(ClumpExt),
ID_VISIBILITYCLUMP, ID_VISIBILITYCLUMP,
ClumpConstructor, ClumpDestructor, ClumpCopyConstructor); ClumpConstructor, ClumpDestructor, ClumpCopyConstructor);
#if GTA_VERSION <= GTA3_PS2_16
Initialise();
#endif
return ms_atomicPluginOffset != -1 && ms_clumpPluginOffset != -1; return ms_atomicPluginOffset != -1 && ms_clumpPluginOffset != -1;
} }