blob: 260c03488a7de0ebf820df00cdea5da1af09ed58 (
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/**
* @file pushableFurnitureManager.c
* @ingroup Managers
*
* @brief Creates pushable furniture based on a room property list.
*/
#include "manager/pushableFurnitureManager.h"
#include "flags.h"
#include "object.h"
#include "player.h"
#include "object/pushableFurniture.h"
#include "room.h"
void PushableFurnitureManager_Init(PushableFurnitureManager*);
void PushableFurnitureManager_Action1(PushableFurnitureManager*);
void PushableFurnitureManager_Action2(PushableFurnitureManager*);
void sub_0805C7CC(PushableFurnitureManager*);
void PushableFurnitureManager_Main(PushableFurnitureManager* this) {
static void (*const PushableFurnitureManager_Actions[])(PushableFurnitureManager*) = {
PushableFurnitureManager_Init,
PushableFurnitureManager_Action1,
PushableFurnitureManager_Action2,
};
PushableFurnitureManager_Actions[super->action](this);
}
void PushableFurnitureManager_Init(PushableFurnitureManager* this) {
UnkPushableFurnitureManagerHelperStruct* tmp = GetCurrentRoomProperty(super->type);
if (!tmp) {
DeleteManager(super);
return;
}
this->unk_2a = gRoomControls.origin_y + super->timer;
super->timer = 0;
this->unk_28 = 0;
this->unk_29 = 0;
while (tmp->unk_00 != 0xFF && super->timer < 0x20) {
PushableFurnitureEntity* furniture =
(PushableFurnitureEntity*)CreateObject(PUSHABLE_FURNITURE, tmp->unk_01, tmp->unk_02);
if (furniture) {
furniture->base.timer = tmp->unk_03;
furniture->base.x.HALF.HI = gRoomControls.origin_x + tmp->unk_04;
furniture->base.y.HALF.HI = gRoomControls.origin_y + tmp->unk_06;
furniture->base.parent = (Entity*)this;
furniture->base.collisionLayer = 1;
furniture->unk_83 = super->timer;
furniture->unk_82 = tmp->unk_00;
this->unk_29 |= 1 << super->timer;
}
tmp++;
super->timer++;
}
if (super->type2 == 0xFF) {
super->action = 2;
} else {
if (CheckLocalFlag(super->type2)) {
super->action = 2;
} else {
super->action = 1;
}
}
}
void PushableFurnitureManager_Action1(PushableFurnitureManager* this) {
if (this->unk_28 == this->unk_29) {
super->action = 2;
SetLocalFlag(super->type2);
}
sub_0805C7CC(this);
}
void PushableFurnitureManager_Action2(PushableFurnitureManager* this) {
sub_0805C7CC(this);
}
void sub_0805C7CC(PushableFurnitureManager* this) {
if (gPlayerState.flags & PL_MINISH) {
if (gPlayerEntity.base.y.HALF.HI < this->unk_2a + 0x10) {
super->subAction = 1;
} else {
super->subAction = 0;
}
} else {
if (gPlayerEntity.base.y.HALF.HI < this->unk_2a + 0x28) {
super->subAction = 3;
} else {
super->subAction = 2;
}
}
}
|