Obj_Syokudai (Torch) OK and mostly documented (#306)

* Started uncommenting statics, but then realized this actor has BSS, lol.

* Import .data and .bss. Run format.sh.

* ObjSyokudai_Init OK and mostly documented.

* ObjSyokudai_Destroy OK and fully documented.

* ObjSyokudai_Draw OK and partially documented.

* Good progress on ObjSyokudai_Update, but NOT OK.

* Instruction match, but needs regalloc and stack.

* Stack is closer now.

* Obj_Syokudai OK, no new warnings, ran formatter.

* Documented .data and .bss variables.

* Final documentation pass before PR.

* Add header, fix build errors.

* Use COLTYPE_METAL and COLTYPE_WOOD macros.

* Apply suggestions from code review

engineer124's suggestions.

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Apply suggestions from code review

engineer124: WaterBox* instead of UNK_PTR

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c

engineer124: AC_HARD -> AC_HIT so Jenkins stops complaining

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Hopefully fix Jenkins via z_bg_lotus WaterBox*.

* Rename sp2C to waterBox in BgLotus.

* Run format.sh.

* Update include/functions.h

Change func_800F22C4 param_1 from s8 to s16.

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Change func_801A5CFC param_1 to sfxId in prototype

* Document interactions.

* Run formatter.

* Clarify that posDiff is relative to stick *tip*.

* Changed interaction comparisons to better fit enum

* snuffTimer enum

* Added more #defines.

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
rylieb 2021-09-25 07:53:53 -06:00 committed by GitHub
parent f77cfb9020
commit bc5c3866d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 351 additions and 42 deletions

View File

@ -696,7 +696,7 @@ void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3,
void func_800B42F8(Actor* actor, Lights* mapper, GlobalContext* globalCtx);
// void func_800B4A98(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
void func_800B4AEC(GlobalContext* globalCtx, Actor* actor, f32 param_3);
void func_800B4B50(Actor* actor, s32 iParm2, GlobalContext* globalCtx);
void func_800B4B50(Actor* actor, Lights* mapper, GlobalContext* globalCtx);
void func_800B4EDC(GlobalContext* globalCtx, Vec3f* pzParm2, Vec3f* pzParm3, f32* pfParm4);
// void func_800B4F40(TargetContext* targetCtx, s32 param_2, UNK_TYPE4 param_3, UNK_TYPE4 param_4, UNK_TYPE4 param_5);
void func_800B4F78(TargetContext* targetCtx, u8 type, GlobalContext* globalCtx);
@ -1110,7 +1110,7 @@ u32 func_800C9E40(CollisionContext* colCtx, CollisionPoly* polygon, s32 index);
u32 func_800C9E88(CollisionContext* colCtx, CollisionPoly* polygon, s32 index);
// void func_800C9EBC(GlobalContext* globalCtx, CollisionContext* colCtx, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
s32 func_800CA1AC(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox);
void func_800CA1E8(GlobalContext* globalCtx, CollisionContext* colCtx, f32 arg2, f32 arg3, f32* arg4, UNK_PTR arg5);
s32 func_800CA1E8(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox);
// void func_800CA22C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
// void func_800CA568(void);
// void func_800CA634(void);
@ -1687,7 +1687,7 @@ s16 ActorCutscene_GetLength(s16 index);
// void func_800F2178(void);
s16 ActorCutscene_GetCurrentCamera(s16 index);
// void func_800F21CC(void);
// UNK_TYPE4 func_800F22C4(s16 param_1, Actor* actor);
s32 func_800F22C4(s16 param_1, Actor* actor);
void ActorCutscene_SetReturnCamera(s16 index);
// void func_800F23E0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
// void func_800F2478(void);
@ -3992,7 +3992,7 @@ UNK_TYPE func_801A51F0(UNK_TYPE arg0);
void func_801A5BD0(s32 param_1);
// void func_801A5C28(void);
// void func_801A5C8C(void);
// void func_801A5CFC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
void func_801A5CFC(u16 sfxId, Vec3f* param_2, u8 param_3, f32* param_4, f32* param_5, s8* param_6);
// void func_801A5DDC(void);
// void func_801A5F7C(void);
// void func_801A6430(void);

View File

@ -1876,8 +1876,8 @@ extern UNK_PTR D_801DB478[7];
// extern UNK_TYPE1 D_801DB49C;
// extern UNK_TYPE2 D_801DB4A0;
extern UNK_TYPE D_801DB4A4;
// extern UNK_TYPE1 D_801DB4B0;
// extern UNK_TYPE1 D_801DB4B8;
extern f32 D_801DB4B0;
extern s8 D_801DB4B8;
// extern UNK_TYPE1 D_801DB4C0;
// extern UNK_TYPE1 D_801DB4C4;
// extern UNK_TYPE1 D_801DB4C8;

4
spec
View File

@ -1075,9 +1075,7 @@ beginseg
name "ovl_Obj_Syokudai"
compress
include "build/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.o"
include "build/data/ovl_Obj_Syokudai/ovl_Obj_Syokudai.data.o"
include "build/data/ovl_Obj_Syokudai/ovl_Obj_Syokudai.bss.o"
include "build/data/ovl_Obj_Syokudai/ovl_Obj_Syokudai.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Syokudai/ovl_Obj_Syokudai_reloc.o"
endseg
beginseg

View File

@ -165,10 +165,10 @@ void BgLotus_WaitToAppear(BgLotus* this, GlobalContext* globalCtx) {
void BgLotus_Update(Actor* thisx, GlobalContext* globalCtx) {
BgLotus* this = THIS;
s32 pad;
void* sp2C;
WaterBox* waterBox;
func_800CA1E8(globalCtx, &globalCtx->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z,
&this->height, &sp2C);
&this->height, &waterBox);
this->actionFunc(this, globalCtx);
}

View File

@ -9,7 +9,9 @@ typedef void (*EnArrowActionFunc)(struct EnArrow*, GlobalContext*);
typedef struct EnArrow {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x130];
/* 0x0144 */ char unk_144[0x7C];
/* 0x01C0 */ s32 unk_1C0;
/* 0x01C4 */ char unk_1C4[0xB0];
/* 0x0274 */ EnArrowActionFunc actionFunc;
} EnArrow; // size = 0x278

View File

@ -234,7 +234,7 @@ s32 EnFirefly_SeekTorch(EnFirefly* this, GlobalContext* globalCtx) {
}
while (findTorch != NULL) {
if ((findTorch->actor.id == ACTOR_OBJ_SYOKUDAI) && (findTorch->unk_1DC != 0)) {
if ((findTorch->actor.id == ACTOR_OBJ_SYOKUDAI) && (findTorch->snuffTimer != OBJ_SYOKUDAI_SNUFF_OUT)) {
currentDist = Actor_DistanceBetweenActors(&this->actor, &findTorch->actor);
if (currentDist < currentMinDist) {
currentMinDist = currentDist;

View File

@ -1,4 +1,11 @@
/*
* File: z_obj_syokudai.c
* Overlay: ovl_Obj_Syokudai
* Description: Torch
*/
#include "z_obj_syokudai.h"
#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h"
#define FLAGS 0x00000410
@ -9,7 +16,10 @@ void ObjSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx);
#if 0
extern Gfx D_060003A0[]; // sObjectSyokudaiTypeSwitchCausesFlameDL
extern Gfx D_06000870[]; // sObjectSyokudaiTypeNoSwitchDL
extern Gfx D_06000B90[]; // sObjectSyokudaiTypeFlameCausesSwitchDL
const ActorInit Obj_Syokudai_InitVars = {
ACTOR_OBJ_SYOKUDAI,
ACTORCAT_PROP,
@ -22,38 +32,289 @@ const ActorInit Obj_Syokudai_InitVars = {
(ActorFunc)ObjSyokudai_Draw,
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_808BCCC0 = {
{ COLTYPE_METAL, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, },
{ ELEMTYPE_UNK2, { 0x00100000, 0x00, 0x00 }, { 0xF6CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, },
static ColliderCylinderInit sStandColliderInit = {
{
COLTYPE_METAL,
AT_NONE,
AC_ON | AC_HARD | AC_TYPE_PLAYER,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_2,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK2,
{ 0x00100000, 0x00, 0x00 },
{ 0xF6CFFFFF, 0x00, 0x00 },
TOUCH_NONE | TOUCH_SFX_NORMAL,
BUMP_ON | BUMP_HOOKABLE,
OCELEM_ON,
},
{ 12, 45, 0, { 0, 0, 0 } },
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_808BCCEC = {
{ COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_CYLINDER, },
{ ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0x00000820, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
static ColliderCylinderInit sFlameColliderInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_ON | AC_TYPE_PLAYER,
OC1_NONE,
OC2_NONE,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK2,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000820, 0x00, 0x00 },
TOUCH_NONE | TOUCH_SFX_NORMAL,
BUMP_ON,
OCELEM_NONE,
},
{ 15, 45, 45, { 0, 0, 0 } },
};
// static InitChainEntry sInitChain[] = {
static InitChainEntry D_808BCD18[] = {
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
};
#endif
static u8 sColTypes[] = { COLTYPE_METAL, COLTYPE_WOOD, COLTYPE_WOOD };
extern ColliderCylinderInit D_808BCCC0;
extern ColliderCylinderInit D_808BCCEC;
extern InitChainEntry D_808BCD18[];
static Gfx* sDLists[] = { D_060003A0, D_06000B90, D_06000870 };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Syokudai/ObjSyokudai_Init.s")
static s32 sNumLitTorchesInGroup;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Syokudai/ObjSyokudai_Destroy.s")
void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjSyokudai* this = THIS;
s32 pad;
s32 type = OBJ_SYOKUDAI_GET_TYPE(thisx);
s32 switchFlag = OBJ_SYOKUDAI_GET_SWITCH_FLAG(thisx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Syokudai/ObjSyokudai_Update.s")
Actor_ProcessInitChain(thisx, sInitChain);
func_800B4AEC(globalCtx, thisx, 50.0f);
ActorShape_Init(&thisx->shape, 0.0f, func_800B4B50, 1.0f);
Collider_InitAndSetCylinder(globalCtx, &this->standCollider, thisx, &sStandColliderInit);
this->standCollider.base.colType = sColTypes[OBJ_SYOKUDAI_GET_TYPE(thisx)];
Collider_InitAndSetCylinder(globalCtx, &this->flameCollider, thisx, &sFlameColliderInit);
thisx->colChkInfo.mass = MASS_IMMOVABLE;
Lights_PointGlowSetInfo(&this->lightInfo, thisx->world.pos.x, thisx->world.pos.y + OBJ_SYOKUDAI_GLOW_HEIGHT,
thisx->world.pos.z, 0xFF, 0xFF, 0xB4, -1);
this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Syokudai/ObjSyokudai_Draw.s")
if (OBJ_SYOKUDAI_GET_START_LIT(thisx) ||
((type != OBJ_SYOKUDAI_TYPE_NO_SWITCH || switchFlag != 0x7F) && Flags_GetSwitch(globalCtx, switchFlag))) {
s32 groupSize = OBJ_SYOKUDAI_GET_GROUP_SIZE(thisx);
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER;
if (groupSize != 0) {
sNumLitTorchesInGroup = groupSize;
}
} else {
sNumLitTorchesInGroup = 0;
}
this->flameTexScroll = (u32)(Rand_ZeroOne() * OBJ_SYOKUDAI_SNUFF_DEFAULT);
Actor_SetHeight(thisx, 60.0f);
}
void ObjSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx) {
ObjSyokudai* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->standCollider);
Collider_DestroyCylinder(globalCtx, &this->flameCollider);
LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode);
}
void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
ObjSyokudai* this = THIS;
s32 groupSize = OBJ_SYOKUDAI_GET_GROUP_SIZE(thisx);
s32 switchFlag = OBJ_SYOKUDAI_GET_SWITCH_FLAG(thisx);
s32 type = OBJ_SYOKUDAI_GET_TYPE(thisx);
s32 pad0;
WaterBox* waterBox;
f32 waterSurface;
s32 lightRadius = -1;
u8 lightIntensity = 0;
Player* player;
s32 pad1;
if (this->pendingAction != OBJ_SYOKUDAI_PENDING_ACTION_NONE) {
if (ActorCutscene_GetCurrentIndex() != thisx->cutscene) {
if (ActorCutscene_GetCanPlayNext(thisx->cutscene) != 0) {
ActorCutscene_StartAndSetUnkLinkFields(thisx->cutscene, thisx);
if (this->pendingAction >= OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH) {
Actor_SetSwitchFlag(globalCtx, switchFlag);
}
} else {
ActorCutscene_SetIntentToPlay(thisx->cutscene);
}
} else if (func_800F22C4(thisx->cutscene, thisx) != 0) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER;
this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_NONE;
}
} else {
if (func_800CA1E8(globalCtx, &globalCtx->colCtx, thisx->world.pos.x, thisx->world.pos.z, &waterSurface,
&waterBox) &&
((waterSurface - thisx->world.pos.y) > OBJ_SYOKUDAI_FLAME_HEIGHT)) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_OUT;
if (type == OBJ_SYOKUDAI_TYPE_FLAME_CAUSES_SWITCH) {
Actor_UnsetSwitchFlag(globalCtx, switchFlag);
if (groupSize != 0) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_GROUP_BY_WATER;
}
}
} else {
s32 interaction = OBJ_SYOKUDAI_INTERACTION_NONE;
u32 flameColliderHurtboxDmgFlags = 0;
player = PLAYER;
if (OBJ_SYOKUDAI_GET_START_LIT(thisx)) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER;
}
if (groupSize != 0) {
if (Flags_GetSwitch(globalCtx, switchFlag)) {
if (this->snuffTimer == OBJ_SYOKUDAI_SNUFF_OUT) {
if (type != OBJ_SYOKUDAI_TYPE_SWITCH_CAUSES_FLAME) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER;
} else {
this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_NO_SWITCH;
}
} else if (this->snuffTimer > OBJ_SYOKUDAI_SNUFF_OUT) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER;
}
} else if (this->snuffTimer <= OBJ_SYOKUDAI_SNUFF_NEVER) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_DEFAULT;
}
}
if (this->flameCollider.base.acFlags & AC_HIT) {
flameColliderHurtboxDmgFlags = this->flameCollider.info.acHitInfo->toucher.dmgFlags;
if (this->flameCollider.info.acHitInfo->toucher.dmgFlags & 0x820) {
interaction = OBJ_SYOKUDAI_INTERACTION_ARROW_FA;
}
} else if (player->itemActionParam == 7) {
Vec3f stickTipSeparationVec;
Math_Vec3f_Diff(&player->swordInfo[0].tip, &thisx->world.pos, &stickTipSeparationVec);
stickTipSeparationVec.y -= OBJ_SYOKUDAI_STICK_IGNITION_HEIGHT;
if (SQXYZ(stickTipSeparationVec) < SQ(OBJ_SYOKUDAI_STICK_IGNITION_RADIUS)) {
interaction = OBJ_SYOKUDAI_INTERACTION_STICK;
}
}
if (interaction != OBJ_SYOKUDAI_INTERACTION_NONE) {
if (this->snuffTimer != OBJ_SYOKUDAI_SNUFF_OUT) {
if (interaction <= OBJ_SYOKUDAI_INTERACTION_STICK) {
if (player->unk_B28 == 0) {
player->unk_B28 = 0xD2;
func_8019F1C0(&thisx->projectedPos, NA_SE_EV_FLAME_IGNITION);
} else if (player->unk_B28 < 0xC8) {
player->unk_B28 = 0xC8;
}
} else if (flameColliderHurtboxDmgFlags & 0x20) {
Actor* flameColliderHurtboxActor = this->flameCollider.base.ac;
if ((flameColliderHurtboxActor->update != NULL) &&
(flameColliderHurtboxActor->id == ACTOR_EN_ARROW)) {
flameColliderHurtboxActor->params = 0;
((EnArrow*)flameColliderHurtboxActor)->unk_1C0 = 0x800;
}
}
if ((this->snuffTimer > OBJ_SYOKUDAI_SNUFF_NEVER) &&
(this->snuffTimer < (OBJ_SYOKUDAI_SNUFF_TIMER_INITIAL(groupSize))) &&
(type != OBJ_SYOKUDAI_TYPE_SWITCH_CAUSES_FLAME)) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_TIMER_INITIAL(groupSize);
}
} else if ((type != OBJ_SYOKUDAI_TYPE_SWITCH_CAUSES_FLAME) &&
(((interaction >= OBJ_SYOKUDAI_INTERACTION_ARROW_FA) &&
(flameColliderHurtboxDmgFlags & 0x800)) ||
((interaction <= OBJ_SYOKUDAI_INTERACTION_STICK) && (player->unk_B28 != 0)))) {
if ((interaction < OBJ_SYOKUDAI_INTERACTION_NONE) && (player->unk_B28 < 0xC8)) {
player->unk_B28 = 0xC8;
}
if (groupSize == 0) {
if ((type == OBJ_SYOKUDAI_TYPE_NO_SWITCH) && (switchFlag == 0x7F)) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER;
} else if (thisx->cutscene >= 0) {
this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH;
} else {
Actor_SetSwitchFlag(globalCtx, switchFlag);
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER;
}
} else {
if (++sNumLitTorchesInGroup >= groupSize) {
this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH;
} else {
this->snuffTimer =
OBJ_SYOKUDAI_SNUFF_TIMER_INITIAL(groupSize) + OBJ_SYOKUDAI_SNUFF_TIMER_JUST_LIT_BONUS;
}
}
func_801A5CFC(NA_SE_EV_FLAME_IGNITION, &thisx->projectedPos, 4, &D_801DB4B0, &D_801DB4B0,
&D_801DB4B8);
}
}
}
}
Collider_UpdateCylinder(thisx, &this->standCollider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->standCollider.base);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->standCollider.base);
Collider_UpdateCylinder(thisx, &this->flameCollider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->flameCollider.base);
if ((this->snuffTimer > OBJ_SYOKUDAI_SNUFF_OUT) && (--this->snuffTimer == OBJ_SYOKUDAI_SNUFF_OUT) &&
(type != OBJ_SYOKUDAI_TYPE_SWITCH_CAUSES_FLAME)) {
sNumLitTorchesInGroup--;
}
if (this->snuffTimer != OBJ_SYOKUDAI_SNUFF_OUT) {
s32 pad2;
if ((this->snuffTimer <= OBJ_SYOKUDAI_SNUFF_NEVER) || (this->snuffTimer >= OBJ_SYOKUDAI_SNUFF_DEFAULT)) {
lightRadius = OBJ_SYOKUDAI_LIGHT_RADIUS_MAX;
} else {
lightRadius = (f32)this->snuffTimer * OBJ_SYOKUDAI_LIGHT_RADIUS_MAX / OBJ_SYOKUDAI_SNUFF_DEFAULT;
}
lightIntensity = Rand_ZeroOne() * 127;
lightIntensity += 128;
func_800B9010(thisx, NA_SE_EV_TORCH - SFX_FLAG);
}
Lights_PointSetColorAndRadius(&this->lightInfo, lightIntensity, lightIntensity * 0.7f, 0, lightRadius);
this->flameTexScroll++;
}
void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) {
ObjSyokudai* this = THIS;
s32 pad;
s32 groupSize = OBJ_SYOKUDAI_GET_GROUP_SIZE(thisx);
f32 flameScale;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, sDLists[OBJ_SYOKUDAI_GET_TYPE(thisx)]);
if (this->snuffTimer != OBJ_SYOKUDAI_SNUFF_OUT) {
s32 snuffTimerInitial = OBJ_SYOKUDAI_SNUFF_TIMER_INITIAL(groupSize);
flameScale = 1.0f;
if (snuffTimerInitial < this->snuffTimer) {
flameScale = (f32)(snuffTimerInitial - this->snuffTimer + OBJ_SYOKUDAI_SNUFF_TIMER_JUST_LIT_BONUS) /
OBJ_SYOKUDAI_SNUFF_TIMER_JUST_LIT_BONUS;
} else if ((this->snuffTimer > OBJ_SYOKUDAI_SNUFF_OUT) && (this->snuffTimer < OBJ_SYOKUDAI_SNUFF_DEFAULT)) {
flameScale = (f32)this->snuffTimer / OBJ_SYOKUDAI_SNUFF_DEFAULT;
}
flameScale *= 0.0027f;
func_8012C2DC(globalCtx->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0,
(this->flameTexScroll * -OBJ_SYOKUDAI_SNUFF_DEFAULT) & 0x1FF, 0x20, 0x80));
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0);
SysMatrix_InsertTranslation(0.0f, OBJ_SYOKUDAI_FLAME_HEIGHT, 0.0f, MTXMODE_APPLY);
Matrix_RotateY(BINANG_ROT180(func_800DFCDC(ACTIVE_CAM) - thisx->shape.rot.y), MTXMODE_APPLY);
Matrix_Scale(flameScale, flameScale, flameScale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_0407D590);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -7,12 +7,54 @@ struct ObjSyokudai;
typedef struct ObjSyokudai {
/* 0x000 */ Actor actor;
/* 0x144 */ ColliderCylinder colliderCylinder1;
/* 0x190 */ ColliderCylinder colliderCylinder2;
/* 0x1DC */ s16 unk_1DC;
/* 0x1DE */ char unk_1DE[0x16];
/* 0x144 */ ColliderCylinder standCollider;
/* 0x190 */ ColliderCylinder flameCollider;
/* 0x1DC */ s16 snuffTimer;
/* 0x1DE */ u8 flameTexScroll;
/* 0x1DF */ s8 pendingAction;
/* 0x1E0 */ LightNode* lightNode;
/* 0x1E4 */ LightInfo lightInfo;
} ObjSyokudai; // size = 0x1F4
extern const ActorInit Obj_Syokudai_InitVars;
typedef enum {
/* 0 */ OBJ_SYOKUDAI_TYPE_SWITCH_CAUSES_FLAME,
/* 1 */ OBJ_SYOKUDAI_TYPE_FLAME_CAUSES_SWITCH,
/* 2 */ OBJ_SYOKUDAI_TYPE_NO_SWITCH
} ObjSyokudaiTypes;
typedef enum {
/* -1 */ OBJ_SYOKUDAI_SNUFF_NEVER = -1,
/* 0 */ OBJ_SYOKUDAI_SNUFF_OUT,
/* 1 */ OBJ_SYOKUDAI_SNUFF_GROUP_BY_WATER,
/* 20 */ OBJ_SYOKUDAI_SNUFF_DEFAULT = 20
} ObjSyokudaiSnuffStates;
typedef enum {
/* -1 */ OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_NO_SWITCH = -1,
/* 0 */ OBJ_SYOKUDAI_PENDING_ACTION_NONE,
/* 1 */ OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH
} ObjSyokudaiPendingActions;
typedef enum {
/* -1 */ OBJ_SYOKUDAI_INTERACTION_STICK = -1,
/* 0 */ OBJ_SYOKUDAI_INTERACTION_NONE,
/* 1 */ OBJ_SYOKUDAI_INTERACTION_ARROW_FA
} ObjSyokudaiInteractions;
#define OBJ_SYOKUDAI_GLOW_HEIGHT 70.0f
#define OBJ_SYOKUDAI_FLAME_HEIGHT 52.0f
#define OBJ_SYOKUDAI_STICK_IGNITION_HEIGHT 67.0f
#define OBJ_SYOKUDAI_STICK_IGNITION_RADIUS 20.0f
#define OBJ_SYOKUDAI_SNUFF_TIMER_JUST_LIT_BONUS 10
#define OBJ_SYOKUDAI_LIGHT_RADIUS_MAX 250
#define OBJ_SYOKUDAI_GET_TYPE(thisx) (thisx->params >> 0xC)
#define OBJ_SYOKUDAI_GET_START_LIT(thisx) (thisx->params & 0x800)
#define OBJ_SYOKUDAI_GET_GROUP_SIZE(thisx) ((thisx->params >> 7) & 0xF)
#define OBJ_SYOKUDAI_GET_SWITCH_FLAG(thisx) (thisx->params & 0x7F)
#define OBJ_SYOKUDAI_SNUFF_TIMER_INITIAL(groupSize) ((groupSize * 50) + 100)
#endif // Z_OBJ_SYOKUDAI_H

View File

@ -6810,14 +6810,14 @@
0x808BC000:("D_808BC000","UNK_TYPE1","",0x1),
0x808BC004:("D_808BC004","UNK_TYPE1","",0x1),
0x808BCCA0:("Obj_Syokudai_InitVars","UNK_TYPE1","",0x1),
0x808BCCC0:("D_808BCCC0","UNK_TYPE1","",0x1),
0x808BCCEC:("D_808BCCEC","UNK_TYPE1","",0x1),
0x808BCD18:("D_808BCD18","UNK_TYPE1","",0x1),
0x808BCD28:("D_808BCD28","UNK_TYPE1","",0x1),
0x808BCD2C:("D_808BCD2C","UNK_TYPE1","",0x1),
0x808BCCC0:("sStandColliderInit","UNK_TYPE1","",0x1),
0x808BCCEC:("sFlameColliderInit","UNK_TYPE1","",0x1),
0x808BCD18:("sInitChain","UNK_TYPE1","",0x1),
0x808BCD28:("sColTypes","UNK_TYPE1","",0x1),
0x808BCD2C:("sDLists","UNK_TYPE1","",0x1),
0x808BCD40:("D_808BCD40","f32","",0x4),
0x808BCD44:("D_808BCD44","f32","",0x4),
0x808BCDE0:("D_808BCDE0","UNK_TYPE1","",0x1),
0x808BCDE0:("sNumLitTorchesInGroup","UNK_TYPE1","",0x1),
0x808BD160:("Item_B_Heart_InitVars","UNK_TYPE1","",0x1),
0x808BD180:("D_808BD180","UNK_TYPE1","",0x1),
0x808BD190:("D_808BD190","f32","",0x4),

View File

@ -4108,6 +4108,12 @@ D_06008B90 = 0x06008B90;
D_06000460 = 0x06000460;
D_06000E68 = 0x06000E68;
// ovl_Obj_Syokudai
D_060003A0 = 0x060003A0;
D_06000870 = 0x06000870;
D_06000B90 = 0x06000B90;
// ovl_Obj_Takaraya_Wall
D_06000B70 = 0x06000B70;