Skip to content

Commit d485fed

Browse files
committed
split backgrounds from camera.c and merge sa1 and sa2 camera.c
1 parent 9543ad3 commit d485fed

38 files changed

Lines changed: 1961 additions & 2907 deletions

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,21 @@ OBJ_TILES_4BPP_SUBDIR = graphics/sa2/obj_tiles/4bpp
171171
TILESETS_SUBDIR = graphics/sa2/tilesets/
172172

173173
ifeq ($(PLATFORM),gba)
174-
C_SRCS := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/*")
174+
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/*")
175175
else ifeq ($(PLATFORM),sdl)
176-
C_SRCS := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
176+
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
177177
else ifeq ($(PLATFORM),sdl_psp)
178-
C_SRCS := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
178+
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
179179
else ifeq ($(PLATFORM),ps2)
180-
C_SRCS := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/pret_sdl/*")
180+
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/pret_sdl/*")
181181
else ifeq ($(PLATFORM),sdl_win32)
182-
C_SRCS := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
182+
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/win32/*" -not -path "*/platform/ps2/*")
183183
else ifeq ($(PLATFORM),win32)
184-
C_SRCS := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/pret_sdl/*" -not -path "*/platform/ps2/*")
184+
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*" -not -path "*/platform/pret_sdl/*" -not -path "*/platform/ps2/*")
185185
else
186-
C_SRCS := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*")
186+
C_SRCS_IN := $(shell find $(C_SUBDIR) -name "*.c" -not -path "*/sa1/*")
187187
endif
188+
C_SRCS := $(foreach src,$(C_SRCS_IN),$(if $(findstring .inc.c,$(src)),,$(src)))
188189
C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS))
189190

190191
ifeq ($(PLATFORM),gba)

chao_garden/include/global.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
#define INCBIN_S8 INCBIN
4848
#define INCBIN_S16 INCBIN
4949
#define INCBIN_S32 INCBIN
50+
51+
#define INCPAL(...) \
52+
{ \
53+
0 \
54+
}
5055
#endif // IDE support
5156

5257
#define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0]))

include/game/shared/stage/camera.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ void InitCamera(u32);
168168
void UpdateCamera(void);
169169
void DestroyCameraMovementTask(void);
170170

171+
// TODO: move to camera_hblank_callbacks.c
172+
#if (GAME == GAME_SA2)
173+
void HBlankCB_801E454(int_vcount vcount);
174+
void sub_801E3F0(void);
175+
void HBlankCB_801E434(int_vcount vcount);
176+
void nullsub_801E494(void);
177+
void HBlankCB_BgUpdateZone5ActBoss(int_vcount vcount);
178+
void HBlankCB_BgUpdateZoneFinalActXX(int_vcount vcount);
179+
#endif
180+
171181
#if (GAME == GAME_SA1)
172182
// TODO: should be included from terrain_collision.h
173183
extern const Collision *gRefCollision;

sa1/Makefile

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ SA2_C_FILES := \
274274
src/game/shared/stage/collision_3.c \
275275
src/game/shared/stage/water_effects.c \
276276
src/game/shared/stage/spot_light_beam_task.c \
277+
src/game/shared/stage/camera.c \
277278
src/game/sa1/ui/game_2_0.c \
278279
src/game/sa1/ui/game_2_1.c \
279280
src/game/sa1/ui/stage_results.c \
@@ -397,21 +398,6 @@ SA2_C_FILES := \
397398
src/game/sa1/stage/player_tails.c \
398399
src/game/sa1/stage/player_super_sonic.c \
399400
src/game/sa1/stage/mp_chao.c \
400-
src/game/sa1/stage/camera_destroy.c \
401-
src/game/sa1/stage/backgrounds/zone_5_init.c \
402-
src/game/sa1/stage/backgrounds/zone_4.c \
403-
src/game/sa1/stage/backgrounds/zone_3_firework.c \
404-
src/game/sa1/stage/backgrounds/zone_3.c \
405-
src/game/sa1/stage/backgrounds/zone_2_interior.c \
406-
src/game/sa1/stage/backgrounds/zone_7_act_2.c \
407-
src/game/sa1/stage/backgrounds/zone_4_init.c \
408-
src/game/sa1/stage/backgrounds/zone_2.c \
409-
src/game/sa1/stage/backgrounds/zone_6_hblank.c \
410-
src/game/sa1/stage/backgrounds/zone_6.c \
411-
src/game/sa1/stage/backgrounds/zone_7_act_1.c \
412-
src/game/sa1/stage/backgrounds/zone_1.c \
413-
src/game/sa1/stage/backgrounds/zone_7_act_2_init.c \
414-
src/game/sa1/stage/backgrounds/zone_5.c \
415401
src/game/sa1/stage/trapped_animals.c \
416402
src/game/sa1/stage/stage_ui_z.c \
417403
src/game/sa1/stage/stage_ui.c \

sa1/ldscript.txt

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,7 @@ SECTIONS {
114114
sa2/src/game/dummy_task.o(.text);
115115

116116
src/game/shared/stage/stage.o(.text);
117-
src/game/shared/stage/camera.o(.text);
118-
sa2/src/game/sa1/stage/backgrounds/zone_1.o(.text);
119-
sa2/src/game/sa1/stage/backgrounds/zone_2_interior.o(.text);
120-
sa2/src/game/sa1/stage/backgrounds/zone_3.o(.text);
121-
sa2/src/game/sa1/stage/backgrounds/zone_4.o(.text);
122-
sa2/src/game/sa1/stage/backgrounds/zone_6.o(.text);
123-
sa2/src/game/sa1/stage/backgrounds/zone_7_act_2.o(.text);
124-
sa2/src/game/sa1/stage/camera_destroy.o(.text);
125-
sa2/src/game/sa1/stage/backgrounds/zone_4_init.o(.text);
126-
sa2/src/game/sa1/stage/backgrounds/zone_5_init.o(.text);
127-
sa2/src/game/sa1/stage/backgrounds/zone_7_act_1.o(.text);
128-
sa2/src/game/sa1/stage/backgrounds/zone_7_act_2_init.o(.text);
129-
sa2/src/game/sa1/stage/backgrounds/zone_2.o(.text);
130-
sa2/src/game/sa1/stage/backgrounds/zone_5.o(.text);
131-
sa2/src/game/sa1/stage/backgrounds/zone_3_firework.o(.text);
132-
sa2/src/game/sa1/stage/backgrounds/zone_6_hblank.o(.text);
117+
sa2/src/game/shared/stage/camera.o(.text);
133118
sa2/src/game/shared/stage/terrain_collision.o(.text);
134119
sa2/src/game/shared/stage/mp_sprite_task.o(.text);
135120
sa2/src/game/shared/stage/dust_effect_braking.o(.text);
@@ -360,7 +345,7 @@ SECTIONS {
360345
sa2/src/game/shared/stage/amy_attack_heart_effect.o(.rodata);
361346
sa2/src/game/shared/stage/music_manager.o(.rodata);
362347
src/game/shared/stage/stage.o(.rodata);
363-
src/game/shared/stage/camera.o(.rodata);
348+
sa2/src/game/shared/stage/camera.o(.rodata);
364349
src/data/sa1/tilemap_table.o(.rodata);
365350
sa2/src/game/shared/stage/terrain_collision.o(.rodata);
366351
data/sa1/data_0_4.o(.rodata);

0 commit comments

Comments
 (0)