Skip to content

Commit

Permalink
Decompile lib dhuron functions (#2203)
Browse files Browse the repository at this point in the history
`func_us_801CC6B0`:
PSX: https://decomp.me/scratch/XJVWJ
PSP: https://decomp.me/scratch/BKgXI

`func_us_801CC7BC`:
PSX: https://decomp.me/scratch/cSNo7
PSP: https://decomp.me/scratch/lsF0V

`func_us_801CC984`:
PSX: https://decomp.me/scratch/HtaiR
PSP: https://decomp.me/scratch/NXku6

`func_us_801CC984` uses `ext.dhuron.unk88` as an s16 and
`ext.dhuron.unk89` as a u8 . I reused the same extension struct for
simplicity but maybe this is a union or a completely separate extension
struct.
  • Loading branch information
gamezter authored Feb 12, 2025
1 parent 36a49e0 commit 9488eb0
Show file tree
Hide file tree
Showing 37 changed files with 348 additions and 73 deletions.
7 changes: 3 additions & 4 deletions include/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -2804,11 +2804,10 @@ typedef struct {
} ET_LibraryShadow;

typedef struct {
/* 0x7C */ s32 : 32;
/* 0x80 */ s16 : 16;
/* 0x82 */ s16 : 16;
/* 0x7C */ struct Primitive* unk7C;
/* 0x80 */ struct Primitive* unk80;
/* 0x84 */ s16 unk84;
/* 0x86 */ s16 : 16;
/* 0x86 */ s16 unk86;
/* 0x88 */ u8 unk88;
/* 0x89 */ u8 unk89;
/* 0x8A */ s16 : 16;
Expand Down
2 changes: 1 addition & 1 deletion src/dra/692E8.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void func_80109594() {
DestroyEntity(e);
e->animSet = ANIMSET_DRA(1);
e->unk5A = i + 1;
e->palette = 0x8100;
e->palette = PAL_OVL(0x100);
e->flags = FLAG_UNK_20000 | FLAG_POS_CAMERA_LOCKED;
}

Expand Down
2 changes: 1 addition & 1 deletion src/dra/75F54.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ bool BatFormFinished(void) {
SetPlayerStep(Player_UnmorphBat);
SetPlayerAnim(0xCA);
D_800AFDA4[1] = 6;
g_Entities->palette = 0x810D;
g_Entities->palette = PAL_OVL(0x10D);
g_Player.unk66 = 0;
g_Player.unk68 = 0;
CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(44, 0x21), 0);
Expand Down
8 changes: 4 additions & 4 deletions src/dra/7879C.c
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,7 @@ void func_8011B5A4(Entity* self) {
self->anim = D_800AD57C;
self->zPriority = PLAYER.zPriority + 2;
self->flags = FLAG_POS_CAMERA_LOCKED | FLAG_UNK_100000 | FLAG_UNK_10000;
self->palette = 0x8195;
self->palette = PAL_OVL(0x195);
paramsHi = self->params >> 8;
paramsLo = self->params & 0xFF;
self->drawMode = DRAW_TPAGE;
Expand Down Expand Up @@ -1660,12 +1660,12 @@ void EntityUnkId24(Entity* self) {
self->posX.i.hi -= 32 - (rand() & 63);
self->posY.i.hi -= 48 - (rand() & 63);
self->drawMode = DRAW_TPAGE;
self->palette = 0x8195;
self->palette = PAL_OVL(0x195);
} else {
self->posY.i.hi -= 12 - rand() % 24;
self->drawFlags = FLAG_DRAW_ROTY | FLAG_DRAW_ROTX;
self->rotX = self->rotY = 0x80;
self->palette = 0x8170;
self->palette = PAL_OVL(0x170);
}
self->step++;
return;
Expand Down Expand Up @@ -2691,7 +2691,7 @@ void EntityWingSmashTrail(Entity* entity) {
entity->drawMode = DRAW_TPAGE2 | DRAW_TPAGE;
entity->rotZ = PLAYER.rotZ;
entity->facingLeft = PLAYER.facingLeft;
entity->palette = 0x8102;
entity->palette = PAL_OVL(0x102);
entity->rotX = entity->rotY = 0x100;
entity->step++;
return;
Expand Down
6 changes: 3 additions & 3 deletions src/dra/7E4BC.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ void func_8011EDA8(Entity* self) {
} else {
self->animSet = ANIMSET_DRA(5);
self->anim = D_800AD57C;
self->palette = 0x8170;
self->palette = PAL_OVL(0x170);
}
}
self->flags = FLAG_UNK_20000 | FLAG_UNK_100000 | FLAG_POS_CAMERA_LOCKED;
Expand Down Expand Up @@ -585,7 +585,7 @@ void func_8011F074(Entity* entity) {
entity->unk5A = 0x79;
entity->animSet = ANIMSET_DRA(14);
entity->zPriority = PLAYER.zPriority + 2;
entity->palette = 0x819F;
entity->palette = PAL_OVL(0x19F);

if (D_8013808C & 1) {
entity->drawMode = DRAW_UNK_40 | DRAW_TPAGE2 | DRAW_TPAGE;
Expand Down Expand Up @@ -2380,7 +2380,7 @@ void func_80123F78(Entity* entity) {
entity->unk5A = 0xD;
entity->drawFlags = PLAYER.drawFlags;
entity->drawMode = DRAW_TPAGE2 | DRAW_TPAGE;
entity->palette = 0x815F;
entity->palette = PAL_OVL(0x15F);
entity->zPriority = PLAYER.zPriority - 2;
entity->facingLeft = PLAYER.facingLeft;

Expand Down
2 changes: 1 addition & 1 deletion src/dra/843B0.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void EntityPlayerSleepZ(Entity* self) {
self->velocityY = FIX(-0.375);
SetSpeedX(FIX(0.25));
self->unk5A = 0x50;
self->palette = 0x819F;
self->palette = PAL_OVL(0x19F);
self->anim = D_800AE294;

self->posY.i.hi -= 16;
Expand Down
2 changes: 1 addition & 1 deletion src/dra/8D3E8.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ void func_8012F894(Entity* self) {
f178_finish = false;
if (abs(PLAYER.velocityX) > FIX(3)) {
f178_finish = true;
self->palette = PLAYER.palette = 0x810D;
self->palette = PLAYER.palette = PAL_OVL(0x10D);
}
prim = &g_PrimBuf[self->primIndex];
func_8012F178(prim, f178_count, f178_finish);
Expand Down
2 changes: 1 addition & 1 deletion src/dra_psp/58E60.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void EntityPlayerSleepZ(Entity* self) {
self->velocityY = FIX(-0.375);
SetSpeedX(FIX(0.25));
self->unk5A = 0x50;
self->palette = 0x819F;
self->palette = PAL_OVL(0x19F);
self->anim = D_800AE294;

self->posY.i.hi -= 16;
Expand Down
2 changes: 1 addition & 1 deletion src/ric/1AC60.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void RicInit(s16 initParam) {
DestroyEntity(e);
e->animSet = ANIMSET_OVL(0x10);
e->unk5A = i + 1;
e->palette = 0x8120;
e->palette = PAL_OVL(0x120);
e->flags = FLAG_UNK_20000 | FLAG_POS_CAMERA_LOCKED;
}
primIndex = g_api.AllocPrimitives(PRIM_TILE, 6);
Expand Down
2 changes: 1 addition & 1 deletion src/ric/211D0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ void RicEntityHitByDark(Entity* entity) {
entity->unk5A = 0x79;
entity->animSet = ANIMSET_DRA(14);
entity->zPriority = PLAYER.zPriority + 2;
entity->palette = 0x819F;
entity->palette = PAL_OVL(0x19F);

if (D_80174FFC & 1) {
entity->drawMode = DRAW_UNK_40 | DRAW_TPAGE2 | DRAW_TPAGE;
Expand Down
2 changes: 1 addition & 1 deletion src/ric/24788.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ void func_80161C2C(Entity* self) {
} else {
self->animSet = ANIMSET_DRA(5);
self->anim = anim_smoke_puff;
self->palette = 0x8170;
self->palette = PAL_OVL(0x170);
}
}
self->flags = FLAG_UNK_20000 | FLAG_UNK_100000 | FLAG_POS_CAMERA_LOCKED;
Expand Down
22 changes: 11 additions & 11 deletions src/ric/2A060.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ void RicEntityWhip(Entity* self) {
self->step = 1;
self->velocityX = 0;
self->velocityY = 0;
self->palette = 0x8148;
self->palette = PAL_OVL(0x148);
if (!PLAYER.facingLeft) {
self->ext.whip.unk88 = playerUnk46;
} else {
Expand Down Expand Up @@ -419,9 +419,9 @@ void RicEntityWhip(Entity* self) {
}
switch (self->step) {
case 0:
self->animSet = -0x7FEE;
self->animSet = ANIMSET_OVL(18);
self->animCurFrame = 0x1E;
self->palette = 0x8138;
self->palette = PAL_OVL(0x138);
self->unk5A = 0x46;
if (lowerParams < 8) {
self->hitboxWidth = 3;
Expand Down Expand Up @@ -555,12 +555,12 @@ void RicEntityWhip(Entity* self) {
if (PLAYER.animFrameIdx == 6) {
if ((PLAYER.animFrameDuration >= 0xF) ||
(PLAYER.animFrameDuration == 0)) {
self->palette = 0x8138;
self->palette = PAL_OVL(0x138);
} else if ((PLAYER.animFrameDuration == 11 ||
PLAYER.animFrameDuration == 12) ||
(PLAYER.animFrameDuration == 13 ||
PLAYER.animFrameDuration == 14)) {
self->palette = 0x813C;
self->palette = PAL_OVL(0x13C);
} else {
// animFrameDuration can be -1 apparently.
// todo this should read the previous element out of bounds?
Expand Down Expand Up @@ -613,15 +613,15 @@ void RicEntityWhip(Entity* self) {
}
// This very well might be a switch
if (PLAYER.animFrameDuration > 14) {
self->palette = 0x8138;
self->palette = PAL_OVL(0x138);
} else if (PLAYER.animFrameDuration == 0) {
self->palette = 0x8138;
self->palette = PAL_OVL(0x138);
} else if (PLAYER.animFrameDuration == 11 ||
PLAYER.animFrameDuration == 12) {
self->palette = 0x813C;
self->palette = PAL_OVL(0x13C);
} else if (PLAYER.animFrameDuration == 13 ||
PLAYER.animFrameDuration == 14) {
self->palette = 0x813C;
self->palette = PAL_OVL(0x13C);
} else {
// animFrameDuration can be -1 apparently.
// todo this should read the previous element out of bounds?
Expand Down Expand Up @@ -733,7 +733,7 @@ void RicEntityWhip(Entity* self) {
self->drawMode = DRAW_TPAGE2 | DRAW_TPAGE;
self->drawFlags |= DRAW_HIDE;
}
self->palette = 0x8160;
self->palette = PAL_OVL(0x160);
}
}

Expand Down Expand Up @@ -761,7 +761,7 @@ void RicEntityArmBrandishWhip(Entity* entity) {
FLAG_KEEP_ALIVE_OFFCAMERA | FLAG_UNK_10000;
entity->animSet = ANIMSET_OVL(18);
entity->unk5A = 0x46;
entity->palette = 0x8120;
entity->palette = PAL_OVL(0x120);
entity->zPriority = PLAYER.zPriority + 2;
}

Expand Down
10 changes: 5 additions & 5 deletions src/ric/2C4C4.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void RicEntitySubwpnHolyWater(Entity* self) {
self->animCurFrame = 0x23;
self->zPriority = PLAYER.zPriority + 2;
self->unk5A = 0x46;
self->palette = 0x812F;
self->palette = PAL_OVL(0x12F);
self->posX.i.hi = self->posX.i.hi;
self->posY.i.hi = self->posY.i.hi - 0x10;
self->ext.holywater.angle = (rand() & 0x7F) + 0xDC0;
Expand Down Expand Up @@ -649,9 +649,9 @@ void RicEntitySubwpnCross(Entity* self) {
}
// Applies a flickering effect
if (!((g_GameTimer >> 1) & 1)) {
self->palette = 0x81B1;
self->palette = PAL_OVL(0x1B1);
} else {
self->palette = 0x81B0;
self->palette = PAL_OVL(0x1B0);
}
temp_a0 = self->ext.crossBoomerang.unk84;
// This indexes into the unk84 array.
Expand Down Expand Up @@ -721,7 +721,7 @@ void RicEntitySubwpnCrossTrail(Entity* self) {
self->animSet = ANIMSET_OVL(17);
self->animCurFrame = D_80155E68[self->params];
self->unk5A = 0x66;
self->palette = 0x81B0;
self->palette = PAL_OVL(0x1B0);
self->drawMode = DRAW_TPAGE;
self->facingLeft = PLAYER.facingLeft;
self->zPriority = PLAYER.zPriority;
Expand Down Expand Up @@ -2339,7 +2339,7 @@ void RicEntityVibhutiCrashCloud(Entity* entity) {
RicSetSubweaponParams(entity);
entity->unk5A = 0x79;
entity->animSet = ANIMSET_DRA(14);
entity->palette = 0x819E;
entity->palette = PAL_OVL(0x19E);
entity->anim = D_80155EA8;
entity->drawMode = DRAW_TPAGE2 | DRAW_TPAGE;
entity->drawFlags = FLAG_DRAW_UNK8;
Expand Down
2 changes: 1 addition & 1 deletion src/servant/tt_003/demon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ void func_us_801765A0(Entity* self) {
}

self->flags = FLAG_POS_CAMERA_LOCKED | FLAG_KEEP_ALIVE_OFFCAMERA;
self->palette = 0x8143;
self->palette = PAL_OVL(0x143);
self->drawMode = DRAW_TPAGE2 | DRAW_TPAGE;
self->animSet = 0xE;
self->unk5A = 0x79;
Expand Down
2 changes: 1 addition & 1 deletion src/st/chi/en_salem_witch.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ void EntitySalemWitchTriboltLaunch(Entity* self) {
return;

case SPAWN_PROJECTILES:
self->animSet = -0x7FFA;
self->animSet = ANIMSET_OVL(6);
self->unk5A = 0x4B;
self->rotY = BurstStartRotation;
self->rotX = BurstStartRotation;
Expand Down
2 changes: 1 addition & 1 deletion src/st/e_explosion_puff_opaque.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void EntityExplosionPuffOpaque(Entity* self) {
}

if (self->params & 0xF0) {
self->palette = 0x819F;
self->palette = PAL_OVL(0x19F);
self->drawMode = DRAW_TPAGE;
self->facingLeft = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions src/st/e_merman2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1371,10 +1371,10 @@ void EntityHighWaterSplash(Entity* self) {
InitializeEntity(g_EInitParticle);
self->animSet = ANIMSET_DRA(2);
self->velocityY = FIX(-5);
self->palette = 0x8162;
self->palette = PAL_OVL(0x162);
self->drawMode = DRAW_TPAGE;
self->drawFlags |= FLAG_DRAW_ROTY | FLAG_DRAW_ROTX;
self->palette = 0x8018;
self->palette = PAL_OVL(0x18);
self->drawMode = DRAW_TPAGE2 | DRAW_TPAGE;
self->drawFlags |= FLAG_DRAW_UNK8;
self->unk6C = 0xA0;
Expand Down
Loading

0 comments on commit 9488eb0

Please sign in to comment.