mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 04:59:41 +00:00
Decompile NZ0 EntityMaria (#1314)
Relatively simple function. I'm trying to get better at things like using good variable names, organizing files, etc, and I think it pays off. This function is more readable than it would have been in the initial scratch. Excited to really get the game into a state where all the code is directly readable.
This commit is contained in:
parent
9f09aa81ee
commit
5769a39a04
@ -94,7 +94,7 @@ segments:
|
||||
- [0x3063C, .rodata, 36DE4] # func_801B7034
|
||||
- [0x3064C, rodata]
|
||||
- [0x30664, .rodata, mariacutscene]
|
||||
- [0x306E8, rodata]
|
||||
- [0x306E8, .rodata, maria]
|
||||
- [0x30728, .rodata, e_red_door] # EntityRedDoor
|
||||
- [0x30740, .rodata, e_collect] # CollectGold text
|
||||
- [0x30790, .rodata, e_collect] # EntityPrizeDrop
|
||||
@ -118,7 +118,7 @@ segments:
|
||||
- [0x35778, c, gaibon]
|
||||
- [0x36DE4, c]
|
||||
- [0x374CC, c, mariacutscene]
|
||||
- [0x38E0C, c]
|
||||
- [0x38E0C, c, maria]
|
||||
- [0x394D4, c, random]
|
||||
- [0x39504, c, update]
|
||||
- [0x39800, c, update_stage_entities]
|
||||
|
@ -48,6 +48,7 @@ EntitySmallGaibonProjectile = 0x801B6AAC;
|
||||
EntityLargeGaibonProjectile = 0x801B6BBC;
|
||||
EntityElevator = 0x801B7034;
|
||||
EntityMariaCutscene = 0x801B7D58;
|
||||
EntityMaria = 0x801B8F94;
|
||||
Update = 0x801B9504;
|
||||
UpdateStageEntities = 0x801B9800;
|
||||
HitDetection = 0x801B9908;
|
||||
@ -57,11 +58,8 @@ UpdateRoomPosition = 0x801BBA98;
|
||||
CreateEntityFromCurrentEntity = 0x801BBB4C;
|
||||
EntityRedDoor = 0x801BBCB4;
|
||||
DestroyEntity = 0x801BC8EC;
|
||||
AnimateEntity = 0x801BCA1C;
|
||||
GetSideToPlayer = 0x801BCC5C;
|
||||
MoveEntity = 0x801BCCA0;
|
||||
AllocEntity = 0x801BD15C;
|
||||
SetStep = 0x801BD52C;
|
||||
InitializeEntity = 0x801BD5FC;
|
||||
EntityDummy = 0x801BD6F8;
|
||||
GetPlayerCollisionWith = 0x801BD9A0;
|
||||
@ -100,4 +98,5 @@ g_LayoutObjVertical = 0x801CAA78;
|
||||
g_LayoutObjPosHorizontal = 0x801CAA7C;
|
||||
g_LayoutObjPosVertical = 0x801CAA80;
|
||||
g_Dialogue = 0x801CB688;
|
||||
g_mariaCutsceneFlags = 0x801CB734;
|
||||
g_ItemIconSlots = 0x801CB740;
|
||||
|
@ -1,47 +0,0 @@
|
||||
#include "nz0.h"
|
||||
|
||||
void func_801B8E0C(Entity* self) {
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180BEC);
|
||||
D_8003C8B8 = 0;
|
||||
g_unkGraphicsStruct.unk0 = 1;
|
||||
g_Player.padSim = PAD_LEFT;
|
||||
if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) {
|
||||
g_Player.padSim = PAD_R2;
|
||||
}
|
||||
g_Player.D_80072EFC = 1;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (PLAYER.posX.i.hi < 176) {
|
||||
g_Player.padSim = 0;
|
||||
self->step++;
|
||||
} else {
|
||||
g_Player.padSim = 0;
|
||||
if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) {
|
||||
if (g_Timer & 1) {
|
||||
g_Player.padSim = PAD_R2;
|
||||
}
|
||||
} else {
|
||||
g_Player.padSim = PAD_LEFT;
|
||||
}
|
||||
}
|
||||
g_Player.D_80072EFC = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (D_801CB734 & 0x2000) {
|
||||
D_8003C8B8 = 1;
|
||||
if (g_unkGraphicsStruct.unk0 != 0) {
|
||||
g_unkGraphicsStruct.unk0 = 0;
|
||||
}
|
||||
DestroyEntity(self);
|
||||
}
|
||||
g_Player.padSim = 0;
|
||||
g_Player.D_80072EFC = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("st/nz0/nonmatchings/38E0C", func_801B8F94);
|
192
src/st/nz0/maria.c
Normal file
192
src/st/nz0/maria.c
Normal file
@ -0,0 +1,192 @@
|
||||
#include "nz0.h"
|
||||
|
||||
void func_801B8E0C(Entity* self) {
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180BEC);
|
||||
D_8003C8B8 = 0;
|
||||
g_unkGraphicsStruct.unk0 = 1;
|
||||
g_Player.padSim = PAD_LEFT;
|
||||
if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) {
|
||||
g_Player.padSim = PAD_R2;
|
||||
}
|
||||
g_Player.D_80072EFC = 1;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (PLAYER.posX.i.hi < 176) {
|
||||
g_Player.padSim = 0;
|
||||
self->step++;
|
||||
} else {
|
||||
g_Player.padSim = 0;
|
||||
if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) {
|
||||
if (g_Timer & 1) {
|
||||
g_Player.padSim = PAD_R2;
|
||||
}
|
||||
} else {
|
||||
g_Player.padSim = PAD_LEFT;
|
||||
}
|
||||
}
|
||||
g_Player.D_80072EFC = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (g_mariaCutsceneFlags & 0x2000) {
|
||||
D_8003C8B8 = 1;
|
||||
if (g_unkGraphicsStruct.unk0 != 0) {
|
||||
g_unkGraphicsStruct.unk0 = 0;
|
||||
}
|
||||
DestroyEntity(self);
|
||||
}
|
||||
g_Player.padSim = 0;
|
||||
g_Player.D_80072EFC = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Maria appearing in the cutscene. Walks in from the door on the left, talks
|
||||
// to Alucard, and departs to the right.
|
||||
void EntityMaria(Entity* self) {
|
||||
Entity* redDoor;
|
||||
Primitive* prim;
|
||||
s32 i;
|
||||
|
||||
if ((D_801CB684 != 0) && (self->step < 12)) {
|
||||
if (!(g_mariaCutsceneFlags & 1)) {
|
||||
g_mariaCutsceneFlags |= 1;
|
||||
}
|
||||
SetStep(12);
|
||||
}
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180BEC);
|
||||
self->animSet = ANIMSET_OVL(0xF);
|
||||
self->animCurFrame = 1;
|
||||
self->unk5A = 0x48;
|
||||
self->palette = 0x237;
|
||||
self->posX.i.hi = -0x10;
|
||||
break;
|
||||
case 1:
|
||||
if (g_mariaCutsceneFlags & 4) {
|
||||
// Maria comes through the door on the left, the door is in entity
|
||||
// slot 192.
|
||||
redDoor = &g_Entities[192];
|
||||
g_api.func_80134714(SE_DOOR_OPEN, 0x60, -6);
|
||||
for (prim = &g_PrimBuf[redDoor->primIndex], i = 0; prim != NULL;
|
||||
prim = prim->next, i++) {
|
||||
if ((i == 1) && !(self->params & FLAG_DEAD)) {
|
||||
prim->drawMode &= ~DRAW_HIDE;
|
||||
}
|
||||
if ((i == 2) && (self->params & FLAG_DEAD)) {
|
||||
prim->drawMode &= ~DRAW_HIDE;
|
||||
}
|
||||
if (i == 0) {
|
||||
prim->drawMode &= ~DRAW_HIDE;
|
||||
}
|
||||
}
|
||||
// This line ends up hiding the rest-state door while the swinging
|
||||
// door opens
|
||||
redDoor->animCurFrame = 0;
|
||||
redDoor->step++;
|
||||
self->step++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
redDoor = &g_Entities[192];
|
||||
if (redDoor->step == 3) {
|
||||
self->velocityX = FIX(0.75);
|
||||
self->step++;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
AnimateEntity(D_80181474, self);
|
||||
MoveEntity();
|
||||
if (self->posX.i.hi >= 25) {
|
||||
redDoor = &g_Entities[192];
|
||||
redDoor->step = 5;
|
||||
g_mariaCutsceneFlags |= 2;
|
||||
self->step++;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
AnimateEntity(D_80181474, self);
|
||||
MoveEntity();
|
||||
if (self->posX.i.hi > 80) {
|
||||
g_mariaCutsceneFlags |= 1;
|
||||
SetStep(5);
|
||||
self->velocityX = 0;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
AnimateEntity(D_80181490, self);
|
||||
if (g_mariaCutsceneFlags & 8) {
|
||||
SetStep(6);
|
||||
AnimateEntity(D_801814A0, self);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
AnimateEntity(D_801814A0, self);
|
||||
if (g_mariaCutsceneFlags & 0x10) {
|
||||
SetStep(7);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
AnimateEntity(D_801814BC, self);
|
||||
if (g_mariaCutsceneFlags & 0x20) {
|
||||
SetStep(8);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
AnimateEntity(D_801814C8, self);
|
||||
if (g_mariaCutsceneFlags & 0x40) {
|
||||
SetStep(9);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
AnimateEntity(D_801814E8, self);
|
||||
if (g_mariaCutsceneFlags & 0x80) {
|
||||
SetStep(10);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
AnimateEntity(D_801814F8, self);
|
||||
if (g_mariaCutsceneFlags & 0x100) {
|
||||
SetStep(11);
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
AnimateEntity(D_80181510, self);
|
||||
if (g_mariaCutsceneFlags & 0x200) {
|
||||
SetStep(12);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
AnimateEntity(D_8018151C, self);
|
||||
if (g_mariaCutsceneFlags & 0x400) {
|
||||
SetStep(13);
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
AnimateEntity(D_80181530, self);
|
||||
if (g_mariaCutsceneFlags & 0x800) {
|
||||
SetStep(14);
|
||||
self->velocityX = FIX(0.75);
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
AnimateEntity(D_80181538, self);
|
||||
MoveEntity();
|
||||
if (self->posX.i.hi > 224) {
|
||||
g_mariaCutsceneFlags |= 0x1000;
|
||||
self->step++;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
AnimateEntity(D_80181538, self);
|
||||
MoveEntity();
|
||||
if (self->posX.i.hi > 272) {
|
||||
DestroyEntity(self);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
@ -207,14 +207,14 @@ void func_801B79A8(void) {
|
||||
DestroyEntity(entity);
|
||||
break;
|
||||
case 2:
|
||||
if (!((D_801CB734 >> *g_Dialogue.unk40) & 1)) {
|
||||
if (!((g_mariaCutsceneFlags >> *g_Dialogue.unk40) & 1)) {
|
||||
g_Dialogue.unk40--;
|
||||
return;
|
||||
}
|
||||
D_801CB734 &= ~(1 << *g_Dialogue.unk40++);
|
||||
g_mariaCutsceneFlags &= ~(1 << *g_Dialogue.unk40++);
|
||||
break;
|
||||
case 3:
|
||||
D_801CB734 |= 1 << *g_Dialogue.unk40++;
|
||||
g_mariaCutsceneFlags |= 1 << *g_Dialogue.unk40++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -293,7 +293,7 @@ void EntityMariaCutscene(Entity* self) {
|
||||
}
|
||||
if (func_801B7520(D_80183B0C) & 0xFF) {
|
||||
self->flags |= FLAG_HAS_PRIMS | FLAG_UNK_2000;
|
||||
D_801CB734 = 0;
|
||||
g_mariaCutsceneFlags = 0;
|
||||
D_801CB73C = 0;
|
||||
D_801CB684 = 0;
|
||||
D_8003C704 = 1;
|
||||
@ -508,15 +508,16 @@ void EntityMariaCutscene(Entity* self) {
|
||||
continue;
|
||||
|
||||
case 16:
|
||||
if (!((D_801CB734 >> *g_Dialogue.nextCharDialogue) & 1)) {
|
||||
if (!((g_mariaCutsceneFlags >> *g_Dialogue.nextCharDialogue) &
|
||||
1)) {
|
||||
g_Dialogue.nextCharDialogue--;
|
||||
return;
|
||||
}
|
||||
D_801CB734 &= ~(1 << *g_Dialogue.nextCharDialogue);
|
||||
g_mariaCutsceneFlags &= ~(1 << *g_Dialogue.nextCharDialogue);
|
||||
*g_Dialogue.nextCharDialogue++;
|
||||
continue;
|
||||
case 17:
|
||||
D_801CB734 |= 1 << *g_Dialogue.nextCharDialogue++;
|
||||
g_mariaCutsceneFlags |= 1 << *g_Dialogue.nextCharDialogue++;
|
||||
continue;
|
||||
case 18:
|
||||
g_Dialogue.unk3C = 0;
|
||||
@ -545,17 +546,18 @@ void EntityMariaCutscene(Entity* self) {
|
||||
g_api.PlaySfx(nextChar);
|
||||
continue;
|
||||
case 21:
|
||||
D_801CB734 = 0;
|
||||
g_mariaCutsceneFlags = 0;
|
||||
D_801CB684 = 0;
|
||||
D_801CB73C = 0;
|
||||
continue;
|
||||
case 22:
|
||||
D_801CB734 &= ~(1 << *g_Dialogue.nextCharDialogue++);
|
||||
g_mariaCutsceneFlags &= ~(1 << *g_Dialogue.nextCharDialogue++);
|
||||
continue;
|
||||
case 23:
|
||||
return;
|
||||
case 24:
|
||||
if (!((D_801CB734 >> *g_Dialogue.nextCharDialogue) & 1)) {
|
||||
if (!((g_mariaCutsceneFlags >> *g_Dialogue.nextCharDialogue) &
|
||||
1)) {
|
||||
*g_Dialogue.nextCharDialogue--;
|
||||
return;
|
||||
}
|
||||
|
@ -355,7 +355,6 @@ extern Primitive* D_801CB6A0[];
|
||||
extern s32 D_801CB6B8;
|
||||
extern s32 D_801CB6BC;
|
||||
extern s32 D_801CB6C0[];
|
||||
extern u32 D_801CB734;
|
||||
extern u16 D_801CB736[];
|
||||
|
||||
// *** EntitySoulStealOrb properties START ***
|
||||
@ -377,7 +376,6 @@ extern SVECTOR D_80182848;
|
||||
|
||||
// For EntityMariaCutscene
|
||||
extern s32 D_801CB684;
|
||||
extern u32 D_801CB734;
|
||||
extern s32 D_801CB73C;
|
||||
extern u8 D_801813C8[];
|
||||
extern u8 D_801813CC[];
|
||||
@ -386,3 +384,18 @@ extern u16 D_801813D4[];
|
||||
extern u16 D_801813D8[];
|
||||
extern s16 D_801813DC[];
|
||||
extern const char D_80183B0C[];
|
||||
extern u32 g_mariaCutsceneFlags;
|
||||
|
||||
// EntityMaria, mostly animations
|
||||
extern u16 D_80180BEC[];
|
||||
extern u8 D_80181474[];
|
||||
extern u8 D_80181490[];
|
||||
extern u8 D_801814A0[];
|
||||
extern u8 D_801814BC[];
|
||||
extern u8 D_801814C8[];
|
||||
extern u8 D_801814E8[];
|
||||
extern u8 D_801814F8[];
|
||||
extern u8 D_80181510[];
|
||||
extern u8 D_8018151C[];
|
||||
extern u8 D_80181530[];
|
||||
extern u8 D_80181538[];
|
||||
|
Loading…
Reference in New Issue
Block a user