Skip to content

Commit

Permalink
Decompile DRE EntityUnkId23 (Xeeynamo#1434)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshlory authored Aug 9, 2024
1 parent 301f312 commit a148db7
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/splat.us.stdre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ segments:
- [0x1181C, .rodata, succubuscutscene] #D_80180938, names
- [0x1183C, .rodata, succubuscutscene] #EntitySuccubusCutscene
- [0x118C0, .rodata, 161DC] #EntityCSMoveAlucard, string and jumps
- [0x118F8, rodata]
- [0x118F8, .rodata, 161DC] # EntityUnkId23
- [0x11910, .rodata, 1697C] # EntityFadeToWhite
- [0x1193C, .rodata, e_red_door] # EntityRedDoor
- [0x11954, rodata]
Expand Down
99 changes: 96 additions & 3 deletions src/st/dre/161DC.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,100 @@ void EntityCSMoveAlucard(Entity* self) {
}
}

// Delete this once the below entity is decompiled!
const s32 rodata_pad_118F0 = 0;
// appears to load from the CD and freeze the game
INCLUDE_ASM("st/dre/nonmatchings/161DC", EntityUnkId23);
void EntityUnkId23(Entity* self) {
Entity* player = &PLAYER;
Entity* ent = &g_Entities[80];
s16 diff;

switch (self->step) {
case 0:
InitializeEntity(D_8018047C);
D_8003C8B8 = 0;
g_unkGraphicsStruct.unk0 = 1;
g_Player.padSim = 0;
if (g_Player.unk0C & PLAYER_STATUS_BAT_FORM) {
g_Player.padSim = PAD_R1;
} else if (g_Player.unk0C & PLAYER_STATUS_MIST_FORM) {
g_Player.padSim = PAD_L1;
} else if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) {
g_Player.padSim = PAD_R2;
}
g_Player.D_80072EFC = PAD_L2;
break;

case 1:
g_Player.padSim = 0;
if (g_Player.unk0C & PLAYER_STATUS_TRANSFORM) {
if (g_Timer & 1) {
if (g_Player.unk0C & PLAYER_STATUS_BAT_FORM) {
g_Player.padSim = PAD_R1;
} else if (g_Player.unk0C & PLAYER_STATUS_MIST_FORM) {
g_Player.padSim = PAD_L1;
} else if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) {
g_Player.padSim = PAD_R2;
}
}
} else if ((g_Player.pl_vram_flag & 1) && (D_801A3F84 & 2)) {
diff = player->posX.i.hi - ent->posX.i.hi;
if (diff < -0x50) {
g_Player.padSim = PAD_RIGHT;
D_801816C0 = 0;
self->step += 3;
} else if (diff >= 0x51) {
g_Player.padSim = PAD_LEFT;
D_801816C0 = 1;
self->step += 3;
} else if (ent->facingLeft) {
g_Player.padSim = PAD_RIGHT;
self->step++;
} else {
g_Player.padSim = PAD_LEFT;
self->step += 2;
}
}
g_Player.D_80072EFC = 1;
break;

case 2:
g_Player.padSim = PAD_RIGHT;
diff = player->posX.i.hi - ent->posX.i.hi;
if (diff > 64) {
g_Player.padSim = PAD_LEFT;
D_801816C0 = 1;
self->step += 2;
}
g_Player.D_80072EFC = 1;
break;

case 3:
g_Player.padSim = PAD_LEFT;
diff = player->posX.i.hi - ent->posX.i.hi;
if (diff < -64) {
g_Player.padSim = PAD_RIGHT;
D_801816C0 = 0;
self->step++;
}
g_Player.D_80072EFC = 1;
break;

case 4:
g_Player.padSim = 0;
g_Player.D_80072EFC = 1;
D_801A3F84 |= 1;
if (D_801A3F84 & 0x20) {
self->step++;
}
break;

case 5:
D_8003C8B8 = 1;
if (g_unkGraphicsStruct.unk0 != 0) {
g_unkGraphicsStruct.unk0 = 0;
}
player->posY.i.hi = player->posY.i.hi + 0x100;
g_Player.padSim = 0;
g_Player.D_80072EFC = 1;
break;
}
}
3 changes: 2 additions & 1 deletion src/st/dre/dre.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ extern u32 D_8018125C[];
extern s16 D_801812E4[];
extern u32 D_801812F4[];
extern s16 D_801815E8[]; // X, Y, params for Entity3DHouseSpawner
extern s8 D_801816C4; // Succubus facing assigned to it
extern s8 D_801816C0;
extern s8 D_801816C4; // Succubus facing assigned to it
extern u8 D_80181338[];
extern u16 D_801811A4[];
extern u16 D_801810B0[];
Expand Down

0 comments on commit a148db7

Please sign in to comment.