blob: b7819429943464b02614421069e14dd42b2aa676 (
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
|
/**
* @file minishSizedEntrance.c
* @ingroup Objects
*
* @brief MinishSizedEntrance object
*/
#include "game.h"
#include "object.h"
#include "asm.h"
#include "room.h"
#include "player.h"
#include "vram.h"
void MinishSizedEntrance_Action1(Entity*);
void MinishSizedEntrance_Init(Entity*);
void MinishSizedEntrance(Entity* this) {
static void (*const MinishSizedEntrance_Actions[])(Entity*) = {
MinishSizedEntrance_Init,
MinishSizedEntrance_Action1,
};
MinishSizedEntrance_Actions[this->action](this);
}
void MinishSizedEntrance_Init(Entity* this) {
this->action = 1;
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 7;
this->frameIndex = this->type2;
if (AreaIsDungeon()) {
this->frameIndex += 4;
UnloadGFXSlots(this);
LoadFixedGFX(this, 0x184);
}
}
void MinishSizedEntrance_Action1(Entity* this) {
static const u16 gUnk_0812225C[] = {
0x400,
0x100,
0x800,
0x200,
};
if (this->type == 1) {
Entity* parent = this->parent;
u32 mask = 1 << this->subtimer;
if (!(parent->zVelocity & mask)) {
DeleteThisEntity();
}
}
if ((gPlayerState.flags & PL_MINISH) && EntityInRectRadius(this, &gPlayerEntity.base, 4, 4) &&
(gPlayerEntity.base.z.HALF.HI == 0) &&
(((u16)gPlayerState.playerInput.heldInput) & gUnk_0812225C[this->type2])) {
DoExitTransition(GetCurrentRoomProperty(this->timer));
}
}
|