diff --git a/src/core/config.h b/src/core/config.h index 9f1981be..cbe692a5 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -5,147 +5,20 @@ #define VANILLA_DEFINES #endif -enum Config { - NUMPLAYERS = 1, // 4 on PS2 - - NUMCDIMAGES = 12, // gta3.img duplicates (not used on PC) - MAX_CDIMAGES = 8, // additional cdimages - MAX_CDCHANNELS = 5, - - MODELINFOSIZE = 5500, // 3150 on PS2 -#ifdef VANILLA_DEFINES - TXDSTORESIZE = 850, -#else - TXDSTORESIZE = 1024, // for Xbox map -#endif - EXTRADIRSIZE = 128, - CUTSCENEDIRSIZE = 512, - - SIMPLEMODELSIZE = 5000, // 2910 on PS2 - MLOMODELSIZE = 1, - MLOINSTANCESIZE = 1, - TIMEMODELSIZE = 30, - CLUMPMODELSIZE = 5, - PEDMODELSIZE = 90, - VEHICLEMODELSIZE = 120, // 70 on PS2 - XTRACOMPSMODELSIZE = 2, - TWODFXSIZE = 2000, // 1210 on PS2 - - MAXVEHICLESLOADED = 50, // 70 on mobile - - NUMOBJECTINFO = 168, // object.dat - - // Pool sizes - NUMPTRNODES = 30000, // 26000 on PS2 - NUMENTRYINFOS = 5400, // 3200 on PS2 - NUMPEDS = 140, // 90 on PS2 - NUMVEHICLES = 110, // 70 on PS2 - NUMBUILDINGS = 5500, // 4915 on PS2 - NUMTREADABLES = 1214, - NUMOBJECTS = 450, - NUMDUMMIES = 2802, // 2368 on PS2 - NUMAUDIOSCRIPTOBJECTS = 256, - NUMCUTSCENEOBJECTS = 50, - - NUMANIMBLOCKS = 2, - NUMANIMATIONS = 250, - - NUMTEMPOBJECTS = 30, - - // Path data - NUM_PATHNODES = 4930, - NUM_CARPATHLINKS = 2076, - NUM_MAPOBJECTS = 1250, - NUM_PATHCONNECTIONS = 10260, - - // Link list lengths - NUMALPHALIST = 20, - NUMALPHAENTITYLIST = 150, - NUMCOLCACHELINKS = 200, - NUMREFERENCES = 800, - - // Zones - NUMAUDIOZONES = 36, - NUMZONES = 50, - NUMMAPZONES = 25, - - // Cull zones - NUMCULLZONES = 512, - NUMATTRIBZONES = 288, - NUMZONEINDICES = 55000, - - PATHNODESIZE = 4500, - - NUMWEATHERS = 4, - NUMHOURS = 24, - - NUMEXTRADIRECTIONALS = 4, - NUMANTENNAS = 8, - NUMCORONAS = 56, - NUMPOINTLIGHTS = 32, - NUM3DMARKERS = 32, - NUMBRIGHTLIGHTS = 32, - NUMSHINYTEXTS = 32, - NUMMONEYMESSAGES = 16, - NUMPICKUPMESSAGES = 16, - NUMBULLETTRACES = 16, - NUMMBLURSTREAKS = 4, - NUMSKIDMARKS = 32, - - NUMONSCREENTIMERENTRIES = 1, - NUMRADARBLIPS = 32, - NUMGENERALPICKUPS = 320, - NUMSCRIPTEDPICKUPS = 16, - NUMPICKUPS = NUMGENERALPICKUPS + NUMSCRIPTEDPICKUPS, - NUMCOLLECTEDPICKUPS = 20, - NUMPACMANPICKUPS = 256, - NUMEVENTS = 64, - - NUM_CARGENS = 160, - - NUM_PATH_NODES_IN_AUTOPILOT = 8, - - NUM_ACCIDENTS = 20, - NUM_FIRES = 40, - NUM_GARAGES = 32, - NUM_PROJECTILES = 32, - - NUM_GLASSPANES = 45, - NUM_GLASSENTITIES = 32, - NUM_WATERCANNONS = 3, - - NUMPEDROUTES = 200, - NUMPHONES = 50, - NUMPEDGROUPS = 31, - NUMMODELSPERPEDGROUP = 8, - NUMSHOTINFOS = 100, - - NUMROADBLOCKS = 600, - - NUMVISIBLEENTITIES = 2000, - NUMINVISIBLEENTITIES = 150, - - NUM_AUDIOENTITY_EVENTS = 4, - NUM_PED_COMMENTS_SLOTS = 20, - - NUM_SOUND_QUEUES = 2, - NUM_AUDIOENTITIES = 200, - - NUM_SCRIPT_MAX_ENTITIES = 40, - - NUM_GARAGE_STORED_CARS = 6, - - NUM_CRANES = 8, - - NUM_EXPLOSIONS = 48, -}; - // We don't expect to compile for PS2 or Xbox // but it might be interesting for documentation purposes #define GTA_PC //#define GTA_PS2 //#define GTA_XBOX +#ifdef GTA_PS2 +#include "limits_ps2.h" +#elif defined VANILLA_DEFINES +#include "limits_pc.h" +#else +#include "limits_custom.h" // some nice enhanced limits +#endif + // Version defines #define GTA3_PS2_140 300 #define GTA3_PS2_160 301 diff --git a/src/core/limits_custom.h b/src/core/limits_custom.h new file mode 100644 index 00000000..7db0cd6d --- /dev/null +++ b/src/core/limits_custom.h @@ -0,0 +1,138 @@ +#pragma once + +enum Config { + NUMPLAYERS = 1, + + NUMCDIMAGES = 12, // gta3.img duplicates (not used on PC) + MAX_CDIMAGES = 8, // additional cdimages + MAX_CDCHANNELS = 5, + + MODELINFOSIZE = 5500, + TXDSTORESIZE = 1024, // 1024 for Xbox map + EXTRADIRSIZE = 128, + CUTSCENEDIRSIZE = 512, + + SIMPLEMODELSIZE = 5000, + MLOMODELSIZE = 1, + MLOINSTANCESIZE = 1, + TIMEMODELSIZE = 1500, + CLUMPMODELSIZE = 5, + PEDMODELSIZE = 90, + VEHICLEMODELSIZE = 120, + XTRACOMPSMODELSIZE = 2, + TWODFXSIZE = 2000, + + MAXVEHICLESLOADED = 70, // 70 on mobile + + NUMOBJECTINFO = 168, // object.dat + + // Pool sizes + NUMPTRNODES = 90000, + NUMENTRYINFOS = 25400, + NUMPEDS = 140, + NUMVEHICLES = 110, + NUMBUILDINGS = 35500, + NUMTREADABLES = 1214, + NUMOBJECTS = 9500, + NUMDUMMIES = 22802, + NUMAUDIOSCRIPTOBJECTS = 256, + NUMCUTSCENEOBJECTS = 50, + + NUMANIMBLOCKS = 2, + NUMANIMATIONS = 250, + + NUMTEMPOBJECTS = 30, + + // Path data + NUM_PATHNODES = 4930, + NUM_CARPATHLINKS = 2076, + NUM_MAPOBJECTS = 1250, + NUM_PATHCONNECTIONS = 10260, + + // Link list lengths + NUMALPHALIST = 20, + NUMALPHAENTITYLIST = 1250, // default 150 is not enough for bigger FOVs + NUMCOLCACHELINKS = 200, + NUMREFERENCES = 800, + + // Zones + NUMAUDIOZONES = 36, + NUMZONES = 50, + NUMMAPZONES = 25, + + // Cull zones + NUMCULLZONES = 512, + NUMATTRIBZONES = 288, + NUMZONEINDICES = 55000, + + PATHNODESIZE = 4500, + + NUMWEATHERS = 4, + NUMHOURS = 24, + + NUMEXTRADIRECTIONALS = 4, + NUMANTENNAS = 8, + NUMCORONAS = 2000, + NUMPOINTLIGHTS = 32, + NUM3DMARKERS = 32, + NUMBRIGHTLIGHTS = 32, + NUMSHINYTEXTS = 32, + NUMMONEYMESSAGES = 16, + NUMPICKUPMESSAGES = 16, + NUMBULLETTRACES = 16, + NUMMBLURSTREAKS = 4, + NUMSKIDMARKS = 32, + + NUMONSCREENTIMERENTRIES = 1, + NUMRADARBLIPS = 32, + NUMGENERALPICKUPS = 320, + NUMSCRIPTEDPICKUPS = 16, + NUMPICKUPS = NUMGENERALPICKUPS + NUMSCRIPTEDPICKUPS, + NUMCOLLECTEDPICKUPS = 20, + NUMPACMANPICKUPS = 256, + NUMEVENTS = 64, + + NUM_CARGENS = 160, + + NUM_PATH_NODES_IN_AUTOPILOT = 8, + + NUM_ACCIDENTS = 20, + NUM_FIRES = 40, + NUM_GARAGES = 32, + NUM_PROJECTILES = 32, + + NUM_GLASSPANES = 45, + NUM_GLASSENTITIES = 32, + NUM_WATERCANNONS = 3, + NUM_PARTICLES = 1000, + + NUM_STOREDSHADOWS = 48, + NUM_POLYBUNCHES = 300, + NUM_STATICSHADOWS = 64, + NUM_PERMAMENTSHADOWS = 48, + + NUMPEDROUTES = 200, + NUMPHONES = 50, + NUMPEDGROUPS = 31, + NUMMODELSPERPEDGROUP = 8, + NUMSHOTINFOS = 100, + + NUMROADBLOCKS = 600, + + NUMVISIBLEENTITIES = 5000, + NUMINVISIBLEENTITIES = 5000, + + NUM_AUDIOENTITY_EVENTS = 4, + NUM_PED_COMMENTS_SLOTS = 20, + + NUM_SOUND_QUEUES = 2, + NUM_AUDIOENTITIES = 200, + + NUM_SCRIPT_MAX_ENTITIES = 40, + + NUM_GARAGE_STORED_CARS = 6, + + NUM_CRANES = 8, + + NUM_EXPLOSIONS = 48, +}; diff --git a/src/core/limits_pc.h b/src/core/limits_pc.h new file mode 100644 index 00000000..6b8502a2 --- /dev/null +++ b/src/core/limits_pc.h @@ -0,0 +1,138 @@ +#pragma once + +enum Config { + NUMPLAYERS = 1, // 4 on PS2 + + NUMCDIMAGES = 12, // gta3.img duplicates (not used on PC) + MAX_CDIMAGES = 8, // additional cdimages + MAX_CDCHANNELS = 5, + + MODELINFOSIZE = 5500, // 3150 on PS2 + TXDSTORESIZE = 850, + EXTRADIRSIZE = 128, + CUTSCENEDIRSIZE = 512, + + SIMPLEMODELSIZE = 5000, // 2910 on PS2 + MLOMODELSIZE = 1, + MLOINSTANCESIZE = 1, + TIMEMODELSIZE = 30, + CLUMPMODELSIZE = 5, + PEDMODELSIZE = 90, + VEHICLEMODELSIZE = 120, // 70 on PS2 + XTRACOMPSMODELSIZE = 2, + TWODFXSIZE = 2000, // 1210 on PS2 + + MAXVEHICLESLOADED = 50, // 70 on mobile + + NUMOBJECTINFO = 168, // object.dat + + // Pool sizes + NUMPTRNODES = 30000, // 26000 on PS2 + NUMENTRYINFOS = 5400, // 3200 on PS2 + NUMPEDS = 140, // 90 on PS2 + NUMVEHICLES = 110, // 70 on PS2 + NUMBUILDINGS = 5500, // 4915 on PS2 + NUMTREADABLES = 1214, + NUMOBJECTS = 450, + NUMDUMMIES = 2802, // 2368 on PS2 + NUMAUDIOSCRIPTOBJECTS = 256, + NUMCUTSCENEOBJECTS = 50, + + NUMANIMBLOCKS = 2, + NUMANIMATIONS = 250, + + NUMTEMPOBJECTS = 30, + + // Path data + NUM_PATHNODES = 4930, + NUM_CARPATHLINKS = 2076, + NUM_MAPOBJECTS = 1250, + NUM_PATHCONNECTIONS = 10260, + + // Link list lengths + NUMALPHALIST = 20, + NUMALPHAENTITYLIST = 150, + NUMCOLCACHELINKS = 200, + NUMREFERENCES = 800, + + // Zones + NUMAUDIOZONES = 36, + NUMZONES = 50, + NUMMAPZONES = 25, + + // Cull zones + NUMCULLZONES = 512, + NUMATTRIBZONES = 288, + NUMZONEINDICES = 55000, + + PATHNODESIZE = 4500, + + NUMWEATHERS = 4, + NUMHOURS = 24, + + NUMEXTRADIRECTIONALS = 4, + NUMANTENNAS = 8, + NUMCORONAS = 56, + NUMPOINTLIGHTS = 32, + NUM3DMARKERS = 32, + NUMBRIGHTLIGHTS = 32, + NUMSHINYTEXTS = 32, + NUMMONEYMESSAGES = 16, + NUMPICKUPMESSAGES = 16, + NUMBULLETTRACES = 16, + NUMMBLURSTREAKS = 4, + NUMSKIDMARKS = 32, + + NUMONSCREENTIMERENTRIES = 1, + NUMRADARBLIPS = 32, + NUMGENERALPICKUPS = 320, + NUMSCRIPTEDPICKUPS = 16, + NUMPICKUPS = NUMGENERALPICKUPS + NUMSCRIPTEDPICKUPS, + NUMCOLLECTEDPICKUPS = 20, + NUMPACMANPICKUPS = 256, + NUMEVENTS = 64, + + NUM_CARGENS = 160, + + NUM_PATH_NODES_IN_AUTOPILOT = 8, + + NUM_ACCIDENTS = 20, + NUM_FIRES = 40, + NUM_GARAGES = 32, + NUM_PROJECTILES = 32, + + NUM_GLASSPANES = 45, + NUM_GLASSENTITIES = 32, + NUM_WATERCANNONS = 3, + NUM_PARTICLES = 1000, + + NUM_STOREDSHADOWS = 48, + NUM_POLYBUNCHES = 300, + NUM_STATICSHADOWS = 64, + NUM_PERMAMENTSHADOWS = 48, + + NUMPEDROUTES = 200, + NUMPHONES = 50, + NUMPEDGROUPS = 31, + NUMMODELSPERPEDGROUP = 8, + NUMSHOTINFOS = 100, + + NUMROADBLOCKS = 600, + + NUMVISIBLEENTITIES = 2000, + NUMINVISIBLEENTITIES = 150, + + NUM_AUDIOENTITY_EVENTS = 4, + NUM_PED_COMMENTS_SLOTS = 20, + + NUM_SOUND_QUEUES = 2, + NUM_AUDIOENTITIES = 200, + + NUM_SCRIPT_MAX_ENTITIES = 40, + + NUM_GARAGE_STORED_CARS = 6, + + NUM_CRANES = 8, + + NUM_EXPLOSIONS = 48, +}; diff --git a/src/core/limits_ps2.h b/src/core/limits_ps2.h new file mode 100644 index 00000000..c8ed9582 --- /dev/null +++ b/src/core/limits_ps2.h @@ -0,0 +1,138 @@ +#pragma once + +enum Config { + NUMPLAYERS = 4, + + NUMCDIMAGES = 12, // gta3.img duplicates + MAX_CDIMAGES = 8, // additional cdimages + MAX_CDCHANNELS = 5, + + MODELINFOSIZE = 3150, + TXDSTORESIZE = 850, + EXTRADIRSIZE = 128, + CUTSCENEDIRSIZE = 512, + + SIMPLEMODELSIZE = 2910, + MLOMODELSIZE = 1, + MLOINSTANCESIZE = 1, + TIMEMODELSIZE = 30, + CLUMPMODELSIZE = 5, + PEDMODELSIZE = 90, + VEHICLEMODELSIZE = 70, + XTRACOMPSMODELSIZE = 2, + TWODFXSIZE = 1210, + + MAXVEHICLESLOADED = 50, + + NUMOBJECTINFO = 168, // object.dat + + // Pool sizes + NUMPTRNODES = 26000, + NUMENTRYINFOS = 3200, + NUMPEDS = 90, + NUMVEHICLES = 70, + NUMBUILDINGS = 4915, + NUMTREADABLES = 1214, + NUMOBJECTS = 450, + NUMDUMMIES = 2368, + NUMAUDIOSCRIPTOBJECTS = 256, + NUMCUTSCENEOBJECTS = 50, + + NUMANIMBLOCKS = 2, + NUMANIMATIONS = 250, + + NUMTEMPOBJECTS = 30, + + // Path data + NUM_PATHNODES = 4930, + NUM_CARPATHLINKS = 2076, + NUM_MAPOBJECTS = 1250, + NUM_PATHCONNECTIONS = 10260, + + // Link list lengths + NUMALPHALIST = 20, + NUMALPHAENTITYLIST = 150, + NUMCOLCACHELINKS = 200, + NUMREFERENCES = 800, + + // Zones + NUMAUDIOZONES = 36, + NUMZONES = 50, + NUMMAPZONES = 25, + + // Cull zones + NUMCULLZONES = 512, + NUMATTRIBZONES = 288, + NUMZONEINDICES = 55000, + + PATHNODESIZE = 4500, + + NUMWEATHERS = 4, + NUMHOURS = 24, + + NUMEXTRADIRECTIONALS = 4, + NUMANTENNAS = 8, + NUMCORONAS = 56, + NUMPOINTLIGHTS = 32, + NUM3DMARKERS = 32, + NUMBRIGHTLIGHTS = 32, + NUMSHINYTEXTS = 32, + NUMMONEYMESSAGES = 16, + NUMPICKUPMESSAGES = 16, + NUMBULLETTRACES = 16, + NUMMBLURSTREAKS = 4, + NUMSKIDMARKS = 32, + + NUMONSCREENTIMERENTRIES = 1, + NUMRADARBLIPS = 32, + NUMGENERALPICKUPS = 320, + NUMSCRIPTEDPICKUPS = 16, + NUMPICKUPS = NUMGENERALPICKUPS + NUMSCRIPTEDPICKUPS, + NUMCOLLECTEDPICKUPS = 20, + NUMPACMANPICKUPS = 256, + NUMEVENTS = 64, + + NUM_CARGENS = 160, + + NUM_PATH_NODES_IN_AUTOPILOT = 8, + + NUM_ACCIDENTS = 20, + NUM_FIRES = 40, + NUM_GARAGES = 32, + NUM_PROJECTILES = 32, + + NUM_GLASSPANES = 45, + NUM_GLASSENTITIES = 32, + NUM_WATERCANNONS = 3, + NUM_PARTICLES = 1000, + + NUM_STOREDSHADOWS = 48, + NUM_POLYBUNCHES = 300, + NUM_STATICSHADOWS = 64, + NUM_PERMAMENTSHADOWS = 48, + + NUMPEDROUTES = 200, + NUMPHONES = 50, + NUMPEDGROUPS = 31, + NUMMODELSPERPEDGROUP = 8, + NUMSHOTINFOS = 100, + + NUMROADBLOCKS = 600, + + NUMVISIBLEENTITIES = 2000, + NUMINVISIBLEENTITIES = 150, + + NUM_AUDIOENTITY_EVENTS = 4, + NUM_PED_COMMENTS_SLOTS = 20, + + NUM_SOUND_QUEUES = 2, + NUM_AUDIOENTITIES = 200, + + NUM_SCRIPT_MAX_ENTITIES = 40, + + NUM_GARAGE_STORED_CARS = 6, + + NUM_CRANES = 8, + + NUM_EXPLOSIONS = 48, +}; diff --git a/src/renderer/Particle.cpp b/src/renderer/Particle.cpp index 76ddde50..34642afd 100644 --- a/src/renderer/Particle.cpp +++ b/src/renderer/Particle.cpp @@ -17,9 +17,6 @@ #include "debugmenu.h" -#define MAX_PARTICLES_ON_SCREEN (1000) - - //(5) #define MAX_SMOKE_FILES ARRAY_SIZE(SmokeFiles) @@ -149,7 +146,7 @@ const char CarsplashFiles[][12+1] = "carsplash_04" }; -CParticle gParticleArray[MAX_PARTICLES_ON_SCREEN]; +CParticle gParticleArray[NUM_PARTICLES]; RwTexture *gpSmokeTex[MAX_SMOKE_FILES]; RwTexture *gpSmoke2Tex[MAX_SMOKE2_FILES]; @@ -243,9 +240,9 @@ void CParticle::ReloadConfig() m_pUnusedListHead = gParticleArray; - for ( int32 i = 0; i < MAX_PARTICLES_ON_SCREEN; i++ ) + for ( int32 i = 0; i < NUM_PARTICLES; i++ ) { - if ( i == MAX_PARTICLES_ON_SCREEN - 1 ) + if ( i == NUM_PARTICLES - 1 ) gParticleArray[i].m_pNext = nil; else gParticleArray[i].m_pNext = &gParticleArray[i + 1]; diff --git a/src/renderer/Shadows.cpp b/src/renderer/Shadows.cpp index 3884d3bb..0b604c40 100644 --- a/src/renderer/Shadows.cpp +++ b/src/renderer/Shadows.cpp @@ -44,11 +44,11 @@ RwTexture *gpPostShadowTex; RwTexture *gpGoalTex; int16 CShadows::ShadowsStoredToBeRendered; -CStoredShadow CShadows::asShadowsStored [MAX_STOREDSHADOWS]; -CPolyBunch CShadows::aPolyBunches [MAX_POLYBUNCHES]; -CStaticShadow CShadows::aStaticShadows [MAX_STATICSHADOWS]; +CStoredShadow CShadows::asShadowsStored [NUM_STOREDSHADOWS]; +CPolyBunch CShadows::aPolyBunches [NUM_POLYBUNCHES]; +CStaticShadow CShadows::aStaticShadows [NUM_STATICSHADOWS]; CPolyBunch *CShadows::pEmptyBunchList; -CPermanentShadow CShadows::aPermanentShadows[MAX_PERMAMENTSHADOWS]; +CPermanentShadow CShadows::aPermanentShadows[NUM_PERMAMENTSHADOWS]; void @@ -125,7 +125,7 @@ CShadows::Init(void) ShadowIndexList[23] = 8; - for ( int32 i = 0; i < MAX_STATICSHADOWS; i++ ) + for ( int32 i = 0; i < NUM_STATICSHADOWS; i++ ) { aStaticShadows[i].m_nId = 0; aStaticShadows[i].m_pPolyBunch = NULL; @@ -133,15 +133,15 @@ CShadows::Init(void) pEmptyBunchList = &aPolyBunches[0]; - for ( int32 i = 0; i < MAX_POLYBUNCHES; i++ ) + for ( int32 i = 0; i < NUM_POLYBUNCHES; i++ ) { - if ( i == MAX_POLYBUNCHES - 1 ) + if ( i == NUM_POLYBUNCHES - 1 ) aPolyBunches[i].m_pNext = NULL; else aPolyBunches[i].m_pNext = &aPolyBunches[i + 1]; } - for ( int32 i = 0; i < MAX_PERMAMENTSHADOWS; i++ ) + for ( int32 i = 0; i < NUM_PERMAMENTSHADOWS; i++ ) { aPermanentShadows[i].m_nType = SHADOWTYPE_NONE; } @@ -193,10 +193,10 @@ CShadows::AddPermanentShadow(uint8 ShadowType, RwTexture *pTexture, CVector *pPo // find free slot int32 nSlot = 0; - while ( nSlot < MAX_PERMAMENTSHADOWS && aPermanentShadows[nSlot].m_nType != SHADOWTYPE_NONE ) + while ( nSlot < NUM_PERMAMENTSHADOWS && aPermanentShadows[nSlot].m_nType != SHADOWTYPE_NONE ) nSlot++; - if ( nSlot < MAX_PERMAMENTSHADOWS ) + if ( nSlot < NUM_PERMAMENTSHADOWS ) { aPermanentShadows[nSlot].m_nType = ShadowType; aPermanentShadows[nSlot].m_pTexture = pTexture; @@ -244,10 +244,10 @@ CShadows::StoreStaticShadow(uint32 nID, uint8 ShadowType, RwTexture *pTexture, C int32 nSlot; nSlot = 0; - while ( nSlot < MAX_STATICSHADOWS && !(nID == aStaticShadows[nSlot].m_nId && aStaticShadows[nSlot].m_pPolyBunch != NULL) ) + while ( nSlot < NUM_STATICSHADOWS && !(nID == aStaticShadows[nSlot].m_nId && aStaticShadows[nSlot].m_pPolyBunch != NULL) ) nSlot++; - if ( nSlot < MAX_STATICSHADOWS ) + if ( nSlot < NUM_STATICSHADOWS ) { if ( Abs(pPosn->x - aStaticShadows[nSlot].m_vecPosn.x) < fUpDistance && Abs(pPosn->y - aStaticShadows[nSlot].m_vecPosn.y) < fUpDistance ) @@ -313,10 +313,10 @@ CShadows::StoreStaticShadow(uint32 nID, uint8 ShadowType, RwTexture *pTexture, C else { nSlot = 0; - while ( nSlot < MAX_STATICSHADOWS && aStaticShadows[nSlot].m_pPolyBunch != NULL ) + while ( nSlot < NUM_STATICSHADOWS && aStaticShadows[nSlot].m_pPolyBunch != NULL ) nSlot++; - if ( nSlot != MAX_STATICSHADOWS ) + if ( nSlot != NUM_STATICSHADOWS ) { aStaticShadows[nSlot].m_nId = nID; aStaticShadows[nSlot].m_nType = ShadowType; @@ -429,7 +429,7 @@ CShadows::StoreShadowToBeRendered(uint8 ShadowType, RwTexture *pTexture, CVector ASSERT(pTexture != NULL); ASSERT(pPosn != NULL); - if ( ShadowsStoredToBeRendered < MAX_STOREDSHADOWS ) + if ( ShadowsStoredToBeRendered < NUM_STOREDSHADOWS ) { asShadowsStored[ShadowsStoredToBeRendered].m_ShadowType = ShadowType; asShadowsStored[ShadowsStoredToBeRendered].m_pTexture = pTexture; @@ -804,10 +804,10 @@ CShadows::RenderStaticShadows(void) SetAlphaTest(0); - for ( int32 i = 0; i < MAX_STATICSHADOWS; i++ ) + for ( int32 i = 0; i < NUM_STATICSHADOWS; i++ ) aStaticShadows[i].m_bRendered = false; - for ( int32 i = 0; i < MAX_STATICSHADOWS; i++ ) + for ( int32 i = 0; i < NUM_STATICSHADOWS; i++ ) { if ( aStaticShadows[i].m_pPolyBunch && !aStaticShadows[i].m_bRendered ) { @@ -815,7 +815,7 @@ CShadows::RenderStaticShadows(void) RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(aStaticShadows[i].m_pTexture)); // optimization trick, render all shadows with same renderstate and texture - for ( int32 j = i; j < MAX_STATICSHADOWS; j++ ) + for ( int32 j = i; j < NUM_STATICSHADOWS; j++ ) { if ( aStaticShadows[j].m_pPolyBunch != NULL && aStaticShadows[i].m_nType == aStaticShadows[j].m_nType @@ -1498,7 +1498,7 @@ CShadows::CastShadowEntity(CEntity *pEntity, float fStartX, float fStartY, floa void CShadows::UpdateStaticShadows(void) { - for ( int32 i = 0; i < MAX_STATICSHADOWS; i++ ) + for ( int32 i = 0; i < NUM_STATICSHADOWS; i++ ) { if ( aStaticShadows[i].m_pPolyBunch != NULL && !aStaticShadows[i].m_bJustCreated && (!aStaticShadows[i].m_bTemp || CTimer::GetTimeInMilliseconds() > aStaticShadows[i].m_nTimeCreated + 5000) ) @@ -1513,7 +1513,7 @@ CShadows::UpdateStaticShadows(void) void CShadows::UpdatePermanentShadows(void) { - for ( int32 i = 0; i < MAX_PERMAMENTSHADOWS; i++ ) + for ( int32 i = 0; i < NUM_PERMAMENTSHADOWS; i++ ) { if ( aPermanentShadows[i].m_nType != SHADOWTYPE_NONE ) { @@ -1768,7 +1768,7 @@ CShadows::RenderExtraPlayerShadows(void) void CShadows::TidyUpShadows(void) { - for ( int32 i = 0; i < MAX_PERMAMENTSHADOWS; i++ ) + for ( int32 i = 0; i < NUM_PERMAMENTSHADOWS; i++ ) aPermanentShadows[i].m_nType = SHADOWTYPE_NONE; } diff --git a/src/renderer/Shadows.h b/src/renderer/Shadows.h index 8c909df3..3ada990d 100644 --- a/src/renderer/Shadows.h +++ b/src/renderer/Shadows.h @@ -1,11 +1,5 @@ #pragma once -#define MAX_STOREDSHADOWS 48 -#define MAX_POLYBUNCHES 300 -#define MAX_STATICSHADOWS 64 -#define MAX_PERMAMENTSHADOWS 48 - - class CEntity; enum eShadowType @@ -129,11 +123,11 @@ class CShadows { public: static int16 ShadowsStoredToBeRendered; - static CStoredShadow asShadowsStored [MAX_STOREDSHADOWS]; - static CPolyBunch aPolyBunches [MAX_POLYBUNCHES]; - static CStaticShadow aStaticShadows [MAX_STATICSHADOWS]; + static CStoredShadow asShadowsStored [NUM_STOREDSHADOWS]; + static CPolyBunch aPolyBunches [NUM_POLYBUNCHES]; + static CStaticShadow aStaticShadows [NUM_STATICSHADOWS]; static CPolyBunch *pEmptyBunchList; - static CPermanentShadow aPermanentShadows[MAX_PERMAMENTSHADOWS]; + static CPermanentShadow aPermanentShadows[NUM_PERMAMENTSHADOWS]; static void Init (void); static void Shutdown (void); diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index e6d4641d..19dfb64e 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -154,12 +154,7 @@ CVisibilityPlugins::Initialise(void) m_alphaList.Init(NUMALPHALIST); m_alphaList.head.item.sort = 0.0f; m_alphaList.tail.item.sort = 100000000.0f; -#ifdef ASPECT_RATIO_SCALE - // default 150 is not enough for bigger FOVs - m_alphaEntityList.Init(NUMALPHAENTITYLIST * 3); -#else m_alphaEntityList.Init(NUMALPHAENTITYLIST); -#endif // ASPECT_RATIO_SCALE m_alphaEntityList.head.item.sort = 0.0f; m_alphaEntityList.tail.item.sort = 100000000.0f;