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
|
#include "ActorBehavior.h"
#include <libultraship/bridge/consolevariablebridge.h>
extern "C" {
#include "functions.h"
#include "variables.h"
#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h"
void ItemBHeart_UpdateModel(ItemBHeart* itemBHeart, PlayState* play);
}
void ItemBHeart_DrawCustom(Actor* thisx, PlayState* play) {
auto randoStaticCheck = Rando::StaticData::GetCheckFromFlag(FLAG_CYCL_SCENE_COLLECTIBLE, 0x1F, gPlayState->sceneId);
if (randoStaticCheck.randoCheckId == RC_UNKNOWN) {
return;
}
auto randoSaveCheck = RANDO_SAVE_CHECKS[randoStaticCheck.randoCheckId];
Rando::DrawItem(Rando::ConvertItem(randoSaveCheck.randoItemId, randoStaticCheck.randoCheckId),
randoStaticCheck.randoCheckId, thisx);
}
void ItemBHeart_UpdateCustom(Actor* thisx, PlayState* play) {
ItemBHeart* itemBHeart = (ItemBHeart*)thisx;
ItemBHeart_UpdateModel(itemBHeart, play);
if (!(itemBHeart->baseScale < BHEART_SCALE_MIN_COLLECTIBLE)) {
if ((thisx->xzDistToPlayer <= 30.0f) && (fabsf(thisx->playerHeightRel) <= fabsf(80.0f))) {
Flags_SetCollectible(play, 0x1F);
Actor_Kill(&itemBHeart->actor);
return;
}
}
}
void Rando::ActorBehavior::InitItemBHeartBehavior() {
COND_ID_HOOK(OnActorInit, ACTOR_ITEM_B_HEART, IS_RANDO, [](Actor* actor) {
ItemBHeart* itemBHeart = (ItemBHeart*)actor;
auto randoStaticCheck =
Rando::StaticData::GetCheckFromFlag(FLAG_CYCL_SCENE_COLLECTIBLE, 0x1F, gPlayState->sceneId);
if (randoStaticCheck.randoCheckId == RC_UNKNOWN) {
return;
}
auto randoSaveCheck = RANDO_SAVE_CHECKS[randoStaticCheck.randoCheckId];
actor->draw = ItemBHeart_DrawCustom;
actor->update = ItemBHeart_UpdateCustom;
});
}
|