Are you doing this in c-script, or lite-c?
If you are using c-script, you may need to use bmap_height(BMAP*) and bmap_width(BMAP*)
instead of hud_bullet.width etc.
But read further down as there is a cleaner work-around...
Please bear in mind, I am primarily Lite-C, so my c-script skills are low...
Firstly, put your global definitions back to
var bullets = 5;
PANEL* bul_panel[9];and try changing the pan_create to be
bul_panel[a] = pan_create("flags=SHOW;", 101);The panels dont automatically pick up the size of the bmap, UNLESS the bmap
name is supplied in the creation string.
eg
var bullets = 5;
PANEL* bul_panel[9];
function reload()
{
var a; for (a=0; a < bullets; a+=1)
{
bul_panel[a] = pan_create("bmap=hud_bullet; flags=SHOW;", 101);
bul_panel[a].pos_x = 366 - 7*a; // Position it in "clip"
wait(1);
}
}
Unfortunately, your current NULL-test will always fail ATM, because when you define
the array with
PANEL* bul_panel[9];, you can almost be sure its contents arent NULL,
even though there isnt ANY valid panel pointers in there.
You need to flush them clean at startup in main, or like this.
PANEL* bul_panel[9];
void bul_panel_startup() { var i; for(i=0, i<9; i++) bul_panel[i]=NULL; }
Then your NULL checking would work, ASSUMING then any time you ptr_remove a bullet,
you set that array element to NULL straigt away.
eg
...
ptr_remove(bul_panel[xx]);
bul_panel[xx] = NULL;
...