I think something is really not right. How can I safely remove the target images and the original textures from an object?
Whatever I try to do with the target image (or apparently independent other things) I get a huge blue screen of death and my pc instantly reboots :/ Its only on certain events though:
function Reboot()
//reboots the game
local i as integer
for i = 1 to 99999
if object exist(i)=1 then delete object i
if image exist(i)=1 then delete image i
if sound exist(i)=1 then delete sound i
if music exist(i)=1 then delete music i
if sprite exist(i)=1 then delete sprite i
next i
flush video memory
Initialize()
if AE_Intro = 1 then Splash_Screen()
Load_Medias()
Create_Main_Menu()
endfunction
function Initialize()
//Initialize
set dir get dir$()
hide mouse
position mouse 0,0
Load_Settings()
sync on: sync rate 90
set display mode AE_ScrW, AE_ScrH, AE_ScrD, 1
backdrop on: color backdrop rgb(0,0,0)
autocam off
disable escapekey
set camera range 1, 10000
position camera 0, 0, Camera_Work_Distance
endfunction
function Load_Medias()
//Load everything here (images, sounds, musics ect)
load image get dir$() + "\GFX\Textures\dirt.png", Texture_Dirt
load image get dir$() + "\GFX\Textures\grass.png", Texture_Grass
load image get dir$() + "\GFX\Textures\sand.png", Texture_Sand
load image get dir$() + "\GFX\Textures\snow.png", Texture_Snow
Create_Target_Texture(Texture_Dirt)
Create_Target_Texture(Texture_Grass)
Create_Target_Texture(Texture_Sand)
Create_Target_Texture(Texture_Snow)
...
This function could be called anytime, its now called on every game start/restart:
function Reset_Map()
//sets the current map
tg = rnd(3)+1
if tg = 1 then Texture_Ground = Texture_Dirt
if tg = 2 then Texture_Ground = Texture_Grass
if tg = 3 then Texture_Ground = Texture_Snow
if tg = 4 then Texture_Ground = Texture_Sand
texture object Plain_Main, Texture_Ground
endfunction
And finally here's the target image converter function which is only called in the Load_Medias function. Load_Medias is called only on boot/reboot of game i.e.: program start and after resolution setting:
function Create_Target_Texture(iSource as integer)
//this function converts the map textures to target textures for IK pastes.
tmp = 0
repeat
inc tmp
until image exist(tmp) = 0
IK copy image tmp, iSource
delete image iSource
IK create target image iSource, 1024, 1024
IK paste image on image tmp, iSource, 0, 0
delete image tmp
endfunction
I think this is my last problem regarding the topic, and the most important one.
"The business in the business is the business"