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
|
/*
* File: z_obj_dowsing.c
* Overlay: ovl_Obj_Dowsing
* Description: Rumbles controller if switch or collectible/chest flag is unset
*/
#include "z_obj_dowsing.h"
#define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED)
void ObjDowsing_Init(Actor* thisx, PlayState* play);
void ObjDowsing_Destroy(Actor* thisx, PlayState* play);
void ObjDowsing_Update(Actor* thisx, PlayState* play);
s32 ObjDowsing_GetFlag(ObjDowsing* this, PlayState* play);
s32 ObjDowsing_CheckValidSpawn(ObjDowsing* this, PlayState* play);
ActorProfile Obj_Dowsing_Profile = {
/**/ ACTOR_OBJ_DOWSING,
/**/ ACTORCAT_ITEMACTION,
/**/ FLAGS,
/**/ GAMEPLAY_KEEP,
/**/ sizeof(ObjDowsing),
/**/ ObjDowsing_Init,
/**/ ObjDowsing_Destroy,
/**/ ObjDowsing_Update,
/**/ NULL,
};
s32 ObjDowsing_GetFlag(ObjDowsing* this, PlayState* play) {
s32 type = DOWSING_GET_TYPE(&this->actor);
s32 flag = DOWSING_GET_FLAG(&this->actor);
if (type == DOWSING_COLLECTIBLE) {
return Flags_GetCollectible(play, flag);
} else if (type == DOWSING_CHEST) {
return Flags_GetTreasure(play, flag);
} else if (type == DOWSING_SWITCH) {
return Flags_GetSwitch(play, flag);
} else {
return 0;
}
}
s32 ObjDowsing_CheckValidSpawn(ObjDowsing* this, PlayState* play) {
if (ObjDowsing_GetFlag(this, play)) {
Actor_Kill(&this->actor);
return true;
}
return false;
}
void ObjDowsing_Init(Actor* thisx, PlayState* play) {
ObjDowsing* this = (ObjDowsing*)thisx;
ObjDowsing_CheckValidSpawn(this, play);
}
void ObjDowsing_Destroy(Actor* thisx, PlayState* play) {
}
void ObjDowsing_Update(Actor* thisx, PlayState* play) {
ObjDowsing* this = (ObjDowsing*)thisx;
if (!ObjDowsing_CheckValidSpawn(this, play)) {
Actor_SetClosestSecretDistance(thisx, play);
}
}
|