NZ0 EntitySecretRoom Entities (#191)

This commit is contained in:
Alejandro Asenjo Nitti 2023-04-14 13:47:06 -03:00 committed by GitHub
parent 7f02b45ba6
commit e8eb52ad4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 180 additions and 7 deletions

View File

@ -87,6 +87,8 @@ EntityCannon = 0x801B25C4;
EntityCannonShot = 0x801B2874;
EntityCannonWall = 0x801B2978;
EntityRedEyeBust = 0x801B11C0;
EntityLeftSecretRoomWall = 0x801B14C4;
EntityBottomSecretRoomFloor = 0x801B1770;
EntityAxeKnight = 0x801C45BC;
EntityAxeKnightThrowingAxe = 0x801C4D18;
EntityBloodDrips = 0x801C5568;

View File

@ -78,11 +78,158 @@ void EntityRedEyeBust(Entity* self) {
}
}
// DECOMPME_WIP func_801B12E8 https://decomp.me/scratch/3Sf68
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/30958", func_801B12E8);
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/30958", func_801B14C4);
void EntityLeftSecretRoomWall(Entity* self, u16* tileLayoutPtr, s32 tilePos) {
Entity* newEntity;
s32 cond;
s32 i;
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/30958", func_801B1770);
switch (self->step) {
case LEFT_SECRET_ROOM_WALL_INIT:
InitializeEntity(D_80180BF8);
self->hitboxWidth = 16;
self->hitboxHeight = 32;
self->unk3C = 2;
cond = D_8003BDEC[129] != 0;
tileLayoutPtr = &D_80180E54 + (-cond & 0xC);
tilePos = 0x260;
for (i = 0; i < 4; i++) {
g_CurrentRoomTileLayout.fg[tilePos] = *tileLayoutPtr;
g_CurrentRoomTileLayout.fg[tilePos + 1] = *(tileLayoutPtr + 1);
tilePos += 0x10;
tileLayoutPtr += 2;
}
if (D_8003BDEC[129] != 0) {
DestroyEntity(self);
break;
}
case LEFT_SECRET_ROOM_WALL_IDLE:
if (self->unk48 != 0) {
func_801C29B0(NA_SE_EN_ROCK_BREAK);
self->step++;
}
break;
case LEFT_SECRET_ROOM_WALL_BREAK:
self->unk84.unk++;
tileLayoutPtr = &D_80180E54 + (self->unk84.unk * 0x4);
tilePos = 0x260;
for (i = 0; i < 4; i++) {
g_CurrentRoomTileLayout.fg[tilePos] = *tileLayoutPtr;
g_CurrentRoomTileLayout.fg[tilePos + 1] = *(tileLayoutPtr + 1);
tileLayoutPtr += 2;
tilePos += 0x10;
}
newEntity = AllocEntity(&g_EntityArray[224], &g_EntityArray[256]);
if (newEntity != NULL) {
CreateEntityFromEntity(2, self, newEntity);
newEntity->subId = 0x13;
}
self->unk80.modeS32 = 32;
self->step++;
if (self->unk84.unk == 3) {
D_8003BDEC[129] = 1;
g_api.func_800F1FC4(0x81);
for (i = 0; i < 8; i++) {
newEntity =
AllocEntity(&g_EntityArray[224], &g_EntityArray[256]);
if (newEntity != NULL) {
CreateEntityFromEntity(0x22, self, newEntity);
newEntity->posX.i.hi += (Random() & 0xF);
newEntity->posY.i.hi -= 0x20 - (Random() & 0x3F);
}
}
DestroyEntity(self);
}
break;
case LEFT_SECRET_ROOM_WALL_CHECK:
if (--self->unk80.modeS32 == 0) {
self->step = LEFT_SECRET_ROOM_WALL_IDLE;
}
break;
}
}
void EntityBottomSecretRoomFloor(Entity* self, u16* tileLayoutPtr,
s32 tilePos) {
Entity* newEntity;
s32 flag;
s32 i;
switch (self->step) {
case BOTTOM_SECRET_ROOM_FLOOR_INIT:
InitializeEntity(D_80180BF8);
self->hitboxWidth = 16;
self->hitboxHeight = 16;
self->unk3C = 2;
flag = (D_8003BDEC[130] != 0);
tileLayoutPtr = &D_80180E94 + (-flag & 0x6);
tilePos = 0x2E7;
for (i = 0; i < 2; i++) {
g_CurrentRoomTileLayout.fg[tilePos] = *tileLayoutPtr;
g_CurrentRoomTileLayout.fg[tilePos + 1] = *(tileLayoutPtr + 1);
tileLayoutPtr += 2;
tilePos += 0x10;
}
if (D_8003BDEC[130] != 0) {
DestroyEntity(self);
break;
}
case BOTTOM_SECRET_ROOM_FLOOR_IDLE:
if (self->unk48 != 0) {
func_801C29B0(NA_SE_EN_ROCK_BREAK);
self->step++;
}
return;
case BOTTOM_SECRET_ROOM_FLOOR_BREAK:
self->unk84.unk++;
tileLayoutPtr = &D_80180E94 + (self->unk84.unk * 2);
tilePos = 0x2E7;
for (i = 0; i < 2; i++) {
g_CurrentRoomTileLayout.fg[tilePos] = *tileLayoutPtr;
g_CurrentRoomTileLayout.fg[tilePos + 1] = *(tileLayoutPtr + 1);
tileLayoutPtr += 2;
tilePos += 0x10;
}
newEntity = AllocEntity(D_8007D858, &D_8007D858[32]);
if (newEntity != NULL) {
CreateEntityFromEntity(2, self, newEntity);
newEntity->subId = 0x11;
}
self->unk80.modeS32 = 32;
self->step++;
if (self->unk84.unk == 3) {
D_8003BDEC[130] = 1;
g_api.func_800F1FC4(0x82);
DestroyEntity(self);
}
break;
case BOTTOM_SECRET_ROOM_FLOOR_CHECK:
if (--self->unk80.modeS32 == 0) {
self->step = BOTTOM_SECRET_ROOM_FLOOR_IDLE;
}
break;
}
}
void func_801B19A0(Entity* self) {
Collider collider;
@ -1242,7 +1389,7 @@ void func_801B6DE4(Entity* self) {
self->posY.i.hi =
(u16)(self->unk80.modeS16.unk0 - (g_Camera.posY.i.hi - 4));
self->step++;
func_801C29B0(0x676);
func_801C29B0(NA_SE_EV_SWITCH_CLICK);
D_801813A4 = self->subId;
}
}

