Skip to content

Commit

Permalink
Decouple vanilla objects in a separate bank
Browse files Browse the repository at this point in the history
  • Loading branch information
aglab2 committed May 2, 2024
1 parent 8bc5dd7 commit 305a18a
Show file tree
Hide file tree
Showing 865 changed files with 5,186 additions and 3,823 deletions.
135 changes: 75 additions & 60 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -528,21 +528,26 @@ assets/demos/pss.bin
assets/demos/unused.bin
assets/demos/wf.bin
levels/bbh/0.rgba16.png
actors_vanilla/bbh/0.rgba16.png
levels/bbh/1.rgba16.png
levels/bbh/2.rgba16.png
levels/bbh/3.rgba16.png
levels/bbh/4.rgba16.png
levels/bbh/5.rgba16.png
levels/bbh/6.rgba16.png
actors_vanilla/bbh/4.rgba16.png
actors_vanilla/bbh/5.rgba16.png
actors_vanilla/bbh/6.rgba16.png
actors_vanilla/bitdw/0.rgba16.png
levels/bitdw/0.rgba16.png
levels/bitdw/1.rgba16.png
levels/bitdw/2.rgba16.png
levels/bitdw/3.rgba16.png
actors_vanilla/bitfs/0.rgba16.png
levels/bitfs/0.rgba16.png
actors_vanilla/bitfs/1.rgba16.png
levels/bitfs/1.rgba16.png
levels/bitfs/2.rgba16.png
levels/bits/0.rgba16.png
levels/bits/1.rgba16.png
actors_vanilla/bits/2.rgba16.png
levels/bits/2.rgba16.png
levels/bob/0.rgba16.png
levels/bob/1.rgba16.png
Expand All @@ -559,9 +564,9 @@ levels/bowser_3/2.rgba16.png
levels/castle_grounds/0.rgba16.png
levels/castle_grounds/1.rgba16.png
levels/castle_grounds/2.rgba16.png
levels/castle_grounds/3.rgba16.png
levels/castle_grounds/4.rgba16.png
levels/castle_grounds/5.ia8.png
actors_vanilla/castle_grounds/3.rgba16.png
actors_vanilla/castle_grounds/4.rgba16.png
actors_vanilla/castle_grounds/5.ia8.png
levels/castle_inside/1.rgba16.png
levels/castle_inside/10.rgba16.png
levels/castle_inside/11.rgba16.png
Expand Down Expand Up @@ -599,22 +604,25 @@ levels/castle_inside/38.rgba16.png
levels/castle_inside/39.rgba16.png
levels/castle_inside/4.rgba16.png
levels/castle_inside/40.rgba16.png
levels/castle_inside/5.rgba16.png
levels/castle_inside/6.rgba16.png
levels/castle_inside/7.rgba16.png
actors_vanilla/castle_inside/5.rgba16.png
actors_vanilla/castle_inside/6.rgba16.png
actors_vanilla/castle_inside/7.rgba16.png
levels/castle_inside/8.rgba16.png
levels/castle_inside/9.rgba16.png
actors_vanilla/castle_inside/castle_light.ia16.png
levels/castle_inside/castle_light.ia16.png
levels/ccm/0.rgba16.png
levels/ccm/1.rgba16.png
actors_vanilla/ccm/1.rgba16.png
levels/ccm/10.rgba16.png
levels/ccm/11.rgba16.png
levels/ccm/12.rgba16.png
actors_vanilla/ccm/12.rgba16.png
levels/ccm/2.rgba16.png
levels/ccm/3.rgba16.png
actors_vanilla/ccm/2.rgba16.png
actors_vanilla/ccm/3.rgba16.png
levels/ccm/4.rgba16.png
levels/ccm/5.rgba16.png
levels/ccm/6.rgba16.png
actors_vanilla/ccm/5.rgba16.png
actors_vanilla/ccm/6.rgba16.png
levels/ccm/7.rgba16.png
levels/ccm/8.ia16.png
levels/ccm/9.ia16.png
Expand All @@ -623,11 +631,12 @@ levels/cotmc/1.rgba16.png
levels/cotmc/2.rgba16.png
levels/cotmc/3.rgba16.png
levels/cotmc/4.rgba16.png
levels/ddd/0.rgba16.png
actors_vanilla/ddd/0.rgba16.png
levels/ddd/1.rgba16.png
levels/ddd/2.rgba16.png
actors_vanilla/ddd/2.rgba16.png
levels/ddd/3.rgba16.png
levels/ddd/4.rgba16.png
actors_vanilla/ddd/4.rgba16.png
levels/ending/cake.png
levels/ending/cake_eu.png
levels/ending/eu_023000.rgba16.png
Expand All @@ -639,10 +648,10 @@ levels/ending/eu_028000.rgba16.png
levels/hmc/0.rgba16.png
levels/hmc/1.rgba16.png
levels/hmc/2.rgba16.png
levels/hmc/3.rgba16.png
levels/hmc/4.rgba16.png
levels/hmc/5.rgba16.png
levels/hmc/6.rgba16.png
actors_vanilla/hmc/3.rgba16.png
actors_vanilla/hmc/4.rgba16.png
actors_vanilla/hmc/5.rgba16.png
actors_vanilla/hmc/6.rgba16.png
levels/hmc/7.rgba16.png
levels/intro/0.rgba16.png
levels/intro/1.rgba16.png
Expand All @@ -653,40 +662,41 @@ levels/intro/3_sh_tm.rgba16.png
levels/intro/3_tm.rgba16.png
levels/jrb/0.rgba16.png
levels/jrb/1.rgba16.png
levels/jrb/2.rgba16.png
levels/jrb/3.rgba16.png
levels/lll/0.rgba16.png
levels/lll/1.rgba16.png
levels/lll/10.rgba16.png
levels/lll/11.rgba16.png
levels/lll/12.rgba16.png
levels/lll/13.rgba16.png
levels/lll/14.rgba16.png
levels/lll/15.rgba16.png
levels/lll/16.rgba16.png
levels/lll/17.rgba16.png
levels/lll/18.rgba16.png
levels/lll/19.rgba16.png
levels/lll/2.rgba16.png
levels/lll/20.rgba16.png
levels/lll/21.rgba16.png
levels/lll/22.rgba16.png
levels/lll/23.rgba16.png
levels/lll/24.rgba16.png
levels/lll/25.rgba16.png
actors_vanilla/jrb/2.rgba16.png
actors_vanilla/jrb/3.rgba16.png
actors_vanilla/lll/0.rgba16.png
actors_vanilla/lll/1.rgba16.png
actors_vanilla/lll/10.rgba16.png
actors_vanilla/lll/11.rgba16.png
actors_vanilla/lll/12.rgba16.png
actors_vanilla/lll/13.rgba16.png
actors_vanilla/lll/14.rgba16.png
actors_vanilla/lll/15.rgba16.png
actors_vanilla/lll/16.rgba16.png
actors_vanilla/lll/17.rgba16.png
actors_vanilla/lll/18.rgba16.png
actors_vanilla/lll/19.rgba16.png
actors_vanilla/lll/2.rgba16.png
actors_vanilla/lll/20.rgba16.png
actors_vanilla/lll/21.rgba16.png
actors_vanilla/lll/22.rgba16.png
actors_vanilla/lll/23.rgba16.png
actors_vanilla/lll/24.rgba16.png
actors_vanilla/lll/25.rgba16.png
levels/lll/26.rgba16.png
levels/lll/27.ia16.png
levels/lll/28.rgba16.png
levels/lll/29.rgba16.png
actors_vanilla/lll/29.rgba16.png
levels/lll/3.rgba16.png
levels/lll/30.rgba16.png
levels/lll/31.rgba16.png
levels/lll/32.rgba16.png
levels/lll/4.rgba16.png
levels/lll/5.rgba16.png
levels/lll/6.rgba16.png
actors_vanilla/lll/6.rgba16.png
levels/lll/7.rgba16.png
levels/lll/8.rgba16.png
actors_vanilla/lll/8.rgba16.png
levels/lll/9.rgba16.png
levels/menu/main_menu_seg7.00018.rgba16.png
levels/menu/main_menu_seg7.00818.rgba16.png
Expand Down Expand Up @@ -921,59 +931,64 @@ levels/menu/main_menu_seg7_us.0B800.ia8.png
levels/pss/0.rgba16.png
levels/pss/1.ia16.png
levels/pss/2.rgba16.png
levels/rr/1.rgba16.png
actors_vanilla/rr/1.rgba16.png
levels/rr/2.rgba16.png
levels/rr/quarter_flying_carpet.rgba16.png
actors_vanilla/rr/quarter_flying_carpet.rgba16.png
levels/sl/0.rgba16.png
levels/sl/1.rgba16.png
levels/sl/2.rgba16.png
actors_vanilla/sl/2.rgba16.png
levels/sl/3.rgba16.png
levels/sl/4.rgba16.png
levels/ssl/0.rgba16.png
levels/ssl/1.ia16.png
levels/ssl/10.rgba16.png
levels/ssl/11.rgba16.png
actors_vanilla/ssl/10.rgba16.png
actors_vanilla/ssl/11.rgba16.png
levels/ssl/2.rgba16.png
levels/ssl/3.rgba16.png
levels/ssl/4.rgba16.png
levels/ssl/5.rgba16.png
levels/ssl/6.rgba16.png
actors_vanilla/ssl/5.rgba16.png
actors_vanilla/ssl/6.rgba16.png
levels/ssl/7.rgba16.png
levels/ssl/8.rgba16.png
levels/ssl/9.rgba16.png
actors_vanilla/ssl/8.rgba16.png
actors_vanilla/ssl/9.rgba16.png
levels/thi/0.rgba16.png
levels/thi/1.rgba16.png
actors_vanilla/thi/1.rgba16.png
levels/totwc/0.rgba16.png
levels/totwc/1.rgba16.png
levels/totwc/2.rgba16.png
levels/totwc/3.ia16.png
levels/ttc/0.rgba16.png
actors_vanilla/ttc/0.rgba16.png
actors_vanilla/ttc/1.rgba16.png
levels/ttc/1.rgba16.png
levels/ttc/2.rgba16.png
levels/ttm/0.ia16.png
levels/ttm/1.rgba16.png
levels/ttm/2.rgba16.png
levels/ttm/3.rgba16.png
levels/ttm/4.rgba16.png
actors_vanilla/ttm/4.rgba16.png
levels/ttm/5.rgba16.png
levels/ttm/6.rgba16.png
levels/ttm/7.rgba16.png
levels/ttm/8.rgba16.png
actors_vanilla/ttm/8.rgba16.png
levels/vcutm/0.rgba16.png
levels/vcutm/1.rgba16.png
levels/vcutm/2.rgba16.png
actors_vanilla/vcutm/2.rgba16.png
levels/vcutm/3.rgba16.png
levels/wdw/0.rgba16.png
levels/wdw/1.rgba16.png
levels/wdw/2.rgba16.png
levels/wdw/3.rgba16.png
actors_vanilla/wdw/1.rgba16.png
actors_vanilla/wdw/2.rgba16.png
actors_vanilla/wdw/3.rgba16.png
levels/wdw/4.rgba16.png
actors_vanilla/wf/0.rgba16.png
levels/wf/0.rgba16.png
levels/wf/1.rgba16.png
actors_vanilla/wf/2.rgba16.png
levels/wf/2.rgba16.png
levels/wf/3.rgba16.png
levels/wf/4.rgba16.png
levels/wf/5.ia8.png
actors_vanilla/wf/3.rgba16.png
actors_vanilla/wf/4.rgba16.png
actors_vanilla/wf/5.ia8.png
levels/wmotr/0.rgba16.png
levels/wmotr/1.rgba16.png
levels/wmotr/2.rgba16.png
Expand Down
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ SOUND_BIN_DIR := $(BUILD_DIR)/sound
TEXTURE_DIR := textures
ACTOR_DIR := actors
LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h)))
VNL_ACTRS_DIRS := $(patsubst actors_vanilla/%,%,$(dir $(wildcard actors_vanilla/*/header.h)))

# Directories containing source files
SRC_DIRS += src src/boot src/game src/engine src/audio src/menu src/buffers actors levels bin data assets asm lib sound
Expand All @@ -392,7 +393,8 @@ include Makefile.split

# Source code files
LEVEL_C_FILES := $(wildcard levels/*/leveldata.c) $(wildcard levels/*/script.c) $(wildcard levels/*/geo.c)
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) $(LEVEL_C_FILES)
VNL_ACTRS_C_FILES := $(wildcard actors_vanilla/*/data.c) $(wildcard actors_vanilla/*/geo.c)
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) $(LEVEL_C_FILES) $(VNL_ACTRS_C_FILES)
CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp))
LIBZ_C_FILES := $(foreach dir,$(LIBZ_SRC_DIRS),$(wildcard $(dir)/*.c))
GODDARD_C_FILES := $(foreach dir,$(GODDARD_SRC_DIRS),$(wildcard $(dir)/*.c))
Expand Down Expand Up @@ -662,7 +664,7 @@ $(BUILD_DIR)/src/game/rendering_graph_node.o: OPT_FLAGS := $(GRAPH_NODE_OPT_FLAG
# $(info MATH_UTIL_OPT_FLAGS: $(MATH_UTIL_OPT_FLAGS))
# $(info GRAPH_NODE_OPT_FLAGS: $(GRAPH_NODE_OPT_FLAGS))

ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) asm/debug $(GODDARD_SRC_DIRS) $(LIBZ_SRC_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) rsp include) $(YAY0_DIR) $(addprefix $(YAY0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION)
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) asm/debug $(GODDARD_SRC_DIRS) $(LIBZ_SRC_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) $(addprefix actors_vanilla/,$(VNL_ACTRS_DIRS)) rsp include) $(YAY0_DIR) $(addprefix $(YAY0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION)

# Make sure build directory exists before compiling anything
DUMMY != mkdir -p $(ALL_DIRS)
Expand Down Expand Up @@ -711,6 +713,11 @@ $(LEVEL_ELF_FILES): $(BUILD_DIR)/levels/%/leveldata.elf: $(BUILD_DIR)/levels/%/l
$(call print,Linking ELF file:,$<,$@)
$(V)$(LD) -e 0 -Ttext=$(SEGMENT_ADDRESS) -Map $@.map --just-symbols=$(BUILD_DIR)/bin/$(TEXTURE_BIN).elf -o $@ $<

.SECONDEXPANSION:
$(VANILLA_ACTORS_ELF_FILES): $(BUILD_DIR)/actors_vanilla/%/data.elf: $(BUILD_DIR)/actors_vanilla/%/data.o $(BUILD_DIR)/bin/$$(TEXTURE_BIN).elf
$(call print,Linking ELF file:,$<,$@)
$(V)$(LD) -e 0 -Ttext=$(SEGMENT_ADDRESS) -Map $@.map --just-symbols=$(BUILD_DIR)/bin/$(TEXTURE_BIN).elf -o $@ $<

$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf
$(call print,Extracting compressible data from:,$<,$@)
$(V)$(EXTRACT_DATA_FOR_MIO) $< $@
Expand Down
43 changes: 41 additions & 2 deletions Makefile.split
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,21 @@ LEVEL_FILES := $(addsuffix leveldata,$(LEVEL_DIRS))

LEVEL_ELF_FILES := $(foreach level_dir,$(LEVEL_DIRS),$(BUILD_DIR)/levels/$(level_dir)leveldata.elf)

VANILLA_ACTORS_FILES := $(addsuffix data,$(VNL_ACTRS_DIRS))

VANILLA_ACTORS_ELF_FILES := $(foreach level_dir,$(VNL_ACTRS_DIRS),$(BUILD_DIR)/actors_vanilla/$(level_dir)data.elf)

SEG_FILES := \
$(SEGMENTS:%=$(BUILD_DIR)/bin/%.elf) \
$(ACTOR_GROUPS:%=$(BUILD_DIR)/actors/%.elf) \
$(LEVEL_FILES:%=$(BUILD_DIR)/levels/%.elf)
$(LEVEL_FILES:%=$(BUILD_DIR)/levels/%.elf) \
$(VANILLA_ACTORS_FILES:%=$(BUILD_DIR)/actors_vanilla/%.elf)

YAY0_FILES := \
$(SEGMENTS:%=$(BUILD_DIR)/bin/%.szp) \
$(ACTOR_GROUPS:%=$(BUILD_DIR)/actors/%.szp) \
$(LEVEL_FILES:%=$(BUILD_DIR)/levels/%.szp)
$(LEVEL_FILES:%=$(BUILD_DIR)/levels/%.szp) \
$(VANILLA_ACTORS_FILES:%=$(BUILD_DIR)/actors_vanilla/%.szp)

YAY0_OBJ_FILES := $(YAY0_FILES:.szp=.szp.o)

Expand Down Expand Up @@ -272,3 +278,36 @@ IPL3_RAW_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%,$(IP

CRASH_TEXTURE_FILES := $(wildcard $(TEXTURE_DIR)/crash_custom/*.png)
CRASH_TEXTURE_C_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%.inc.c,$(CRASH_TEXTURE_FILES)))

# --------------------------------------
# Vanilla Objects Rules
# --------------------------------------

define vanilla_objects_rules =
VANILLA_ACTORS_$(1)_TEXTURE_FILES := $$(patsubst %.png,%.inc.c,$$(wildcard actors_vanilla/$(1)/*.png))
$$(BUILD_DIR)/actors_vanilla/$(1)/data.o: $$(addprefix $$(BUILD_DIR)/,$$(VANILLA_ACTORS_$(1)_TEXTURE_FILES))
$$(BUILD_DIR)/actors_vanilla/$(1)/data.elf: SEGMENT_ADDRESS := 0x0e000000
$$(BUILD_DIR)/actors_vanilla/$(1)/data.elf: TEXTURE_BIN := $(2)
endef

$(eval $(call vanilla_objects_rules,bob,generic))
$(eval $(call vanilla_objects_rules,wf,grass))
$(eval $(call vanilla_objects_rules,jrb,water))
$(eval $(call vanilla_objects_rules,ccm,snow))
$(eval $(call vanilla_objects_rules,bbh,spooky))
$(eval $(call vanilla_objects_rules,hmc,cave))
$(eval $(call vanilla_objects_rules,lll,fire))
$(eval $(call vanilla_objects_rules,ssl,generic))
$(eval $(call vanilla_objects_rules,ddd,water))
$(eval $(call vanilla_objects_rules,sl,snow))
$(eval $(call vanilla_objects_rules,wdw,grass))
$(eval $(call vanilla_objects_rules,ttm,mountain))
$(eval $(call vanilla_objects_rules,thi,grass))
$(eval $(call vanilla_objects_rules,ttc,machine))
$(eval $(call vanilla_objects_rules,rr,sky))
$(eval $(call vanilla_objects_rules,bitdw,sky))
$(eval $(call vanilla_objects_rules,bitfs,sky))
$(eval $(call vanilla_objects_rules,bits,sky))
$(eval $(call vanilla_objects_rules,vcutm,outside))
$(eval $(call vanilla_objects_rules,castle_inside,inside))
$(eval $(call vanilla_objects_rules,castle_grounds,outside))
29 changes: 29 additions & 0 deletions actors/common0_geo.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,32 @@
#include "metal_box/geo.inc.c"
#include "exclamation_box_outline/geo.inc.c"
#include "koopa_shell/geo.inc.c"

#include "level_commands.h"

const LevelScript script_func_global_1[] = {
LOAD_MODEL_FROM_GEO(MODEL_BLUE_COIN_SWITCH, blue_coin_switch_geo),
LOAD_MODEL_FROM_GEO(MODEL_AMP, dAmpGeo),
LOAD_MODEL_FROM_GEO(MODEL_PURPLE_SWITCH, purple_switch_geo),
LOAD_MODEL_FROM_GEO(MODEL_CHECKERBOARD_PLATFORM, checkerboard_platform_geo),
LOAD_MODEL_FROM_GEO(MODEL_BREAKABLE_BOX, breakable_box_geo),
LOAD_MODEL_FROM_GEO(MODEL_BREAKABLE_BOX_NO_SHADOW, breakable_box_no_shadow_geo),
LOAD_MODEL_FROM_GEO(MODEL_EXCLAMATION_BOX_OUTLINE, exclamation_box_outline_geo),
LOAD_MODEL_FROM_GEO(MODEL_EXCLAMATION_BOX, exclamation_box_geo),
LOAD_MODEL_FROM_GEO(MODEL_GOOMBA, goomba_geo),
LOAD_MODEL_FROM_DL( MODEL_EXCLAMATION_POINT, exclamation_box_outline_seg8_dl_exclamation_point, LAYER_OCCLUDE_SILHOUETTE_ALPHA),
LOAD_MODEL_FROM_GEO(MODEL_KOOPA_SHELL, koopa_shell_geo),
LOAD_MODEL_FROM_GEO(MODEL_METAL_BOX, metal_box_geo),
LOAD_MODEL_FROM_DL( MODEL_METAL_BOX_DL, metal_box_dl, LAYER_OPAQUE),
LOAD_MODEL_FROM_GEO(MODEL_BLACK_BOBOMB, black_bobomb_geo),
LOAD_MODEL_FROM_GEO(MODEL_BOBOMB_BUDDY, bobomb_buddy_geo),
LOAD_MODEL_FROM_DL( MODEL_DL_CANNON_LID, cannon_lid_seg8_dl_080048E0, LAYER_OPAQUE),
LOAD_MODEL_FROM_GEO(MODEL_BOWLING_BALL, bowling_ball_geo),
LOAD_MODEL_FROM_GEO(MODEL_CANNON_BARREL, cannon_barrel_geo),
LOAD_MODEL_FROM_GEO(MODEL_CANNON_BASE, cannon_base_geo),
LOAD_MODEL_FROM_GEO(MODEL_HEART, heart_geo),
LOAD_MODEL_FROM_GEO(MODEL_FLYGUY, flyguy_geo),
LOAD_MODEL_FROM_GEO(MODEL_CHUCKYA, chuckya_geo),
LOAD_MODEL_FROM_GEO(MODEL_TRAJECTORY_MARKER_BALL, bowling_ball_track_geo),
RETURN(),
};
9 changes: 9 additions & 0 deletions actors/group10_geo.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@
#include "bird/geo.inc.c"
#include "peach/geo.inc.c"
#include "yoshi/geo.inc.c"

#include "level_commands.h"

const LevelScript script_func_global_11[] = {
LOAD_MODEL_FROM_GEO(MODEL_BIRDS, birds_geo),
LOAD_MODEL_FROM_GEO(MODEL_PEACH, peach_geo),
LOAD_MODEL_FROM_GEO(MODEL_YOSHI, yoshi_geo),
RETURN(),
};
Loading

0 comments on commit 305a18a

Please sign in to comment.