This commit is contained in:
olikraus 2017-07-16 10:13:31 +02:00
parent 7682c7e0b4
commit 897752b1ca
5 changed files with 30 additions and 6 deletions

View File

@ -8,6 +8,7 @@
*/
#include <stddef.h>
#include "ugl_bc.h"
#include "item.h"
#include "map.h"
@ -25,6 +26,17 @@ item_t item_pool[ITEM_MAX];
item_t *item_under_pos; /* set by getMapTile() */
bc_t bc;
/*===============================================*/
void execute(uint16_t pos)
{
bc_exec(&bc, map_code, pos);
}
/*===============================================*/
void posStep(pos_t *pos, uint8_t dir)
@ -135,6 +147,9 @@ void setupLevel(uint8_t level)
item->tile = item_template_list[item->template_index].fg_tile;
onmap_ptr++;
}
execute(map_list[level].init_proc);
}
/*

View File

@ -1,4 +1,4 @@
CFLAGS = -g -Wall -I../../../csrc/. -I../../../tools/ugl/. -DU8G2_16BIT
CFLAGS = -g -Wall -I../../../csrc/. -I../../../tools/ugl/. -DU8G2_16BIT -DUGL_TEST
SRC = $(shell ls ../../../csrc/*.c) mapgen.c u8g2_d_tga.c
SRC += ../../../tools/ugl/ugl_arrays.c

View File

@ -36,6 +36,7 @@ struct _item_template_struct
};
typedef struct _item_template_struct item_template_t;
extern unsigned char map_code[] ;
extern item_template_t item_template_list[];
extern map_t map_list[];

View File

@ -19,17 +19,18 @@ int ugl_label_cnt;
/* procedures */
void ugl_InitBytecode(void)
{
ugl_bytecode_len = 0;
}
void ugl_AddBytecode(uint8_t x)
{
ugl_bytecode_array[ugl_bytecode_len] = x;
ugl_bytecode_len++;
}
void ugl_InitBytecode(void)
{
ugl_bytecode_len = 0;
ugl_AddBytecode(BC_CMD_RETURN_FROM_PROCEDURE);
}
void ugl_ExecBytecode(void)
{
bc_t bc;

View File

@ -29,6 +29,13 @@
#include <stdio.h>
#include <assert.h>
#ifndef UGL_TEST
#include "item.h"
#include "map.h"
#endif
void bc_push_on_arg_stack(bc_t *bc, uint16_t val)
{
bc->arg_stack[bc->arg_stack_pointer] = val;