Tsuchinoko Real?!

This commit is contained in:
fate6 2024-12-29 15:39:10 -08:00
parent 4c25ed9a98
commit 661f983e1d
906 changed files with 57143 additions and 0 deletions

View file

@ -0,0 +1,8 @@
{
"_resourceType": "project",
"name": "Slightys Midnight Adventure",
"author": "fate6",
"notes": "",
"_version": "4.1.0",
"_release": "1"
}

View file

@ -0,0 +1,8 @@
{
"_resourceType": "project",
"name": "Slightys Midnight Adventure",
"author": "fate6",
"notes": "",
"_version": "4.1.0",
"_release": "1"
}

View file

@ -0,0 +1,3 @@
Place 16x16 .png files in this folder to use them as avatars in your dialogues
Docs: https://www.gbstudio.dev/docs/assets/ui-elements#avatars

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

View file

@ -0,0 +1,3 @@
Place .png files in this folder to use them as backgrounds for your scenes
Docs: https://www.gbstudio.dev/docs/assets/backgrounds

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -0,0 +1,3 @@
Place 16x16 .png files in this folder to use them as emotes in your game
Docs: https://www.gbstudio.dev/docs/assets/ui-elements#emotes

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

View file

@ -0,0 +1,3 @@
Place .png and .json mapping files in this folder to use them as fonts in your dialogues
Docs: https://www.gbstudio.dev/docs/settings/#ui-elements--fonts

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,4 @@
{
"name": "GBS Mono",
"mapping": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -0,0 +1,4 @@
{
"name": "GBS Variable Width",
"mapping": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,3 @@
Place .uge and .mod files in this folder to use them as music in your game
Docs: https://www.gbstudio.dev/docs/assets/music/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,3 @@
Place .wav, .sav or .vgm files in this folder to use them as sound effects in your game
Docs: https://www.gbstudio.dev/docs/assets/sound-effects

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,3 @@
Place .png files in this folder to use them as sprites for your game's actors
Docs: https://www.gbstudio.dev/docs/assets/sprites

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

@ -0,0 +1,3 @@
Place .png files in this folder to use them as tilesets for your game
Docs: https://www.gbstudio.dev/docs/assets/tilesets

View file

@ -0,0 +1,3 @@
Place .png files in this folder to use them as UI elements of your game
Docs: https://www.gbstudio.dev/docs/assets/ui-elements

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

29
gb_studio_project/build/src/.gitignore vendored Normal file
View file

@ -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

View file

@ -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 $@ $<

View file

@ -0,0 +1 @@
settings: CGB hUGE MBC5

View file

@ -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

View file

@ -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"]
}
]
}

View file

@ -0,0 +1,81 @@
#ifndef ACTOR_H
#define ACTOR_H
#include <gbdk/platform.h>
#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

View file

@ -0,0 +1,147 @@
#ifndef BANK_DATA_H
#define BANK_DATA_H
#include <gbdk/platform.h>
#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

View file

@ -0,0 +1,32 @@
#ifndef CAMERA_H
#define CAMERA_H
#include <gbdk/platform.h>
#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

View file

@ -0,0 +1,71 @@
#ifndef COLLISIONS_H
#define COLLISIONS_H
#include <gbdk/platform.h>
#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

View file

@ -0,0 +1,47 @@
#ifndef _COMPAT_H_INCLUDE
#define _COMPAT_H_INCLUDE
#include <gbdk/platform.h>
#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

View file

@ -0,0 +1,9 @@
#ifndef _CORE_H_INCLUDE
#define _CORE_H_INCLUDE
#include <gbdk/platform.h>
void core_reset(void) BANKED;
void core_run(void) BANKED;
#endif

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

Some files were not shown because too many files have changed in this diff Show more