-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PSX: https://decomp.me/scratch/RL97B PSP: https://decomp.me/scratch/3WKmX `func_us_8018B4A0` needed to be decompiled before importing all the assets due to GCC compiling `PfnEntityUpdates[entity->entityId - 1]` into a hardcoded offset landing to the `header.c` data as a fake symbol. The decompiled function seem to be some kind of object spawner for the cutscenes controller. I have yet to confirm that, so I did not rename any symbols yet. EDIT: `func_us_8018B4A0` turned out to be a shared function I renamed as `CutsceneRun`. DRE and CEN use slightly different variants and they will not use the new `cutscene.h`. I plan on putting more stuff into `cutscene.h` in a separate PR and maybe rename all the C files that handle cutscenes accordingly.
- Loading branch information
Showing
29 changed files
with
296 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
#include "mar.h" | ||
|
||
extern RoomHeader OVL_EXPORT(rooms)[]; | ||
extern signed short* spriteBanks[]; | ||
extern void* Cluts[]; | ||
extern MyRoomDef rooms_layers[]; | ||
static GfxBank* gfxBanks[]; | ||
void UpdateStageEntities(); | ||
|
||
AbbreviatedOverlay OVL_EXPORT(Overlay) = { | ||
.Update = Update, | ||
.HitDetection = HitDetection, | ||
.UpdateRoomPosition = UpdateRoomPosition, | ||
.InitRoomEntities = InitRoomEntities, | ||
.rooms = OVL_EXPORT(rooms), | ||
.spriteBanks = spriteBanks, | ||
.cluts = Cluts, | ||
.objLayoutHorizontal = g_pStObjLayoutHorizontal, | ||
.tileLayers = rooms_layers, | ||
.gfxBanks = gfxBanks, | ||
.UpdateStageEntities = UpdateStageEntities, | ||
}; | ||
|
||
#include "sprite_banks.h" | ||
|
||
extern u16* D_us_80184EE0[]; | ||
extern u16* D_us_801850E0[]; | ||
extern u16* D_us_801852E0[]; | ||
static u16** D_us_8018008C[] = { | ||
0x00000005, 0x00002000, 0x00000080, D_us_80184EE0, | ||
0x00002080, 0x00000080, D_us_801850E0, 0x00002100, | ||
0x00000010, D_us_801852E0, PAL_TERMINATE(), | ||
}; | ||
|
||
static void* Cluts[] = { | ||
D_us_8018008C, | ||
}; | ||
|
||
#include "layers.h" | ||
|
||
static u_long* D_us_801800F4_TERM = GFX_TERMINATE(); | ||
|
||
extern u_long* D_us_801830F0; | ||
extern u_long* D_us_80184220; | ||
static u_long* D_us_801800F8[] = { | ||
// TODO GfxBank | ||
0x00000004, 0x00800100, 0x00800080, &D_us_801830F0, | ||
0x00A00100, 0x00800080, &D_us_80184220, 0xFFFFFFFF, | ||
}; | ||
|
||
static GfxBank* gfxBanks[] = { | ||
&D_us_801800F4_TERM, &D_us_801800F8, &D_us_801800F4_TERM, | ||
&D_us_801800F4_TERM, &D_us_801800F4_TERM, &D_us_801800F4_TERM, | ||
&D_us_801800F4_TERM, &D_us_801800F4_TERM, &D_us_801800F4_TERM, | ||
&D_us_801800F4_TERM, &D_us_801800F4_TERM, &D_us_801800F4_TERM, | ||
&D_us_801800F4_TERM, &D_us_801800F4_TERM, &D_us_801800F4_TERM, | ||
&D_us_801800F4_TERM, &D_us_801800F4_TERM, &D_us_801800F4_TERM, | ||
&D_us_801800F4_TERM, &D_us_801800F4_TERM}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
#include <stage.h> | ||
|
||
#include "tilemap_05300.h" | ||
#include "tilemap_05500.h" | ||
#include "tiledef_09700.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
#include <stage.h> | ||
|
||
extern Dialogue g_Dialogue; | ||
extern u32 g_CutsceneFlags; | ||
extern PfnEntityUpdate PfnEntityUpdates[]; | ||
void CutsceneRun(void) { | ||
Entity* entity; | ||
u16 startTimer; | ||
|
||
g_Dialogue.timer++; | ||
// protect from overflows | ||
if (g_Dialogue.timer >= 0xFFFF) { | ||
g_Dialogue.unk3C = 0; | ||
return; | ||
} | ||
while (true) { | ||
// Start the dialogue script only if the start timer has passed | ||
startTimer = *g_Dialogue.unk40++ << 8; | ||
startTimer |= *g_Dialogue.unk40++; | ||
if (g_Dialogue.timer < startTimer) { | ||
// Re-evaluate the condition at the next frame | ||
g_Dialogue.unk40 -= 2; | ||
return; | ||
} | ||
switch (*g_Dialogue.unk40++) { | ||
case 0: | ||
entity = | ||
&g_Entities[*g_Dialogue.unk40++ & 0xFF] + STAGE_ENTITY_START; | ||
DestroyEntity(entity); | ||
entity->entityId = *g_Dialogue.unk40++; | ||
entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1]; | ||
entity->posX.i.hi = *g_Dialogue.unk40++ * 0x10; | ||
entity->posX.i.hi |= *g_Dialogue.unk40++; | ||
entity->posY.i.hi = *g_Dialogue.unk40++ * 0x10; | ||
entity->posY.i.hi |= *g_Dialogue.unk40++; | ||
break; | ||
case 1: | ||
entity = | ||
&g_Entities[*g_Dialogue.unk40++ & 0xFF] + STAGE_ENTITY_START; | ||
DestroyEntity(entity); | ||
break; | ||
case 2: | ||
if (!((g_CutsceneFlags >> *g_Dialogue.unk40) & 1)) { | ||
g_Dialogue.unk40--; | ||
return; | ||
} | ||
g_CutsceneFlags &= ~(1 << *g_Dialogue.unk40++); | ||
break; | ||
case 3: | ||
g_CutsceneFlags |= 1 << *g_Dialogue.unk40++; | ||
break; | ||
} | ||
} | ||
} |
Oops, something went wrong.