Dekunut Salesman Docs (#1493)

* Dekunut Salesman Docs

* Update src/overlays/actors/ovl_En_Dns/z_en_dns.c

Remove extra param from debug logging

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>

* * Full Deku/Potion name usage
* Dialog -> CanBuy
* Revert debug logging symbols
* Proper declaration spacing
* Fix en_shopnuts header doc
* Biz -> Business

* Fix missed deku prefix's

* Synchronize CanBuy sticks and nuts

* Fix enum naming

* Clarified CanBuy success values

* anon review

* fig review

* macro changes

* fix macro usage

---------

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
Billy
2023-09-20 01:41:42 +00:00
committed by GitHub
parent da3f4718f0
commit 107c0288cc
8 changed files with 363 additions and 263 deletions

View File

@@ -1,26 +1,26 @@
<Root>
<File Name="object_shopnuts" Segment="6">
<!-- Business Scrub Skeleton -->
<Skeleton Name="gBusinessScrubSkel" Type="Flex" LimbType="Standard" Offset="0x41A8"/>
<Skeleton Name="gBusinessScrubSkel" Type="Flex" LimbType="Standard" LimbNone="BUSINESS_SCRUB_LIMB_NONE" LimbMax="BUSINESS_SCRUB_LIMB_MAX" EnumName="BusinessScrubLimb" Offset="0x41A8"/>
<!-- Business Scrub Limbs -->
<Limb Name="gBusinessScrubRootLimb" LimbType="Standard" Offset="0x4098"/>
<Limb Name="gBusinessScrubLeftThighLimb" LimbType="Standard" Offset="0x40A4"/>
<Limb Name="gBusinessScrubLeftShinLimb" LimbType="Standard" Offset="0x40B0"/>
<Limb Name="gBusinessScrubLeftFootLimb" LimbType="Standard" Offset="0x40BC"/>
<Limb Name="gBusinessScrubRightThighLimb" LimbType="Standard" Offset="0x40C8"/>
<Limb Name="gBusinessScrubRightShinLimb" LimbType="Standard" Offset="0x40D4"/>
<Limb Name="gBusinessScrubRightFootLimb" LimbType="Standard" Offset="0x40E0"/>
<Limb Name="gBusinessScrubTopLeafLimb" LimbType="Standard" Offset="0x40EC"/>
<Limb Name="gBusinessScrubNoseLimb" LimbType="Standard" Offset="0x40F8"/>
<Limb Name="gBusinessScrubLeftUpperArmLimb" LimbType="Standard" Offset="0x4104"/>
<Limb Name="gBusinessScrubLeftForearmLimb" LimbType="Standard" Offset="0x4110"/>
<Limb Name="gBusinessScrubLeftHandLimb" LimbType="Standard" Offset="0x411C"/>
<Limb Name="gBusinessScrubRightUpperArmLimb" LimbType="Standard" Offset="0x4128"/>
<Limb Name="gBusinessScrubRightForearmLimb" LimbType="Standard" Offset="0x4134"/>
<Limb Name="gBusinessScrubRightHandLimb" LimbType="Standard" Offset="0x4140"/>
<Limb Name="gBusinessScrubEyesLimb" LimbType="Standard" Offset="0x414C"/>
<Limb Name="gBusinessScrubBodyLimb" LimbType="Standard" Offset="0x4158"/>
<Limb Name="gBusinessScrubRootLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_ROOT" Offset="0x4098"/>
<Limb Name="gBusinessScrubLeftThighLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_LEFT_THIGH" Offset="0x40A4"/>
<Limb Name="gBusinessScrubLeftShinLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_LEFT_SHIN" Offset="0x40B0"/>
<Limb Name="gBusinessScrubLeftFootLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_LEFT_FOOT" Offset="0x40BC"/>
<Limb Name="gBusinessScrubRightThighLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_RIGHT_THIGH" Offset="0x40C8"/>
<Limb Name="gBusinessScrubRightShinLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_RIGHT_SHIN" Offset="0x40D4"/>
<Limb Name="gBusinessScrubRightFootLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_RIGHT_FOOT" Offset="0x40E0"/>
<Limb Name="gBusinessScrubTopLeafLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_TOP_LEAF" Offset="0x40EC"/>
<Limb Name="gBusinessScrubNoseLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_NOSE" Offset="0x40F8"/>
<Limb Name="gBusinessScrubLeftUpperArmLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_LEFT_UPPER_ARM" Offset="0x4104"/>
<Limb Name="gBusinessScrubLeftForearmLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_LEFT_FOREARM" Offset="0x4110"/>
<Limb Name="gBusinessScrubLeftHandLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_LEFT_HAND" Offset="0x411C"/>
<Limb Name="gBusinessScrubRightUpperArmLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_RIGHT_UPPER_ARM" Offset="0x4128"/>
<Limb Name="gBusinessScrubRightForearmLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_RIGHT_FOREARM" Offset="0x4134"/>
<Limb Name="gBusinessScrubRightHandLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_RIGHT_HAND" Offset="0x4140"/>
<Limb Name="gBusinessScrubEyesLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_EYES" Offset="0x414C"/>
<Limb Name="gBusinessScrubBodyLimb" LimbType="Standard" EnumName="BUSINESS_SCRUB_LIMB_BODY" Offset="0x4158"/>
<!-- Business Scrub Limb DisplayLists -->
<DList Name="gBusinessScrubRootLeafDL" Offset="0x3C80"/>
@@ -54,14 +54,14 @@
<DList Name="gBusinessScrubDekuNutDL" Offset="0x4008"/>
<!-- Business Scrub Animations -->
<Animation Name="gBusinessScrubAnim_1EC" Offset="0x1EC"/>
<Animation Name="gBusinessScrubAnim_39C" Offset="0x39C"/>
<Animation Name="gBusinessScrubThrowNutAnim" Offset="0x1EC"/>
<Animation Name="gBusinessScrubPeekBurrowAnim" Offset="0x39C"/>
<Animation Name="gBusinessScrubRotateAnim" Offset="0x764"/>
<Animation Name="gBusinessScrubNervousTransitionAnim" Offset="0x9A0"/>
<Animation Name="gBusinessScrubLookAroundAnim" Offset="0xBA0"/>
<Animation Name="gBusinessScrubNervousIdleAnim" Offset="0x1108"/>
<Animation Name="gBusinessScrubAnim_139C" Offset="0x139C"/>
<Animation Name="gBusinessScrubAnim_4404" Offset="0x4404"/>
<Animation Name="gBusinessScrubAnim_4574" Offset="0x4574"/>
<Animation Name="gBusinessScrubInitialAnim" Offset="0x139C"/>
<Animation Name="gBusinessScrubLeaveBurrowAnim" Offset="0x4404"/>
<Animation Name="gBusinessScrubPeekAnim" Offset="0x4574"/>
</File>
</Root>

View File

@@ -580,7 +580,7 @@ typedef enum {
#define ITEMGETINF_08 0x08
#define ITEMGETINF_09 0x09
#define ITEMGETINF_0A 0x0A
#define ITEMGETINF_0B 0x0B
#define ITEMGETINF_DEKU_HEART_PIECE 0x0B
#define ITEMGETINF_0C 0x0C
#define ITEMGETINF_0D 0x0D
#define ITEMGETINF_0E 0x0E
@@ -750,8 +750,8 @@ typedef enum {
#define INFTABLE_17F 0x17F
#define INFTABLE_190 0x190
#define INFTABLE_191 0x191
#define INFTABLE_192 0x192
#define INFTABLE_193 0x193
#define INFTABLE_HAS_DEKU_STICK_UPGRADE 0x192
#define INFTABLE_HAS_DEKU_NUT_UPGRADE 0x193
#define INFTABLE_195 0x195
#define INFTABLE_196 0x196
#define INFTABLE_197 0x197

File diff suppressed because it is too large Load Diff

View File

@@ -3,31 +3,62 @@
#include "ultra64.h"
#include "global.h"
#include "assets/objects/object_shopnuts/object_shopnuts.h"
#define DNS_GET_TYPE(thisx) ((thisx)->params)
typedef enum {
/* 0 */ DNS_TYPE_DEKU_NUTS_5,
/* 1 */ DNS_TYPE_DEKU_STICKS_1,
/* 2 */ DNS_TYPE_HEART_PIECE,
/* 3 */ DNS_TYPE_DEKU_SEEDS_30,
/* 4 */ DNS_TYPE_DEKU_SHIELD,
/* 5 */ DNS_TYPE_BOMBS_5,
/* 6 */ DNS_TYPE_ARROWS_30,
/* 7 */ DNS_TYPE_RED_POTION,
/* 8 */ DNS_TYPE_GREEN_POTION,
/* 9 */ DNS_TYPE_DEKU_STICK_UPGRADE,
/* 10 */ DNS_TYPE_DEKU_NUT_UPGRADE
} EnDnsType;
typedef enum {
/* 0 */ DNS_CANBUY_RESULT_NEED_RUPEES,
/* 1 */ DNS_CANBUY_RESULT_CAPACITY_FULL,
/* 2 */ DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM,
/* 3 */ DNS_CANBUY_RESULT_CANT_GET_NOW,
/* 4 */ DNS_CANBUY_RESULT_SUCCESS
} EnDnsCanBuyResult;
typedef enum {
/* 0 */ DNS_ANIM_IDLE,
/* 1 */ DNS_ANIM_BURROW,
/* 2 */ DNS_ANIM_IDLE_TRANSITION
} EnDnsAnimation;
struct EnDns;
typedef void (*EnDnsActionFunc)(struct EnDns*, PlayState*);
typedef u32 (*EnDnsPurchaseableCheck)(struct EnDns*);
typedef void (*EnDnsSetRupeesAndFlags)(struct EnDns*);
typedef u32 (*EnDnsCanBuyFunc)(struct EnDns*);
typedef void (*EnDnsPaymentFunc)(struct EnDns*);
typedef struct {
/* 0x00 */ s16 itemPrice;
/* 0x02 */ u16 itemAmount;
/* 0x04 */ s32 getItemId;
/* 0x08 */ EnDnsPurchaseableCheck purchaseableCheck;
/* 0x0C */ EnDnsSetRupeesAndFlags setRupeesAndFlags;
/* 0x08 */ EnDnsCanBuyFunc canBuy;
/* 0x0C */ EnDnsPaymentFunc payment;
} DnsItemEntry; // size = 0x10
typedef struct EnDns {
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ Vec3s jointTable[18];
/* 0x01FC */ Vec3s morphTable[18];
/* 0x0190 */ Vec3s jointTable[BUSINESS_SCRUB_LIMB_MAX];
/* 0x01FC */ Vec3s morphTable[BUSINESS_SCRUB_LIMB_MAX];
/* 0x0268 */ EnDnsActionFunc actionFunc;
/* 0x026C */ ColliderCylinder collider;
/* 0x02B8 */ s16 dustTimer;
/* 0x02BA */ u8 unk_2BA;
/* 0x02BB */ u8 maintainCollider;
/* 0x02BA */ u8 animIndex; // set but not read
/* 0x02BB */ u8 bumpOn;
/* 0x02BC */ u8 standOnGround;
/* 0x02BD */ u8 dropCollectible;
/* 0x02C0 */ DnsItemEntry* dnsItemEntry;

View File

@@ -69,7 +69,7 @@ void EnNutsball_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawCircle, 13.0f);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[this->actor.params]);
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[NUTSBALL_GET_TYPE(&this->actor)]);
if (this->requiredObjectSlot < 0) {
Actor_Kill(&this->actor);
@@ -165,16 +165,16 @@ void EnNutsball_Update(Actor* thisx, PlayState* play) {
}
void EnNutsball_Draw(Actor* thisx, PlayState* play) {
s32 pad;
EnNutsball* this = (EnNutsball*)thisx;
OPEN_DISPS(play->state.gfxCtx, "../z_en_nutsball.c", 327);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZ(thisx->home.rot.z * 9.58738e-05f, MTXMODE_APPLY);
Matrix_RotateZ(this->actor.home.rot.z * 9.58738e-05f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_nutsball.c", 333),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDLists[thisx->params]);
gSPDisplayList(POLY_OPA_DISP++, sDLists[NUTSBALL_GET_TYPE(&this->actor)]);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_nutsball.c", 337);
}

View File

@@ -4,6 +4,16 @@
#include "ultra64.h"
#include "global.h"
#define NUTSBALL_GET_TYPE(thisx) ((thisx)->params)
typedef enum {
/* 0 */ EN_NUTSBALL_TYPE_DEKUNUTS,
/* 1 */ EN_NUTSBALL_TYPE_HINTNUTS,
/* 2 */ EN_NUTSBALL_TYPE_SHOPNUTS,
/* 3 */ EN_NUTSBALL_TYPE_DNS,
/* 4 */ EN_NUTSBALL_TYPE_DNK
} EnNutsballType;
struct EnNutsball;
typedef void (*EnNutsballActionFunc)(struct EnNutsball*, PlayState*);

View File

@@ -1,5 +1,10 @@
/*
* File: z_en_shopnuts.c
* Overlay: En_Shopnuts
* Description: Deku Salesman - Attack Phase
*/
#include "z_en_shopnuts.h"
#include "assets/objects/object_shopnuts/object_shopnuts.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2)
@@ -8,10 +13,10 @@ void EnShopnuts_Destroy(Actor* thisx, PlayState* play);
void EnShopnuts_Update(Actor* thisx, PlayState* play);
void EnShopnuts_Draw(Actor* thisx, PlayState* play);
void EnShopnuts_SetupWait(EnShopnuts* this);
void EnShopnuts_Wait(EnShopnuts* this, PlayState* play);
void EnShopnuts_SetupIdle(EnShopnuts* this);
void EnShopnuts_Idle(EnShopnuts* this, PlayState* play);
void EnShopnuts_LookAround(EnShopnuts* this, PlayState* play);
void EnShopnuts_Stand(EnShopnuts* this, PlayState* play);
void EnShopnuts_Peek(EnShopnuts* this, PlayState* play);
void EnShopnuts_ThrowNut(EnShopnuts* this, PlayState* play);
void EnShopnuts_Burrow(EnShopnuts* this, PlayState* play);
void EnShopnuts_SpawnSalesman(EnShopnuts* this, PlayState* play);
@@ -48,7 +53,7 @@ static ColliderCylinderInit sCylinderInit = {
{ 20, 40, 0, { 0, 0, 0 } },
};
static CollisionCheckInfoInit sColChkInfoInit = { 1, 20, 40, 0xFE };
static CollisionCheckInfoInit sColChkInfoInit = { 1, 20, 40, MASS_HEAVY };
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BUSINESS_SCRUB, ICHAIN_CONTINUE),
@@ -61,19 +66,23 @@ void EnShopnuts_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubAnim_4574, this->jointTable,
this->morphTable, 18);
SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubPeekAnim, this->jointTable,
this->morphTable, BUSINESS_SCRUB_LIMB_MAX);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
Collider_UpdateCylinder(&this->actor, &this->collider);
if (((this->actor.params == 0x0002) && GET_ITEMGETINF(ITEMGETINF_0B)) ||
((this->actor.params == 0x0009) && GET_INFTABLE(INFTABLE_192)) ||
((this->actor.params == 0x000A) && GET_INFTABLE(INFTABLE_193))) {
if (((SHOPNUTS_GET_TYPE(&this->actor) == DNS_TYPE_HEART_PIECE) && GET_ITEMGETINF(ITEMGETINF_DEKU_HEART_PIECE)) ||
((SHOPNUTS_GET_TYPE(&this->actor) == DNS_TYPE_DEKU_STICK_UPGRADE) &&
GET_INFTABLE(INFTABLE_HAS_DEKU_STICK_UPGRADE)) ||
((SHOPNUTS_GET_TYPE(&this->actor) == DNS_TYPE_DEKU_NUT_UPGRADE) &&
GET_INFTABLE(INFTABLE_HAS_DEKU_NUT_UPGRADE))) {
Actor_Kill(&this->actor);
} else {
EnShopnuts_SetupWait(this);
EnShopnuts_SetupIdle(this);
}
}
@@ -83,12 +92,12 @@ void EnShopnuts_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
void EnShopnuts_SetupWait(EnShopnuts* this) {
Animation_PlayOnceSetSpeed(&this->skelAnime, &gBusinessScrubAnim_139C, 0.0f);
void EnShopnuts_SetupIdle(EnShopnuts* this) {
Animation_PlayOnceSetSpeed(&this->skelAnime, &gBusinessScrubInitialAnim, 0.0f);
this->animFlagAndTimer = Rand_S16Offset(100, 50);
this->collider.dim.height = 5;
this->collider.base.acFlags &= ~AC_ON;
this->actionFunc = EnShopnuts_Wait;
this->actionFunc = EnShopnuts_Idle;
}
void EnShopnuts_SetupLookAround(EnShopnuts* this) {
@@ -98,22 +107,24 @@ void EnShopnuts_SetupLookAround(EnShopnuts* this) {
}
void EnShopnuts_SetupThrowNut(EnShopnuts* this) {
Animation_PlayOnce(&this->skelAnime, &gBusinessScrubAnim_1EC);
Animation_PlayOnce(&this->skelAnime, &gBusinessScrubThrowNutAnim);
this->actionFunc = EnShopnuts_ThrowNut;
}
void EnShopnuts_SetupStand(EnShopnuts* this) {
Animation_MorphToLoop(&this->skelAnime, &gBusinessScrubAnim_4574, -3.0f);
void EnShopnuts_SetupPeek(EnShopnuts* this) {
Animation_MorphToLoop(&this->skelAnime, &gBusinessScrubPeekAnim, -3.0f);
if (this->actionFunc == EnShopnuts_ThrowNut) {
this->animFlagAndTimer = 2 | 0x1000; // sets timer and flag
} else {
this->animFlagAndTimer = 1;
}
this->actionFunc = EnShopnuts_Stand;
this->actionFunc = EnShopnuts_Peek;
}
void EnShopnuts_SetupBurrow(EnShopnuts* this) {
Animation_MorphToPlayOnce(&this->skelAnime, &gBusinessScrubAnim_39C, -5.0f);
Animation_MorphToPlayOnce(&this->skelAnime, &gBusinessScrubPeekBurrowAnim, -5.0f);
Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN);
this->actionFunc = EnShopnuts_Burrow;
}
@@ -125,15 +136,17 @@ void EnShopnuts_SetupSpawnSalesman(EnShopnuts* this) {
this->actionFunc = EnShopnuts_SpawnSalesman;
}
void EnShopnuts_Wait(EnShopnuts* this, PlayState* play) {
void EnShopnuts_Idle(EnShopnuts* this, PlayState* play) {
s32 hasSlowPlaybackSpeed = false;
if (this->skelAnime.playSpeed < 0.5f) {
hasSlowPlaybackSpeed = true;
}
if (hasSlowPlaybackSpeed && (this->animFlagAndTimer != 0)) {
this->animFlagAndTimer--;
}
if (Animation_OnFrame(&this->skelAnime, 9.0f)) {
this->collider.base.acFlags |= AC_ON;
} else if (Animation_OnFrame(&this->skelAnime, 8.0f)) {
@@ -149,7 +162,7 @@ void EnShopnuts_Wait(EnShopnuts* this, PlayState* play) {
} else if ((this->animFlagAndTimer == 0) && (this->actor.xzDistToPlayer > 320.0f)) {
EnShopnuts_SetupLookAround(this);
} else {
EnShopnuts_SetupStand(this);
EnShopnuts_SetupPeek(this);
}
}
if (hasSlowPlaybackSpeed &&
@@ -161,22 +174,27 @@ void EnShopnuts_Wait(EnShopnuts* this, PlayState* play) {
void EnShopnuts_LookAround(EnShopnuts* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) {
this->animFlagAndTimer--;
}
if ((this->actor.xzDistToPlayer < 120.0f) || (this->animFlagAndTimer == 0)) {
EnShopnuts_SetupBurrow(this);
}
}
void EnShopnuts_Stand(EnShopnuts* this, PlayState* play) {
void EnShopnuts_Peek(EnShopnuts* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->animFlagAndTimer != 0)) {
this->animFlagAndTimer--;
}
if (!(this->animFlagAndTimer & 0x1000)) {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38);
}
if ((this->actor.xzDistToPlayer < 120.0f) || (this->animFlagAndTimer == 0x1000)) {
EnShopnuts_SetupBurrow(this);
} else if (this->animFlagAndTimer == 0) {
@@ -188,16 +206,19 @@ void EnShopnuts_ThrowNut(EnShopnuts* this, PlayState* play) {
Vec3f spawnPos;
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38);
if (this->actor.xzDistToPlayer < 120.0f) {
EnShopnuts_SetupBurrow(this);
} else if (SkelAnime_Update(&this->skelAnime)) {
EnShopnuts_SetupStand(this);
EnShopnuts_SetupPeek(this);
} else if (Animation_OnFrame(&this->skelAnime, 6.0f)) {
spawnPos.x = this->actor.world.pos.x + (Math_SinS(this->actor.shape.rot.y) * 23.0f);
spawnPos.y = this->actor.world.pos.y + 12.0f;
spawnPos.z = this->actor.world.pos.z + (Math_CosS(this->actor.shape.rot.y) * 23.0f);
if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, spawnPos.x, spawnPos.y, spawnPos.z,
this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 2) != NULL) {
this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z,
EN_NUTSBALL_TYPE_SHOPNUTS) != NULL) {
Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_THROW);
}
}
@@ -205,10 +226,11 @@ void EnShopnuts_ThrowNut(EnShopnuts* this, PlayState* play) {
void EnShopnuts_Burrow(EnShopnuts* this, PlayState* play) {
if (SkelAnime_Update(&this->skelAnime)) {
EnShopnuts_SetupWait(this);
EnShopnuts_SetupIdle(this);
} else {
this->collider.dim.height = ((4.0f - CLAMP_MAX(this->skelAnime.curFrame, 4.0f)) * 10.0f) + 5.0f;
}
if (Animation_OnFrame(&this->skelAnime, 4.0f)) {
this->collider.base.acFlags &= ~AC_ON;
}
@@ -218,7 +240,7 @@ void EnShopnuts_SpawnSalesman(EnShopnuts* this, PlayState* play) {
if (SkelAnime_Update(&this->skelAnime)) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DNS, this->actor.world.pos.x, this->actor.world.pos.y,
this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z,
this->actor.params);
SHOPNUTS_GET_TYPE(&this->actor));
Actor_Kill(&this->actor);
} else {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38);
@@ -239,18 +261,23 @@ void EnShopnuts_Update(Actor* thisx, PlayState* play) {
EnShopnuts* this = (EnShopnuts*)thisx;
EnShopnuts_ColliderCheck(this, play);
this->actionFunc(this, play);
Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height,
UPDBGCHECKINFO_FLAG_2);
if (this->collider.base.acFlags & AC_ON) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
if (this->actionFunc == EnShopnuts_Wait) {
if (this->actionFunc == EnShopnuts_Idle) {
Actor_SetFocus(&this->actor, this->skelAnime.curFrame);
} else if (this->actionFunc == EnShopnuts_Burrow) {
Actor_SetFocus(&this->actor,
20.0f - ((this->skelAnime.curFrame * 20.0f) / Animation_GetLastFrame(&gBusinessScrubAnim_39C)));
Actor_SetFocus(&this->actor, 20.0f - ((this->skelAnime.curFrame * 20.0f) /
Animation_GetLastFrame(&gBusinessScrubPeekBurrowAnim)));
} else {
Actor_SetFocus(&this->actor, 20.0f);
}
@@ -259,21 +286,21 @@ void EnShopnuts_Update(Actor* thisx, PlayState* play) {
s32 EnShopnuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnShopnuts* this = (EnShopnuts*)thisx;
if ((limbIndex == 9) && (this->actionFunc == EnShopnuts_ThrowNut)) {
if ((limbIndex == BUSINESS_SCRUB_LIMB_NOSE) && (this->actionFunc == EnShopnuts_ThrowNut)) {
*dList = NULL;
}
return 0;
}
void EnShopnuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnShopnuts* this = (EnShopnuts*)thisx;
f32 curFrame;
f32 x;
f32 y;
f32 z;
if ((limbIndex == 9) && (this->actionFunc == EnShopnuts_ThrowNut)) {
if ((limbIndex == BUSINESS_SCRUB_LIMB_NOSE) && (this->actionFunc == EnShopnuts_ThrowNut)) {
OPEN_DISPS(play->state.gfxCtx, "../z_en_shopnuts.c", 682);
curFrame = this->skelAnime.curFrame;
if (curFrame <= 6.0f) {

View File

@@ -3,9 +3,13 @@
#include "ultra64.h"
#include "global.h"
#include "overlays/actors/ovl_En_Dns/z_en_dns.h"
#include "overlays/actors/ovl_En_Nutsball/z_en_nutsball.h"
struct EnShopnuts;
#define SHOPNUTS_GET_TYPE(thisx) ((thisx)->params)
typedef void (*EnShopnutsActionFunc)(struct EnShopnuts*, PlayState*);
typedef struct EnShopnuts {
@@ -13,8 +17,8 @@ typedef struct EnShopnuts {
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnShopnutsActionFunc actionFunc;
/* 0x0194 */ s16 animFlagAndTimer; // 0x1000 bit denotes that projectile has been thrown
/* 0x0196 */ Vec3s jointTable[18];
/* 0x0202 */ Vec3s morphTable[18];
/* 0x0196 */ Vec3s jointTable[BUSINESS_SCRUB_LIMB_MAX];
/* 0x0202 */ Vec3s morphTable[BUSINESS_SCRUB_LIMB_MAX];
/* 0x0270 */ ColliderCylinder collider;
} EnShopnuts; // size = 0x02BC