summaryrefslogtreecommitdiff
path: root/src/00_Core/Actor/Dungeon/ActorActionObject.cpp
blob: dbd66a76a89c5fb9b2bf1a2bf9626ddfea4961de (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
#include "Actor/Dungeon/ActorActionObject.hpp"
#include "Map/MapManager.hpp"
#include "Player/LinkStateBase.hpp"
#include "Player/PlayerLinkBase.hpp"
#include "Save/AdventureFlags.hpp"

#pragma section sbss begin
ActorType ActorActionObject::gType = ActorType(ActorTypeId_ActionObject, (ActorCreateFunc) ActorActionObject::Create, NULL);
#pragma section sbss end

extern u32 **data_027e0fe0[];
ARM ActorActionObject *ActorActionObject::Create() {
    return new(*data_027e0fe0[0], 4) ActorActionObject();
}

ARM ActorActionObject::ActorActionObject() {}

ARM ActorActionObject::~ActorActionObject() {}

// non-matching
ARM bool ActorActionObject::Init() {
    mGravity      = 0;
    mHitbox.pos   = gVec3p_ZERO;
    mHitbox.size  = -1;
    mUnk_08c.pos  = mHitbox.pos;
    mUnk_08c.size = mHitbox.size;
    mUnk_0a4.mUnk_04.MakeEmpty();
    mVisible = false;
    mUnk_130 = 0;
    return true;
}

ARM void ActorActionObject::vfunc_14(u32 param1) {
    if (!this->func_ov00_020c313c(param1)) {
        return;
    }

    u32 flag = mUnk_020.mUnk_00[2];
    bool bVar3;
    switch (mUnk_020.mUnk_00[0]) {
        case 0:
            bVar3 = true;
            break;
        case 1:
            if (gPlayerLink->mGrabActor.id != -1 && gPlayerLink->GetStateId() == LinkStateId_Move) {
                bVar3 = true;
            } else {
                bVar3 = false;
            }
            break;
        case 2:
            if (gPlayerLink->mGrabActor.id == -1 && gPlayerLink->GetStateId() == LinkStateId_Move) {
                bVar3 = true;
            } else {
                bVar3 = false;
            }
            break;
        default:
            bVar3 = false;
            break;
    }

    if (!bVar3) {
        return;
    }
    if (!gMapManager->func_ov00_020836dc((u32) mUnk_020.mUnk_00[1], 0)) {
        return;
    }
    if (mUnk_020.mUnk_0a[0] != 0 && !this->func_ov00_020c1bfc(0)) {
        return;
    }
    if (flag != 0 && !gAdventureFlags->Get(flag)) {
        return;
    }

    PlayerLinkBase *link = gPlayerLink;
    if (link != NULL && link->vfunc_18(7)) {
        if (mUnk_020.mUnk_00[3] == 1) {
            link->func_ov000_020bcf50(&mPos, 0x800);
        }
        this->func_ov00_020c1c20(1, 1);
        this->Kill();
    }
}

ARM void ActorActionObject::vfunc_18(u32 param1) {
    this->func_ov00_020c313c(param1);
}