NO3 EntityForegroundTree (#517)

https://decomp.me/scratch/jeTVE
This commit is contained in:
Alejandro Asenjo Nitti 2023-08-27 18:02:48 -03:00 committed by GitHub
parent ad2131b19e
commit efd48e4a2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 101 additions and 1 deletions

View File

@ -403,6 +403,18 @@ typedef struct {
/* 0x86 */ s8 unk86;
} ET_MermanWaterSplash;
typedef struct {
/* 0x7C */ s32 playerVelocity;
} ET_CastleDoorTransition;
typedef struct {
/* 0x7C */ s8 unk7C;
} ET_AlucardController;
typedef struct {
/* 0x7C */ u16 unk7C;
} ET_ForegroundTree;
typedef union {
/* 0x7C */ struct Primitive* prim;
/* 0x7C */ ET_Generic generic;
@ -435,5 +447,8 @@ typedef union {
/* 0x7C */ ET_801CDFD8 et_801CDFD8;
/* 0x7C */ ET_TransparentWater transparentWater;
/* 0x7C */ ET_HeartRoomGoldDoor heartRoomGoldDoor;
/* 0x7C */ ET_CastleDoorTransition castleDoorTransition;
/* 0x7C */ ET_AlucardController alucardController;
/* 0x7C */ ET_ForegroundTree foregroundTree;
/* 0x7C */ char stub[0x40];
} Ext;

View File

@ -129,7 +129,90 @@ void EntityUnkId53(Entity* entity) {
#endif
// large foreground tree during intro
INCLUDE_ASM("asm/us/st/no3/nonmatchings/3C4EC", EntityForegroundTree);
void EntityForegroundTree(Entity* self) {
Unkstruct8* currentRoomTileLayout = &g_CurrentRoomTileLayout;
Entity *EntRange, *ent, *ent2;
u16* ptrParams;
u16 temp_s4;
s16 var_s3;
u16 y;
if (self->params != 0) {
var_s3 = 320;
ptrParams = &D_80181468[self->ext.foregroundTree.unk7C].x;
} else {
var_s3 = 448;
ptrParams = &D_801813DC[self->ext.foregroundTree.unk7C].x;
}
switch (self->step) {
case 0:
InitializeEntity(D_80180AD0);
EntRange = &g_Entities[192];
self->unk68 = var_s3;
self->flags |= FLAG_UNK_08000000;
label:
if (*ptrParams <= 352) {
ent = AllocEntity(EntRange, &EntRange[64]);
if (ent != NULL) {
CreateEntityFromCurrentEntity(E_ID_11, ent);
ent->posX.i.hi = *ptrParams++;
y = *ptrParams++;
ent->params = (y >> 8) + self->params;
ent->posY.i.hi = y & 255;
ent->unk68 = var_s3;
if (self->params != 0) {
ent->unk6C = 0x60;
}
} else {
ptrParams += 2;
}
self->ext.foregroundTree.unk7C++;
goto label;
}
break;
case 1:
self->posX.i.hi = 128;
temp_s4 = var_s3 * currentRoomTileLayout->unkA / 256 + 352;
if (temp_s4 >= *ptrParams) {
ent = AllocEntity(&g_Entities[192], &g_Entities[256]);
if (ent != NULL) {
CreateEntityFromCurrentEntity(E_ID_11, ent);
ent->posX.i.hi = temp_s4 - ptrParams[0] + 368;
y = ptrParams[1];
ent->params = (y >> 8) + self->params;
ent->posY.i.hi = y & 255;
ent->unk68 = var_s3;
if (self->params != 0) {
ent->unk6C = 0x60;
} else if (self->ext.foregroundTree.unk7C == 7) {
ent2 = AllocEntity(&g_Entities[192], &g_Entities[256]);
CreateEntityFromEntity(E_ID_11, ent, ent2);
ent2->params = 0x12;
ent2->unk68 = var_s3;
ent2->unk6C = 0x40;
ent2->posY.i.hi -= 16;
} else if (self->ext.foregroundTree.unk7C == 10) {
ent2 = AllocEntity(&g_Entities[192], &g_Entities[256]);
CreateEntityFromEntity(E_ID_11, ent, ent2);
ent2->params = 0x13;
ent2->unk68 = var_s3;
ent2->unk6C = 0x40;
ent2->posY.i.hi += 48;
} else if (self->ext.foregroundTree.unk7C == 15) {
ent2 = AllocEntity(&g_Entities[192], &g_Entities[256]);
CreateEntityFromEntity(E_ID_11, ent, ent2);
ent2->params = 0x14;
ent2->unk68 = var_s3;
ent2->unk6C = 0x40;
ent2->posY.i.hi += 4;
}
}
self->ext.foregroundTree.unk7C++;
}
}
}
void EntityUnkId50(Entity* self) {
Unkstruct8* roomLayout = &g_CurrentRoomTileLayout;

View File

@ -95,6 +95,8 @@ extern u16 D_801813AA;
extern u16 D_801813AC[];
extern u16 D_801813AA;
extern u16 D_801813AC[];
extern Point16 D_801813DC[];
extern Point16 D_80181468[];
extern u16 D_801814EC[];
extern u16 D_801817F8[];
extern u8 D_801819D0[];