I'm actually already looping through a ridiculously huge range of images, sprites, objects, etc and deleting them (except the ones that are still needed but they're all accounted for)
But it's still happening. It may not ENTIRELY make sense, but here's the code from my purge routine to show you what I'm doing.
FUNCTION PurgeAssets(Parameter)
IF UseShaders = 1
FOR C = 3 TO 300
FOR Cb = 1 to 7
Lights(C, Cb) = 0
NEXT
NEXT
FOR C = 1 to 300
PointLight_Delete(C)
NEXT
FOR C = 1 TO 1000000
IF OBJECT EXIST(C)
Object_Remove(C)
ENDIF
NEXT
FOR C = 1 TO 10
Effect_Remove(C)
NEXT
Refraction_Delete()
Reflection_Delete()
Ambient_Delete()
Sky_Delete()
Clouds_Delete()
TimeOfDay_Delete()
Skybox_Delete()
AdvancedLighting_Delete()
IF UsePostProcessing = 1
Postfilter_Delete()
ENDIF
FOR C = 1 to 10
IF EFFECT EXIST(C) THEN DELETE EFFECT C
NEXT
ENDIF
FOR C = 1 TO 1000000
IF OBJECT EXIST(C)
IF HasLoadedDungeon = 1
IF C < 50000 OR C > 50043
DELETE OBJECT C
ENDIF
ELSE
DELETE OBJECT C
ENDIF
ENDIF
NEXT
FOR C = 1 TO 50000
OBJCODE$(C) = ""
NEXT
FOR C = 1 TO 7
IF LIGHT EXIST(C)
DELETE LIGHT C
ENDIF
NEXT
FOR C = 1 TO 150
IF SOUND EXIST(C) THEN DELETE SOUND C
NEXT c
FOR C = 1 TO 500000
IF SPRITE EXIST(C)
IF C <> 666666 AND C <> 51 THEN DELETE SPRITE C
ENDIF
IF IMAGE EXIST(C)
IF HasLoadedDungeon = 1
IF C > 117
IF C <> 666666 AND C < 1046 OR C > 1050 THEN DELETE IMAGE C
ENDIF
ELSE
IF C <> 666666 AND C < 1046 OR C > 1050 THEN DELETE IMAGE C
ENDIF
ENDIF
NEXT
FLUSH VIDEO MEMORY
RELOAD DISPLAY POINTER
ENDFUNCTION 0
And this is the code I'm using the set up the advanced lighting:
color backdrop 0,rgb(0,0,0)
`Set up the advanced lighting
BiasRes=1280
Sw#=screen width()
res#=((Sw#/(BiasRes*2))*2)
if res#<1 then res#=1
AdvLightingX=((screen width()/res#)/2)*2
AdvLightingY=((screen height()/res#)/2)*2
AdvancedLighting_SetUp(AdvLightingX,AdvLightingY,6,AdvLightingY)
Set_Camera(1,5000,65,1.6)
Set_Fog(0,0,0,1000,2)
Set_Ambient(AlphaLevel,AlphaLevel,AlphaLevel,1.0)
Ambient_SetUp("Media/Ambient.dds",0,0)
backdrop on 0
color backdrop 0,rgb(0,0,0)
load effect "FX/Parallaxmap.fx",1,0
Effect_Add(1)
load effect "FX/Diffuse (bone).fx",2,0
Effect_Add(2)
load effect "FX/Scroll.fx",3,0
Effect_Add(3)
IF UseReflections = 1
Reflection_SetUp(512,512)
Reflection_Enabled(1)
ENDIF
IF UsePostProcessing = 1
ViewPortRatio#=1.0
ViewPortX=((screen width()*ViewPortRatio#)/2)*2
ViewPortY=((screen height()*ViewPortRatio#)/2)*2
PostEffects_Setup(ViewPortX,ViewPortY,1,0,1,0,0,0)
backdrop on 1
color backdrop 0,rgb(0,0,0)
color backdrop 1,rgb(0,0,0)
ENDIF
SkyBox_SetUp("IMAGES/CubeBlack.dds")
And each time an object is instanced to build the level, I give it a bit of this:
CLONE OBJECT UpToObj, 50011
IF UseShaders = 0
TEXTURE OBJECT UpToObj, 29
ELSE
TEXTURE OBJECT UpToObj, 0, 29
TEXTURE OBJECT UpToObj, 1, 30
TEXTURE OBJECT UpToObj, 2, 31
set object normals UpToObj
Object_Add(UpToObj)
Object_Set_Dynamic(UpToObj)
set object effect UpToObj,1
Object_Render_Shadows(UpToObj)
ENDIF
POSITION OBJECT UpToObj, (X*200), 0, (Y*200)
INC UpToObj
And during my housekeeping/syncing phase, I run this:
IF UseShaders = 1
AdvancedLighting_Update()
SkyBox_Update()
ENDIF
IF UsePostProcessing = 1
PostFilter_Update()
ENDIF
SYNC MASK 2^0
SYNC
But I still have this problem happening:
On the 13th level load it looks
like this.
On the 14th level load it looks
like this.
This issue is starting to drive me batty
Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame