From aef4ef49d3bca9b729c9228012419533adefef4c Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 6 Nov 2020 12:36:14 -0500 Subject: add GShierMemObject.h, and implement constructors for GSanimationObject and GSblendObject --- include/GShierMemObject.h | 32 ++++++++++++++++++++++++++++++++ include/code_801DD5C8.h | 7 ++++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 include/GShierMemObject.h (limited to 'include') diff --git a/include/GShierMemObject.h b/include/GShierMemObject.h new file mode 100644 index 0000000..60af7b7 --- /dev/null +++ b/include/GShierMemObject.h @@ -0,0 +1,32 @@ +#ifndef POKEREVO_GSHIERMEMOBJECT_H +#define POKEREVO_GSHIERMEMOBJECT_H + +#include "code_801DAAE0.h" + +// TODO: determine file that defines this +extern MEMHeapHandle lbl_8063E8F8; + +// Note: This is the root base class for various classes such as GScamera, +// GSlight, GSmodel, etc. These classes are all new/deleted using an alternative set of +// routines than the global new and delete, which we infer is defined inline here. + +// TODO: abstract class? + +class GShierMemObject +{ +public: + void* operator new(size_t sz) + { + if (func_801DAB28()) + return func_801DAC94(lbl_8063E8F8, sz); + else + return NULL; + } + + void operator delete(void* ptr) + { + func_801DAD48(lbl_8063E8F8, ptr); + } +}; + +#endif //POKEREVO_GSHIERMEMOBJECT_H diff --git a/include/code_801DD5C8.h b/include/code_801DD5C8.h index 2b0dc47..1b528ae 100644 --- a/include/code_801DD5C8.h +++ b/include/code_801DD5C8.h @@ -5,6 +5,8 @@ extern "C" { #endif +#include "GShierMemObject.h" + // TODO: identify data structures // size == 0x10 @@ -25,13 +27,16 @@ struct gUnkClass8 gUnkClass8* next; }; -struct gUnkClass7 +struct gUnkClass7 : public GShierMemObject { gUnkClass8* unk0; // linked list head u16 unk4; u16 unk6; float unk8; float unkC; + + gUnkClass7() : unk0(NULL), unk4(0), unk6(0xC), unk8(1.0f), unkC(0.0f) { } + }; void func_801DD5C8(gUnkClass7* p1, float p2); -- cgit v1.2.3