// -------------
//real MOVEIMAGETIMER_TIMEOUT=0.04
//! textmacro imageBulletsFunction takes NAME
globals
image array imageBullet_$NAME$_images
timer imageBullet_$NAME$_timer
integer imageBullet_$NAME$_Max=0
integer imageBullet_$NAME$_imageMax=0
integer array imageBullet_$NAME$_id
unit array imageBullet_$NAME$_spellunit
real array imageBullet_$NAME$_x
real array imageBullet_$NAME$_y
real array imageBullet_$NAME$_z
real array imageBullet_$NAME$_speed_x
real array imageBullet_$NAME$_speed_y
real array imageBullet_$NAME$_distance
real array imageBullet_$NAME$_speed
string array imageBullet_$NAME$_effpath
string array imageBullet_$NAME$_targeteffpath
real array imageBullet_$NAME$_collision
real array imageBullet_$NAME$_range
integer udg_$NAME$_Max = 0
integer array udg_$NAME$_Flu
endglobals
function Create_$NAME$_Id takes nothing returns integer
set udg_$NAME$_Max = udg_$NAME$_Max + 1
debug call BJDebugMsg("$NAME$_Max_ID="+I2S(udg_$NAME$_Max))
if udg_$NAME$_Max>8190 then
call BJDebugMsg("|cffff0000 CreateImageId_$NAME$_error: cannot create id (>8190)|r")
return 0
endif
if udg_$NAME$_Flu[udg_$NAME$_Max] == 0 then
return udg_$NAME$_Max
endif
return udg_$NAME$_Flu[udg_$NAME$_Max]
endfunction
function Remove_$NAME$_Id takes integer tid returns nothing
set udg_$NAME$_Flu[udg_$NAME$_Max] = tid
set udg_$NAME$_Max = udg_$NAME$_Max - 1
debug call BJDebugMsg("$NAME$_Max_ID="+I2S(udg_$NAME$_Max))
endfunction
function imageBullet_$NAME$_Preload takes nothing returns nothing
local integer c=imageBullet_$NAME$_imageMax+IMAGE_BULLET_PRELOAD_AMOUNT
debug call BJDebugMsg("Image_$NAME$ is preloading")
if c>8190 then
call BJDebugMsg("|cffff0000 Image_$NAME$_error: preload is failed|r")
return
endif
loop
set imageBullet_$NAME$_imageMax=imageBullet_$NAME$_imageMax+1
exitwhen imageBullet_$NAME$_imageMax>c
set imageBullet_$NAME$_images[imageBullet_$NAME$_imageMax]=CreateImage(IMAGE_BULLETS_paths[$NAME$],IMAGE_BULLETS_size[$NAME$],IMAGE_BULLETS_size[$NAME$],IMAGE_BULLETS_size[$NAME$],0,0,0,0,0,0,2)
//real MOVEIMAGETIMER_TIMEOUT=0.04
//! textmacro imageBulletsFunction takes NAME
globals
image array imageBullet_$NAME$_images
timer imageBullet_$NAME$_timer
integer imageBullet_$NAME$_Max=0
integer imageBullet_$NAME$_imageMax=0
integer array imageBullet_$NAME$_id
unit array imageBullet_$NAME$_spellunit
real array imageBullet_$NAME$_x
real array imageBullet_$NAME$_y
real array imageBullet_$NAME$_z
real array imageBullet_$NAME$_speed_x
real array imageBullet_$NAME$_speed_y
real array imageBullet_$NAME$_distance
real array imageBullet_$NAME$_speed
string array imageBullet_$NAME$_effpath
string array imageBullet_$NAME$_targeteffpath
real array imageBullet_$NAME$_collision
real array imageBullet_$NAME$_range
integer udg_$NAME$_Max = 0
integer array udg_$NAME$_Flu
endglobals
function Create_$NAME$_Id takes nothing returns integer
set udg_$NAME$_Max = udg_$NAME$_Max + 1
debug call BJDebugMsg("$NAME$_Max_ID="+I2S(udg_$NAME$_Max))
if udg_$NAME$_Max>8190 then
call BJDebugMsg("|cffff0000 CreateImageId_$NAME$_error: cannot create id (>8190)|r")
return 0
endif
if udg_$NAME$_Flu[udg_$NAME$_Max] == 0 then
return udg_$NAME$_Max
endif
return udg_$NAME$_Flu[udg_$NAME$_Max]
endfunction
function Remove_$NAME$_Id takes integer tid returns nothing
set udg_$NAME$_Flu[udg_$NAME$_Max] = tid
set udg_$NAME$_Max = udg_$NAME$_Max - 1
debug call BJDebugMsg("$NAME$_Max_ID="+I2S(udg_$NAME$_Max))
endfunction
function imageBullet_$NAME$_Preload takes nothing returns nothing
local integer c=imageBullet_$NAME$_imageMax+IMAGE_BULLET_PRELOAD_AMOUNT
debug call BJDebugMsg("Image_$NAME$ is preloading")
if c>8190 then
call BJDebugMsg("|cffff0000 Image_$NAME$_error: preload is failed|r")
return
endif
loop
set imageBullet_$NAME$_imageMax=imageBullet_$NAME$_imageMax+1
exitwhen imageBullet_$NAME$_imageMax>c
set imageBullet_$NAME$_images[imageBullet_$NAME$_imageMax]=CreateImage(IMAGE_BULLETS_paths[$NAME$],IMAGE_BULLETS_size[$NAME$],IMAGE_BULLETS_size[$NAME$],IMAGE_BULLETS_size[$NAME$],0,0,0,0,0,0,2)