Skip to content

Commit 46ee4c5

Browse files
committed
sa1: reference spotlight_beam_task from sa2
1 parent bbaeac4 commit 46ee4c5

5 files changed

Lines changed: 17 additions & 226 deletions

File tree

sa1/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ SA2_C_FILES := \
273273
src/game/shared/stage/collision_2.c \
274274
src/game/shared/stage/collision_3.c \
275275
src/game/shared/stage/water_effects.c \
276+
src/game/shared/stage/spot_light_beam_task.c \
276277
src/game/sa1/ui/game_2_0.c \
277278
src/game/sa1/ui/game_2_1.c \
278279
src/game/sa1/ui/stage_results.c \

sa1/asm/non_matching/game/shared/stage/Task_SpotlightBeam.inc renamed to sa1/asm/non_matching/game/shared/stage/sa1_Task_SpotlightBeam.inc

File renamed without changes.

sa1/ldscript.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ SECTIONS {
4242
sa2/src/game/sa1/menus/options.o(.text);
4343
sa2/src/game/sa1/menus/player_data.o(.text);
4444

45-
src/game/shared/stage/spot_light_beam_task.o(.text);
45+
sa2/src/game/shared/stage/spot_light_beam_task.o(.text);
4646
sa2/src/game/sa1/stage/to_be_continued_screen.o(.text);
4747
sa2/src/game/shared/stage/enemy_defeat_score.o(.text);
4848
sa2/src/game/shared/stage/demo_manager.o(.text);

sa1/src/game/shared/stage/spot_light_beam_task.c

Lines changed: 0 additions & 214 deletions
This file was deleted.

src/game/shared/stage/spot_light_beam_task.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
#include "gba/syscall.h"
99
#include "game/shared/stage/spot_light_beam_task.h"
1010

11-
void Task_SpotlightBeamTask(void);
12-
void TaskDestructor_SpotlightBeamTask(struct Task *);
13-
14-
/* This task is related to spot lights in Ice Paradise. */
11+
void Task_SpotlightBeam(void);
12+
void TaskDestructor_SpotlightBeam(struct Task *);
1513

1614
struct Task *CreateSpotlightBeamTask(void)
1715
{
18-
struct Task *t = TaskCreate(Task_SpotlightBeamTask, sizeof(SpotlightBeam), 0x2000, 0, TaskDestructor_SpotlightBeamTask);
16+
struct Task *t = TaskCreate(Task_SpotlightBeam, sizeof(SpotlightBeam), 0x2000, 0, TaskDestructor_SpotlightBeam);
1917
SpotlightBeam *beam = TASK_DATA(t);
2018

2119
beam->unk6 = 120;
@@ -35,11 +33,17 @@ typedef struct {
3533

3634
} Struct_SP10;
3735

36+
#if (GAME == GAME_SA1)
37+
NONMATCH("asm/non_matching/game/shared/stage/sa1_Task_SpotlightBeam.inc", void Task_SpotlightBeam(void))
38+
#elif (GAME == GAME_SA2)
3839
// (68.53%) https://decomp.me/scratch/NchTb
3940
// (66.79%) https://decomp.me/scratch/PmbTP
4041
// (52.07%) https://decomp.me/scratch/I1Kkn (M2C generated)
41-
NONMATCH("asm/non_matching/game/shared/stage/Task_SpotlightBeamTask.inc", void Task_SpotlightBeamTask(void))
42+
NONMATCH("asm/non_matching/game/shared/stage/Task_SpotlightBeamTask.inc", void Task_SpotlightBeam(void))
43+
#endif
4244
{
45+
// NOTE: This was decompiled from the SA2 code
46+
// It may not be the SA1 code, since the asm is difference
4347
TriParam1 sp8;
4448
Struct_SP10 sp10;
4549
Struct_SP10 sp14;
@@ -176,15 +180,15 @@ NONMATCH("asm/non_matching/game/shared/stage/Task_SpotlightBeamTask.inc", void T
176180
} else {
177181
gWinRegs[WINREG_WIN0V] = WIN_RANGE(sp8.unk5, DISPLAY_HEIGHT);
178182
}
179-
sub_8006228(beam->bg, sp8.unk4, sp8.unk5, sp8.unk6, sp8.unk7, 0);
183+
SA2_LABEL(sub_8006228)(beam->bg, sp8.unk4, sp8.unk5, sp8.unk6, sp8.unk7, 0);
180184
return;
181185
}
182186
if (1 & beam->bg) {
183187
gWinRegs[WINREG_WIN1V] = WIN_RANGE(sp8.unk5, DISPLAY_HEIGHT);
184188
} else {
185189
gWinRegs[WINREG_WIN0V] = WIN_RANGE(sp8.unk5, DISPLAY_HEIGHT);
186190
}
187-
sub_800724C(beam->bg, &sp8);
191+
SA2_LABEL(sub_800724C)(beam->bg, &sp8);
188192
return;
189193
}
190194

@@ -196,18 +200,18 @@ NONMATCH("asm/non_matching/game/shared/stage/Task_SpotlightBeamTask.inc", void T
196200
gWinRegs[WINREG_WIN0V] = WIN_RANGE(sp8.unk1, DISPLAY_HEIGHT);
197201
}
198202

199-
sub_80064A8(beam->bg, sp8.unk0, sp8.unk1, sp8.unk2, (s32)sp8.unk3, 0);
203+
SA2_LABEL(sub_80064A8)(beam->bg, sp8.unk0, sp8.unk1, sp8.unk2, (s32)sp8.unk3, 0);
200204
} else {
201205
if (beam->bg & 0x1) {
202206
gWinRegs[WINREG_WIN1V] = WIN_RANGE(sp8.unk1, DISPLAY_HEIGHT);
203207
} else {
204208
gWinRegs[WINREG_WIN0V] = WIN_RANGE(sp8.unk1, DISPLAY_HEIGHT);
205209
}
206210

207-
sub_800724C(beam->bg, &sp8);
211+
SA2_LABEL(sub_800724C)(beam->bg, &sp8);
208212
}
209213
}
210214
}
211215
END_NONMATCH
212216

213-
void TaskDestructor_SpotlightBeamTask(struct Task *t) { gFlags &= ~FLAGS_EXECUTE_HBLANK_COPY; }
217+
void TaskDestructor_SpotlightBeam(struct Task *t) { gFlags &= ~FLAGS_EXECUTE_HBLANK_COPY; }

0 commit comments

Comments
 (0)