mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-14 11:54:39 +00:00
Merge branch 'master' into doc_pause_menu
This commit is contained in:
commit
d43613694c
188 changed files with 4328 additions and 3791 deletions
|
@ -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>
|
||||
|
|
12
include/attributes.h
Normal file
12
include/attributes.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef ATTRIBUTES_H
|
||||
#define ATTRIBUTES_H
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
#define UNUSED __attribute__((unused))
|
||||
#define FALLTHROUGH __attribute__((fallthrough))
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
|
||||
#endif
|
|
@ -42,8 +42,8 @@ void Fault_Init(void);
|
|||
|
||||
// Fatal Errors
|
||||
|
||||
void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2);
|
||||
void Fault_AddHungupAndCrash(const char* file, s32 line);
|
||||
NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2);
|
||||
NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line);
|
||||
|
||||
// Client Registration
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@ void Locale_ResetRegion(void);
|
|||
u32 func_80001F48(void);
|
||||
u32 func_80001F8C(void);
|
||||
u32 Locale_IsRegionNative(void);
|
||||
void __assert(const char* exp, const char* file, s32 line);
|
||||
NORETURN void __assert(const char* exp, const char* file, s32 line);
|
||||
void isPrintfInit(void);
|
||||
void osSyncPrintfUnused(const char* fmt, ...);
|
||||
void osSyncPrintf(const char* fmt, ...);
|
||||
void rmonPrintf(const char* fmt, ...);
|
||||
void* is_proutSyncPrintf(void* arg, const char* str, u32 count);
|
||||
void func_80002384(const char* exp, const char* file, u32 line);
|
||||
NORETURN void func_80002384(const char* exp, const char* file, u32 line);
|
||||
OSPiHandle* osDriveRomInit(void);
|
||||
void Mio0_Decompress(Yaz0Header* hdr, u8* dst);
|
||||
void StackCheck_Init(StackEntry* entry, void* stackBottom, void* stackTop, u32 initValue, s32 minSpace,
|
||||
|
@ -458,7 +458,7 @@ void Enemy_StartFinishingBlow(PlayState* play, Actor* actor);
|
|||
s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3);
|
||||
void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play);
|
||||
void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList,
|
||||
s16 objectId);
|
||||
s16 objectSlot);
|
||||
s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type);
|
||||
void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne,
|
||||
f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting);
|
||||
|
@ -856,7 +856,7 @@ s32 Math_StepUntilS(s16* pValue, s16 limit, s16 step);
|
|||
s32 Math_StepToAngleS(s16* pValue, s16 target, s16 step);
|
||||
s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step);
|
||||
s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep);
|
||||
void func_80077D10(f32* arg0, s16* arg1, Input* input);
|
||||
void Lib_GetControlStickData(f32* outMagnitude, s16* outAngle, Input* input);
|
||||
s16 Rand_S16Offset(s16 base, s16 range);
|
||||
void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src);
|
||||
void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src);
|
||||
|
@ -1069,7 +1069,7 @@ void Gfx_SetupDL_37Opa(GraphicsContext* gfxCtx);
|
|||
Gfx* Gfx_SetupDL_39(Gfx* gfx);
|
||||
void Gfx_SetupDL_39Opa(GraphicsContext* gfxCtx);
|
||||
void Gfx_SetupDL_39Overlay(GraphicsContext* gfxCtx);
|
||||
void Gfx_SetupDL_39Ptr(Gfx** gfxp);
|
||||
void Gfx_SetupDL_39Ptr(Gfx** gfxP);
|
||||
void Gfx_SetupDL_40Opa(GraphicsContext* gfxCtx);
|
||||
void Gfx_SetupDL_41Opa(GraphicsContext* gfxCtx);
|
||||
void Gfx_SetupDL_47Xlu(GraphicsContext* gfxCtx);
|
||||
|
@ -1081,8 +1081,8 @@ void Gfx_SetupDL_42Overlay(GraphicsContext* gfxCtx);
|
|||
void Gfx_SetupDL_27Xlu(GraphicsContext* gfxCtx);
|
||||
void Gfx_SetupDL_60NoCDXlu(GraphicsContext* gfxCtx);
|
||||
void Gfx_SetupDL_61Xlu(GraphicsContext* gfxCtx);
|
||||
void Gfx_SetupDL_56Ptr(Gfx** gfxp);
|
||||
Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height);
|
||||
void Gfx_SetupDL_56Ptr(Gfx** gfxP);
|
||||
Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height);
|
||||
Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y);
|
||||
Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height);
|
||||
Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2,
|
||||
|
@ -1106,11 +1106,10 @@ void Sample_Init(GameState* thisx);
|
|||
void Inventory_ChangeEquipment(s16 equipment, u16 value);
|
||||
u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment);
|
||||
void Inventory_ChangeUpgrade(s16 upgrade, s16 value);
|
||||
s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId);
|
||||
void Object_InitBank(PlayState* play, ObjectContext* objectCtx);
|
||||
void Object_UpdateBank(ObjectContext* objectCtx);
|
||||
s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId);
|
||||
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex);
|
||||
void Object_InitContext(PlayState* play, ObjectContext* objectCtx);
|
||||
void Object_UpdateEntries(ObjectContext* objectCtx);
|
||||
s32 Object_GetSlot(ObjectContext* objectCtx, s16 objectId);
|
||||
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 slot);
|
||||
void func_800981B8(ObjectContext* objectCtx);
|
||||
s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd);
|
||||
void TransitionActor_InitContext(GameState* state, TransitionActorContext* transiActorCtx);
|
||||
|
@ -1187,7 +1186,7 @@ void View_Apply(View* view, s32 mask);
|
|||
s32 View_ApplyOrthoToOverlay(View* view);
|
||||
s32 View_ApplyPerspectiveToOverlay(View* view);
|
||||
s32 View_UpdateViewingMatrix(View* view);
|
||||
s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxp);
|
||||
s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP);
|
||||
s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ);
|
||||
void ViMode_LogPrint(OSViMode* osViMode);
|
||||
void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antialiasOff, s32 modeN, s32 fb16Bit,
|
||||
|
@ -1198,15 +1197,6 @@ void ViMode_Init(ViMode* viMode);
|
|||
void ViMode_Destroy(ViMode* viMode);
|
||||
void ViMode_ConfigureFeatures(ViMode* viMode, s32 viFeatures);
|
||||
void ViMode_Update(ViMode* viMode, Input* input);
|
||||
void func_800ACE70(struct_801664F0* this);
|
||||
void func_800ACE90(struct_801664F0* this);
|
||||
void func_800ACE98(struct_801664F0* this, Gfx** gfxp);
|
||||
void VisMono_Init(VisMono* this);
|
||||
void VisMono_Destroy(VisMono* this);
|
||||
void VisMono_Draw(VisMono* this, Gfx** gfxp);
|
||||
void func_800AD920(struct_80166500* this);
|
||||
void func_800AD950(struct_80166500* this);
|
||||
void func_800AD958(struct_80166500* this, Gfx** gfxp);
|
||||
void PlayerCall_InitFuncPtrs(void);
|
||||
void TransitionTile_Destroy(TransitionTile* this);
|
||||
TransitionTile* TransitionTile_Init(TransitionTile* this, s32 cols, s32 rows);
|
||||
|
@ -1305,15 +1295,15 @@ void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf,
|
|||
void PreRender_Init(PreRender* this);
|
||||
void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf);
|
||||
void PreRender_Destroy(PreRender* this);
|
||||
void func_800C170C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a);
|
||||
void func_800C1AE8(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave);
|
||||
void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxp);
|
||||
void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp);
|
||||
void PreRender_DrawCoverage(PreRender* this, Gfx** gfxp);
|
||||
void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxp);
|
||||
void func_800C213C(PreRender* this, Gfx** gfxp);
|
||||
void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxp);
|
||||
void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxp);
|
||||
void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a);
|
||||
void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave);
|
||||
void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP);
|
||||
void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP);
|
||||
void PreRender_DrawCoverage(PreRender* this, Gfx** gfxP);
|
||||
void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP);
|
||||
void func_800C213C(PreRender* this, Gfx** gfxP);
|
||||
void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP);
|
||||
void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP);
|
||||
void PreRender_ApplyFilters(PreRender* this);
|
||||
void AudioMgr_StopAllSfx(void);
|
||||
void func_800C3C80(AudioMgr* audioMgr);
|
||||
|
@ -1323,8 +1313,8 @@ void AudioMgr_ThreadEntry(void* arg0);
|
|||
void AudioMgr_Unlock(AudioMgr* audioMgr);
|
||||
void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, Scheduler* sched, IrqMgr* irqMgr);
|
||||
void GameState_FaultPrint(void);
|
||||
void GameState_SetFBFilter(Gfx** gfx);
|
||||
void GameState_DrawInputDisplay(u16 input, Gfx** gfx);
|
||||
void GameState_SetFBFilter(Gfx** gfxP);
|
||||
void GameState_DrawInputDisplay(u16 input, Gfx** gfxP);
|
||||
void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx);
|
||||
void GameState_SetFrameBuffer(GraphicsContext* gfxCtx);
|
||||
void GameState_ReqPadData(GameState* gameState);
|
||||
|
@ -1358,7 +1348,7 @@ void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file,
|
|||
void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line);
|
||||
Gfx* Graph_GfxPlusOne(Gfx* gfx);
|
||||
Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst);
|
||||
void* Graph_DlistAlloc(Gfx** gfx, u32 size);
|
||||
void* Graph_DlistAlloc(Gfx** gfxP, u32 size);
|
||||
ListAlloc* ListAlloc_Init(ListAlloc* this);
|
||||
void* ListAlloc_Alloc(ListAlloc* this, u32 size);
|
||||
void ListAlloc_Free(ListAlloc* this, void* data);
|
||||
|
@ -1476,7 +1466,7 @@ u64* SysUcode_GetUCodeBoot(void);
|
|||
size_t SysUcode_GetUCodeBootSize(void);
|
||||
u64* SysUcode_GetUCode(void);
|
||||
u64* SysUcode_GetUCodeData(void);
|
||||
void func_800D31A0(void);
|
||||
NORETURN void func_800D31A0(void);
|
||||
void func_800D31F0(void);
|
||||
void func_800D3210(void);
|
||||
void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action);
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
#ifndef MACROS_H
|
||||
#define MACROS_H
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
#ifndef AVOID_UB
|
||||
#define BAD_RETURN(type) type
|
||||
#else
|
||||
#define BAD_RETURN(type) void
|
||||
#endif
|
||||
|
||||
#define UNUSED __attribute__((unused))
|
||||
#define FALLTHROUGH __attribute__((fallthrough))
|
||||
|
||||
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
||||
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "ultra64.h"
|
||||
#include "ultra64/gs2dex.h"
|
||||
#include "attributes.h"
|
||||
#include "z64save.h"
|
||||
#include "z64light.h"
|
||||
#include "z64bgcheck.h"
|
||||
|
@ -34,6 +35,7 @@
|
|||
#include "z64skybox.h"
|
||||
#include "z64sram.h"
|
||||
#include "z64view.h"
|
||||
#include "z64vis.h"
|
||||
#include "alignment.h"
|
||||
#include "seqcmd.h"
|
||||
#include "sequence.h"
|
||||
|
@ -794,29 +796,4 @@ typedef struct {
|
|||
/* 0x84 */ u32 unk_84;
|
||||
} ViMode; // size = 0x88
|
||||
|
||||
// Vis...
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 type;
|
||||
/* 0x04 */ u32 setScissor;
|
||||
/* 0x08 */ Color_RGBA8_u32 color;
|
||||
/* 0x0C */ Color_RGBA8_u32 envColor;
|
||||
} struct_801664F0; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 unk_00;
|
||||
/* 0x04 */ u32 setScissor;
|
||||
/* 0x08 */ Color_RGBA8_u32 primColor;
|
||||
/* 0x0C */ Color_RGBA8_u32 envColor;
|
||||
/* 0x10 */ u16* tlut;
|
||||
/* 0x14 */ Gfx* dList;
|
||||
} VisMono; // size = 0x18
|
||||
|
||||
// Vis...
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 useRgba;
|
||||
/* 0x04 */ u32 setScissor;
|
||||
/* 0x08 */ Color_RGBA8_u32 primColor;
|
||||
/* 0x08 */ Color_RGBA8_u32 envColor;
|
||||
} struct_80166500; // size = 0x10
|
||||
|
||||
#endif
|
||||
|
|
|
@ -199,7 +199,7 @@ typedef struct Actor {
|
|||
/* 0x004 */ u32 flags; // Flags used for various purposes
|
||||
/* 0x008 */ PosRot home; // Initial position/rotation when spawned. Can be used for other purposes
|
||||
/* 0x01C */ s16 params; // Configurable variable set by the actor's spawn data; original name: "args_data"
|
||||
/* 0x01E */ s8 objBankIndex; // Object bank index of the actor's object dependency; original name: "bank"
|
||||
/* 0x01E */ s8 objectSlot; // Object slot (in ObjectContext) corresponding to the actor's object; original name: "bank"
|
||||
/* 0x01F */ s8 targetMode; // Controls how far the actor can be targeted from and how far it can stay locked on
|
||||
/* 0x020 */ u16 sfx; // SFX ID to play. Sfx plays when value is set, then is cleared the following update cycle
|
||||
/* 0x024 */ PosRot world; // Position/rotation in the world
|
||||
|
@ -287,14 +287,14 @@ typedef struct DynaPolyActor {
|
|||
|
||||
typedef struct {
|
||||
/* 0x00 */ MtxF* matrices;
|
||||
/* 0x04 */ s16* objectIds;
|
||||
/* 0x04 */ s16* objectSlots;
|
||||
/* 0x08 */ s16 count;
|
||||
/* 0x0C */ Gfx** dLists;
|
||||
/* 0x10 */ s32 val; // used for various purposes: both a status indicator and counter
|
||||
/* 0x14 */ s32 prevLimbIndex;
|
||||
} BodyBreak;
|
||||
|
||||
#define BODYBREAK_OBJECT_DEFAULT -1 // use the same object as the actor
|
||||
#define BODYBREAK_OBJECT_SLOT_DEFAULT -1 // use the same object as the actor
|
||||
#define BODYBREAK_STATUS_READY -1
|
||||
#define BODYBREAK_STATUS_FINISHED 0
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ typedef struct {
|
|||
#define rgEnvColorG regs[8]
|
||||
#define rgEnvColorB regs[9]
|
||||
#define rgEnvColorA regs[10]
|
||||
#define rgObjBankIdx regs[11]
|
||||
#define rgObjectSlot regs[11]
|
||||
|
||||
#define DEFINE_EFFECT_SS(_0, enum) enum,
|
||||
#define DEFINE_EFFECT_SS_UNSET(enum) enum,
|
||||
|
|
|
@ -4,24 +4,22 @@
|
|||
#include "ultra64.h"
|
||||
#include "z64dma.h"
|
||||
|
||||
#define OBJECT_EXCHANGE_BANK_MAX 19
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 id;
|
||||
/* 0x04 */ void* segment;
|
||||
/* 0x08 */ DmaRequest dmaRequest;
|
||||
/* 0x00 */ s16 id;
|
||||
/* 0x04 */ void* segment;
|
||||
/* 0x08 */ DmaRequest dmaRequest;
|
||||
/* 0x28 */ OSMesgQueue loadQueue;
|
||||
/* 0x40 */ OSMesg loadMsg;
|
||||
} ObjectStatus; // size = 0x44
|
||||
/* 0x40 */ OSMesg loadMsg;
|
||||
} ObjectEntry; // size = 0x44
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ void* spaceStart;
|
||||
/* 0x0004 */ void* spaceEnd; // original name: "endSegment"
|
||||
/* 0x0008 */ u8 num; // number of objects in bank
|
||||
/* 0x0009 */ u8 unk_09;
|
||||
/* 0x000A */ u8 mainKeepIndex; // "gameplay_keep" index in bank
|
||||
/* 0x000B */ u8 subKeepIndex; // "gameplay_field_keep" or "gameplay_dangeon_keep" index in bank
|
||||
/* 0x000C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX];
|
||||
/* 0x0000 */ void* spaceStart;
|
||||
/* 0x0004 */ void* spaceEnd; // original name: "endSegment"
|
||||
/* 0x0008 */ u8 numEntries; // total amount of used entries
|
||||
/* 0x0009 */ u8 numPersistentEntries; // amount of entries that won't be reused when loading a new object list (when loading a new room)
|
||||
/* 0x000A */ u8 mainKeepSlot; // "gameplay_keep" slot
|
||||
/* 0x000B */ u8 subKeepSlot; // "gameplay_field_keep" or "gameplay_dangeon_keep" slot
|
||||
/* 0x000C */ ObjectEntry slots[19];
|
||||
} ObjectContext; // size = 0x518
|
||||
|
||||
#define DEFINE_OBJECT(_0, enum) enum,
|
||||
|
@ -31,7 +29,7 @@ typedef struct {
|
|||
typedef enum {
|
||||
#include "tables/object_table.h"
|
||||
/* 0x0192 */ OBJECT_ID_MAX
|
||||
} ObjectID;
|
||||
} ObjectId;
|
||||
|
||||
#undef DEFINE_OBJECT
|
||||
#undef DEFINE_OBJECT_NULL
|
||||
|
|
|
@ -459,8 +459,16 @@ typedef enum {
|
|||
/* 0x67 */ PLAYER_CSMODE_MAX
|
||||
} PlayerCutsceneMode;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ PLAYER_LEDGE_CLIMB_NONE,
|
||||
/* 1 */ PLAYER_LEDGE_CLIMB_1,
|
||||
/* 2 */ PLAYER_LEDGE_CLIMB_2,
|
||||
/* 3 */ PLAYER_LEDGE_CLIMB_3,
|
||||
/* 4 */ PLAYER_LEDGE_CLIMB_4
|
||||
} PlayerLedgeClimbType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ f32 unk_00;
|
||||
/* 0x00 */ f32 ceilingCheckHeight;
|
||||
/* 0x04 */ f32 unk_04;
|
||||
/* 0x08 */ f32 unk_08;
|
||||
/* 0x0C */ f32 unk_0C;
|
||||
|
@ -474,7 +482,7 @@ typedef struct {
|
|||
/* 0x2C */ f32 unk_2C;
|
||||
/* 0x30 */ f32 unk_30;
|
||||
/* 0x34 */ f32 unk_34;
|
||||
/* 0x38 */ f32 unk_38;
|
||||
/* 0x38 */ f32 wallCheckRadius;
|
||||
/* 0x3C */ f32 unk_3C;
|
||||
/* 0x40 */ f32 unk_40;
|
||||
/* 0x44 */ Vec3s unk_44;
|
||||
|
@ -501,6 +509,8 @@ typedef struct {
|
|||
/* 0x10 */ Vec3f base;
|
||||
} WeaponInfo; // size = 0x1C
|
||||
|
||||
#define LEDGE_DIST_MAX 399.96002f
|
||||
|
||||
#define PLAYER_STATE1_0 (1 << 0)
|
||||
#define PLAYER_STATE1_SWINGING_BOTTLE (1 << 1)
|
||||
#define PLAYER_STATE1_2 (1 << 2)
|
||||
|
@ -509,7 +519,7 @@ typedef struct {
|
|||
#define PLAYER_STATE1_5 (1 << 5)
|
||||
#define PLAYER_STATE1_6 (1 << 6)
|
||||
#define PLAYER_STATE1_7 (1 << 7)
|
||||
#define PLAYER_STATE1_8 (1 << 8)
|
||||
#define PLAYER_STATE1_START_CHANGING_HELD_ITEM (1 << 8)
|
||||
#define PLAYER_STATE1_9 (1 << 9)
|
||||
#define PLAYER_STATE1_10 (1 << 10)
|
||||
#define PLAYER_STATE1_11 (1 << 11)
|
||||
|
@ -543,7 +553,7 @@ typedef struct {
|
|||
#define PLAYER_STATE2_6 (1 << 6)
|
||||
#define PLAYER_STATE2_7 (1 << 7)
|
||||
#define PLAYER_STATE2_8 (1 << 8)
|
||||
#define PLAYER_STATE2_9 (1 << 9)
|
||||
#define PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND (1 << 9)
|
||||
#define PLAYER_STATE2_10 (1 << 10)
|
||||
#define PLAYER_STATE2_11 (1 << 11)
|
||||
#define PLAYER_STATE2_12 (1 << 12)
|
||||
|
@ -576,185 +586,185 @@ typedef struct {
|
|||
#define PLAYER_STATE3_RESTORE_NAYRUS_LOVE (1 << 6) // Set by ocarina effects actors when destroyed to signal Nayru's Love may be restored (see `ACTOROVL_ALLOC_ABSOLUTE`)
|
||||
#define PLAYER_STATE3_7 (1 << 7)
|
||||
|
||||
typedef void (*PlayerFunc674)(struct Player*, struct PlayState*);
|
||||
typedef s32 (*PlayerFunc82C)(struct Player*, struct PlayState*);
|
||||
typedef void (*PlayerActionFunc)(struct Player*, struct PlayState*);
|
||||
typedef s32 (*ItemActionFunc)(struct Player*, struct PlayState*);
|
||||
typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*);
|
||||
|
||||
typedef struct Player {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ s8 currentTunic; // current tunic from `PlayerTunic`
|
||||
/* 0x014D */ s8 currentSwordItemId;
|
||||
/* 0x014E */ s8 currentShield; // current shield from `PlayerShield`
|
||||
/* 0x014F */ s8 currentBoots; // current boots from `PlayerBoots`
|
||||
/* 0x0150 */ s8 heldItemButton; // Button index for the item currently used
|
||||
/* 0x0151 */ s8 heldItemAction; // Item action for the item currently used
|
||||
/* 0x0152 */ u8 heldItemId; // Item id for the item currently used
|
||||
/* 0x0153 */ s8 prevBoots; // previous boots from `PlayerBoots`
|
||||
/* 0x0154 */ s8 itemAction; // the difference between this and heldItemAction is unclear
|
||||
/* 0x0155 */ char unk_155[0x003];
|
||||
/* 0x0158 */ u8 modelGroup;
|
||||
/* 0x0159 */ u8 nextModelGroup;
|
||||
/* 0x015A */ s8 unk_15A;
|
||||
/* 0x015B */ u8 modelAnimType;
|
||||
/* 0x015C */ u8 leftHandType;
|
||||
/* 0x015D */ u8 rightHandType;
|
||||
/* 0x015E */ u8 sheathType;
|
||||
/* 0x015F */ u8 currentMask; // current mask equipped from `PlayerMask`
|
||||
/* 0x0160 */ Gfx** rightHandDLists;
|
||||
/* 0x0164 */ Gfx** leftHandDLists;
|
||||
/* 0x0168 */ Gfx** sheathDLists;
|
||||
/* 0x016C */ Gfx** waistDLists;
|
||||
/* 0x0170 */ u8 giObjectLoading;
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ s8 currentTunic; // current tunic from `PlayerTunic`
|
||||
/* 0x014D */ s8 currentSwordItemId;
|
||||
/* 0x014E */ s8 currentShield; // current shield from `PlayerShield`
|
||||
/* 0x014F */ s8 currentBoots; // current boots from `PlayerBoots`
|
||||
/* 0x0150 */ s8 heldItemButton; // Button index for the item currently used
|
||||
/* 0x0151 */ s8 heldItemAction; // Item action for the item currently used
|
||||
/* 0x0152 */ u8 heldItemId; // Item id for the item currently used
|
||||
/* 0x0153 */ s8 prevBoots; // previous boots from `PlayerBoots`
|
||||
/* 0x0154 */ s8 itemAction; // the difference between this and heldItemAction is unclear
|
||||
/* 0x0155 */ char unk_155[0x003];
|
||||
/* 0x0158 */ u8 modelGroup;
|
||||
/* 0x0159 */ u8 nextModelGroup;
|
||||
/* 0x015A */ s8 itemChangeType;
|
||||
/* 0x015B */ u8 modelAnimType;
|
||||
/* 0x015C */ u8 leftHandType;
|
||||
/* 0x015D */ u8 rightHandType;
|
||||
/* 0x015E */ u8 sheathType;
|
||||
/* 0x015F */ u8 currentMask; // current mask equipped from `PlayerMask`
|
||||
/* 0x0160 */ Gfx** rightHandDLists;
|
||||
/* 0x0164 */ Gfx** leftHandDLists;
|
||||
/* 0x0168 */ Gfx** sheathDLists;
|
||||
/* 0x016C */ Gfx** waistDLists;
|
||||
/* 0x0170 */ u8 giObjectLoading;
|
||||
/* 0x0174 */ DmaRequest giObjectDmaRequest;
|
||||
/* 0x0194 */ OSMesgQueue giObjectLoadQueue;
|
||||
/* 0x01AC */ OSMesg giObjectLoadMsg;
|
||||
/* 0x01B0 */ void* giObjectSegment; // also used for title card textures
|
||||
/* 0x01B4 */ SkelAnime skelAnime;
|
||||
/* 0x01F8 */ Vec3s jointTable[PLAYER_LIMB_BUF_COUNT];
|
||||
/* 0x0288 */ Vec3s morphTable[PLAYER_LIMB_BUF_COUNT];
|
||||
/* 0x0318 */ Vec3s blendTable[PLAYER_LIMB_BUF_COUNT];
|
||||
/* 0x03A8 */ s16 unk_3A8[2];
|
||||
/* 0x03AC */ Actor* heldActor;
|
||||
/* 0x03B0 */ Vec3f leftHandPos;
|
||||
/* 0x03BC */ Vec3s unk_3BC;
|
||||
/* 0x03C4 */ Actor* unk_3C4;
|
||||
/* 0x03C8 */ Vec3f unk_3C8;
|
||||
/* 0x03D4 */ char unk_3D4[0x058];
|
||||
/* 0x042C */ s8 doorType;
|
||||
/* 0x042D */ s8 doorDirection;
|
||||
/* 0x042E */ s16 doorTimer;
|
||||
/* 0x0430 */ Actor* doorActor;
|
||||
/* 0x0434 */ s8 getItemId;
|
||||
/* 0x0436 */ u16 getItemDirection;
|
||||
/* 0x0438 */ Actor* interactRangeActor;
|
||||
/* 0x043C */ s8 mountSide;
|
||||
/* 0x043D */ char unk_43D[0x003];
|
||||
/* 0x0440 */ Actor* rideActor;
|
||||
/* 0x0444 */ u8 csMode;
|
||||
/* 0x0445 */ u8 prevCsMode;
|
||||
/* 0x0446 */ u8 cueId;
|
||||
/* 0x0447 */ u8 unk_447;
|
||||
/* 0x0448 */ Actor* unk_448;
|
||||
/* 0x044C */ char unk_44C[0x004];
|
||||
/* 0x0450 */ Vec3f unk_450;
|
||||
/* 0x045C */ Vec3f unk_45C;
|
||||
/* 0x0468 */ char unk_468[0x002];
|
||||
/* 0x046A */ s16 doorBgCamIndex;
|
||||
/* 0x046C */ s16 subCamId;
|
||||
/* 0x046E */ char unk_46E[0x02A];
|
||||
/* 0x01AC */ OSMesg giObjectLoadMsg;
|
||||
/* 0x01B0 */ void* giObjectSegment; // also used for title card textures
|
||||
/* 0x01B4 */ SkelAnime skelAnime;
|
||||
/* 0x01F8 */ Vec3s jointTable[PLAYER_LIMB_BUF_COUNT];
|
||||
/* 0x0288 */ Vec3s morphTable[PLAYER_LIMB_BUF_COUNT];
|
||||
/* 0x0318 */ Vec3s blendTable[PLAYER_LIMB_BUF_COUNT];
|
||||
/* 0x03A8 */ s16 unk_3A8[2];
|
||||
/* 0x03AC */ Actor* heldActor;
|
||||
/* 0x03B0 */ Vec3f leftHandPos;
|
||||
/* 0x03BC */ Vec3s unk_3BC;
|
||||
/* 0x03C4 */ Actor* unk_3C4;
|
||||
/* 0x03C8 */ Vec3f unk_3C8;
|
||||
/* 0x03D4 */ char unk_3D4[0x058];
|
||||
/* 0x042C */ s8 doorType;
|
||||
/* 0x042D */ s8 doorDirection;
|
||||
/* 0x042E */ s16 doorTimer;
|
||||
/* 0x0430 */ Actor* doorActor;
|
||||
/* 0x0434 */ s8 getItemId;
|
||||
/* 0x0436 */ u16 getItemDirection;
|
||||
/* 0x0438 */ Actor* interactRangeActor;
|
||||
/* 0x043C */ s8 mountSide;
|
||||
/* 0x043D */ char unk_43D[0x003];
|
||||
/* 0x0440 */ Actor* rideActor;
|
||||
/* 0x0444 */ u8 csMode;
|
||||
/* 0x0445 */ u8 prevCsMode;
|
||||
/* 0x0446 */ u8 cueId;
|
||||
/* 0x0447 */ u8 unk_447;
|
||||
/* 0x0448 */ Actor* unk_448;
|
||||
/* 0x044C */ char unk_44C[0x004];
|
||||
/* 0x0450 */ Vec3f unk_450;
|
||||
/* 0x045C */ Vec3f unk_45C;
|
||||
/* 0x0468 */ char unk_468[0x002];
|
||||
/* 0x046A */ s16 doorBgCamIndex;
|
||||
/* 0x046C */ s16 subCamId;
|
||||
/* 0x046E */ char unk_46E[0x02A];
|
||||
/* 0x0498 */ ColliderCylinder cylinder;
|
||||
/* 0x04E4 */ ColliderQuad meleeWeaponQuads[2];
|
||||
/* 0x05E4 */ ColliderQuad shieldQuad;
|
||||
/* 0x0664 */ Actor* unk_664;
|
||||
/* 0x0668 */ char unk_668[0x004];
|
||||
/* 0x066C */ s32 unk_66C;
|
||||
/* 0x0670 */ s32 meleeWeaponEffectIndex;
|
||||
/* 0x0674 */ PlayerFunc674 func_674;
|
||||
/* 0x0664 */ Actor* unk_664;
|
||||
/* 0x0668 */ char unk_668[0x004];
|
||||
/* 0x066C */ s32 unk_66C;
|
||||
/* 0x0670 */ s32 meleeWeaponEffectIndex;
|
||||
/* 0x0674 */ PlayerActionFunc actionFunc;
|
||||
/* 0x0678 */ PlayerAgeProperties* ageProperties;
|
||||
/* 0x067C */ u32 stateFlags1;
|
||||
/* 0x0680 */ u32 stateFlags2;
|
||||
/* 0x0684 */ Actor* unk_684;
|
||||
/* 0x0688 */ Actor* boomerangActor;
|
||||
/* 0x068C */ Actor* naviActor;
|
||||
/* 0x0690 */ s16 naviTextId;
|
||||
/* 0x0692 */ u8 stateFlags3;
|
||||
/* 0x0693 */ s8 exchangeItemId;
|
||||
/* 0x0694 */ Actor* targetActor;
|
||||
/* 0x0698 */ f32 targetActorDistance;
|
||||
/* 0x069C */ char unk_69C[0x004];
|
||||
/* 0x06A0 */ f32 unk_6A0;
|
||||
/* 0x06A4 */ f32 closestSecretDistSq;
|
||||
/* 0x06A8 */ Actor* unk_6A8;
|
||||
/* 0x06AC */ s8 unk_6AC;
|
||||
/* 0x06AD */ u8 unk_6AD;
|
||||
/* 0x06AE */ u16 unk_6AE;
|
||||
/* 0x06B0 */ s16 unk_6B0;
|
||||
/* 0x06B2 */ char unk_6B4[0x004];
|
||||
/* 0x06B6 */ s16 unk_6B6;
|
||||
/* 0x06B8 */ s16 unk_6B8;
|
||||
/* 0x06BA */ s16 unk_6BA;
|
||||
/* 0x06BC */ s16 unk_6BC;
|
||||
/* 0x06BE */ s16 unk_6BE;
|
||||
/* 0x06C0 */ s16 unk_6C0;
|
||||
/* 0x06C2 */ s16 unk_6C2;
|
||||
/* 0x06C4 */ f32 unk_6C4;
|
||||
/* 0x06C8 */ SkelAnime skelAnime2;
|
||||
/* 0x070C */ Vec3s jointTable2[PLAYER_LIMB_BUF_COUNT];
|
||||
/* 0x079C */ Vec3s morphTable2[PLAYER_LIMB_BUF_COUNT];
|
||||
/* 0x082C */ PlayerFunc82C func_82C;
|
||||
/* 0x0830 */ f32 unk_830;
|
||||
/* 0x0834 */ s16 unk_834;
|
||||
/* 0x0836 */ s8 unk_836;
|
||||
/* 0x0837 */ u8 unk_837;
|
||||
/* 0x0838 */ f32 speedXZ; // Controls horizontal speed, used for `actor.speed`. Current or target value depending on context.
|
||||
/* 0x083C */ s16 yaw; // General yaw value, used both for world and shape rotation. Current or target value depending on context.
|
||||
/* 0x083E */ s16 zTargetYaw; // yaw relating to Z targeting/"parallel" mode
|
||||
/* 0x0840 */ u16 underwaterTimer;
|
||||
/* 0x0842 */ s8 meleeWeaponAnimation;
|
||||
/* 0x0843 */ s8 meleeWeaponState;
|
||||
/* 0x0844 */ s8 unk_844;
|
||||
/* 0x0845 */ u8 unk_845;
|
||||
/* 0x0846 */ u8 unk_846;
|
||||
/* 0x0847 */ s8 unk_847[4];
|
||||
/* 0x084B */ s8 unk_84B[4];
|
||||
/* 0x084F */ s8 unk_84F;
|
||||
/* 0x0850 */ s16 unk_850; // multipurpose timer
|
||||
/* 0x0854 */ f32 unk_854;
|
||||
/* 0x0858 */ f32 unk_858;
|
||||
/* 0x085C */ f32 unk_85C; // stick length among other things
|
||||
/* 0x0860 */ s16 unk_860; // stick flame timer among other things
|
||||
/* 0x0862 */ s8 unk_862; // get item draw ID + 1
|
||||
/* 0x0864 */ f32 unk_864;
|
||||
/* 0x0868 */ f32 unk_868;
|
||||
/* 0x086C */ f32 unk_86C;
|
||||
/* 0x0870 */ f32 unk_870;
|
||||
/* 0x0874 */ f32 unk_874;
|
||||
/* 0x0878 */ f32 unk_878;
|
||||
/* 0x087C */ s16 unk_87C;
|
||||
/* 0x087E */ s16 unk_87E;
|
||||
/* 0x0880 */ f32 unk_880;
|
||||
/* 0x0884 */ f32 wallHeight; // height used to determine whether link can climb or grab a ledge at the top
|
||||
/* 0x0888 */ f32 wallDistance; // distance to the colliding wall plane
|
||||
/* 0x088C */ u8 unk_88C;
|
||||
/* 0x088D */ u8 unk_88D;
|
||||
/* 0x088E */ u8 unk_88E;
|
||||
/* 0x088F */ u8 unk_88F;
|
||||
/* 0x0890 */ u8 unk_890;
|
||||
/* 0x0891 */ u8 shockTimer;
|
||||
/* 0x0892 */ u8 unk_892;
|
||||
/* 0x0893 */ u8 hoverBootsTimer;
|
||||
/* 0x0894 */ s16 fallStartHeight; // last truncated Y position before falling
|
||||
/* 0x0896 */ s16 fallDistance; // truncated Y distance the player has fallen so far (positive is down)
|
||||
/* 0x0898 */ s16 unk_898;
|
||||
/* 0x089A */ s16 unk_89A;
|
||||
/* 0x089C */ s16 unk_89C;
|
||||
/* 0x089E */ u16 floorSfxOffset;
|
||||
/* 0x08A0 */ u8 unk_8A0;
|
||||
/* 0x08A1 */ u8 unk_8A1;
|
||||
/* 0x08A2 */ s16 unk_8A2;
|
||||
/* 0x08A4 */ f32 unk_8A4;
|
||||
/* 0x08A8 */ f32 unk_8A8;
|
||||
/* 0x08AC */ f32 pushedSpeed; // Pushing player, examples include water currents, floor conveyors, climbing sloped surfaces
|
||||
/* 0x08B0 */ s16 pushedYaw; // Yaw direction of player being pushed
|
||||
/* 0x067C */ u32 stateFlags1;
|
||||
/* 0x0680 */ u32 stateFlags2;
|
||||
/* 0x0684 */ Actor* unk_684;
|
||||
/* 0x0688 */ Actor* boomerangActor;
|
||||
/* 0x068C */ Actor* naviActor;
|
||||
/* 0x0690 */ s16 naviTextId;
|
||||
/* 0x0692 */ u8 stateFlags3;
|
||||
/* 0x0693 */ s8 exchangeItemId;
|
||||
/* 0x0694 */ Actor* targetActor;
|
||||
/* 0x0698 */ f32 targetActorDistance;
|
||||
/* 0x069C */ char unk_69C[0x004];
|
||||
/* 0x06A0 */ f32 unk_6A0;
|
||||
/* 0x06A4 */ f32 closestSecretDistSq;
|
||||
/* 0x06A8 */ Actor* unk_6A8;
|
||||
/* 0x06AC */ s8 unk_6AC;
|
||||
/* 0x06AD */ u8 unk_6AD;
|
||||
/* 0x06AE */ u16 unk_6AE;
|
||||
/* 0x06B0 */ s16 unk_6B0;
|
||||
/* 0x06B2 */ char unk_6B4[0x004];
|
||||
/* 0x06B6 */ s16 unk_6B6;
|
||||
/* 0x06B8 */ s16 unk_6B8;
|
||||
/* 0x06BA */ s16 unk_6BA;
|
||||
/* 0x06BC */ s16 unk_6BC;
|
||||
/* 0x06BE */ s16 unk_6BE;
|
||||
/* 0x06C0 */ s16 unk_6C0;
|
||||
/* 0x06C2 */ s16 unk_6C2;
|
||||
/* 0x06C4 */ f32 unk_6C4;
|
||||
/* 0x06C8 */ SkelAnime skelAnimeUpper;
|
||||
/* 0x070C */ Vec3s jointTableUpper[PLAYER_LIMB_BUF_COUNT];
|
||||
/* 0x079C */ Vec3s morphTableUpper[PLAYER_LIMB_BUF_COUNT];
|
||||
/* 0x082C */ ItemActionFunc itemActionFunc;
|
||||
/* 0x0830 */ f32 skelAnimeUpperBlendWeight;
|
||||
/* 0x0834 */ s16 unk_834;
|
||||
/* 0x0836 */ s8 unk_836;
|
||||
/* 0x0837 */ u8 unk_837;
|
||||
/* 0x0838 */ f32 speedXZ; // Controls horizontal speed, used for `actor.speed`. Current or target value depending on context.
|
||||
/* 0x083C */ s16 yaw; // General yaw value, used both for world and shape rotation. Current or target value depending on context.
|
||||
/* 0x083E */ s16 zTargetYaw; // yaw relating to Z targeting/"parallel" mode
|
||||
/* 0x0840 */ u16 underwaterTimer;
|
||||
/* 0x0842 */ s8 meleeWeaponAnimation;
|
||||
/* 0x0843 */ s8 meleeWeaponState;
|
||||
/* 0x0844 */ s8 unk_844;
|
||||
/* 0x0845 */ u8 unk_845;
|
||||
/* 0x0846 */ u8 unk_846;
|
||||
/* 0x0847 */ s8 unk_847[4];
|
||||
/* 0x084B */ s8 unk_84B[4];
|
||||
/* 0x084F */ s8 actionVar1; // context dependent variable that has different meanings depending on what action is currently running
|
||||
/* 0x0850 */ s16 actionVar2; // context dependent variable that has different meanings depending on what action is currently running
|
||||
/* 0x0854 */ f32 unk_854;
|
||||
/* 0x0858 */ f32 unk_858;
|
||||
/* 0x085C */ f32 unk_85C; // stick length among other things
|
||||
/* 0x0860 */ s16 unk_860; // stick flame timer among other things
|
||||
/* 0x0862 */ s8 unk_862; // get item draw ID + 1
|
||||
/* 0x0864 */ f32 unk_864;
|
||||
/* 0x0868 */ f32 unk_868;
|
||||
/* 0x086C */ f32 unk_86C;
|
||||
/* 0x0870 */ f32 unk_870;
|
||||
/* 0x0874 */ f32 unk_874;
|
||||
/* 0x0878 */ f32 unk_878;
|
||||
/* 0x087C */ s16 unk_87C;
|
||||
/* 0x087E */ s16 unk_87E;
|
||||
/* 0x0880 */ f32 unk_880;
|
||||
/* 0x0884 */ f32 yDistToLedge; // y distance to ground above an interact wall. LEDGE_DIST_MAX if no ground is found
|
||||
/* 0x0888 */ f32 distToInteractWall; // xyz distance to the interact wall
|
||||
/* 0x088C */ u8 ledgeClimbType;
|
||||
/* 0x088D */ u8 ledgeClimbDelayTimer;
|
||||
/* 0x088E */ u8 unk_88E;
|
||||
/* 0x088F */ u8 unk_88F;
|
||||
/* 0x0890 */ u8 unk_890;
|
||||
/* 0x0891 */ u8 shockTimer;
|
||||
/* 0x0892 */ u8 unk_892;
|
||||
/* 0x0893 */ u8 hoverBootsTimer;
|
||||
/* 0x0894 */ s16 fallStartHeight; // last truncated Y position before falling
|
||||
/* 0x0896 */ s16 fallDistance; // truncated Y distance the player has fallen so far (positive is down)
|
||||
/* 0x0898 */ s16 floorPitch; // angle of the floor slope in the direction of current world yaw (positive for ascending slope)
|
||||
/* 0x089A */ s16 floorPitchAlt; // the calculation for this value is bugged and doesn't represent anything meaningful
|
||||
/* 0x089C */ s16 unk_89C;
|
||||
/* 0x089E */ u16 floorSfxOffset;
|
||||
/* 0x08A0 */ u8 unk_8A0;
|
||||
/* 0x08A1 */ u8 unk_8A1;
|
||||
/* 0x08A2 */ s16 unk_8A2;
|
||||
/* 0x08A4 */ f32 unk_8A4;
|
||||
/* 0x08A8 */ f32 unk_8A8;
|
||||
/* 0x08AC */ f32 pushedSpeed; // Pushing player, examples include water currents, floor conveyors, climbing sloped surfaces
|
||||
/* 0x08B0 */ s16 pushedYaw; // Yaw direction of player being pushed
|
||||
/* 0x08B4 */ WeaponInfo meleeWeaponInfo[3];
|
||||
/* 0x0908 */ Vec3f bodyPartsPos[PLAYER_BODYPART_MAX];
|
||||
/* 0x09E0 */ MtxF mf_9E0;
|
||||
/* 0x0A20 */ MtxF shieldMf;
|
||||
/* 0x0A60 */ u8 isBurning;
|
||||
/* 0x0A61 */ u8 flameTimers[PLAYER_BODYPART_MAX]; // one flame per body part
|
||||
/* 0x0A73 */ u8 unk_A73;
|
||||
/* 0x0908 */ Vec3f bodyPartsPos[PLAYER_BODYPART_MAX];
|
||||
/* 0x09E0 */ MtxF mf_9E0;
|
||||
/* 0x0A20 */ MtxF shieldMf;
|
||||
/* 0x0A60 */ u8 isBurning;
|
||||
/* 0x0A61 */ u8 flameTimers[PLAYER_BODYPART_MAX]; // one flame per body part
|
||||
/* 0x0A73 */ u8 unk_A73;
|
||||
/* 0x0A74 */ PlayerFuncA74 func_A74;
|
||||
/* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame)
|
||||
/* 0x0A79 */ u8 unk_A79;
|
||||
/* 0x0A7A */ u8 unk_A7A;
|
||||
/* 0x0A7B */ u8 unk_A7B;
|
||||
/* 0x0A7C */ f32 unk_A7C;
|
||||
/* 0x0A80 */ s16 unk_A80;
|
||||
/* 0x0A82 */ u16 prevFloorSfxOffset;
|
||||
/* 0x0A84 */ s16 unk_A84;
|
||||
/* 0x0A86 */ s8 unk_A86;
|
||||
/* 0x0A87 */ u8 unk_A87;
|
||||
/* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position
|
||||
/* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame)
|
||||
/* 0x0A79 */ u8 floorTypeTimer; // counts up every frame the current floor type is the same as the last frame
|
||||
/* 0x0A7A */ u8 floorProperty;
|
||||
/* 0x0A7B */ u8 prevFloorType;
|
||||
/* 0x0A7C */ f32 prevControlStickMagnitude;
|
||||
/* 0x0A80 */ s16 prevControlStickAngle;
|
||||
/* 0x0A82 */ u16 prevFloorSfxOffset;
|
||||
/* 0x0A84 */ s16 unk_A84;
|
||||
/* 0x0A86 */ s8 unk_A86;
|
||||
/* 0x0A87 */ u8 unk_A87;
|
||||
/* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position
|
||||
} Player; // size = 0xA94
|
||||
|
||||
#endif
|
||||
|
|
|
@ -606,7 +606,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
|
||||
|
@ -776,8 +776,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
|
||||
|
|
87
include/z64vis.h
Normal file
87
include/z64vis.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
#ifndef Z64_VIS_H
|
||||
#define Z64_VIS_H
|
||||
|
||||
#include "ultra64.h"
|
||||
#include "color.h"
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ FB_FILTER_NONE,
|
||||
/* 1 */ FB_FILTER_CVG_RGB,
|
||||
/* 2 */ FB_FILTER_CVG_RGB_UNIFORM,
|
||||
/* 3 */ FB_FILTER_CVG_ONLY,
|
||||
/* 4 */ FB_FILTER_CVG_RGB_FOG, // Not recommended, easily overflows blender
|
||||
/* 5 */ FB_FILTER_ZBUF_IA,
|
||||
/* 6 */ FB_FILTER_ZBUF_RGBA,
|
||||
/* 7 */ FB_FILTER_MONO
|
||||
} FramebufferFilterType;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ VIS_NO_SETSCISSOR,
|
||||
/* 1 */ VIS_SETSCISSOR
|
||||
} VisScissorType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 type;
|
||||
/* 0x04 */ u32 scissorType;
|
||||
/* 0x08 */ Color_RGBA8_u32 primColor;
|
||||
/* 0x0C */ Color_RGBA8_u32 envColor;
|
||||
} Vis; // size = 0x10
|
||||
|
||||
|
||||
|
||||
/* Cvg: Coverage */
|
||||
|
||||
#define FB_FILTER_TO_CVG_TYPE(filter) (filter)
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ VIS_CVG_TYPE_NONE = FB_FILTER_TO_CVG_TYPE(FB_FILTER_NONE),
|
||||
/* 1 */ VIS_CVG_TYPE_CVG_RGB = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB),
|
||||
/* 2 */ VIS_CVG_TYPE_CVG_RGB_UNIFORM = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_UNIFORM),
|
||||
/* 3 */ VIS_CVG_TYPE_CVG_ONLY = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_ONLY),
|
||||
/* 4 */ VIS_CVG_TYPE_CVG_RGB_FOG = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_FOG)
|
||||
} VisCvgType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vis vis;
|
||||
} VisCvg; // size = 0x10
|
||||
|
||||
void VisCvg_Init(VisCvg* this);
|
||||
void VisCvg_Destroy(VisCvg* this);
|
||||
void VisCvg_Draw(VisCvg* this, Gfx** gfxP);
|
||||
|
||||
|
||||
|
||||
/* Mono: Desaturation */
|
||||
|
||||
// Only one type
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vis vis;
|
||||
/* 0x10 */ u16* tlut;
|
||||
/* 0x14 */ Gfx* dList;
|
||||
} VisMono; // size = 0x18
|
||||
|
||||
void VisMono_Init(VisMono* this);
|
||||
void VisMono_Destroy(VisMono* this);
|
||||
void VisMono_Draw(VisMono* this, Gfx** gfxP);
|
||||
|
||||
|
||||
|
||||
/* ZBuf: Z-Buffer */
|
||||
|
||||
#define FB_FILTER_TO_ZBUF_TYPE(filter) ((filter) - FB_FILTER_ZBUF_IA)
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ VIS_ZBUF_TYPE_IA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_IA),
|
||||
/* 1 */ VIS_ZBUF_TYPE_RGBA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_RGBA)
|
||||
} VisZBufType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vis vis;
|
||||
} VisZBuf; // size = 0x10
|
||||
|
||||
void VisZBuf_Init(VisZBuf* this);
|
||||
void VisZBuf_Destroy(VisZBuf* this);
|
||||
void VisZBuf_Draw(VisZBuf* this, Gfx** gfxP);
|
||||
|
||||
#endif
|
4
spec
4
spec
|
@ -366,9 +366,9 @@ beginseg
|
|||
include "build/data/unk_8012ABC0.data.o"
|
||||
include "build/src/code/z_view.o"
|
||||
include "build/src/code/z_vimode.o"
|
||||
include "build/src/code/code_800ACE70.o"
|
||||
include "build/src/code/z_viscvg.o"
|
||||
include "build/src/code/z_vismono.o"
|
||||
include "build/src/code/code_800AD920.o"
|
||||
include "build/src/code/z_viszbuf.o"
|
||||
include "build/src/code/z_vr_box.o"
|
||||
include "build/src/code/z_vr_box_draw.o"
|
||||
include "build/src/code/z_player_call.o"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "global.h"
|
||||
|
||||
void __assert(const char* exp, const char* file, s32 line) {
|
||||
NORETURN void __assert(const char* exp, const char* file, s32 line) {
|
||||
char msg[256];
|
||||
|
||||
osSyncPrintf("Assertion failed: %s, file %s, line %d, thread %d\n", exp, file, line, osGetThreadId(NULL));
|
||||
|
|
|
@ -86,7 +86,7 @@ void* is_proutSyncPrintf(void* arg, const char* str, u32 count) {
|
|||
return (void*)1;
|
||||
}
|
||||
|
||||
void func_80002384(const char* exp, const char* file, u32 line) {
|
||||
NORETURN void func_80002384(const char* exp, const char* file, u32 line) {
|
||||
osSyncPrintf("File:%s Line:%d %s \n", file, line, exp);
|
||||
while (true) {
|
||||
;
|
||||
|
|
|
@ -231,7 +231,7 @@ void DmaMgr_DmaFromDriveRom(void* ram, uintptr_t rom, size_t size) {
|
|||
*
|
||||
* This function does not return.
|
||||
*/
|
||||
void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc) {
|
||||
NORETURN void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc) {
|
||||
uintptr_t vrom = req->vromAddr;
|
||||
void* ram = req->dramAddr;
|
||||
size_t size = req->size;
|
||||
|
|
|
@ -43,19 +43,19 @@ void PreRender_Destroy(PreRender* this) {
|
|||
/**
|
||||
* Copies RGBA16 image `img` to `imgDst`
|
||||
*
|
||||
* @param gfxp Display list pointer
|
||||
* @param gfxP Display list pointer
|
||||
* @param img Image to copy from
|
||||
* @param imgDst Buffer to copy to
|
||||
*/
|
||||
void PreRender_CopyImage(PreRender* this, Gfx** gfxp, void* img, void* imgDst) {
|
||||
void PreRender_CopyImage(PreRender* this, Gfx** gfxP, void* img, void* imgDst) {
|
||||
Gfx* gfx;
|
||||
s32 rowsRemaining;
|
||||
s32 curRow;
|
||||
s32 nRows;
|
||||
|
||||
LogUtils_CheckNullPointer("this", this, "../PreRender.c", 215);
|
||||
LogUtils_CheckNullPointer("glistpp", gfxp, "../PreRender.c", 216);
|
||||
gfx = *gfxp;
|
||||
LogUtils_CheckNullPointer("glistpp", gfxP, "../PreRender.c", 216);
|
||||
gfx = *gfxP;
|
||||
LogUtils_CheckNullPointer("glistp", gfx, "../PreRender.c", 218);
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
|
@ -101,22 +101,22 @@ void PreRender_CopyImage(PreRender* this, Gfx** gfxp, void* img, void* imgDst) {
|
|||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf);
|
||||
*gfxp = gfx;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies part of `this->fbufSave` in the region (this->ulx, this->uly), (this->lrx, this->lry) to the same location in
|
||||
* `this->fbuf`.
|
||||
*/
|
||||
void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxp) {
|
||||
void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) {
|
||||
Gfx* gfx;
|
||||
s32 rowsRemaining;
|
||||
s32 curRow;
|
||||
s32 nRows;
|
||||
|
||||
LogUtils_CheckNullPointer("this", this, "../PreRender.c", 278);
|
||||
LogUtils_CheckNullPointer("glistpp", gfxp, "../PreRender.c", 279);
|
||||
gfx = *gfxp;
|
||||
LogUtils_CheckNullPointer("glistpp", gfxP, "../PreRender.c", 279);
|
||||
gfx = *gfxP;
|
||||
LogUtils_CheckNullPointer("glistp", gfx, "../PreRender.c", 281);
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
|
@ -164,22 +164,22 @@ void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxp) {
|
|||
gDPPipeSync(gfx++);
|
||||
gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf);
|
||||
gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, this->width, this->height);
|
||||
*gfxp = gfx;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies `buf` to `bufSave`, discarding the alpha channel and modulating the RGB channel by
|
||||
* the color ('r', 'g', 'b', 'a')
|
||||
*/
|
||||
void func_800C170C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a) {
|
||||
void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a) {
|
||||
Gfx* gfx;
|
||||
s32 rowsRemaining;
|
||||
s32 curRow;
|
||||
s32 nRows;
|
||||
|
||||
LogUtils_CheckNullPointer("this", this, "../PreRender.c", 343);
|
||||
LogUtils_CheckNullPointer("glistpp", gfxp, "../PreRender.c", 344);
|
||||
gfx = *gfxp;
|
||||
LogUtils_CheckNullPointer("glistpp", gfxP, "../PreRender.c", 344);
|
||||
gfx = *gfxP;
|
||||
LogUtils_CheckNullPointer("glistp", gfx, "../PreRender.c", 346);
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
|
@ -232,33 +232,33 @@ void func_800C170C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 r,
|
|||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf);
|
||||
*gfxp = gfx;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies `fbuf` to `fbufSave`, discarding the alpha channel and leaving the rgb channel unchanged
|
||||
*/
|
||||
void func_800C1AE8(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave) {
|
||||
func_800C170C(this, gfxp, fbuf, fbufSave, 255, 255, 255, 255);
|
||||
void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave) {
|
||||
func_800C170C(this, gfxP, fbuf, fbufSave, 255, 255, 255, 255);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the coverage values stored in the RGBA16 format `img` with dimensions `this->width`, `this->height` and
|
||||
* converts it to an 8-bpp intensity image.
|
||||
*
|
||||
* @param gfxp Display list pointer
|
||||
* @param gfxP Display list pointer
|
||||
* @param img Image to read coverage from
|
||||
* @param cvgDst Buffer to store coverage into
|
||||
*/
|
||||
void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxp, void* img, void* cvgDst) {
|
||||
void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxP, void* img, void* cvgDst) {
|
||||
Gfx* gfx;
|
||||
s32 rowsRemaining;
|
||||
s32 curRow;
|
||||
s32 nRows;
|
||||
|
||||
LogUtils_CheckNullPointer("this", this, "../PreRender.c", 422);
|
||||
LogUtils_CheckNullPointer("glistpp", gfxp, "../PreRender.c", 423);
|
||||
gfx = *gfxp;
|
||||
LogUtils_CheckNullPointer("glistpp", gfxP, "../PreRender.c", 423);
|
||||
gfx = *gfxP;
|
||||
LogUtils_CheckNullPointer("glistp", gfx, "../PreRender.c", 425);
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
|
@ -326,30 +326,30 @@ void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxp, void* img, void*
|
|||
// Reset the color image to the current framebuffer
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf);
|
||||
*gfxp = gfx;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves zbuf to zbufSave
|
||||
*/
|
||||
void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxp) {
|
||||
void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP) {
|
||||
LogUtils_CheckNullPointer("this->zbuf_save", this->zbufSave, "../PreRender.c", 481);
|
||||
LogUtils_CheckNullPointer("this->zbuf", this->zbuf, "../PreRender.c", 482);
|
||||
|
||||
if ((this->zbufSave != NULL) && (this->zbuf != NULL)) {
|
||||
PreRender_CopyImage(this, gfxp, this->zbuf, this->zbufSave);
|
||||
PreRender_CopyImage(this, gfxP, this->zbuf, this->zbufSave);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves fbuf to fbufSave
|
||||
*/
|
||||
void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp) {
|
||||
void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP) {
|
||||
LogUtils_CheckNullPointer("this->fbuf_save", this->fbufSave, "../PreRender.c", 495);
|
||||
LogUtils_CheckNullPointer("this->fbuf", this->fbuf, "../PreRender.c", 496);
|
||||
|
||||
if ((this->fbufSave != NULL) && (this->fbuf != NULL)) {
|
||||
func_800C1AE8(this, gfxp, this->fbuf, this->fbufSave);
|
||||
func_800C1AE8(this, gfxP, this->fbuf, this->fbufSave);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,8 +357,8 @@ void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp) {
|
|||
* Fetches the coverage of the current framebuffer into an image of the same format as the current color image, storing
|
||||
* it over the framebuffer in memory.
|
||||
*/
|
||||
void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
// Set the blend color to full white and set maximum depth.
|
||||
|
@ -392,33 +392,33 @@ void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxp) {
|
|||
gDPFillRectangle(gfx++, 0, 0, this->width, this->height);
|
||||
gDPPipeSync(gfx++);
|
||||
|
||||
*gfxp = gfx;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the coverage of the current framebuffer `this->fbuf` to an I8 image at `this->cvgSave`. Overwrites
|
||||
* `this->fbuf` in the process.
|
||||
*/
|
||||
void PreRender_DrawCoverage(PreRender* this, Gfx** gfxp) {
|
||||
PreRender_FetchFbufCoverage(this, gfxp);
|
||||
void PreRender_DrawCoverage(PreRender* this, Gfx** gfxP) {
|
||||
PreRender_FetchFbufCoverage(this, gfxP);
|
||||
LogUtils_CheckNullPointer("this->cvg_save", this->cvgSave, "../PreRender.c", 532);
|
||||
if (this->cvgSave != NULL) {
|
||||
PreRender_CoverageRgba16ToI8(this, gfxp, this->fbuf, this->cvgSave);
|
||||
PreRender_CoverageRgba16ToI8(this, gfxP, this->fbuf, this->cvgSave);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores zbufSave to zbuf
|
||||
*/
|
||||
void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxp) {
|
||||
PreRender_CopyImage(this, gfxp, this->zbufSave, this->zbuf);
|
||||
void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP) {
|
||||
PreRender_CopyImage(this, gfxP, this->zbufSave, this->zbuf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a full-screen image to the current framebuffer, that sources the rgb channel from `this->fbufSave` and
|
||||
* the alpha channel from `this->cvgSave` modulated by environment color.
|
||||
*/
|
||||
void func_800C213C(PreRender* this, Gfx** gfxp) {
|
||||
void func_800C213C(PreRender* this, Gfx** gfxP) {
|
||||
Gfx* gfx;
|
||||
s32 rowsRemaining;
|
||||
s32 curRow;
|
||||
|
@ -427,8 +427,8 @@ void func_800C213C(PreRender* this, Gfx** gfxp) {
|
|||
|
||||
if (this->cvgSave != NULL) {
|
||||
LogUtils_CheckNullPointer("this", this, "../PreRender.c", 563);
|
||||
LogUtils_CheckNullPointer("glistpp", gfxp, "../PreRender.c", 564);
|
||||
gfx = *gfxp;
|
||||
LogUtils_CheckNullPointer("glistpp", gfxP, "../PreRender.c", 564);
|
||||
gfx = *gfxP;
|
||||
LogUtils_CheckNullPointer("glistp", gfx, "../PreRender.c", 566);
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
|
@ -482,23 +482,23 @@ void func_800C213C(PreRender* this, Gfx** gfxp) {
|
|||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
*gfxp = gfx;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies fbufSave to fbuf
|
||||
*/
|
||||
void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxp) {
|
||||
PreRender_CopyImage(this, gfxp, this->fbufSave, this->fbuf);
|
||||
void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP) {
|
||||
PreRender_CopyImage(this, gfxP, this->fbufSave, this->fbuf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies part of `this->fbufSave` in the region (this->ulx, this->uly), (this->lrx, this->lry) to the same location in
|
||||
* `this->fbuf`.
|
||||
*/
|
||||
void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxp) {
|
||||
PreRender_CopyImageRegionImpl(this, gfxp);
|
||||
void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP) {
|
||||
PreRender_CopyImageRegionImpl(this, gfxP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
#include "global.h"
|
||||
|
||||
// Note : This file is related to z_vismono, the original name was probably z_vis<something before "mono"
|
||||
// alphabetically>
|
||||
|
||||
Gfx D_8012AC00[] = {
|
||||
gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2),
|
||||
gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1),
|
||||
gsDPPipeSync(),
|
||||
gsDPSetBlendColor(0, 0, 0, 8),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
Gfx D_8012AC28[] = {
|
||||
gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL |
|
||||
GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM) |
|
||||
GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)),
|
||||
gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
Gfx D_8012AC40[] = {
|
||||
gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL |
|
||||
GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) |
|
||||
GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)),
|
||||
|
||||
gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
Gfx D_8012AC58[] = {
|
||||
gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE),
|
||||
gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2),
|
||||
gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1),
|
||||
gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL |
|
||||
GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) |
|
||||
GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)),
|
||||
gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
// Init
|
||||
void func_800ACE70(struct_801664F0* this) {
|
||||
this->type = 0;
|
||||
this->setScissor = false;
|
||||
this->color.r = 255;
|
||||
this->color.g = 255;
|
||||
this->color.b = 255;
|
||||
this->color.a = 255;
|
||||
}
|
||||
|
||||
// Destroy
|
||||
void func_800ACE90(struct_801664F0* this) {
|
||||
}
|
||||
|
||||
// Draw
|
||||
void func_800ACE98(struct_801664F0* this, Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetPrimDepth(gfx++, 0xFFFF, 0xFFFF);
|
||||
|
||||
if (this->setScissor == true) {
|
||||
gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
switch (this->type) {
|
||||
case 1:
|
||||
gSPDisplayList(gfx++, D_8012AC40);
|
||||
break;
|
||||
case 2:
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba);
|
||||
gSPDisplayList(gfx++, D_8012AC58);
|
||||
break;
|
||||
case 3:
|
||||
gDPSetColor(gfx++, G_SETBLENDCOLOR, this->color.rgba);
|
||||
gSPDisplayList(gfx++, D_8012AC00);
|
||||
break;
|
||||
case 4:
|
||||
gDPSetColor(gfx++, G_SETFOGCOLOR, this->color.rgba);
|
||||
gSPDisplayList(gfx++, D_8012AC28);
|
||||
break;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
*gfxp = gfx;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
#include "global.h"
|
||||
|
||||
// Note : This file is related to z_vismono, the original name was probably z_vis<something after "mono" alphabetically>
|
||||
|
||||
// z-buffer
|
||||
extern u16 D_0E000000[];
|
||||
|
||||
// Init
|
||||
void func_800AD920(struct_80166500* this) {
|
||||
this->useRgba = false;
|
||||
this->setScissor = false;
|
||||
this->primColor.r = 255;
|
||||
this->primColor.g = 255;
|
||||
this->primColor.b = 255;
|
||||
this->primColor.a = 255;
|
||||
this->envColor.a = 255;
|
||||
this->envColor.r = 0;
|
||||
this->envColor.g = 0;
|
||||
this->envColor.b = 0;
|
||||
}
|
||||
|
||||
// Destroy
|
||||
void func_800AD950(struct_80166500* this) {
|
||||
}
|
||||
|
||||
// Draw
|
||||
void func_800AD958(struct_80166500* this, Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
u16* tex = D_0E000000;
|
||||
s32 fmt = !this->useRgba ? G_IM_FMT_IA : G_IM_FMT_RGBA;
|
||||
s32 y;
|
||||
s32 height = 6;
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
if (this->setScissor == true) {
|
||||
gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
gDPSetOtherMode(gfx++,
|
||||
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | G_RM_OPA_SURF | G_RM_OPA_SURF2);
|
||||
gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT,
|
||||
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT);
|
||||
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba);
|
||||
|
||||
for (y = 0; y <= SCREEN_HEIGHT - height; y += height) {
|
||||
gDPLoadTextureBlock(gfx++, tex, fmt, G_IM_SIZ_16b, SCREEN_WIDTH, height, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
gSPTextureRectangle(gfx++, 0, y << 2, SCREEN_WIDTH << 2, (y + height) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10,
|
||||
1 << 10);
|
||||
tex += SCREEN_WIDTH * height;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
*gfxp = gfx;
|
||||
}
|
|
@ -61,7 +61,7 @@ s32 func_800BB2B4(Vec3f* pos, f32* roll, f32* fov, CutsceneCameraPoint* point, s
|
|||
}
|
||||
*curFrame += advance;
|
||||
if (*curFrame >= 1) {
|
||||
if (point[++*keyFrame + 3].continueFlag == CS_CMD_STOP) {
|
||||
if (point[++*keyFrame + 3].continueFlag == CS_CAM_STOP) {
|
||||
*keyFrame = 0;
|
||||
ret = true;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
u32 gIsCtrlr2Valid = false;
|
||||
|
||||
void func_800D31A0(void) {
|
||||
NORETURN void func_800D31A0(void) {
|
||||
osSyncPrintf(VT_FGCOL(RED) "\n**** Freeze!! ****\n" VT_RST);
|
||||
while (true) {
|
||||
Sleep_Msec(1000);
|
||||
|
|
|
@ -1304,19 +1304,25 @@ void Fault_HungupFaultClient(const char* exp1, const char* exp2) {
|
|||
* error occurs. The parameters specify two messages detailing the error, one
|
||||
* or both may be NULL.
|
||||
*/
|
||||
void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) {
|
||||
NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) {
|
||||
FaultClient client;
|
||||
s32 pad;
|
||||
|
||||
Fault_AddClient(&client, Fault_HungupFaultClient, (void*)exp1, (void*)exp2);
|
||||
*(u32*)0x11111111 = 0; // trigger an exception via unaligned memory access
|
||||
|
||||
// Since the above line triggers an exception and transfers execution to the fault handler
|
||||
// this function does not return and the rest of the function is unreachable.
|
||||
#ifdef __GNUC__
|
||||
__builtin_unreachable();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Like `Fault_AddHungupAndCrashImpl`, however provides a fixed message containing
|
||||
* filename and line number
|
||||
*/
|
||||
void Fault_AddHungupAndCrash(const char* file, s32 line) {
|
||||
NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line) {
|
||||
char msg[256];
|
||||
|
||||
sprintf(msg, "HungUp %s:%d", file, line);
|
||||
|
|
101
src/code/game.c
101
src/code/game.c
|
@ -2,9 +2,9 @@
|
|||
#include "terminal.h"
|
||||
|
||||
SpeedMeter D_801664D0;
|
||||
struct_801664F0 D_801664F0;
|
||||
struct_80166500 D_80166500;
|
||||
VisMono sMonoColors;
|
||||
VisCvg sVisCvg;
|
||||
VisZBuf sVisZBuf;
|
||||
VisMono sVisMono;
|
||||
ViMode sViMode;
|
||||
FaultClient sGameFaultClient;
|
||||
u16 sLastButtonPressed;
|
||||
|
@ -22,40 +22,43 @@ void GameState_FaultPrint(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void GameState_SetFBFilter(Gfx** gfx) {
|
||||
Gfx* gfxP = *gfx;
|
||||
void GameState_SetFBFilter(Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
|
||||
if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) {
|
||||
D_801664F0.type = R_FB_FILTER_TYPE;
|
||||
D_801664F0.color.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
D_801664F0.color.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
D_801664F0.color.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
D_801664F0.color.a = R_FB_FILTER_A;
|
||||
func_800ACE98(&D_801664F0, &gfxP);
|
||||
} else if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) {
|
||||
D_80166500.useRgba = (R_FB_FILTER_TYPE == 6);
|
||||
D_80166500.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
D_80166500.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
D_80166500.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
D_80166500.primColor.a = R_FB_FILTER_A;
|
||||
D_80166500.envColor.r = R_FB_FILTER_ENV_COLOR(0);
|
||||
D_80166500.envColor.g = R_FB_FILTER_ENV_COLOR(1);
|
||||
D_80166500.envColor.b = R_FB_FILTER_ENV_COLOR(2);
|
||||
D_80166500.envColor.a = R_FB_FILTER_A;
|
||||
func_800AD958(&D_80166500, &gfxP);
|
||||
} else if (R_FB_FILTER_TYPE == 7) {
|
||||
sMonoColors.unk_00 = 0;
|
||||
sMonoColors.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
sMonoColors.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
sMonoColors.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
sMonoColors.primColor.a = R_FB_FILTER_A;
|
||||
sMonoColors.envColor.r = R_FB_FILTER_ENV_COLOR(0);
|
||||
sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1);
|
||||
sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2);
|
||||
sMonoColors.envColor.a = R_FB_FILTER_A;
|
||||
VisMono_Draw(&sMonoColors, &gfxP);
|
||||
if ((R_FB_FILTER_TYPE >= FB_FILTER_CVG_RGB) && (R_FB_FILTER_TYPE <= FB_FILTER_CVG_RGB_FOG)) {
|
||||
// Visualize coverage
|
||||
sVisCvg.vis.type = FB_FILTER_TO_CVG_TYPE(R_FB_FILTER_TYPE);
|
||||
sVisCvg.vis.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
sVisCvg.vis.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
sVisCvg.vis.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
sVisCvg.vis.primColor.a = R_FB_FILTER_A;
|
||||
VisCvg_Draw(&sVisCvg, &gfx);
|
||||
} else if ((R_FB_FILTER_TYPE == FB_FILTER_ZBUF_IA) || (R_FB_FILTER_TYPE == FB_FILTER_ZBUF_RGBA)) {
|
||||
// Visualize z-buffer
|
||||
sVisZBuf.vis.type = (R_FB_FILTER_TYPE == FB_FILTER_ZBUF_RGBA);
|
||||
sVisZBuf.vis.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
sVisZBuf.vis.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
sVisZBuf.vis.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
sVisZBuf.vis.primColor.a = R_FB_FILTER_A;
|
||||
sVisZBuf.vis.envColor.r = R_FB_FILTER_ENV_COLOR(0);
|
||||
sVisZBuf.vis.envColor.g = R_FB_FILTER_ENV_COLOR(1);
|
||||
sVisZBuf.vis.envColor.b = R_FB_FILTER_ENV_COLOR(2);
|
||||
sVisZBuf.vis.envColor.a = R_FB_FILTER_A;
|
||||
VisZBuf_Draw(&sVisZBuf, &gfx);
|
||||
} else if (R_FB_FILTER_TYPE == FB_FILTER_MONO) {
|
||||
// Monochrome filter
|
||||
sVisMono.vis.type = 0;
|
||||
sVisMono.vis.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
sVisMono.vis.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
sVisMono.vis.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
sVisMono.vis.primColor.a = R_FB_FILTER_A;
|
||||
sVisMono.vis.envColor.r = R_FB_FILTER_ENV_COLOR(0);
|
||||
sVisMono.vis.envColor.g = R_FB_FILTER_ENV_COLOR(1);
|
||||
sVisMono.vis.envColor.b = R_FB_FILTER_ENV_COLOR(2);
|
||||
sVisMono.vis.envColor.a = R_FB_FILTER_A;
|
||||
VisMono_Draw(&sVisMono, &gfx);
|
||||
}
|
||||
*gfx = gfxP;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
void func_800C4344(GameState* gameState) {
|
||||
|
@ -110,7 +113,7 @@ void func_800C4344(GameState* gameState) {
|
|||
}
|
||||
}
|
||||
|
||||
void GameState_DrawInputDisplay(u16 input, Gfx** gfx) {
|
||||
void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) {
|
||||
static const u16 sInpDispBtnColors[] = {
|
||||
GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1),
|
||||
GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1),
|
||||
|
@ -120,10 +123,10 @@ void GameState_DrawInputDisplay(u16 input, Gfx** gfx) {
|
|||
GPACK_RGBA5551(0, 0, 255, 1),
|
||||
};
|
||||
s32 i, j, k;
|
||||
Gfx* gfxP = *gfx;
|
||||
Gfx* gfx = *gfxP;
|
||||
|
||||
gDPPipeSync(gfxP++);
|
||||
gDPSetOtherMode(gfxP++,
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetOtherMode(gfx++,
|
||||
G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
|
||||
|
@ -131,14 +134,14 @@ void GameState_DrawInputDisplay(u16 input, Gfx** gfx) {
|
|||
for (i = 0; i < 16; i++) {
|
||||
j = i;
|
||||
if (input & (1 << i)) {
|
||||
gDPSetFillColor(gfxP++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]);
|
||||
gDPSetFillColor(gfx++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]);
|
||||
k = i + 1;
|
||||
gDPFillRectangle(gfxP++, (j * 4) + 226, 220, (k * 4) + 225, 223);
|
||||
gDPPipeSync(gfxP++);
|
||||
gDPFillRectangle(gfx++, (j * 4) + 226, 220, (k * 4) + 225, 223);
|
||||
gDPPipeSync(gfx++);
|
||||
}
|
||||
}
|
||||
|
||||
*gfx = gfxP;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
|
||||
|
@ -413,9 +416,9 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
|||
|
||||
startTime = endTime;
|
||||
LogUtils_CheckNullPointer("this->cleanup", gameState->destroy, "../game.c", 1088);
|
||||
func_800ACE70(&D_801664F0);
|
||||
func_800AD920(&D_80166500);
|
||||
VisMono_Init(&sMonoColors);
|
||||
VisCvg_Init(&sVisCvg);
|
||||
VisZBuf_Init(&sVisZBuf);
|
||||
VisMono_Init(&sVisMono);
|
||||
if (R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) {
|
||||
ViMode_Init(&sViMode);
|
||||
}
|
||||
|
@ -443,9 +446,9 @@ void GameState_Destroy(GameState* gameState) {
|
|||
}
|
||||
Rumble_Destroy();
|
||||
SpeedMeter_Destroy(&D_801664D0);
|
||||
func_800ACE90(&D_801664F0);
|
||||
func_800AD950(&D_80166500);
|
||||
VisMono_Destroy(&sMonoColors);
|
||||
VisCvg_Destroy(&sVisCvg);
|
||||
VisZBuf_Destroy(&sVisZBuf);
|
||||
VisMono_Destroy(&sVisMono);
|
||||
if (R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) {
|
||||
ViMode_Destroy(&sViMode);
|
||||
}
|
||||
|
|
|
@ -513,17 +513,17 @@ Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst) {
|
|||
return dst;
|
||||
}
|
||||
|
||||
void* Graph_DlistAlloc(Gfx** gfx, u32 size) {
|
||||
void* Graph_DlistAlloc(Gfx** gfxP, u32 size) {
|
||||
u8* ptr;
|
||||
Gfx* dst;
|
||||
|
||||
size = ALIGN8(size);
|
||||
|
||||
ptr = (u8*)(*gfx + 1);
|
||||
ptr = (u8*)(*gfxP + 1);
|
||||
|
||||
dst = (Gfx*)(ptr + size);
|
||||
gSPBranchList(*gfx, dst);
|
||||
gSPBranchList(*gfxP, dst);
|
||||
|
||||
*gfx = dst;
|
||||
*gfxP = dst;
|
||||
return ptr;
|
||||
}
|
||||
|
|
|
@ -799,7 +799,7 @@ void Actor_SetScale(Actor* actor, f32 scale) {
|
|||
}
|
||||
|
||||
void Actor_SetObjectDependency(PlayState* play, Actor* actor) {
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[actor->objBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[actor->objectSlot].segment);
|
||||
}
|
||||
|
||||
void Actor_Init(Actor* actor, PlayState* play) {
|
||||
|
@ -818,7 +818,7 @@ void Actor_Init(Actor* actor, PlayState* play) {
|
|||
CollisionCheck_InitInfo(&actor->colChkInfo);
|
||||
actor->floorBgId = BGCHECK_SCENE;
|
||||
ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f);
|
||||
if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, actor->objectSlot)) {
|
||||
Actor_SetObjectDependency(play, actor);
|
||||
actor->init(actor, play);
|
||||
actor->init = NULL;
|
||||
|
@ -2143,13 +2143,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
|
|||
actor->sfx = 0;
|
||||
|
||||
if (actor->init != NULL) {
|
||||
if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, actor->objectSlot)) {
|
||||
Actor_SetObjectDependency(play, actor);
|
||||
actor->init(actor, play);
|
||||
actor->init = NULL;
|
||||
}
|
||||
actor = actor->next;
|
||||
} else if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
|
||||
} else if (!Object_IsLoaded(&play->objectCtx, actor->objectSlot)) {
|
||||
Actor_Kill(actor);
|
||||
actor = actor->next;
|
||||
} else if ((requiredActorFlag && !(actor->flags & requiredActorFlag)) ||
|
||||
|
@ -2272,8 +2272,8 @@ void Actor_Draw(PlayState* play, Actor* actor) {
|
|||
Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY);
|
||||
Actor_SetObjectDependency(play, actor);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[actor->objectSlot].segment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[actor->objectSlot].segment);
|
||||
|
||||
if (actor->colorFilterTimer != 0) {
|
||||
Color_RGBA8 color = { 0, 0, 0, 255 };
|
||||
|
@ -2570,7 +2570,7 @@ void Actor_KillAllWithMissingObject(PlayState* play, ActorContext* actorCtx) {
|
|||
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) {
|
||||
actor = actorCtx->actorLists[i].head;
|
||||
while (actor != NULL) {
|
||||
if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
|
||||
if (!Object_IsLoaded(&play->objectCtx, actor->objectSlot)) {
|
||||
Actor_Kill(actor);
|
||||
}
|
||||
actor = actor->next;
|
||||
|
@ -2745,7 +2745,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
s32 pad;
|
||||
Actor* actor;
|
||||
ActorInit* actorInit;
|
||||
s32 objBankIndex;
|
||||
s32 objectSlot;
|
||||
ActorOverlay* overlayEntry;
|
||||
uintptr_t temp;
|
||||
char* name;
|
||||
|
@ -2828,13 +2828,13 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
: NULL);
|
||||
}
|
||||
|
||||
objBankIndex = Object_GetIndex(&play->objectCtx, actorInit->objectId);
|
||||
objectSlot = Object_GetSlot(&play->objectCtx, actorInit->objectId);
|
||||
|
||||
if ((objBankIndex < 0) ||
|
||||
if ((objectSlot < 0) ||
|
||||
((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num))) {
|
||||
// "No data bank!! <data bank=%d> (profilep->bank=%d)"
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST,
|
||||
objBankIndex, actorInit->objectId);
|
||||
objectSlot, actorInit->objectId);
|
||||
Actor_FreeOverlay(overlayEntry);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2864,10 +2864,10 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
actor->flags = actorInit->flags;
|
||||
|
||||
if (actorInit->id == ACTOR_EN_PART) {
|
||||
actor->objBankIndex = rotZ;
|
||||
actor->objectSlot = rotZ;
|
||||
rotZ = 0;
|
||||
} else {
|
||||
actor->objBankIndex = objBankIndex;
|
||||
actor->objectSlot = objectSlot;
|
||||
}
|
||||
|
||||
actor->init = actorInit->init;
|
||||
|
@ -3155,7 +3155,7 @@ s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) {
|
|||
void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) {
|
||||
u32 matricesSize;
|
||||
u32 dListsSize;
|
||||
u32 objectIdsSize;
|
||||
u32 objectSlotsSize;
|
||||
|
||||
matricesSize = (count + 1) * sizeof(*bodyBreak->matrices);
|
||||
bodyBreak->matrices = ZeldaArena_MallocDebug(matricesSize, "../z_actor.c", 7540);
|
||||
|
@ -3165,13 +3165,13 @@ void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) {
|
|||
bodyBreak->dLists = ZeldaArena_MallocDebug(dListsSize, "../z_actor.c", 7543);
|
||||
|
||||
if (bodyBreak->dLists != NULL) {
|
||||
objectIdsSize = (count + 1) * sizeof(*bodyBreak->objectIds);
|
||||
bodyBreak->objectIds = ZeldaArena_MallocDebug(objectIdsSize, "../z_actor.c", 7546);
|
||||
objectSlotsSize = (count + 1) * sizeof(*bodyBreak->objectSlots);
|
||||
bodyBreak->objectSlots = ZeldaArena_MallocDebug(objectSlotsSize, "../z_actor.c", 7546);
|
||||
|
||||
if (bodyBreak->objectIds != NULL) {
|
||||
if (bodyBreak->objectSlots != NULL) {
|
||||
Lib_MemSet((u8*)bodyBreak->matrices, matricesSize, 0);
|
||||
Lib_MemSet((u8*)bodyBreak->dLists, dListsSize, 0);
|
||||
Lib_MemSet((u8*)bodyBreak->objectIds, objectIdsSize, 0);
|
||||
Lib_MemSet((u8*)bodyBreak->objectSlots, objectSlotsSize, 0);
|
||||
bodyBreak->val = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -3186,20 +3186,20 @@ void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) {
|
|||
ZeldaArena_FreeDebug(bodyBreak->dLists, "../z_actor.c", 7561);
|
||||
}
|
||||
|
||||
if (bodyBreak->objectIds != NULL) {
|
||||
ZeldaArena_FreeDebug(bodyBreak->objectIds, "../z_actor.c", 7564);
|
||||
if (bodyBreak->objectSlots != NULL) {
|
||||
ZeldaArena_FreeDebug(bodyBreak->objectSlots, "../z_actor.c", 7564);
|
||||
}
|
||||
}
|
||||
|
||||
void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList,
|
||||
s16 objectId) {
|
||||
s16 objectSlot) {
|
||||
PlayState* play = Effect_GetPlayState();
|
||||
|
||||
if ((play->actorCtx.freezeFlashTimer == 0) && (bodyBreak->val > 0)) {
|
||||
if ((limbIndex >= minLimbIndex) && (limbIndex <= maxLimbIndex) && (*dList != NULL)) {
|
||||
bodyBreak->dLists[bodyBreak->val] = *dList;
|
||||
Matrix_Get(&bodyBreak->matrices[bodyBreak->val]);
|
||||
bodyBreak->objectIds[bodyBreak->val] = objectId;
|
||||
bodyBreak->objectSlots[bodyBreak->val] = objectSlot;
|
||||
bodyBreak->val++;
|
||||
}
|
||||
|
||||
|
@ -3219,7 +3219,7 @@ void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s3
|
|||
s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type) {
|
||||
EnPart* spawnedEnPart;
|
||||
MtxF* mtx;
|
||||
s16 objBankIndex;
|
||||
s16 objectSlot;
|
||||
|
||||
if (bodyBreak->val != BODYBREAK_STATUS_READY) {
|
||||
return false;
|
||||
|
@ -3231,17 +3231,17 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s1
|
|||
Matrix_Get(&bodyBreak->matrices[bodyBreak->count]);
|
||||
|
||||
if (1) {
|
||||
if (bodyBreak->objectIds[bodyBreak->count] >= 0) {
|
||||
objBankIndex = bodyBreak->objectIds[bodyBreak->count];
|
||||
if (bodyBreak->objectSlots[bodyBreak->count] > BODYBREAK_OBJECT_SLOT_DEFAULT) {
|
||||
objectSlot = bodyBreak->objectSlots[bodyBreak->count];
|
||||
} else {
|
||||
objBankIndex = actor->objBankIndex;
|
||||
objectSlot = actor->objectSlot;
|
||||
}
|
||||
}
|
||||
|
||||
mtx = &bodyBreak->matrices[bodyBreak->count];
|
||||
|
||||
spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, mtx->xw, mtx->yw,
|
||||
mtx->zw, 0, 0, objBankIndex, type);
|
||||
mtx->zw, 0, 0, objectSlot, type);
|
||||
|
||||
if (spawnedEnPart != NULL) {
|
||||
Matrix_MtxFToYXZRotS(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0);
|
||||
|
@ -3256,7 +3256,7 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s1
|
|||
|
||||
ZeldaArena_FreeDebug(bodyBreak->matrices, "../z_actor.c", 7678);
|
||||
ZeldaArena_FreeDebug(bodyBreak->dLists, "../z_actor.c", 7679);
|
||||
ZeldaArena_FreeDebug(bodyBreak->objectIds, "../z_actor.c", 7680);
|
||||
ZeldaArena_FreeDebug(bodyBreak->objectSlots, "../z_actor.c", 7680);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -4329,7 +4329,7 @@ Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3,
|
|||
EnPart* spawnedEnPart;
|
||||
|
||||
spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, spawnPos->x, spawnPos->y,
|
||||
spawnPos->z, spawnRot->x, spawnRot->y, actor->objBankIndex, params);
|
||||
spawnPos->z, spawnRot->x, spawnRot->y, actor->objectSlot, params);
|
||||
if (spawnedEnPart != NULL) {
|
||||
spawnedEnPart->actor.scale = actor->scale;
|
||||
spawnedEnPart->actor.speed = arg3[0];
|
||||
|
|
|
@ -6876,7 +6876,7 @@ s32 Camera_Special9(Camera* camera) {
|
|||
f32 playerYOffset;
|
||||
s32 pad3;
|
||||
PosRot* playerPosRot = &camera->playerPosRot;
|
||||
PosRot adjustedPlayerPosRot;
|
||||
PosRot referencePosRot;
|
||||
f32 yNormal;
|
||||
DoorParams* doorParams = &camera->paramData.doorParams;
|
||||
Special9ReadOnlyData* roData = &camera->paramData.spec9.roData;
|
||||
|
@ -6902,11 +6902,11 @@ s32 Camera_Special9(Camera* camera) {
|
|||
}
|
||||
|
||||
if (doorParams->doorActor != NULL) {
|
||||
Actor_GetWorldPosShapeRot(&adjustedPlayerPosRot, doorParams->doorActor);
|
||||
Actor_GetWorldPosShapeRot(&referencePosRot, doorParams->doorActor);
|
||||
} else {
|
||||
adjustedPlayerPosRot = *playerPosRot;
|
||||
adjustedPlayerPosRot.pos.y += playerYOffset + roData->yOffset;
|
||||
adjustedPlayerPosRot.rot.x = 0;
|
||||
referencePosRot = *playerPosRot;
|
||||
referencePosRot.pos.y += playerYOffset + roData->yOffset;
|
||||
referencePosRot.rot.x = 0;
|
||||
}
|
||||
|
||||
OLib_Vec3fDiffToVecGeo(&atEyeOffsetGeo, at, eye);
|
||||
|
@ -6919,9 +6919,15 @@ s32 Camera_Special9(Camera* camera) {
|
|||
case 0:
|
||||
camera->stateFlags &= ~(CAM_STATE_1 | CAM_STATE_2);
|
||||
camera->animState++;
|
||||
rwData->targetYaw = ABS(playerPosRot->rot.y - adjustedPlayerPosRot.rot.y) >= 0x4000
|
||||
? adjustedPlayerPosRot.rot.y - 0x7FFF
|
||||
: adjustedPlayerPosRot.rot.y;
|
||||
|
||||
//! @bug The angle passed to ABS should be cast to s16.
|
||||
//! The lack of a cast means that a door which has an angle of around 0x8000 will calculate an incorrect
|
||||
//! angle and use an incorrect `targetYaw`.
|
||||
//! In-game, this means if the player opens a susceptible door at a slanted angle, the camera will not
|
||||
//! appear correctly on the other side after the player has walked through the door.
|
||||
rwData->targetYaw = ABS(playerPosRot->rot.y - referencePosRot.rot.y) >= 0x4000
|
||||
? referencePosRot.rot.y - 0x7FFF
|
||||
: referencePosRot.rot.y;
|
||||
FALLTHROUGH;
|
||||
case 1:
|
||||
doorParams->timer1--;
|
||||
|
|
|
@ -49,7 +49,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) {
|
|||
MtxF mfTransBillboard;
|
||||
s32 pad1;
|
||||
Mtx* mtx;
|
||||
void* object = play->objectCtx.status[this->rgObjBankIdx].segment;
|
||||
void* objectPtr = play->objectCtx.slots[this->rgObjectSlot].segment;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_effect_soft_sprite_old_init.c", 196);
|
||||
|
||||
|
@ -58,8 +58,8 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) {
|
|||
SkinMatrix_SetScale(&mfScale, scale, scale, scale);
|
||||
SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
|
||||
SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(object);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x06, object);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr);
|
||||
|
||||
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
|
|||
this->scale = 0.01f;
|
||||
break;
|
||||
case ITEM00_SHIELD_DEKU:
|
||||
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_1);
|
||||
this->actor.objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_SHIELD_1);
|
||||
Actor_SetObjectDependency(play, &this->actor);
|
||||
Actor_SetScale(&this->actor, 0.5f);
|
||||
this->scale = 0.5f;
|
||||
|
@ -245,7 +245,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
|
|||
this->actor.world.rot.x = 0x4000;
|
||||
break;
|
||||
case ITEM00_SHIELD_HYLIAN:
|
||||
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2);
|
||||
this->actor.objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_SHIELD_2);
|
||||
Actor_SetObjectDependency(play, &this->actor);
|
||||
Actor_SetScale(&this->actor, 0.5f);
|
||||
this->scale = 0.5f;
|
||||
|
@ -255,7 +255,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
|
|||
break;
|
||||
case ITEM00_TUNIC_ZORA:
|
||||
case ITEM00_TUNIC_GORON:
|
||||
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_CLOTHES);
|
||||
this->actor.objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_CLOTHES);
|
||||
Actor_SetObjectDependency(play, &this->actor);
|
||||
Actor_SetScale(&this->actor, 0.5f);
|
||||
this->scale = 0.5f;
|
||||
|
@ -765,10 +765,10 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
|
|||
case ITEM00_RECOVERY_HEART:
|
||||
if (this->despawnTimer < 0) {
|
||||
if (this->despawnTimer == -1) {
|
||||
s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART);
|
||||
s8 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_HEART);
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, bankIndex)) {
|
||||
this->actor.objBankIndex = bankIndex;
|
||||
if (Object_IsLoaded(&play->objectCtx, objectSlot)) {
|
||||
this->actor.objectSlot = objectSlot;
|
||||
Actor_SetObjectDependency(play, &this->actor);
|
||||
this->despawnTimer = -2;
|
||||
}
|
||||
|
|
|
@ -432,7 +432,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
|
|||
play->csCtx.actorCues[i] = NULL;
|
||||
}
|
||||
|
||||
if (Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) < 0 && !play->envCtx.sunMoonDisabled) {
|
||||
if (Object_GetSlot(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) < 0 && !play->envCtx.sunMoonDisabled) {
|
||||
play->envCtx.sunMoonDisabled = true;
|
||||
// "Sun setting other than field keep! So forced release!"
|
||||
osSyncPrintf(VT_COL(YELLOW, BLACK) "\n\nフィールド常駐以外、太陽設定!よって強制解除!\n" VT_RST);
|
||||
|
|
|
@ -219,14 +219,14 @@ s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void func_80077D10(f32* arg0, s16* arg1, Input* input) {
|
||||
void Lib_GetControlStickData(f32* outMagnitude, s16* outAngle, Input* input) {
|
||||
f32 relX = input->rel.stick_x;
|
||||
f32 relY = input->rel.stick_y;
|
||||
|
||||
*arg0 = sqrtf(SQ(relX) + SQ(relY));
|
||||
*arg0 = (60.0f < *arg0) ? 60.0f : *arg0;
|
||||
*outMagnitude = sqrtf(SQ(relX) + SQ(relY));
|
||||
*outMagnitude = (60.0f < *outMagnitude) ? 60.0f : *outMagnitude;
|
||||
|
||||
*arg1 = Math_Atan2S(relY, -relX);
|
||||
*outAngle = Math_Atan2S(relY, -relX);
|
||||
}
|
||||
|
||||
s16 Rand_S16Offset(s16 base, s16 range) {
|
||||
|
|
|
@ -8,7 +8,7 @@ Input* D_8012D1F8 = NULL;
|
|||
|
||||
TransitionTile sTransitionTile;
|
||||
s32 gTransitionTileState;
|
||||
VisMono D_80161498;
|
||||
VisMono sPlayVisMono;
|
||||
Color_RGBA8_u32 gVisMonoColor;
|
||||
FaultClient D_801614B8;
|
||||
s16 sTransitionFillTimer;
|
||||
|
@ -199,7 +199,7 @@ void Play_Destroy(GameState* thisx) {
|
|||
|
||||
Letterbox_Destroy();
|
||||
TransitionFade_Destroy(&this->transitionFadeFlash);
|
||||
VisMono_Destroy(&D_80161498);
|
||||
VisMono_Destroy(&sPlayVisMono);
|
||||
|
||||
if (gSaveContext.save.linkAge != this->linkAgeOnLoad) {
|
||||
Inventory_SwapAgeEquipment();
|
||||
|
@ -390,7 +390,7 @@ void Play_Init(GameState* thisx) {
|
|||
TransitionFade_SetType(&this->transitionFadeFlash, TRANS_INSTANCE_TYPE_FADE_FLASH);
|
||||
TransitionFade_SetColor(&this->transitionFadeFlash, RGBA8(160, 160, 160, 255));
|
||||
TransitionFade_Start(&this->transitionFadeFlash);
|
||||
VisMono_Init(&D_80161498);
|
||||
VisMono_Init(&sPlayVisMono);
|
||||
gVisMonoColor.a = 0;
|
||||
CutsceneFlags_UnsetAll(this);
|
||||
|
||||
|
@ -482,8 +482,8 @@ void Play_Update(PlayState* this) {
|
|||
ActorOverlayTable_LogPrint();
|
||||
}
|
||||
|
||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
|
||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
|
||||
gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
|
||||
|
||||
if (FrameAdvance_Update(&this->frameAdvCtx, &input[1])) {
|
||||
|
@ -855,7 +855,7 @@ void Play_Update(PlayState* this) {
|
|||
AnimationContext_Reset(&this->animationCtx);
|
||||
|
||||
PLAY_LOG(3561);
|
||||
Object_UpdateBank(&this->objectCtx);
|
||||
Object_UpdateEntries(&this->objectCtx);
|
||||
|
||||
PLAY_LOG(3577);
|
||||
|
||||
|
@ -1035,21 +1035,21 @@ void Play_Draw(PlayState* this) {
|
|||
|
||||
OPEN_DISPS(gfxCtx, "../z_play.c", 3907);
|
||||
|
||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
|
||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
|
||||
gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x00, NULL);
|
||||
gSPSegment(OVERLAY_DISP++, 0x00, NULL);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
|
||||
gSPSegment(OVERLAY_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
|
||||
gSPSegment(OVERLAY_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
|
||||
gSPSegment(OVERLAY_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x05, this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x05, this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
|
||||
gSPSegment(OVERLAY_DISP++, 0x05, this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x02, this->sceneSegment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x02, this->sceneSegment);
|
||||
|
@ -1103,8 +1103,8 @@ void Play_Draw(PlayState* this) {
|
|||
TransitionFade_Draw(&this->transitionFadeFlash, &gfxP);
|
||||
|
||||
if (gVisMonoColor.a > 0) {
|
||||
D_80161498.primColor.rgba = gVisMonoColor.rgba;
|
||||
VisMono_Draw(&D_80161498, &gfxP);
|
||||
sPlayVisMono.vis.primColor.rgba = gVisMonoColor.rgba;
|
||||
VisMono_Draw(&sPlayVisMono, &gfxP);
|
||||
}
|
||||
|
||||
gSPEndDisplayList(gfxP++);
|
||||
|
@ -1434,7 +1434,7 @@ void Play_InitScene(PlayState* this, s32 spawn) {
|
|||
|
||||
this->numActorEntries = 0;
|
||||
|
||||
Object_InitBank(this, &this->objectCtx);
|
||||
Object_InitContext(this, &this->objectCtx);
|
||||
LightContext_Init(this, &this->lightCtx);
|
||||
TransitionActor_InitContext(&this->state, &this->transiActorCtx);
|
||||
func_80096FD4(this, &this->roomCtx.curRoom);
|
||||
|
|
|
@ -1370,7 +1370,7 @@ void Player_DrawHookshotReticle(PlayState* play, Player* this, f32 arg2) {
|
|||
|
||||
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2587),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPSegment(OVERLAY_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
|
||||
gSPSegment(OVERLAY_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment);
|
||||
gSPDisplayList(OVERLAY_DISP++, gLinkAdultHookshotReticleDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2592);
|
||||
|
|
|
@ -907,8 +907,8 @@ Gfx* Gfx_SetupDL(Gfx* gfx, u32 i) {
|
|||
return Gfx_SetupDLImpl(gfx, i);
|
||||
}
|
||||
|
||||
void Gfx_SetupDLAtPtr(Gfx** gfxp, u32 i) {
|
||||
*gfxp = Gfx_SetupDL(*gfxp, i);
|
||||
void Gfx_SetupDLAtPtr(Gfx** gfxP, u32 i) {
|
||||
*gfxP = Gfx_SetupDL(*gfxP, i);
|
||||
}
|
||||
|
||||
Gfx* Gfx_SetupDL_57(Gfx* gfx) {
|
||||
|
@ -1193,11 +1193,11 @@ void Gfx_SetupDL_39Overlay(GraphicsContext* gfxCtx) {
|
|||
CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1811);
|
||||
}
|
||||
|
||||
void Gfx_SetupDL_39Ptr(Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
void Gfx_SetupDL_39Ptr(Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
|
||||
gSPDisplayList(gfx++, sSetupDL[SETUPDL_39]);
|
||||
*gfxp = gfx;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
void Gfx_SetupDL_40Opa(GraphicsContext* gfxCtx) {
|
||||
|
@ -1345,12 +1345,12 @@ void Gfx_SetupDL_56Opa(GraphicsContext* gfxCtx) {
|
|||
CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2090);
|
||||
}
|
||||
|
||||
void Gfx_SetupDL_56Ptr(Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
void Gfx_SetupDL_56Ptr(Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
|
||||
gSPDisplayList(gfx++, sSetupDL[SETUPDL_56]);
|
||||
|
||||
*gfxp = gfx;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
void Gfx_SetupDL_59Opa(GraphicsContext* gfxCtx) {
|
||||
|
@ -1361,8 +1361,8 @@ void Gfx_SetupDL_59Opa(GraphicsContext* gfxCtx) {
|
|||
CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2116);
|
||||
}
|
||||
|
||||
Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height) {
|
||||
Gfx* displayList = Graph_DlistAlloc(gfxp, 3 * sizeof(Gfx));
|
||||
Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height) {
|
||||
Gfx* displayList = Graph_DlistAlloc(gfxP, 3 * sizeof(Gfx));
|
||||
|
||||
gDPTileSync(displayList);
|
||||
gDPSetTileSize(displayList + 1, G_TX_RENDERTILE, x, y, x + ((width - 1) << 2), y + ((height - 1) << 2));
|
||||
|
@ -1371,8 +1371,8 @@ Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height) {
|
|||
return displayList;
|
||||
}
|
||||
|
||||
Gfx* func_80094E54(Gfx** gfxp, u32 x, u32 y) {
|
||||
return Gfx_BranchTexScroll(gfxp, x, y, 0, 0);
|
||||
Gfx* func_80094E54(Gfx** gfxP, u32 x, u32 y) {
|
||||
return Gfx_BranchTexScroll(gfxP, x, y, 0, 0);
|
||||
}
|
||||
|
||||
Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y) {
|
||||
|
|
|
@ -3,64 +3,77 @@
|
|||
|
||||
RomFile sNaviQuestHintFiles[];
|
||||
|
||||
s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) {
|
||||
/**
|
||||
* Spawn an object file of a specified ID that will persist through room changes.
|
||||
*
|
||||
* This waits for the file to be fully loaded, the data is available when the function returns.
|
||||
*
|
||||
* @return The new object slot corresponding to the requested object ID.
|
||||
*
|
||||
* @note This function is not meant to be called externally to spawn object files on the fly.
|
||||
* When an object is spawned with this function, all objects that come before it in the entry list will be treated as
|
||||
* persistent, which will likely cause either the amount of free slots or object space memory to run out.
|
||||
* This function is only meant to be called internally on scene load, before the object list from any room is processed.
|
||||
*/
|
||||
s32 Object_SpawnPersistent(ObjectContext* objectCtx, s16 objectId) {
|
||||
u32 size;
|
||||
|
||||
objectCtx->status[objectCtx->num].id = objectId;
|
||||
objectCtx->slots[objectCtx->numEntries].id = objectId;
|
||||
size = gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart;
|
||||
|
||||
osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectId, size / 1024.0f, objectCtx->status[objectCtx->num].segment);
|
||||
osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectId, size / 1024.0f,
|
||||
objectCtx->slots[objectCtx->numEntries].segment);
|
||||
|
||||
osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->num, (uintptr_t)objectCtx->status[objectCtx->num].segment + size,
|
||||
objectCtx->spaceEnd);
|
||||
osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->numEntries,
|
||||
(uintptr_t)objectCtx->slots[objectCtx->numEntries].segment + size, objectCtx->spaceEnd);
|
||||
|
||||
ASSERT(((objectCtx->num < OBJECT_EXCHANGE_BANK_MAX) &&
|
||||
(((uintptr_t)objectCtx->status[objectCtx->num].segment + size) < (uintptr_t)objectCtx->spaceEnd)),
|
||||
ASSERT(((objectCtx->numEntries < ARRAY_COUNT(objectCtx->slots)) &&
|
||||
(((uintptr_t)objectCtx->slots[objectCtx->numEntries].segment + size) < (uintptr_t)objectCtx->spaceEnd)),
|
||||
"this->num < OBJECT_EXCHANGE_BANK_MAX && (this->status[this->num].Segment + size) < this->endSegment",
|
||||
"../z_scene.c", 142);
|
||||
|
||||
DmaMgr_RequestSyncDebug(objectCtx->status[objectCtx->num].segment, gObjectTable[objectId].vromStart, size,
|
||||
DmaMgr_RequestSyncDebug(objectCtx->slots[objectCtx->numEntries].segment, gObjectTable[objectId].vromStart, size,
|
||||
"../z_scene.c", 145);
|
||||
|
||||
if (objectCtx->num < OBJECT_EXCHANGE_BANK_MAX - 1) {
|
||||
objectCtx->status[objectCtx->num + 1].segment =
|
||||
(void*)ALIGN16((uintptr_t)objectCtx->status[objectCtx->num].segment + size);
|
||||
if (objectCtx->numEntries < (ARRAY_COUNT(objectCtx->slots) - 1)) {
|
||||
objectCtx->slots[objectCtx->numEntries + 1].segment =
|
||||
(void*)ALIGN16((uintptr_t)objectCtx->slots[objectCtx->numEntries].segment + size);
|
||||
}
|
||||
|
||||
objectCtx->num++;
|
||||
objectCtx->unk_09 = objectCtx->num;
|
||||
objectCtx->numEntries++;
|
||||
objectCtx->numPersistentEntries = objectCtx->numEntries;
|
||||
|
||||
return objectCtx->num - 1;
|
||||
return objectCtx->numEntries - 1;
|
||||
}
|
||||
|
||||
void Object_InitBank(PlayState* play, ObjectContext* objectCtx) {
|
||||
PlayState* play2 = play; // Needs to be a new variable to match (possibly a sub struct?)
|
||||
void Object_InitContext(PlayState* play, ObjectContext* objectCtx) {
|
||||
PlayState* play2 = play;
|
||||
u32 spaceSize;
|
||||
s32 i;
|
||||
|
||||
if (play2->sceneId == SCENE_HYRULE_FIELD) {
|
||||
spaceSize = 1024000;
|
||||
spaceSize = 1000 * 1024;
|
||||
} else if (play2->sceneId == SCENE_GANON_BOSS) {
|
||||
if (gSaveContext.sceneLayer != 4) {
|
||||
spaceSize = 1177600;
|
||||
spaceSize = 1150 * 1024;
|
||||
} else {
|
||||
spaceSize = 1024000;
|
||||
spaceSize = 1000 * 1024;
|
||||
}
|
||||
} else if (play2->sceneId == SCENE_SPIRIT_TEMPLE_BOSS) {
|
||||
spaceSize = 1075200;
|
||||
spaceSize = 1050 * 1024;
|
||||
} else if (play2->sceneId == SCENE_CHAMBER_OF_THE_SAGES) {
|
||||
spaceSize = 1075200;
|
||||
spaceSize = 1050 * 1024;
|
||||
} else if (play2->sceneId == SCENE_GANONDORF_BOSS) {
|
||||
spaceSize = 1075200;
|
||||
spaceSize = 1050 * 1024;
|
||||
} else {
|
||||
spaceSize = 1024000;
|
||||
spaceSize = 1000 * 1024;
|
||||
}
|
||||
|
||||
objectCtx->num = objectCtx->unk_09 = 0;
|
||||
objectCtx->mainKeepIndex = objectCtx->subKeepIndex = 0;
|
||||
objectCtx->numEntries = objectCtx->numPersistentEntries = 0;
|
||||
objectCtx->mainKeepSlot = objectCtx->subKeepSlot = 0;
|
||||
|
||||
for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) {
|
||||
objectCtx->status[i].id = OBJECT_INVALID;
|
||||
for (i = 0; i < ARRAY_COUNT(objectCtx->slots); i++) {
|
||||
objectCtx->slots[i].id = OBJECT_INVALID;
|
||||
}
|
||||
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
|
@ -68,42 +81,43 @@ void Object_InitBank(PlayState* play, ObjectContext* objectCtx) {
|
|||
osSyncPrintf("オブジェクト入れ替えバンク情報 %8.3fKB\n", spaceSize / 1024.0f);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
objectCtx->spaceStart = objectCtx->status[0].segment =
|
||||
GameState_Alloc(&play->state, spaceSize, "../z_scene.c", 219);
|
||||
objectCtx->spaceStart = objectCtx->slots[0].segment = GameState_Alloc(&play->state, spaceSize, "../z_scene.c", 219);
|
||||
objectCtx->spaceEnd = (void*)((uintptr_t)objectCtx->spaceStart + spaceSize);
|
||||
|
||||
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP);
|
||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->status[objectCtx->mainKeepIndex].segment);
|
||||
objectCtx->mainKeepSlot = Object_SpawnPersistent(objectCtx, OBJECT_GAMEPLAY_KEEP);
|
||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->slots[objectCtx->mainKeepSlot].segment);
|
||||
}
|
||||
|
||||
void Object_UpdateBank(ObjectContext* objectCtx) {
|
||||
void Object_UpdateEntries(ObjectContext* objectCtx) {
|
||||
s32 i;
|
||||
ObjectStatus* status = &objectCtx->status[0];
|
||||
ObjectEntry* entry = &objectCtx->slots[0];
|
||||
RomFile* objectFile;
|
||||
u32 size;
|
||||
|
||||
for (i = 0; i < objectCtx->num; i++) {
|
||||
if (status->id < 0) {
|
||||
if (status->dmaRequest.vromAddr == 0) {
|
||||
osCreateMesgQueue(&status->loadQueue, &status->loadMsg, 1);
|
||||
objectFile = &gObjectTable[-status->id];
|
||||
for (i = 0; i < objectCtx->numEntries; i++) {
|
||||
if (entry->id < 0) {
|
||||
if (entry->dmaRequest.vromAddr == 0) {
|
||||
osCreateMesgQueue(&entry->loadQueue, &entry->loadMsg, 1);
|
||||
objectFile = &gObjectTable[-entry->id];
|
||||
size = objectFile->vromEnd - objectFile->vromStart;
|
||||
osSyncPrintf("OBJECT EXCHANGE BANK-%2d SIZE %8.3fK SEG=%08x\n", i, size / 1024.0f, status->segment);
|
||||
DmaMgr_RequestAsync(&status->dmaRequest, status->segment, objectFile->vromStart, size, 0,
|
||||
&status->loadQueue, NULL, "../z_scene.c", 266);
|
||||
} else if (osRecvMesg(&status->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||
status->id = -status->id;
|
||||
|
||||
osSyncPrintf("OBJECT EXCHANGE BANK-%2d SIZE %8.3fK SEG=%08x\n", i, size / 1024.0f, entry->segment);
|
||||
|
||||
DmaMgr_RequestAsync(&entry->dmaRequest, entry->segment, objectFile->vromStart, size, 0,
|
||||
&entry->loadQueue, NULL, "../z_scene.c", 266);
|
||||
} else if (osRecvMesg(&entry->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||
entry->id = -entry->id;
|
||||
}
|
||||
}
|
||||
status++;
|
||||
entry++;
|
||||
}
|
||||
}
|
||||
|
||||
s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) {
|
||||
s32 Object_GetSlot(ObjectContext* objectCtx, s16 objectId) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < objectCtx->num; i++) {
|
||||
if (ABS(objectCtx->status[i].id) == objectId) {
|
||||
for (i = 0; i < objectCtx->numEntries; i++) {
|
||||
if (ABS(objectCtx->slots[i].id) == objectId) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -111,8 +125,8 @@ s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex) {
|
||||
if (objectCtx->status[bankIndex].id > 0) {
|
||||
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 slot) {
|
||||
if (objectCtx->slots[slot].id > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -124,30 +138,30 @@ void func_800981B8(ObjectContext* objectCtx) {
|
|||
s32 id;
|
||||
u32 size;
|
||||
|
||||
for (i = 0; i < objectCtx->num; i++) {
|
||||
id = objectCtx->status[i].id;
|
||||
for (i = 0; i < objectCtx->numEntries; i++) {
|
||||
id = objectCtx->slots[i].id;
|
||||
size = gObjectTable[id].vromEnd - gObjectTable[id].vromStart;
|
||||
osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectCtx->status[i].id, size / 1024.0f,
|
||||
objectCtx->status[i].segment);
|
||||
osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->num, (uintptr_t)objectCtx->status[i].segment + size,
|
||||
osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectCtx->slots[i].id, size / 1024.0f,
|
||||
objectCtx->slots[i].segment);
|
||||
osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->numEntries, (uintptr_t)objectCtx->slots[i].segment + size,
|
||||
objectCtx->spaceEnd);
|
||||
DmaMgr_RequestSyncDebug(objectCtx->status[i].segment, gObjectTable[id].vromStart, size, "../z_scene.c", 342);
|
||||
DmaMgr_RequestSyncDebug(objectCtx->slots[i].segment, gObjectTable[id].vromStart, size, "../z_scene.c", 342);
|
||||
}
|
||||
}
|
||||
|
||||
void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) {
|
||||
ObjectStatus* status = &objectCtx->status[bankIndex];
|
||||
void* func_800982FC(ObjectContext* objectCtx, s32 slot, s16 objectId) {
|
||||
ObjectEntry* entry = &objectCtx->slots[slot];
|
||||
RomFile* objectFile = &gObjectTable[objectId];
|
||||
u32 size;
|
||||
void* nextPtr;
|
||||
|
||||
status->id = -objectId;
|
||||
status->dmaRequest.vromAddr = 0;
|
||||
entry->id = -objectId;
|
||||
entry->dmaRequest.vromAddr = 0;
|
||||
|
||||
size = objectFile->vromEnd - objectFile->vromStart;
|
||||
osSyncPrintf("OBJECT EXCHANGE NO=%2d BANK=%3d SIZE=%8.3fK\n", bankIndex, objectId, size / 1024.0f);
|
||||
osSyncPrintf("OBJECT EXCHANGE NO=%2d BANK=%3d SIZE=%8.3fK\n", slot, objectId, size / 1024.0f);
|
||||
|
||||
nextPtr = (void*)ALIGN16((uintptr_t)status->segment + size);
|
||||
nextPtr = (void*)ALIGN16((uintptr_t)entry->segment + size);
|
||||
|
||||
ASSERT(nextPtr < objectCtx->spaceEnd, "nextptr < this->endSegment", "../z_scene.c", 381);
|
||||
|
||||
|
@ -191,7 +205,7 @@ void Scene_CommandPlayerEntryList(PlayState* play, SceneCmd* cmd) {
|
|||
linkObjectId = gLinkObjectIds[((void)0, gSaveContext.save.linkAge)];
|
||||
|
||||
gActorOverlayTable[playerEntry->id].initInfo->objectId = linkObjectId;
|
||||
Object_Spawn(&play->objectCtx, linkObjectId);
|
||||
Object_SpawnPersistent(&play->objectCtx, linkObjectId);
|
||||
}
|
||||
|
||||
void Scene_CommandActorEntryList(PlayState* play, SceneCmd* cmd) {
|
||||
|
@ -226,8 +240,8 @@ void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) {
|
|||
|
||||
void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) {
|
||||
if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) {
|
||||
play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.keepObjectId);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment);
|
||||
play->objectCtx.subKeepSlot = Object_SpawnPersistent(&play->objectCtx, cmd->specialFiles.keepObjectId);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[play->objectCtx.subKeepSlot].segment);
|
||||
}
|
||||
|
||||
if (cmd->specialFiles.naviQuestHintFileId != NAVI_QUEST_HINTS_NONE) {
|
||||
|
@ -250,25 +264,27 @@ void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) {
|
|||
s32 i;
|
||||
s32 j;
|
||||
s32 k;
|
||||
ObjectStatus* status;
|
||||
ObjectStatus* status2;
|
||||
ObjectStatus* firstStatus;
|
||||
s16* objectEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.data);
|
||||
ObjectEntry* entry;
|
||||
ObjectEntry* invalidatedEntry;
|
||||
ObjectEntry* entries;
|
||||
s16* objectListEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.data);
|
||||
void* nextPtr;
|
||||
|
||||
k = 0;
|
||||
i = play->objectCtx.unk_09;
|
||||
firstStatus = &play->objectCtx.status[0];
|
||||
status = &play->objectCtx.status[i];
|
||||
i = play->objectCtx.numPersistentEntries;
|
||||
entries = play->objectCtx.slots;
|
||||
entry = &play->objectCtx.slots[i];
|
||||
|
||||
while (i < play->objectCtx.num) {
|
||||
if (status->id != *objectEntry) {
|
||||
status2 = &play->objectCtx.status[i];
|
||||
for (j = i; j < play->objectCtx.num; j++) {
|
||||
status2->id = OBJECT_INVALID;
|
||||
status2++;
|
||||
while (i < play->objectCtx.numEntries) {
|
||||
if (entry->id != *objectListEntry) {
|
||||
|
||||
invalidatedEntry = &play->objectCtx.slots[i];
|
||||
for (j = i; j < play->objectCtx.numEntries; j++) {
|
||||
invalidatedEntry->id = OBJECT_INVALID;
|
||||
invalidatedEntry++;
|
||||
}
|
||||
play->objectCtx.num = i;
|
||||
|
||||
play->objectCtx.numEntries = i;
|
||||
Actor_KillAllWithMissingObject(play, &play->actorCtx);
|
||||
|
||||
continue;
|
||||
|
@ -276,24 +292,24 @@ void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) {
|
|||
|
||||
i++;
|
||||
k++;
|
||||
objectEntry++;
|
||||
status++;
|
||||
objectListEntry++;
|
||||
entry++;
|
||||
}
|
||||
|
||||
ASSERT(cmd->objectList.length <= OBJECT_EXCHANGE_BANK_MAX,
|
||||
ASSERT(cmd->objectList.length <= ARRAY_COUNT(play->objectCtx.slots),
|
||||
"scene_info->object_bank.num <= OBJECT_EXCHANGE_BANK_MAX", "../z_scene.c", 705);
|
||||
|
||||
while (k < cmd->objectList.length) {
|
||||
nextPtr = func_800982FC(&play->objectCtx, i, *objectEntry);
|
||||
if (i < OBJECT_EXCHANGE_BANK_MAX - 1) {
|
||||
firstStatus[i + 1].segment = nextPtr;
|
||||
nextPtr = func_800982FC(&play->objectCtx, i, *objectListEntry);
|
||||
if (i < (ARRAY_COUNT(play->objectCtx.slots) - 1)) {
|
||||
entries[i + 1].segment = nextPtr;
|
||||
}
|
||||
i++;
|
||||
k++;
|
||||
objectEntry++;
|
||||
objectListEntry++;
|
||||
}
|
||||
|
||||
play->objectCtx.num = i;
|
||||
play->objectCtx.numEntries = i;
|
||||
}
|
||||
|
||||
void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) {
|
||||
|
|
|
@ -539,8 +539,8 @@ s32 View_UpdateViewingMatrix(View* view) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
s32 width;
|
||||
s32 height;
|
||||
|
@ -606,7 +606,7 @@ s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxp) {
|
|||
}
|
||||
|
||||
view->flags = 0;
|
||||
*gfxp = gfx;
|
||||
*gfxP = gfx;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
145
src/code/z_viscvg.c
Normal file
145
src/code/z_viscvg.c
Normal file
|
@ -0,0 +1,145 @@
|
|||
/**
|
||||
* @file z_viscvg.c
|
||||
*
|
||||
* This file implements full-screen frame buffer effects involving the visualization of Coverage in various ways.
|
||||
*
|
||||
* Coverage is roughly how much of a pixel is covered by a primitive; the final coverage for a frame is stored in the
|
||||
* color image alpha component where it is used for antialiasing, see PreRender.c and §15 of the programming manual for
|
||||
* details.
|
||||
*
|
||||
* To understand this file, it is helpful to remember that A_MEM is essentially synonymous with coverage, and that
|
||||
* `GBL_c1/2(p, a, m, b)` usually represents the RDP blender calculation `(p * a + m * b)`.
|
||||
* Note the division step that is often included in the blender calculation is omitted; the division is skipped if
|
||||
* force blending (FORCE_BL) is set, which is the case for all render modes used in this file.
|
||||
*
|
||||
* Coverage is full when not on an edge, while on an edge it is usually lower. Since coverage is treated as an alpha
|
||||
* value, edges of primitives where coverage is lower will show up darker than primitive interiors in all of the
|
||||
* available modes.
|
||||
*
|
||||
* Coverage is abbreviated to "cvg"; "FB RGB" ("framebuffer red/green/blue") is the color the pixel originally had
|
||||
* before the filter is applied.
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
/**
|
||||
* Draws only coverage: does not retain any of the original pixel RGB, primColor is used as background color.
|
||||
*/
|
||||
Gfx sCoverageOnlyDL[] = {
|
||||
gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2),
|
||||
// (blendColor RGB) * (cvg)
|
||||
gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1),
|
||||
gsDPPipeSync(),
|
||||
gsDPSetBlendColor(0, 0, 0, 8),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
/**
|
||||
* Draws fog + coverage * RGB of pixels
|
||||
*
|
||||
* @bug This easily overflows the blender because the fog value is added to the coverage value.
|
||||
*/
|
||||
Gfx sCoverageRGBFogDL[] = {
|
||||
gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL |
|
||||
GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM) |
|
||||
GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)),
|
||||
// (fog RGB) * (fog alpha) + (FB RGB) * (cvg)
|
||||
gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
/**
|
||||
* Draws coverage and RGB of pixels
|
||||
*/
|
||||
Gfx sCoverageRGBDL[] = {
|
||||
gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL |
|
||||
GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) |
|
||||
GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)),
|
||||
// (FB RGB) * (cvg)
|
||||
gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
/**
|
||||
* Two stage filtering:
|
||||
*
|
||||
* 1. Apply a uniform color filter by transparently blending primColor with original frame. The "cloud surface"
|
||||
* RenderMode is used to preserve the coverage for the second stage.
|
||||
* 2. Second half is the same as `sCoverageRGBDL`'s, i.e. (RGB from stage 1) * cvg
|
||||
*/
|
||||
Gfx sCoverageRGBUniformDL[] = {
|
||||
gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE),
|
||||
gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2),
|
||||
// stage 1 color = (primColor RGB) * (primColor Alpha) + (FB RGB) * (1 - primColor Alpha)
|
||||
gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1),
|
||||
|
||||
gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL |
|
||||
GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) |
|
||||
GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)),
|
||||
// final color = (stage 1 RGB) * (cvg)
|
||||
gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
void VisCvg_Init(VisCvg* this) {
|
||||
this->vis.type = FB_FILTER_NONE;
|
||||
this->vis.scissorType = VIS_NO_SETSCISSOR;
|
||||
this->vis.primColor.r = 255;
|
||||
this->vis.primColor.g = 255;
|
||||
this->vis.primColor.b = 255;
|
||||
this->vis.primColor.a = 255;
|
||||
}
|
||||
|
||||
void VisCvg_Destroy(VisCvg* this) {
|
||||
}
|
||||
|
||||
void VisCvg_Draw(VisCvg* this, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetPrimDepth(gfx++, 0xFFFF, 0xFFFF);
|
||||
|
||||
if (this->vis.scissorType == VIS_SETSCISSOR) {
|
||||
gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
switch (this->vis.type) {
|
||||
case FB_FILTER_CVG_RGB:
|
||||
gSPDisplayList(gfx++, sCoverageRGBDL);
|
||||
break;
|
||||
|
||||
case FB_FILTER_CVG_RGB_UNIFORM:
|
||||
// Set primitive color for uniform color filter in custom RenderMode
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->vis.primColor.rgba);
|
||||
gSPDisplayList(gfx++, sCoverageRGBUniformDL);
|
||||
break;
|
||||
|
||||
case FB_FILTER_CVG_ONLY:
|
||||
// Set background color for G_RM_VISCVG
|
||||
gDPSetColor(gfx++, G_SETBLENDCOLOR, this->vis.primColor.rgba);
|
||||
gSPDisplayList(gfx++, sCoverageOnlyDL);
|
||||
break;
|
||||
|
||||
case FB_FILTER_CVG_RGB_FOG:
|
||||
// Set fog color for custom RenderMode, needs to be close to 0 to not overflow
|
||||
gDPSetColor(gfx++, G_SETFOGCOLOR, this->vis.primColor.rgba);
|
||||
gSPDisplayList(gfx++, sCoverageRGBFogDL);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
*gfxP = gfx;
|
||||
}
|
|
@ -1,13 +1,19 @@
|
|||
/**
|
||||
* Color frame buffer effect to desaturate the colors.
|
||||
* @file z_vismono.c
|
||||
*
|
||||
* This file implements a full-screen framebuffer effect for desaturating the contents of the framebuffer image.
|
||||
*
|
||||
* Broadly, this effect is achieved by reinterpreting the contents of the RGBA16 color image as indices into an IA16
|
||||
* color palette that converts each color into the desaturated equivalent. More precise details can be found in inline
|
||||
* comments.
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
// Height of the fragments the color frame buffer (CFB) is split into.
|
||||
// It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into
|
||||
// the half of tmem (0x800 bytes) dedicated to color-indexed data.
|
||||
#define VISMONO_CFBFRAG_HEIGHT (0x800 / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES))
|
||||
// the half of TMEM dedicated to color-indexed data.
|
||||
#define VISMONO_CFBFRAG_HEIGHT ((TMEM_SIZE / 2) / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES))
|
||||
|
||||
// Maximum size of the dlist written by `VisMono_DesaturateDList`.
|
||||
// `VisMono_DesaturateDList` consistently uses `VISMONO_DLSIZE - 2` double words, so this can be 2 less.
|
||||
|
@ -26,16 +32,16 @@ extern u16 D_0F000000[];
|
|||
|
||||
void VisMono_Init(VisMono* this) {
|
||||
bzero(this, sizeof(VisMono));
|
||||
this->unk_00 = 0;
|
||||
this->setScissor = false;
|
||||
this->primColor.r = 255;
|
||||
this->primColor.g = 255;
|
||||
this->primColor.b = 255;
|
||||
this->primColor.a = 255;
|
||||
this->envColor.r = 0;
|
||||
this->envColor.g = 0;
|
||||
this->envColor.b = 0;
|
||||
this->envColor.a = 0;
|
||||
this->vis.type = 0;
|
||||
this->vis.scissorType = VIS_NO_SETSCISSOR;
|
||||
this->vis.primColor.r = 255;
|
||||
this->vis.primColor.g = 255;
|
||||
this->vis.primColor.b = 255;
|
||||
this->vis.primColor.a = 255;
|
||||
this->vis.envColor.r = 0;
|
||||
this->vis.envColor.g = 0;
|
||||
this->vis.envColor.b = 0;
|
||||
this->vis.envColor.a = 0;
|
||||
}
|
||||
|
||||
void VisMono_Destroy(VisMono* this) {
|
||||
|
@ -95,6 +101,8 @@ Gfx* VisMono_DesaturateDList(VisMono* this, Gfx* gfx) {
|
|||
|
||||
// Set texel 1 to be a CI8 image with width `SCREEN_WIDTH * 2` and height `VISMONO_CFBFRAG_HEIGHT`
|
||||
// Its position in texture image space is shifted along +S by 1
|
||||
// Note the palette index for this tile has also been incremented from 0 to 1, however the palette index is
|
||||
// ignored for CI8 texture sampling.
|
||||
gDPSetTile(gfx++, G_IM_FMT_CI, G_IM_SIZ_8b, SCREEN_WIDTH * 2 * G_IM_SIZ_8b_LINE_BYTES / 8, 0x0, 1, 1,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, 0, 0, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0);
|
||||
gDPSetTileSize(gfx++, 1, 1 << 2, 0, (SCREEN_WIDTH * 2) << 2, (VISMONO_CFBFRAG_HEIGHT - 1) << 2);
|
||||
|
@ -129,8 +137,8 @@ Gfx* VisMono_DesaturateDList(VisMono* this, Gfx* gfx) {
|
|||
return gfx;
|
||||
}
|
||||
|
||||
void VisMono_Draw(VisMono* this, Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
void VisMono_Draw(VisMono* this, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
u16* tlut;
|
||||
Gfx* dList;
|
||||
Gfx* dListEnd;
|
||||
|
@ -159,12 +167,12 @@ void VisMono_Draw(VisMono* this, Gfx** gfxp) {
|
|||
|
||||
gDPPipeSync(gfx++);
|
||||
|
||||
if (this->setScissor == true) {
|
||||
if (this->vis.scissorType == VIS_SETSCISSOR) {
|
||||
gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->vis.primColor.rgba);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, this->vis.envColor.rgba);
|
||||
|
||||
gDPLoadTLUT_pal256(gfx++, tlut);
|
||||
|
||||
|
@ -172,7 +180,7 @@ void VisMono_Draw(VisMono* this, Gfx** gfxp) {
|
|||
|
||||
gDPPipeSync(gfx++);
|
||||
|
||||
*gfxp = gfx;
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
void VisMono_DrawOld(VisMono* this) {
|
||||
|
|
111
src/code/z_viszbuf.c
Normal file
111
src/code/z_viszbuf.c
Normal file
|
@ -0,0 +1,111 @@
|
|||
/**
|
||||
* @file z_viszbuf.c
|
||||
*
|
||||
* This file implements a full-screen framebuffer effect for visualizing the z-buffer (AKA depth buffer), using either
|
||||
* cycling RGBA or a single fading color.
|
||||
*
|
||||
* This is done by reading the z-buffer as if it were a color image, the format of which is specified by the selected
|
||||
* vis type:
|
||||
* - VIS_ZBUF_TYPE_IA : Produces a monotonic fade from primColor to envColor as depth increases.
|
||||
* - VIS_ZBUF_TYPE_RGBA : Produces vibrant almost-periodic-looking bands.
|
||||
*
|
||||
* In both cases this occurs because of the format the depth information takes: it is 18-bit, and is a nonnegative
|
||||
* floating-point number with
|
||||
* bbb mmmmmmmmmmm dd|dd
|
||||
* exponent mantissa dz value (only first 16 bits visible to CPU, the least significant 2 bits of dz are ignored)
|
||||
*
|
||||
* Reading z-buffer as IA16:
|
||||
* bbbmmmmm mmmmmmdd
|
||||
* iiiiiiii aaaaaaaa
|
||||
*
|
||||
* Since floating-point numbers of this format have the same ordering as their binary/hex representation, increasing
|
||||
* the depth also increases the intensity in the IA16 representation and hence the interpolation parameter used to
|
||||
* combine primColor and envColor. The alpha is ignored by the RenderMode.
|
||||
*
|
||||
* Reading z-buffer as RGBA16:
|
||||
* bbbmm mmmmm mmmmd d
|
||||
* rrrrr ggggg bbbbb a
|
||||
*
|
||||
* The red increases monotonically with the depth. The significant visible oscillation is the green component, because
|
||||
* it rolls over every time the second-most-significant bit of the mantissa increments. The blue component oscillates
|
||||
* too rapidly to be particularly visible (it rolls over when the 7th-most-significant bit increments). The alpha is
|
||||
* again ignored by the RenderMode.
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
// Height of the fragments the z-buffer is split into.
|
||||
// It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into TMEM.
|
||||
#define VISZBUF_ZBUFFRAG_HEIGHT (TMEM_SIZE / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES))
|
||||
|
||||
// z-buffer
|
||||
extern u16 D_0E000000[];
|
||||
|
||||
/**
|
||||
* Initialise to IA type with white and black as default colors.
|
||||
*/
|
||||
void VisZBuf_Init(VisZBuf* this) {
|
||||
this->vis.type = VIS_ZBUF_TYPE_IA;
|
||||
this->vis.scissorType = VIS_NO_SETSCISSOR;
|
||||
this->vis.primColor.r = 255;
|
||||
this->vis.primColor.g = 255;
|
||||
this->vis.primColor.b = 255;
|
||||
this->vis.primColor.a = 255;
|
||||
this->vis.envColor.a = 255;
|
||||
this->vis.envColor.r = 0;
|
||||
this->vis.envColor.g = 0;
|
||||
this->vis.envColor.b = 0;
|
||||
}
|
||||
|
||||
void VisZBuf_Destroy(VisZBuf* this) {
|
||||
}
|
||||
|
||||
void VisZBuf_Draw(VisZBuf* this, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
u16* zbufFrag = D_0E000000;
|
||||
s32 fmt;
|
||||
s32 y;
|
||||
s32 height;
|
||||
|
||||
if (this->vis.type == VIS_ZBUF_TYPE_IA) {
|
||||
fmt = G_IM_FMT_IA;
|
||||
} else { // VIS_ZBUF_TYPE_RGBA
|
||||
fmt = G_IM_FMT_RGBA;
|
||||
}
|
||||
|
||||
height = VISZBUF_ZBUFFRAG_HEIGHT;
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
// Scissoring is only required if the scissor has not been set prior.
|
||||
if (this->vis.scissorType == VIS_SETSCISSOR) {
|
||||
gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
// No palette so can use all of TMEM.
|
||||
// G_RM_OPA_SURF discards all information previously in the pixel, and the current alpha, leaving only the color
|
||||
// from this filter.
|
||||
gDPSetOtherMode(gfx++,
|
||||
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | G_RM_OPA_SURF | G_RM_OPA_SURF2);
|
||||
|
||||
// LERP between primColor and envColor in 1-cycle mode using the z-buffer value.
|
||||
gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT,
|
||||
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->vis.primColor.rgba);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, this->vis.envColor.rgba);
|
||||
|
||||
for (y = 0; y <= SCREEN_HEIGHT - height; y += height) {
|
||||
// Load a few lines of the z-buffer, as many as can fit in TMEM at once.
|
||||
gDPLoadTextureBlock(gfx++, zbufFrag, fmt, G_IM_SIZ_16b, SCREEN_WIDTH, height, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
// Overwrite them with the calculated colors.
|
||||
gSPTextureRectangle(gfx++, 0, y << 2, SCREEN_WIDTH << 2, (y + height) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10,
|
||||
1 << 10);
|
||||
zbufFrag += SCREEN_WIDTH * height;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
*gfxP = gfx;
|
||||
}
|
|
@ -47,7 +47,7 @@ u64 __fixunssfdi(f32 a) {
|
|||
u64 i;
|
||||
} m;
|
||||
|
||||
__asm__ ("cvt.l.s %0, %1" : "=f"(m.f) : "f"(a));
|
||||
__asm__("cvt.l.s %0, %1" : "=f"(m.f) : "f"(a));
|
||||
return m.i;
|
||||
}
|
||||
return 0;
|
||||
|
@ -61,7 +61,7 @@ u64 __fixunsdfdi(f64 a) {
|
|||
u64 i;
|
||||
} m;
|
||||
|
||||
__asm__ ("cvt.l.d %0, %1" : "=f"(m.f) : "f"(a));
|
||||
__asm__("cvt.l.d %0, %1" : "=f"(m.f) : "f"(a));
|
||||
return m.i;
|
||||
}
|
||||
return 0;
|
||||
|
@ -74,7 +74,7 @@ s64 __fixsfdi(f32 c) {
|
|||
s64 i;
|
||||
} m;
|
||||
|
||||
__asm__ ("cvt.l.s %0, %1" : "=f"(m.f) : "f"(c));
|
||||
__asm__("cvt.l.s %0, %1" : "=f"(m.f) : "f"(c));
|
||||
return m.i;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ s64 __fixdfdi(f64 c) {
|
|||
s64 i;
|
||||
} m;
|
||||
|
||||
__asm__ ("cvt.l.d %0, %1" : "=f"(m.f) : "f"(c));
|
||||
__asm__("cvt.l.d %0, %1" : "=f"(m.f) : "f"(c));
|
||||
return m.i;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ f32 __floatdisf(s64 c) {
|
|||
register f32 v;
|
||||
|
||||
m.i = c;
|
||||
__asm__ ("cvt.s.l %0, %1" : "=f"(v) : "f"(m.f));
|
||||
__asm__("cvt.s.l %0, %1" : "=f"(v) : "f"(m.f));
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ f64 __floatdidf(s64 c) {
|
|||
register f64 v;
|
||||
|
||||
m.i = c;
|
||||
__asm__ ("cvt.d.l %0, %1" : "=f"(v) : "f"(m.f));
|
||||
__asm__("cvt.d.l %0, %1" : "=f"(v) : "f"(m.f));
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ f32 __floatundisf(u64 c) {
|
|||
register f32 v;
|
||||
|
||||
m.i = c;
|
||||
__asm__ ("cvt.s.l %0, %1" : "=f"(v) : "f"(m.f));
|
||||
__asm__("cvt.s.l %0, %1" : "=f"(v) : "f"(m.f));
|
||||
if ((s64)c < 0) {
|
||||
// cvt.s.l assumes signed input, adjust output
|
||||
v += 4294967296.0f; // 2^32
|
||||
|
@ -141,7 +141,7 @@ f64 __floatundidf(u64 c) {
|
|||
register f64 v;
|
||||
|
||||
m.i = c;
|
||||
__asm__ ("cvt.d.l %0, %1" : "=f"(v) : "f"(m.f));
|
||||
__asm__("cvt.d.l %0, %1" : "=f"(v) : "f"(m.f));
|
||||
if ((s64)c < 0) {
|
||||
// cvt.d.l assumes signed input, adjust output
|
||||
v += 18446744073709551616.0; // 2^64
|
||||
|
|
|
@ -103,10 +103,10 @@ void BgBreakwall_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.actor.world.pos.y -= 40.0f;
|
||||
}
|
||||
|
||||
this->bankIndex = (wallType >= BWALL_KD_FLOOR) ? Object_GetIndex(&play->objectCtx, OBJECT_KINGDODONGO)
|
||||
: Object_GetIndex(&play->objectCtx, OBJECT_BWALL);
|
||||
this->requiredObjectSlot = (wallType >= BWALL_KD_FLOOR) ? Object_GetSlot(&play->objectCtx, OBJECT_KINGDODONGO)
|
||||
: Object_GetSlot(&play->objectCtx, OBJECT_BWALL);
|
||||
|
||||
if (this->bankIndex < 0) {
|
||||
if (this->requiredObjectSlot < 0) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
} else {
|
||||
BgBreakwall_SetupAction(this, BgBreakwall_WaitForObject);
|
||||
|
@ -201,11 +201,11 @@ Actor* BgBreakwall_SpawnFragments(PlayState* play, BgBreakwall* this, Vec3f* pos
|
|||
* Sets up the collision model as well is the object dependency and action function to use.
|
||||
*/
|
||||
void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;
|
||||
|
||||
this->dyna.actor.objBankIndex = this->bankIndex;
|
||||
this->dyna.actor.objectSlot = this->requiredObjectSlot;
|
||||
Actor_SetObjectDependency(play, &this->dyna.actor);
|
||||
this->dyna.actor.flags &= ~ACTOR_FLAG_4;
|
||||
this->dyna.actor.draw = BgBreakwall_Draw;
|
||||
|
|
|
@ -12,7 +12,7 @@ typedef struct BgBreakwall {
|
|||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ Gfx* bombableWallDList;
|
||||
/* 0x0168 */ s8 colType;
|
||||
/* 0x0169 */ s8 bankIndex;
|
||||
/* 0x0169 */ s8 requiredObjectSlot;
|
||||
/* 0x016C */ ColliderQuad collider;
|
||||
/* 0x01EC */ BgBreakwallActionFunc actionFunc;
|
||||
} BgBreakwall; // size = 0x01F0
|
||||
|
|
|
@ -60,7 +60,7 @@ void func_8087B758(BgHaka* this, Player* player) {
|
|||
|
||||
func_8002DBD0(&this->dyna.actor, &sp1C, &player->actor.world.pos);
|
||||
if (fabsf(sp1C.x) < 34.6f && sp1C.z > -112.8f && sp1C.z < -36.0f) {
|
||||
player->stateFlags2 |= PLAYER_STATE2_9;
|
||||
player->stateFlags2 |= PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,12 +66,12 @@ void BgHakaMegane_Init(Actor* thisx, PlayState* play) {
|
|||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
|
||||
if (thisx->params < 3) {
|
||||
this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS);
|
||||
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HAKACH_OBJECTS);
|
||||
} else {
|
||||
this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS);
|
||||
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HAKA_OBJECTS);
|
||||
}
|
||||
|
||||
if (this->objBankIndex < 0) {
|
||||
if (this->requiredObjectSlot < 0) {
|
||||
Actor_Kill(thisx);
|
||||
} else {
|
||||
this->actionFunc = func_8087DB24;
|
||||
|
@ -88,8 +88,8 @@ void func_8087DB24(BgHakaMegane* this, PlayState* play) {
|
|||
CollisionHeader* colHeader;
|
||||
CollisionHeader* collision;
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
|
||||
this->dyna.actor.objBankIndex = this->objBankIndex;
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
this->dyna.actor.objectSlot = this->requiredObjectSlot;
|
||||
this->dyna.actor.draw = BgHakaMegane_Draw;
|
||||
Actor_SetObjectDependency(play, &this->dyna.actor);
|
||||
if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) {
|
||||
|
|
|
@ -12,7 +12,7 @@ typedef struct BgHakaMegane {
|
|||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ BgHakaMeganeActionFunc actionFunc;
|
||||
/* 0x0168 */ char unk_168[0x1];
|
||||
/* 0x0169 */ s8 objBankIndex;
|
||||
/* 0x0169 */ s8 requiredObjectSlot;
|
||||
/* 0x016A */ char unk_16A[0x2];
|
||||
} BgHakaMegane; // size = 0x016C
|
||||
|
||||
|
|
|
@ -169,16 +169,16 @@ void BgHakaSgami_Init(Actor* thisx, PlayState* play) {
|
|||
Effect_Add(play, &this->blureEffectIndex[1], EFFECT_BLURE1, 0, 0, &blureInit);
|
||||
|
||||
if (thisx->params == SCYTHE_TRAP_SHADOW_TEMPLE) {
|
||||
this->requiredObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS);
|
||||
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HAKA_OBJECTS);
|
||||
thisx->flags &= ~ACTOR_FLAG_0;
|
||||
} else {
|
||||
this->requiredObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_ICE_OBJECTS);
|
||||
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ICE_OBJECTS);
|
||||
this->colliderScytheCenter.dim.radius = 30;
|
||||
this->colliderScytheCenter.dim.height = 70;
|
||||
Actor_SetFocus(thisx, 40.0f);
|
||||
}
|
||||
|
||||
if (this->requiredObjBankIndex < 0) {
|
||||
if (this->requiredObjectSlot < 0) {
|
||||
Actor_Kill(thisx);
|
||||
return;
|
||||
}
|
||||
|
@ -196,8 +196,8 @@ void BgHakaSgami_Destroy(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
void BgHakaSgami_SetupSpin(BgHakaSgami* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) {
|
||||
this->actor.objBankIndex = this->requiredObjBankIndex;
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
this->actor.objectSlot = this->requiredObjectSlot;
|
||||
this->actor.draw = BgHakaSgami_Draw;
|
||||
this->timer = SCYTHE_SPIN_TIME;
|
||||
this->actor.flags &= ~ACTOR_FLAG_4;
|
||||
|
|
|
@ -11,7 +11,7 @@ typedef void (*BgHakaSgamiActionFunc)(struct BgHakaSgami*, PlayState*);
|
|||
typedef struct BgHakaSgami {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ BgHakaSgamiActionFunc actionFunc;
|
||||
/* 0x0150 */ s8 requiredObjBankIndex;
|
||||
/* 0x0150 */ s8 requiredObjectSlot;
|
||||
/* 0x0151 */ s8 unk_151;
|
||||
/* 0x0152 */ s16 timer;
|
||||
/* 0x0154 */ s32 blureEffectIndex[2];
|
||||
|
|
|
@ -102,11 +102,11 @@ void BgHakaZou_Init(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
this->requiredObjBankIndex = (thisx->params == STA_BOMBABLE_RUBBLE)
|
||||
? Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS)
|
||||
: Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS);
|
||||
this->requiredObjectSlot = (thisx->params == STA_BOMBABLE_RUBBLE)
|
||||
? Object_GetSlot(&play->objectCtx, OBJECT_HAKACH_OBJECTS)
|
||||
: Object_GetSlot(&play->objectCtx, OBJECT_HAKA_OBJECTS);
|
||||
|
||||
if (this->requiredObjBankIndex < 0) {
|
||||
if (this->requiredObjectSlot < 0) {
|
||||
Actor_Kill(thisx);
|
||||
} else if ((thisx->params != STA_UNKNOWN) && Flags_GetSwitch(play, this->switchFlag)) {
|
||||
if (thisx->params != STA_GIANT_BIRD_STATUE) {
|
||||
|
@ -158,8 +158,8 @@ void func_808828F4(BgHakaZou* this, PlayState* play) {
|
|||
void BgHakaZou_Wait(BgHakaZou* this, PlayState* play) {
|
||||
CollisionHeader* colHeader;
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) {
|
||||
this->dyna.actor.objBankIndex = this->requiredObjBankIndex;
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
this->dyna.actor.objectSlot = this->requiredObjectSlot;
|
||||
this->dyna.actor.draw = BgHakaZou_Draw;
|
||||
|
||||
if (this->dyna.actor.params == STA_UNKNOWN) {
|
||||
|
|
|
@ -11,7 +11,7 @@ typedef void (*BgHakaZouActionFunc)(struct BgHakaZou*, PlayState*);
|
|||
typedef struct BgHakaZou {
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ BgHakaZouActionFunc actionFunc;
|
||||
/* 0x0168 */ s8 requiredObjBankIndex;
|
||||
/* 0x0168 */ s8 requiredObjectSlot;
|
||||
/* 0x0169 */ u8 switchFlag;
|
||||
/* 0x016A */ s16 timer;
|
||||
/* 0x016C */ ColliderCylinder collider;
|
||||
|
|
|
@ -117,8 +117,8 @@ void BgJyaBigmirror_SetBombiwaFlag(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) {
|
||||
static s16 sMirRayParamss[] = { 0x0005, 0x0007, 0x0008 };
|
||||
static Vec3f sMirRayPoss[] = {
|
||||
static s16 sMirRayParamsVals[] = { 0x0005, 0x0007, 0x0008 };
|
||||
static Vec3f sMirRayPositions[] = {
|
||||
{ 60.0f, 1802.0f, -1102.0f },
|
||||
{ -560.0f, 1800.0f, -310.0f },
|
||||
{ 60.0f, 1800.0f, -310.0f },
|
||||
|
@ -127,11 +127,11 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) {
|
|||
s32 puzzleSolved;
|
||||
s32 lightBeamToggles[3];
|
||||
s32 i;
|
||||
s32 objBankIndex;
|
||||
s32 mirRayObjectSlot;
|
||||
|
||||
objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MIR_RAY);
|
||||
mirRayObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MIR_RAY);
|
||||
|
||||
if ((objBankIndex < 0) || (objBankIndex != this->mirRayObjIndex)) {
|
||||
if ((mirRayObjectSlot < 0) || (mirRayObjectSlot != this->mirRayObjectSlot)) {
|
||||
this->lightBeams[2] = NULL;
|
||||
this->lightBeams[1] = NULL;
|
||||
this->lightBeams[0] = NULL;
|
||||
|
@ -152,9 +152,11 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) {
|
|||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (lightBeamToggles[i]) {
|
||||
if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&play->objectCtx, objBankIndex)) {
|
||||
this->lightBeams[i] = Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPoss[i].x,
|
||||
sMirRayPoss[i].y, sMirRayPoss[i].z, 0, 0, 0, sMirRayParamss[i]);
|
||||
if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&play->objectCtx, mirRayObjectSlot)) {
|
||||
|
||||
this->lightBeams[i] =
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPositions[i].x, sMirRayPositions[i].y,
|
||||
sMirRayPositions[i].z, 0, 0, 0, sMirRayParamsVals[i]);
|
||||
|
||||
if (this->lightBeams[i] == NULL) {
|
||||
// "Mir Ray generation failed"
|
||||
|
@ -169,7 +171,7 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
}
|
||||
}
|
||||
this->mirRayObjIndex = objBankIndex;
|
||||
this->mirRayObjectSlot = mirRayObjectSlot;
|
||||
}
|
||||
|
||||
void BgJyaBigmirror_Init(Actor* thisx, PlayState* play) {
|
||||
|
@ -186,7 +188,7 @@ void BgJyaBigmirror_Init(Actor* thisx, PlayState* play) {
|
|||
this->actor.room = -1;
|
||||
sIsSpawned = true;
|
||||
this->spawned = true;
|
||||
this->mirRayObjIndex = -1;
|
||||
this->mirRayObjectSlot = -1;
|
||||
|
||||
// "jya Bigmirror"
|
||||
osSyncPrintf("(jya 大鏡)(arg_data 0x%04x)\n", this->actor.params);
|
||||
|
|
|
@ -25,7 +25,7 @@ typedef struct BgJyaBigmirror {
|
|||
/* 0x015C */ u8 puzzleFlags;
|
||||
/* 0x015D */ u8 spawned;
|
||||
/* 0x0160 */ Actor* lightBeams[3];
|
||||
/* 0x016C */ s32 mirRayObjIndex;
|
||||
/* 0x016C */ s32 mirRayObjectSlot;
|
||||
/* 0x0170 */ f32 liftHeight;
|
||||
} BgJyaBigmirror; // size = 0x0174
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ static InitChainEntry sInitChain[] = {
|
|||
ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
static s16 sObjectIDs[] = { OBJECT_MJIN_FLASH, OBJECT_MJIN_DARK, OBJECT_MJIN_FLAME,
|
||||
static s16 sObjectIds[] = { OBJECT_MJIN_FLASH, OBJECT_MJIN_DARK, OBJECT_MJIN_FLAME,
|
||||
OBJECT_MJIN_ICE, OBJECT_MJIN_SOUL, OBJECT_MJIN_WIND };
|
||||
|
||||
void BgMjin_SetupAction(BgMjin* this, BgMjinActionFunc actionFunc) {
|
||||
|
@ -54,12 +54,12 @@ void BgMjin_SetupAction(BgMjin* this, BgMjinActionFunc actionFunc) {
|
|||
|
||||
void BgMjin_Init(Actor* thisx, PlayState* play) {
|
||||
BgMjin* this = (BgMjin*)thisx;
|
||||
s8 objBankIndex;
|
||||
s8 objectSlot;
|
||||
|
||||
Actor_ProcessInitChain(thisx, sInitChain);
|
||||
objBankIndex = Object_GetIndex(&play->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA));
|
||||
this->objBankIndex = objBankIndex;
|
||||
if (objBankIndex < 0) {
|
||||
objectSlot = Object_GetSlot(&play->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA));
|
||||
this->requiredObjectSlot = objectSlot;
|
||||
if (objectSlot < 0) {
|
||||
Actor_Kill(thisx);
|
||||
} else {
|
||||
BgMjin_SetupAction(this, func_808A0850);
|
||||
|
@ -76,10 +76,10 @@ void func_808A0850(BgMjin* this, PlayState* play) {
|
|||
CollisionHeader* colHeader;
|
||||
CollisionHeader* collision;
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
colHeader = NULL;
|
||||
this->dyna.actor.flags &= ~ACTOR_FLAG_4;
|
||||
this->dyna.actor.objBankIndex = this->objBankIndex;
|
||||
this->dyna.actor.objectSlot = this->requiredObjectSlot;
|
||||
Actor_SetObjectDependency(play, &this->dyna.actor);
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
collision = this->dyna.actor.params != 0 ? &gWarpPadCol : &gOcarinaWarpPadCol;
|
||||
|
@ -106,10 +106,10 @@ void BgMjin_Draw(Actor* thisx, PlayState* play) {
|
|||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mjin.c", 250);
|
||||
|
||||
if (thisx->params != 0) {
|
||||
s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIDs[thisx->params - 1]);
|
||||
s32 objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[thisx->params - 1]);
|
||||
|
||||
if (objBankIndex >= 0) {
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment);
|
||||
if (objectSlot >= 0) {
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment);
|
||||
}
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&D_06000000));
|
||||
|
|
|
@ -10,7 +10,7 @@ typedef void (*BgMjinActionFunc)(struct BgMjin*, PlayState*);
|
|||
|
||||
typedef struct BgMjin {
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ s8 objBankIndex;
|
||||
/* 0x0164 */ s8 requiredObjectSlot;
|
||||
/* 0x0168 */ BgMjinActionFunc actionFunc;
|
||||
} BgMjin; // size = 0x016C
|
||||
|
||||
|
|
|
@ -77,8 +77,8 @@ void BgMoriBigst_Init(Actor* thisx, PlayState* play) {
|
|||
GET_PLAYER(play)->actor.world.pos.y);
|
||||
BgMoriBigst_InitDynapoly(this, play, &gMoriBigstCol, 0);
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjIndex < 0) {
|
||||
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjectSlot < 0) {
|
||||
// "【Big Stalfos key ceiling】 bank danger!"
|
||||
osSyncPrintf("【ビッグスタルフォス鍵型天井】 バンク危険!\n");
|
||||
osSyncPrintf("%s %d\n", "../z_bg_mori_bigst.c", 234);
|
||||
|
@ -108,7 +108,7 @@ void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, PlayState* play) {
|
|||
void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, PlayState* play) {
|
||||
Actor* thisx = &this->dyna.actor;
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
|
||||
thisx->draw = BgMoriBigst_Draw;
|
||||
if (Flags_GetClear(play, thisx->room) && (GET_PLAYER(play)->actor.world.pos.y > 700.0f)) {
|
||||
if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) {
|
||||
|
@ -248,7 +248,7 @@ void BgMoriBigst_Draw(Actor* thisx, PlayState* play) {
|
|||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_bigst.c", 541);
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_bigst.c", 548),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
|
|
@ -12,7 +12,7 @@ typedef struct BgMoriBigst {
|
|||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ BgMoriBigstActionFunc actionFunc;
|
||||
/* 0x0168 */ s16 waitTimer;
|
||||
/* 0x016A */ s8 moriTexObjIndex;
|
||||
/* 0x016A */ s8 moriTexObjectSlot;
|
||||
} BgMoriBigst; // size = 0x016C
|
||||
|
||||
#endif
|
||||
|
|
|
@ -87,8 +87,8 @@ void BgMoriElevator_Init(Actor* thisx, PlayState* play) {
|
|||
CollisionHeader* colHeader = NULL;
|
||||
|
||||
this->unk_172 = sIsSpawned;
|
||||
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjIndex < 0) {
|
||||
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjectSlot < 0) {
|
||||
Actor_Kill(thisx);
|
||||
// "Forest Temple obj elevator Bank Danger!"
|
||||
osSyncPrintf("Error : 森の神殿 obj elevator バンク危険!(%s %d)\n", "../z_bg_mori_elevator.c", 277);
|
||||
|
@ -134,7 +134,7 @@ void BgMoriElevator_SetupWaitAfterInit(BgMoriElevator* this) {
|
|||
}
|
||||
|
||||
void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
|
||||
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
|
||||
if (play->roomCtx.curRoom.num == 2) {
|
||||
this->dyna.actor.world.pos.y = 73.0f;
|
||||
|
@ -255,7 +255,7 @@ void BgMoriElevator_Draw(Actor* thisx, PlayState* play) {
|
|||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_elevator.c", 575);
|
||||
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_elevator.c", 580),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gMoriElevatorDL);
|
||||
|
|
|
@ -14,7 +14,7 @@ typedef struct BgMoriElevator {
|
|||
/* 0x0168 */ f32 targetY;
|
||||
/* 0x016C */ s32 unk_16C;
|
||||
/* 0x0170 */ u8 unk_170;
|
||||
/* 0x0171 */ s8 moriTexObjIndex;
|
||||
/* 0x0171 */ s8 moriTexObjectSlot;
|
||||
/* 0x0172 */ s16 unk_172;
|
||||
} BgMoriElevator; // size = 0x0174
|
||||
|
||||
|
|
|
@ -164,8 +164,8 @@ void BgMoriHashigo_Init(Actor* thisx, PlayState* play) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjIndex < 0) {
|
||||
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjectSlot < 0) {
|
||||
// "Bank danger!"
|
||||
osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params,
|
||||
"../z_bg_mori_hashigo.c", 312);
|
||||
|
@ -194,7 +194,7 @@ void BgMoriHashigo_SetupWaitForMoriTex(BgMoriHashigo* this) {
|
|||
}
|
||||
|
||||
void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
|
||||
if (this->dyna.actor.params == HASHIGO_CLASP) {
|
||||
BgMoriHashigo_SetupClasp(this);
|
||||
} else if (this->dyna.actor.params == HASHIGO_LADDER) {
|
||||
|
@ -285,7 +285,7 @@ void BgMoriHashigo_Draw(Actor* thisx, PlayState* play) {
|
|||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 516);
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
if (1) {}
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 521),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
|
|
@ -15,7 +15,7 @@ typedef struct BgMoriHashigo {
|
|||
/* 0x01C4 */ BgMoriHashigoActionFunc actionFunc;
|
||||
/* 0x01C8 */ s16 hitTimer;
|
||||
/* 0x01CA */ s16 bounceCounter;
|
||||
/* 0x01CC */ s8 moriTexObjIndex;
|
||||
/* 0x01CC */ s8 moriTexObjectSlot;
|
||||
} BgMoriHashigo; // size = 0x01D0
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -78,8 +78,8 @@ void BgMoriHashira4_Init(Actor* thisx, PlayState* play) {
|
|||
BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira2Col, 0);
|
||||
}
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjIndex < 0) {
|
||||
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjectSlot < 0) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
// "Bank danger!"
|
||||
osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params,
|
||||
|
@ -109,7 +109,7 @@ void BgMoriHashira4_SetupWaitForMoriTex(BgMoriHashira4* this) {
|
|||
}
|
||||
|
||||
void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
|
||||
this->gateTimer = 0;
|
||||
if (this->dyna.actor.params == 0) {
|
||||
BgMoriHashira4_SetupPillarsRotate(this);
|
||||
|
@ -163,7 +163,7 @@ void BgMoriHashira4_Draw(Actor* thisx, PlayState* play) {
|
|||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hashira4.c", 339);
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hashira4.c", 344),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
|
|
@ -11,7 +11,7 @@ typedef void (*BgMoriHashira4ActionFunc)(struct BgMoriHashira4*, PlayState*);
|
|||
typedef struct BgMoriHashira4 {
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ BgMoriHashira4ActionFunc actionFunc;
|
||||
/* 0x0168 */ s8 moriTexObjIndex;
|
||||
/* 0x0168 */ s8 moriTexObjectSlot;
|
||||
/* 0x0169 */ s8 switchFlag;
|
||||
/* 0x016A */ s16 gateTimer;
|
||||
} BgMoriHashira4; // size = 0x016C
|
||||
|
|
|
@ -54,7 +54,7 @@ static Gfx* sDLists[] = {
|
|||
|
||||
void BgMoriHineri_Init(Actor* thisx, PlayState* play) {
|
||||
BgMoriHineri* this = (BgMoriHineri*)thisx;
|
||||
s8 moriHineriObjIdx;
|
||||
s8 objectSlot;
|
||||
u32 switchFlagParam;
|
||||
s32 t6;
|
||||
|
||||
|
@ -78,26 +78,26 @@ void BgMoriHineri_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.actor.params = 3;
|
||||
}
|
||||
}
|
||||
this->boxObjIdx = -1;
|
||||
this->boxObjectSlot = -1;
|
||||
if (this->dyna.actor.params == 0) {
|
||||
this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1);
|
||||
this->moriHineriObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1);
|
||||
if (t6 == 0) {
|
||||
this->boxObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOX);
|
||||
this->boxObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOX);
|
||||
}
|
||||
} else {
|
||||
if (this->dyna.actor.params == 1) {
|
||||
moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1A);
|
||||
objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1A);
|
||||
} else {
|
||||
moriHineriObjIdx = (this->dyna.actor.params == 2) ? Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2)
|
||||
: Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2A);
|
||||
objectSlot = (this->dyna.actor.params == 2) ? Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2)
|
||||
: Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2A);
|
||||
}
|
||||
this->moriHineriObjIdx = moriHineriObjIdx;
|
||||
this->moriHineriObjectSlot = objectSlot;
|
||||
}
|
||||
this->moriTexObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (t6 != 0) {
|
||||
this->dyna.actor.params += 4;
|
||||
}
|
||||
if ((this->moriHineriObjIdx < 0) || (this->moriTexObjIdx < 0)) {
|
||||
if ((this->moriHineriObjectSlot < 0) || (this->moriTexObjectSlot < 0)) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
} else {
|
||||
this->actionFunc = func_808A39FC;
|
||||
|
@ -112,22 +112,22 @@ void BgMoriHineri_Destroy(Actor* thisx, PlayState* play) {
|
|||
void func_808A39FC(BgMoriHineri* this, PlayState* play) {
|
||||
CollisionHeader* colHeader;
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriHineriObjIdx) &&
|
||||
Object_IsLoaded(&play->objectCtx, this->moriTexObjIdx) &&
|
||||
((this->boxObjIdx < 0) || Object_IsLoaded(&play->objectCtx, this->boxObjIdx))) {
|
||||
this->dyna.actor.objBankIndex = this->moriHineriObjIdx;
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriHineriObjectSlot) &&
|
||||
Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot) &&
|
||||
((this->boxObjectSlot < 0) || Object_IsLoaded(&play->objectCtx, this->boxObjectSlot))) {
|
||||
this->dyna.actor.objectSlot = this->moriHineriObjectSlot;
|
||||
if (this->dyna.actor.params >= 4) {
|
||||
this->dyna.actor.params -= 4;
|
||||
if (this->dyna.actor.params == 0) {
|
||||
this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1A);
|
||||
this->moriHineriObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1A);
|
||||
} else if (this->dyna.actor.params == 1) {
|
||||
this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1);
|
||||
this->moriHineriObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1);
|
||||
} else {
|
||||
this->moriHineriObjIdx = (this->dyna.actor.params == 2)
|
||||
? Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2A)
|
||||
: Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2);
|
||||
this->moriHineriObjectSlot = (this->dyna.actor.params == 2)
|
||||
? Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2A)
|
||||
: Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2);
|
||||
}
|
||||
if (this->moriHineriObjIdx < 0) {
|
||||
if (this->moriHineriObjectSlot < 0) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
} else {
|
||||
this->actionFunc = func_808A3D58;
|
||||
|
@ -194,13 +194,13 @@ void func_808A3D58(BgMoriHineri* this, PlayState* play) {
|
|||
}
|
||||
|
||||
void func_808A3E54(BgMoriHineri* this, PlayState* play) {
|
||||
s8 objBankIndex;
|
||||
s8 objectSlot;
|
||||
|
||||
if (play->activeCamId == sSubCamId) {
|
||||
if (sSubCamId != SUB_CAM_ID_DONE) {
|
||||
objBankIndex = this->dyna.actor.objBankIndex;
|
||||
this->dyna.actor.objBankIndex = this->moriHineriObjIdx;
|
||||
this->moriHineriObjIdx = objBankIndex;
|
||||
objectSlot = this->dyna.actor.objectSlot;
|
||||
this->dyna.actor.objectSlot = this->moriHineriObjectSlot;
|
||||
this->moriHineriObjectSlot = objectSlot;
|
||||
this->dyna.actor.params ^= 1;
|
||||
sSubCamId = SUB_CAM_ID_DONE;
|
||||
Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR);
|
||||
|
@ -223,17 +223,17 @@ void BgMoriHineri_Update(Actor* thisx, PlayState* play) {
|
|||
|
||||
void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) {
|
||||
BgMoriHineri* this = (BgMoriHineri*)thisx;
|
||||
s8 objIndex;
|
||||
s32 pad;
|
||||
MtxF mtx;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hineri.c", 611);
|
||||
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIdx].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hineri.c", 618),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, sDLists[this->dyna.actor.params]);
|
||||
if (this->boxObjIdx > 0) {
|
||||
if (this->boxObjectSlot > 0) {
|
||||
Matrix_Get(&mtx);
|
||||
}
|
||||
if ((this->actionFunc == func_808A3C8C) && (this->dyna.actor.shape.rot.z != 0)) {
|
||||
|
@ -249,9 +249,9 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) {
|
|||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gDungeonDoorDL);
|
||||
}
|
||||
if ((this->boxObjIdx > 0) && ((this->boxObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOX)) > 0) &&
|
||||
Object_IsLoaded(&play->objectCtx, this->boxObjIdx)) {
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->boxObjIdx].segment);
|
||||
if ((this->boxObjectSlot > 0) && ((this->boxObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOX)) > 0) &&
|
||||
Object_IsLoaded(&play->objectCtx, this->boxObjectSlot)) {
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->boxObjectSlot].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]);
|
||||
Matrix_Put(&mtx);
|
||||
Matrix_Translate(147.0f, -245.0f, -453.0f, MTXMODE_APPLY);
|
||||
|
|
|
@ -11,9 +11,9 @@ typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, PlayState*);
|
|||
typedef struct BgMoriHineri {
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ BgMoriHineriActionFunc actionFunc;
|
||||
/* 0x0168 */ s8 moriHineriObjIdx;
|
||||
/* 0x0169 */ s8 moriTexObjIdx;
|
||||
/* 0x016A */ s8 boxObjIdx;
|
||||
/* 0x0168 */ s8 moriHineriObjectSlot;
|
||||
/* 0x0169 */ s8 moriTexObjectSlot;
|
||||
/* 0x016A */ s8 boxObjectSlot;
|
||||
/* 0x016B */ s8 switchFlag;
|
||||
} BgMoriHineri; // size = 0x016C
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ void BgMoriIdomizu_Init(Actor* thisx, PlayState* play) {
|
|||
this->actor.world.pos.y = 184.0f;
|
||||
BgMoriIdomizu_SetWaterLevel(play, 184);
|
||||
}
|
||||
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjIndex < 0) {
|
||||
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjectSlot < 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
// "Bank danger!"
|
||||
osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_bg_mori_idomizu.c",
|
||||
|
@ -96,7 +96,7 @@ void BgMoriIdomizu_SetupWaitForMoriTex(BgMoriIdomizu* this) {
|
|||
}
|
||||
|
||||
void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
|
||||
BgMoriIdomizu_SetupMain(this);
|
||||
this->actor.draw = BgMoriIdomizu_Draw;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ void BgMoriIdomizu_Draw(Actor* thisx, PlayState* play) {
|
|||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_idomizu.c", 360),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
|
||||
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 128);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ typedef struct BgMoriIdomizu {
|
|||
/* 0x0154 */ s32 prevSwitchFlagSet;
|
||||
/* 0x0158 */ s16 isLoaded;
|
||||
/* 0x015A */ s16 drainTimer;
|
||||
/* 0x015C */ s8 moriTexObjIndex;
|
||||
/* 0x015C */ s8 moriTexObjectSlot;
|
||||
} BgMoriIdomizu; // size = 0x0160
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,8 +56,8 @@ void BgMoriKaitenkabe_Init(Actor* thisx, PlayState* play) {
|
|||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
CollisionHeader_GetVirtual(&gMoriKaitenkabeCol, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjIndex < 0) {
|
||||
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjectSlot < 0) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
// "【Rotating wall】 Bank danger!"
|
||||
osSyncPrintf("【回転壁】 バンク危険!(%s %d)\n", "../z_bg_mori_kaitenkabe.c", 176);
|
||||
|
@ -74,7 +74,7 @@ void BgMoriKaitenkabe_Destroy(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
|
||||
BgMoriKaitenkabe_SetupWait(this);
|
||||
this->dyna.actor.draw = BgMoriKaitenkabe_Draw;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ void BgMoriKaitenkabe_Draw(Actor* thisx, PlayState* play) {
|
|||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 347);
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 352),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
|
|
@ -16,7 +16,7 @@ typedef struct BgMoriKaitenkabe {
|
|||
/* 0x0170 */ f32 rotSpeed;
|
||||
/* 0x0174 */ f32 rotYdeg;
|
||||
/* 0x0178 */ Vec3f lockedPlayerPos;
|
||||
/* 0x0184 */ s8 moriTexObjIndex;
|
||||
/* 0x0184 */ s8 moriTexObjectSlot;
|
||||
} BgMoriKaitenkabe; // size = 0x0188
|
||||
|
||||
#endif
|
||||
|
|
|
@ -64,8 +64,8 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) {
|
|||
// "The set Angle has changed. Let's fix the program."
|
||||
osSyncPrintf("Warning : セット Angle が変更されています。プログラムを修正しましょう。\n");
|
||||
}
|
||||
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjIndex < 0) {
|
||||
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjectSlot < 0) {
|
||||
// "Forest Temple obj Falling Ceiling Bank Danger!"
|
||||
osSyncPrintf("Error : 森の神殿 obj 落下天井 バンク危険!(%s %d)\n", "../z_bg_mori_rakkatenjo.c", 205);
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
|
@ -102,7 +102,7 @@ void BgMoriRakkatenjo_SetupWaitForMoriTex(BgMoriRakkatenjo* this) {
|
|||
}
|
||||
|
||||
void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
|
||||
BgMoriRakkatenjo_SetupWait(this);
|
||||
this->dyna.actor.draw = BgMoriRakkatenjo_Draw;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ void BgMoriRakkatenjo_Draw(Actor* thisx, PlayState* play) {
|
|||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 497);
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 502),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
|
|
@ -14,7 +14,7 @@ typedef struct BgMoriRakkatenjo {
|
|||
/* 0x0168 */ s32 timer;
|
||||
/* 0x016C */ s32 bounceCount;
|
||||
/* 0x0170 */ s32 fallCount;
|
||||
/* 0x0174 */ s8 moriTexObjIndex;
|
||||
/* 0x0174 */ s8 moriTexObjectSlot;
|
||||
} BgMoriRakkatenjo; // size = 0x0178
|
||||
|
||||
#endif
|
||||
|
|
|
@ -59,8 +59,8 @@ void BgSpot01Objects2_Init(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
if (this->objectId >= 0) {
|
||||
this->objBankIndex = Object_GetIndex(&play->objectCtx, this->objectId);
|
||||
if (this->objBankIndex < 0) {
|
||||
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->objectId);
|
||||
if (this->requiredObjectSlot < 0) {
|
||||
// "There was no bank setting."
|
||||
osSyncPrintf("-----------------------------バンク設定ありませんでした.");
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
|
@ -91,12 +91,12 @@ void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) {
|
|||
s32 pad;
|
||||
Vec3f position;
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
// "---- Successful bank switching!!"
|
||||
osSyncPrintf("-----バンク切り換え成功!!\n");
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment);
|
||||
|
||||
this->dyna.actor.objBankIndex = this->objBankIndex;
|
||||
this->dyna.actor.objectSlot = this->requiredObjectSlot;
|
||||
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
|
||||
|
||||
switch (this->dyna.actor.params & 7) {
|
||||
|
|
|
@ -13,7 +13,7 @@ typedef struct BgSpot01Objects2 {
|
|||
/* 0x0164 */ BgSpot01Objects2ActionFunc actionFunc;
|
||||
/* 0x0168 */ char unk_168[0x10];
|
||||
/* 0x0178 */ s32 objectId;
|
||||
/* 0x017C */ s8 objBankIndex;
|
||||
/* 0x017C */ s8 requiredObjectSlot;
|
||||
} BgSpot01Objects2; // size = 0x0180
|
||||
|
||||
#endif
|
||||
|
|
|
@ -218,9 +218,9 @@ s32 func_808B4E58(BgSpot16Bombstone* this, PlayState* play) {
|
|||
actor->shape.rot.z = D_808B5DD8[actor->params][9];
|
||||
|
||||
this->dList = object_bombiwa_DL_0009E0;
|
||||
this->bombiwaBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_BOMBIWA);
|
||||
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOMBIWA);
|
||||
|
||||
if (this->bombiwaBankIndex < 0) {
|
||||
if (this->requiredObjectSlot < 0) {
|
||||
osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", actor->params, "../z_bg_spot16_bombstone.c",
|
||||
589);
|
||||
return false;
|
||||
|
@ -486,7 +486,7 @@ void func_808B5AF0(BgSpot16Bombstone* this) {
|
|||
}
|
||||
|
||||
void func_808B5B04(BgSpot16Bombstone* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->bombiwaBankIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
func_808B5B58(this);
|
||||
this->actor.draw = BgSpot16Bombstone_Draw;
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ void BgSpot16Bombstone_Draw(Actor* thisx, PlayState* play) {
|
|||
gSPDisplayList(POLY_OPA_DISP++, this->dList);
|
||||
} else {
|
||||
// The boulder is debris
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->bombiwaBankIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->requiredObjectSlot].segment);
|
||||
gSPDisplayList(POLY_OPA_DISP++, this->dList);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ typedef struct BgSpot16Bombstone {
|
|||
/* 0x01C4 */ ColliderCylinder colliderCylinder;
|
||||
/* 0x0210 */ s16 unk_210;
|
||||
/* 0x0212 */ s16 unk_212;
|
||||
/* 0x0214 */ s8 bombiwaBankIndex;
|
||||
/* 0x0214 */ s8 requiredObjectSlot;
|
||||
} BgSpot16Bombstone; // size = 0x0218
|
||||
|
||||
#endif
|
||||
|
|
|
@ -321,8 +321,8 @@ void BossGanon_SetColliderPos(Vec3f* pos, ColliderCylinder* collider) {
|
|||
}
|
||||
|
||||
void BossGanon_SetAnimationObject(BossGanon* this, PlayState* play, s32 objectId) {
|
||||
this->animBankIndex = Object_GetIndex(&play->objectCtx, objectId);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment);
|
||||
this->animObjectSlot = Object_GetSlot(&play->objectCtx, objectId);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment);
|
||||
}
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
|
@ -474,18 +474,18 @@ void BossGanon_Destroy(Actor* thisx, PlayState* play) {
|
|||
|
||||
void BossGanon_SetupIntroCutscene(BossGanon* this, PlayState* play) {
|
||||
s32 pad;
|
||||
s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2);
|
||||
s32 animObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME2);
|
||||
|
||||
if (animBankIndex < 0) {
|
||||
if (animObjectSlot < 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, animBankIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) {
|
||||
this->actionFunc = BossGanon_IntroCutscene;
|
||||
this->unk_198 = 1;
|
||||
this->animBankIndex = animBankIndex;
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment);
|
||||
this->animObjectSlot = animObjectSlot;
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment);
|
||||
Animation_MorphToLoop(&this->skelAnime, &gGanondorfPlayOrganAnim, 0.0f);
|
||||
} else {
|
||||
this->actionFunc = BossGanon_SetupIntroCutscene;
|
||||
|
@ -533,7 +533,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
|
|||
f32 cos;
|
||||
Camera* mainCam;
|
||||
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment);
|
||||
|
||||
sCape->backPush = -2.0f;
|
||||
sCape->backSwayMagnitude = 0.25f;
|
||||
|
@ -1079,8 +1079,8 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
|
|||
}
|
||||
|
||||
if (this->csTimer == 50) {
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(
|
||||
play->objectCtx.status[Object_GetIndex(&play->objectCtx, OBJECT_GANON)].segment);
|
||||
gSegments[6] =
|
||||
VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[Object_GetSlot(&play->objectCtx, OBJECT_GANON)].segment);
|
||||
|
||||
if (!GET_EVENTCHKINF(EVENTCHKINF_78)) {
|
||||
TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gGanondorfTitleCardTex),
|
||||
|
@ -1163,14 +1163,14 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
|
|||
|
||||
void BossGanon_SetupDeathCutscene(BossGanon* this, PlayState* play) {
|
||||
s32 pad;
|
||||
s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2);
|
||||
s32 animObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME2);
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, animBankIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) {
|
||||
this->actionFunc = BossGanon_DeathAndTowerCutscene;
|
||||
this->csTimer = this->csState = 0;
|
||||
this->unk_198 = 1;
|
||||
this->animBankIndex = animBankIndex;
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment);
|
||||
this->animObjectSlot = animObjectSlot;
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment);
|
||||
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f);
|
||||
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim);
|
||||
this->unk_508 = 0.0f;
|
||||
|
@ -1179,11 +1179,11 @@ void BossGanon_SetupDeathCutscene(BossGanon* this, PlayState* play) {
|
|||
|
||||
void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play) {
|
||||
s32 pad;
|
||||
s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2);
|
||||
s32 animObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME2);
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, animBankIndex)) {
|
||||
this->animBankIndex = animBankIndex;
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment);
|
||||
if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) {
|
||||
this->animObjectSlot = animObjectSlot;
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment);
|
||||
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f);
|
||||
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim);
|
||||
this->actionFunc = BossGanon_DeathAndTowerCutscene;
|
||||
|
@ -1226,7 +1226,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
|
|||
Camera* mainCam;
|
||||
Vec3f sp64;
|
||||
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment);
|
||||
|
||||
this->csTimer++;
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
|
@ -2796,7 +2796,7 @@ void BossGanon_Update(Actor* thisx, PlayState* play2) {
|
|||
if ((this->actionFunc != BossGanon_IntroCutscene) && (this->actionFunc != BossGanon_DeathAndTowerCutscene)) {
|
||||
BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1);
|
||||
} else {
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment);
|
||||
}
|
||||
|
||||
if (this->windowShatterState != GDF_WINDOW_SHATTER_OFF) {
|
||||
|
|
|
@ -85,7 +85,7 @@ typedef enum {
|
|||
|
||||
typedef struct BossGanon {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ s32 animBankIndex;
|
||||
/* 0x014C */ s32 animObjectSlot;
|
||||
/* 0x0150 */ SkelAnime skelAnime;
|
||||
/* 0x0194 */ BossGanonActionFunc actionFunc;
|
||||
/* 0x0198 */ u8 unk_198;
|
||||
|
|
|
@ -78,15 +78,15 @@ void func_808FD080(s32 idx, ColliderJntSph* collider, Vec3f* arg2) {
|
|||
|
||||
void BossGanon2_SetObjectSegment(BossGanon2* this, PlayState* play, s32 objectId, u8 setRSPSegment) {
|
||||
s32 pad;
|
||||
s32 objectIdx = Object_GetIndex(&play->objectCtx, objectId);
|
||||
s32 objectSlot = Object_GetSlot(&play->objectCtx, objectId);
|
||||
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIdx].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment);
|
||||
|
||||
if (setRSPSegment) {
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 790);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIdx].segment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[objectIdx].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 799);
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
|
|||
s16 pad;
|
||||
u8 sp8D;
|
||||
Player* player;
|
||||
s32 objectIdx;
|
||||
s32 objectSlot;
|
||||
s32 zero = 0;
|
||||
s32 pad2;
|
||||
|
||||
|
@ -193,8 +193,8 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
|
|||
|
||||
switch (this->unk_39C) {
|
||||
case 0:
|
||||
objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME3);
|
||||
if (Object_IsLoaded(&play->objectCtx, objectIdx)) {
|
||||
objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME3);
|
||||
if (Object_IsLoaded(&play->objectCtx, objectSlot)) {
|
||||
Cutscene_StartManual(play, &play->csCtx);
|
||||
func_8002DF54(play, &this->actor, PLAYER_CSMODE_8);
|
||||
this->subCamId = Play_CreateSubCamera(play);
|
||||
|
@ -1040,10 +1040,10 @@ void func_808FFCFC(BossGanon2* this, PlayState* play) {
|
|||
|
||||
void func_808FFDB0(BossGanon2* this, PlayState* play) {
|
||||
s32 sp28;
|
||||
s32 objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON2);
|
||||
s32 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON2);
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, objectIdx)) {
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIdx].segment);
|
||||
if (Object_IsLoaded(&play->objectCtx, objectSlot)) {
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment);
|
||||
Animation_MorphToLoop(&this->skelAnime, &gGanonGuardIdleAnim, -10.0f);
|
||||
this->actionFunc = func_808FFEBC;
|
||||
|
||||
|
|
|
@ -2083,7 +2083,7 @@ void BossGoma_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r
|
|||
sDeadLimbLifetime[limbIndex] + 100);
|
||||
if (babyGohma != NULL) {
|
||||
babyGohma->bossLimbDL = *dList;
|
||||
babyGohma->actor.objBankIndex = this->actor.objBankIndex;
|
||||
babyGohma->actor.objectSlot = this->actor.objectSlot;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -756,7 +756,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
if (this->work[MO_TENT_ACTION_STATE] == MO_TENT_GRAB) {
|
||||
player->unk_850 = 0xA;
|
||||
player->actionVar2 = 0xA;
|
||||
player->actor.speed = player->actor.velocity.y = 0;
|
||||
Math_ApproachF(&player->actor.world.pos.x, this->grabPosRot.pos.x, 0.5f, 20.0f);
|
||||
Math_ApproachF(&player->actor.world.pos.y, this->grabPosRot.pos.y, 0.5f, 20.0f);
|
||||
|
@ -814,7 +814,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
|
|||
Math_ApproachS(&this->tentRot[indS1].z, tempf2, 1.0f / this->tentMaxAngle, this->tentSpeed);
|
||||
}
|
||||
}
|
||||
player->unk_850 = 0xA;
|
||||
player->actionVar2 = 0xA;
|
||||
player->actor.world.pos.x = this->grabPosRot.pos.x;
|
||||
player->actor.world.pos.y = this->grabPosRot.pos.y;
|
||||
player->actor.world.pos.z = this->grabPosRot.pos.z;
|
||||
|
@ -833,7 +833,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
|
|||
this->work[MO_TENT_ACTION_STATE] = MO_TENT_RETREAT;
|
||||
this->work[MO_TENT_INVINC_TIMER] = 50;
|
||||
if (&this->actor == player->actor.parent) {
|
||||
player->unk_850 = 0x65;
|
||||
player->actionVar2 = 0x65;
|
||||
player->actor.parent = NULL;
|
||||
player->csMode = PLAYER_CSMODE_NONE;
|
||||
if (this->timers[0] == 0) {
|
||||
|
@ -863,7 +863,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
|
|||
case MO_TENT_CUT:
|
||||
Sfx_PlaySfxAtPos(&this->tentTipPos, NA_SE_EV_WATER_WALL - SFX_FLAG);
|
||||
if (&this->actor == player->actor.parent) {
|
||||
player->unk_850 = 0x65;
|
||||
player->actionVar2 = 0x65;
|
||||
player->actor.parent = NULL;
|
||||
player->csMode = PLAYER_CSMODE_NONE;
|
||||
}
|
||||
|
@ -1784,7 +1784,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) {
|
|||
sMorphaTent2->tent2KillTimer = 1;
|
||||
}
|
||||
if (player->actor.parent != NULL) {
|
||||
player->unk_850 = 0x65;
|
||||
player->actionVar2 = 0x65;
|
||||
player->actor.parent = NULL;
|
||||
player->csMode = PLAYER_CSMODE_NONE;
|
||||
}
|
||||
|
@ -1803,7 +1803,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) {
|
|||
sMorphaTent1->timers[0] = 40;
|
||||
sMorphaTent1->actor.flags &= ~ACTOR_FLAG_0;
|
||||
if (player->actor.parent == &sMorphaTent1->actor) {
|
||||
player->unk_850 = 0x65;
|
||||
player->actionVar2 = 0x65;
|
||||
player->actor.parent = NULL;
|
||||
player->csMode = PLAYER_CSMODE_NONE;
|
||||
}
|
||||
|
|
|
@ -1749,7 +1749,7 @@ void BossSst_HandClap(BossSst* this, PlayState* play) {
|
|||
}
|
||||
|
||||
if (player->actor.parent == &this->actor) {
|
||||
player->unk_850 = 0;
|
||||
player->actionVar2 = 0;
|
||||
player->actor.world.pos = this->actor.world.pos;
|
||||
}
|
||||
}
|
||||
|
@ -1844,7 +1844,7 @@ void BossSst_HandGrab(BossSst* this, PlayState* play) {
|
|||
this->actor.world.pos.x += this->actor.speed * Math_SinS(this->actor.world.rot.y);
|
||||
this->actor.world.pos.z += this->actor.speed * Math_CosS(this->actor.world.rot.y);
|
||||
if (player->stateFlags2 & PLAYER_STATE2_7) {
|
||||
player->unk_850 = 0;
|
||||
player->actionVar2 = 0;
|
||||
player->actor.world.pos = this->actor.world.pos;
|
||||
player->actor.shape.rot.y = this->actor.shape.rot.y;
|
||||
}
|
||||
|
@ -1938,7 +1938,7 @@ void BossSst_HandSwing(BossSst* this, PlayState* play) {
|
|||
}
|
||||
|
||||
if (player->stateFlags2 & PLAYER_STATE2_7) {
|
||||
player->unk_850 = 0;
|
||||
player->actionVar2 = 0;
|
||||
Math_Vec3f_Copy(&player->actor.world.pos, &this->actor.world.pos);
|
||||
player->actor.shape.rot.x = this->actor.shape.rot.x;
|
||||
player->actor.shape.rot.z = (this->vParity * -0x4000) + this->actor.shape.rot.z;
|
||||
|
@ -2422,7 +2422,7 @@ void BossSst_HandReleasePlayer(BossSst* this, PlayState* play, s32 dropPlayer) {
|
|||
|
||||
if (player->actor.parent == &this->actor) {
|
||||
player->actor.parent = NULL;
|
||||
player->unk_850 = 100;
|
||||
player->actionVar2 = 100;
|
||||
this->colliderJntSph.base.ocFlags1 |= OC1_ON;
|
||||
OTHER_HAND(this)->colliderJntSph.base.ocFlags1 |= OC1_ON;
|
||||
if (dropPlayer) {
|
||||
|
|
|
@ -17,7 +17,7 @@ void Demo6K_Init(Actor* thisx, PlayState* play);
|
|||
void Demo6K_Destroy(Actor* thisx, PlayState* play);
|
||||
void Demo6K_Update(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_80966DB0(Demo6K* this, PlayState* play);
|
||||
void Demo6K_WaitForObject(Demo6K* this, PlayState* play);
|
||||
void func_80966E04(Demo6K* this, PlayState* play);
|
||||
void func_80966E98(Demo6K* this, PlayState* play);
|
||||
void func_80966F84(Demo6K* this, PlayState* play);
|
||||
|
@ -69,26 +69,26 @@ void Demo6K_Init(Actor* thisx, PlayState* play) {
|
|||
Demo6K* this = (Demo6K*)thisx;
|
||||
s32 pad;
|
||||
s32 params = this->actor.params;
|
||||
s32 objBankIndex;
|
||||
s32 objectSlot;
|
||||
s32 i;
|
||||
|
||||
osSyncPrintf("no = %d\n", params);
|
||||
|
||||
if (sObjectIds[params] != OBJECT_GAMEPLAY_KEEP) {
|
||||
objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[params]);
|
||||
objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[params]);
|
||||
} else {
|
||||
objBankIndex = 0;
|
||||
objectSlot = 0;
|
||||
}
|
||||
|
||||
osSyncPrintf("bank_ID = %d\n", objBankIndex);
|
||||
osSyncPrintf("bank_ID = %d\n", objectSlot);
|
||||
|
||||
if (objBankIndex < 0) {
|
||||
if (objectSlot < 0) {
|
||||
ASSERT(0, "0", "../z_demo_6k.c", 334);
|
||||
} else {
|
||||
this->objBankIndex = objBankIndex;
|
||||
this->requiredObjectSlot = objectSlot;
|
||||
}
|
||||
|
||||
Demo6K_SetupAction(this, func_80966DB0);
|
||||
Demo6K_SetupAction(this, Demo6K_WaitForObject);
|
||||
this->timer1 = 0;
|
||||
this->flags = 0;
|
||||
this->timer2 = 0;
|
||||
|
@ -197,9 +197,9 @@ void Demo6K_Destroy(Actor* thisx, PlayState* play) {
|
|||
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode);
|
||||
}
|
||||
|
||||
void func_80966DB0(Demo6K* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
|
||||
this->actor.objBankIndex = this->objBankIndex;
|
||||
void Demo6K_WaitForObject(Demo6K* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
this->actor.objectSlot = this->requiredObjectSlot;
|
||||
this->actor.draw = this->drawFunc;
|
||||
this->actionFunc = this->initActionFunc;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ typedef struct Demo6K {
|
|||
/* 0x028C */ u16 flags;
|
||||
/* 0x028E */ u16 timer1;
|
||||
/* 0x0290 */ u16 timer2;
|
||||
/* 0x0292 */ u8 objBankIndex;
|
||||
/* 0x0292 */ u8 requiredObjectSlot;
|
||||
/* 0x0293 */ u8 unk_293;
|
||||
} Demo6K; // size = 0x0294
|
||||
|
||||
|
|
|
@ -314,22 +314,22 @@ void DemoEc_DrawSkeletonCustomColor(DemoEc* this, PlayState* play, Gfx* arg2, Gf
|
|||
|
||||
void DemoEc_UseDrawObject(DemoEc* this, PlayState* play) {
|
||||
s32 pad[2];
|
||||
s32 drawObjBankIndex = this->drawObjBankIndex;
|
||||
s32 drawObjectSlot = this->drawObjectSlot;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_demo_ec.c", 662);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[drawObjBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[drawObjBankIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[drawObjectSlot].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[drawObjectSlot].segment);
|
||||
if (!play) {}
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_demo_ec.c", 670);
|
||||
}
|
||||
|
||||
void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) {
|
||||
s32 animObjBankIndex = this->animObjBankIndex;
|
||||
s32 animObjectSlot = this->animObjectSlot;
|
||||
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animObjBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment);
|
||||
}
|
||||
|
||||
CsCmdActorCue* DemoEc_GetCue(PlayState* play, s32 cueChannel) {
|
||||
|
@ -1261,26 +1261,27 @@ void DemoEc_InitCommon(DemoEc* this, PlayState* play) {
|
|||
s32 type;
|
||||
s16 pad2;
|
||||
s16 sp28;
|
||||
s32 primaryBankIndex;
|
||||
s32 secondaryBankIndex;
|
||||
s32 primaryObjectSlot;
|
||||
s32 secondaryObjectSlot;
|
||||
|
||||
type = this->actor.params;
|
||||
primary = sDrawObjects[type];
|
||||
sp28 = sAnimationObjects[type];
|
||||
primaryBankIndex = Object_GetIndex(&play->objectCtx, primary);
|
||||
secondaryBankIndex = Object_GetIndex(&play->objectCtx, sp28);
|
||||
primaryObjectSlot = Object_GetSlot(&play->objectCtx, primary);
|
||||
secondaryObjectSlot = Object_GetSlot(&play->objectCtx, sp28);
|
||||
|
||||
if ((secondaryBankIndex < 0) || (primaryBankIndex < 0)) {
|
||||
if ((secondaryObjectSlot < 0) || (primaryObjectSlot < 0)) {
|
||||
// "Demo_Ec_main_bank: Bank unreadable arg_data = %d!"
|
||||
osSyncPrintf(VT_FGCOL(RED) "Demo_Ec_main_bank:バンクを読めない arg_data = %d!\n" VT_RST, type);
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, primaryBankIndex) && Object_IsLoaded(&play->objectCtx, secondaryBankIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, primaryObjectSlot) &&
|
||||
Object_IsLoaded(&play->objectCtx, secondaryObjectSlot)) {
|
||||
|
||||
this->drawObjBankIndex = primaryBankIndex;
|
||||
this->animObjBankIndex = secondaryBankIndex;
|
||||
this->drawObjectSlot = primaryObjectSlot;
|
||||
this->animObjectSlot = secondaryObjectSlot;
|
||||
|
||||
DemoEc_InitNpc(this, play);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ typedef struct DemoEc {
|
|||
/* 0x0194 */ s32 updateMode;
|
||||
/* 0x0198 */ s32 drawConfig;
|
||||
/* 0x019C */ s32 cueId;
|
||||
/* 0x01A0 */ s32 drawObjBankIndex;
|
||||
/* 0x01A4 */ s32 animObjBankIndex;
|
||||
/* 0x01A0 */ s32 drawObjectSlot;
|
||||
/* 0x01A4 */ s32 animObjectSlot;
|
||||
} DemoEc; // size = 0x01A8
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,7 @@ void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play);
|
|||
void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play);
|
||||
void DemoEffect_DrawJewel(Actor* thisx, PlayState* play2);
|
||||
|
||||
void DemoEffect_Wait(DemoEffect* this, PlayState* play);
|
||||
void DemoEffect_WaitForObject(DemoEffect* this, PlayState* play);
|
||||
void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play);
|
||||
void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, PlayState* play);
|
||||
void DemoEffect_InitCreationFireball(DemoEffect* this, PlayState* play);
|
||||
|
@ -166,7 +166,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) {
|
|||
DemoEffect* this = (DemoEffect*)thisx;
|
||||
s32 effectType;
|
||||
s32 lightEffect;
|
||||
s32 objectIndex;
|
||||
s32 objectSlot;
|
||||
DemoEffect* crystalLight;
|
||||
DemoEffect* lightRing;
|
||||
|
||||
|
@ -175,16 +175,16 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) {
|
|||
|
||||
osSyncPrintf(VT_FGCOL(CYAN) " no = %d\n" VT_RST, effectType);
|
||||
|
||||
objectIndex = sEffectTypeObjects[effectType] == OBJECT_GAMEPLAY_KEEP
|
||||
? 0
|
||||
: Object_GetIndex(&play->objectCtx, sEffectTypeObjects[effectType]);
|
||||
objectSlot = sEffectTypeObjects[effectType] == OBJECT_GAMEPLAY_KEEP
|
||||
? 0
|
||||
: Object_GetSlot(&play->objectCtx, sEffectTypeObjects[effectType]);
|
||||
|
||||
osSyncPrintf(VT_FGCOL(CYAN) " bank_ID = %d\n" VT_RST, objectIndex);
|
||||
osSyncPrintf(VT_FGCOL(CYAN) " bank_ID = %d\n" VT_RST, objectSlot);
|
||||
|
||||
if (objectIndex < 0) {
|
||||
if (objectSlot < 0) {
|
||||
ASSERT(0, "0", "../z_demo_effect.c", 723);
|
||||
} else {
|
||||
this->initObjectBankIndex = objectIndex;
|
||||
this->requiredObjectSlot = objectSlot;
|
||||
}
|
||||
|
||||
this->effectFlags = 0;
|
||||
|
@ -499,7 +499,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) {
|
|||
}
|
||||
|
||||
ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f);
|
||||
DemoEffect_SetupUpdate(this, DemoEffect_Wait);
|
||||
DemoEffect_SetupUpdate(this, DemoEffect_WaitForObject);
|
||||
}
|
||||
|
||||
void DemoEffect_Destroy(Actor* thisx, PlayState* play) {
|
||||
|
@ -518,9 +518,9 @@ void DemoEffect_Destroy(Actor* thisx, PlayState* play) {
|
|||
* They are copied to actor.draw and updateFunc.
|
||||
* initUpdateFunc/initDrawFunc are set during initialization and are NOT executed.
|
||||
*/
|
||||
void DemoEffect_Wait(DemoEffect* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->initObjectBankIndex)) {
|
||||
this->actor.objBankIndex = this->initObjectBankIndex;
|
||||
void DemoEffect_WaitForObject(DemoEffect* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
this->actor.objectSlot = this->requiredObjectSlot;
|
||||
this->actor.draw = this->initDrawFunc;
|
||||
this->updateFunc = this->initUpdateFunc;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ typedef struct {
|
|||
typedef struct DemoEffect {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ SkelCurve skelCurve;
|
||||
/* 0x016C */ u8 initObjectBankIndex;
|
||||
/* 0x016C */ u8 requiredObjectSlot;
|
||||
/* 0x0170 */ Gfx* jewelDisplayList;
|
||||
/* 0x0174 */ Gfx* jewelHolderDisplayList;
|
||||
/* 0x0178 */ u8 primXluColor[3];
|
||||
|
|
|
@ -23,7 +23,7 @@ void func_80978308(DemoGeff* this, PlayState* play);
|
|||
void func_809784D4(DemoGeff* this, PlayState* play);
|
||||
void func_80978344(DemoGeff* this, PlayState* play);
|
||||
|
||||
static s16 sObjectIDs[] = {
|
||||
static s16 sObjectIds[] = {
|
||||
OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF,
|
||||
};
|
||||
|
||||
|
@ -86,13 +86,13 @@ void func_80977EA8(PlayState* play, Gfx* dlist) {
|
|||
|
||||
void func_80977F80(DemoGeff* this, PlayState* play) {
|
||||
s32 pad[2];
|
||||
s32 objBankIndex = this->objBankIndex;
|
||||
s32 objectSlot = this->objectSlot;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_demo_geff.c", 204);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment);
|
||||
|
||||
// Necessary to match
|
||||
if (!play) {}
|
||||
|
@ -188,17 +188,17 @@ void func_809783D4(DemoGeff* this, PlayState* play) {
|
|||
ObjectContext* objCtx = &play->objectCtx;
|
||||
Actor* thisx = &this->actor;
|
||||
s32 params = thisx->params;
|
||||
s16 objectId = sObjectIDs[params];
|
||||
s32 objBankIndex = Object_GetIndex(objCtx, objectId);
|
||||
s16 objectId = sObjectIds[params];
|
||||
s32 objectSlot = Object_GetSlot(objCtx, objectId);
|
||||
s32 pad;
|
||||
|
||||
if (objBankIndex < 0) {
|
||||
if (objectSlot < 0) {
|
||||
osSyncPrintf(VT_FGCOL(RED) "Demo_Geff_main_bank:バンクを読めない arg_data = %d!\n" VT_RST, params);
|
||||
Actor_Kill(thisx);
|
||||
return;
|
||||
}
|
||||
if (Object_IsLoaded(objCtx, objBankIndex)) {
|
||||
this->objBankIndex = objBankIndex;
|
||||
if (Object_IsLoaded(objCtx, objectSlot)) {
|
||||
this->objectSlot = objectSlot;
|
||||
func_80978370(this, play);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ typedef struct DemoGeff {
|
|||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ s32 action;
|
||||
/* 0x0150 */ s32 drawConfig;
|
||||
/* 0x0154 */ s32 objBankIndex;
|
||||
/* 0x0154 */ s32 objectSlot;
|
||||
/* 0x0158 */ DemoGt* demoGt;
|
||||
/* 0x015C */ f32 deltaPosX;
|
||||
/* 0x0160 */ f32 deltaPosY;
|
||||
|
|
|
@ -52,7 +52,7 @@ ActorInit Demo_Kankyo_InitVars = {
|
|||
(ActorFunc)DemoKankyo_Draw,
|
||||
};
|
||||
|
||||
static s16 sObjIds[] = {
|
||||
static s16 sObjectIds[] = {
|
||||
OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD,
|
||||
OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_GAMEPLAY_KEEP, OBJECT_GI_MELODY, OBJECT_GI_MELODY,
|
||||
OBJECT_GI_MELODY, OBJECT_GI_MELODY, OBJECT_GI_MELODY, OBJECT_TOKI_OBJECTS, OBJECT_TOKI_OBJECTS,
|
||||
|
@ -181,13 +181,13 @@ void DemoKankyo_SetupAction(DemoKankyo* this, DemoKankyoActionFunc actionFunc) {
|
|||
void DemoKankyo_Init(Actor* thisx, PlayState* play) {
|
||||
DemoKankyo* this = (DemoKankyo*)thisx;
|
||||
s16 i;
|
||||
s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjIds[this->actor.params]);
|
||||
s32 objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[this->actor.params]);
|
||||
|
||||
osSyncPrintf("bank_ID = %d\n", objBankIndex);
|
||||
if (objBankIndex < 0) {
|
||||
osSyncPrintf("bank_ID = %d\n", objectSlot);
|
||||
if (objectSlot < 0) {
|
||||
ASSERT(0, "0", "../z_demo_kankyo.c", 521);
|
||||
} else {
|
||||
this->objBankIndex = objBankIndex;
|
||||
this->requiredObjectSlot = objectSlot;
|
||||
}
|
||||
|
||||
switch (this->actor.params) {
|
||||
|
@ -279,7 +279,7 @@ void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play) {
|
|||
Player* player = GET_PLAYER(play);
|
||||
f32 temp;
|
||||
|
||||
if (this->actor.objBankIndex == this->objBankIndex) {
|
||||
if (this->actor.objectSlot == this->requiredObjectSlot) {
|
||||
switch (this->actor.params) {
|
||||
case DEMOKANKYO_ROCK_1:
|
||||
case DEMOKANKYO_ROCK_2:
|
||||
|
@ -432,7 +432,7 @@ void DemoKankyo_Update(Actor* thisx, PlayState* play) {
|
|||
void DemoKankyo_Draw(Actor* thisx, PlayState* play) {
|
||||
DemoKankyo* this = (DemoKankyo*)thisx;
|
||||
|
||||
if (this->actor.objBankIndex == this->objBankIndex) {
|
||||
if (this->actor.objectSlot == this->requiredObjectSlot) {
|
||||
switch (this->actor.params) {
|
||||
case DEMOKANKYO_BLUE_RAIN:
|
||||
case DEMOKANKYO_BLUE_RAIN_2:
|
||||
|
@ -480,8 +480,8 @@ void DemoKankyo_Draw(Actor* thisx, PlayState* play) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
|
||||
this->actor.objBankIndex = this->objBankIndex;
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
this->actor.objectSlot = this->requiredObjectSlot;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ typedef struct {
|
|||
|
||||
typedef struct DemoKankyo {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ u8 objBankIndex;
|
||||
/* 0x014C */ u8 requiredObjectSlot;
|
||||
/* 0x014D */ u8 sparkleCounter;
|
||||
/* 0x014E */ u8 warpTimer;
|
||||
/* 0x0150 */ DemoKankyoUnk150 unk_150[30];
|
||||
|
|
|
@ -277,47 +277,52 @@ void DemoKekkai_DrawTrialBarrier(Actor* thisx, PlayState* play2) {
|
|||
Vtx* energyVtx = SEGMENTED_TO_VIRTUAL(gTrialBarrierEnergyVtx);
|
||||
s32 i;
|
||||
|
||||
if (this->orbScale != 0.0f) {
|
||||
if (1) {}
|
||||
alphas[2] = (s32)(this->energyAlpha * 202.0f);
|
||||
alphas[1] = (s32)(this->energyAlpha * 126.0f);
|
||||
alphas[0] = 0;
|
||||
for (i = 0; i < 102; i++) {
|
||||
energyVtx[i].v.cn[3] = alphas[alphaIndex[i]];
|
||||
}
|
||||
colorIndex = (this->actor.params - 1) * 6;
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 632);
|
||||
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
|
||||
Matrix_Push();
|
||||
Matrix_Translate(0.0f, 1200.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(this->orbScale, this->orbScale, this->orbScale, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, -1200.0f, 0.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 639),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x09,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, frames * 5, frames * -10, 0x20, 0x20, 1,
|
||||
frames * 5, frames * -10, 0x20, 0x20));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierOrbDL);
|
||||
Matrix_Pop();
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 656),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 50, 0, 100, 255);
|
||||
gSPSegment(
|
||||
POLY_XLU_DISP++, 0x0A,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, frames, frames, 0x20, 0x20));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierFloorDL);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, sEnergyColors[colorIndex + 0], sEnergyColors[colorIndex + 1],
|
||||
sEnergyColors[colorIndex + 2], 255);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, sEnergyColors[colorIndex + 3], sEnergyColors[colorIndex + 4],
|
||||
sEnergyColors[colorIndex + 5], 128);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, frames * 5, frames * -10, 0x20, 0x20, 1,
|
||||
frames * 5, frames * -10, 0x20, 0x40));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierEnergyDL);
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 696);
|
||||
if (this->orbScale == 0.0f) {
|
||||
return;
|
||||
}
|
||||
|
||||
alphas[2] = (s32)(this->energyAlpha * 202.0f);
|
||||
alphas[1] = (s32)(this->energyAlpha * 126.0f);
|
||||
alphas[0] = 0;
|
||||
|
||||
for (i = 0; i < 102; i++) {
|
||||
energyVtx[i].v.cn[3] = alphas[alphaIndex[i]];
|
||||
}
|
||||
|
||||
colorIndex = (this->actor.params - 1) * 6;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 632);
|
||||
|
||||
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
|
||||
Matrix_Push();
|
||||
Matrix_Translate(0.0f, 1200.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(this->orbScale, this->orbScale, this->orbScale, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, -1200.0f, 0.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 639),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x09,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, frames * 5, frames * -10, 0x20, 0x20, 1,
|
||||
frames * 5, frames * -10, 0x20, 0x20));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierOrbDL);
|
||||
Matrix_Pop();
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_kekkai.c", 656),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 50, 0, 100, 255);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x0A,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, frames, frames, 0x20, 0x20));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierFloorDL);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, sEnergyColors[colorIndex + 0], sEnergyColors[colorIndex + 1],
|
||||
sEnergyColors[colorIndex + 2], 255);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, sEnergyColors[colorIndex + 3], sEnergyColors[colorIndex + 4],
|
||||
sEnergyColors[colorIndex + 5], 128);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, frames * 5, frames * -10, 0x20, 0x20, 1,
|
||||
frames * 5, frames * -10, 0x20, 0x40));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierEnergyDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_demo_kekkai.c", 696);
|
||||
}
|
||||
|
||||
void DemoKekkai_DrawTowerBarrier(Actor* thisx, PlayState* play) {
|
||||
|
|
|
@ -129,7 +129,7 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) {
|
|||
player = GET_PLAYER(play);
|
||||
if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) {
|
||||
if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
|
||||
(player->stateFlags1 & PLAYER_STATE1_31) && (player->unk_84F == 0)) {
|
||||
(player->stateFlags1 & PLAYER_STATE1_31) && (player->actionVar1 == 0)) {
|
||||
destinationIdx = ((this->actor.params >> 0xC) & 7) - 1;
|
||||
Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF);
|
||||
gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.world.pos.y;
|
||||
|
|
|
@ -25,7 +25,7 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2);
|
|||
void DoorKiller_Destroy(Actor* thisx, PlayState* play);
|
||||
void DoorKiller_Update(Actor* thisx, PlayState* play);
|
||||
void DoorKiller_Wait(DoorKiller* this, PlayState* play);
|
||||
void DoorKiller_SetProperties(DoorKiller* this, PlayState* play);
|
||||
void DoorKiller_WaitForObject(DoorKiller* this, PlayState* play);
|
||||
void DoorKiller_DrawDoor(Actor* thisx, PlayState* play);
|
||||
void DoorKiller_DrawRubble(Actor* thisx, PlayState* play);
|
||||
|
||||
|
@ -99,18 +99,19 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) {
|
|||
PlayState* play = play2;
|
||||
f32 randF;
|
||||
DoorKiller* this = (DoorKiller*)thisx;
|
||||
s32 bankIndex;
|
||||
s32 objectSlot;
|
||||
s32 i;
|
||||
|
||||
// Look in the object bank for one of the four objects containing door textures
|
||||
bankIndex = -1;
|
||||
for (i = 0; bankIndex < 0; i++) {
|
||||
bankIndex = Object_GetIndex(&play->objectCtx, sDoorTextures[i].objectId);
|
||||
objectSlot = -1;
|
||||
//! @bug If no objectSlot is found, `sDoorTextures` will be read out of bounds
|
||||
for (i = 0; objectSlot < 0; i++) {
|
||||
objectSlot = Object_GetSlot(&play->objectCtx, sDoorTextures[i].objectId);
|
||||
this->textureEntryIndex = i;
|
||||
}
|
||||
osSyncPrintf("bank_ID = %d\n", bankIndex);
|
||||
osSyncPrintf("bank_ID = %d\n", objectSlot);
|
||||
osSyncPrintf("status = %d\n", this->textureEntryIndex);
|
||||
this->doorObjBankIndex = bankIndex;
|
||||
this->requiredObjectSlot = objectSlot;
|
||||
this->texture = sDoorTextures[this->textureEntryIndex].texture;
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
|
||||
|
@ -126,8 +127,8 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) {
|
|||
// play any animations it does not cause problems, but it would need to be changed otherwise.
|
||||
SkelAnime_InitFlex(play, &this->skelAnime, &object_door_killer_Skel_001BC8, NULL, this->jointTable,
|
||||
this->jointTable, 9);
|
||||
this->actionFunc = DoorKiller_SetProperties;
|
||||
DoorKiller_SetProperties(this, play);
|
||||
this->actionFunc = DoorKiller_WaitForObject;
|
||||
DoorKiller_WaitForObject(this, play);
|
||||
|
||||
// manually set the overall rotation of the door
|
||||
this->jointTable[1].x = this->jointTable[1].z = 0x4000;
|
||||
|
@ -152,8 +153,8 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) {
|
|||
case DOOR_KILLER_RUBBLE_PIECE_2:
|
||||
case DOOR_KILLER_RUBBLE_PIECE_3:
|
||||
case DOOR_KILLER_RUBBLE_PIECE_4:
|
||||
this->actionFunc = DoorKiller_SetProperties;
|
||||
DoorKiller_SetProperties(this, play);
|
||||
this->actionFunc = DoorKiller_WaitForObject;
|
||||
DoorKiller_WaitForObject(this, play);
|
||||
|
||||
this->actor.gravity = -0.6f;
|
||||
this->actor.minVelocityY = -6.0f;
|
||||
|
@ -459,17 +460,17 @@ void DoorKiller_Wait(DoorKiller* this, PlayState* play) {
|
|||
void DoorKiller_UpdateTexture(Actor* thisx, PlayState* play) {
|
||||
DoorKiller* this = (DoorKiller*)thisx;
|
||||
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->doorObjBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment);
|
||||
this->texture = SEGMENTED_TO_VIRTUAL(this->texture);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[thisx->objBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the correct door texture, defines the appropriate draw fucntion and action function based on type behaviour
|
||||
* (door or rubble).
|
||||
*/
|
||||
void DoorKiller_SetProperties(DoorKiller* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->doorObjBankIndex)) {
|
||||
void DoorKiller_WaitForObject(DoorKiller* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
DoorKiller_UpdateTexture(&this->actor, play);
|
||||
switch (this->actor.params & 0xFF) {
|
||||
case DOOR_KILLER_DOOR:
|
||||
|
|
|
@ -25,7 +25,7 @@ typedef struct DoorKiller {
|
|||
/* 0x0214 */ void* texture;
|
||||
/* 0x0218 */ u16 hasHitPlayerOrGround;
|
||||
/* 0x021A */ u16 timer;
|
||||
/* 0x021C */ u8 doorObjBankIndex;
|
||||
/* 0x021C */ u8 requiredObjectSlot;
|
||||
/* 0x021D */ u8 textureEntryIndex;
|
||||
/* 0x0220 */ ColliderJntSph colliderJntSph;
|
||||
/* 0x0240 */ ColliderJntSphElement colliderJntSphItems[1];
|
||||
|
|
|
@ -402,7 +402,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) {
|
|||
PlayState* play = play2;
|
||||
s32 styleType;
|
||||
s32 pad;
|
||||
s32 objectIndex;
|
||||
s32 objectSlot;
|
||||
s32 i;
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
|
@ -432,9 +432,8 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) {
|
|||
} else { // DOORSHUTTER_STYLE_PHANTOM_GANON, DOORSHUTTER_STYLE_GOHMA_BLOCK
|
||||
this->dyna.actor.room = -1;
|
||||
}
|
||||
|
||||
if (this->requiredObjBankIndex = objectIndex = Object_GetIndex(&play->objectCtx, sStyleInfo[styleType].objectId),
|
||||
(s8)objectIndex < 0) {
|
||||
if (this->requiredObjectSlot = objectSlot = Object_GetSlot(&play->objectCtx, sStyleInfo[styleType].objectId),
|
||||
(s8)objectSlot < 0) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
|
@ -468,8 +467,8 @@ void DoorShutter_Destroy(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
void DoorShutter_WaitForObject(DoorShutter* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) {
|
||||
this->dyna.actor.objBankIndex = this->requiredObjBankIndex;
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
this->dyna.actor.objectSlot = this->requiredObjectSlot;
|
||||
if (this->doorType == SHUTTER_PG_BARS || this->doorType == SHUTTER_GOHMA_BLOCK) {
|
||||
// Init dynapoly for shutters of the type that uses it
|
||||
CollisionHeader* colHeader = NULL;
|
||||
|
@ -977,7 +976,7 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) {
|
|||
DoorShutter* this = (DoorShutter*)thisx;
|
||||
|
||||
//! @bug This actor is not fully initialized until the required object dependency is loaded.
|
||||
//! In most cases, the check for objBankIndex to equal requiredObjBankIndex prevents the actor
|
||||
//! In most cases, the check for objectSlot to equal requiredObjectSlot prevents the actor
|
||||
//! from drawing until initialization is complete. However if the required object is the same as the
|
||||
//! object dependency listed in init vars (gameplay_keep in this case), the check will pass even though
|
||||
//! initialization has not completed. When this happens, it will try to draw the display list of the
|
||||
|
@ -988,7 +987,7 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) {
|
|||
//! The best way to fix this issue (and what was done in Majora's Mask) is to null out the draw function in
|
||||
//! the init vars for the actor, and only set draw after initialization is complete.
|
||||
|
||||
if (this->dyna.actor.objBankIndex == this->requiredObjBankIndex &&
|
||||
if (this->dyna.actor.objectSlot == this->requiredObjectSlot &&
|
||||
(this->styleType == DOORSHUTTER_STYLE_PHANTOM_GANON || DoorShutter_ShouldDraw(this, play))) {
|
||||
s32 pad[2];
|
||||
DoorShutterGfxInfo* gfxInfo = &sGfxInfo[this->gfxType];
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef struct DoorShutter {
|
|||
/* 0x016A */ u8 doorType;
|
||||
/* 0x016B */ u8 styleType;
|
||||
/* 0x016C */ u8 gfxType;
|
||||
/* 0x016D */ s8 requiredObjBankIndex;
|
||||
/* 0x016D */ s8 requiredObjectSlot;
|
||||
/* 0x016E */ s8 unlockTimer; // non-0 if the door is locked, ticks down while the door is unlocking
|
||||
/* 0x016F */ s8 actionTimer;
|
||||
/* 0x0170 */ f32 barsClosedAmount; // Ranges from 0.0f (unbarred) to 1.0f (barred)
|
||||
|
|
|
@ -281,26 +281,23 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, PlayState* play2) {
|
|||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL);
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
if (*distanceTraveled < 1.0f) {
|
||||
aux = 1.0f - (*distanceTraveled * *distanceTraveled);
|
||||
Matrix_Translate(this->actor.world.pos.x + (initialPositions->x * ((this->dx * aux) + (1.0f - this->dx))),
|
||||
this->actor.world.pos.y + (initialPositions->y * ((this->dy * aux) + (1.0f - this->dy))),
|
||||
this->actor.world.pos.z + (initialPositions->z * ((this->dz * aux) + (1.0f - this->dz))),
|
||||
MTXMODE_NEW);
|
||||
|
||||
Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY);
|
||||
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 449),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL));
|
||||
for (i = 0; i < 64; i++, initialPositions++, distanceTraveled++) {
|
||||
if (!(*distanceTraveled < 1.0f)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
initialPositions++;
|
||||
distanceTraveled++;
|
||||
// Needed for matching.
|
||||
if (0) {}
|
||||
aux = 1.0f - SQ(*distanceTraveled);
|
||||
Matrix_Translate(this->actor.world.pos.x + (initialPositions->x * ((this->dx * aux) + (1.0f - this->dx))),
|
||||
this->actor.world.pos.y + (initialPositions->y * ((this->dy * aux) + (1.0f - this->dy))),
|
||||
this->actor.world.pos.z + (initialPositions->z * ((this->dz * aux) + (1.0f - this->dz))),
|
||||
MTXMODE_NEW);
|
||||
|
||||
Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY);
|
||||
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 449),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL));
|
||||
}
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_eff_dust.c", 458);
|
||||
|
@ -333,33 +330,29 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, PlayState* play2) {
|
|||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL);
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
if (*distanceTraveled < 1.0f) {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, *distanceTraveled * 255);
|
||||
|
||||
// Needed to match.
|
||||
if (!this) {}
|
||||
|
||||
aux = 1.0f - (*distanceTraveled * *distanceTraveled);
|
||||
|
||||
Matrix_Mult(&player->mf_9E0, MTXMODE_NEW);
|
||||
|
||||
Matrix_Translate(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)),
|
||||
initialPositions->y * (1.0f - *distanceTraveled) + 320.0f,
|
||||
initialPositions->z * (1.0f - *distanceTraveled) + -20.0f, MTXMODE_APPLY);
|
||||
|
||||
Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor,
|
||||
*distanceTraveled * this->scalingFactor, MTXMODE_APPLY);
|
||||
|
||||
Matrix_ReplaceRotation(&play->billboardMtxF);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 506),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL));
|
||||
for (i = 0; i < 64; i++, initialPositions++, distanceTraveled++) {
|
||||
if (!(*distanceTraveled < 1.0f)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
initialPositions++;
|
||||
distanceTraveled++;
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, *distanceTraveled * 255);
|
||||
|
||||
aux = 1.0f - SQ(*distanceTraveled);
|
||||
|
||||
Matrix_Mult(&player->mf_9E0, MTXMODE_NEW);
|
||||
|
||||
Matrix_Translate(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)),
|
||||
initialPositions->y * (1.0f - *distanceTraveled) + 320.0f,
|
||||
initialPositions->z * (1.0f - *distanceTraveled) + -20.0f, MTXMODE_APPLY);
|
||||
|
||||
Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor,
|
||||
*distanceTraveled * this->scalingFactor, MTXMODE_APPLY);
|
||||
|
||||
Matrix_ReplaceRotation(&play->billboardMtxF);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 506),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL));
|
||||
}
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_eff_dust.c", 515);
|
||||
|
|
|
@ -1267,7 +1267,7 @@ void EnBb_Update(Actor* thisx, PlayState* play2) {
|
|||
void EnBb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
EnBb* this = (EnBb*)thisx;
|
||||
|
||||
BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 4, 15, 15, dList, BODYBREAK_OBJECT_DEFAULT);
|
||||
BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 4, 15, 15, dList, BODYBREAK_OBJECT_SLOT_DEFAULT);
|
||||
}
|
||||
|
||||
static Vec3f sFireIceOffsets[] = {
|
||||
|
|
|
@ -69,8 +69,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) {
|
|||
|
||||
for (i = 0; i < 2; i++) {
|
||||
cucco = (EnSyatekiNiw*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SYATEKI_NIW, cuccoSpawnPos[i].x,
|
||||
cuccoSpawnPos[i].y, cuccoSpawnPos[i].z, 0, 0, 0,
|
||||
SYATEKI_MINIGAME_ALLEY);
|
||||
cuccoSpawnPos[i].y, cuccoSpawnPos[i].z, 0, 0, 0, SYATEKI_MINIGAME_ALLEY);
|
||||
if (cucco != NULL) {
|
||||
cucco->scale = cuccoScales[i];
|
||||
cucco->collider.dim.radius = (s16)cuccoColliderDims[i][0];
|
||||
|
|
|
@ -470,18 +470,18 @@ void EnCs_Draw(Actor* thisx, PlayState* play) {
|
|||
EnCs_OverrideLimbDraw, EnCs_PostLimbDraw, &this->actor);
|
||||
|
||||
if (GET_ITEMGETINF(ITEMGETINF_3A)) {
|
||||
s32 childLinkObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD);
|
||||
s32 linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD);
|
||||
|
||||
// Handle attaching the Spooky Mask to the boy's face
|
||||
if (childLinkObjectIndex >= 0) {
|
||||
if (linkChildObjectSlot >= 0) {
|
||||
Mtx* mtx;
|
||||
|
||||
Matrix_Put(&this->spookyMaskMtx);
|
||||
mtx = Matrix_NewMtx(play->state.gfxCtx, "../z_en_cs.c", 1000);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[childLinkObjectIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[linkChildObjectSlot].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0D, mtx - 7);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gLinkChildSpookyMaskDL);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ void EnDha_Wait(EnDha* this, PlayState* play) {
|
|||
if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) {
|
||||
player->stateFlags2 &= ~PLAYER_STATE2_7;
|
||||
player->actor.parent = NULL;
|
||||
player->unk_850 = 200;
|
||||
player->actionVar2 = 200;
|
||||
}
|
||||
|
||||
if (this->actor.home.rot.z != 0) {
|
||||
|
@ -285,7 +285,7 @@ void EnDha_Wait(EnDha* this, PlayState* play) {
|
|||
if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) {
|
||||
player->stateFlags2 &= ~PLAYER_STATE2_7;
|
||||
player->actor.parent = NULL;
|
||||
player->unk_850 = 200;
|
||||
player->actionVar2 = 200;
|
||||
}
|
||||
|
||||
this->actor.home.rot.z = 1;
|
||||
|
@ -306,7 +306,7 @@ void EnDha_TakeDamage(EnDha* this, PlayState* play) {
|
|||
if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) {
|
||||
player->stateFlags2 &= ~PLAYER_STATE2_7;
|
||||
player->actor.parent = NULL;
|
||||
player->unk_850 = 200;
|
||||
player->actionVar2 = 200;
|
||||
}
|
||||
|
||||
Math_SmoothStepToS(&this->limbAngleX[1], 0, 1, 2000, 0);
|
||||
|
@ -344,7 +344,7 @@ void EnDha_Die(EnDha* this, PlayState* play) {
|
|||
if ((player->stateFlags2 & PLAYER_STATE2_7) && (&this->actor == player->actor.parent)) {
|
||||
player->stateFlags2 &= ~PLAYER_STATE2_7;
|
||||
player->actor.parent = NULL;
|
||||
player->unk_850 = 200;
|
||||
player->actionVar2 = 200;
|
||||
}
|
||||
|
||||
Math_SmoothStepToS(&this->limbAngleX[1], 0, 1, 0x7D0, 0);
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/*
|
||||
* File: z_en_dns.c
|
||||
* Overlay: En_Dns
|
||||
* Description: Deku Salesman
|
||||
* Description: Deku Salesman - Sale Phase
|
||||
*/
|
||||
|
||||
#include "z_en_dns.h"
|
||||
#include "assets/objects/object_shopnuts/object_shopnuts.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3)
|
||||
|
@ -15,33 +14,33 @@ void EnDns_Destroy(Actor* thisx, PlayState* play);
|
|||
void EnDns_Update(Actor* thisx, PlayState* play);
|
||||
void EnDns_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
u32 func_809EF5A4(EnDns* this);
|
||||
u32 func_809EF658(EnDns* this);
|
||||
u32 func_809EF70C(EnDns* this);
|
||||
u32 func_809EF73C(EnDns* this);
|
||||
u32 func_809EF800(EnDns* this);
|
||||
u32 func_809EF854(EnDns* this);
|
||||
u32 func_809EF8F4(EnDns* this);
|
||||
u32 func_809EF9A4(EnDns* this);
|
||||
u32 EnDns_CanBuyPrice(EnDns* this);
|
||||
u32 EnDns_CanBuyDekuNuts(EnDns* this);
|
||||
u32 EnDns_CanBuyDekuSticks(EnDns* this);
|
||||
u32 EnDns_CanBuyDekuSeeds(EnDns* this);
|
||||
u32 EnDns_CanBuyDekuShield(EnDns* this);
|
||||
u32 EnDns_CanBuyBombs(EnDns* this);
|
||||
u32 EnDns_CanBuyArrows(EnDns* this);
|
||||
u32 EnDns_CanBuyBottle(EnDns* this);
|
||||
|
||||
void func_809EF9F8(EnDns* this);
|
||||
void func_809EFA28(EnDns* this);
|
||||
void func_809EFA58(EnDns* this);
|
||||
void func_809EFA9C(EnDns* this);
|
||||
void func_809EFACC(EnDns* this);
|
||||
void func_809EFAFC(EnDns* this);
|
||||
void func_809EFB40(EnDns* this);
|
||||
void EnDns_PayPrice(EnDns* this);
|
||||
void EnDns_PayForDekuNuts(EnDns* this);
|
||||
void EnDns_PayForHeartPiece(EnDns* this);
|
||||
void EnDns_PayForBombs(EnDns* this);
|
||||
void EnDns_PayForArrows(EnDns* this);
|
||||
void EnDns_PayForDekuStickUpgrade(EnDns* this);
|
||||
void EnDns_PayForDekuNutUpgrade(EnDns* this);
|
||||
|
||||
void EnDns_SetupWait(EnDns* this, PlayState* play);
|
||||
void EnDns_Wait(EnDns* this, PlayState* play);
|
||||
void EnDns_SetupIdle(EnDns* this, PlayState* play);
|
||||
void EnDns_Idle(EnDns* this, PlayState* play);
|
||||
void EnDns_Talk(EnDns* this, PlayState* play);
|
||||
void func_809EFDD0(EnDns* this, PlayState* play);
|
||||
void func_809EFEE8(EnDns* this, PlayState* play);
|
||||
void func_809EFF50(EnDns* this, PlayState* play);
|
||||
void func_809EFF98(EnDns* this, PlayState* play);
|
||||
void func_809F008C(EnDns* this, PlayState* play);
|
||||
void EnDns_OfferSaleItem(EnDns* this, PlayState* play);
|
||||
void EnDns_SetupSale(EnDns* this, PlayState* play);
|
||||
void EnDns_Sale(EnDns* this, PlayState* play);
|
||||
void EnDns_SetupBurrow(EnDns* this, PlayState* play);
|
||||
void EnDns_SetupNoSaleBurrow(EnDns* this, PlayState* play);
|
||||
void EnDns_Burrow(EnDns* this, PlayState* play);
|
||||
void EnDns_PostBurrow(EnDns* this, PlayState* play);
|
||||
|
||||
ActorInit En_Dns_InitVars = {
|
||||
ACTOR_EN_DNS,
|
||||
|
@ -74,44 +73,42 @@ static ColliderCylinderInitType1 sCylinderInit = {
|
|||
{ 18, 32, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
static u16 D_809F040C[] = {
|
||||
static u16 sStartingTextIds[] = {
|
||||
0x10A0, 0x10A1, 0x10A2, 0x10CA, 0x10CB, 0x10CC, 0x10CD, 0x10CE, 0x10CF, 0x10DC, 0x10DD,
|
||||
};
|
||||
|
||||
// Debug text: "sells" { "Deku Nuts", "Deku Sticks", "Piece of Heart", "Deku Seeds",
|
||||
// "Deku Shield", "Bombs", "Arrows", "Red Potion",
|
||||
// "Green Potion", "Deku Stick Upgrade", "Deku Nut Upgrade" }
|
||||
static char* D_809F0424[] = {
|
||||
"デクの実売り ", "デクの棒売り ", "ハートの欠片売り ", "デクの種売り ",
|
||||
"デクの盾売り ", "バクダン売り ", "矢売り ", "赤のくすり売り ",
|
||||
"緑のくすり売り ", "デクの棒持てる数を増やす", "デクの実持てる数を増やす",
|
||||
static char* sItemDebugTxt[] = {
|
||||
"デクの実売り ", // "Deku Nuts"
|
||||
"デクの棒売り ", // "Deku Sticks"
|
||||
"ハートの欠片売り ", // "Piece of Heart"
|
||||
"デクの種売り ", // "Deku Seeds"
|
||||
"デクの盾売り ", // "Deku Shield"
|
||||
"バクダン売り ", // "Bombs"
|
||||
"矢売り ", // "Arrows"
|
||||
"赤のくすり売り ", // "Red Potion"
|
||||
"緑のくすり売り ", // "Green Potion"
|
||||
"デクの棒持てる数を増やす", // "Deku Stick Upgrade"
|
||||
"デクの実持てる数を増やす", // "Deku Nut Upgrade"
|
||||
};
|
||||
|
||||
static DnsItemEntry D_809F0450 = { 20, 5, GI_DEKU_NUTS_5_2, func_809EF5A4, func_809EFA28 };
|
||||
static DnsItemEntry sItemDekuNuts = { 20, 5, GI_DEKU_NUTS_5_2, EnDns_CanBuyDekuNuts, EnDns_PayForDekuNuts };
|
||||
static DnsItemEntry sItemDekuSticks = { 15, 1, GI_DEKU_STICKS_1, EnDns_CanBuyDekuSticks, EnDns_PayPrice };
|
||||
static DnsItemEntry sItemHeartPiece = { 10, 1, GI_HEART_PIECE, EnDns_CanBuyPrice, EnDns_PayForHeartPiece };
|
||||
static DnsItemEntry sItemDekuSeeds = { 40, 30, GI_DEKU_SEEDS_30, EnDns_CanBuyDekuSeeds, EnDns_PayPrice };
|
||||
static DnsItemEntry sItemDekuShield = { 50, 1, GI_SHIELD_DEKU, EnDns_CanBuyDekuShield, EnDns_PayPrice };
|
||||
static DnsItemEntry sItemBombs = { 40, 5, GI_BOMBS_5, EnDns_CanBuyBombs, EnDns_PayForBombs };
|
||||
static DnsItemEntry sItemArrows = { 70, 20, GI_ARROWS_30, EnDns_CanBuyArrows, EnDns_PayForArrows };
|
||||
static DnsItemEntry sItemRedPotion = { 40, 1, GI_BOTTLE_POTION_RED, EnDns_CanBuyBottle, EnDns_PayPrice };
|
||||
static DnsItemEntry sItemGreenPotion = { 40, 1, GI_BOTTLE_POTION_GREEN, EnDns_CanBuyBottle, EnDns_PayPrice };
|
||||
|
||||
static DnsItemEntry D_809F0460 = { 15, 1, GI_DEKU_STICKS_1, func_809EF658, func_809EF9F8 };
|
||||
|
||||
static DnsItemEntry D_809F0470 = { 10, 1, GI_HEART_PIECE, func_809EF70C, func_809EFA58 };
|
||||
|
||||
static DnsItemEntry D_809F0480 = { 40, 30, GI_DEKU_SEEDS_30, func_809EF73C, func_809EF9F8 };
|
||||
|
||||
static DnsItemEntry D_809F0490 = { 50, 1, GI_SHIELD_DEKU, func_809EF800, func_809EF9F8 };
|
||||
|
||||
static DnsItemEntry D_809F04A0 = { 40, 5, GI_BOMBS_5, func_809EF854, func_809EFA9C };
|
||||
|
||||
static DnsItemEntry D_809F04B0 = { 70, 20, GI_ARROWS_30, func_809EF8F4, func_809EFACC };
|
||||
|
||||
static DnsItemEntry D_809F04C0 = { 40, 1, GI_BOTTLE_POTION_RED, func_809EF9A4, func_809EF9F8 };
|
||||
|
||||
static DnsItemEntry D_809F04D0 = { 40, 1, GI_BOTTLE_POTION_GREEN, func_809EF9A4, func_809EF9F8 };
|
||||
|
||||
static DnsItemEntry D_809F04E0 = { 40, 1, GI_DEKU_STICK_UPGRADE_20, func_809EF70C, func_809EFAFC };
|
||||
|
||||
static DnsItemEntry D_809F04F0 = { 40, 1, GI_DEKU_NUT_UPGRADE_30, func_809EF70C, func_809EFB40 };
|
||||
static DnsItemEntry sItemDekuStickUpgrade = { 40, 1, GI_DEKU_STICK_UPGRADE_20, EnDns_CanBuyPrice,
|
||||
EnDns_PayForDekuStickUpgrade };
|
||||
static DnsItemEntry sItemDekuNutUpgrade = { 40, 1, GI_DEKU_NUT_UPGRADE_30, EnDns_CanBuyPrice,
|
||||
EnDns_PayForDekuNutUpgrade };
|
||||
|
||||
static DnsItemEntry* sItemEntries[] = {
|
||||
&D_809F0450, &D_809F0460, &D_809F0470, &D_809F0480, &D_809F0490, &D_809F04A0,
|
||||
&D_809F04B0, &D_809F04C0, &D_809F04D0, &D_809F04E0, &D_809F04F0,
|
||||
&sItemDekuNuts, &sItemDekuSticks, &sItemHeartPiece, &sItemDekuSeeds, &sItemDekuShield, &sItemBombs,
|
||||
&sItemArrows, &sItemRedPotion, &sItemGreenPotion, &sItemDekuStickUpgrade, &sItemDekuNutUpgrade,
|
||||
};
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
|
@ -120,51 +117,52 @@ static InitChainEntry sInitChain[] = {
|
|||
ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ ENDNS_ANIM_0,
|
||||
/* 1 */ ENDNS_ANIM_1,
|
||||
/* 2 */ ENDNS_ANIM_2
|
||||
} EnDnsAnimation;
|
||||
|
||||
static AnimationMinimalInfo sAnimationInfo[] = {
|
||||
{ &gBusinessScrubNervousIdleAnim, ANIMMODE_LOOP, 0.0f },
|
||||
{ &gBusinessScrubAnim_4404, ANIMMODE_ONCE, 0.0f },
|
||||
{ &gBusinessScrubLeaveBurrowAnim, ANIMMODE_ONCE, 0.0f },
|
||||
{ &gBusinessScrubNervousTransitionAnim, ANIMMODE_ONCE, 0.0f },
|
||||
};
|
||||
|
||||
void EnDns_Init(Actor* thisx, PlayState* play) {
|
||||
EnDns* this = (EnDns*)thisx;
|
||||
|
||||
if (this->actor.params < 0) {
|
||||
if (DNS_GET_TYPE(&this->actor) < 0) {
|
||||
// "Function Error (Deku Salesman)"
|
||||
osSyncPrintf(VT_FGCOL(RED) "引数エラー(売りナッツ)[ arg_data = %d ]" VT_RST "\n", this->actor.params);
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
||||
// Sell Seeds instead of Arrows if Link is child
|
||||
if ((this->actor.params == 0x0006) && (LINK_AGE_IN_YEARS == YEARS_CHILD)) {
|
||||
this->actor.params = 0x0003;
|
||||
if ((DNS_GET_TYPE(&this->actor) == DNS_TYPE_ARROWS_30) && (LINK_AGE_IN_YEARS == YEARS_CHILD)) {
|
||||
DNS_GET_TYPE(&this->actor) = DNS_TYPE_DEKU_SEEDS_30;
|
||||
}
|
||||
|
||||
// "Deku Salesman"
|
||||
osSyncPrintf(VT_FGCOL(GREEN) "◆◆◆ 売りナッツ『%s』 ◆◆◆" VT_RST "\n", D_809F0424[this->actor.params],
|
||||
this->actor.params);
|
||||
osSyncPrintf(VT_FGCOL(GREEN) "◆◆◆ 売りナッツ『%s』 ◆◆◆" VT_RST "\n", sItemDebugTxt[DNS_GET_TYPE(&this->actor)]);
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
|
||||
SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim,
|
||||
this->jointTable, this->morphTable, 18);
|
||||
this->jointTable, this->morphTable, BUSINESS_SCRUB_LIMB_MAX);
|
||||
|
||||
Collider_InitCylinder(play, &this->collider);
|
||||
Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit);
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f);
|
||||
this->actor.textId = D_809F040C[this->actor.params];
|
||||
this->actor.textId = sStartingTextIds[DNS_GET_TYPE(&this->actor)];
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
|
||||
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
|
||||
this->maintainCollider = 1;
|
||||
this->standOnGround = 1;
|
||||
this->dropCollectible = 0;
|
||||
this->bumpOn = true;
|
||||
this->standOnGround = true;
|
||||
this->dropCollectible = false;
|
||||
this->actor.speed = 0.0f;
|
||||
this->actor.velocity.y = 0.0f;
|
||||
this->actor.gravity = -1.0f;
|
||||
this->dnsItemEntry = sItemEntries[this->actor.params];
|
||||
this->actionFunc = EnDns_SetupWait;
|
||||
this->dnsItemEntry = sItemEntries[DNS_GET_TYPE(&this->actor)];
|
||||
|
||||
this->actionFunc = EnDns_SetupIdle;
|
||||
}
|
||||
|
||||
void EnDns_Destroy(Actor* thisx, PlayState* play) {
|
||||
|
@ -174,154 +172,175 @@ void EnDns_Destroy(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
void EnDns_ChangeAnim(EnDns* this, u8 index) {
|
||||
s16 frameCount;
|
||||
s16 frameCount = Animation_GetLastFrame(sAnimationInfo[index].animation);
|
||||
|
||||
frameCount = Animation_GetLastFrame(sAnimationInfo[index].animation);
|
||||
this->unk_2BA = index; // Not used anywhere else?
|
||||
Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, (f32)frameCount,
|
||||
this->animIndex = index;
|
||||
Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, frameCount,
|
||||
sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames);
|
||||
}
|
||||
|
||||
/* Item give checking functions */
|
||||
|
||||
u32 func_809EF5A4(EnDns* this) {
|
||||
u32 EnDns_CanBuyDekuNuts(EnDns* this) {
|
||||
if ((CUR_CAPACITY(UPG_DEKU_NUTS) != 0) && (AMMO(ITEM_DEKU_NUT) >= CUR_CAPACITY(UPG_DEKU_NUTS))) {
|
||||
return 1;
|
||||
return DNS_CANBUY_RESULT_CAPACITY_FULL;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) {
|
||||
return 0;
|
||||
return DNS_CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
|
||||
if (Item_CheckObtainability(ITEM_DEKU_NUT) == ITEM_NONE) {
|
||||
return 2;
|
||||
return DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM;
|
||||
}
|
||||
return 4;
|
||||
|
||||
return DNS_CANBUY_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
u32 func_809EF658(EnDns* this) {
|
||||
u32 EnDns_CanBuyDekuSticks(EnDns* this) {
|
||||
if ((CUR_CAPACITY(UPG_DEKU_STICKS) != 0) && (AMMO(ITEM_DEKU_STICK) >= CUR_CAPACITY(UPG_DEKU_STICKS))) {
|
||||
return 1;
|
||||
return DNS_CANBUY_RESULT_CAPACITY_FULL;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) {
|
||||
return 0;
|
||||
return DNS_CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
|
||||
if (Item_CheckObtainability(ITEM_DEKU_STICK) == ITEM_NONE) {
|
||||
return 2;
|
||||
return DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM;
|
||||
}
|
||||
return 4;
|
||||
|
||||
return DNS_CANBUY_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
u32 func_809EF70C(EnDns* this) {
|
||||
u32 EnDns_CanBuyPrice(EnDns* this) {
|
||||
if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) {
|
||||
return 0;
|
||||
return DNS_CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
return 4;
|
||||
|
||||
return DNS_CANBUY_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
u32 func_809EF73C(EnDns* this) {
|
||||
u32 EnDns_CanBuyDekuSeeds(EnDns* this) {
|
||||
if (INV_CONTENT(ITEM_SLINGSHOT) == ITEM_NONE) {
|
||||
return 3;
|
||||
return DNS_CANBUY_RESULT_CANT_GET_NOW;
|
||||
}
|
||||
|
||||
if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) {
|
||||
return 1;
|
||||
return DNS_CANBUY_RESULT_CAPACITY_FULL;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) {
|
||||
return 0;
|
||||
return DNS_CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
|
||||
if (Item_CheckObtainability(ITEM_DEKU_SEEDS) == ITEM_NONE) {
|
||||
return 2;
|
||||
return DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM;
|
||||
}
|
||||
return 4;
|
||||
|
||||
return DNS_CANBUY_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
u32 func_809EF800(EnDns* this) {
|
||||
u32 EnDns_CanBuyDekuShield(EnDns* this) {
|
||||
if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, EQUIP_INV_SHIELD_DEKU)) {
|
||||
return 1;
|
||||
return DNS_CANBUY_RESULT_CAPACITY_FULL;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) {
|
||||
return 0;
|
||||
return DNS_CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
return 4;
|
||||
|
||||
return DNS_CANBUY_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
u32 func_809EF854(EnDns* this) {
|
||||
u32 EnDns_CanBuyBombs(EnDns* this) {
|
||||
if (!CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) {
|
||||
return 3;
|
||||
return DNS_CANBUY_RESULT_CANT_GET_NOW;
|
||||
}
|
||||
|
||||
if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) {
|
||||
return 1;
|
||||
return DNS_CANBUY_RESULT_CAPACITY_FULL;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) {
|
||||
return 0;
|
||||
return DNS_CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
return 4;
|
||||
|
||||
return DNS_CANBUY_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
u32 func_809EF8F4(EnDns* this) {
|
||||
u32 EnDns_CanBuyArrows(EnDns* this) {
|
||||
if (Item_CheckObtainability(ITEM_BOW) == ITEM_NONE) {
|
||||
return 3;
|
||||
return DNS_CANBUY_RESULT_CANT_GET_NOW;
|
||||
}
|
||||
|
||||
if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) {
|
||||
return 1;
|
||||
return DNS_CANBUY_RESULT_CAPACITY_FULL;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) {
|
||||
return 0;
|
||||
return DNS_CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
return 4;
|
||||
|
||||
return DNS_CANBUY_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
u32 func_809EF9A4(EnDns* this) {
|
||||
u32 EnDns_CanBuyBottle(EnDns* this) {
|
||||
if (!Inventory_HasEmptyBottle()) {
|
||||
return 1;
|
||||
return DNS_CANBUY_RESULT_CAPACITY_FULL;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) {
|
||||
return 0;
|
||||
return DNS_CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
return 4;
|
||||
|
||||
return DNS_CANBUY_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
/* Paying and flagging functions */
|
||||
|
||||
void func_809EF9F8(EnDns* this) {
|
||||
void EnDns_PayPrice(EnDns* this) {
|
||||
Rupees_ChangeBy(-this->dnsItemEntry->itemPrice);
|
||||
}
|
||||
|
||||
void func_809EFA28(EnDns* this) {
|
||||
void EnDns_PayForDekuNuts(EnDns* this) {
|
||||
Rupees_ChangeBy(-this->dnsItemEntry->itemPrice);
|
||||
}
|
||||
|
||||
void func_809EFA58(EnDns* this) {
|
||||
SET_ITEMGETINF(ITEMGETINF_0B);
|
||||
void EnDns_PayForHeartPiece(EnDns* this) {
|
||||
SET_ITEMGETINF(ITEMGETINF_DEKU_HEART_PIECE);
|
||||
Rupees_ChangeBy(-this->dnsItemEntry->itemPrice);
|
||||
}
|
||||
|
||||
void func_809EFA9C(EnDns* this) {
|
||||
void EnDns_PayForBombs(EnDns* this) {
|
||||
Rupees_ChangeBy(-this->dnsItemEntry->itemPrice);
|
||||
}
|
||||
|
||||
void func_809EFACC(EnDns* this) {
|
||||
void EnDns_PayForArrows(EnDns* this) {
|
||||
Rupees_ChangeBy(-this->dnsItemEntry->itemPrice);
|
||||
}
|
||||
|
||||
void func_809EFAFC(EnDns* this) {
|
||||
SET_INFTABLE(INFTABLE_192);
|
||||
void EnDns_PayForDekuStickUpgrade(EnDns* this) {
|
||||
SET_INFTABLE(INFTABLE_HAS_DEKU_STICK_UPGRADE);
|
||||
Rupees_ChangeBy(-this->dnsItemEntry->itemPrice);
|
||||
}
|
||||
|
||||
void func_809EFB40(EnDns* this) {
|
||||
SET_INFTABLE(INFTABLE_193);
|
||||
void EnDns_PayForDekuNutUpgrade(EnDns* this) {
|
||||
SET_INFTABLE(INFTABLE_HAS_DEKU_NUT_UPGRADE);
|
||||
Rupees_ChangeBy(-this->dnsItemEntry->itemPrice);
|
||||
}
|
||||
|
||||
void EnDns_SetupWait(EnDns* this, PlayState* play) {
|
||||
void EnDns_SetupIdle(EnDns* this, PlayState* play) {
|
||||
if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
|
||||
this->actionFunc = EnDns_Wait;
|
||||
EnDns_ChangeAnim(this, ENDNS_ANIM_0);
|
||||
this->actionFunc = EnDns_Idle;
|
||||
EnDns_ChangeAnim(this, DNS_ANIM_IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
void EnDns_Wait(EnDns* this, PlayState* play) {
|
||||
void EnDns_Idle(EnDns* this, PlayState* play) {
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 2000, 0);
|
||||
this->actor.world.rot.y = this->actor.shape.rot.y;
|
||||
|
||||
if (Actor_ProcessTalkRequest(&this->actor, play)) {
|
||||
this->actionFunc = EnDns_Talk;
|
||||
} else {
|
||||
|
@ -340,41 +359,45 @@ void EnDns_Talk(EnDns* this, PlayState* play) {
|
|||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
|
||||
switch (play->msgCtx.choiceIndex) {
|
||||
case 0: // OK
|
||||
switch (this->dnsItemEntry->purchaseableCheck(this)) {
|
||||
case 0:
|
||||
switch (this->dnsItemEntry->canBuy(this)) {
|
||||
case DNS_CANBUY_RESULT_NEED_RUPEES:
|
||||
Message_ContinueTextbox(play, 0x10A5);
|
||||
this->actionFunc = func_809F008C;
|
||||
this->actionFunc = EnDns_SetupNoSaleBurrow;
|
||||
break;
|
||||
case 1:
|
||||
|
||||
case DNS_CANBUY_RESULT_CAPACITY_FULL:
|
||||
Message_ContinueTextbox(play, 0x10A6);
|
||||
this->actionFunc = func_809F008C;
|
||||
this->actionFunc = EnDns_SetupNoSaleBurrow;
|
||||
break;
|
||||
case 3:
|
||||
|
||||
case DNS_CANBUY_RESULT_CANT_GET_NOW:
|
||||
Message_ContinueTextbox(play, 0x10DE);
|
||||
this->actionFunc = func_809F008C;
|
||||
this->actionFunc = EnDns_SetupNoSaleBurrow;
|
||||
break;
|
||||
case 2:
|
||||
case 4:
|
||||
|
||||
case DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM:
|
||||
case DNS_CANBUY_RESULT_SUCCESS:
|
||||
Message_ContinueTextbox(play, 0x10A7);
|
||||
this->actionFunc = func_809EFEE8;
|
||||
this->actionFunc = EnDns_SetupSale;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: // No way
|
||||
|
||||
case 1: // "No"
|
||||
Message_ContinueTextbox(play, 0x10A4);
|
||||
this->actionFunc = func_809F008C;
|
||||
this->actionFunc = EnDns_SetupNoSaleBurrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_809EFDD0(EnDns* this, PlayState* play) {
|
||||
if (this->actor.params == 0x9) {
|
||||
void EnDns_OfferSaleItem(EnDns* this, PlayState* play) {
|
||||
if (DNS_GET_TYPE(&this->actor) == DNS_TYPE_DEKU_STICK_UPGRADE) {
|
||||
if (CUR_UPG_VALUE(UPG_DEKU_STICKS) < 2) {
|
||||
Actor_OfferGetItem(&this->actor, play, GI_DEKU_STICK_UPGRADE_20, 130.0f, 100.0f);
|
||||
} else {
|
||||
Actor_OfferGetItem(&this->actor, play, GI_DEKU_STICK_UPGRADE_30, 130.0f, 100.0f);
|
||||
}
|
||||
} else if (this->actor.params == 0xA) {
|
||||
} else if (DNS_GET_TYPE(&this->actor) == DNS_TYPE_DEKU_NUT_UPGRADE) {
|
||||
if (CUR_UPG_VALUE(UPG_DEKU_NUTS) < 2) {
|
||||
Actor_OfferGetItem(&this->actor, play, GI_DEKU_NUT_UPGRADE_30, 130.0f, 100.0f);
|
||||
} else {
|
||||
|
@ -385,84 +408,85 @@ void func_809EFDD0(EnDns* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
void func_809EFEE8(EnDns* this, PlayState* play) {
|
||||
void EnDns_SetupSale(EnDns* this, PlayState* play) {
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
|
||||
Message_CloseTextbox(play);
|
||||
func_809EFDD0(this, play);
|
||||
this->actionFunc = func_809EFF50;
|
||||
EnDns_OfferSaleItem(this, play);
|
||||
this->actionFunc = EnDns_Sale;
|
||||
}
|
||||
}
|
||||
|
||||
void func_809EFF50(EnDns* this, PlayState* play) {
|
||||
void EnDns_Sale(EnDns* this, PlayState* play) {
|
||||
if (Actor_HasParent(&this->actor, play)) {
|
||||
this->actor.parent = NULL;
|
||||
this->actionFunc = func_809EFF98;
|
||||
} else {
|
||||
func_809EFDD0(this, play);
|
||||
}
|
||||
}
|
||||
|
||||
void func_809EFF98(EnDns* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (player->stateFlags1 & PLAYER_STATE1_10) {
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
|
||||
this->dnsItemEntry->setRupeesAndFlags(this);
|
||||
this->dropCollectible = 1;
|
||||
this->maintainCollider = 0;
|
||||
this->actor.flags &= ~ACTOR_FLAG_0;
|
||||
EnDns_ChangeAnim(this, ENDNS_ANIM_1);
|
||||
this->actionFunc = EnDns_SetupBurrow;
|
||||
}
|
||||
} else {
|
||||
this->dnsItemEntry->setRupeesAndFlags(this);
|
||||
this->dropCollectible = 1;
|
||||
this->maintainCollider = 0;
|
||||
this->actor.flags &= ~ACTOR_FLAG_0;
|
||||
EnDns_ChangeAnim(this, ENDNS_ANIM_1);
|
||||
this->actionFunc = EnDns_SetupBurrow;
|
||||
}
|
||||
}
|
||||
|
||||
void func_809F008C(EnDns* this, PlayState* play) {
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
|
||||
this->maintainCollider = 0;
|
||||
this->actor.flags &= ~ACTOR_FLAG_0;
|
||||
EnDns_ChangeAnim(this, ENDNS_ANIM_1);
|
||||
this->actionFunc = EnDns_SetupBurrow;
|
||||
} else {
|
||||
EnDns_OfferSaleItem(this, play);
|
||||
}
|
||||
}
|
||||
|
||||
void EnDns_SetupBurrow(EnDns* this, PlayState* play) {
|
||||
f32 frameCount = Animation_GetLastFrame(&gBusinessScrubAnim_4404);
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (this->skelAnime.curFrame == frameCount) {
|
||||
Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE);
|
||||
if (player->stateFlags1 & PLAYER_STATE1_10) {
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
|
||||
this->dnsItemEntry->payment(this);
|
||||
this->dropCollectible = true;
|
||||
this->bumpOn = false;
|
||||
this->actor.flags &= ~ACTOR_FLAG_0;
|
||||
EnDns_ChangeAnim(this, DNS_ANIM_BURROW);
|
||||
this->actionFunc = EnDns_Burrow;
|
||||
}
|
||||
} else {
|
||||
this->dnsItemEntry->payment(this);
|
||||
this->dropCollectible = true;
|
||||
this->bumpOn = false;
|
||||
this->actor.flags &= ~ACTOR_FLAG_0;
|
||||
EnDns_ChangeAnim(this, DNS_ANIM_BURROW);
|
||||
this->actionFunc = EnDns_Burrow;
|
||||
}
|
||||
}
|
||||
|
||||
void EnDns_SetupNoSaleBurrow(EnDns* this, PlayState* play) {
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
|
||||
this->bumpOn = false;
|
||||
this->actor.flags &= ~ACTOR_FLAG_0;
|
||||
EnDns_ChangeAnim(this, DNS_ANIM_BURROW);
|
||||
this->actionFunc = EnDns_Burrow;
|
||||
this->standOnGround = 0;
|
||||
this->yInitPos = this->actor.world.pos.y;
|
||||
}
|
||||
}
|
||||
|
||||
void EnDns_Burrow(EnDns* this, PlayState* play) {
|
||||
f32 depth;
|
||||
f32 frameCount = Animation_GetLastFrame(&gBusinessScrubLeaveBurrowAnim);
|
||||
|
||||
if (this->skelAnime.curFrame == frameCount) {
|
||||
Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE);
|
||||
this->actionFunc = EnDns_PostBurrow;
|
||||
this->standOnGround = false;
|
||||
this->yInitPos = this->actor.world.pos.y;
|
||||
}
|
||||
}
|
||||
|
||||
void EnDns_PostBurrow(EnDns* this, PlayState* play) {
|
||||
f32 depthInGround = this->yInitPos - this->actor.world.pos.y;
|
||||
Vec3f initPos;
|
||||
s32 i;
|
||||
|
||||
depth = this->yInitPos - this->actor.world.pos.y;
|
||||
if ((this->dustTimer & 3) == 0) {
|
||||
initPos.x = this->actor.world.pos.x;
|
||||
initPos.y = this->yInitPos;
|
||||
initPos.z = this->actor.world.pos.z;
|
||||
func_80028990(play, 20.0f, &initPos);
|
||||
}
|
||||
|
||||
this->actor.shape.rot.y += 0x2000;
|
||||
// Drops only if you bought its item
|
||||
if (depth > 400.0f) {
|
||||
|
||||
if (depthInGround > 400.0f) {
|
||||
if (this->dropCollectible) {
|
||||
initPos.x = this->actor.world.pos.x;
|
||||
initPos.y = this->yInitPos;
|
||||
initPos.z = this->actor.world.pos.z;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
Item_DropCollectible(play, &initPos, ITEM00_RECOVERY_HEART);
|
||||
}
|
||||
|
@ -476,16 +500,20 @@ void EnDns_Update(Actor* thisx, PlayState* play) {
|
|||
s16 pad;
|
||||
|
||||
this->dustTimer++;
|
||||
this->actor.textId = D_809F040C[this->actor.params];
|
||||
this->actor.textId = sStartingTextIds[DNS_GET_TYPE(&this->actor)];
|
||||
|
||||
Actor_SetFocus(&this->actor, 60.0f);
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
Actor_MoveXZGravity(&this->actor);
|
||||
|
||||
this->actionFunc(this, play);
|
||||
|
||||
if (this->standOnGround) {
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2);
|
||||
}
|
||||
if (this->maintainCollider) {
|
||||
|
||||
if (this->bumpOn) {
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue