Skip to content

Commit

Permalink
Match camera_destroy.c
Browse files Browse the repository at this point in the history
  • Loading branch information
JaceCear committed Jan 29, 2025
1 parent b189c93 commit 4c7e3e3
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 115 deletions.
113 changes: 0 additions & 113 deletions asm/game__stage__camera__destroy.s

This file was deleted.

2 changes: 1 addition & 1 deletion asm/game__stage__stage.s
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,7 @@ sub_803DC48: @ 0x0803DC48
ldr r0, _0803DC80 @ =gPartner
bl sub_8046CC4
_0803DC6A:
bl sub_803F644
bl DestroyCameraMovementTask
pop {r4}
pop {r0}
bx r0
Expand Down
1 change: 1 addition & 0 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ struct BlendRegs {

// TODO: Should this be in a GBA-specific header file?
#define NUM_AFFINE_BACKGROUNDS 2
#define NUM_BACKGROUNDS 4

// Values to be passed top the affine registers
// (used by BG2/BG3 in affine screen modes)
Expand Down
4 changes: 3 additions & 1 deletion ldscript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ SECTIONS {
build/sa1/asm/game__stage__camera__bg__zone_4.o(.text);
build/sa1/asm/game__stage__camera__bg__zone_6.o(.text);
build/sa1/asm/game__stage__camera__bg__zone_7_act_2.o(.text);
build/sa1/asm/game__stage__camera__destroy.o(.text);
build/sa1/src/game/stage/camera_destroy.o(.text);
build/sa1/src/game/stage/backgrounds/zone_4_init.o(.text);
build/sa1/src/game/stage/backgrounds/zone_5_init.o(.text);
build/sa1/src/game/stage/backgrounds/zone_7_act_1.o(.text);
Expand Down Expand Up @@ -125,6 +125,7 @@ SECTIONS {
build/sa1/asm/game_2.o(.text);
build/sa1/asm/game__edit_language_screen.o(.text);
build/sa1/asm/game_3.o(.text);

build/sa1/asm/enemy_gamigami.o(.text);
build/sa1/asm/enemy_rhinotank.o(.text);
build/sa1/asm/enemy_kerokero.o(.text);
Expand All @@ -143,6 +144,7 @@ SECTIONS {
build/sa1/asm/enemy_kuraa.o(.text);
build/sa1/asm/enemy_pen.o(.text);
build/sa1/asm/enemy_tentou.o(.text);

build/sa1/asm/ia_trampoline.o(.text);
build/sa1/asm/ia_bounce_block.o(.text);
build/sa1/asm/ia_incline_ramp.o(.text);
Expand Down
56 changes: 56 additions & 0 deletions src/game/stage/camera_destroy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include "global.h"
#include "core.h"
#include "flags.h"
#include "game/sa1_sa2_shared/camera.h"
#include "game/sa1_sa2_shared/globals.h"
#include "game/stage/camera.h"
#include "constants/zones.h"

static void Task_CallUpdateCameraInternal(void);

void DestroyCameraMovementTask(void)
{
TaskDestroy(gCamera.movementTask);
gCamera.movementTask = NULL;
}

void TaskDestructor_Camera(struct Task *unused)
{
s32 i;
gCamera.movementTask = NULL;

for (i = 0; i < NUM_BACKGROUNDS; i++) {
gBgScrollRegs[i][0] = 0;
gBgScrollRegs[i][1] = 0;
}

if (IS_EXTRA_STAGE(gCurrentLevel) && (gFlags & FLAGS_40)) {
gIntrTable[INTR_INDEX_VCOUNT] = gIntrTableTemplate[INTR_INDEX_VCOUNT];
gFlags &= ~FLAGS_40;
}

gFlags &= ~FLAGS_4;
}

void Task_CallUpdateCamera(void)
{
gDispCnt |= (DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON);

#if (GAME == GAME_SA2)
if (IS_EXTRA_STAGE(gCurrentLevel)) {
gDispCnt &= ~DISPCNT_BG3_ON;
}
#endif

if (gGameMode == GAME_MODE_MULTI_PLAYER_COLLECT_RINGS) {
gDispCnt &= ~DISPCNT_WIN0_ON;
}

gCurTask->main = Task_CallUpdateCameraInternal;
}

static void Task_CallUpdateCameraInternal(void)
{
UpdateCamera();
sa2__gUnknown_030054B8 = 0x4;
}

0 comments on commit 4c7e3e3

Please sign in to comment.