blob: 82cb79f99ce5df41c6c678dac3ac01443ceea8e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/**
* @file playerItemPacciCane.c
* @ingroup Items
*
* @brief Pacci Cane Player Item
*/
#include "common.h"
#include "entity.h"
#include "save.h"
#include "sound.h"
#include "pauseMenu.h"
#include "vram.h"
#include "asm.h"
void PlayerItemPacciCane_Action1(Entity*);
void PlayerItemPacciCane_Init(Entity* this);
void PlayerItemPacciCane(Entity* this) {
static void (*const PlayerItemPacciCane_Actions[])(Entity*) = {
PlayerItemPacciCane_Init,
PlayerItemPacciCane_Action1,
};
PlayerItemPacciCane_Actions[this->action](this);
}
void PlayerItemPacciCane_Init(Entity* this) {
this->action = 1;
this->frameIndex = -1;
LoadSwapGFX(this, 1, 3);
SoundReq(SFX_10E);
PlayerItemPacciCane_Action1(this);
}
void PlayerItemPacciCane_Action1(Entity* this) {
u32 playerFrame;
u32 frameIndex;
u32 flipX;
if (((gPlayerEntity.base.frame & ANIM_DONE) != 0) || (this != gPlayerState.item)) {
if (this == gPlayerState.item) {
gPlayerState.item = NULL;
}
DeleteEntity(this);
} else {
playerFrame = gPlayerEntity.base.frame & 0xf;
if (playerFrame != 0xf) {
frameIndex = gPlayerEntity.base.frameIndex;
playerFrame += 0x91;
if (frameIndex - playerFrame != this->frameIndex) {
this->frameIndex = frameIndex + 0x6f;
sub_080042D0(this, this->frameIndex, this->spriteIndex);
}
sub_08078E84(this, &gPlayerEntity.base);
} else {
this->frameIndex = -1;
}
}
if ((gPlayerEntity.base.animationState & 2)) {
flipX = gPlayerEntity.base.spriteSettings.flipX ^ 1;
} else {
flipX = gPlayerEntity.base.spriteSettings.flipX;
}
this->spriteSettings.flipX = flipX;
}
// TODO This name sounds like this does not belong in this file
void ClearMenuSavestate(void) {
MemClear(&gPauseMenuOptions, sizeof(gPauseMenuOptions));
}
|