Skip to content

Commit

Permalink
Anchor + Player Models 3 (alpha 2)
Browse files Browse the repository at this point in the history
Co-authored-by: PurpleHato <[email protected]>
Co-authored-by: MelonSpeedruns <[email protected]>
Co-authored-by: Sirius902 <[email protected]>
  • Loading branch information
4 people committed Oct 7, 2023
1 parent 6665319 commit aa59079
Show file tree
Hide file tree
Showing 15 changed files with 948 additions and 24 deletions.
5 changes: 5 additions & 0 deletions soh/include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ s32 func_8008EF44(PlayState* play, s32 ammo);
s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 radius, f32 arg3);
s32 Player_GetStrength(void);
u8 Player_GetMask(PlayState* play);
s32 Player_InflictDamage(PlayState* play, s32 damage);
Player* Player_UnsetMask(PlayState* play);
s32 Player_HasMirrorShieldEquipped(PlayState* play);
s32 Player_HasMirrorShieldSetToDraw(PlayState* play);
Expand All @@ -1148,6 +1149,10 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data);
s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data);
s32 Player_OverrideLimbDrawGameplayCrawling(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data);
void DrawAnchorPuppet(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
void* this, PlayerData playerData, s32 anchorActorIndex);
s32 PuppetOverrideDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data);
u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponDim, Vec3f* newTip,
Vec3f* newBase);
void Player_DrawGetItem(PlayState* play, Player* player);
Expand Down
43 changes: 43 additions & 0 deletions soh/include/z64save.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,45 @@ typedef struct {
u8 value;
} RandoSetting;

typedef struct {
s32 playerAge;
u16 playerSound;
u8 sheathType;
u8 leftHandType;
u8 biggoron_broken;
u8 rightHandType;
u8 tunicType;
u8 bootsType;
s16 faceType;
u8 shieldType;
u8 damageEffect;
u8 damageValue;
s16 playerHealth;
s16 playerHealthCapacity;
s16 playerMagic;
s16 playerMagicCapacity;
s16 isPlayerMagicAcquired;
s16 isDoubleMagicAcquired;
s32 strengthValue;
f32 yOffset;
u8 currentMask;
u8 swordEquipped;
u32 playerStateFlags1;
u8 moveFlags;
f32 unk_6C4;
s16 unk_00;
s16 unk_02;
s16 unk_04;
s16 unk_06;
s16 unk_08;
f32 speedXZ;
s8 itemAction;
f32 unk_85C;
Vec3f stickWeaponTip;
s16 unk_860;
s8 unk_862;
} PlayerData;

typedef struct {
/* 0x0000 */ s32 entranceIndex; // start of `save` substruct, originally called "memory"
/* 0x0004 */ s32 linkAge; // 0: Adult; 1: Child (see enum `LinkAge`)
Expand Down Expand Up @@ -325,6 +364,10 @@ typedef struct {
/* */ u16 adultTradeItems;
/* */ u8 triforcePiecesCollected;
// #endregion
// #region SOH [Network]
// Upstream TODO: Move these to their own struct or name to more obviously specific to Network
/* */ PlayerData playerData;
// #endregion
} SaveContext; // size = 0x1428

typedef enum {
Expand Down
21 changes: 21 additions & 0 deletions soh/soh/ActorDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,29 @@ static ActorDBInit EnPartnerInit = {
};
extern "C" s16 gEnPartnerId;

#ifdef ENABLE_REMOTE_CONTROL
#include "src/overlays/actors/ovl_Link_Puppet/z_link_puppet.h"
static ActorDBInit EnLinkPuppetInit = {
"En_Link_Puppet",
"Puppet",
ACTORCAT_ITEMACTION,
(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED),
OBJECT_LINK_BOY,
sizeof(LinkPuppet),
(ActorFunc)LinkPuppet_Init,
(ActorFunc)LinkPuppet_Destroy,
(ActorFunc)LinkPuppet_Update,
(ActorFunc)LinkPuppet_Draw,
nullptr,
};
#endif
extern "C" s16 gEnLinkPuppetId;

void ActorDB::AddBuiltInCustomActors() {
gEnPartnerId = ActorDB::Instance->AddEntry(EnPartnerInit).entry.id;
#ifdef ENABLE_REMOTE_CONTROL
gEnLinkPuppetId = ActorDB::Instance->AddEntry(EnLinkPuppetInit).entry.id;
#endif
}

extern "C" ActorDBEntry* ActorDB_Retrieve(const int id) {
Expand Down
Loading

0 comments on commit aa59079

Please sign in to comment.