Files
st/include/Actor/ActorRef.hpp
T
Alessevan dfc8f2748c Match ActorItemDrop (#82)
* feat: begin decompilation

* feat: improve

* feat: update symbols

* feat: huge improvements on decompiling

* feat: rename files and add function to give item

* feat: improvements

* feat: decompiling stuff

* feat: remove deprecated comment

* feat: other improvements

* feat: use float values for mUnk_50 and mUnk_52

* ActorDroppedItem OK

* fix build issues

* fix regressions

* DroppedItem -> ItemDrop and name actor ids

---------

Co-authored-by: Yanis002 <35189056+Yanis002@users.noreply.github.com>
2026-06-17 20:08:35 +02:00

83 lines
1.4 KiB
C++

#pragma once
#include "types.h"
// mapping:
// 0011 1111 1111 1111 = index
// 1100 0000 0000 0000 = type
//
// 0000 1111 1111 1111 = id
// 1111 0000 0000 0000 = unk
#define REF_TYPE_INDEX(type, index) (((type) << 14) | (index))
enum ActorRefType_ {
ActorRefType_0,
ActorRefType_1,
ActorRefType_2,
};
enum ActorRefId_ {
ActorRefId_0,
ActorRefId_1,
ActorRefId_2,
ActorRefId_4,
ActorRefId_5,
ActorRefId_6,
ActorRefId_7,
//! TODO: more ids?
};
struct ActorRef {
union {
struct {
/* 00 */ u16 index : 14;
/* 00 */ u16 type : 2;
/* 02 */ u16 id : 12;
/* 02 */ u16 unk : 4;
/* 04 */
};
struct {
/* 00 */ u16 type_index;
/* 02 */ u16 unk_id;
/* 04 */
};
u32 data;
};
ActorRef() {}
ActorRef(u32 value) {
this->data = value;
}
void Reset() {
this->data = 0;
}
const bool operator==(const ActorRef &other) const {
return other.data == this->data;
}
const bool operator!=(const ActorRef &other) const {
return !(*this == other);
}
void operator=(const ActorRef &other) {
this->data = other.data;
}
const u32 Get32() const {
return this->data;
}
};
// for arrays
struct ActorRefElem {
ActorRef ref;
ActorRefElem() {
this->ref.Reset();
}
};