summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/Game.cpp47
-rw-r--r--src/core/main.cpp18
-rw-r--r--src/modelinfo/VehicleModelInfo.cpp9
-rw-r--r--src/rw/VisibilityPlugins.cpp5
4 files changed, 61 insertions, 18 deletions
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index dfc13bb2..33302653 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -170,26 +170,39 @@ void ReplaceAtomicPipeCallback();
#endif // PS2_ALPHA_TEST
#endif // !LIBRW
-// missing altogether on PS2, mostly done in GameInit there it seems
bool
CGame::InitialiseRenderWare(void)
{
#ifdef USE_TEXTURE_POOL
_TexturePoolsInitialise();
#endif
-
- CTxdStore::Initialise();
- CVisibilityPlugins::Initialise();
-
+
+#if GTA_VERSION > GTA3_PS2_160
+ 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 */
- Scene.camera = CameraCreate(RsGlobal.width, RsGlobal.height, TRUE);
+ Scene.camera = CameraCreate(SCREEN_WIDTH, SCREEN_HEIGHT, TRUE);
ASSERT(Scene.camera != nil);
if (!Scene.camera)
{
return (false);
}
- RwCameraSetFarClipPlane(Scene.camera, 2000.0f);
+ RwCameraSetFarClipPlane(Scene.camera, 2000.0f); // 250.0f on PS2 but who cares
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
@@ -212,8 +225,12 @@ CGame::InitialiseRenderWare(void)
/* Add the camera to the world */
RpWorldAddCamera(Scene.world, Scene.camera);
LightsCreate(Scene.world);
-
- CreateDebugFont();
+
+#if GTA_VERSION > GTA3_PS2_160
+ CreateDebugFont(); // in GameInit on PS2
+#else
+ RwImageSetPath("textures");
+#endif
#ifdef LIBRW
#ifdef PS2_MATFX
@@ -229,9 +246,16 @@ CGame::InitialiseRenderWare(void)
ReplaceAtomicPipeCallback();
#endif // PS2_ALPHA_TEST
#endif // LIBRW
-
+
+
+#if GTA_VERSION > GTA3_PS2_160
+ // in GameInit on PS2
+ PUSH_MEMID(MEMID_TEXTURES);
CFont::Initialise();
CHud::Initialise();
+ POP_MEMID();
+#endif
+ // TODO: define
CPlayerSkin::Initialise();
return (true);
@@ -247,7 +271,8 @@ void CGame::ShutdownRenderWare(void)
for ( int32 i = 0; i < NUMPLAYERS; i++ )
CWorld::Players[i].DeletePlayerSkin();
-
+
+ // TODO: define
CPlayerSkin::Shutdown();
DestroyDebugFont();
diff --git a/src/core/main.cpp b/src/core/main.cpp
index ebfa096a..54821979 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -114,7 +114,7 @@ void DebugMenuPopulate(void);
bool gbPrintMemoryUsage;
#endif
-#ifdef GTA_PS2
+#ifdef PS2_MENU
#define WANT_TO_LOAD TheMemoryCard.m_bWantToLoad
#define FOUND_GAME_TO_LOAD TheMemoryCard.b_FoundRecentSavedGameWantToLoad
#else
@@ -415,7 +415,6 @@ PluginAttach(void)
return TRUE;
}
-// rather different on PS2
static RwBool
Initialise3D(void *param)
{
@@ -1766,7 +1765,7 @@ void SystemInit()
#ifdef GTA_PS2
CFileMgr::InitCd();
- Char modulepath[256];
+ char modulepath[256];
strcpy(modulepath, "cdrom0:\\");
strcat(modulepath, "SYSTEM\\");
@@ -1989,7 +1988,7 @@ void GameInit()
CreateDebugFont();
#ifdef GTA_PS2
- AddIntcHandler(_TODOCONST(2), VBlankCounter, 0);
+ AddIntcHandler(INTC_VBLANK_S, VBlankCounter, 0);
#endif
CameraSize(Scene.camera, NULL, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
@@ -2031,8 +2030,7 @@ main(int argc, char *argv[])
#ifdef GTA_PS2
int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
- if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
- && r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
+ if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT )
{
GameInit();
@@ -2042,6 +2040,8 @@ main(int argc, char *argv[])
CFont::Initialise();
FrontEndMenuManager.DrawMemoryCardStartUpMenus();
+ }else if(r == CMemoryCard::ERR_OPENNOENTRY || r == CMemoryCard::ERR_NONE){
+ // eh?
}
#endif
@@ -2052,12 +2052,18 @@ main(int argc, char *argv[])
InitMPEGPlayer();
+#ifdef GTA_PAL
PlayMPEG("cdrom0:\\MOVIES\\DMAPAL.PSS;1", false);
if (CGame::frenchGame || CGame::germanGame)
PlayMPEG("cdrom0:\\MOVIES\\INTROPAF.PSS;1", true);
else
PlayMPEG("cdrom0:\\MOVIES\\INTROPAL.PSS;1", true);
+#else
+ PlayMPEG("cdrom0:\\MOVIES\\DMANTSC.PSS;1", false);
+
+ PlayMPEG("cdrom0:\\MOVIES\\INTRNTSC.PSS;1", true);
+#endif
ShutdownMPEGPlayer();
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp
index afda70d3..17754211 100644
--- a/src/modelinfo/VehicleModelInfo.cpp
+++ b/src/modelinfo/VehicleModelInfo.cpp
@@ -998,6 +998,8 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpMaterial *material, void *data)
return material;
}
+bool initialised;
+
RpAtomic*
CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data)
{
@@ -1011,7 +1013,12 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data)
RpGeometryForAllMaterials(geo, SetEnvironmentMapCB, data);
RpGeometrySetFlags(geo, RpGeometryGetFlags(geo) | rpGEOMETRYMODULATEMATERIALCOLOR);
RpMatFXAtomicEnableEffects(atomic);
- // PS2 sets of PS2Manager lighting CB here
+#ifdef GTA_PS2
+ if(!initialised){
+ SetupPS2ManagerLightingCallback(RpAtomicGetInstancePipeline(atomic));
+ initialised = true;
+ }
+#endif
}
return atomic;
}
diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp
index f931019c..d81c97f2 100644
--- a/src/rw/VisibilityPlugins.cpp
+++ b/src/rw/VisibilityPlugins.cpp
@@ -819,6 +819,11 @@ CVisibilityPlugins::PluginAttach(void)
ms_clumpPluginOffset = RpClumpRegisterPlugin(sizeof(ClumpExt),
ID_VISIBILITYCLUMP,
ClumpConstructor, ClumpDestructor, ClumpCopyConstructor);
+
+#if GTA_VERSION <= GTA3_PS2_16
+ Initialise();
+#endif
+
return ms_atomicPluginOffset != -1 && ms_clumpPluginOffset != -1;
}