This commit is contained in:
olikraus 2017-07-25 21:21:15 +02:00
parent 2e3df53b14
commit 7f05c3181c
5 changed files with 34 additions and 3 deletions

View File

@ -100,6 +100,21 @@ void moveAllItems(void)
} while( i != 0);
}
void callStepAllItems(void)
{
uint8_t i;
item_t *item;
i = item_cnt;
item = item_pool;
do
{
execute(item_template_list[item->template_index].step_proc);
item++;
i--;
} while( i != 0);
}
/*===============================================*/

View File

@ -30,6 +30,7 @@ item_t *pool_GetItem(uint8_t idx);
void posStep(pos_t *pos, uint8_t dir);
void moveAllItems(void);
void callStepAllItems(void);
uint8_t getMapTileByPos(pos_t *pos);

View File

@ -325,7 +325,7 @@ void moveHero(uint8_t dir)
moveItem(0, dir);
/* other monster actions */
callStepAllItems();
/* recalculate window position */
setWindowPosByItem(0);

View File

@ -397,6 +397,19 @@ void bc_fn_setItemPos(bc_t *bc)
bc_push_on_arg_stack(bc, i);
}
void bc_fn_setItemDir(bc_t *bc)
{
uint8_t i;
uint8_t dir;
dir = bc_pop_from_arg_stack(bc);
i = bc_pop_from_arg_stack(bc);
#ifndef UGL_TEST
pool_GetItem(i)->dir = dir;
printf("item %d dir=%d\n", i, dir);
#endif
bc_push_on_arg_stack(bc, i);
}
/*======================================================*/
bc_buildin_fn bc_buildin_list[] =
@ -407,8 +420,9 @@ bc_buildin_fn bc_buildin_list[] =
/* 3 */ bc_fn_arg2, /* two arguments */
/* 4 */ bc_fn_add,
/* 5 */ bc_fn_print,
/* 6 */ bc_fn_setPos, /* two args: x & y*/
/* 7 */ bc_fn_setItemPos, /* one args: item */
/* 6 */ bc_fn_setPos, /* two args: x & y: assign x/y to the pos temp var */
/* 7 */ bc_fn_setItemPos, /* one args: item, assign pos temp var to item */
/* 8 */ bc_fn_setItemDir, /* two args, item and dir */
};

View File

@ -58,6 +58,7 @@ struct ugl_buildin_cmd_struct ugl_buildin_cmd_list[] = {
{ /* code=*/ 5, /* name=*/ "print", /* args=*/ 1 },
{ /* code=*/ 6, /* name=*/ "setPos", /* args=*/ 2 },
{ /* code=*/ 7, /* name=*/ "setItemPos", /* args=*/ 1 },
{ /* code=*/ 8, /* name=*/ "setItemDir", /* args=*/ 2 },
};