diff --git a/Makefile b/Makefile index 59fae268..8627e08f 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ DSEKAI_C_FILES := \ src/mobile.c \ src/item.c \ src/window.c \ + src/script.c \ unilayer/dio.c \ src/control.c \ src/topdown.c diff --git a/src/dsekai.h b/src/dsekai.h index 22ca8d35..2b02f476 100644 --- a/src/dsekai.h +++ b/src/dsekai.h @@ -7,10 +7,13 @@ struct DSEKAI_STATE; +#define MOBILE_SCRIPT_STEPS_MAX 16 + #include "engines.h" #ifdef USE_JSON_MAPS #include "json.h" #endif /* USE_JSON_MAPS */ +#include "script.h" #include "item.h" #include "tilemap.h" #include "mobile.h" diff --git a/src/item.h b/src/item.h index 121afeb9..56c7a31b 100644 --- a/src/item.h +++ b/src/item.h @@ -2,7 +2,7 @@ #ifndef ITEM_H #define ITEM_H -struct ITEM { +struct PACKED ITEM { RESOURCE_ID sprite; struct TILEMAP_COORDS coords; struct ITEM* inventory; diff --git a/src/mobile.h b/src/mobile.h index 57e4b2cf..0080356e 100644 --- a/src/mobile.h +++ b/src/mobile.h @@ -2,11 +2,7 @@ #ifndef MOBILE_H #define MOBILE_H -struct -#ifdef __GNUC__ -__attribute__( (__packed__) ) -#endif /* __GNUC__ */ -MOBILE { +struct PACKED MOBILE { uint8_t facing; uint8_t active; uint8_t hp; diff --git a/src/script.c b/src/script.c new file mode 100644 index 00000000..9112bf28 --- /dev/null +++ b/src/script.c @@ -0,0 +1,3 @@ + +#include "dsekai.h" + diff --git a/src/script.h b/src/script.h new file mode 100644 index 00000000..d53e8756 --- /dev/null +++ b/src/script.h @@ -0,0 +1,11 @@ + +#ifndef SCRIPT_H +#define SCRIPT_H + +struct PACKED SCRIPT_STEP { + uint16_t action; + uint16_t arg; +}; + +#endif /* SCRIPT_H */ + diff --git a/src/tilemap.h b/src/tilemap.h index 8fd93e56..af6a999a 100644 --- a/src/tilemap.h +++ b/src/tilemap.h @@ -15,7 +15,6 @@ #define TILEMAP_STRINGS_MAX 20 #define TILEMAP_STRINGS_SZ 128 #define TILEMAP_SPAWN_T_MAX 32 -#define MOBILE_SCRIPT_STEPS_MAX 16 #define SCREEN_TW (SCREEN_MAP_W / TILE_W) #define SCREEN_TH (SCREEN_MAP_H / TILE_H) @@ -39,15 +38,10 @@ struct PACKED TILESET_TILE { uint32_t flags; }; -struct PACKED MOBILE_SCRIPT_STEP { - uint16_t action; - uint16_t arg; -}; - struct PACKED TILEMAP_SPAWN { struct TILEMAP_COORDS coords; int16_t type; - struct MOBILE_SCRIPT_STEP script[MOBILE_SCRIPT_STEPS_MAX]; + struct SCRIPT_STEP script[MOBILE_SCRIPT_STEPS_MAX]; }; struct PACKED TILEMAP { diff --git a/unilayer b/unilayer index 0e3a5e2d..f80909a7 160000 --- a/unilayer +++ b/unilayer @@ -1 +1 @@ -Subproject commit 0e3a5e2d7c6517687285f30d08900da7f0b69e09 +Subproject commit f80909a785f660ae802e9fd0a3b1e19ff5d3314c