summaryrefslogtreecommitdiff
path: root/src/d/d_base.cpp
diff options
context:
space:
mode:
authorelijah-thomas774 <elijahthomas774@gmail.com>2023-08-09 12:00:45 -0400
committerelijah-thomas774 <elijahthomas774@gmail.com>2023-08-09 12:00:45 -0400
commit5e2c18896d5afcf2c5b9ca3c3235266374546fce (patch)
treeada37ae00d18be1b6464a531d65ad8d33ef60e20 /src/d/d_base.cpp
parent42880ec9aed16f89c4685cc09369d583b4c1300e (diff)
initial test with porting d_base
Diffstat (limited to 'src/d/d_base.cpp')
-rw-r--r--src/d/d_base.cpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/d/d_base.cpp b/src/d/d_base.cpp
new file mode 100644
index 00000000..5a7abc2b
--- /dev/null
+++ b/src/d/d_base.cpp
@@ -0,0 +1,81 @@
+#include <d/d_base.h>
+
+extern "C" fProfile::fBaseProfile_c** DAT_ACTOR_ALLOCATION_FUNCTIONS;
+extern "C" /* 805750c0 */ u32 ACTOR_SHOULD_UPDATE_FLAGS;
+extern "C" /* 805750c4 */ u32 ACTOR_SHOULD_DRAW_FLAGS;
+extern "C" /* 805750c0 */ u32 ACTOR_SHOULD_UNK_FLAGS;
+
+dBase_c::dBase_c() : fBase_c() {
+ baseProperties = DAT_ACTOR_ALLOCATION_FUNCTIONS[mProfName]->mBaseProperties;
+}
+
+void dBase_c::postDraw(fBase_c::MAIN_STATE_e status) {
+ if (status != CANCELED) {
+ baseProperties |= 0x100;
+ } else {
+ baseProperties &= ~0x100;
+ }
+ fBase_c::postDraw(status);
+}
+
+int dBase_c::preExecute() {
+ if (fBase_c::preExecute() == 0) {
+ return NOT_READY;
+ }
+ if (ACTOR_SHOULD_UPDATE_FLAGS && !isProcControlFlag(ACTOR_SHOULD_UPDATE_FLAGS)) {
+ return NOT_READY;
+ }
+ return SUCCEEDED;
+}
+
+void dBase_c::postExecute(fBase_c::MAIN_STATE_e status) {
+ if (status != CANCELED) {
+ baseProperties |= 0x4;
+ } else {
+ baseProperties &= ~0x4;
+ }
+ fBase_c::postExecute(status);
+}
+
+int dBase_c::preDraw() {
+ if (fBase_c::preDraw() == NOT_READY) {
+ return NOT_READY;
+ }
+ if (ACTOR_SHOULD_DRAW_FLAGS && !isProcControlFlag(ACTOR_SHOULD_DRAW_FLAGS)) {
+ return NOT_READY;
+ }
+ return SUCCEEDED;
+}
+
+void dBase_c::resetFlags() {
+ ACTOR_SHOULD_UPDATE_FLAGS = 0;
+ ACTOR_SHOULD_DRAW_FLAGS = 0;
+ ACTOR_SHOULD_UNK_FLAGS = 0;
+}
+
+bool dBase_c::isActorPlayer(dBase_c& base) {
+ return base.mProfName == fProfile::PLAYER;
+}
+
+int dBase_c::loadAsyncCallback() {
+ return 2;
+}
+
+void dBase_c::unloadCallback() {
+ return;
+}
+
+void dBase_c::initLoader() {
+ fBase_c::sLoadAsyncCallback = loadAsyncCallback;
+ fBase_c::sUnloadCallback = unloadCallback;
+}
+
+dBase_c* dBase_c::createBase(ProfileName profName, dBase_c* parent, unsigned long param, u8 grouptype) {
+ return static_cast<dBase_c*>(fBase_c::createChild(profName, parent, param, grouptype));
+}
+
+dBase_c* dBase_c::createRoot(ProfileName profName, unsigned long param, u8 groupType) {
+ return static_cast<dBase_c*>(fBase_c::createRoot(profName, param, groupType));
+}
+
+// dBase_c::~dBase_c() {}