Skip to content

Commit

Permalink
Added script module skeleton.
Browse files Browse the repository at this point in the history
  • Loading branch information
indigoparadox committed Aug 3, 2021
1 parent 846669f commit 6b50a65
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 14 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/dsekai.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions src/mobile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/script.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

#include "dsekai.h"

11 changes: 11 additions & 0 deletions src/script.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#ifndef SCRIPT_H
#define SCRIPT_H

struct PACKED SCRIPT_STEP {
uint16_t action;
uint16_t arg;
};

#endif /* SCRIPT_H */

8 changes: 1 addition & 7 deletions src/tilemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion unilayer
Submodule unilayer updated 2 files
+18 −0 README.md
+4 −2 graphics/dosg.c

0 comments on commit 6b50a65

Please sign in to comment.