diff --git a/Slightlys Midnight Adventure.gbc b/Slightlys Midnight Adventure.gbc new file mode 100644 index 0000000..6fb8b44 Binary files /dev/null and b/Slightlys Midnight Adventure.gbc differ diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..d4ed318 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,29 @@ +/obj +*.bak +*.dof +*.dsk +*.cfg +*.map +*.sym +*.o +__pycache__ +/profile/*.txt +@usage.bat +*.ihx +*.noi +/.vscode +/*.cdb +/build +/test/*.noi +/test/*.sna +/test/*.bmp +/test/*.o +/test/*.asm +/test/*.lst +*.gb +/examples/*/obj +/examples/*/build +/test/*/obj +/test/*/build +/test/*/*.bmp +/third-party/*/build diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..7fc1d9d --- /dev/null +++ b/src/Makefile @@ -0,0 +1,35 @@ +include ./Makefile.common +include ./Makefile.build + +GBSTOOLS_DIR = /tmp/_gbstools +GBDK = $(GBSTOOLS_DIR)/gbdk +GBSPACK = $(GBSTOOLS_DIR)/gbspack/gbspack + +ROM_BUILD_DIR = build +OBJDIR = obj +REL_OBJDIR = obj/_rel + +ADATA = $(foreach dir,src/data,$(notdir $(wildcard $(dir)/*.s))) +CDATA = $(foreach dir,src/data,$(notdir $(wildcard $(dir)/*.c))) +MDATA = $(foreach dir,src/data/music,$(notdir $(wildcard $(dir)/*.c))) + +OBJS = $(ENGINE_OBJS) \ + $(ADATA:%.s=$(OBJDIR)/%.o) \ + $(CDATA:%.c=$(OBJDIR)/%.o) \ + $(MDATA:%.c=$(OBJDIR)/%.o) + +REL_OBJS_LOCAL = $(OBJS:$(OBJDIR)/%.o=$(REL_OBJDIR)/%.rel) +REL_OBJS = $(REL_OBJS_LOCAL:$(TOP)$(OBJDIR)/%.o=$(REL_OBJDIR)/%.rel) + +CFLAGS += -Idata/include -Wa-Idata/include + +all: settings directories $(TARGET) + +$(OBJDIR)/%.o: src/data/music/%.c + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJDIR)/%.o: src/data/%.c + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJDIR)/%.o: src/data/%.s + $(CC) $(CFLAGS) -c -o $@ $< diff --git a/src/Makefile.build b/src/Makefile.build new file mode 100644 index 0000000..f3883b6 --- /dev/null +++ b/src/Makefile.build @@ -0,0 +1 @@ +settings: CGB hUGE MBC5 \ No newline at end of file diff --git a/src/Makefile.common b/src/Makefile.common new file mode 100644 index 0000000..c1646f8 --- /dev/null +++ b/src/Makefile.common @@ -0,0 +1,174 @@ +TOP := $(dir $(lastword $(MAKEFILE_LIST))) + +GBDK = $(TOP)../gbdk +CC = $(GBDK)/bin/lcc +TEST_DIR = $(TOP)test +TEST_FW = $(TEST_DIR)/framework +EXAMPLES_DIR = ./examples +EMU = $(TOP)../bgb/bgb +GBSPACK = $(TOP)../gbspack/gbspack +TEST_CHK = python $(CURDIR)/$(TEST_FW)/unit_checker.py +GBS_CLI = node $(TOP)../gb-studio/out/cli/gb-studio-cli.js +PLATFORM = + +ROMTITLE = "GBSTUDIO" + +ROM_BUILD_DIR = build +OBJDIR = obj +REL_OBJDIR = obj/_rel + +CFLAGS = $(PLATFORM) -I$(TOP)include -Wa-I$(TOP)include + +LFLAGS_NBANKS += -Wm-yoA -Wm-ya4 +LFLAGS_SYMBOLS = -Wl-j -Wl-m -Wl-w -Wm-yS + +LFLAGS = $(PLATFORM) -Wm-yt$(CART_MBC) $(LFLAGS_NBANKS) $(LFLAGS_SYMBOLS) -Wl-klib -Wl-g.STACK=0xDF00 -Wi-e + +PACKFLAGS = -b 1 -f 255 -e rel -c + +EMUFLAGS = \ + -set "Color0=E8E8E8" \ + -set "Color1=A0A0A0" \ + -set "Color2=585858" \ + -set "Color3=101010" \ + -set "DebugWRAMbreak=0" \ + -set "DebugSrcBrk=1" \ + -hf -stateonexit \ + -screenonexit ./capture.bmp + +EMU_FORCE_DMG = -set "SystemMode=0" + +TARGET = $(ROM_BUILD_DIR)/rom.gb + +ASRC = $(foreach dir,$(TOP)src,$(notdir $(wildcard $(dir)/*.s))) +CSRC = $(foreach dir,$(TOP)src,$(notdir $(wildcard $(dir)/*.c))) +ACORE = $(foreach dir,$(TOP)src/core,$(notdir $(wildcard $(dir)/*.s))) +CCORE = $(foreach dir,$(TOP)src/core,$(notdir $(wildcard $(dir)/*.c))) +CSTATES = $(foreach dir,$(TOP)src/states,$(notdir $(wildcard $(dir)/*.c))) +ASTATES = $(foreach dir,$(TOP)src/states,$(notdir $(wildcard $(dir)/*.s))) + +ENGINE_OBJS = $(CSRC:%.c=$(TOP)$(OBJDIR)/%.o) \ + $(ASRC:%.s=$(TOP)$(OBJDIR)/%.o) \ + $(ACORE:%.s=$(TOP)$(OBJDIR)/%.o) \ + $(CCORE:%.c=$(TOP)$(OBJDIR)/%.o) \ + $(CSTATES:%.c=$(TOP)$(OBJDIR)/%.o) \ + $(ASTATES:%.s=$(TOP)$(OBJDIR)/%.o) + +OBJS = $(ENGINE_OBJS) +REL_OBJS = $(OBJS:$(OBJDIR)/%.o=$(REL_OBJDIR)/%.rel) + +all: settings directories BUILD + +.PHONY: directories clean release debug profile AP DMG CGB SGB MBC3 MBC5 hUGE GBT test rom BUILD +.SECONDARY: $(OBJS) + +AP: + $(eval PLATFORM = -msm83:ap) + $(eval TARGET = $(patsubst %.gb,%.pocket,$(TARGET))) + @echo "Analogue pocket build" + +release: + $(eval CFLAGS += -Wf'--max-allocs-per-node 50000') + @echo "RELEASE mode ON" + +debug: + $(eval CFLAGS += -Wf--fverbose-asm -Wf--debug -Wl-m -Wl-w -Wl-y -DVM_DEBUG_OUTPUT) + $(eval CFLAGS += -Wf--nolospre -Wf--nogcse) + $(eval LFLAGS += -Wf--debug -Wl-m -Wl-w -Wl-y) + @echo "DEBUG mode ON" + +profile: + $(eval CFLAGS += -Wf--profile) + @echo "PROFILE mode ON" + +DMG: + @echo "DMG mode ON" + +CGB: + $(eval CFLAGS += -DCGB) + $(eval LFLAGS += -Wm-yC) + @echo "CGB mode ON" + +SGB: + $(eval CFLAGS += -DSGB) + $(eval LFLAGS += -Wm-ys) + @echo "SGB mode ON" + +batteryless: + $(eval PACKFLAGS += -a 4) + $(eval BATTERYLESS = 1) + $(eval CFLAGS += -DBATTERYLESS) + @echo "BETTERYLESS SAVE ON" + +MBC3: + $(eval CART_MBC = 0x10) + @echo "Using MBC3" +MBC5: + $(eval CART_MBC = 0x1B) + @echo "Using MBC5" + +hUGE: + $(eval CFLAGS += -DHUGE_TRACKER) + $(eval LFLAGS += -Wl-l$(TOP)lib/hUGEDriver.lib) + @echo "Enable hUGETracker" +GBT: + $(eval CFLAGS += -DGBT_PLAYER) + $(eval LFLAGS += -Wl-l$(TOP)lib/gbt_player.lib) + $(eval PACKFLAGS += -s 1:800) + @echo "Enable GBTPlayer" + +directories: $(ROM_BUILD_DIR) $(OBJDIR) $(REL_OBJDIR) + +$(ROM_BUILD_DIR): + mkdir -p $(ROM_BUILD_DIR) + +$(OBJDIR): + mkdir -p $(OBJDIR) + mkdir -p $(TOP)$(OBJDIR) + +$(REL_OBJDIR): + mkdir -p $(REL_OBJDIR) + +$(TOP)$(OBJDIR)/%.o: $(TOP)src/core/%.c + $(CC) $(CFLAGS) -Wf-MMD $(filter -Wf-ba%, $(subst .d,-Wf-ba,$(suffix $(<:%.c=%)))) -c -o $@ $< + +$(TOP)$(OBJDIR)/%.o: $(TOP)src/core/%.s + $(CC) $(CFLAGS) -c -o $@ $< + +$(TOP)$(OBJDIR)/%.o: $(TOP)src/states/%.c + $(CC) $(CFLAGS) -Wf-MMD -c -o $@ $< + +$(TOP)$(OBJDIR)/%.o: $(TOP)src/states/%.s + $(CC) $(CFLAGS) -c -o $@ $< + +$(TOP)$(OBJDIR)/%.o: $(TOP)src/%.c + $(CC) $(CFLAGS) -Wf-MMD -c -o $@ $< + +$(TOP)$(OBJDIR)/%.o: $(TOP)src/%.s + $(CC) $(CFLAGS) -c -o $@ $< + +$(REL_OBJDIR)/linkfile.lk: $(OBJS) + mkdir -p $(REL_OBJDIR) + + $(shell rm -f $(REL_OBJDIR)/packfile.pk) + $(foreach O,$(OBJS),$(shell echo $O >>$(REL_OBJDIR)/packfile.pk)) + $(eval CART_SIZE=$(shell $(GBSPACK) $(PACKFLAGS) -o $(REL_OBJDIR) -i $(REL_OBJDIR)/packfile.pk)) + + $(shell echo -g __start_save=$(shell expr $(CART_SIZE) - 4 ) >$@) + $(foreach O,$(REL_OBJS),$(shell echo $O >>$@)) + +BUILD: $(REL_OBJDIR)/linkfile.lk + $(CC) $(LFLAGS) -Wm-yn$(ROMTITLE) -o $(TARGET) -Wl-f$< + +clean: + @echo "CLEANUP..." + rm -rf $(TOP)$(OBJDIR) + rm -rf $(OBJDIR) + rm -rf $(ROM_BUILD_DIR) + rm -f $(TEST_DIR)/*/capture.bmp + rm -rf $(TEST_DIR)/*/obj + rm -rf $(TEST_DIR)/*/build + rm -rf $(EXAMPLES_DIR)/*/obj + rm -rf $(EXAMPLES_DIR)/*/build + +rom: directories BUILD diff --git a/src/engine.json b/src/engine.json new file mode 100644 index 0000000..fe4208a --- /dev/null +++ b/src/engine.json @@ -0,0 +1,249 @@ +{ + "version": "4.2.0-e1", + "fields": [ + { + "key": "INPUT_PLATFORM_JUMP", + "sceneType": "PLATFORM", + "label": "FIELD_INPUT_JUMP", + "group": "GAMETYPE_PLATFORMER", + "type": "select", + "options": [ + ["INPUT_A", "A"], + ["INPUT_B", "B"], + ["INPUT_UP", "FIELD_DIRECTION_UP"] + ], + "cType": "define", + "defaultValue": "INPUT_A" + }, + { + "key": "INPUT_PLATFORM_RUN", + "sceneType": "PLATFORM", + "label": "FIELD_INPUT_RUN", + "group": "GAMETYPE_PLATFORMER", + "type": "select", + "options": [ + ["INPUT_A", "A"], + ["INPUT_B", "B"] + ], + "cType": "define", + "defaultValue": "INPUT_B" + }, + { + "key": "INPUT_PLATFORM_INTERACT", + "sceneType": "PLATFORM", + "label": "FIELD_INPUT_INTERACT", + "group": "GAMETYPE_PLATFORMER", + "type": "select", + "options": [ + ["INPUT_A", "A"], + ["INPUT_B", "B"], + ["INPUT_UP", "FIELD_DIRECTION_UP"], + ["INPUT_DOWN", "FIELD_DIRECTION_DOWN"] + ], + "cType": "define", + "defaultValue": "INPUT_A" + }, + { + "key": "plat_min_vel", + "sceneType": "PLATFORM", + "label": "FIELD_MIN_VEL", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 304, + "min": 0, + "max": 16384 + }, + { + "key": "plat_walk_vel", + "sceneType": "PLATFORM", + "label": "FIELD_WALK_VEL", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 6400, + "min": 0, + "max": 16384 + }, + { + "key": "plat_run_vel", + "sceneType": "PLATFORM", + "label": "FIELD_RUN_VEL", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 10496, + "min": 0, + "max": 16384 + }, + { + "key": "plat_climb_vel", + "sceneType": "PLATFORM", + "label": "FIELD_CLIMB_VEL", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 4000, + "min": 0, + "max": 16384 + }, + { + "key": "plat_walk_acc", + "sceneType": "PLATFORM", + "label": "FIELD_WALK_ACC", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 152, + "min": 0, + "max": 768 + }, + { + "key": "plat_run_acc", + "sceneType": "PLATFORM", + "label": "FIELD_RUN_ACC", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 228, + "min": 0, + "max": 768 + }, + { + "key": "plat_dec", + "sceneType": "PLATFORM", + "label": "FIELD_DECELERATION", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 208, + "min": 0, + "max": 768 + }, + { + "key": "plat_jump_vel", + "sceneType": "PLATFORM", + "label": "FIELD_JUMP_VEL", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 16384, + "min": 0, + "max": 32768 + }, + { + "key": "plat_grav", + "sceneType": "PLATFORM", + "label": "FIELD_GRAVITY", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 1792, + "min": 0, + "max": 8192 + }, + { + "key": "plat_hold_grav", + "sceneType": "PLATFORM", + "label": "FIELD_GRAVITY_JUMP", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 512, + "min": 0, + "max": 8192 + }, + { + "key": "plat_max_fall_vel", + "sceneType": "PLATFORM", + "label": "FIELD_MAX_FALL_VEL", + "group": "GAMETYPE_PLATFORMER", + "type": "slider", + "cType": "WORD", + "defaultValue": 20000, + "min": 0, + "max": 24560 + }, + { + "key": "shooter_scroll_speed", + "sceneType": "SHMUP", + "label": "FIELD_SCROLL_SPEED", + "group": "GAMETYPE_SHMUP", + "type": "slider", + "cType": "UBYTE", + "defaultValue": 16, + "min": 0, + "max": 64 + }, + { + "key": "INPUT_TOPDOWN_INTERACT", + "sceneType": "TOPDOWN", + "label": "FIELD_INPUT_INTERACT", + "group": "GAMETYPE_TOP_DOWN", + "type": "select", + "options": [ + ["INPUT_A", "A"], + ["INPUT_B", "B"] + ], + "cType": "define", + "defaultValue": "INPUT_A" + }, + { + "key": "topdown_grid", + "sceneType": "TOPDOWN", + "label": "FIELD_GRID_SIZE", + "group": "GAMETYPE_TOP_DOWN", + "type": "select", + "options": [ + [8, "FIELD_GRID_8PX"], + [16, "FIELD_GRID_16PX"] + ], + "cType": "UBYTE", + "defaultValue": 8 + }, + { + "key": "fade_style", + "label": "FIELD_FADE_STYLE", + "group": "SETTINGS_FADE", + "type": "select", + "options": [ + [0, "FIELD_FADE_WHITE"], + [1, "FIELD_FADE_BLACK"] + ], + "cType": "UBYTE", + "defaultValue": 0 + } + ], + "sceneTypes": [ + { + "key": "TOPDOWN", + "label": "GAMETYPE_TOP_DOWN", + "files": ["include/states/topdown.h", "src/states/topdown.c"] + }, + { + "key": "PLATFORM", + "label": "GAMETYPE_PLATFORMER", + "files": ["include/states/platform.h", "src/states/platform.c"] + }, + { + "key": "ADVENTURE", + "label": "GAMETYPE_ADVENTURE", + "files": ["include/states/adventure.h", "src/states/adventure.c"] + }, + { + "key": "SHMUP", + "label": "GAMETYPE_SHMUP", + "files": ["include/states/shmup.h", "src/states/shmup.c"] + }, + { + "key": "POINTNCLICK", + "label": "GAMETYPE_POINT_N_CLICK", + "files": ["include/states/pointnclick.h", "src/states/pointnclick.c"] + }, + { + "key": "LOGO", + "label": "GAMETYPE_LOGO", + "files": ["include/states/logo.h", "src/states/logo.c"] + } + ] +} diff --git a/src/include/actor.h b/src/include/actor.h new file mode 100644 index 0000000..8b43e1e --- /dev/null +++ b/src/include/actor.h @@ -0,0 +1,81 @@ +#ifndef ACTOR_H +#define ACTOR_H + +#include +#include "bankdata.h" +#include "gbs_types.h" + +#define MAX_ACTORS 21 +#define MAX_ACTORS_ACTIVE 12 + +#define PLAYER actors[0] +#define ON_8PX_GRID(A) ( MOD_8((A).x >> 4) == 0 && MOD_8((A).y >> 4) == 0) +#define ON_16PX_GRID(A) (MOD_16((A).x >> 4) == 0 && MOD_16((A).y >> 4) == 8) + +#define PLAYER_HURT_IFRAMES 20 + +#define ANIM_JUMP_LEFT 0 +#define ANIM_JUMP_RIGHT 2 +#define ANIM_CLIMB 6 + +#define ANIM_CURSOR 0 +#define ANIM_CURSOR_HOVER 1 + +#define ANIM_SET_DEFAULT 0 + +BANKREF_EXTERN(ACTOR) + +typedef enum { + CHECK_DIR_LEFT = 1, + CHECK_DIR_RIGHT, + CHECK_DIR_UP, + CHECK_DIR_DOWN, +} col_check_dir_e; + +extern actor_t actors[MAX_ACTORS]; +extern actor_t * actors_active_head; +extern actor_t * actors_active_tail; +extern actor_t * actors_inactive_head; +extern UBYTE player_moving; +extern actor_t * player_collision_actor; +extern actor_t * emote_actor; +extern UBYTE emote_timer; + +extern UBYTE allocated_sprite_tiles; +extern UBYTE allocated_hardware_sprites; + +void actors_init(void) BANKED; +void actors_update(void) NONBANKED; +void deactivate_actor(actor_t *actor) BANKED; +void activate_actor(actor_t *actor) BANKED; +void actor_set_frames(actor_t *actor, UBYTE frame_start, UBYTE frame_end) BANKED; +void actor_set_frame_offset(actor_t *actor, UBYTE frame_offset) BANKED; +UBYTE actor_get_frame_offset(actor_t *actor) BANKED; +actor_t *actor_at_tile(UBYTE tx, UBYTE ty, UBYTE inc_noclip) BANKED; +actor_t *actor_in_front_of_player(UBYTE grid_size, UBYTE inc_noclip) BANKED; +actor_t *actor_overlapping_player(UBYTE inc_noclip) BANKED; +actor_t *actor_overlapping_bb(bounding_box_t *bb, point16_t *offset, actor_t *ignore, UBYTE inc_noclip) BANKED; +void actor_set_anim_idle(actor_t *actor) BANKED; +void actor_set_anim_moving(actor_t *actor) BANKED; +void actor_set_dir(actor_t *actor, direction_e dir, UBYTE moving) BANKED; +inline void actor_set_anim(actor_t *actor, UBYTE anim) { + actor->animation = anim; + actor_set_frames(actor, actor->animations[anim].start, actor->animations[anim].end + 1); +} +inline void actor_reset_anim(actor_t *actor) { + actor_set_frames(actor, actor->animations[actor->animation].start, actor->animations[actor->animation].end + 1); +} +inline void actor_stop_anim(actor_t *actor) { + actor->frame_start = actor->frame; + actor->frame_end = actor->frame + 1; +} +inline void player_register_collision_with(actor_t *actor) { + player_collision_actor = actor; +} +void actors_handle_player_collision(void) BANKED; +UWORD check_collision_in_direction(UWORD start_x, UWORD start_y, bounding_box_t *bounds, UWORD end_pos, col_check_dir_e check_dir) BANKED; +void activate_actors_in_row(UBYTE x, UBYTE y) BANKED; +void activate_actors_in_col(UBYTE x, UBYTE y) BANKED; +void player_init(void) BANKED; + +#endif diff --git a/src/include/bankdata.h b/src/include/bankdata.h new file mode 100644 index 0000000..568420c --- /dev/null +++ b/src/include/bankdata.h @@ -0,0 +1,147 @@ +#ifndef BANK_DATA_H +#define BANK_DATA_H + +#include + +#include "compat.h" + +#define TO_FAR_PTR_T(A) {.bank = (UBYTE)&(__bank_ ## A), .ptr = (void *)&(A)} +#define TO_FAR_ARGS(T, A) (T)(A).ptr, (A).bank + +#ifndef BANK +#define BANK(VARNAME) ( (UBYTE) & __bank_ ## VARNAME ) +#endif +#ifndef BANKREF +#define BANKREF(VARNAME) void __func_ ## VARNAME(void) BANKED NAKED { \ +__asm \ + .local b___func_ ## VARNAME \ + ___bank_ ## VARNAME = b___func_ ## VARNAME \ + .globl ___bank_ ## VARNAME \ +__endasm; \ +} +#endif +#ifndef BANKREF_EXTERN +#define BANKREF_EXTERN(VARNAME) extern const void __bank_ ## VARNAME; +#endif + +#ifndef SIZE +#define SIZE(VARNAME) ((UWORD)&( __size_ ## VARNAME )) +#endif +#ifndef SIZEREF +#define SIZEREF(VARNAME) const void AT(sizeof(VARNAME)) __size_ ## VARNAME; +#endif +#ifndef SIZEREF_EXTERN +#define SIZEREF_EXTERN(VARNAME) extern const void __size_ ## VARNAME; +#endif + +typedef struct far_ptr_t { + UBYTE bank; + void * ptr; +} far_ptr_t; + +/** + * Call set_bkg_data with data stored in banked memory (non-reentrant!) + * + * @param i first tile to write to + * @param l number of tiles to write + * @param ptr memory address of tile data within bank + * @param bank bank to read from + */ +void SetBankedBkgData(UBYTE i, UBYTE l, const unsigned char *ptr, UBYTE bank) OLDCALL; + +/** + * Call set_sprite_data with data stored in banked memory (non-reentrant!) + * + * @param i first tile to write to + * @param l number of tiles to write + * @param ptr memory address of tile data within bank + * @param bank bank to read from + */ +void SetBankedSpriteData(UBYTE i, UBYTE l, const unsigned char *ptr, UBYTE bank) OLDCALL; + +/** + * Sets a rectangular region of Tile Map entries for the Background layer (non-reentrant!) + * + * @param x X Start position in Background Map tile coordinates. Range 0 - 31 + * @param y Y Start position in Background Map tile coordinates. Range 0 - 31 + * @param w Width of area to set in tiles. Range 0 - 31 + * @param h Height of area to set in tiles. Range 0 - 31 + * @param tiles Pointer to source Tile Map data + * @param bank bank to read from + */ +void SetBankedBkgTiles(UINT8 x, UINT8 y, UINT8 w, UINT8 h, const unsigned char *tiles, UBYTE bank) OLDCALL; + +/** + * Sets a rectangular region of Tile Map entries for the Window layer (non-reentrant!) + * + * @param x X Start position in Window Map tile coordinates. Range 0 - 31 + * @param y Y Start position in Window Map tile coordinates. Range 0 - 31 + * @param w Width of area to set in tiles. Range 0 - 31 + * @param h Height of area to set in tiles. Range 0 - 31 + * @param tiles Pointer to source Tile Map data + * @param bank bank to read from + */ +void SetBankedWinTiles(UINT8 x, UINT8 y, UINT8 w, UINT8 h, const unsigned char *tiles, UBYTE bank) OLDCALL; + + +/** + * Read far pointer from banked memory location into dest (non-reentrant!) + * + * @param dest pointer to far_ptr_t struct + * @param ptr memory address of data within bank + * @param bank bank to read from + */ +void ReadBankedFarPtr(far_ptr_t * dest, const unsigned char *ptr, UBYTE bank); + +/** + * Read UWORD from banked memory location (non-reentrant!) + * + * @param ptr memory address of data within bank + * @param bank bank to read from + * @return value stored in banked location + */ +UWORD ReadBankedUWORD(const unsigned char *ptr, UBYTE bank); + +/** + * Read UBYTE from banked memory location (non-reentrant!) + * + * @param ptr memory address of data within bank + * @param bank bank to read from + * @return value stored in banked location + */ +inline UBYTE ReadBankedUBYTE(const unsigned char *ptr, UBYTE bank) { + return (UBYTE)ReadBankedUWORD(ptr, bank); +} + +/** + * memcpy data from banked memory location (non-reentrant!) + * + * @param to destination to write fetched data + * @param from memory address of data within bank + * @param n number of bytes to fetch from bank + * @param bank bank to read from + */ +void MemcpyBanked(void* to, const void* from, size_t n, UBYTE bank); + +/** + * memcpy data from banked memory location (non-reentrant!) to VRAM + * + * @param to destination to write fetched data + * @param from memory address of data within bank + * @param n number of bytes to fetch from bank + * @param bank bank to read from + */ +void MemcpyVRAMBanked(void* to, const void* from, size_t n, UBYTE bank); + +/** + * returns the index of pointer from the list + * + * @param list pointer to the farptr array + * @param bank bank number of the list + * @param count number of items in the farptr array + * @param item pointer the the item in WRAM being searched + * @return index in the array or count if not found + */ +UBYTE IndexOfFarPtr(const far_ptr_t * list, UBYTE bank, UBYTE count, const far_ptr_t * item); + +#endif diff --git a/src/include/camera.h b/src/include/camera.h new file mode 100644 index 0000000..4cacbd5 --- /dev/null +++ b/src/include/camera.h @@ -0,0 +1,32 @@ +#ifndef CAMERA_H +#define CAMERA_H + +#include + +#define SCREEN_WIDTH 160 +#define SCREEN_HEIGHT 144 +#define SCREEN_WIDTH_HALF 80 +#define SCREEN_HEIGHT_HALF 72 + +#define CAMERA_UNLOCKED 0x00 +#define CAMERA_LOCK_X_FLAG 0x01 +#define CAMERA_LOCK_Y_FLAG 0x02 +#define CAMERA_LOCK_FLAG (CAMERA_LOCK_X_FLAG | CAMERA_LOCK_Y_FLAG) + +extern INT16 camera_x; +extern INT16 camera_y; +extern BYTE camera_offset_x; +extern BYTE camera_offset_y; +extern BYTE camera_deadzone_x; +extern BYTE camera_deadzone_y; +extern UBYTE camera_settings; + +void camera_init(void) BANKED; + +inline void camera_reset(void) { + camera_deadzone_x = camera_deadzone_y = 0; +} + +void camera_update(void) NONBANKED; + +#endif \ No newline at end of file diff --git a/src/include/collision.h b/src/include/collision.h new file mode 100644 index 0000000..b0d1bfe --- /dev/null +++ b/src/include/collision.h @@ -0,0 +1,71 @@ +#ifndef COLLISIONS_H +#define COLLISIONS_H + +#include + +#include "math.h" +#include "bankdata.h" + +#define COLLISION_TOP 0x1 +#define COLLISION_BOTTOM 0x2 +#define COLLISION_LEFT 0x4 +#define COLLISION_RIGHT 0x8 +#define COLLISION_ALL 0xF +#define TILE_PROP_LADDER 0x10 + +typedef struct bounding_box_t { + BYTE left, right, top, bottom; +} bounding_box_t; + +extern UBYTE collision_bank; +extern unsigned char *collision_ptr; +extern UBYTE image_tile_width; +extern UBYTE image_tile_height; + +/** + * Check if point is within positioned bounding box. + * + * @param bb Pointer to bounding box + * @param offset Pointer to position offset for bounding box (e.g Actor position) + * @param point Pointer to position to look for within bounding box + * @return Point is within bounding box + */ +inline UBYTE bb_contains(bounding_box_t *bb, point16_t *offset, point16_t *point) { + if ((point->x < (offset->x >> 4) + bb->left) || + (point->x > (offset->x >> 4) + bb->right)) return FALSE; + if ((point->y < (offset->y >> 4) + bb->top) || + (point->y > (offset->y >> 4) + bb->bottom)) return FALSE; + return TRUE; +} + +/** + * Check if two positioned bounding boxes intersect. + * + * @param bb_a Pointer to bounding box A + * @param offset_a Pointer to position offset for bounding box A + * @param bb_b Pointer to bounding box B + * @param offset_b Pointer to position offset for bounding box B + * @return Positioned bounding boxes intersect + */ +inline UBYTE bb_intersects(bounding_box_t *bb_a, point16_t *offset_a, bounding_box_t *bb_b, point16_t *offset_b) { + if (((offset_b->x >> 4) + bb_b->left > (offset_a->x >> 4) + bb_a->right) || + ((offset_b->x >> 4) + bb_b->right < (offset_a->x >> 4) + bb_a->left)) return FALSE; + if (((offset_b->y >> 4) + bb_b->top > (offset_a->y >> 4) + bb_a->bottom) || + ((offset_b->y >> 4) + bb_b->bottom < (offset_a->y >> 4) + bb_a->top)) return FALSE; + return TRUE; +} + +/** + * Return collision tile value at given tile x,y coordinate. + * + * @param tx Left tile + * @param ty Top tile + * @return Tile value, 0 if no collisions, COLLISION_ALL if out of bounds + */ +inline UBYTE tile_at(UBYTE tx, UBYTE ty) { + if ((tx < image_tile_width) && (ty < image_tile_height)) + return ReadBankedUBYTE(collision_ptr + (ty * (UINT16)image_tile_width) + tx, collision_bank); + return COLLISION_ALL; +} + +#endif diff --git a/src/include/compat.h b/src/include/compat.h new file mode 100644 index 0000000..2eca7cc --- /dev/null +++ b/src/include/compat.h @@ -0,0 +1,47 @@ +#ifndef _COMPAT_H_INCLUDE +#define _COMPAT_H_INCLUDE + +#include + +#ifndef OLDCALL +#if __SDCC_REVISION >= 12608 +#define OLDCALL __sdcccall(0) +#else +#define OLDCALL +#endif +#endif + +#ifndef PRESERVES_REGS +#ifdef __SDCC +#define PRESERVES_REGS(...) __preserves_regs(__VA_ARGS__) +#else +#define PRESERVES_REGS(...) +#endif +#endif + +#ifndef NAKED +#ifdef __SDCC +#define NAKED __naked +#else +#define NAKED +#endif +#endif + +#ifndef SFR +#ifdef __SDCC +#define SFR __sfr +#else +#define SFR +#endif +#endif + +#ifndef AT +#ifdef __SDCC +#define AT(A) __at(A) +#else +#define AT(A) +#endif +#endif + + +#endif \ No newline at end of file diff --git a/src/include/core.h b/src/include/core.h new file mode 100644 index 0000000..23e6a26 --- /dev/null +++ b/src/include/core.h @@ -0,0 +1,9 @@ +#ifndef _CORE_H_INCLUDE +#define _CORE_H_INCLUDE + +#include + +void core_reset(void) BANKED; +void core_run(void) BANKED; + +#endif \ No newline at end of file diff --git a/src/include/data/actor_0_interact.h b/src/include/data/actor_0_interact.h new file mode 100644 index 0000000..008868c --- /dev/null +++ b/src/include/data/actor_0_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_0_INTERACT_H +#define ACTOR_0_INTERACT_H + +// Script actor_0_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_0_interact) +extern const unsigned char actor_0_interact[]; + +#endif diff --git a/src/include/data/actor_10_interact.h b/src/include/data/actor_10_interact.h new file mode 100644 index 0000000..64f741d --- /dev/null +++ b/src/include/data/actor_10_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_10_INTERACT_H +#define ACTOR_10_INTERACT_H + +// Script actor_10_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_10_interact) +extern const unsigned char actor_10_interact[]; + +#endif diff --git a/src/include/data/actor_11_interact.h b/src/include/data/actor_11_interact.h new file mode 100644 index 0000000..dd16462 --- /dev/null +++ b/src/include/data/actor_11_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_11_INTERACT_H +#define ACTOR_11_INTERACT_H + +// Script actor_11_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_11_interact) +extern const unsigned char actor_11_interact[]; + +#endif diff --git a/src/include/data/actor_12_interact.h b/src/include/data/actor_12_interact.h new file mode 100644 index 0000000..28879d9 --- /dev/null +++ b/src/include/data/actor_12_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_12_INTERACT_H +#define ACTOR_12_INTERACT_H + +// Script actor_12_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_12_interact) +extern const unsigned char actor_12_interact[]; + +#endif diff --git a/src/include/data/actor_13_interact.h b/src/include/data/actor_13_interact.h new file mode 100644 index 0000000..9b1cba6 --- /dev/null +++ b/src/include/data/actor_13_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_13_INTERACT_H +#define ACTOR_13_INTERACT_H + +// Script actor_13_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_13_interact) +extern const unsigned char actor_13_interact[]; + +#endif diff --git a/src/include/data/actor_14_interact.h b/src/include/data/actor_14_interact.h new file mode 100644 index 0000000..bedc400 --- /dev/null +++ b/src/include/data/actor_14_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_14_INTERACT_H +#define ACTOR_14_INTERACT_H + +// Script actor_14_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_14_interact) +extern const unsigned char actor_14_interact[]; + +#endif diff --git a/src/include/data/actor_15_interact.h b/src/include/data/actor_15_interact.h new file mode 100644 index 0000000..eec71ad --- /dev/null +++ b/src/include/data/actor_15_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_15_INTERACT_H +#define ACTOR_15_INTERACT_H + +// Script actor_15_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_15_interact) +extern const unsigned char actor_15_interact[]; + +#endif diff --git a/src/include/data/actor_1_interact.h b/src/include/data/actor_1_interact.h new file mode 100644 index 0000000..24e69d4 --- /dev/null +++ b/src/include/data/actor_1_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_1_INTERACT_H +#define ACTOR_1_INTERACT_H + +// Script actor_1_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_1_interact) +extern const unsigned char actor_1_interact[]; + +#endif diff --git a/src/include/data/actor_2_interact.h b/src/include/data/actor_2_interact.h new file mode 100644 index 0000000..40a05c4 --- /dev/null +++ b/src/include/data/actor_2_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_2_INTERACT_H +#define ACTOR_2_INTERACT_H + +// Script actor_2_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_2_interact) +extern const unsigned char actor_2_interact[]; + +#endif diff --git a/src/include/data/actor_3_interact.h b/src/include/data/actor_3_interact.h new file mode 100644 index 0000000..b934746 --- /dev/null +++ b/src/include/data/actor_3_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_3_INTERACT_H +#define ACTOR_3_INTERACT_H + +// Script actor_3_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_3_interact) +extern const unsigned char actor_3_interact[]; + +#endif diff --git a/src/include/data/actor_4_interact.h b/src/include/data/actor_4_interact.h new file mode 100644 index 0000000..64084b1 --- /dev/null +++ b/src/include/data/actor_4_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_4_INTERACT_H +#define ACTOR_4_INTERACT_H + +// Script actor_4_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_4_interact) +extern const unsigned char actor_4_interact[]; + +#endif diff --git a/src/include/data/actor_5_interact.h b/src/include/data/actor_5_interact.h new file mode 100644 index 0000000..a33438e --- /dev/null +++ b/src/include/data/actor_5_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_5_INTERACT_H +#define ACTOR_5_INTERACT_H + +// Script actor_5_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_5_interact) +extern const unsigned char actor_5_interact[]; + +#endif diff --git a/src/include/data/actor_6_interact.h b/src/include/data/actor_6_interact.h new file mode 100644 index 0000000..10c2bfa --- /dev/null +++ b/src/include/data/actor_6_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_6_INTERACT_H +#define ACTOR_6_INTERACT_H + +// Script actor_6_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_6_interact) +extern const unsigned char actor_6_interact[]; + +#endif diff --git a/src/include/data/actor_7_interact.h b/src/include/data/actor_7_interact.h new file mode 100644 index 0000000..45fdd65 --- /dev/null +++ b/src/include/data/actor_7_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_7_INTERACT_H +#define ACTOR_7_INTERACT_H + +// Script actor_7_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_7_interact) +extern const unsigned char actor_7_interact[]; + +#endif diff --git a/src/include/data/actor_8_interact.h b/src/include/data/actor_8_interact.h new file mode 100644 index 0000000..1d12a71 --- /dev/null +++ b/src/include/data/actor_8_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_8_INTERACT_H +#define ACTOR_8_INTERACT_H + +// Script actor_8_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_8_interact) +extern const unsigned char actor_8_interact[]; + +#endif diff --git a/src/include/data/actor_9_interact.h b/src/include/data/actor_9_interact.h new file mode 100644 index 0000000..19e7743 --- /dev/null +++ b/src/include/data/actor_9_interact.h @@ -0,0 +1,11 @@ +#ifndef ACTOR_9_INTERACT_H +#define ACTOR_9_INTERACT_H + +// Script actor_9_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(actor_9_interact) +extern const unsigned char actor_9_interact[]; + +#endif diff --git a/src/include/data/bg_cave.h b/src/include/data/bg_cave.h new file mode 100644 index 0000000..9b5b0ed --- /dev/null +++ b/src/include/data/bg_cave.h @@ -0,0 +1,11 @@ +#ifndef BG_CAVE_H +#define BG_CAVE_H + +// Background: cave + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_cave) +extern const struct background_t bg_cave; + +#endif diff --git a/src/include/data/bg_cave_tilemap.h b/src/include/data/bg_cave_tilemap.h new file mode 100644 index 0000000..3872ff2 --- /dev/null +++ b/src/include/data/bg_cave_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_CAVE_TILEMAP_H +#define BG_CAVE_TILEMAP_H + +// Tilemap bg_cave_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_cave_tilemap) +extern const unsigned char bg_cave_tilemap[]; + +#endif diff --git a/src/include/data/bg_cave_tilemap_attr.h b/src/include/data/bg_cave_tilemap_attr.h new file mode 100644 index 0000000..3a87a10 --- /dev/null +++ b/src/include/data/bg_cave_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_CAVE_TILEMAP_ATTR_H +#define BG_CAVE_TILEMAP_ATTR_H + +// Tilemap Attr bg_cave_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_cave_tilemap_attr) +extern const unsigned char bg_cave_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_cave_tileset.h b/src/include/data/bg_cave_tileset.h new file mode 100644 index 0000000..e549138 --- /dev/null +++ b/src/include/data/bg_cave_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_CAVE_TILESET_H +#define BG_CAVE_TILESET_H + +// Tileset: bg_cave_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_cave_tileset) +extern const struct tileset_t bg_cave_tileset; + +#endif diff --git a/src/include/data/bg_endscreen.h b/src/include/data/bg_endscreen.h new file mode 100644 index 0000000..d7efe6a --- /dev/null +++ b/src/include/data/bg_endscreen.h @@ -0,0 +1,11 @@ +#ifndef BG_ENDSCREEN_H +#define BG_ENDSCREEN_H + +// Background: endScreen + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_endscreen) +extern const struct background_t bg_endscreen; + +#endif diff --git a/src/include/data/bg_endscreen_cgb_tileset.h b/src/include/data/bg_endscreen_cgb_tileset.h new file mode 100644 index 0000000..76794f6 --- /dev/null +++ b/src/include/data/bg_endscreen_cgb_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_ENDSCREEN_CGB_TILESET_H +#define BG_ENDSCREEN_CGB_TILESET_H + +// Tileset: bg_endscreen_cgb_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_endscreen_cgb_tileset) +extern const struct tileset_t bg_endscreen_cgb_tileset; + +#endif diff --git a/src/include/data/bg_endscreen_tilemap.h b/src/include/data/bg_endscreen_tilemap.h new file mode 100644 index 0000000..3d4af55 --- /dev/null +++ b/src/include/data/bg_endscreen_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_ENDSCREEN_TILEMAP_H +#define BG_ENDSCREEN_TILEMAP_H + +// Tilemap bg_endscreen_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_endscreen_tilemap) +extern const unsigned char bg_endscreen_tilemap[]; + +#endif diff --git a/src/include/data/bg_endscreen_tilemap_attr.h b/src/include/data/bg_endscreen_tilemap_attr.h new file mode 100644 index 0000000..4db2766 --- /dev/null +++ b/src/include/data/bg_endscreen_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_ENDSCREEN_TILEMAP_ATTR_H +#define BG_ENDSCREEN_TILEMAP_ATTR_H + +// Tilemap Attr bg_endscreen_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_endscreen_tilemap_attr) +extern const unsigned char bg_endscreen_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_endscreen_tileset.h b/src/include/data/bg_endscreen_tileset.h new file mode 100644 index 0000000..1d0bd04 --- /dev/null +++ b/src/include/data/bg_endscreen_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_ENDSCREEN_TILESET_H +#define BG_ENDSCREEN_TILESET_H + +// Tileset: bg_endscreen_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_endscreen_tileset) +extern const struct tileset_t bg_endscreen_tileset; + +#endif diff --git a/src/include/data/bg_fate6housef2.h b/src/include/data/bg_fate6housef2.h new file mode 100644 index 0000000..b1d9a8b --- /dev/null +++ b/src/include/data/bg_fate6housef2.h @@ -0,0 +1,11 @@ +#ifndef BG_FATE6HOUSEF2_H +#define BG_FATE6HOUSEF2_H + +// Background: Fate6Housef2 + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_fate6housef2) +extern const struct background_t bg_fate6housef2; + +#endif diff --git a/src/include/data/bg_fate6housef2_tilemap.h b/src/include/data/bg_fate6housef2_tilemap.h new file mode 100644 index 0000000..aa47aa4 --- /dev/null +++ b/src/include/data/bg_fate6housef2_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_FATE6HOUSEF2_TILEMAP_H +#define BG_FATE6HOUSEF2_TILEMAP_H + +// Tilemap bg_fate6housef2_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_fate6housef2_tilemap) +extern const unsigned char bg_fate6housef2_tilemap[]; + +#endif diff --git a/src/include/data/bg_fate6housef2_tilemap_attr.h b/src/include/data/bg_fate6housef2_tilemap_attr.h new file mode 100644 index 0000000..0bb9e08 --- /dev/null +++ b/src/include/data/bg_fate6housef2_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_FATE6HOUSEF2_TILEMAP_ATTR_H +#define BG_FATE6HOUSEF2_TILEMAP_ATTR_H + +// Tilemap Attr bg_fate6housef2_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_fate6housef2_tilemap_attr) +extern const unsigned char bg_fate6housef2_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_fate6housef2_tileset.h b/src/include/data/bg_fate6housef2_tileset.h new file mode 100644 index 0000000..7a65836 --- /dev/null +++ b/src/include/data/bg_fate6housef2_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_FATE6HOUSEF2_TILESET_H +#define BG_FATE6HOUSEF2_TILESET_H + +// Tileset: bg_fate6housef2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_fate6housef2_tileset) +extern const struct tileset_t bg_fate6housef2_tileset; + +#endif diff --git a/src/include/data/bg_house.h b/src/include/data/bg_house.h new file mode 100644 index 0000000..cad55c1 --- /dev/null +++ b/src/include/data/bg_house.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSE_H +#define BG_HOUSE_H + +// Background: house + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_house) +extern const struct background_t bg_house; + +#endif diff --git a/src/include/data/bg_house_tilemap.h b/src/include/data/bg_house_tilemap.h new file mode 100644 index 0000000..451855e --- /dev/null +++ b/src/include/data/bg_house_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSE_TILEMAP_H +#define BG_HOUSE_TILEMAP_H + +// Tilemap bg_house_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_house_tilemap) +extern const unsigned char bg_house_tilemap[]; + +#endif diff --git a/src/include/data/bg_house_tilemap_attr.h b/src/include/data/bg_house_tilemap_attr.h new file mode 100644 index 0000000..6e1af66 --- /dev/null +++ b/src/include/data/bg_house_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSE_TILEMAP_ATTR_H +#define BG_HOUSE_TILEMAP_ATTR_H + +// Tilemap Attr bg_house_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_house_tilemap_attr) +extern const unsigned char bg_house_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_house_tileset.h b/src/include/data/bg_house_tileset.h new file mode 100644 index 0000000..dfe556b --- /dev/null +++ b/src/include/data/bg_house_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSE_TILESET_H +#define BG_HOUSE_TILESET_H + +// Tileset: bg_house_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_house_tileset) +extern const struct tileset_t bg_house_tileset; + +#endif diff --git a/src/include/data/bg_house_wide.h b/src/include/data/bg_house_wide.h new file mode 100644 index 0000000..89e516d --- /dev/null +++ b/src/include/data/bg_house_wide.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSE_WIDE_H +#define BG_HOUSE_WIDE_H + +// Background: house-wide + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_house_wide) +extern const struct background_t bg_house_wide; + +#endif diff --git a/src/include/data/bg_house_wide_tilemap.h b/src/include/data/bg_house_wide_tilemap.h new file mode 100644 index 0000000..cbee13f --- /dev/null +++ b/src/include/data/bg_house_wide_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSE_WIDE_TILEMAP_H +#define BG_HOUSE_WIDE_TILEMAP_H + +// Tilemap bg_house_wide_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_house_wide_tilemap) +extern const unsigned char bg_house_wide_tilemap[]; + +#endif diff --git a/src/include/data/bg_house_wide_tilemap_attr.h b/src/include/data/bg_house_wide_tilemap_attr.h new file mode 100644 index 0000000..e3fa651 --- /dev/null +++ b/src/include/data/bg_house_wide_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSE_WIDE_TILEMAP_ATTR_H +#define BG_HOUSE_WIDE_TILEMAP_ATTR_H + +// Tilemap Attr bg_house_wide_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_house_wide_tilemap_attr) +extern const unsigned char bg_house_wide_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_house_wide_tileset.h b/src/include/data/bg_house_wide_tileset.h new file mode 100644 index 0000000..525567c --- /dev/null +++ b/src/include/data/bg_house_wide_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSE_WIDE_TILESET_H +#define BG_HOUSE_WIDE_TILESET_H + +// Tileset: bg_house_wide_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_house_wide_tileset) +extern const struct tileset_t bg_house_wide_tileset; + +#endif diff --git a/src/include/data/bg_housef2.h b/src/include/data/bg_housef2.h new file mode 100644 index 0000000..edaf291 --- /dev/null +++ b/src/include/data/bg_housef2.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSEF2_H +#define BG_HOUSEF2_H + +// Background: Housef2 + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_housef2) +extern const struct background_t bg_housef2; + +#endif diff --git a/src/include/data/bg_housef2_tilemap.h b/src/include/data/bg_housef2_tilemap.h new file mode 100644 index 0000000..47bdb21 --- /dev/null +++ b/src/include/data/bg_housef2_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSEF2_TILEMAP_H +#define BG_HOUSEF2_TILEMAP_H + +// Tilemap bg_housef2_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_housef2_tilemap) +extern const unsigned char bg_housef2_tilemap[]; + +#endif diff --git a/src/include/data/bg_housef2_tilemap_attr.h b/src/include/data/bg_housef2_tilemap_attr.h new file mode 100644 index 0000000..64167f5 --- /dev/null +++ b/src/include/data/bg_housef2_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSEF2_TILEMAP_ATTR_H +#define BG_HOUSEF2_TILEMAP_ATTR_H + +// Tilemap Attr bg_housef2_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_housef2_tilemap_attr) +extern const unsigned char bg_housef2_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_housef2_tileset.h b/src/include/data/bg_housef2_tileset.h new file mode 100644 index 0000000..9483e75 --- /dev/null +++ b/src/include/data/bg_housef2_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_HOUSEF2_TILESET_H +#define BG_HOUSEF2_TILESET_H + +// Tileset: bg_housef2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_housef2_tileset) +extern const struct tileset_t bg_housef2_tileset; + +#endif diff --git a/src/include/data/bg_lab1.h b/src/include/data/bg_lab1.h new file mode 100644 index 0000000..7bc978a --- /dev/null +++ b/src/include/data/bg_lab1.h @@ -0,0 +1,11 @@ +#ifndef BG_LAB1_H +#define BG_LAB1_H + +// Background: Lab1 + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_lab1) +extern const struct background_t bg_lab1; + +#endif diff --git a/src/include/data/bg_lab1_tilemap.h b/src/include/data/bg_lab1_tilemap.h new file mode 100644 index 0000000..8a263e3 --- /dev/null +++ b/src/include/data/bg_lab1_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_LAB1_TILEMAP_H +#define BG_LAB1_TILEMAP_H + +// Tilemap bg_lab1_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_lab1_tilemap) +extern const unsigned char bg_lab1_tilemap[]; + +#endif diff --git a/src/include/data/bg_lab1_tilemap_attr.h b/src/include/data/bg_lab1_tilemap_attr.h new file mode 100644 index 0000000..7f3ac41 --- /dev/null +++ b/src/include/data/bg_lab1_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_LAB1_TILEMAP_ATTR_H +#define BG_LAB1_TILEMAP_ATTR_H + +// Tilemap Attr bg_lab1_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_lab1_tilemap_attr) +extern const unsigned char bg_lab1_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_lab1_tileset.h b/src/include/data/bg_lab1_tileset.h new file mode 100644 index 0000000..7712bd5 --- /dev/null +++ b/src/include/data/bg_lab1_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_LAB1_TILESET_H +#define BG_LAB1_TILESET_H + +// Tileset: bg_lab1_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_lab1_tileset) +extern const struct tileset_t bg_lab1_tileset; + +#endif diff --git a/src/include/data/bg_logoscreen.h b/src/include/data/bg_logoscreen.h new file mode 100644 index 0000000..05d5a41 --- /dev/null +++ b/src/include/data/bg_logoscreen.h @@ -0,0 +1,11 @@ +#ifndef BG_LOGOSCREEN_H +#define BG_LOGOSCREEN_H + +// Background: LogoScreen + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_logoscreen) +extern const struct background_t bg_logoscreen; + +#endif diff --git a/src/include/data/bg_logoscreen_tilemap.h b/src/include/data/bg_logoscreen_tilemap.h new file mode 100644 index 0000000..b20accd --- /dev/null +++ b/src/include/data/bg_logoscreen_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_LOGOSCREEN_TILEMAP_H +#define BG_LOGOSCREEN_TILEMAP_H + +// Tilemap bg_logoscreen_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_logoscreen_tilemap) +extern const unsigned char bg_logoscreen_tilemap[]; + +#endif diff --git a/src/include/data/bg_logoscreen_tilemap_attr.h b/src/include/data/bg_logoscreen_tilemap_attr.h new file mode 100644 index 0000000..a177f81 --- /dev/null +++ b/src/include/data/bg_logoscreen_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_LOGOSCREEN_TILEMAP_ATTR_H +#define BG_LOGOSCREEN_TILEMAP_ATTR_H + +// Tilemap Attr bg_logoscreen_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_logoscreen_tilemap_attr) +extern const unsigned char bg_logoscreen_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_logoscreen_tileset.h b/src/include/data/bg_logoscreen_tileset.h new file mode 100644 index 0000000..7ef4346 --- /dev/null +++ b/src/include/data/bg_logoscreen_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_LOGOSCREEN_TILESET_H +#define BG_LOGOSCREEN_TILESET_H + +// Tileset: bg_logoscreen_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_logoscreen_tileset) +extern const struct tileset_t bg_logoscreen_tileset; + +#endif diff --git a/src/include/data/bg_outside.h b/src/include/data/bg_outside.h new file mode 100644 index 0000000..1b1b677 --- /dev/null +++ b/src/include/data/bg_outside.h @@ -0,0 +1,11 @@ +#ifndef BG_OUTSIDE_H +#define BG_OUTSIDE_H + +// Background: outside + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_outside) +extern const struct background_t bg_outside; + +#endif diff --git a/src/include/data/bg_outside_cgb_tileset.h b/src/include/data/bg_outside_cgb_tileset.h new file mode 100644 index 0000000..bc58347 --- /dev/null +++ b/src/include/data/bg_outside_cgb_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_OUTSIDE_CGB_TILESET_H +#define BG_OUTSIDE_CGB_TILESET_H + +// Tileset: bg_outside_cgb_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_outside_cgb_tileset) +extern const struct tileset_t bg_outside_cgb_tileset; + +#endif diff --git a/src/include/data/bg_outside_tilemap.h b/src/include/data/bg_outside_tilemap.h new file mode 100644 index 0000000..f2494a3 --- /dev/null +++ b/src/include/data/bg_outside_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_OUTSIDE_TILEMAP_H +#define BG_OUTSIDE_TILEMAP_H + +// Tilemap bg_outside_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_outside_tilemap) +extern const unsigned char bg_outside_tilemap[]; + +#endif diff --git a/src/include/data/bg_outside_tilemap_attr.h b/src/include/data/bg_outside_tilemap_attr.h new file mode 100644 index 0000000..18233a3 --- /dev/null +++ b/src/include/data/bg_outside_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_OUTSIDE_TILEMAP_ATTR_H +#define BG_OUTSIDE_TILEMAP_ATTR_H + +// Tilemap Attr bg_outside_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_outside_tilemap_attr) +extern const unsigned char bg_outside_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_outside_tileset.h b/src/include/data/bg_outside_tileset.h new file mode 100644 index 0000000..707d4ce --- /dev/null +++ b/src/include/data/bg_outside_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_OUTSIDE_TILESET_H +#define BG_OUTSIDE_TILESET_H + +// Tileset: bg_outside_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_outside_tileset) +extern const struct tileset_t bg_outside_tileset; + +#endif diff --git a/src/include/data/bg_overworld_test_1.h b/src/include/data/bg_overworld_test_1.h new file mode 100644 index 0000000..19a47b1 --- /dev/null +++ b/src/include/data/bg_overworld_test_1.h @@ -0,0 +1,11 @@ +#ifndef BG_OVERWORLD_TEST_1_H +#define BG_OVERWORLD_TEST_1_H + +// Background: Overworld_-_Test_1 + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_overworld_test_1) +extern const struct background_t bg_overworld_test_1; + +#endif diff --git a/src/include/data/bg_overworld_test_1_tilemap.h b/src/include/data/bg_overworld_test_1_tilemap.h new file mode 100644 index 0000000..b56f7e4 --- /dev/null +++ b/src/include/data/bg_overworld_test_1_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_OVERWORLD_TEST_1_TILEMAP_H +#define BG_OVERWORLD_TEST_1_TILEMAP_H + +// Tilemap bg_overworld_test_1_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_overworld_test_1_tilemap) +extern const unsigned char bg_overworld_test_1_tilemap[]; + +#endif diff --git a/src/include/data/bg_overworld_test_1_tilemap_attr.h b/src/include/data/bg_overworld_test_1_tilemap_attr.h new file mode 100644 index 0000000..c5b2127 --- /dev/null +++ b/src/include/data/bg_overworld_test_1_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_OVERWORLD_TEST_1_TILEMAP_ATTR_H +#define BG_OVERWORLD_TEST_1_TILEMAP_ATTR_H + +// Tilemap Attr bg_overworld_test_1_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_overworld_test_1_tilemap_attr) +extern const unsigned char bg_overworld_test_1_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_overworld_test_1_tileset.h b/src/include/data/bg_overworld_test_1_tileset.h new file mode 100644 index 0000000..03ad84a --- /dev/null +++ b/src/include/data/bg_overworld_test_1_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_OVERWORLD_TEST_1_TILESET_H +#define BG_OVERWORLD_TEST_1_TILESET_H + +// Tileset: bg_overworld_test_1_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_overworld_test_1_tileset) +extern const struct tileset_t bg_overworld_test_1_tileset; + +#endif diff --git a/src/include/data/bg_questscreen.h b/src/include/data/bg_questscreen.h new file mode 100644 index 0000000..b17d275 --- /dev/null +++ b/src/include/data/bg_questscreen.h @@ -0,0 +1,11 @@ +#ifndef BG_QUESTSCREEN_H +#define BG_QUESTSCREEN_H + +// Background: QuestScreen + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_questscreen) +extern const struct background_t bg_questscreen; + +#endif diff --git a/src/include/data/bg_questscreen_tilemap.h b/src/include/data/bg_questscreen_tilemap.h new file mode 100644 index 0000000..b44ad11 --- /dev/null +++ b/src/include/data/bg_questscreen_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_QUESTSCREEN_TILEMAP_H +#define BG_QUESTSCREEN_TILEMAP_H + +// Tilemap bg_questscreen_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_questscreen_tilemap) +extern const unsigned char bg_questscreen_tilemap[]; + +#endif diff --git a/src/include/data/bg_questscreen_tilemap_attr.h b/src/include/data/bg_questscreen_tilemap_attr.h new file mode 100644 index 0000000..37aa77f --- /dev/null +++ b/src/include/data/bg_questscreen_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_QUESTSCREEN_TILEMAP_ATTR_H +#define BG_QUESTSCREEN_TILEMAP_ATTR_H + +// Tilemap Attr bg_questscreen_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_questscreen_tilemap_attr) +extern const unsigned char bg_questscreen_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_questscreen_tileset.h b/src/include/data/bg_questscreen_tileset.h new file mode 100644 index 0000000..c878c69 --- /dev/null +++ b/src/include/data/bg_questscreen_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_QUESTSCREEN_TILESET_H +#define BG_QUESTSCREEN_TILESET_H + +// Tileset: bg_questscreen_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_questscreen_tileset) +extern const struct tileset_t bg_questscreen_tileset; + +#endif diff --git a/src/include/data/bg_slighhousef2.h b/src/include/data/bg_slighhousef2.h new file mode 100644 index 0000000..73734d4 --- /dev/null +++ b/src/include/data/bg_slighhousef2.h @@ -0,0 +1,11 @@ +#ifndef BG_SLIGHHOUSEF2_H +#define BG_SLIGHHOUSEF2_H + +// Background: SlighHousef2 + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_slighhousef2) +extern const struct background_t bg_slighhousef2; + +#endif diff --git a/src/include/data/bg_slighhousef2_tilemap.h b/src/include/data/bg_slighhousef2_tilemap.h new file mode 100644 index 0000000..2c07817 --- /dev/null +++ b/src/include/data/bg_slighhousef2_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_SLIGHHOUSEF2_TILEMAP_H +#define BG_SLIGHHOUSEF2_TILEMAP_H + +// Tilemap bg_slighhousef2_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_slighhousef2_tilemap) +extern const unsigned char bg_slighhousef2_tilemap[]; + +#endif diff --git a/src/include/data/bg_slighhousef2_tilemap_attr.h b/src/include/data/bg_slighhousef2_tilemap_attr.h new file mode 100644 index 0000000..1e5eaad --- /dev/null +++ b/src/include/data/bg_slighhousef2_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_SLIGHHOUSEF2_TILEMAP_ATTR_H +#define BG_SLIGHHOUSEF2_TILEMAP_ATTR_H + +// Tilemap Attr bg_slighhousef2_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_slighhousef2_tilemap_attr) +extern const unsigned char bg_slighhousef2_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_slighhousef2_tileset.h b/src/include/data/bg_slighhousef2_tileset.h new file mode 100644 index 0000000..25f7e17 --- /dev/null +++ b/src/include/data/bg_slighhousef2_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_SLIGHHOUSEF2_TILESET_H +#define BG_SLIGHHOUSEF2_TILESET_H + +// Tileset: bg_slighhousef2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_slighhousef2_tileset) +extern const struct tileset_t bg_slighhousef2_tileset; + +#endif diff --git a/src/include/data/bg_titlescreen.h b/src/include/data/bg_titlescreen.h new file mode 100644 index 0000000..0792ebd --- /dev/null +++ b/src/include/data/bg_titlescreen.h @@ -0,0 +1,11 @@ +#ifndef BG_TITLESCREEN_H +#define BG_TITLESCREEN_H + +// Background: titlescreen + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_titlescreen) +extern const struct background_t bg_titlescreen; + +#endif diff --git a/src/include/data/bg_titlescreen_tilemap.h b/src/include/data/bg_titlescreen_tilemap.h new file mode 100644 index 0000000..bf24487 --- /dev/null +++ b/src/include/data/bg_titlescreen_tilemap.h @@ -0,0 +1,11 @@ +#ifndef BG_TITLESCREEN_TILEMAP_H +#define BG_TITLESCREEN_TILEMAP_H + +// Tilemap bg_titlescreen_tilemap + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_titlescreen_tilemap) +extern const unsigned char bg_titlescreen_tilemap[]; + +#endif diff --git a/src/include/data/bg_titlescreen_tilemap_attr.h b/src/include/data/bg_titlescreen_tilemap_attr.h new file mode 100644 index 0000000..70b06b6 --- /dev/null +++ b/src/include/data/bg_titlescreen_tilemap_attr.h @@ -0,0 +1,11 @@ +#ifndef BG_TITLESCREEN_TILEMAP_ATTR_H +#define BG_TITLESCREEN_TILEMAP_ATTR_H + +// Tilemap Attr bg_titlescreen_tilemap_attr + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_titlescreen_tilemap_attr) +extern const unsigned char bg_titlescreen_tilemap_attr[]; + +#endif diff --git a/src/include/data/bg_titlescreen_tileset.h b/src/include/data/bg_titlescreen_tileset.h new file mode 100644 index 0000000..aaacb2c --- /dev/null +++ b/src/include/data/bg_titlescreen_tileset.h @@ -0,0 +1,11 @@ +#ifndef BG_TITLESCREEN_TILESET_H +#define BG_TITLESCREEN_TILESET_H + +// Tileset: bg_titlescreen_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(bg_titlescreen_tileset) +extern const struct tileset_t bg_titlescreen_tileset; + +#endif diff --git a/src/include/data/border.h b/src/include/data/border.h new file mode 100644 index 0000000..9dd6543 --- /dev/null +++ b/src/include/data/border.h @@ -0,0 +1,16 @@ +#ifndef __BORDER_H_INCLUDE +#define __BORDER_H_INCLUDE + +BANKREF_EXTERN(SGB_border_chr) +BANKREF_EXTERN(SGB_border_map) +BANKREF_EXTERN(SGB_border_pal) + +SIZEREF_EXTERN(SGB_border_chr) +SIZEREF_EXTERN(SGB_border_map) +SIZEREF_EXTERN(SGB_border_pal) + +extern const unsigned char SGB_border_chr[]; +extern const unsigned char SGB_border_map[]; +extern const unsigned char SGB_border_pal[]; + +#endif \ No newline at end of file diff --git a/src/include/data/cursor_image.h b/src/include/data/cursor_image.h new file mode 100644 index 0000000..e5dbd73 --- /dev/null +++ b/src/include/data/cursor_image.h @@ -0,0 +1,11 @@ +#ifndef CURSOR_IMAGE_H +#define CURSOR_IMAGE_H + +// Cursor + +#include "gbs_types.h" + +BANKREF_EXTERN(cursor_image) +extern const unsigned char cursor_image[]; + +#endif diff --git a/src/include/data/data_bootstrap.h b/src/include/data/data_bootstrap.h new file mode 100644 index 0000000..19fb6ce --- /dev/null +++ b/src/include/data/data_bootstrap.h @@ -0,0 +1,18 @@ +#ifndef DATA_PTRS_H +#define DATA_PTRS_H + +#include "bankdata.h" +#include "gbs_types.h" + +extern const INT16 start_scene_x; +extern const INT16 start_scene_y; +extern const direction_e start_scene_dir; +extern const far_ptr_t start_scene; +extern const UBYTE start_player_move_speed; +extern const UBYTE start_player_anim_tick; + +extern const far_ptr_t ui_fonts[]; + +void bootstrap_init(void) BANKED; + +#endif diff --git a/src/include/data/emote_love.h b/src/include/data/emote_love.h new file mode 100644 index 0000000..fc5f7c9 --- /dev/null +++ b/src/include/data/emote_love.h @@ -0,0 +1,11 @@ +#ifndef EMOTE_LOVE_H +#define EMOTE_LOVE_H + +// Emote love + +#include "gbs_types.h" + +BANKREF_EXTERN(emote_love) +extern const unsigned char emote_love[]; + +#endif diff --git a/src/include/data/font_gbs_mono.h b/src/include/data/font_gbs_mono.h new file mode 100644 index 0000000..4590ec2 --- /dev/null +++ b/src/include/data/font_gbs_mono.h @@ -0,0 +1,11 @@ +#ifndef FONT_GBS_MONO_H +#define FONT_GBS_MONO_H + +// Font gbs-mono.png + +#include "gbs_types.h" + +BANKREF_EXTERN(font_gbs_mono) +extern const unsigned char font_gbs_mono[]; + +#endif diff --git a/src/include/data/frame_image.h b/src/include/data/frame_image.h new file mode 100644 index 0000000..6b5afe6 --- /dev/null +++ b/src/include/data/frame_image.h @@ -0,0 +1,11 @@ +#ifndef FRAME_IMAGE_H +#define FRAME_IMAGE_H + +// Frame + +#include "gbs_types.h" + +BANKREF_EXTERN(frame_image) +extern const unsigned char frame_image[]; + +#endif diff --git a/src/include/data/game_globals.h b/src/include/data/game_globals.h new file mode 100644 index 0000000..b04747f --- /dev/null +++ b/src/include/data/game_globals.h @@ -0,0 +1,17 @@ +#ifndef GAME_GLOBALS_H +#define GAME_GLOBALS_H + +#define VAR_QUEST1 0 +#define VAR_QUEST2_0 1 +#define VAR_QUEST3_0 2 +#define VAR_QUEST4_0 3 +#define VAR_QUEST5 4 +#define VAR_EEVEECHAT_0 5 +#define VAR_KUMACHAT 6 +#define VAR_KUMATEXTFIX 7 +#define VAR_S0A0_LOCAL_0 8 +#define VAR_S0T4_POSTKEYGET 9 +#define VAR_S3T2_STARTTEXT 10 +#define MAX_GLOBAL_VARS 11 + +#endif diff --git a/src/include/data/game_globals.i b/src/include/data/game_globals.i new file mode 100644 index 0000000..3c21cc4 --- /dev/null +++ b/src/include/data/game_globals.i @@ -0,0 +1,13 @@ +VAR_QUEST1 = 0 +VAR_QUEST2_0 = 1 +VAR_QUEST3_0 = 2 +VAR_QUEST4_0 = 3 +VAR_QUEST5 = 4 +VAR_EEVEECHAT_0 = 5 +VAR_KUMACHAT = 6 +VAR_KUMATEXTFIX = 7 +VAR_S0A0_LOCAL_0 = 8 +VAR_S0T4_POSTKEYGET = 9 +VAR_S3T2_STARTTEXT = 10 +MAX_GLOBAL_VARS = 11 +STATE_DEFAULT = 0 diff --git a/src/include/data/music_data.h b/src/include/data/music_data.h new file mode 100644 index 0000000..2ee2661 --- /dev/null +++ b/src/include/data/music_data.h @@ -0,0 +1,13 @@ +#ifndef MUSIC_DATA_H +#define MUSIC_DATA_H + +extern const void __bank_song_rulz_lightmood_Data; +extern const void song_rulz_lightmood_Data; +extern const void __bank_song_rulz_outside_0_Data; +extern const void song_rulz_outside_0_Data; +extern const void __bank_song_rulz_spaceemergency_0_Data; +extern const void song_rulz_spaceemergency_0_Data; +extern const void __bank_song_rulz_undergroundcave_Data; +extern const void song_rulz_undergroundcave_Data; + +#endif diff --git a/src/include/data/palette_0.h b/src/include/data/palette_0.h new file mode 100644 index 0000000..f14831d --- /dev/null +++ b/src/include/data/palette_0.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_0_H +#define PALETTE_0_H + +// Palette: 0 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_0) +extern const struct palette_t palette_0; + +#endif diff --git a/src/include/data/palette_1.h b/src/include/data/palette_1.h new file mode 100644 index 0000000..142d3ff --- /dev/null +++ b/src/include/data/palette_1.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_1_H +#define PALETTE_1_H + +// Palette: 1 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_1) +extern const struct palette_t palette_1; + +#endif diff --git a/src/include/data/palette_10.h b/src/include/data/palette_10.h new file mode 100644 index 0000000..11eaae3 --- /dev/null +++ b/src/include/data/palette_10.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_10_H +#define PALETTE_10_H + +// Palette: 10 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_10) +extern const struct palette_t palette_10; + +#endif diff --git a/src/include/data/palette_11.h b/src/include/data/palette_11.h new file mode 100644 index 0000000..46c44ea --- /dev/null +++ b/src/include/data/palette_11.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_11_H +#define PALETTE_11_H + +// Palette: 11 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_11) +extern const struct palette_t palette_11; + +#endif diff --git a/src/include/data/palette_12.h b/src/include/data/palette_12.h new file mode 100644 index 0000000..1f5bad1 --- /dev/null +++ b/src/include/data/palette_12.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_12_H +#define PALETTE_12_H + +// Palette: 12 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_12) +extern const struct palette_t palette_12; + +#endif diff --git a/src/include/data/palette_13.h b/src/include/data/palette_13.h new file mode 100644 index 0000000..30090d0 --- /dev/null +++ b/src/include/data/palette_13.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_13_H +#define PALETTE_13_H + +// Palette: 13 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_13) +extern const struct palette_t palette_13; + +#endif diff --git a/src/include/data/palette_2.h b/src/include/data/palette_2.h new file mode 100644 index 0000000..99b00a6 --- /dev/null +++ b/src/include/data/palette_2.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_2_H +#define PALETTE_2_H + +// Palette: 2 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_2) +extern const struct palette_t palette_2; + +#endif diff --git a/src/include/data/palette_3.h b/src/include/data/palette_3.h new file mode 100644 index 0000000..38dceb0 --- /dev/null +++ b/src/include/data/palette_3.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_3_H +#define PALETTE_3_H + +// Palette: 3 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_3) +extern const struct palette_t palette_3; + +#endif diff --git a/src/include/data/palette_4.h b/src/include/data/palette_4.h new file mode 100644 index 0000000..92ce44a --- /dev/null +++ b/src/include/data/palette_4.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_4_H +#define PALETTE_4_H + +// Palette: 4 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_4) +extern const struct palette_t palette_4; + +#endif diff --git a/src/include/data/palette_5.h b/src/include/data/palette_5.h new file mode 100644 index 0000000..81b5ed7 --- /dev/null +++ b/src/include/data/palette_5.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_5_H +#define PALETTE_5_H + +// Palette: 5 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_5) +extern const struct palette_t palette_5; + +#endif diff --git a/src/include/data/palette_6.h b/src/include/data/palette_6.h new file mode 100644 index 0000000..0025d04 --- /dev/null +++ b/src/include/data/palette_6.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_6_H +#define PALETTE_6_H + +// Palette: 6 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_6) +extern const struct palette_t palette_6; + +#endif diff --git a/src/include/data/palette_7.h b/src/include/data/palette_7.h new file mode 100644 index 0000000..408ccde --- /dev/null +++ b/src/include/data/palette_7.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_7_H +#define PALETTE_7_H + +// Palette: 7 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_7) +extern const struct palette_t palette_7; + +#endif diff --git a/src/include/data/palette_8.h b/src/include/data/palette_8.h new file mode 100644 index 0000000..8df7dc7 --- /dev/null +++ b/src/include/data/palette_8.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_8_H +#define PALETTE_8_H + +// Palette: 8 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_8) +extern const struct palette_t palette_8; + +#endif diff --git a/src/include/data/palette_9.h b/src/include/data/palette_9.h new file mode 100644 index 0000000..41ec8b1 --- /dev/null +++ b/src/include/data/palette_9.h @@ -0,0 +1,11 @@ +#ifndef PALETTE_9_H +#define PALETTE_9_H + +// Palette: 9 + +#include "gbs_types.h" + +BANKREF_EXTERN(palette_9) +extern const struct palette_t palette_9; + +#endif diff --git a/src/include/data/scene_1.h b/src/include/data/scene_1.h new file mode 100644 index 0000000..d8d5f56 --- /dev/null +++ b/src/include/data/scene_1.h @@ -0,0 +1,11 @@ +#ifndef SCENE_1_H +#define SCENE_1_H + +// Scene: Overworld + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_1) +extern const struct scene_t scene_1; + +#endif diff --git a/src/include/data/scene_10.h b/src/include/data/scene_10.h new file mode 100644 index 0000000..cafa2da --- /dev/null +++ b/src/include/data/scene_10.h @@ -0,0 +1,11 @@ +#ifndef SCENE_10_H +#define SCENE_10_H + +// Scene: NPCJail + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_10) +extern const struct scene_t scene_10; + +#endif diff --git a/src/include/data/scene_10_collisions.h b/src/include/data/scene_10_collisions.h new file mode 100644 index 0000000..e39bb01 --- /dev/null +++ b/src/include/data/scene_10_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_10_COLLISIONS_H +#define SCENE_10_COLLISIONS_H + +// Scene: NPCJail +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_10_collisions) +extern const unsigned char scene_10_collisions[]; + +#endif diff --git a/src/include/data/scene_10_init.h b/src/include/data/scene_10_init.h new file mode 100644 index 0000000..c977318 --- /dev/null +++ b/src/include/data/scene_10_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_10_INIT_H +#define SCENE_10_INIT_H + +// Script scene_10_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_10_init) +extern const unsigned char scene_10_init[]; + +#endif diff --git a/src/include/data/scene_11.h b/src/include/data/scene_11.h new file mode 100644 index 0000000..1117143 --- /dev/null +++ b/src/include/data/scene_11.h @@ -0,0 +1,11 @@ +#ifndef SCENE_11_H +#define SCENE_11_H + +// Scene: SlighHousef2 + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_11) +extern const struct scene_t scene_11; + +#endif diff --git a/src/include/data/scene_11_collisions.h b/src/include/data/scene_11_collisions.h new file mode 100644 index 0000000..0ae487b --- /dev/null +++ b/src/include/data/scene_11_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_11_COLLISIONS_H +#define SCENE_11_COLLISIONS_H + +// Scene: SlighHousef2 +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_11_collisions) +extern const unsigned char scene_11_collisions[]; + +#endif diff --git a/src/include/data/scene_11_init.h b/src/include/data/scene_11_init.h new file mode 100644 index 0000000..9c572ac --- /dev/null +++ b/src/include/data/scene_11_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_11_INIT_H +#define SCENE_11_INIT_H + +// Script scene_11_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_11_init) +extern const unsigned char scene_11_init[]; + +#endif diff --git a/src/include/data/scene_11_triggers.h b/src/include/data/scene_11_triggers.h new file mode 100644 index 0000000..08aa111 --- /dev/null +++ b/src/include/data/scene_11_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_11_TRIGGERS_H +#define SCENE_11_TRIGGERS_H + +// Scene: SlighHousef2 +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_11_triggers) +extern const struct trigger_t scene_11_triggers[]; + +#endif diff --git a/src/include/data/scene_12.h b/src/include/data/scene_12.h new file mode 100644 index 0000000..7f37549 --- /dev/null +++ b/src/include/data/scene_12.h @@ -0,0 +1,11 @@ +#ifndef SCENE_12_H +#define SCENE_12_H + +// Scene: NyaaLogo + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_12) +extern const struct scene_t scene_12; + +#endif diff --git a/src/include/data/scene_12_collisions.h b/src/include/data/scene_12_collisions.h new file mode 100644 index 0000000..3cd3c7e --- /dev/null +++ b/src/include/data/scene_12_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_12_COLLISIONS_H +#define SCENE_12_COLLISIONS_H + +// Scene: NyaaLogo +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_12_collisions) +extern const unsigned char scene_12_collisions[]; + +#endif diff --git a/src/include/data/scene_12_init.h b/src/include/data/scene_12_init.h new file mode 100644 index 0000000..e6f7664 --- /dev/null +++ b/src/include/data/scene_12_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_12_INIT_H +#define SCENE_12_INIT_H + +// Script scene_12_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_12_init) +extern const unsigned char scene_12_init[]; + +#endif diff --git a/src/include/data/scene_13.h b/src/include/data/scene_13.h new file mode 100644 index 0000000..92860af --- /dev/null +++ b/src/include/data/scene_13.h @@ -0,0 +1,11 @@ +#ifndef SCENE_13_H +#define SCENE_13_H + +// Scene: StartScreen + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_13) +extern const struct scene_t scene_13; + +#endif diff --git a/src/include/data/scene_13_collisions.h b/src/include/data/scene_13_collisions.h new file mode 100644 index 0000000..703111f --- /dev/null +++ b/src/include/data/scene_13_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_13_COLLISIONS_H +#define SCENE_13_COLLISIONS_H + +// Scene: StartScreen +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_13_collisions) +extern const unsigned char scene_13_collisions[]; + +#endif diff --git a/src/include/data/scene_13_init.h b/src/include/data/scene_13_init.h new file mode 100644 index 0000000..17ee80e --- /dev/null +++ b/src/include/data/scene_13_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_13_INIT_H +#define SCENE_13_INIT_H + +// Script scene_13_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_13_init) +extern const unsigned char scene_13_init[]; + +#endif diff --git a/src/include/data/scene_14.h b/src/include/data/scene_14.h new file mode 100644 index 0000000..5e15f82 --- /dev/null +++ b/src/include/data/scene_14.h @@ -0,0 +1,11 @@ +#ifndef SCENE_14_H +#define SCENE_14_H + +// Scene: MidnightClubHousef2 + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_14) +extern const struct scene_t scene_14; + +#endif diff --git a/src/include/data/scene_14_actors.h b/src/include/data/scene_14_actors.h new file mode 100644 index 0000000..ee34d7f --- /dev/null +++ b/src/include/data/scene_14_actors.h @@ -0,0 +1,12 @@ +#ifndef SCENE_14_ACTORS_H +#define SCENE_14_ACTORS_H + +// Scene: MidnightClubHousef2 +// Actors + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_14_actors) +extern const struct actor_t scene_14_actors[]; + +#endif diff --git a/src/include/data/scene_14_collisions.h b/src/include/data/scene_14_collisions.h new file mode 100644 index 0000000..acf7edd --- /dev/null +++ b/src/include/data/scene_14_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_14_COLLISIONS_H +#define SCENE_14_COLLISIONS_H + +// Scene: MidnightClubHousef2 +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_14_collisions) +extern const unsigned char scene_14_collisions[]; + +#endif diff --git a/src/include/data/scene_14_init.h b/src/include/data/scene_14_init.h new file mode 100644 index 0000000..537894c --- /dev/null +++ b/src/include/data/scene_14_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_14_INIT_H +#define SCENE_14_INIT_H + +// Script scene_14_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_14_init) +extern const unsigned char scene_14_init[]; + +#endif diff --git a/src/include/data/scene_14_sprites.h b/src/include/data/scene_14_sprites.h new file mode 100644 index 0000000..67f06e8 --- /dev/null +++ b/src/include/data/scene_14_sprites.h @@ -0,0 +1,12 @@ +#ifndef SCENE_14_SPRITES_H +#define SCENE_14_SPRITES_H + +// Scene: MidnightClubHousef2 +// Sprites + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_14_sprites) +extern const far_ptr_t scene_14_sprites[]; + +#endif diff --git a/src/include/data/scene_14_triggers.h b/src/include/data/scene_14_triggers.h new file mode 100644 index 0000000..05205fd --- /dev/null +++ b/src/include/data/scene_14_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_14_TRIGGERS_H +#define SCENE_14_TRIGGERS_H + +// Scene: MidnightClubHousef2 +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_14_triggers) +extern const struct trigger_t scene_14_triggers[]; + +#endif diff --git a/src/include/data/scene_15.h b/src/include/data/scene_15.h new file mode 100644 index 0000000..cb72a44 --- /dev/null +++ b/src/include/data/scene_15.h @@ -0,0 +1,11 @@ +#ifndef SCENE_15_H +#define SCENE_15_H + +// Scene: Quest Menu + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_15) +extern const struct scene_t scene_15; + +#endif diff --git a/src/include/data/scene_15_actors.h b/src/include/data/scene_15_actors.h new file mode 100644 index 0000000..7e4b8f6 --- /dev/null +++ b/src/include/data/scene_15_actors.h @@ -0,0 +1,12 @@ +#ifndef SCENE_15_ACTORS_H +#define SCENE_15_ACTORS_H + +// Scene: Quest Menu +// Actors + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_15_actors) +extern const struct actor_t scene_15_actors[]; + +#endif diff --git a/src/include/data/scene_15_collisions.h b/src/include/data/scene_15_collisions.h new file mode 100644 index 0000000..2ed1c61 --- /dev/null +++ b/src/include/data/scene_15_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_15_COLLISIONS_H +#define SCENE_15_COLLISIONS_H + +// Scene: Quest Menu +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_15_collisions) +extern const unsigned char scene_15_collisions[]; + +#endif diff --git a/src/include/data/scene_15_init.h b/src/include/data/scene_15_init.h new file mode 100644 index 0000000..617eea2 --- /dev/null +++ b/src/include/data/scene_15_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_15_INIT_H +#define SCENE_15_INIT_H + +// Script scene_15_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_15_init) +extern const unsigned char scene_15_init[]; + +#endif diff --git a/src/include/data/scene_15_sprites.h b/src/include/data/scene_15_sprites.h new file mode 100644 index 0000000..d64ef6f --- /dev/null +++ b/src/include/data/scene_15_sprites.h @@ -0,0 +1,12 @@ +#ifndef SCENE_15_SPRITES_H +#define SCENE_15_SPRITES_H + +// Scene: Quest Menu +// Sprites + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_15_sprites) +extern const far_ptr_t scene_15_sprites[]; + +#endif diff --git a/src/include/data/scene_16.h b/src/include/data/scene_16.h new file mode 100644 index 0000000..74e7deb --- /dev/null +++ b/src/include/data/scene_16.h @@ -0,0 +1,11 @@ +#ifndef SCENE_16_H +#define SCENE_16_H + +// Scene: EndScreen + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_16) +extern const struct scene_t scene_16; + +#endif diff --git a/src/include/data/scene_16_collisions.h b/src/include/data/scene_16_collisions.h new file mode 100644 index 0000000..6b1bb74 --- /dev/null +++ b/src/include/data/scene_16_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_16_COLLISIONS_H +#define SCENE_16_COLLISIONS_H + +// Scene: EndScreen +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_16_collisions) +extern const unsigned char scene_16_collisions[]; + +#endif diff --git a/src/include/data/scene_16_init.h b/src/include/data/scene_16_init.h new file mode 100644 index 0000000..d44ad71 --- /dev/null +++ b/src/include/data/scene_16_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_16_INIT_H +#define SCENE_16_INIT_H + +// Script scene_16_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_16_init) +extern const unsigned char scene_16_init[]; + +#endif diff --git a/src/include/data/scene_17.h b/src/include/data/scene_17.h new file mode 100644 index 0000000..47d80a0 --- /dev/null +++ b/src/include/data/scene_17.h @@ -0,0 +1,11 @@ +#ifndef SCENE_17_H +#define SCENE_17_H + +// Scene: Field + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_17) +extern const struct scene_t scene_17; + +#endif diff --git a/src/include/data/scene_17_actors.h b/src/include/data/scene_17_actors.h new file mode 100644 index 0000000..f9f6050 --- /dev/null +++ b/src/include/data/scene_17_actors.h @@ -0,0 +1,12 @@ +#ifndef SCENE_17_ACTORS_H +#define SCENE_17_ACTORS_H + +// Scene: Field +// Actors + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_17_actors) +extern const struct actor_t scene_17_actors[]; + +#endif diff --git a/src/include/data/scene_17_collisions.h b/src/include/data/scene_17_collisions.h new file mode 100644 index 0000000..d125394 --- /dev/null +++ b/src/include/data/scene_17_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_17_COLLISIONS_H +#define SCENE_17_COLLISIONS_H + +// Scene: Field +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_17_collisions) +extern const unsigned char scene_17_collisions[]; + +#endif diff --git a/src/include/data/scene_17_init.h b/src/include/data/scene_17_init.h new file mode 100644 index 0000000..f588d71 --- /dev/null +++ b/src/include/data/scene_17_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_17_INIT_H +#define SCENE_17_INIT_H + +// Script scene_17_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_17_init) +extern const unsigned char scene_17_init[]; + +#endif diff --git a/src/include/data/scene_17_sprites.h b/src/include/data/scene_17_sprites.h new file mode 100644 index 0000000..e709711 --- /dev/null +++ b/src/include/data/scene_17_sprites.h @@ -0,0 +1,12 @@ +#ifndef SCENE_17_SPRITES_H +#define SCENE_17_SPRITES_H + +// Scene: Field +// Sprites + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_17_sprites) +extern const far_ptr_t scene_17_sprites[]; + +#endif diff --git a/src/include/data/scene_17_triggers.h b/src/include/data/scene_17_triggers.h new file mode 100644 index 0000000..4f3cd6a --- /dev/null +++ b/src/include/data/scene_17_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_17_TRIGGERS_H +#define SCENE_17_TRIGGERS_H + +// Scene: Field +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_17_triggers) +extern const struct trigger_t scene_17_triggers[]; + +#endif diff --git a/src/include/data/scene_1_actors.h b/src/include/data/scene_1_actors.h new file mode 100644 index 0000000..dd406eb --- /dev/null +++ b/src/include/data/scene_1_actors.h @@ -0,0 +1,12 @@ +#ifndef SCENE_1_ACTORS_H +#define SCENE_1_ACTORS_H + +// Scene: Overworld +// Actors + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_1_actors) +extern const struct actor_t scene_1_actors[]; + +#endif diff --git a/src/include/data/scene_1_collisions.h b/src/include/data/scene_1_collisions.h new file mode 100644 index 0000000..8bf88e8 --- /dev/null +++ b/src/include/data/scene_1_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_1_COLLISIONS_H +#define SCENE_1_COLLISIONS_H + +// Scene: Overworld +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_1_collisions) +extern const unsigned char scene_1_collisions[]; + +#endif diff --git a/src/include/data/scene_1_init.h b/src/include/data/scene_1_init.h new file mode 100644 index 0000000..d16b9be --- /dev/null +++ b/src/include/data/scene_1_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_1_INIT_H +#define SCENE_1_INIT_H + +// Script scene_1_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_1_init) +extern const unsigned char scene_1_init[]; + +#endif diff --git a/src/include/data/scene_1_sprites.h b/src/include/data/scene_1_sprites.h new file mode 100644 index 0000000..19a0606 --- /dev/null +++ b/src/include/data/scene_1_sprites.h @@ -0,0 +1,12 @@ +#ifndef SCENE_1_SPRITES_H +#define SCENE_1_SPRITES_H + +// Scene: Overworld +// Sprites + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_1_sprites) +extern const far_ptr_t scene_1_sprites[]; + +#endif diff --git a/src/include/data/scene_1_triggers.h b/src/include/data/scene_1_triggers.h new file mode 100644 index 0000000..49d88c3 --- /dev/null +++ b/src/include/data/scene_1_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_1_TRIGGERS_H +#define SCENE_1_TRIGGERS_H + +// Scene: Overworld +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_1_triggers) +extern const struct trigger_t scene_1_triggers[]; + +#endif diff --git a/src/include/data/scene_2.h b/src/include/data/scene_2.h new file mode 100644 index 0000000..17fbc3f --- /dev/null +++ b/src/include/data/scene_2.h @@ -0,0 +1,11 @@ +#ifndef SCENE_2_H +#define SCENE_2_H + +// Scene: fate6House + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_2) +extern const struct scene_t scene_2; + +#endif diff --git a/src/include/data/scene_2_actors.h b/src/include/data/scene_2_actors.h new file mode 100644 index 0000000..21beb20 --- /dev/null +++ b/src/include/data/scene_2_actors.h @@ -0,0 +1,12 @@ +#ifndef SCENE_2_ACTORS_H +#define SCENE_2_ACTORS_H + +// Scene: fate6House +// Actors + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_2_actors) +extern const struct actor_t scene_2_actors[]; + +#endif diff --git a/src/include/data/scene_2_collisions.h b/src/include/data/scene_2_collisions.h new file mode 100644 index 0000000..0764a4d --- /dev/null +++ b/src/include/data/scene_2_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_2_COLLISIONS_H +#define SCENE_2_COLLISIONS_H + +// Scene: fate6House +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_2_collisions) +extern const unsigned char scene_2_collisions[]; + +#endif diff --git a/src/include/data/scene_2_init.h b/src/include/data/scene_2_init.h new file mode 100644 index 0000000..cdaf362 --- /dev/null +++ b/src/include/data/scene_2_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_2_INIT_H +#define SCENE_2_INIT_H + +// Script scene_2_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_2_init) +extern const unsigned char scene_2_init[]; + +#endif diff --git a/src/include/data/scene_2_sprites.h b/src/include/data/scene_2_sprites.h new file mode 100644 index 0000000..f6e3067 --- /dev/null +++ b/src/include/data/scene_2_sprites.h @@ -0,0 +1,12 @@ +#ifndef SCENE_2_SPRITES_H +#define SCENE_2_SPRITES_H + +// Scene: fate6House +// Sprites + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_2_sprites) +extern const far_ptr_t scene_2_sprites[]; + +#endif diff --git a/src/include/data/scene_2_triggers.h b/src/include/data/scene_2_triggers.h new file mode 100644 index 0000000..33e48a2 --- /dev/null +++ b/src/include/data/scene_2_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_2_TRIGGERS_H +#define SCENE_2_TRIGGERS_H + +// Scene: fate6House +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_2_triggers) +extern const struct trigger_t scene_2_triggers[]; + +#endif diff --git a/src/include/data/scene_3.h b/src/include/data/scene_3.h new file mode 100644 index 0000000..d1dcaa3 --- /dev/null +++ b/src/include/data/scene_3.h @@ -0,0 +1,11 @@ +#ifndef SCENE_3_H +#define SCENE_3_H + +// Scene: TappyHouse + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_3) +extern const struct scene_t scene_3; + +#endif diff --git a/src/include/data/scene_3_actors.h b/src/include/data/scene_3_actors.h new file mode 100644 index 0000000..6a4a97e --- /dev/null +++ b/src/include/data/scene_3_actors.h @@ -0,0 +1,12 @@ +#ifndef SCENE_3_ACTORS_H +#define SCENE_3_ACTORS_H + +// Scene: TappyHouse +// Actors + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_3_actors) +extern const struct actor_t scene_3_actors[]; + +#endif diff --git a/src/include/data/scene_3_collisions.h b/src/include/data/scene_3_collisions.h new file mode 100644 index 0000000..6953c60 --- /dev/null +++ b/src/include/data/scene_3_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_3_COLLISIONS_H +#define SCENE_3_COLLISIONS_H + +// Scene: TappyHouse +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_3_collisions) +extern const unsigned char scene_3_collisions[]; + +#endif diff --git a/src/include/data/scene_3_init.h b/src/include/data/scene_3_init.h new file mode 100644 index 0000000..629506c --- /dev/null +++ b/src/include/data/scene_3_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_3_INIT_H +#define SCENE_3_INIT_H + +// Script scene_3_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_3_init) +extern const unsigned char scene_3_init[]; + +#endif diff --git a/src/include/data/scene_3_sprites.h b/src/include/data/scene_3_sprites.h new file mode 100644 index 0000000..f4335ce --- /dev/null +++ b/src/include/data/scene_3_sprites.h @@ -0,0 +1,12 @@ +#ifndef SCENE_3_SPRITES_H +#define SCENE_3_SPRITES_H + +// Scene: TappyHouse +// Sprites + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_3_sprites) +extern const far_ptr_t scene_3_sprites[]; + +#endif diff --git a/src/include/data/scene_3_triggers.h b/src/include/data/scene_3_triggers.h new file mode 100644 index 0000000..42b95c1 --- /dev/null +++ b/src/include/data/scene_3_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_3_TRIGGERS_H +#define SCENE_3_TRIGGERS_H + +// Scene: TappyHouse +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_3_triggers) +extern const struct trigger_t scene_3_triggers[]; + +#endif diff --git a/src/include/data/scene_4.h b/src/include/data/scene_4.h new file mode 100644 index 0000000..dbf4d73 --- /dev/null +++ b/src/include/data/scene_4.h @@ -0,0 +1,11 @@ +#ifndef SCENE_4_H +#define SCENE_4_H + +// Scene: SlighsHouse + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_4) +extern const struct scene_t scene_4; + +#endif diff --git a/src/include/data/scene_4_collisions.h b/src/include/data/scene_4_collisions.h new file mode 100644 index 0000000..936a273 --- /dev/null +++ b/src/include/data/scene_4_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_4_COLLISIONS_H +#define SCENE_4_COLLISIONS_H + +// Scene: SlighsHouse +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_4_collisions) +extern const unsigned char scene_4_collisions[]; + +#endif diff --git a/src/include/data/scene_4_init.h b/src/include/data/scene_4_init.h new file mode 100644 index 0000000..b8db342 --- /dev/null +++ b/src/include/data/scene_4_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_4_INIT_H +#define SCENE_4_INIT_H + +// Script scene_4_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_4_init) +extern const unsigned char scene_4_init[]; + +#endif diff --git a/src/include/data/scene_4_triggers.h b/src/include/data/scene_4_triggers.h new file mode 100644 index 0000000..0c48fb3 --- /dev/null +++ b/src/include/data/scene_4_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_4_TRIGGERS_H +#define SCENE_4_TRIGGERS_H + +// Scene: SlighsHouse +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_4_triggers) +extern const struct trigger_t scene_4_triggers[]; + +#endif diff --git a/src/include/data/scene_5.h b/src/include/data/scene_5.h new file mode 100644 index 0000000..05359ad --- /dev/null +++ b/src/include/data/scene_5.h @@ -0,0 +1,11 @@ +#ifndef SCENE_5_H +#define SCENE_5_H + +// Scene: Basement + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_5) +extern const struct scene_t scene_5; + +#endif diff --git a/src/include/data/scene_5_actors.h b/src/include/data/scene_5_actors.h new file mode 100644 index 0000000..0099836 --- /dev/null +++ b/src/include/data/scene_5_actors.h @@ -0,0 +1,12 @@ +#ifndef SCENE_5_ACTORS_H +#define SCENE_5_ACTORS_H + +// Scene: Basement +// Actors + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_5_actors) +extern const struct actor_t scene_5_actors[]; + +#endif diff --git a/src/include/data/scene_5_collisions.h b/src/include/data/scene_5_collisions.h new file mode 100644 index 0000000..9dfc214 --- /dev/null +++ b/src/include/data/scene_5_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_5_COLLISIONS_H +#define SCENE_5_COLLISIONS_H + +// Scene: Basement +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_5_collisions) +extern const unsigned char scene_5_collisions[]; + +#endif diff --git a/src/include/data/scene_5_init.h b/src/include/data/scene_5_init.h new file mode 100644 index 0000000..05f53ff --- /dev/null +++ b/src/include/data/scene_5_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_5_INIT_H +#define SCENE_5_INIT_H + +// Script scene_5_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_5_init) +extern const unsigned char scene_5_init[]; + +#endif diff --git a/src/include/data/scene_5_sprites.h b/src/include/data/scene_5_sprites.h new file mode 100644 index 0000000..0385e6b --- /dev/null +++ b/src/include/data/scene_5_sprites.h @@ -0,0 +1,12 @@ +#ifndef SCENE_5_SPRITES_H +#define SCENE_5_SPRITES_H + +// Scene: Basement +// Sprites + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_5_sprites) +extern const far_ptr_t scene_5_sprites[]; + +#endif diff --git a/src/include/data/scene_5_triggers.h b/src/include/data/scene_5_triggers.h new file mode 100644 index 0000000..08b2a8f --- /dev/null +++ b/src/include/data/scene_5_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_5_TRIGGERS_H +#define SCENE_5_TRIGGERS_H + +// Scene: Basement +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_5_triggers) +extern const struct trigger_t scene_5_triggers[]; + +#endif diff --git a/src/include/data/scene_6.h b/src/include/data/scene_6.h new file mode 100644 index 0000000..ebe34bd --- /dev/null +++ b/src/include/data/scene_6.h @@ -0,0 +1,11 @@ +#ifndef SCENE_6_H +#define SCENE_6_H + +// Scene: MidnightLibrary + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_6) +extern const struct scene_t scene_6; + +#endif diff --git a/src/include/data/scene_6_actors.h b/src/include/data/scene_6_actors.h new file mode 100644 index 0000000..89ac997 --- /dev/null +++ b/src/include/data/scene_6_actors.h @@ -0,0 +1,12 @@ +#ifndef SCENE_6_ACTORS_H +#define SCENE_6_ACTORS_H + +// Scene: MidnightLibrary +// Actors + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_6_actors) +extern const struct actor_t scene_6_actors[]; + +#endif diff --git a/src/include/data/scene_6_collisions.h b/src/include/data/scene_6_collisions.h new file mode 100644 index 0000000..1cc94cb --- /dev/null +++ b/src/include/data/scene_6_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_6_COLLISIONS_H +#define SCENE_6_COLLISIONS_H + +// Scene: MidnightLibrary +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_6_collisions) +extern const unsigned char scene_6_collisions[]; + +#endif diff --git a/src/include/data/scene_6_init.h b/src/include/data/scene_6_init.h new file mode 100644 index 0000000..847b491 --- /dev/null +++ b/src/include/data/scene_6_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_6_INIT_H +#define SCENE_6_INIT_H + +// Script scene_6_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_6_init) +extern const unsigned char scene_6_init[]; + +#endif diff --git a/src/include/data/scene_6_sprites.h b/src/include/data/scene_6_sprites.h new file mode 100644 index 0000000..6e3299b --- /dev/null +++ b/src/include/data/scene_6_sprites.h @@ -0,0 +1,12 @@ +#ifndef SCENE_6_SPRITES_H +#define SCENE_6_SPRITES_H + +// Scene: MidnightLibrary +// Sprites + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_6_sprites) +extern const far_ptr_t scene_6_sprites[]; + +#endif diff --git a/src/include/data/scene_6_triggers.h b/src/include/data/scene_6_triggers.h new file mode 100644 index 0000000..1725168 --- /dev/null +++ b/src/include/data/scene_6_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_6_TRIGGERS_H +#define SCENE_6_TRIGGERS_H + +// Scene: MidnightLibrary +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_6_triggers) +extern const struct trigger_t scene_6_triggers[]; + +#endif diff --git a/src/include/data/scene_7.h b/src/include/data/scene_7.h new file mode 100644 index 0000000..0a57bfa --- /dev/null +++ b/src/include/data/scene_7.h @@ -0,0 +1,11 @@ +#ifndef SCENE_7_H +#define SCENE_7_H + +// Scene: melonHouse + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_7) +extern const struct scene_t scene_7; + +#endif diff --git a/src/include/data/scene_7_actors.h b/src/include/data/scene_7_actors.h new file mode 100644 index 0000000..6fc0d0b --- /dev/null +++ b/src/include/data/scene_7_actors.h @@ -0,0 +1,12 @@ +#ifndef SCENE_7_ACTORS_H +#define SCENE_7_ACTORS_H + +// Scene: melonHouse +// Actors + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_7_actors) +extern const struct actor_t scene_7_actors[]; + +#endif diff --git a/src/include/data/scene_7_collisions.h b/src/include/data/scene_7_collisions.h new file mode 100644 index 0000000..fff7e61 --- /dev/null +++ b/src/include/data/scene_7_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_7_COLLISIONS_H +#define SCENE_7_COLLISIONS_H + +// Scene: melonHouse +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_7_collisions) +extern const unsigned char scene_7_collisions[]; + +#endif diff --git a/src/include/data/scene_7_init.h b/src/include/data/scene_7_init.h new file mode 100644 index 0000000..dd29cc4 --- /dev/null +++ b/src/include/data/scene_7_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_7_INIT_H +#define SCENE_7_INIT_H + +// Script scene_7_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_7_init) +extern const unsigned char scene_7_init[]; + +#endif diff --git a/src/include/data/scene_7_sprites.h b/src/include/data/scene_7_sprites.h new file mode 100644 index 0000000..e18b2db --- /dev/null +++ b/src/include/data/scene_7_sprites.h @@ -0,0 +1,12 @@ +#ifndef SCENE_7_SPRITES_H +#define SCENE_7_SPRITES_H + +// Scene: melonHouse +// Sprites + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_7_sprites) +extern const far_ptr_t scene_7_sprites[]; + +#endif diff --git a/src/include/data/scene_7_triggers.h b/src/include/data/scene_7_triggers.h new file mode 100644 index 0000000..a14ed85 --- /dev/null +++ b/src/include/data/scene_7_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_7_TRIGGERS_H +#define SCENE_7_TRIGGERS_H + +// Scene: melonHouse +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_7_triggers) +extern const struct trigger_t scene_7_triggers[]; + +#endif diff --git a/src/include/data/scene_8.h b/src/include/data/scene_8.h new file mode 100644 index 0000000..64f8c20 --- /dev/null +++ b/src/include/data/scene_8.h @@ -0,0 +1,11 @@ +#ifndef SCENE_8_H +#define SCENE_8_H + +// Scene: MidnightClubHouse + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_8) +extern const struct scene_t scene_8; + +#endif diff --git a/src/include/data/scene_8_actors.h b/src/include/data/scene_8_actors.h new file mode 100644 index 0000000..1d5f75b --- /dev/null +++ b/src/include/data/scene_8_actors.h @@ -0,0 +1,12 @@ +#ifndef SCENE_8_ACTORS_H +#define SCENE_8_ACTORS_H + +// Scene: MidnightClubHouse +// Actors + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_8_actors) +extern const struct actor_t scene_8_actors[]; + +#endif diff --git a/src/include/data/scene_8_collisions.h b/src/include/data/scene_8_collisions.h new file mode 100644 index 0000000..e7300cf --- /dev/null +++ b/src/include/data/scene_8_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_8_COLLISIONS_H +#define SCENE_8_COLLISIONS_H + +// Scene: MidnightClubHouse +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_8_collisions) +extern const unsigned char scene_8_collisions[]; + +#endif diff --git a/src/include/data/scene_8_init.h b/src/include/data/scene_8_init.h new file mode 100644 index 0000000..f59442e --- /dev/null +++ b/src/include/data/scene_8_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_8_INIT_H +#define SCENE_8_INIT_H + +// Script scene_8_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_8_init) +extern const unsigned char scene_8_init[]; + +#endif diff --git a/src/include/data/scene_8_sprites.h b/src/include/data/scene_8_sprites.h new file mode 100644 index 0000000..9254278 --- /dev/null +++ b/src/include/data/scene_8_sprites.h @@ -0,0 +1,12 @@ +#ifndef SCENE_8_SPRITES_H +#define SCENE_8_SPRITES_H + +// Scene: MidnightClubHouse +// Sprites + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_8_sprites) +extern const far_ptr_t scene_8_sprites[]; + +#endif diff --git a/src/include/data/scene_8_triggers.h b/src/include/data/scene_8_triggers.h new file mode 100644 index 0000000..7fb68e9 --- /dev/null +++ b/src/include/data/scene_8_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_8_TRIGGERS_H +#define SCENE_8_TRIGGERS_H + +// Scene: MidnightClubHouse +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_8_triggers) +extern const struct trigger_t scene_8_triggers[]; + +#endif diff --git a/src/include/data/scene_9.h b/src/include/data/scene_9.h new file mode 100644 index 0000000..8240fe7 --- /dev/null +++ b/src/include/data/scene_9.h @@ -0,0 +1,11 @@ +#ifndef SCENE_9_H +#define SCENE_9_H + +// Scene: fate6HouseF2 + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_9) +extern const struct scene_t scene_9; + +#endif diff --git a/src/include/data/scene_9_collisions.h b/src/include/data/scene_9_collisions.h new file mode 100644 index 0000000..d38fbac --- /dev/null +++ b/src/include/data/scene_9_collisions.h @@ -0,0 +1,12 @@ +#ifndef SCENE_9_COLLISIONS_H +#define SCENE_9_COLLISIONS_H + +// Scene: fate6HouseF2 +// Collisions + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_9_collisions) +extern const unsigned char scene_9_collisions[]; + +#endif diff --git a/src/include/data/scene_9_init.h b/src/include/data/scene_9_init.h new file mode 100644 index 0000000..386744f --- /dev/null +++ b/src/include/data/scene_9_init.h @@ -0,0 +1,11 @@ +#ifndef SCENE_9_INIT_H +#define SCENE_9_INIT_H + +// Script scene_9_init + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_9_init) +extern const unsigned char scene_9_init[]; + +#endif diff --git a/src/include/data/scene_9_triggers.h b/src/include/data/scene_9_triggers.h new file mode 100644 index 0000000..cdf1726 --- /dev/null +++ b/src/include/data/scene_9_triggers.h @@ -0,0 +1,12 @@ +#ifndef SCENE_9_TRIGGERS_H +#define SCENE_9_TRIGGERS_H + +// Scene: fate6HouseF2 +// Triggers + +#include "gbs_types.h" + +BANKREF_EXTERN(scene_9_triggers) +extern const struct trigger_t scene_9_triggers[]; + +#endif diff --git a/src/include/data/scene_types.h b/src/include/data/scene_types.h new file mode 100644 index 0000000..a8fae35 --- /dev/null +++ b/src/include/data/scene_types.h @@ -0,0 +1,8 @@ +#ifndef SCENE_TYPES_H +#define SCENE_TYPES_H + +typedef enum { + SCENE_TYPE_TOPDOWN = 0, + SCENE_TYPE_LOGO +} scene_type_e; +#endif diff --git a/src/include/data/script_1.h b/src/include/data/script_1.h new file mode 100644 index 0000000..9eb9f6e --- /dev/null +++ b/src/include/data/script_1.h @@ -0,0 +1,11 @@ +#ifndef SCRIPT_1_H +#define SCRIPT_1_H + +// Script script_1 + +#include "gbs_types.h" + +BANKREF_EXTERN(script_1) +extern const unsigned char script_1[]; + +#endif diff --git a/src/include/data/script_input.h b/src/include/data/script_input.h new file mode 100644 index 0000000..0515b80 --- /dev/null +++ b/src/include/data/script_input.h @@ -0,0 +1,11 @@ +#ifndef SCRIPT_INPUT_H +#define SCRIPT_INPUT_H + +// Script script_input + +#include "gbs_types.h" + +BANKREF_EXTERN(script_input) +extern const unsigned char script_input[]; + +#endif diff --git a/src/include/data/script_input_4.h b/src/include/data/script_input_4.h new file mode 100644 index 0000000..46146cf --- /dev/null +++ b/src/include/data/script_input_4.h @@ -0,0 +1,11 @@ +#ifndef SCRIPT_INPUT_4_H +#define SCRIPT_INPUT_4_H + +// Script script_input_4 + +#include "gbs_types.h" + +BANKREF_EXTERN(script_input_4) +extern const unsigned char script_input_4[]; + +#endif diff --git a/src/include/data/script_input_5.h b/src/include/data/script_input_5.h new file mode 100644 index 0000000..9ad129a --- /dev/null +++ b/src/include/data/script_input_5.h @@ -0,0 +1,11 @@ +#ifndef SCRIPT_INPUT_5_H +#define SCRIPT_INPUT_5_H + +// Script script_input_5 + +#include "gbs_types.h" + +BANKREF_EXTERN(script_input_5) +extern const unsigned char script_input_5[]; + +#endif diff --git a/src/include/data/script_input_6.h b/src/include/data/script_input_6.h new file mode 100644 index 0000000..072ce35 --- /dev/null +++ b/src/include/data/script_input_6.h @@ -0,0 +1,11 @@ +#ifndef SCRIPT_INPUT_6_H +#define SCRIPT_INPUT_6_H + +// Script script_input_6 + +#include "gbs_types.h" + +BANKREF_EXTERN(script_input_6) +extern const unsigned char script_input_6[]; + +#endif diff --git a/src/include/data/sprite_actor_animated.h b/src/include/data/sprite_actor_animated.h new file mode 100644 index 0000000..f26bc52 --- /dev/null +++ b/src/include/data/sprite_actor_animated.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_ACTOR_ANIMATED_H +#define SPRITE_ACTOR_ANIMATED_H + +// SpriteSheet: actor_animated + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_actor_animated) +extern const struct spritesheet_t sprite_actor_animated; + +#endif diff --git a/src/include/data/sprite_actor_animated_bank2_tileset.h b/src/include/data/sprite_actor_animated_bank2_tileset.h new file mode 100644 index 0000000..e0dd1c0 --- /dev/null +++ b/src/include/data/sprite_actor_animated_bank2_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_ACTOR_ANIMATED_BANK2_TILESET_H +#define SPRITE_ACTOR_ANIMATED_BANK2_TILESET_H + +// Tileset: sprite_actor_animated_bank2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_actor_animated_bank2_tileset) +extern const struct tileset_t sprite_actor_animated_bank2_tileset; + +#endif diff --git a/src/include/data/sprite_actor_animated_tileset.h b/src/include/data/sprite_actor_animated_tileset.h new file mode 100644 index 0000000..5603627 --- /dev/null +++ b/src/include/data/sprite_actor_animated_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_ACTOR_ANIMATED_TILESET_H +#define SPRITE_ACTOR_ANIMATED_TILESET_H + +// Tileset: sprite_actor_animated_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_actor_animated_tileset) +extern const struct tileset_t sprite_actor_animated_tileset; + +#endif diff --git a/src/include/data/sprite_cat.h b/src/include/data/sprite_cat.h new file mode 100644 index 0000000..c879a93 --- /dev/null +++ b/src/include/data/sprite_cat.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_CAT_H +#define SPRITE_CAT_H + +// SpriteSheet: cat + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_cat) +extern const struct spritesheet_t sprite_cat; + +#endif diff --git a/src/include/data/sprite_cat_bank2_tileset.h b/src/include/data/sprite_cat_bank2_tileset.h new file mode 100644 index 0000000..a954c67 --- /dev/null +++ b/src/include/data/sprite_cat_bank2_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_CAT_BANK2_TILESET_H +#define SPRITE_CAT_BANK2_TILESET_H + +// Tileset: sprite_cat_bank2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_cat_bank2_tileset) +extern const struct tileset_t sprite_cat_bank2_tileset; + +#endif diff --git a/src/include/data/sprite_cat_tileset.h b/src/include/data/sprite_cat_tileset.h new file mode 100644 index 0000000..0244f0f --- /dev/null +++ b/src/include/data/sprite_cat_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_CAT_TILESET_H +#define SPRITE_CAT_TILESET_H + +// Tileset: sprite_cat_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_cat_tileset) +extern const struct tileset_t sprite_cat_tileset; + +#endif diff --git a/src/include/data/sprite_charanimatedsprite.h b/src/include/data/sprite_charanimatedsprite.h new file mode 100644 index 0000000..00afc4d --- /dev/null +++ b/src/include/data/sprite_charanimatedsprite.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_CHARANIMATEDSPRITE_H +#define SPRITE_CHARANIMATEDSPRITE_H + +// SpriteSheet: CharAnimatedSprite + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_charanimatedsprite) +extern const struct spritesheet_t sprite_charanimatedsprite; + +#endif diff --git a/src/include/data/sprite_charanimatedsprite_bank2_tileset.h b/src/include/data/sprite_charanimatedsprite_bank2_tileset.h new file mode 100644 index 0000000..9e8d90a --- /dev/null +++ b/src/include/data/sprite_charanimatedsprite_bank2_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_CHARANIMATEDSPRITE_BANK2_TILESET_H +#define SPRITE_CHARANIMATEDSPRITE_BANK2_TILESET_H + +// Tileset: sprite_charanimatedsprite_bank2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_charanimatedsprite_bank2_tileset) +extern const struct tileset_t sprite_charanimatedsprite_bank2_tileset; + +#endif diff --git a/src/include/data/sprite_charanimatedsprite_tileset.h b/src/include/data/sprite_charanimatedsprite_tileset.h new file mode 100644 index 0000000..0ae4758 --- /dev/null +++ b/src/include/data/sprite_charanimatedsprite_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_CHARANIMATEDSPRITE_TILESET_H +#define SPRITE_CHARANIMATEDSPRITE_TILESET_H + +// Tileset: sprite_charanimatedsprite_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_charanimatedsprite_tileset) +extern const struct tileset_t sprite_charanimatedsprite_tileset; + +#endif diff --git a/src/include/data/sprite_checkbox.h b/src/include/data/sprite_checkbox.h new file mode 100644 index 0000000..faaee76 --- /dev/null +++ b/src/include/data/sprite_checkbox.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_CHECKBOX_H +#define SPRITE_CHECKBOX_H + +// SpriteSheet: checkbox + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_checkbox) +extern const struct spritesheet_t sprite_checkbox; + +#endif diff --git a/src/include/data/sprite_checkbox_bank2_tileset.h b/src/include/data/sprite_checkbox_bank2_tileset.h new file mode 100644 index 0000000..c354e8c --- /dev/null +++ b/src/include/data/sprite_checkbox_bank2_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_CHECKBOX_BANK2_TILESET_H +#define SPRITE_CHECKBOX_BANK2_TILESET_H + +// Tileset: sprite_checkbox_bank2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_checkbox_bank2_tileset) +extern const struct tileset_t sprite_checkbox_bank2_tileset; + +#endif diff --git a/src/include/data/sprite_checkbox_tileset.h b/src/include/data/sprite_checkbox_tileset.h new file mode 100644 index 0000000..5ee1e3d --- /dev/null +++ b/src/include/data/sprite_checkbox_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_CHECKBOX_TILESET_H +#define SPRITE_CHECKBOX_TILESET_H + +// Tileset: sprite_checkbox_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_checkbox_tileset) +extern const struct tileset_t sprite_checkbox_tileset; + +#endif diff --git a/src/include/data/sprite_dog.h b/src/include/data/sprite_dog.h new file mode 100644 index 0000000..ba997ba --- /dev/null +++ b/src/include/data/sprite_dog.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_DOG_H +#define SPRITE_DOG_H + +// SpriteSheet: dog + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_dog) +extern const struct spritesheet_t sprite_dog; + +#endif diff --git a/src/include/data/sprite_dog_bank2_tileset.h b/src/include/data/sprite_dog_bank2_tileset.h new file mode 100644 index 0000000..a219314 --- /dev/null +++ b/src/include/data/sprite_dog_bank2_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_DOG_BANK2_TILESET_H +#define SPRITE_DOG_BANK2_TILESET_H + +// Tileset: sprite_dog_bank2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_dog_bank2_tileset) +extern const struct tileset_t sprite_dog_bank2_tileset; + +#endif diff --git a/src/include/data/sprite_dog_tileset.h b/src/include/data/sprite_dog_tileset.h new file mode 100644 index 0000000..d9caa4f --- /dev/null +++ b/src/include/data/sprite_dog_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_DOG_TILESET_H +#define SPRITE_DOG_TILESET_H + +// Tileset: sprite_dog_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_dog_tileset) +extern const struct tileset_t sprite_dog_tileset; + +#endif diff --git a/src/include/data/sprite_npc001.h b/src/include/data/sprite_npc001.h new file mode 100644 index 0000000..f0f8506 --- /dev/null +++ b/src/include/data/sprite_npc001.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_NPC001_H +#define SPRITE_NPC001_H + +// SpriteSheet: npc001 + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_npc001) +extern const struct spritesheet_t sprite_npc001; + +#endif diff --git a/src/include/data/sprite_npc001_bank2_tileset.h b/src/include/data/sprite_npc001_bank2_tileset.h new file mode 100644 index 0000000..aa6a883 --- /dev/null +++ b/src/include/data/sprite_npc001_bank2_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_NPC001_BANK2_TILESET_H +#define SPRITE_NPC001_BANK2_TILESET_H + +// Tileset: sprite_npc001_bank2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_npc001_bank2_tileset) +extern const struct tileset_t sprite_npc001_bank2_tileset; + +#endif diff --git a/src/include/data/sprite_npc001_tileset.h b/src/include/data/sprite_npc001_tileset.h new file mode 100644 index 0000000..2b77ff4 --- /dev/null +++ b/src/include/data/sprite_npc001_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_NPC001_TILESET_H +#define SPRITE_NPC001_TILESET_H + +// Tileset: sprite_npc001_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_npc001_tileset) +extern const struct tileset_t sprite_npc001_tileset; + +#endif diff --git a/src/include/data/sprite_npc002.h b/src/include/data/sprite_npc002.h new file mode 100644 index 0000000..ff32d18 --- /dev/null +++ b/src/include/data/sprite_npc002.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_NPC002_H +#define SPRITE_NPC002_H + +// SpriteSheet: npc002 + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_npc002) +extern const struct spritesheet_t sprite_npc002; + +#endif diff --git a/src/include/data/sprite_npc002_bank2_tileset.h b/src/include/data/sprite_npc002_bank2_tileset.h new file mode 100644 index 0000000..1b43edd --- /dev/null +++ b/src/include/data/sprite_npc002_bank2_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_NPC002_BANK2_TILESET_H +#define SPRITE_NPC002_BANK2_TILESET_H + +// Tileset: sprite_npc002_bank2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_npc002_bank2_tileset) +extern const struct tileset_t sprite_npc002_bank2_tileset; + +#endif diff --git a/src/include/data/sprite_npc002_tileset.h b/src/include/data/sprite_npc002_tileset.h new file mode 100644 index 0000000..1d8a0e4 --- /dev/null +++ b/src/include/data/sprite_npc002_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_NPC002_TILESET_H +#define SPRITE_NPC002_TILESET_H + +// Tileset: sprite_npc002_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_npc002_tileset) +extern const struct tileset_t sprite_npc002_tileset; + +#endif diff --git a/src/include/data/sprite_npc005.h b/src/include/data/sprite_npc005.h new file mode 100644 index 0000000..3162828 --- /dev/null +++ b/src/include/data/sprite_npc005.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_NPC005_H +#define SPRITE_NPC005_H + +// SpriteSheet: npc005 + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_npc005) +extern const struct spritesheet_t sprite_npc005; + +#endif diff --git a/src/include/data/sprite_npc005_bank2_tileset.h b/src/include/data/sprite_npc005_bank2_tileset.h new file mode 100644 index 0000000..0fd8716 --- /dev/null +++ b/src/include/data/sprite_npc005_bank2_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_NPC005_BANK2_TILESET_H +#define SPRITE_NPC005_BANK2_TILESET_H + +// Tileset: sprite_npc005_bank2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_npc005_bank2_tileset) +extern const struct tileset_t sprite_npc005_bank2_tileset; + +#endif diff --git a/src/include/data/sprite_npc005_tileset.h b/src/include/data/sprite_npc005_tileset.h new file mode 100644 index 0000000..b8c241f --- /dev/null +++ b/src/include/data/sprite_npc005_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_NPC005_TILESET_H +#define SPRITE_NPC005_TILESET_H + +// Tileset: sprite_npc005_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_npc005_tileset) +extern const struct tileset_t sprite_npc005_tileset; + +#endif diff --git a/src/include/data/sprite_player.h b/src/include/data/sprite_player.h new file mode 100644 index 0000000..fe06e35 --- /dev/null +++ b/src/include/data/sprite_player.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_PLAYER_H +#define SPRITE_PLAYER_H + +// SpriteSheet: player + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_player) +extern const struct spritesheet_t sprite_player; + +#endif diff --git a/src/include/data/sprite_player_bank2_tileset.h b/src/include/data/sprite_player_bank2_tileset.h new file mode 100644 index 0000000..02adc7f --- /dev/null +++ b/src/include/data/sprite_player_bank2_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_PLAYER_BANK2_TILESET_H +#define SPRITE_PLAYER_BANK2_TILESET_H + +// Tileset: sprite_player_bank2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_player_bank2_tileset) +extern const struct tileset_t sprite_player_bank2_tileset; + +#endif diff --git a/src/include/data/sprite_player_tileset.h b/src/include/data/sprite_player_tileset.h new file mode 100644 index 0000000..6ff18e4 --- /dev/null +++ b/src/include/data/sprite_player_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_PLAYER_TILESET_H +#define SPRITE_PLAYER_TILESET_H + +// Tileset: sprite_player_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_player_tileset) +extern const struct tileset_t sprite_player_tileset; + +#endif diff --git a/src/include/data/sprite_sign.h b/src/include/data/sprite_sign.h new file mode 100644 index 0000000..0b634eb --- /dev/null +++ b/src/include/data/sprite_sign.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_SIGN_H +#define SPRITE_SIGN_H + +// SpriteSheet: sign + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_sign) +extern const struct spritesheet_t sprite_sign; + +#endif diff --git a/src/include/data/sprite_sign_bank2_tileset.h b/src/include/data/sprite_sign_bank2_tileset.h new file mode 100644 index 0000000..21f017b --- /dev/null +++ b/src/include/data/sprite_sign_bank2_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_SIGN_BANK2_TILESET_H +#define SPRITE_SIGN_BANK2_TILESET_H + +// Tileset: sprite_sign_bank2_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_sign_bank2_tileset) +extern const struct tileset_t sprite_sign_bank2_tileset; + +#endif diff --git a/src/include/data/sprite_sign_tileset.h b/src/include/data/sprite_sign_tileset.h new file mode 100644 index 0000000..475ecf7 --- /dev/null +++ b/src/include/data/sprite_sign_tileset.h @@ -0,0 +1,11 @@ +#ifndef SPRITE_SIGN_TILESET_H +#define SPRITE_SIGN_TILESET_H + +// Tileset: sprite_sign_tileset + +#include "gbs_types.h" + +BANKREF_EXTERN(sprite_sign_tileset) +extern const struct tileset_t sprite_sign_tileset; + +#endif diff --git a/src/include/data/spritesheet_none.h b/src/include/data/spritesheet_none.h new file mode 100644 index 0000000..abbbed2 --- /dev/null +++ b/src/include/data/spritesheet_none.h @@ -0,0 +1,11 @@ +#ifndef SPRITESHEET_NONE_H +#define SPRITESHEET_NONE_H + +// SpriteSheet: None + +#include "gbs_types.h" + +extern const void __bank_spritesheet_none; +extern const struct spritesheet_t spritesheet_none; + +#endif diff --git a/src/include/data/states_defines.h b/src/include/data/states_defines.h new file mode 100644 index 0000000..d9f16ce --- /dev/null +++ b/src/include/data/states_defines.h @@ -0,0 +1,6 @@ +#ifndef STATES_DEFINES_H +#define STATES_DEFINES_H + +#define INPUT_TOPDOWN_INTERACT INPUT_A + +#endif diff --git a/src/include/data/trigger_0_interact.h b/src/include/data/trigger_0_interact.h new file mode 100644 index 0000000..ecc1c69 --- /dev/null +++ b/src/include/data/trigger_0_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_0_INTERACT_H +#define TRIGGER_0_INTERACT_H + +// Script trigger_0_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_0_interact) +extern const unsigned char trigger_0_interact[]; + +#endif diff --git a/src/include/data/trigger_10_interact.h b/src/include/data/trigger_10_interact.h new file mode 100644 index 0000000..29c740a --- /dev/null +++ b/src/include/data/trigger_10_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_10_INTERACT_H +#define TRIGGER_10_INTERACT_H + +// Script trigger_10_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_10_interact) +extern const unsigned char trigger_10_interact[]; + +#endif diff --git a/src/include/data/trigger_11_interact.h b/src/include/data/trigger_11_interact.h new file mode 100644 index 0000000..0ff67ee --- /dev/null +++ b/src/include/data/trigger_11_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_11_INTERACT_H +#define TRIGGER_11_INTERACT_H + +// Script trigger_11_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_11_interact) +extern const unsigned char trigger_11_interact[]; + +#endif diff --git a/src/include/data/trigger_12_interact.h b/src/include/data/trigger_12_interact.h new file mode 100644 index 0000000..352f7f7 --- /dev/null +++ b/src/include/data/trigger_12_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_12_INTERACT_H +#define TRIGGER_12_INTERACT_H + +// Script trigger_12_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_12_interact) +extern const unsigned char trigger_12_interact[]; + +#endif diff --git a/src/include/data/trigger_13_interact.h b/src/include/data/trigger_13_interact.h new file mode 100644 index 0000000..018a227 --- /dev/null +++ b/src/include/data/trigger_13_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_13_INTERACT_H +#define TRIGGER_13_INTERACT_H + +// Script trigger_13_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_13_interact) +extern const unsigned char trigger_13_interact[]; + +#endif diff --git a/src/include/data/trigger_14_interact.h b/src/include/data/trigger_14_interact.h new file mode 100644 index 0000000..a026b48 --- /dev/null +++ b/src/include/data/trigger_14_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_14_INTERACT_H +#define TRIGGER_14_INTERACT_H + +// Script trigger_14_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_14_interact) +extern const unsigned char trigger_14_interact[]; + +#endif diff --git a/src/include/data/trigger_15_interact.h b/src/include/data/trigger_15_interact.h new file mode 100644 index 0000000..523e6c2 --- /dev/null +++ b/src/include/data/trigger_15_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_15_INTERACT_H +#define TRIGGER_15_INTERACT_H + +// Script trigger_15_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_15_interact) +extern const unsigned char trigger_15_interact[]; + +#endif diff --git a/src/include/data/trigger_16_interact.h b/src/include/data/trigger_16_interact.h new file mode 100644 index 0000000..e142015 --- /dev/null +++ b/src/include/data/trigger_16_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_16_INTERACT_H +#define TRIGGER_16_INTERACT_H + +// Script trigger_16_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_16_interact) +extern const unsigned char trigger_16_interact[]; + +#endif diff --git a/src/include/data/trigger_17_interact.h b/src/include/data/trigger_17_interact.h new file mode 100644 index 0000000..57a631c --- /dev/null +++ b/src/include/data/trigger_17_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_17_INTERACT_H +#define TRIGGER_17_INTERACT_H + +// Script trigger_17_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_17_interact) +extern const unsigned char trigger_17_interact[]; + +#endif diff --git a/src/include/data/trigger_18_interact.h b/src/include/data/trigger_18_interact.h new file mode 100644 index 0000000..4ef4cf6 --- /dev/null +++ b/src/include/data/trigger_18_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_18_INTERACT_H +#define TRIGGER_18_INTERACT_H + +// Script trigger_18_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_18_interact) +extern const unsigned char trigger_18_interact[]; + +#endif diff --git a/src/include/data/trigger_19_interact.h b/src/include/data/trigger_19_interact.h new file mode 100644 index 0000000..692d65c --- /dev/null +++ b/src/include/data/trigger_19_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_19_INTERACT_H +#define TRIGGER_19_INTERACT_H + +// Script trigger_19_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_19_interact) +extern const unsigned char trigger_19_interact[]; + +#endif diff --git a/src/include/data/trigger_1_interact.h b/src/include/data/trigger_1_interact.h new file mode 100644 index 0000000..775919c --- /dev/null +++ b/src/include/data/trigger_1_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_1_INTERACT_H +#define TRIGGER_1_INTERACT_H + +// Script trigger_1_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_1_interact) +extern const unsigned char trigger_1_interact[]; + +#endif diff --git a/src/include/data/trigger_20_interact.h b/src/include/data/trigger_20_interact.h new file mode 100644 index 0000000..af5bae7 --- /dev/null +++ b/src/include/data/trigger_20_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_20_INTERACT_H +#define TRIGGER_20_INTERACT_H + +// Script trigger_20_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_20_interact) +extern const unsigned char trigger_20_interact[]; + +#endif diff --git a/src/include/data/trigger_21_interact.h b/src/include/data/trigger_21_interact.h new file mode 100644 index 0000000..4365ace --- /dev/null +++ b/src/include/data/trigger_21_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_21_INTERACT_H +#define TRIGGER_21_INTERACT_H + +// Script trigger_21_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_21_interact) +extern const unsigned char trigger_21_interact[]; + +#endif diff --git a/src/include/data/trigger_22_interact.h b/src/include/data/trigger_22_interact.h new file mode 100644 index 0000000..5d6fb4e --- /dev/null +++ b/src/include/data/trigger_22_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_22_INTERACT_H +#define TRIGGER_22_INTERACT_H + +// Script trigger_22_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_22_interact) +extern const unsigned char trigger_22_interact[]; + +#endif diff --git a/src/include/data/trigger_23_interact.h b/src/include/data/trigger_23_interact.h new file mode 100644 index 0000000..3a1114d --- /dev/null +++ b/src/include/data/trigger_23_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_23_INTERACT_H +#define TRIGGER_23_INTERACT_H + +// Script trigger_23_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_23_interact) +extern const unsigned char trigger_23_interact[]; + +#endif diff --git a/src/include/data/trigger_24_interact.h b/src/include/data/trigger_24_interact.h new file mode 100644 index 0000000..cb8afcd --- /dev/null +++ b/src/include/data/trigger_24_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_24_INTERACT_H +#define TRIGGER_24_INTERACT_H + +// Script trigger_24_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_24_interact) +extern const unsigned char trigger_24_interact[]; + +#endif diff --git a/src/include/data/trigger_2_interact.h b/src/include/data/trigger_2_interact.h new file mode 100644 index 0000000..c437750 --- /dev/null +++ b/src/include/data/trigger_2_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_2_INTERACT_H +#define TRIGGER_2_INTERACT_H + +// Script trigger_2_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_2_interact) +extern const unsigned char trigger_2_interact[]; + +#endif diff --git a/src/include/data/trigger_3_interact.h b/src/include/data/trigger_3_interact.h new file mode 100644 index 0000000..500b1f7 --- /dev/null +++ b/src/include/data/trigger_3_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_3_INTERACT_H +#define TRIGGER_3_INTERACT_H + +// Script trigger_3_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_3_interact) +extern const unsigned char trigger_3_interact[]; + +#endif diff --git a/src/include/data/trigger_4_interact.h b/src/include/data/trigger_4_interact.h new file mode 100644 index 0000000..b580619 --- /dev/null +++ b/src/include/data/trigger_4_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_4_INTERACT_H +#define TRIGGER_4_INTERACT_H + +// Script trigger_4_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_4_interact) +extern const unsigned char trigger_4_interact[]; + +#endif diff --git a/src/include/data/trigger_5_interact.h b/src/include/data/trigger_5_interact.h new file mode 100644 index 0000000..e483588 --- /dev/null +++ b/src/include/data/trigger_5_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_5_INTERACT_H +#define TRIGGER_5_INTERACT_H + +// Script trigger_5_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_5_interact) +extern const unsigned char trigger_5_interact[]; + +#endif diff --git a/src/include/data/trigger_6_interact.h b/src/include/data/trigger_6_interact.h new file mode 100644 index 0000000..be99f11 --- /dev/null +++ b/src/include/data/trigger_6_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_6_INTERACT_H +#define TRIGGER_6_INTERACT_H + +// Script trigger_6_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_6_interact) +extern const unsigned char trigger_6_interact[]; + +#endif diff --git a/src/include/data/trigger_7_interact.h b/src/include/data/trigger_7_interact.h new file mode 100644 index 0000000..40606da --- /dev/null +++ b/src/include/data/trigger_7_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_7_INTERACT_H +#define TRIGGER_7_INTERACT_H + +// Script trigger_7_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_7_interact) +extern const unsigned char trigger_7_interact[]; + +#endif diff --git a/src/include/data/trigger_8_interact.h b/src/include/data/trigger_8_interact.h new file mode 100644 index 0000000..9dc2332 --- /dev/null +++ b/src/include/data/trigger_8_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_8_INTERACT_H +#define TRIGGER_8_INTERACT_H + +// Script trigger_8_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_8_interact) +extern const unsigned char trigger_8_interact[]; + +#endif diff --git a/src/include/data/trigger_9_interact.h b/src/include/data/trigger_9_interact.h new file mode 100644 index 0000000..ebeeaff --- /dev/null +++ b/src/include/data/trigger_9_interact.h @@ -0,0 +1,11 @@ +#ifndef TRIGGER_9_INTERACT_H +#define TRIGGER_9_INTERACT_H + +// Script trigger_9_interact + +#include "gbs_types.h" + +BANKREF_EXTERN(trigger_9_interact) +extern const unsigned char trigger_9_interact[]; + +#endif diff --git a/src/include/data_manager.h b/src/include/data_manager.h new file mode 100644 index 0000000..33dbfd3 --- /dev/null +++ b/src/include/data_manager.h @@ -0,0 +1,40 @@ +#ifndef SCENE_H +#define SCENE_H + +#include +#include "gbs_types.h" + +extern far_ptr_t current_scene; +extern UBYTE image_bank; +extern UBYTE image_attr_bank; +extern UBYTE collision_bank; +extern unsigned char *image_ptr; +extern unsigned char *image_attr_ptr; +extern unsigned char *collision_ptr; +extern UBYTE image_tile_width; +extern UBYTE image_tile_height; +extern UINT16 image_width; +extern UINT16 image_height; +extern scene_type_e scene_type; +extern UBYTE actors_len; +extern UBYTE sprites_len; +extern UBYTE actors_len; +extern LCD_isr_e scene_LCD_type; + +#define SCENE_STACK_SIZE 8 +extern scene_stack_item_t scene_stack[SCENE_STACK_SIZE]; +extern scene_stack_item_t * scene_stack_ptr; + +#define MAX_SCENE_SPRITES 64 +extern UBYTE scene_sprites_base_tiles[MAX_SCENE_SPRITES]; + +void load_init(void) BANKED; +UBYTE load_scene(const scene_t * scene, UBYTE bank, UBYTE init_data) BANKED; + +UBYTE load_sprite(UBYTE sprite_offset, const spritesheet_t * sprite, UBYTE bank) BANKED; +void load_player(void) BANKED; +void load_emote(const unsigned char * tiles, UBYTE bank) BANKED; +void load_animations(const spritesheet_t *sprite, UBYTE bank, UWORD animation_set, animation_t * res_animations) NONBANKED; +void load_bounds(const spritesheet_t * sprite, UBYTE bank, bounding_box_t * res_bounds) BANKED; + +#endif diff --git a/src/include/events.h b/src/include/events.h new file mode 100644 index 0000000..1882995 --- /dev/null +++ b/src/include/events.h @@ -0,0 +1,30 @@ +#ifndef _EVENTS_H_INCLUDE +#define _EVENTS_H_INCLUDE + +#include "vm.h" + +typedef struct script_event_t { + UWORD handle; + UBYTE script_bank; + void * script_addr; +} script_event_t; + +extern script_event_t input_events[8]; +extern UBYTE input_slots[8]; + +typedef struct timer_time_t { + UBYTE value, remains; +} timer_time_t; + +#define MAX_CONCURRENT_TIMERS 4 + +extern script_event_t timer_events[MAX_CONCURRENT_TIMERS]; +extern timer_time_t timer_values[MAX_CONCURRENT_TIMERS]; + +void events_init(UBYTE preserve) BANKED; +void events_update(void) NONBANKED; + +void timers_init(UBYTE preserve) BANKED; +void timers_update(void) NONBANKED; + +#endif \ No newline at end of file diff --git a/src/include/fade_manager.h b/src/include/fade_manager.h new file mode 100644 index 0000000..c94da1f --- /dev/null +++ b/src/include/fade_manager.h @@ -0,0 +1,73 @@ +#ifndef FADE_MANAGER_H +#define FADE_MANAGER_H + +#include + +#define FADE_SPEED_MASK 0x3F +#define FADE_IN_FLAG 0x40 +#define FADE_ENABLED_FLAG 0x80 + +typedef enum { FADE_IN, FADE_OUT } FADE_DIRECTION; + +extern UBYTE fade_running; +extern UBYTE fade_frames_per_step; +extern UBYTE fade_black; +extern UBYTE fade_timer; +extern UBYTE fade_style; + +#define BCPS_REG_ADDR 0x68 +#define OCPS_REG_ADDR 0x6A + +/** + * Initialise fade variables + */ +void fade_init(void) BANKED; + +/** + * Start Fade In + */ +void fade_in(void) BANKED; + +/** + * Start Fade Out + */ +void fade_out(void) BANKED; + +/** + * Update current fade + */ +void fade_update(void) BANKED; + +/** + * Refresh tile coloring to reflect changes in palette + * Call after LoadPalette etc. + */ +void fade_applypalettechange(void) BANKED; + +/** + * Change current fade speed + * + * @param speed new fade speed + */ +void fade_setspeed(UBYTE speed) BANKED; + +/** + * Check if fade is currently running + * + * @return TRUE if fade is currently running + */ +inline UBYTE fade_isfading(void) { + return fade_running; +} + +/** + * Fade in and wait until complete + */ +void fade_in_modal(void) BANKED; + +/** + * Fade out and wait until complete + */ +void fade_out_modal(void) BANKED; + +#endif diff --git a/src/include/flasher.h b/src/include/flasher.h new file mode 100644 index 0000000..845f61d --- /dev/null +++ b/src/include/flasher.h @@ -0,0 +1,11 @@ +#ifndef __FLASHER_H_INCLUDE +#define __FLASHER_H_INCLUDE + +#include + +void restore_sram_bank(UINT8 bank) BANKED; +void restore_sram(void) BANKED; + +UINT8 save_sram(UINT8 count) BANKED; + +#endif \ No newline at end of file diff --git a/src/include/game_time.h b/src/include/game_time.h new file mode 100644 index 0000000..1fea57c --- /dev/null +++ b/src/include/game_time.h @@ -0,0 +1,19 @@ +#ifndef GAME_TIME_H +#define GAME_TIME_H + +#include + +#define IS_FRAME_256 ((game_time & 0xFF) == 0) +#define IS_FRAME_128 ((game_time & 0x7F) == 0) +#define IS_FRAME_64 ((game_time & 0x3F) == 0) +#define IS_FRAME_32 ((game_time & 0x1F) == 0) +#define IS_FRAME_16 ((game_time & 0xF) == 0) +#define IS_FRAME_8 ((game_time & 0x7) == 0) +#define IS_FRAME_4 ((game_time & 0x3) == 0) +#define IS_FRAME_2 ((game_time & 0x1) == 0) +#define IS_FRAME_ODD ((game_time & 0x1) == 1) +#define IS_FRAME_EVEN ((game_time & 0x1) == 0) + +extern UINT8 game_time; + +#endif \ No newline at end of file diff --git a/src/include/gbprinter.h b/src/include/gbprinter.h new file mode 100644 index 0000000..cd0ad2b --- /dev/null +++ b/src/include/gbprinter.h @@ -0,0 +1,136 @@ +#ifndef __GBPRINTER_H_INCLUDE__ +#define __GBPRINTER_H_INCLUDE__ + +#include +#include + +/** Width of the printed image in tiles +*/ +#define PRN_TILE_WIDTH 20 + +#define PRN_LOW(A) ((A) & 0xFF) +#define PRN_HIGH(A) ((A) >> 8) + +/** 0x88,0x33 are mandatory first bytes to initialise a communication with printer + Any command sequence begins by these +*/ +#define PRN_MAGIC 0x3388 +#define PRN_LE(A) PRN_LOW(A),PRN_HIGH(A) + +/** INIT command is mandatory to initialize communication protocol with the printer + Two consecutive linked commands must never be more than 150 ms apart except the INIT command which is valid at least 10 seconds +*/ +#define PRN_CMD_INIT 0x01 + +/** PRINT command + Contains the palette, margins, number of prints and printing intensity +*/ +#define PRN_CMD_PRINT 0x02 + +/** DATA command + Can be any length between 0 and 640 bytes. + DATA command with lenght 0 triggers PRN_STATUS_FULL and is mandatory before print command +*/ +#define PRN_CMD_DATA 0x04 + +/** BREAK command + Not very usefull but exists (see Game Boy Programming Manual) +*/ +#define PRN_CMD_BREAK 0x08 + +/** STATUS command + Used to check status bits + Maybe be used alone before an INIT command to check physical connection with printer + Resets PRN_STATUS_UNTRAN +*/ +#define PRN_CMD_STATUS 0x0F + +/** Palette format: the bits, grouped two by two, give the printing color of the encoded pixel value + for the default palette 0xE4 = 0b11100100 = [3 2 1 0] + Any value is valid, which means that 1 to 4 color images are possible + 0x00 acts the same as 0xE4 for the printer +*/ +#define PRN_PALETTE_NORMAL 0b11100100u +#define PRN_PALETTE_INV 0b00011011u + +/** Don't use margins +*/ +#define PRN_NO_MARGINS 0x00 + +/** Exposure: 0x40 is default value, values from 0x80 to 0xFF act as 0x40 + Determines the time used by the printer head to heat the thermal paper +*/ +#define PRN_EXPOSURE_LIGHT 0x00 +#define PRN_EXPOSURE_DEFAULT 0x40 +#define PRN_EXPOSURE_DARK 0x7F + +/** Battery too low +*/ +#define PRN_STATUS_LOWBAT 0x80 + +/** Error not specified according to the Game Boy Programming manual +*/ +#define PRN_STATUS_ER2 0x40 + +/** Paper jam (abnormal motor operation) +*/ +#define PRN_STATUS_ER1 0x20 + +/** Packet error (but not checksum error) +*/ +#define PRN_STATUS_ER0 0x10 + +/** Unprocessed data present in printer memory + Allows to verify that printer got some data in memory with correct checksum + is resetted by STATUS command +*/ +#define PRN_STATUS_UNTRAN 0x08 + +/** status data ready, mandatory to allow printing + is triggered by DATA command with lenght 0 +*/ +#define PRN_STATUS_FULL 0x04 + +/** Message sent by the printer while physically printing +*/ +#define PRN_STATUS_BUSY 0x02 + +/** The received packet has a ckecksum error +*/ +#define PRN_STATUS_SUM 0x01 + +/** Everything is fine, printer ready for further transmission +*/ +#define PRN_STATUS_OK 0x00 + +#define PRN_STATUS_MASK_ERRORS 0xF0 +#define PRN_STATUS_MASK_ANY 0xFF + +#define PRN_SECONDS(A) ((A)*60) + +#define PRN_MAX_PROGRESS 8 + +#define PRN_STATUS_CANCELLED PRN_STATUS_ER2 + +typedef struct start_print_pkt_t { + uint16_t magic; + uint16_t command; + uint16_t length; + uint8_t print; + uint8_t margins; + uint8_t palette; + uint8_t exposure; + uint16_t crc; + uint16_t trail; +} start_print_pkt_t; + +extern start_print_pkt_t PRN_PKT_START; + +uint8_t gbprinter_detect(uint8_t delay) BANKED; +uint8_t gbprinter_print_overlay(uint8_t start, uint8_t rows, uint8_t margins) BANKED; + +inline void gbprinter_set_print_params(uint8_t margins, uint8_t palette, uint8_t exposure) { + PRN_PKT_START.crc = ((PRN_CMD_PRINT + 0x04u + 0x01u) + (PRN_PKT_START.margins = margins) + (PRN_PKT_START.palette = palette) + (PRN_PKT_START.exposure = exposure)); +} + +#endif \ No newline at end of file diff --git a/src/include/gbs_types.h b/src/include/gbs_types.h new file mode 100644 index 0000000..9a54527 --- /dev/null +++ b/src/include/gbs_types.h @@ -0,0 +1,191 @@ +#ifndef GBS_TYPES_H +#define GBS_TYPES_H + +#include +#include + +#include +#include + +#include "data/scene_types.h" +#include "bankdata.h" +#include "parallax.h" +#include "collision.h" + +typedef enum { + LCD_simple, + LCD_parallax, + LCD_fullscreen +} LCD_isr_e; + +typedef enum { + COLLISION_GROUP_NONE = 0, + COLLISION_GROUP_PLAYER = 1, + COLLISION_GROUP_1 = 2, + COLLISION_GROUP_2 = 4, + COLLISION_GROUP_3 = 8, +} collision_group_e; + +typedef struct animation_t +{ + uint8_t start; + uint8_t end; +} animation_t; + +typedef struct actor_t +{ + bool active : 1; + bool pinned : 1; + bool hidden : 1; + bool disabled : 1; + bool anim_noloop : 1; + bool collision_enabled : 1; + bool movement_interrupt : 1; + bool persistent : 1; + point16_t pos; + direction_e dir; + bounding_box_t bounds; + uint8_t base_tile; + uint8_t frame; + uint8_t frame_start; + uint8_t frame_end; + uint8_t anim_tick; + uint8_t move_speed; + uint8_t animation; + uint8_t reserve_tiles; + animation_t animations[8]; + far_ptr_t sprite; + far_ptr_t script, script_update; + uint16_t hscript_update, hscript_hit; + + // Collisions + collision_group_e collision_group; + + // Linked list + struct actor_t *next; + struct actor_t *prev; +} actor_t; + +#define TRIGGER_HAS_ENTER_SCRIPT 1 +#define TRIGGER_HAS_LEAVE_SCRIPT 2 + +typedef struct trigger_t { + uint8_t x, y, width, height; + far_ptr_t script; + uint8_t script_flags; +} trigger_t; + +typedef struct scene_t { + uint8_t width, height; + scene_type_e type; + uint8_t n_actors, n_triggers, n_projectiles, n_sprites; + uint8_t reserve_tiles; + far_ptr_t player_sprite; + far_ptr_t background, collisions; + far_ptr_t palette, sprite_palette; + far_ptr_t script_init, script_p_hit1; + far_ptr_t sprites; + far_ptr_t actors; + far_ptr_t triggers; + far_ptr_t projectiles; + parallax_row_t parallax_rows[3]; +} scene_t; + +typedef struct background_t { + uint8_t width, height; + far_ptr_t tileset; + far_ptr_t cgb_tileset; + far_ptr_t tilemap; // far pointer to array of bytes with map + far_ptr_t cgb_tilemap_attr; // far pointer to array of bytes with CGB attributes (may be NULL) +} background_t; + +typedef struct tileset_t { + uint16_t n_tiles; // actual amount of 8x8 tiles in tiles[] array + uint8_t tiles[]; +} tileset_t; + +typedef struct spritesheet_t { + uint8_t n_metasprites; + point8_t emote_origin; + metasprite_t * const *metasprites; + animation_t *animations; + uint16_t *animations_lookup; + bounding_box_t bounds; + far_ptr_t tileset; // far pointer to sprite tileset + far_ptr_t cgb_tileset; // far pointer to additional CGB tileset (may be NULL) +} spritesheet_t; + +typedef struct projectile_def_t +{ + bounding_box_t bounds; + far_ptr_t sprite; + uint8_t life_time; + uint8_t base_tile; + animation_t animations[4]; + uint8_t anim_tick; + uint8_t move_speed; + uint16_t initial_offset; + collision_group_e collision_group; + uint8_t collision_mask; +} projectile_def_t; + +typedef struct projectile_t +{ + bool anim_noloop : 1; + bool strong : 1; + point16_t pos; + point16_t delta_pos; + uint8_t frame; + uint8_t frame_start; + uint8_t frame_end; + projectile_def_t def; + struct projectile_t *next; +} projectile_t; + +#define FONT_RECODE 1 +#define FONT_VWF 2 +#define FONT_VWF_1BIT 4 + +#define FONT_RECODE_SIZE_7BIT 0x7fu + +typedef struct font_desc_t { + uint8_t attr, mask; + const uint8_t * recode_table; + const uint8_t * widths; + const uint8_t * bitmaps; +} font_desc_t; + +typedef struct scene_stack_item_t { + far_ptr_t scene; + point16_t pos; + direction_e dir; +} scene_stack_item_t; + +typedef struct menu_item_t { + uint8_t X, Y; + uint8_t iL, iR, iU, iD; +} menu_item_t; + +#define DMG_BLACK 0x03 +#define DMG_DARK_GRAY 0x02 +#define DMG_LITE_GRAY 0x01 +#define DMG_WHITE 0x00 + +#ifndef DMG_PALETTE +#define DMG_PALETTE(C0, C1, C2, C3) ((uint8_t)((((C3) & 0x03) << 6) | (((C2) & 0x03) << 4) | (((C1) & 0x03) << 2) | ((C0) & 0x03))) +#endif + +#define CGB_PALETTE(C0, C1, C2, C3) {C0, C1, C2, C3} +#define CGB_COLOR(R, G, B) ((uint16_t)(((R) & 0x1f) | (((G) & 0x1f) << 5) | (((B) & 0x1f) << 10))) + +typedef struct palette_entry_t { + uint16_t c0, c1, c2, c3; +} palette_entry_t; + +typedef struct palette_t { + uint8_t mask; + uint8_t palette[2]; + palette_entry_t cgb_palette[]; +} palette_t; + +#endif diff --git a/src/include/gbt_player.h b/src/include/gbt_player.h new file mode 100644 index 0000000..791e2e5 --- /dev/null +++ b/src/include/gbt_player.h @@ -0,0 +1,51 @@ +/* + * GBT Player v2.1.3 + * + * SPDX-License-Identifier: MIT + * + * Copyright (c) 2009-2020, Antonio Niño Díaz + */ + +#ifndef _GBT_PLAYER_ +#define _GBT_PLAYER_ + +#include + +// Plays the song pointed by data (pointer array to patterns) in given bank at +// given initial speed. +void gbt_play(void *data, UINT8 bank, UINT8 speed) OLDCALL; + +// Pauses or unpauses music. +// Parameter: 1 = un-pause/resume, 0 = pause +void gbt_pause(UINT8 pause) OLDCALL; + +// Stops music and turns off sound system. Called automatically when the last +// pattern ends and autoloop isn't activated. +void gbt_stop(void) OLDCALL; + +// Enables or disables autoloop +void gbt_loop(UINT8 loop) OLDCALL; + +// Updates player, should be called every frame. +// NOTE: This will change the active ROM bank to 1. +void gbt_update(void) OLDCALL; + +// Set enabled channels to prevent the player from using that channel. +// NOTE: If a channel is re-enabled, it can take some time to sound OK (until +// pan and volume are modified in the song). You should only disable unused +// channels or channels that don't change pan or volume. +void gbt_enable_channels(UINT8 channel_flags) OLDCALL; + +#define GBT_CHAN_1 (1<<0) +#define GBT_CHAN_2 (1<<1) +#define GBT_CHAN_3 (1<<2) +#define GBT_CHAN_4 (1<<3) + +extern volatile UINT8 _gbt_channel3_loaded_instrument; + +// resets channel3 instrument; forces reloading of waveform +inline void gbt_reset_ch3_instrument(void) { + _gbt_channel3_loaded_instrument = 0xffu; +} + +#endif //_GBT_PLAYER_ diff --git a/src/include/hUGEDriver.h b/src/include/hUGEDriver.h new file mode 100644 index 0000000..f3453c8 --- /dev/null +++ b/src/include/hUGEDriver.h @@ -0,0 +1,142 @@ +#ifndef HUGEDRIVER_H_INCLUDE +#define HUGEDRIVER_H_INCLUDE + +#include + +#define DN(A, B, C) (unsigned char)(A | ((B & 0x10) << 3)),(unsigned char)(((B << 4) & 0xFF) | (C >> 8)),(unsigned char)(C & 0xFF) + +#define C_3 0 +#define Cs3 1 +#define D_3 2 +#define Ds3 3 +#define E_3 4 +#define F_3 5 +#define Fs3 6 +#define G_3 7 +#define Gs3 8 +#define A_3 9 +#define As3 10 +#define B_3 11 +#define C_4 12 +#define Cs4 13 +#define D_4 14 +#define Ds4 15 +#define E_4 16 +#define F_4 17 +#define Fs4 18 +#define G_4 19 +#define Gs4 20 +#define A_4 21 +#define As4 22 +#define B_4 23 +#define C_5 24 +#define Cs5 25 +#define D_5 26 +#define Ds5 27 +#define E_5 28 +#define F_5 29 +#define Fs5 30 +#define G_5 31 +#define Gs5 32 +#define A_5 33 +#define As5 34 +#define B_5 35 +#define C_6 36 +#define Cs6 37 +#define D_6 38 +#define Ds6 39 +#define E_6 40 +#define F_6 41 +#define Fs6 42 +#define G_6 43 +#define Gs6 44 +#define A_6 45 +#define As6 46 +#define B_6 47 +#define C_7 48 +#define Cs7 49 +#define D_7 50 +#define Ds7 51 +#define E_7 52 +#define F_7 53 +#define Fs7 54 +#define G_7 55 +#define Gs7 56 +#define A_7 57 +#define As7 58 +#define B_7 59 +#define C_8 60 +#define Cs8 61 +#define D_8 62 +#define Ds8 63 +#define E_8 64 +#define F_8 65 +#define Fs8 66 +#define G_8 67 +#define Gs8 68 +#define A_8 69 +#define As8 70 +#define B_8 71 +#define LAST_NOTE 72 +#define ___ 90 + +// tick is a tick number; the high byte of param is channel and the low byte of param is routine id +typedef void (*hUGERoutine_t)(unsigned char tick, unsigned int param); + +typedef struct hUGEDutyInstr_t { + const unsigned char sweep; + const unsigned char len_duty; + const unsigned char envelope; + const unsigned char * subpattern; + const unsigned char highmask; +} hUGEDutyInstr_t; + +typedef struct hUGEWaveInstr_t { + const unsigned char length; + const unsigned char volume; + const unsigned char waveform; + const unsigned char * subpattern; + const unsigned char highmask; +} hUGEWaveInstr_t; + +typedef struct hUGENoiseInstr_t { + const unsigned char envelope; + const unsigned char * subpattern; + const unsigned char highmask; + const unsigned char unused1; + const unsigned char unused2; +} hUGENoiseInstr_t; + +typedef struct hUGESong_t { + unsigned char tempo; + const unsigned char * order_cnt; + const unsigned char ** order1, ** order2, ** order3, ** order4; + const hUGEDutyInstr_t * duty_instruments; + const hUGEWaveInstr_t * wave_instruments; + const hUGENoiseInstr_t * noise_instruments; + const hUGERoutine_t ** routines; + const unsigned char * waves; +} hUGESong_t; + +// initialize the driver with song data +void hUGE_init(const hUGESong_t * song); + +// driver routine +void hUGE_dosound(void); + +enum hUGE_channel_t {HT_CH1 = 0, HT_CH2, HT_CH3, HT_CH4}; +enum hUGE_mute_t {HT_CH_PLAY = 0, HT_CH_MUTE}; + +void hUGE_mute_channel(enum hUGE_channel_t ch, enum hUGE_mute_t mute); + +void hUGE_set_position(unsigned char pattern); + +extern volatile unsigned char hUGE_current_wave; + +extern volatile unsigned char hUGE_mute_mask; + +inline void hUGE_reset_wave(void) { + hUGE_current_wave = 100; +} + +#endif diff --git a/src/include/hUGEDriverRoutines.h b/src/include/hUGEDriverRoutines.h new file mode 100644 index 0000000..fa8da7f --- /dev/null +++ b/src/include/hUGEDriverRoutines.h @@ -0,0 +1,15 @@ +#ifndef HUGEDRIVER_ROUTINES_H_INCLUDE +#define HUGEDRIVER_ROUTINES_H_INCLUDE + +#include "hUGEDriver.h" + +void hUGETrackerRoutine(unsigned char tick, unsigned int param) NONBANKED; + +static const hUGERoutine_t routines[] = { + hUGETrackerRoutine, hUGETrackerRoutine, hUGETrackerRoutine, hUGETrackerRoutine, + hUGETrackerRoutine, hUGETrackerRoutine, hUGETrackerRoutine, hUGETrackerRoutine, + hUGETrackerRoutine, hUGETrackerRoutine, hUGETrackerRoutine, hUGETrackerRoutine, + hUGETrackerRoutine, hUGETrackerRoutine, hUGETrackerRoutine, hUGETrackerRoutine +}; + +#endif \ No newline at end of file diff --git a/src/include/input.h b/src/include/input.h new file mode 100644 index 0000000..83649d3 --- /dev/null +++ b/src/include/input.h @@ -0,0 +1,104 @@ +#ifndef INPUT_H +#define INPUT_H + +#include + +#ifdef SGB + #define MAX_JOYPADS 2 +#endif +#define joy (frame_joy) + +/* TRUE if any button is being held */ +#define INPUT_ANY (joy) + +/* TRUE if left is being held on dpad */ +#define INPUT_LEFT (joy & J_LEFT) + +/* TRUE if right is being held on dpad */ +#define INPUT_RIGHT (joy & J_RIGHT) + +/* TRUE if up is being held on dpad */ +#define INPUT_UP (joy & J_UP) + +/* TRUE if down is being held on dpad */ +#define INPUT_DOWN (joy & J_DOWN) + +/* TRUE if left is most recent direction being held on dpad */ +#define INPUT_RECENT_LEFT ((recent_joy & J_LEFT) || (!recent_joy && (joy & J_LEFT))) + +/* TRUE if right is most recent direction being held on dpad */ +#define INPUT_RECENT_RIGHT ((recent_joy & J_RIGHT) || (!recent_joy && (joy & J_RIGHT))) + +/* TRUE if up is most recent direction being held on dpad */ +#define INPUT_RECENT_UP ((recent_joy & J_UP) || (!recent_joy && (joy & J_UP))) + +/* TRUE if down is most recent direction being held on dpad */ +#define INPUT_RECENT_DOWN ((recent_joy & J_DOWN) || (!recent_joy && (joy & J_DOWN))) + +/* TRUE if A button is being held */ +#define INPUT_A (joy & J_A) + +/* TRUE if B button is being held */ +#define INPUT_B (joy & J_B) + +/* TRUE if A OR B button is being held */ +#define INPUT_A_OR_B (joy & (J_A | J_B)) + +/* TRUE if Start button is being held */ +#define INPUT_START (joy & J_START) + +/* TRUE if Select button is being held */ +#define INPUT_SELECT (joy & J_SELECT) + +/* TRUE on first frame that any button is pressed */ +#define INPUT_ANY_PRESSED (joy & ~last_joy) + +/* TRUE on first frame that left is pressed on dpad */ +#define INPUT_LEFT_PRESSED ((joy & ~last_joy) & J_LEFT) + +/* TRUE on first frame that right is pressed on dpad */ +#define INPUT_RIGHT_PRESSED ((joy & ~last_joy) & J_RIGHT) + +/* TRUE on first frame that up is pressed on dpad */ +#define INPUT_UP_PRESSED ((joy & ~last_joy) & J_UP) + +/* TRUE on first frame that down is pressed on dpad */ +#define INPUT_DOWN_PRESSED ((joy & ~last_joy) & J_DOWN) + +/* TRUE on first frame that button is pressed */ +#define INPUT_PRESSED(btn) ((joy & ~last_joy) & (btn)) + +/* TRUE on first frame that A button is pressed */ +#define INPUT_A_PRESSED ((joy & ~last_joy) & J_A) + +/* TRUE on first frame that B button is pressed */ +#define INPUT_B_PRESSED ((joy & ~last_joy) & J_B) + +/* TRUE on first frame that A OR B button is pressed */ +#define INPUT_A_OR_B_PRESSED ((joy & ~last_joy) & (J_A | J_B)) + +/* TRUE on first frame that Start button is pressed */ +#define INPUT_START_PRESSED ((joy & ~last_joy) & J_START) + +/* TRUE on first frame that Select button is pressed */ +#define INPUT_SELECT_PRESSED ((joy & ~last_joy) & J_SELECT) + +#define INPUT_SOFT_RESTART (joy == (J_A | J_B | J_START | J_SELECT)) + +/* resets the input */ +#define INPUT_RESET (last_joy = joy) + +#define NUM_INPUTS 8 + +#define INPUT_DPAD (J_UP | J_DOWN | J_LEFT | J_RIGHT) + + +extern joypads_t joypads; +extern UBYTE frame_joy; +extern UBYTE last_joy; +extern UBYTE recent_joy; + +void input_init(void) BANKED; +void input_update(void) NONBANKED; + +#endif diff --git a/src/include/interrupts.h b/src/include/interrupts.h new file mode 100644 index 0000000..68095e6 --- /dev/null +++ b/src/include/interrupts.h @@ -0,0 +1,14 @@ +#ifndef INTERRUPTS_H_INCLUDE +#define INTERRUPTS_H_INCLUDE + +extern UINT8 hide_sprites; +extern UBYTE show_actors_on_overlay; + +void simple_LCD_isr(void); +void fullscreen_LCD_isr(void); + +void VBL_isr(void); + +void remove_LCD_ISRs(void) BANKED; + +#endif \ No newline at end of file diff --git a/src/include/linked_list.h b/src/include/linked_list.h new file mode 100644 index 0000000..177e628 --- /dev/null +++ b/src/include/linked_list.h @@ -0,0 +1,94 @@ +#ifndef LINKED_LIST_H +#define LINKED_LIST_H + +// #define STRICT_LINKED_LIST + +#define LL_PUSH_HEAD(head, item) \ + (item)->next = (head); \ + (head) = (item) + +#define LL_REMOVE_ITEM(head, item, prev) \ + if (prev) { \ + (prev)->next = (item)->next; \ + } else { \ + (head) = (item)->next; \ + } + +#define LL_REMOVE_HEAD(head) \ + if (head) { \ + (head) = (head)->next; \ + } + +#define DL_PUSH_HEAD(head, item) \ + (item)->prev = 0; \ + (item)->next = (head); \ + if (head) { \ + (head)->prev = (item); \ + } \ + (head) = (item) + +#ifdef STRICT_LINKED_LIST +#define DL_REMOVE_ITEM(head, item) \ + if (head) { \ + /* Hook next to prev */ \ + if ((item)->next && (item)->prev) \ + { \ + /* Middle of list */ \ + (item)->prev->next = (item)->next; \ + (item)->next->prev = (item)->prev; \ + } \ + else if ((item)->next) \ + { \ + /* Start of list */ \ + (item)->next->prev = 0; \ + (head) = (item)->next; \ + } \ + else if ((item)->prev) \ + { \ + /* End of list */ \ + (item)->prev->next = 0; \ + } \ + else \ + { \ + (head) = 0; \ + } \ + (item)->next = (item)->prev = 0; \ + } +#else +#define DL_REMOVE_ITEM(head, item) \ + /* Hook next to prev */ \ + if ((item)->next && (item)->prev) \ + { \ + /* Middle of list */ \ + (item)->prev->next = (item)->next; \ + (item)->next->prev = (item)->prev; \ + } \ + else if ((item)->next) \ + { \ + /* Start of list */ \ + (item)->next->prev = 0; \ + (head) = (item)->next; \ + } \ + else if ((item)->prev) \ + { \ + /* End of list */ \ + (item)->prev->next = 0; \ + } \ + else \ + { \ + (head) = 0; \ + } +#endif + +#define DL_CONTAINS(head_mut, item, found) \ + (found) = 0; \ + while (head_mut) { \ + if ((head_mut) == (item)) \ + { \ + (found) = 1; \ + break; \ + } \ + (head_mut) = (head_mut)->next; \ + } + +#endif diff --git a/src/include/load_save.h b/src/include/load_save.h new file mode 100644 index 0000000..caebdb0 --- /dev/null +++ b/src/include/load_save.h @@ -0,0 +1,26 @@ +#ifndef _LOADSAVE_H_INCLUDE +#define _LOADSAVE_H_INCLUDE + +#include + +#define SRAM_BANKS_TO_SAVE 3 +#define SRAM_BANK_SIZE 0x2000 + +BANKREF_EXTERN(VM_LOAD_SAVE) + +// initializes saving capabilities +void data_init(void) BANKED; + +// save state to SRAM +void data_save(UBYTE slot) BANKED; + +// load state from SRAM +UBYTE data_load(UBYTE slot) BANKED; + +// clear state in SRAM +void data_clear(UBYTE slot) BANKED; + +// peek count VM variables from idx into dest +UBYTE data_peek(UBYTE slot, UINT16 idx, UWORD count, UINT16 * dest) BANKED; + +#endif \ No newline at end of file diff --git a/src/include/macro.h b/src/include/macro.h new file mode 100644 index 0000000..43c79e8 --- /dev/null +++ b/src/include/macro.h @@ -0,0 +1,10 @@ +#ifndef MACRO_H +#define MACRO_H + +// Bit Flags Helpers +#define SET_FLAG(n, f) ((n) |= (f)) +#define CLR_FLAG(n, f) ((n) &= ~(f)) +#define TGL_FLAG(n, f) ((n) ^= (f)) +#define CHK_FLAG(n, f) ((n) & (f)) + +#endif diff --git a/src/include/macro.i b/src/include/macro.i new file mode 100644 index 0000000..52c40e1 --- /dev/null +++ b/src/include/macro.i @@ -0,0 +1,17 @@ +.macro FAR_PTR SYM + .db b'SYM + .dw SYM +.endm +.macro IMPORT_FAR_PTR SYM + .globl SYM, b'SYM + FAR_PTR SYM +.endm + +.macro FAR_PTR_DATA SYM + .db ___bank'SYM + .dw SYM +.endm +.macro IMPORT_FAR_PTR_DATA SYM + .globl SYM, ___bank'SYM + FAR_PTR_DATA SYM +.endm diff --git a/src/include/math.h b/src/include/math.h new file mode 100644 index 0000000..7c64e25 --- /dev/null +++ b/src/include/math.h @@ -0,0 +1,121 @@ +#ifndef MATH_H +#define MATH_H + +#include + +#include +#include + +#include "asm/types.h" + +#define IS_NEG(a) ((uint8_t)(a)&0x80) + +#define U_LESS_THAN(A, B) ((A) - (B)&0x8000u) +#define UBYTE_LESS_THAN(A, B) ((A) - (B)&0x80u) + +#define U_GT_THAN(A, B) ((B) - (A)&0x8000u) +#define UBYTE_GT_THAN(A, B) ((B) - (A)&0x80u) + +#define DISTANCE(A, B) (U_LESS_THAN(A, B) ? (B - A) : (A - B)) + +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#define CLAMP(a, min, max) (((a) < (min)) ? (min) : (((a) > (max)) ? (max) : (a))) + +#define SET_BIT(N, POS) N |= 1 << POS +#define UNSET_BIT(N, POS) N &= ~(1 << POS) +#define GET_BIT(N, POS) ((N & (1 << POS)) != 0) + +#define SET_BIT_MASK(N, MASK) N |= MASK +#define UNSET_BIT_MASK(N, MASK) N &= ~MASK +#define GET_BIT_MASK(N, MASK) (N & MASK) + +#define MOD_2(a) ((a)&1) +#define MOD_4(a) ((a)&3) +#define MOD_8(a) ((a)&7) +#define MOD_16(a) ((a)&15) +#define MOD_32(a) ((a)&31) +#define MOD_64(a) ((a)&63) +#define MOD_128(a) ((a)&127) + +#define MUL_16(a) ((a) << 4) +#define MUL_8(a) ((a) << 3) +#define MUL_4(a) ((a) << 2) +#define MUL_2(a) ((a) << 1) + +#define DIV_16(a) ((a) >> 4) +#define DIV_8(a) ((a) >> 3) +#define DIV_4(a) ((a) >> 2) +#define DIV_2(a) ((a) >> 1) + +#define SIN(a) (sine_wave[(uint8_t)(a)]) +#define COS(a) (sine_wave[(uint8_t)((uint8_t)(a) + 64u)]) + +#define ANGLE_UP 0 +#define ANGLE_RIGHT 64 +#define ANGLE_DOWN 128 +#define ANGLE_LEFT 192 + +#define ANGLE_0DEG 0 +#define ANGLE_45DEG 32 +#define ANGLE_90DEG 64 +#define ANGLE_135DEG 96 +#define ANGLE_180DEG 128 +#define ANGLE_225DEG 160 +#define ANGLE_270DEG 192 +#define ANGLE_315DEG 224 + +#define FLIPPED_DIR(dir) MOD_4((dir) + 2) +#define IS_DIR_HORIZONTAL(dir) ((dir)&01) +#define IS_DIR_VERTICAL(dir) (!((dir)&01)) + +#define N_DIRECTIONS 4 + +typedef struct upoint16_t { + uint16_t x, y; +} upoint16_t; + +typedef struct point16_t { + int16_t x, y; +} point16_t; + +typedef struct point8_t { + int8_t x, y; +} point8_t; + +typedef enum { + DIR_DOWN = 0, + DIR_RIGHT, + DIR_UP, + DIR_LEFT, + DIR_NONE +} direction_e; + +extern const int8_t sine_wave[256]; +extern const point8_t dir_lookup[4]; +extern const uint8_t dir_angle_lookup[4]; + +inline void point_translate_dir(point16_t *point, direction_e dir, uint8_t speed) { + point->x += (int16_t)(dir_lookup[dir].x * speed); + point->y += (int16_t)(dir_lookup[dir].y * speed); +} + +inline void point_translate_dir_word(point16_t *point, direction_e dir, uint16_t speed) { + point->x += (int16_t)(dir_lookup[dir].x * speed); + point->y += (int16_t)(dir_lookup[dir].y * speed); +} + +inline void point_translate_angle(point16_t *point, uint8_t angle, uint8_t speed) { + point->x += ((SIN(angle) * (speed)) >> 7); + point->y -= ((COS(angle) * (speed)) >> 7); +} + +inline void point_translate_angle_to_delta(point16_t *point, uint8_t angle, uint8_t speed) { + point->x = ((SIN(angle) * (speed)) >> 7); + point->y = ((COS(angle) * (speed)) >> 7); +} + +uint8_t isqrt(uint16_t x) NONBANKED; +uint8_t atan2(int16_t y, int16_t x) BANKED; + +#endif diff --git a/src/include/music_manager.h b/src/include/music_manager.h new file mode 100644 index 0000000..97bd32f --- /dev/null +++ b/src/include/music_manager.h @@ -0,0 +1,126 @@ +#ifndef __MUSIC_MANAGER_H_INCLUDE__ +#define __MUSIC_MANAGER_H_INCLUDE__ + +#include "events.h" +#include "sfx_player.h" + +#ifdef GBT_PLAYER +#undef HUGE_TRACKER +#define TRACK_T uint8_t +#include "gbt_player.h" + +#define driver_reset_wave gbt_reset_ch3_instrument +#define driver_update gbt_update + +inline void driver_init(uint8_t bank, const TRACK_T * track, uint8_t loop) { + gbt_play(track, bank, 7); + gbt_loop(loop); +} + +inline uint8_t driver_set_mute_mask(uint8_t mute_mask) { + gbt_enable_channels(~mute_mask & 0x0f); + return mute_mask; +} + +inline void music_setpos(UBYTE pattern, UBYTE row) { + pattern, row; +} +#endif + +#ifdef HUGE_TRACKER +#undef GBT_PLAYER +#define TRACK_T hUGESong_t +#include "hUGEDriver.h" + +#define driver_reset_wave hUGE_reset_wave +#define driver_update hUGE_dosound + +inline void driver_init(uint8_t bank, const TRACK_T * track, uint8_t loop) { + bank; loop; + hUGE_init(track); +} + +inline uint8_t driver_set_mute_mask(uint8_t mute_mask) { + return (hUGE_mute_mask = mute_mask); +} + +inline void music_setpos(UBYTE pattern, UBYTE row) { + row; + hUGE_set_position(pattern); +} +#endif + +extern script_event_t music_events[4]; + +#define MUSIC_SFX_PRIORITY_MINIMAL 0 +#define MUSIC_SFX_PRIORITY_NORMAL 4 +#define MUSIC_SFX_PRIORITY_HIGH 8 + +#define MUSIC_STOP_BANK SFX_STOP_BANK +//#define FORCE_CUT_SFX // don't cut by default + +extern volatile uint8_t music_current_track_bank; +extern uint8_t music_mute_mask; +extern uint8_t music_effective_mute; +extern const TRACK_T * music_next_track; +extern const TRACK_T * music_current_track; +extern uint8_t music_global_mute_mask; +extern uint8_t music_sfx_priority; + +void music_init_driver(void) BANKED; + +void music_init_events(uint8_t preserve) BANKED; +void music_events_update(void) NONBANKED; +uint8_t music_events_poll(void) BANKED; + +inline void music_sound_cut(void) { + sfx_sound_cut(); +} + +#define MUSIC_CH_1 SFX_CH_1 +#define MUSIC_CH_2 SFX_CH_2 +#define MUSIC_CH_3 SFX_CH_3 +#define MUSIC_CH_4 SFX_CH_4 + +inline uint8_t music_sound_cut_mask(uint8_t mask) { + return sfx_sound_cut_mask(mask); +} + +void music_play_isr(void); + +inline void music_load(uint8_t bank, const TRACK_T * data) { + if ((bank == music_current_track_bank) && (data == music_current_track)) return; + music_current_track_bank = MUSIC_STOP_BANK, music_current_track = data, music_next_track = data; music_current_track_bank = bank; +} + +void music_pause(uint8_t pause); + +inline void music_stop(void) { + music_current_track_bank = MUSIC_STOP_BANK, music_sound_cut(); +} + +inline void music_setup_timer(void) { + TMA_REG = ((_cpu == CGB_TYPE) && (*(uint8_t *)0x0143 & 0x80)) ? 0x80u : 0xC0u; + TAC_REG = 0x07u; +} + +inline void music_init(void) { + music_current_track_bank = MUSIC_STOP_BANK; + sfx_reset_sample(); + sfx_sound_init(); + music_sound_cut(); +} + +#define MUTE_MASK_NONE 0 +#define MUTE_MASK_WAVE MUSIC_CH_3 + +inline void music_play_sfx(uint8_t bank, const uint8_t * sample, uint8_t mute_mask, uint8_t priority) { + if (priority < music_sfx_priority) return; + sfx_play_bank = SFX_STOP_BANK; + music_sfx_priority = priority; + music_sound_cut_mask(music_mute_mask); + music_mute_mask = mute_mask; + sfx_set_sample(bank, sample); +} + +#endif \ No newline at end of file diff --git a/src/include/palette.h b/src/include/palette.h new file mode 100644 index 0000000..0860d6a --- /dev/null +++ b/src/include/palette.h @@ -0,0 +1,26 @@ +#ifndef PALETTE_H +#define PALETTE_H + +#include + +#include "compat.h" +#include "gbs_types.h" + +extern UBYTE DMG_palette[3]; +extern palette_entry_t SprPalette[8]; +extern palette_entry_t BkgPalette[8]; + +void palette_init(void) BANKED; + +#ifdef CGB +void CGBZeroPalette(UBYTE reg) OLDCALL BANKED; +#endif + +#ifdef SGB +#define SGB_PALETTES_NONE 0 +#define SGB_PALETTES_01 1 +#define SGB_PALETTES_23 2 +void SGBTransferPalettes(UBYTE palettes) BANKED; +#endif + +#endif diff --git a/src/include/parallax.h b/src/include/parallax.h new file mode 100644 index 0000000..3901595 --- /dev/null +++ b/src/include/parallax.h @@ -0,0 +1,26 @@ +#ifndef PARALLAX_H_INCLUDE +#define PARALLAX_H_INCLUDE + +#include + +#include "compat.h" + +#define PARALLAX_MAX_HEIGHT 20 +#define PARALLAX_STEP(start, end, shift) {0, (end)?(((end) << 3) - 1):0, (shift), (start), (end)?((end)-(start)):(PARALLAX_MAX_HEIGHT-(start)), 0} + +typedef struct parallax_row_t { + UBYTE scx; // x scroll position for current slice + UBYTE next_y; // y position of next LYC + INT8 shift; // shift of scroll position within the world + UBYTE start_tile; + UBYTE tile_height; + UBYTE shadow_scx; +} parallax_row_t; + +extern parallax_row_t parallax_rows[3]; +extern parallax_row_t * parallax_row; + +void parallax_init(void) BANKED; +void parallax_LCD_isr(void) NONBANKED; + +#endif \ No newline at end of file diff --git a/src/include/projectiles.h b/src/include/projectiles.h new file mode 100644 index 0000000..036cdca --- /dev/null +++ b/src/include/projectiles.h @@ -0,0 +1,24 @@ +#ifndef PROJECTILES_H +#define PROJECTILES_H + +#include + +#include "math.h" +#include "collision.h" +#include "gbs_types.h" + +#define MAX_PROJECTILES 5 +#define MAX_PROJECTILE_DEFS 5 + +extern projectile_def_t projectile_defs[MAX_PROJECTILES]; + +void projectiles_init(void) BANKED; +void projectiles_update(void) NONBANKED; +void projectiles_render(void) NONBANKED; + +#define PROJECTILE_ANIM_NOLOOP 0x01 +#define PROJECTILE_STRONG 0x02 + +void projectile_launch(UBYTE index, point16_t *pos, UBYTE angle, UBYTE flags) BANKED; + +#endif diff --git a/src/include/rtc.h b/src/include/rtc.h new file mode 100644 index 0000000..7f104a9 --- /dev/null +++ b/src/include/rtc.h @@ -0,0 +1,51 @@ +#ifndef _RTC_H_INCLUDE +#define _RTC_H_INCLUDE + +#include + +#include "system.h" + +volatile UBYTE AT(0x4000) RTC_SELECT_REG; +volatile UBYTE AT(0x6000) RTC_LATCH_REG; +volatile UBYTE AT(0xA000) RTC_VALUE_REG; + +#define RTC_TIMER_STOP 0b01000000 + +typedef enum { + RTC_VALUE_SEC = 0x08, + RTC_VALUE_MIN, + RTC_VALUE_HOUR, + RTC_VALUE_DAY +} rtc_dateparts_e; + +#define RTC_VALUE_FLAGS 0x0c + +inline void RTC_SELECT(UBYTE what) { SWITCH_RAM_BANK(what, RAM_BANKS_ONLY); } +inline void RTC_LATCH(void) { RTC_LATCH_REG = 0; RTC_LATCH_REG = 1; } + +inline UWORD RTC_GET(const rtc_dateparts_e part) { + UWORD v; + RTC_SELECT(part); + v = RTC_VALUE_REG; + if (part == RTC_VALUE_DAY) { + RTC_SELECT(RTC_VALUE_FLAGS); + if (RTC_VALUE_REG & 0x01) v |= 0x0100u; + } + return v; +} + +inline void RTC_SET(const rtc_dateparts_e part, const UWORD v) { + RTC_SELECT(part); + RTC_VALUE_REG = v; + if (part == RTC_VALUE_DAY) { + RTC_SELECT(RTC_VALUE_FLAGS); + RTC_VALUE_REG = (RTC_VALUE_REG & 0x0e) | (UBYTE)((v >> 8) & 0x01); + } +} + +inline void RTC_START(const UBYTE start) { + RTC_SELECT(RTC_VALUE_FLAGS); + if (start) RTC_VALUE_REG &= ~RTC_TIMER_STOP; else RTC_VALUE_REG |= RTC_TIMER_STOP; +} + +#endif \ No newline at end of file diff --git a/src/include/scroll.h b/src/include/scroll.h new file mode 100644 index 0000000..e674b94 --- /dev/null +++ b/src/include/scroll.h @@ -0,0 +1,80 @@ +#ifndef SCROLL_H +#define SCROLL_H + +#include + +#include "compat.h" +#include "parallax.h" + +#define SCROLL_BANK 1 +#define SCREEN_TILES_W 20 // 160 >> 3 = 20 +#define SCREEN_TILES_H 18 // 144 >> 3 = 18 +#define SCREEN_PAD_LEFT 1 +#define SCREEN_PAD_RIGHT 2 +#define SCREEN_PAD_TOP 1 +#define SCREEN_PAD_BOTTOM 2 +#define SCREEN_TILE_REFRES_W (SCREEN_TILES_W + SCREEN_PAD_LEFT + SCREEN_PAD_RIGHT) +#define SCREEN_TILE_REFRES_H (SCREEN_TILES_H + SCREEN_PAD_TOP + SCREEN_PAD_BOTTOM) +#define PENDING_BATCH_SIZE 7 + +extern INT16 scroll_x; +extern INT16 scroll_y; +extern INT16 draw_scroll_x; +extern INT16 draw_scroll_y; +extern UINT16 scroll_x_max; +extern UINT16 scroll_y_max; +extern BYTE scroll_offset_x; +extern BYTE scroll_offset_y; +extern UINT8 pending_w_i; +extern UINT8 pending_h_i; + +/** + * Resets scroll settings on engine start + */ +void scroll_reset(void) BANKED; + +/** + * Initialise scroll variables, call on scene load + */ +void scroll_init(void) BANKED; + +/** + * Update scroll position and load in any newly visible background tiles and actors + */ +void scroll_update(void) BANKED; + +/** + * Resets scroll and update the whole screen + */ +void scroll_repaint(void) BANKED; + +/** + * Get base address of window map + */ +UINT8 * GetWinAddr(void) OLDCALL PRESERVES_REGS(b, c, h, l); + +/** + * Get base address of background map + */ +UINT8 * GetBkgAddr(void) OLDCALL PRESERVES_REGS(b, c, h, l); + +/** + * Scrolls rectangle area of VRAM filemap by base address 1 row up + * @param base_addr address of top-left corner + * @param w width of the area + * @param h height of the area + * @param fill tile id to fill the bottom row + */ +void scroll_rect(UBYTE * base_addr, UBYTE w, UBYTE h, UBYTE fill) OLDCALL BANKED PRESERVES_REGS(b, c); + +/** + * copies scroll position variables into double buffered copies + * which are used for actual scrolling next frame + */ +inline void scroll_shadow_update(void) { + parallax_rows[0].scx = parallax_rows[0].shadow_scx; + parallax_rows[1].scx = parallax_rows[1].shadow_scx; + parallax_rows[2].scx = parallax_rows[2].shadow_scx; +} + +#endif diff --git a/src/include/sfx_player.h b/src/include/sfx_player.h new file mode 100644 index 0000000..23e1fc0 --- /dev/null +++ b/src/include/sfx_player.h @@ -0,0 +1,51 @@ +#ifndef __SFX_PLAYER_H_INCLUDE__ +#define __SFX_PLAYER_H_INCLUDE__ + +#include +#include + +#define SFX_STOP_BANK 0xffu +#define SFX_MUTE_MASK(VARNAME) ( (uint8_t) & __mute_mask_ ## VARNAME ) + +extern volatile uint8_t sfx_play_bank; +extern const uint8_t * sfx_play_sample; +extern uint8_t sfx_frame_skip; + +#define SFX_CH_RETRIGGER 0b11000000 +#define SFX_CH_ENABLE 0b10000000 + +inline void sfx_sound_init(void) { + NR52_REG = SFX_CH_ENABLE, NR51_REG = 0xFF, NR50_REG = 0x77; // enable sound +} + +inline void sfx_sound_cut(void) { + NR12_REG = NR22_REG = NR32_REG = NR42_REG = 0; + NR14_REG = NR24_REG = NR44_REG = SFX_CH_RETRIGGER; + NR51_REG = 0xFF; +} + +#define SFX_CH_1 1 +#define SFX_CH_2 2 +#define SFX_CH_3 4 +#define SFX_CH_4 8 + +inline uint8_t sfx_sound_cut_mask(uint8_t mask) { + if (mask & SFX_CH_1) NR12_REG = 0, NR14_REG = SFX_CH_RETRIGGER; + if (mask & SFX_CH_2) NR22_REG = 0, NR24_REG = SFX_CH_RETRIGGER; + if (mask & SFX_CH_3) NR32_REG = 0; + if (mask & SFX_CH_4) NR42_REG = 0, NR44_REG = SFX_CH_RETRIGGER; + NR51_REG = 0xFF; + return mask; +} + +inline void sfx_reset_sample(void) { + sfx_play_bank = SFX_STOP_BANK, sfx_play_sample = NULL; +} + +inline void sfx_set_sample(uint8_t bank, const uint8_t * sample) { + sfx_play_bank = SFX_STOP_BANK, sfx_frame_skip = 0, sfx_play_sample = sample, sfx_play_bank = bank; +} + +uint8_t sfx_play_isr(void); + +#endif \ No newline at end of file diff --git a/src/include/sgb_border.h b/src/include/sgb_border.h new file mode 100644 index 0000000..1d1595c --- /dev/null +++ b/src/include/sgb_border.h @@ -0,0 +1,14 @@ +#ifndef __SGBBORDER_H_INCLUDE +#define __SGBBORDER_H_INCLUDE + +#include + +#define SNES_RGB(R,G,B) (UINT16)((B) << 10 | (G) << 5 | (R)) + +/** sets SGB border */ + +void set_sgb_border(unsigned char * tiledata, size_t tiledata_size, UBYTE tiledata_bank, + unsigned char * tilemap, size_t tilemap_size, UBYTE tilemap_bank, + unsigned char * palette, size_t palette_size, UBYTE palette_bank) BANKED; + +#endif \ No newline at end of file diff --git a/src/include/shadow.h b/src/include/shadow.h new file mode 100644 index 0000000..05f337c --- /dev/null +++ b/src/include/shadow.h @@ -0,0 +1,21 @@ +#ifndef _SHADOW_H_INCLUDE +#define _SHADOW_H_INCLUDE + +#include "actor.h" + +extern volatile OAM_item_t shadow_OAM2[40]; + +inline void toggle_shadow_OAM(void) { + if (_shadow_OAM_base == (UBYTE)((UWORD)&shadow_OAM >> 8)) { + __render_shadow_OAM = (UBYTE)((UWORD)&shadow_OAM2 >> 8); + } else { + __render_shadow_OAM = (UBYTE)((UWORD)&shadow_OAM >> 8); + } + allocated_hardware_sprites = 0; +} +inline void activate_shadow_OAM(void) { + hide_sprites_range(allocated_hardware_sprites, MAX_HARDWARE_SPRITES); + _shadow_OAM_base = __render_shadow_OAM; +} + +#endif \ No newline at end of file diff --git a/src/include/sio.h b/src/include/sio.h new file mode 100644 index 0000000..950ab10 --- /dev/null +++ b/src/include/sio.h @@ -0,0 +1,48 @@ +#ifndef _SIO_H_INCLUDE +#define _SIO_H_INCLUDE + +#include + +#include "compat.h" + +#define LINK_MAX_PACKET_LENGTH 32 + +#define LINK_MODE_NONE 0 +#define LINK_MODE_MASTER 1 +#define LINK_MODE_SLAVE 2 + +extern volatile UBYTE SIO_status; +void SIO_send_byte(UBYTE data) OLDCALL PRESERVES_REGS(b, c, d, e, h, l); +void SIO_receive(void) PRESERVES_REGS(b, c, d, e, h, l); + +extern UBYTE link_operation_mode; + +extern UBYTE link_packet[]; +extern UBYTE link_byte_sent; + +extern UBYTE link_packet_len; +extern UBYTE * link_packet_ptr; +extern UBYTE link_packet_received; + +extern UBYTE link_packet_snd_len; +extern const UBYTE * link_packet_snd_ptr; +extern UBYTE link_packet_sent; + +void SIO_init(void) BANKED; + +inline void SIO_set_mode(UBYTE mode) { + link_operation_mode = mode; + if (mode == LINK_MODE_SLAVE) { + SIO_receive(); + } +} + +inline void SIO_send_async(UBYTE len, const UBYTE * data) { + link_packet_snd_len = len; + link_packet_snd_ptr = data; + link_byte_sent = FALSE; + SIO_send_byte(len); + link_packet_sent = (link_packet_snd_len == 0); +} + +#endif diff --git a/src/include/states/logo.h b/src/include/states/logo.h new file mode 100644 index 0000000..7cd13d4 --- /dev/null +++ b/src/include/states/logo.h @@ -0,0 +1,9 @@ +#ifndef STATE_LOGO_H +#define STATE_LOGO_H + +#include + +void logo_init(void) BANKED; +void logo_update(void) BANKED; + +#endif diff --git a/src/include/states/topdown.h b/src/include/states/topdown.h new file mode 100644 index 0000000..dce7b8a --- /dev/null +++ b/src/include/states/topdown.h @@ -0,0 +1,11 @@ +#ifndef STATE_TOP_DOWN_H +#define STATE_TOP_DOWN_H + +#include + +void topdown_init(void) BANKED; +void topdown_update(void) BANKED; + +extern UBYTE topdown_grid; + +#endif diff --git a/src/include/states_caller.h b/src/include/states_caller.h new file mode 100644 index 0000000..dd34571 --- /dev/null +++ b/src/include/states_caller.h @@ -0,0 +1,9 @@ +#ifndef __STATESCALLER_H_INCLUDE +#define __STATESCALLER_H_INCLUDE + +#include + +void state_init(void); +void state_update(void); + +#endif \ No newline at end of file diff --git a/src/include/system.h b/src/include/system.h new file mode 100644 index 0000000..c2cd704 --- /dev/null +++ b/src/include/system.h @@ -0,0 +1,18 @@ +#ifndef _SYSTEM_H_INCLUDE +#define _SYSTEM_H_INCLUDE + +#include + +// System fields +extern UBYTE _is_CGB; +extern UBYTE _is_SGB; + +// SRAM bank switching with saving of state +extern volatile UBYTE _current_ram_bank; + +#define RAM_BANKS_ONLY 0x0fu +#define RAM_BANKS_AND_FLAGS 0xffu + +inline void SWITCH_RAM_BANK(UBYTE bank, UBYTE mask) { SWITCH_RAM(_current_ram_bank = ((_current_ram_bank & ~mask) | (bank & mask))); } + +#endif \ No newline at end of file diff --git a/src/include/trigger.h b/src/include/trigger.h new file mode 100644 index 0000000..204a260 --- /dev/null +++ b/src/include/trigger.h @@ -0,0 +1,51 @@ +#ifndef TRIGGER_H +#define TRIGGER_H + +#include + +#include "gbs_types.h" +#include "math.h" + +#define MAX_TRIGGERS 31 +#define MAX_ACTIVE_TRIGGERS 11 +#define NO_TRIGGER_COLLISON 0xFF + +extern trigger_t triggers[MAX_TRIGGERS]; +extern UBYTE triggers_len; + +/** + * Resets trigger collision flags on scene start + */ +void trigger_reset(void) BANKED; + +/** + * Find trigger at tile {tx,ty} + * + * @param tx Left tile + * @param ty Top tile + * @return tile index or NO_TRIGGER_COLLISON if not found + */ +UBYTE trigger_at_tile(UBYTE tx_a, UBYTE ty_a) BANKED; + +/** + * Run script for trigger specified trigger + * + * @param i Trigger index + */ +void trigger_interact(UBYTE i) BANKED; + +/** + * Run script for trigger at tile {tx,ty} if this tile was the + * most recently activated trigger tile don't reactivate + * (i.e. player must move to another tile first) + * + * @param tx Left tile + * @param ty Top tile + * @param force Force trigger to activate without changing tile + */ +UBYTE trigger_activate_at(UBYTE tx, UBYTE ty, UBYTE force) BANKED; + +UBYTE trigger_activate_at_intersection(bounding_box_t *bb, point16_t *offset, UBYTE force) BANKED; +UBYTE trigger_at_intersection(bounding_box_t *bb, point16_t *offset) BANKED; + +#endif diff --git a/src/include/ui.h b/src/include/ui.h new file mode 100644 index 0000000..ab3ef66 --- /dev/null +++ b/src/include/ui.h @@ -0,0 +1,116 @@ +#ifndef UI_H +#define UI_H + +#include + +#include "gbs_types.h" +#include "bankdata.h" + +#define MENU_CANCEL_LAST 1 +#define MENU_CANCEL_B 2 +#define MENU_SET_START 4 + +#define TEXT_BUFFER_START 0xCCu +#define TEXT_BUFFER_START_BANK1 0xC0u +#define TEXT_BUFFER_LEN ((UBYTE)(0x100 - TEXT_BUFFER_START)) +#define TEXT_BKG_FILL_W 0x00u +#define TEXT_BKG_FILL_B 0xffu +#define TEXT_MAX_LENGTH 255 + +#define UI_DEFAULT_PALETTE 7 + +#define MENU_OPEN_Y 112 +#define WIN_LEFT_X 7 +#define MENU_CLOSED_Y (UBYTE)(MAXWNDPOSY + 1U) +#define MENU_LAYOUT_INITIAL_X 88 +#define MENU_CANCEL_ON_LAST_OPTION 0x01U +#define MENU_CANCEL_ON_B_PRESSED 0x02U + +#define ui_bkg_tile 0x07u +#define ui_white_tile 0xC9u +#define ui_black_tile 0xCAu + +#define ui_cursor_tile 0xCBu +#define ui_bg_tile 0xC4u + +extern UBYTE win_pos_x, win_dest_pos_x; +extern UBYTE win_pos_y, win_dest_pos_y; +extern UBYTE win_speed; + +extern UBYTE text_drawn; + +#define TEXT_OPT_DEFAULT 0 +#define TEXT_OPT_PRESERVE_POS 1 + +extern UBYTE text_options; +extern UBYTE text_in_speed; +extern UBYTE text_out_speed; +extern UBYTE text_draw_speed; +extern UBYTE text_ff_joypad; +extern UBYTE text_ff; +extern UBYTE text_bkg_fill; + +extern unsigned char ui_text_data[TEXT_MAX_LENGTH]; + +#define UI_PRINT_LEFTTORIGHT 0 +#define UI_PRINT_RIGHTTOLEFT 1 + +extern UBYTE vwf_direction; +extern font_desc_t vwf_current_font_desc; +extern UBYTE vwf_current_font_bank; +extern UBYTE vwf_current_font_idx; +extern UBYTE vwf_tile_data[16 * 2]; + +extern UBYTE * text_render_base_addr; + +extern UBYTE * text_scroll_addr; +extern UBYTE text_scroll_width, text_scroll_height; +extern UBYTE text_scroll_fill; + +extern UBYTE text_sound_mask; +extern UBYTE text_sound_bank; +extern const UBYTE * text_sound_data; + +extern const UBYTE ui_time_masks[]; + +#ifdef CGB +extern UBYTE overlay_priority; +extern UBYTE text_palette; +#endif + +void ui_init(void) BANKED; +void ui_update(void) NONBANKED; // critical path, NONBANKED for speed + +void ui_load_tiles(void) BANKED; + +void ui_set_start_tile(UBYTE start_tile, UBYTE start_tile_bank) BANKED; + +#define UI_WAIT_WINDOW 1 +#define UI_WAIT_TEXT 2 +#define UI_WAIT_BTN_A 4 +#define UI_WAIT_BTN_B 8 +#define UI_WAIT_BTN_ANY 16 + +#define UI_DRAW_FRAME 1 +#define UI_AUTOSCROLL 2 + +#define UI_IN_SPEED -1 +#define UI_OUT_SPEED -2 +#define UI_SPEED_INSTANT -3 + +void ui_run_modal(UBYTE wait_flags) BANKED; // process UI until closed + +inline void ui_set_pos(UBYTE x, UBYTE y) { + win_pos_y = win_dest_pos_y = y; + win_pos_x = win_dest_pos_x = x; +} + +inline void ui_move_to(UBYTE x, UBYTE y, BYTE speed) { + win_dest_pos_y = y; + win_dest_pos_x = x; + if (speed == UI_SPEED_INSTANT) win_pos_y = y, win_pos_x = x; else win_speed = speed; +} + +UBYTE ui_run_menu(menu_item_t * start_item, UBYTE bank, UBYTE options, UBYTE count, UBYTE start_index) BANKED; + +#endif diff --git a/src/include/vm.h b/src/include/vm.h new file mode 100644 index 0000000..ca9e099 --- /dev/null +++ b/src/include/vm.h @@ -0,0 +1,183 @@ +#ifndef _VM_H_INCLUDE +#define _VM_H_INCLUDE + +#include +#include + +#ifdef VM_DEBUG_OUTPUT + #include +#endif + +#include "compat.h" + +BANKREF_EXTERN(VM_MAIN) + +#define FN_ARG0 -1 +#define FN_ARG1 -2 +#define FN_ARG2 -3 +#define FN_ARG3 -4 +#define FN_ARG4 -5 +#define FN_ARG5 -6 +#define FN_ARG6 -7 +#define FN_ARG7 -8 + +#if defined(NINTENDO) +#define STEP_FUNC_ATTR +typedef UWORD DUMMY0_t; +typedef UWORD DUMMY1_t; +#elif defined(SEGA) +#define STEP_FUNC_ATTR Z88DK_FASTCALL +typedef UBYTE DUMMY0_t; +typedef UWORD DUMMY1_t; +#endif + +typedef void * SCRIPT_CMD_FN; + +typedef struct SCRIPT_CMD { + SCRIPT_CMD_FN fn; + UBYTE fn_bank; + UBYTE args_len; +} SCRIPT_CMD; + +#define FAR_CALL_EX(addr, seg, typ, ...) (__call_banked_addr=(addr),__call_banked_bank=(seg),((typ)(&__call__banked))(__VA_ARGS__)) +typedef UBYTE (*SCRIPT_UPDATE_FN)(void * THIS, UBYTE start, UWORD * stack_frame) OLDCALL BANKED; + +#define VM_REF_TO_PTR(idx) (void *)(((idx) < 0) ? THIS->stack_ptr + (idx) : script_memory + (idx)) +#define VM_GLOBAL(idx) script_memory[(idx)] + +typedef struct SCRIPT_CTX { + const UBYTE * PC; + UBYTE bank; + // linked list of contexts for the multitasking + struct SCRIPT_CTX * next; + // update function + void * update_fn; + UBYTE update_fn_bank; + // VM stack pointer + UWORD * stack_ptr; + UWORD * base_addr; + // thread control + UBYTE ID; + UWORD * hthread; + UBYTE terminated; + // waitable state + UBYTE waitable; + UBYTE lock_count; + UBYTE flags; +} SCRIPT_CTX; + +#define INSTRUCTION_SIZE 1 + +// maximum number of concurrent running VM threads +#define VM_MAX_CONTEXTS 16 +// stack size of each VM thread +#define VM_CONTEXT_STACK_SIZE 64 +// number of shared variables +#define VM_HEAP_SIZE 768 +// quant size +#define INSTRUCTIONS_PER_QUANT 0x10 +// termination flag +#define SCRIPT_TERMINATED 0x8000 + +// logical operators +#define VM_OP_EQ 1 +#define VM_OP_LT 2 +#define VM_OP_LE 3 +#define VM_OP_GT 4 +#define VM_OP_GE 5 +#define VM_OP_NE 6 +#define VM_OP_AND 7 +#define VM_OP_OR 8 +#define VM_OP_NOT 9 + +// shared context memory +extern UWORD script_memory[VM_HEAP_SIZE + (VM_MAX_CONTEXTS * VM_CONTEXT_STACK_SIZE)]; // maximum stack depth is 16 words + +// contexts for executing scripts +// ScriptRunnerInit(), ExecuteScript(), ScriptRunnerUpdate() manipulate these contexts +extern SCRIPT_CTX CTXS[VM_MAX_CONTEXTS]; +extern SCRIPT_CTX * first_ctx, * free_ctxs; +// context pointers for script_runner +extern SCRIPT_CTX * old_executing_ctx, * executing_ctx; + +// lock state +extern UBYTE vm_lock_state; +// loaded state +extern UBYTE vm_loaded_state; +// exception flag and parameters +extern UBYTE vm_exception_code; +extern UBYTE vm_exception_params_length; +extern UBYTE vm_exception_params_bank; +extern const void * vm_exception_params_offset; + +// script core functions +void vm_push(SCRIPT_CTX * THIS, UWORD value) OLDCALL BANKED; +UWORD vm_pop(SCRIPT_CTX * THIS, UBYTE n) OLDCALL BANKED; +void vm_call(SCRIPT_CTX * THIS, UBYTE * pc) OLDCALL BANKED; +void vm_ret(SCRIPT_CTX * THIS, UBYTE n) OLDCALL BANKED; +void vm_call_far(SCRIPT_CTX * THIS, UBYTE bank, UBYTE * pc) OLDCALL BANKED; +void vm_ret_far(SCRIPT_CTX * THIS, UBYTE n) OLDCALL BANKED; +void vm_loop(SCRIPT_CTX * THIS, INT16 idx, UINT8 * pc, UBYTE n) OLDCALL BANKED; +void vm_switch(DUMMY0_t dummy0, DUMMY1_t dummy1, SCRIPT_CTX * THIS, INT16 idx, UBYTE size, UBYTE n) OLDCALL NONBANKED; +void vm_jump(SCRIPT_CTX * THIS, UBYTE * pc) OLDCALL BANKED; +void vm_invoke(SCRIPT_CTX * THIS, UBYTE bank, UBYTE * fn, UBYTE nparams, INT16 idx) OLDCALL BANKED; +void vm_beginthread(DUMMY0_t dummy0, DUMMY1_t dummy1, SCRIPT_CTX * THIS, UBYTE bank, UBYTE * pc, INT16 idx, UBYTE nargs) OLDCALL NONBANKED; +void vm_if(SCRIPT_CTX * THIS, UBYTE condition, INT16 idxA, INT16 idxB, UBYTE * pc, UBYTE n) OLDCALL BANKED; +void vm_if_const(SCRIPT_CTX * THIS, UBYTE condition, INT16 idxA, INT16 B, UBYTE * pc, UBYTE n) OLDCALL BANKED; +void vm_push_value(SCRIPT_CTX * THIS, INT16 idx) OLDCALL BANKED; +void vm_push_value_ind(SCRIPT_CTX * THIS, INT16 idx) OLDCALL BANKED; +void vm_push_reference(SCRIPT_CTX * THIS, INT16 idx) OLDCALL BANKED; +void vm_reserve(SCRIPT_CTX * THIS, INT8 ofs) OLDCALL BANKED; +void vm_set(SCRIPT_CTX * THIS, INT16 idxA, INT16 idxB) OLDCALL BANKED; +void vm_set_const(SCRIPT_CTX * THIS, INT16 idx, UWORD value) OLDCALL BANKED; +void vm_rpn(DUMMY0_t dummy0, DUMMY1_t dummy1, SCRIPT_CTX * THIS) OLDCALL NONBANKED; +void vm_join(SCRIPT_CTX * THIS, INT16 idx) OLDCALL BANKED; +void vm_terminate(SCRIPT_CTX * THIS, INT16 idx) OLDCALL BANKED; +void vm_idle(SCRIPT_CTX * THIS) OLDCALL BANKED; +void vm_get_tlocal(SCRIPT_CTX * THIS, INT16 idxA, INT16 idxB) OLDCALL BANKED; +void vm_get_far(DUMMY0_t dummy0, DUMMY1_t dummy1, SCRIPT_CTX * THIS, INT16 idxA, UBYTE size, UBYTE bank, UBYTE * addr) OLDCALL NONBANKED; +void vm_init_rng(SCRIPT_CTX * THIS, INT16 idx) OLDCALL BANKED; +void vm_rand(SCRIPT_CTX * THIS, INT16 idx, UINT16 min, UINT16 limit) OLDCALL BANKED; +void vm_lock(SCRIPT_CTX * THIS) OLDCALL BANKED; +void vm_unlock(SCRIPT_CTX * THIS) OLDCALL BANKED; +void vm_raise(SCRIPT_CTX * THIS, UBYTE code, UBYTE size) OLDCALL BANKED; +void vm_set_indirect(SCRIPT_CTX * THIS, INT16 idxA, INT16 idxB) OLDCALL BANKED; +void vm_get_indirect(SCRIPT_CTX * THIS, INT16 idxA, INT16 idxB) OLDCALL BANKED; +void vm_test_terminate(SCRIPT_CTX * THIS, UBYTE flags) OLDCALL BANKED; +void vm_poll_loaded(SCRIPT_CTX * THIS, INT16 idx) OLDCALL BANKED; +void vm_call_native(DUMMY0_t dummy0, DUMMY1_t dummy1, SCRIPT_CTX * THIS, UINT8 bank, const void * ptr) OLDCALL NONBANKED; +void vm_memset(SCRIPT_CTX * THIS, INT16 idx, INT16 value, INT16 count) OLDCALL BANKED; +void vm_memcpy(SCRIPT_CTX * THIS, INT16 idxA, INT16 idxB, INT16 count) OLDCALL BANKED; + +// return zero if script end +// bank with VM code must be active +UBYTE VM_STEP(SCRIPT_CTX * CTX) NAKED NONBANKED STEP_FUNC_ATTR; + +// return TRUE if VM is in locked state +inline UBYTE VM_ISLOCKED(void) { + return (vm_lock_state != 0); +} + +// enable check for pointer in script_execute(), disabled by default +// #define SAFE_SCRIPT_EXECUTE + +// initialize script runner contexts +void script_runner_init(UBYTE reset) BANKED; +// execute a script in the new allocated context +SCRIPT_CTX * script_execute(UBYTE bank, UBYTE * pc, UWORD * handle, UBYTE nargs, ...) BANKED; +// terminate script by ID; returns non zero if no such thread is running +UBYTE script_terminate(UBYTE ID) BANKED; +// detach script from the monitoring variable +UBYTE script_detach_hthread(UBYTE ID) BANKED; + +#define RUNNER_DONE 0 +#define RUNNER_IDLE 1 +#define RUNNER_BUSY 2 +#define RUNNER_EXCEPTION 3 + +#define EXCEPTION_CODE_NONE 0 + +// process all contexts +UBYTE script_runner_update(void) NONBANKED; + +#endif \ No newline at end of file diff --git a/src/include/vm.i b/src/include/vm.i new file mode 100644 index 0000000..c18db59 --- /dev/null +++ b/src/include/vm.i @@ -0,0 +1,1667 @@ +; bytecode +; calling convention +; args: big-endian +; order: left-to-right (leftmost argument pushed first) + +; exception ID's +EXCEPTION_RESET = 1 +EXCEPTION_CHANGE_SCENE = 2 +EXCEPTION_SAVE = 3 +EXCEPTION_LOAD = 4 + +; aliases +.ARG0 = -1 +.ARG1 = -2 +.ARG2 = -3 +.ARG3 = -4 +.ARG4 = -5 +.ARG5 = -6 +.ARG6 = -7 +.ARG7 = -8 +.ARG8 = -9 +.ARG9 = -10 +.ARG10 = -11 +.ARG11 = -12 +.ARG12 = -13 +.ARG13 = -14 +.ARG14 = -15 +.ARG15 = -16 +.ARG16 = -17 + +.PARAM0 = .ARG2 +.PARAM1 = .ARG3 +.PARAM2 = .ARG4 +.PARAM3 = .ARG5 +.PARAM4 = .ARG6 +.PARAM5 = .ARG7 +.PARAM6 = .ARG8 +.PARAM7 = .ARG9 +.PARAM8 = .ARG10 +.PARAM9 = .ARG11 +.PARAM10 = .ARG12 +.PARAM11 = .ARG13 +.PARAM12 = .ARG14 +.PARAM13 = .ARG15 +.PARAM14 = .ARG16 +.PARAM15 = -18 +.PARAM16 = -19 + +; ------------------------------------------------------ +; @section Core + +OP_VM_STOP = 0x00 +;-- Stops execution of context. +.macro VM_STOP + .db OP_VM_STOP +.endm + +OP_VM_PUSH_CONST = 0x01 +;-- Pushes immediate value to the top of the VM stack. +; @param VAL Immediate value to be pushed. +.macro VM_PUSH_CONST VAL + .db OP_VM_PUSH_CONST, #>VAL, #ADDR, #ADDR, #IDX, #LABEL, #IDX, #IDX, #LABEL, #