Skip to content

Commit

Permalink
Update to begin work on Dm_Hina overrides.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhlexPlexico committed Jun 22, 2024
1 parent 27d5e24 commit e5f3413
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
5 changes: 4 additions & 1 deletion code/include/game/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ namespace game {
float field_2A4;
u8 gap_2A8[228];
u8 field_38C;
u8 gap_38D[123];
u8 gap_38D[71];
z3d_nn_math_MTX34 some_global_mtx;
u8 gap_404[4];
Camera main_camera;
Camera other_cameras[3];
Camera* cameras[4];
Expand Down Expand Up @@ -467,6 +469,7 @@ namespace game {
static_assert(offsetof(GlobalContext, gap_AC6C) == 0xAC6C);
static_assert(offsetof(GlobalContext, field_83CE) == 0x83CE);
static_assert(offsetof(GlobalContext, gap_8384) == 0x8384);
static_assert(offsetof(GlobalContext, gap_404) == 0x0404);
static_assert(offsetof(GlobalContext, object_context) == 0x9438);
static_assert(sizeof(GlobalContext) == 0x11030);

Expand Down
14 changes: 5 additions & 9 deletions code/source/rnd/actors/dm_hina.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@

namespace rnd {
void Dm_Hina_Init(game::act::Actor* actor, game::GlobalContext* gctx) {
#if defined ENABLE_DEBUG || defined DEBUG_PRINT
rnd::util::Print("%s: %#04x\n", __func__, actor->params);
#endif
util::GetPointer<void(game::act::Actor*, game::GlobalContext*)>(0x34F7A4)(actor, gctx);
// TODO - Use scene or params to determined base item ID.
// Model_SpawnByActor(actor, rnd::GetContext().gctx, 0x55);
Model_SpawnByActor(actor, rnd::GetContext().gctx, 0x55);
}

void Dm_Hina_Draw(game::act::Actor* actor, game::GlobalContext* gctx) {
// if (!Model_DrawByActor(actor)) {
// util::GetPointer<void(game::act::Actor*, game::GlobalContext*)>(0x3C7BA8)(actor, gctx);
// }
util::GetPointer<void(game::act::Actor*, game::GlobalContext*)>(0x3C7BA8)(actor, gctx);
if (!Model_DrawByActor(actor)) {
util::GetPointer<void(game::act::Actor*, game::GlobalContext*)>(0x3C7BA8)(actor, gctx);
}
}

void Dm_Hina_Destroy(game::act::Actor* self, game::GlobalContext* gctx) {
// Model_DestroyByActor(self);
Model_DestroyByActor(self);
util::GetPointer<void(game::act::Actor*)>(0x34F864)(self);
}

Expand Down
8 changes: 4 additions & 4 deletions code/source/rnd/item_override.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ namespace rnd {
// Manual overide example code
rItemOverrides[0].key.scene = 0x6F;
rItemOverrides[0].key.type = ItemOverride_Type::OVR_COLLECTABLE;
rItemOverrides[0].value.getItemId = 0x26;
rItemOverrides[0].value.looksLikeItemId = 0x26;
rItemOverrides[0].value.getItemId = 0x56;
rItemOverrides[0].value.looksLikeItemId = 0x56;
rItemOverrides[1].key.scene = 0x6F;
rItemOverrides[1].key.type = ItemOverride_Type::OVR_COLLECTABLE;
rItemOverrides[1].value.getItemId = 0x7C;
rItemOverrides[1].value.looksLikeItemId = 0x7C;
rItemOverrides[1].value.getItemId = 0x54;
rItemOverrides[1].value.looksLikeItemId = 0x54;
rItemOverrides[2].key.scene = 0x12;
rItemOverrides[2].key.type = ItemOverride_Type::OVR_COLLECTABLE;
rItemOverrides[2].value.getItemId = 0x37;
Expand Down
7 changes: 1 addition & 6 deletions code/source/rnd/models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ namespace rnd {
if (objectBankIdx < 0) {
storedObjId = model->itemRow->objectId;
objectBankIdx = ExtendedObject_Spawn(&globalCtx->object_context, model->itemRow->objectId);
} else {
storedObjId = -1;
}
model->objectBankIdx = objectBankIdx;
}
Expand All @@ -78,10 +76,8 @@ namespace rnd {
SkeletonAnimationModel_CopyMtx(&tmpMtx, &model->actor->mtx);
// Base case - if we're a free-standing heart piece then set scale and use built-in scaling call.
if (model->baseItemId == 0x00 && model->itemRow->objectId == 0x01) {
if (model->itemRow->objectModelIdx == 0x05) {
if (model->itemRow->objectModelIdx == 0x05)
model->scale = 0.010f;
}

else
model->scale = 0.015f;
Model_SetScale(model->actor, model->scale);
Expand Down Expand Up @@ -253,7 +249,6 @@ namespace rnd {

s32 Model_DrawByActor(game::act::Actor* actor) {
s32 actorDrawn = 0;

for (s32 i = 0; i < LOADEDMODELS_MAX; ++i) {
if (ModelContext[i].actor == actor) {
actorDrawn = 1;
Expand Down
2 changes: 0 additions & 2 deletions code/source/rnd/objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ namespace rnd {
}

extern "C" game::ActorResource::ActorResource* ExtendedObject_GetStatus() {
if (storedObjId <= -1)
return NULL;
s32 i;
for (i = 0; i < rExtendedObjectCtx.num; ++i) {
s32 id = rExtendedObjectCtx.status[i].object_id;
Expand Down

0 comments on commit e5f3413

Please sign in to comment.