actors: Add ObjStoneTowerBlock

This commit is contained in:
Léo Lam
2020-05-04 23:19:31 +02:00
parent 91149f5dfa
commit adeaf1e86f
3 changed files with 54 additions and 9 deletions

View File

@@ -19,6 +19,7 @@ add_executable(newcode
game/actors/boss_gyorg.h
game/actors/boss_twinmold.h
game/actors/obj_elegy_statue.h
game/actors/obj_stone_tower_block.h
game/as.cpp
game/as.h
game/camera.cpp

View File

@@ -69,7 +69,11 @@ enum class Type : u8 {
Chest = 11,
};
using MainFunction = void(*)(Actor* self, GlobalContext* gctx);
using MainFunc = void(Actor* self, GlobalContext* gctx);
// Typically used in derived actors to implement states ("modes") for actor state machines.
template <typename ActorType>
using ActionFunc = void(ActorType* self, GlobalContext* gctx);
struct ActorInfo {
Id id;
@@ -79,10 +83,10 @@ struct ActorInfo {
u16 object_id;
u8 anonymous_3[2];
size_t inst_size;
MainFunction init_fn;
MainFunction deinit_fn;
MainFunction calc_fn;
MainFunction draw_fn;
MainFunc* init_fn;
MainFunc* deinit_fn;
MainFunc* calc_fn;
MainFunc* draw_fn;
};
// Actor overlay info. Same structure as Majora's Mask, though most fields are now unused.
@@ -206,10 +210,10 @@ struct Actor {
Actor* prev;
/// Next actor of the same type in the linked list.
Actor* next;
MainFunction init_fn;
MainFunction deinit_fn;
MainFunction calc_fn;
MainFunction draw_fn;
MainFunc* init_fn;
MainFunc* deinit_fn;
MainFunc* calc_fn;
MainFunc* draw_fn;
ActorOverlayInfo* overlay_info;
float field_14C;
float field_150;
@@ -242,4 +246,15 @@ static_assert(rst::util::OffsetOf(&Actor::field_B4) == 0xB4);
static_assert(rst::util::OffsetOf(&Actor::field_F0) == 0xF0);
static_assert(rst::util::OffsetOf(&Actor::field_11C) == 0x11C);
// Name courtesy of the OoT decomp project.
struct DynaPolyActor : Actor {
u32 dyna_poly_id;
float field_1FC;
float field_200;
u16 field_204;
u8 field_206;
u32 dyna_poly_flags;
};
static_assert(sizeof(DynaPolyActor) == 0x20C);
} // namespace game::act

View File

@@ -0,0 +1,29 @@
#pragma once
#include "game/actor.h"
namespace game::act {
struct ObjStoneTowerBlock : DynaPolyActor {
enum class MoveDirection : int {
X = 0,
Y = 1,
Z = 2,
NegX = 3,
NegY = 4,
NegZ = 5,
None = 6,
};
void* field_20C;
int field_210;
int field_214;
MoveDirection move_direction;
void* object_handle;
ActionFunc<ObjStoneTowerBlock>* action_fn;
u16 field_224;
u16 timer;
};
static_assert(sizeof(ObjStoneTowerBlock) == 0x228);
} // namespace game::act