inv_clear();
#define MAX_INV 9
int inv[MAX_INV] = {0};
int cur_item = -1;
int cur_type = -1;
void
inv_clear ()
{
int i;
for(i=0;i<MAX_INV;i++)
{
inv[i]=-1;
}
}
#define ITEM_CREATE 0
#define ITEM_MOVE 1
int
inv_add (int type, int action)
{
int i;
for(i=0;i<MAX_INV;i++)
{
if(inv[i]==-1) // empty
{
inv[i] = type;
cur_type = type;
switch(action)
{
case ITEM_CREATE:
CreateActor("item", "ricon", "view", "(none)",
view.width/2-60+(i%3)*60, view.height*2/3+i/3*60, true)->inv_pos = i;
break;
case ITEM_MOVE:
ChangeParent("Event Actor", "view");
xscreen = view.width-400;
yscreen = view.height-115;
inv_pos = i;
break;
}
cur_type = -1;
return 1;
}
}
return 0;
}
void
inv_remove (int idx)
{
inv[idx] = -1;
}
switch(action)
{
case ITEM_CREATE:
CreateActor("item", "ricon", "view", "(none)",
view.width-400+i, view.height-115, true)->inv_pos = i; //<===
break;
case ITEM_MOVE:
ChangeParent("Event Actor", "view");
xscreen = view.width-400+i; //<===
yscreen = view.height-115; //<===
inv_pos = i;
break;
}
Users browsing this forum: No registered users and 1 guest