mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2025-02-22 22:22:35 +00:00
Decompile w58 (Alucart Shield) EntityWeaponAttack (#1440)
Finishing the Alucart Shield. Noticed we are doing stuff with offset 0xAC which sounds a lot like the one in the Player entity, so I called it anim for now especially since it seems connected with animations. This finishes this shield. I'm going to try to go through all the shields in the weapon overlays and get them done, they seem like some of the most complicated since a lot of the shield spells do some kind of crazy stuff with graphics.
This commit is contained in:
parent
42107e8bb8
commit
47b3b3eb2c
@ -292,7 +292,9 @@ typedef struct {
|
|||||||
/* 0x98 */ s16 unk98;
|
/* 0x98 */ s16 unk98;
|
||||||
/* 0x9A */ s16 unk9A;
|
/* 0x9A */ s16 unk9A;
|
||||||
/* 0x9C */ s16 unk9C;
|
/* 0x9C */ s16 unk9C;
|
||||||
/* 0x9E */ byte pad[16];
|
/* 0x9E */ byte pad[14];
|
||||||
|
/* 0xAC */ u8 anim;
|
||||||
|
/* 0xAD */ u8 padAD;
|
||||||
/* 0xAE */ s16 unkAE;
|
/* 0xAE */ s16 unkAE;
|
||||||
} ET_Shield;
|
} ET_Shield;
|
||||||
|
|
||||||
|
@ -4,8 +4,145 @@
|
|||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
extern SpriteParts D_19A000_8017A040[];
|
extern SpriteParts D_19A000_8017A040[];
|
||||||
|
extern s8 D_19A000_8017AB3C;
|
||||||
|
extern AnimationFrame* D_19A000_8017AB84;
|
||||||
|
extern s32 D_19A000_8017BB40;
|
||||||
|
|
||||||
INCLUDE_ASM("weapon/nonmatchings/w_058", EntityWeaponAttack);
|
void EntityWeaponAttack(Entity* self) {
|
||||||
|
s32 anim1;
|
||||||
|
s32 anim2;
|
||||||
|
s32 attackButton;
|
||||||
|
|
||||||
|
anim1 = 0;
|
||||||
|
anim2 = 0;
|
||||||
|
if (g_HandId) {
|
||||||
|
attackButton = PAD_CIRCLE;
|
||||||
|
} else {
|
||||||
|
attackButton = PAD_SQUARE;
|
||||||
|
}
|
||||||
|
if (!(attackButton & g_Player.padPressed) && (self->step < 3)) {
|
||||||
|
self->animFrameDuration = 0;
|
||||||
|
self->animFrameIdx = 0;
|
||||||
|
self->step = 3;
|
||||||
|
}
|
||||||
|
if (self->step != 4) {
|
||||||
|
self->posX.val = PLAYER.posX.val;
|
||||||
|
self->posY.val = PLAYER.posY.val;
|
||||||
|
self->facingLeft = PLAYER.facingLeft;
|
||||||
|
}
|
||||||
|
if ((g_Player.unk0C & PLAYER_STATUS_UNK10000) && (self->step != 4)) {
|
||||||
|
self->zPriority = PLAYER.zPriority + 2;
|
||||||
|
self->step = 4;
|
||||||
|
if (g_Player.pl_vram_flag & 1) {
|
||||||
|
self->velocityX = PLAYER.velocityX;
|
||||||
|
} else {
|
||||||
|
self->velocityX = PLAYER.velocityX * 2;
|
||||||
|
}
|
||||||
|
self->velocityY = FIX(-3.5);
|
||||||
|
self->ext.timer.t = 0x80;
|
||||||
|
self->flags = FLAG_UNK_08000000;
|
||||||
|
self->animCurFrame = 0x3E;
|
||||||
|
}
|
||||||
|
if ((PLAYER.step == Player_Crouch) && (PLAYER.step_s != 2)) {
|
||||||
|
anim2++;
|
||||||
|
}
|
||||||
|
switch (self->step) {
|
||||||
|
case 0:
|
||||||
|
SetSpriteBank1(D_19A000_8017A040);
|
||||||
|
if (g_HandId != 0) {
|
||||||
|
self->animSet = ANIMSET_OVL(0x12);
|
||||||
|
self->palette = 0x128;
|
||||||
|
self->unk5A = 0x66;
|
||||||
|
} else {
|
||||||
|
self->animSet = ANIMSET_OVL(0x10);
|
||||||
|
self->palette = 0x110;
|
||||||
|
self->unk5A = 0x64;
|
||||||
|
}
|
||||||
|
self->flags = FLAG_UNK_40000 | FLAG_UNK_20000;
|
||||||
|
self->zPriority = PLAYER.zPriority - 2;
|
||||||
|
g_Player.unk48 = 1;
|
||||||
|
SetWeaponProperties(self, 0);
|
||||||
|
D_19A000_8017BB40 = self->attack;
|
||||||
|
self->attack = 1;
|
||||||
|
self->step++;
|
||||||
|
/* fallthrough */
|
||||||
|
case 1:
|
||||||
|
self->ext.shield.anim = anim2 + 10;
|
||||||
|
if (self->animFrameDuration < 0) {
|
||||||
|
self->step++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
switch (PLAYER.ext.player.anim) {
|
||||||
|
case 9:
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
anim1++;
|
||||||
|
/* fallthrough */
|
||||||
|
case 7:
|
||||||
|
anim1++;
|
||||||
|
/* fallthrough */
|
||||||
|
case 8:
|
||||||
|
anim1++;
|
||||||
|
/* fallthrough */
|
||||||
|
case 12:
|
||||||
|
anim1++;
|
||||||
|
/* fallthrough */
|
||||||
|
case 13:
|
||||||
|
anim1++;
|
||||||
|
/* fallthrough */
|
||||||
|
case 24:
|
||||||
|
case 25:
|
||||||
|
anim1++;
|
||||||
|
/* fallthrough */
|
||||||
|
case 14:
|
||||||
|
case 15:
|
||||||
|
anim1++;
|
||||||
|
/* fallthrough */
|
||||||
|
case 26:
|
||||||
|
anim1 += 2;
|
||||||
|
self->animFrameIdx = PLAYER.animFrameIdx;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
self->animFrameIdx = 0;
|
||||||
|
anim1 += anim2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
self->ext.shield.anim = anim1;
|
||||||
|
self->animFrameDuration = 2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
g_Player.unk48 = 0;
|
||||||
|
self->ext.shield.anim = anim2 + 12;
|
||||||
|
if (self->animFrameDuration < 0) {
|
||||||
|
DestroyEntity(self);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
self->hitboxState = 0;
|
||||||
|
g_Player.unk48 = 0;
|
||||||
|
self->drawFlags |= FLAG_DRAW_ROTZ;
|
||||||
|
self->posY.val += self->velocityY;
|
||||||
|
self->posX.val += self->velocityX;
|
||||||
|
self->velocityY += FIX(20.0 / 128);
|
||||||
|
self->rotZ += 0x80;
|
||||||
|
if (--self->ext.timer.t < 0x10) {
|
||||||
|
self->drawFlags |= FLAG_DRAW_UNK80;
|
||||||
|
}
|
||||||
|
if (--self->ext.timer.t == 0) {
|
||||||
|
DestroyEntity(self);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (self->step != 4) {
|
||||||
|
g_api.PlayAnimation(&D_19A000_8017AB3C, &D_19A000_8017AB84);
|
||||||
|
}
|
||||||
|
self->drawFlags = PLAYER.drawFlags;
|
||||||
|
self->rotY = PLAYER.rotY;
|
||||||
|
self->rotPivotY = PLAYER.rotPivotY;
|
||||||
|
}
|
||||||
|
|
||||||
s32 func_ptr_80170004(Entity* self) {}
|
s32 func_ptr_80170004(Entity* self) {}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user