View File

@ -137,7 +137,7 @@ void EntityAxeKnight(Entity* self) {
self->unk7C.S8.unk0 = 0;
}
} else if ((animStatus & 0x80) && (self->animFrameIdx == 7)) {
func_801C29B0(0x766);
func_801C29B0(NA_SE_VO_AXE_KNIGHT_THROW);
newEntity = AllocEntity(D_8007A958, &D_8007A958[32]);
if (newEntity != NULL) {
CreateEntityFromCurrentEntity(0x2A, newEntity);
@ -156,7 +156,7 @@ void EntityAxeKnight(Entity* self) {
animStatus = AnimateEntity(D_80182220, self);
if (animStatus != 0) {
if ((animStatus & 0x80) && (self->animFrameIdx == 6)) {
func_801C29B0(0x766);
func_801C29B0(NA_SE_VO_AXE_KNIGHT_THROW);
newEntity = AllocEntity(D_8007A958, &D_8007A958[32]);
if (newEntity != NULL) {
CreateEntityFromCurrentEntity(0x2A, newEntity);

View File

@ -33,10 +33,14 @@ extern u16 D_80180D30[];
extern u16 D_80180D3C[];
extern u16 D_80180D48[];
extern ObjInit2 D_80180D64[];
extern u16* D_80180E54;
extern u16* D_80180E94;
extern s32 D_80180EB4;
extern u16 D_80180ED4[];
extern u16 D_80180EE0[];
extern s32 D_80180EEC;
extern const u8 D_80180EF0[];
extern const u8 D_80180EF8[];
extern u16 D_80180F10[];
extern const u8 D_80180F1C[];
extern u8 D_80180F30;
@ -48,8 +52,6 @@ extern u16 D_80180F9C[];
extern u32 g_randomNext;
extern s8 c_HeartPrizes[];
extern Entity* g_CurrentEntity;
extern const u8 D_80180EF0[];
extern const u8 D_80180EF8[];
extern s32 D_80181010;
extern const u8 D_80181160[];
extern const u8 D_80181170[];
@ -143,6 +145,28 @@ extern SubWpnContDebris D_80182584[ENTITY_SUBWPNCONT_DEBRIS_COUNT];
// *** EntitySubWeaponContainer properties END ***
// *** EntityLeftSecretRoomWall properties START ***
typedef enum {
LEFT_SECRET_ROOM_WALL_INIT,
LEFT_SECRET_ROOM_WALL_IDLE,
LEFT_SECRET_ROOM_WALL_BREAK,
LEFT_SECRET_ROOM_WALL_CHECK
} LEFT_SECRET_ROOM_WALL_STEPS;
// *** EntityLeftSecretRoomWall properties END ***
// *** EntityBottomSecretRoomFloor properties START ***
typedef enum {
BOTTOM_SECRET_ROOM_FLOOR_INIT,
BOTTOM_SECRET_ROOM_FLOOR_IDLE,
BOTTOM_SECRET_ROOM_FLOOR_BREAK,
BOTTOM_SECRET_ROOM_FLOOR_CHECK
} BOTTOM_SECRET_ROOM_FLOOR_STEPS;
// *** EntityBottomSecretRoomFloor properties END ***
extern s32 D_801825CC[]; // SubWeapons subId table
extern u8 D_801825F0;
extern u16 D_80180C70[];