summaryrefslogtreecommitdiff
path: root/mm/2s2h/ObjectExtension/ActorListIndex.cpp
blob: b3537507c2d6eddafee6d77efa696e001b0fbeda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "ActorListIndex.h"
#include "2s2h/ObjectExtension/ObjectExtension.h"

struct ActorListIndex {
    s16 index = -1;
};
static ObjectExtension::Register<ActorListIndex> ActorListIndexRegister;
s16 currentActorListIndex = -1;

int16_t GetActorListIndex(const Actor* actor) {
    const ActorListIndex* index = ObjectExtension::GetInstance().Get<ActorListIndex>(actor);
    return index != nullptr ? index->index : -1;
}

void SetActorListIndex(const Actor* actor, int16_t index) {
    ObjectExtension::GetInstance().Set<ActorListIndex>(actor, ActorListIndex{ index });
}