Skip to content

Commit

Permalink
Decompile EntityWeaponAttack for w_033
Browse files Browse the repository at this point in the history
  • Loading branch information
hohle committed Aug 7, 2024
1 parent 455a97c commit c4132fe
Showing 1 changed file with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion src/weapon/w_033.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,61 @@
#include "weapon_private.h"
#include "shared.h"

INCLUDE_ASM("weapon/nonmatchings/w_033", EntityWeaponAttack);
extern WeaponAnimation D_EB000_8017AC3C[2];

void EntityWeaponAttack(Entity* self) {
WeaponAnimation* anim;
s8 animIndex;

self->posX.val = g_Entities->posX.val;
self->posY.val = PLAYER.posY.val;
self->facingLeft = PLAYER.facingLeft;
animIndex = (self->params & 0x7fff) >> 8;
anim = &D_EB000_8017AC3C[animIndex];

if (PLAYER.ext.player.anim >= anim->frameStart &&
PLAYER.ext.player.anim < (anim->frameStart + 7) && g_Player.unk46) {

if (self->step == 0) {
SetSpriteBank1(&g_Animset);
self->animSet = ANIMSET_OVL(0x10);
self->palette = PAL_DRA(0x110);
self->unk5A = 0x64;
if (g_HandId != 0) {
self->animSet += 2;
self->palette += 0x18;
self->unk5A += 2;
}
self->palette += anim->palette;
self->flags = FALL_TERMINAL_VELOCITY;
self->zPriority = PLAYER.zPriority - 2;
SetWeaponProperties(self, 0);
self->step++;
}

self->ext.weapon.anim = PLAYER.ext.player.anim - anim->frameStart;
if (PLAYER.animFrameDuration == 1 &&
PLAYER.animFrameIdx == anim->soundFrame) {
g_api.PlaySfx(anim->soundId);
}

if (PLAYER.animFrameIdx == 12 && PLAYER.animFrameDuration == 1) {
g_api.PlaySfx(anim->soundId);
g_api.PlaySfx(SFX_WEAPON_SWISH_B);
}
if (g_api.UpdateUnarmedAnim(anim->frameProps, anim->frames) < 0) {
DestroyEntity(self);
return;
}
} else {
DestroyEntity(self);
return;
}

self->drawFlags = PLAYER.drawFlags;
self->rotY = PLAYER.rotY;
self->rotPivotY = PLAYER.rotPivotY;
}

s32 func_ptr_80170004(Entity* self) {}

Expand Down

0 comments on commit c4132fe

Please sign in to comment.