mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-27 06:50:35 +00:00
Decompile func_ptr_80170004
of w_038
(#1579)
This commit is contained in:
parent
3cba98f975
commit
27e8618e7b
@ -70,7 +70,120 @@ static void EntityWeaponAttack(Entity* self) {
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("weapon/nonmatchings/w_038", func_ptr_80170004);
|
||||
extern s32 D_10E000_8017B844;
|
||||
|
||||
s32 func_ptr_80170004(Entity* self) {
|
||||
Primitive* prim;
|
||||
s32 i;
|
||||
s16 x, y;
|
||||
s16 newX;
|
||||
s16 newY;
|
||||
s16 xOffset, yOffset;
|
||||
s16 params;
|
||||
|
||||
params = (self->params & 0x7fff) >> 8; // unused (for PSP)
|
||||
|
||||
self->posX.val = PLAYER.posX.val;
|
||||
self->posY.val = PLAYER.posY.val;
|
||||
self->facingLeft = PLAYER.facingLeft;
|
||||
|
||||
if (!g_Player.unk46 || PLAYER.step_s != 0x5A) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->step == 0) {
|
||||
self->primIndex = g_api.AllocPrimitives(PRIM_LINE_G2, 24);
|
||||
|
||||
if (self->primIndex == -1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
|
||||
for (i = 0; i < 24; i++) {
|
||||
prim->r1 = (rand() & 0xF) + 63;
|
||||
prim->g1 = 255;
|
||||
prim->b1 = 63;
|
||||
prim->r0 = 15;
|
||||
prim->g0 = 63;
|
||||
prim->b0 = 15;
|
||||
prim->r2 = i + 1;
|
||||
prim->priority = PLAYER.zPriority + 4;
|
||||
prim->drawMode = DRAW_UNK_200 | DRAW_UNK_100 | DRAW_TPAGE2 |
|
||||
DRAW_TPAGE | DRAW_HIDE | DRAW_TRANSP;
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
self->flags = FLAG_HAS_PRIMS | FLAG_UNK_40000 | FLAG_UNK_20000;
|
||||
self->ext.weapon.equipId = self->ext.weapon.parent->ext.weapon.equipId;
|
||||
SetWeaponProperties(self, 0);
|
||||
self->enemyId = self->ext.weapon.parent->enemyId;
|
||||
D_10E000_8017B844 = 40;
|
||||
self->hitboxWidth = 24;
|
||||
self->hitboxHeight = 10;
|
||||
self->hitboxOffX = 38;
|
||||
self->hitboxOffY = -12;
|
||||
self->step++;
|
||||
|
||||
} else {
|
||||
if ((D_10E000_8017B844 & 7) == 7) {
|
||||
g_api.PlaySfx(SFX_ANIME_SWORD_B);
|
||||
}
|
||||
|
||||
if (!--D_10E000_8017B844) {
|
||||
g_api.PlaySfx(SFX_UNK_6F0);
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
|
||||
xOffset = 34;
|
||||
yOffset = -14;
|
||||
if (PLAYER.facingLeft) {
|
||||
xOffset = -xOffset;
|
||||
}
|
||||
|
||||
newX = PLAYER.posX.i.hi + xOffset;
|
||||
newY = PLAYER.posY.i.hi + yOffset;
|
||||
if (PLAYER.drawFlags & FLAG_DRAW_ROTY) {
|
||||
newY -= 3;
|
||||
}
|
||||
|
||||
for (i = 0; i < 0x18; i++) {
|
||||
switch (prim->r3) {
|
||||
case 0:
|
||||
if (--prim->r2 == 0) {
|
||||
x = newX + (rand() % 24) - 12;
|
||||
y = (newY + (rand() % 18)) - 9;
|
||||
if (!PLAYER.facingLeft) {
|
||||
prim->x0 = x - 12;
|
||||
prim->x1 = x + 16;
|
||||
} else {
|
||||
prim->x0 = x + 16;
|
||||
prim->x1 = x - 12;
|
||||
}
|
||||
prim->y1 = y;
|
||||
prim->y0 = y;
|
||||
prim->drawMode &= ~DRAW_HIDE;
|
||||
prim->r2 = 3;
|
||||
prim->r3++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (--prim->r2 == 0) {
|
||||
prim->r2 = 2;
|
||||
prim->r3 = 0;
|
||||
prim->drawMode |= DRAW_HIDE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
prim = prim->next;
|
||||
}
|
||||
}
|
||||
|
||||
static void func_ptr_80170008(Entity* self) {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user