Misc fixes (#159)

* Fix `extract_assets` not properly checking if scenes files were updated

* fix `first_diff.py` path due to the baserom renaming

* FlexSkeletonHeader and other stuff

* fix some SkeletonHeader instead of FlexSkeletonHeader

* Add blob compilation to makefile

* CURRENT_DAY and type swaps

* Remove extra cast

* run format

* zbanks suggestions
This commit is contained in:
Anghelo Carvajal 2021-05-20 18:52:07 -04:00 committed by GitHub
parent 458dd13141
commit 062a813fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 198 additions and 192 deletions

View File

@ -80,6 +80,8 @@ BASEROM_DIRS := $(shell find baserom -type d 2>/dev/null)
COMP_DIRS := $(BASEROM_DIRS:baserom%=comp%) COMP_DIRS := $(BASEROM_DIRS:baserom%=comp%)
BINARY_DIRS := $(BASEROM_DIRS:baserom%=binary%) BINARY_DIRS := $(BASEROM_DIRS:baserom%=binary%)
ASSET_C_FILES := $(shell find assets/ -type f -name "*.c") ASSET_C_FILES := $(shell find assets/ -type f -name "*.c")
ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin))
ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),build/$f)
# Because we may not have disassembled the code files yet, there might not be any assembly files. # Because we may not have disassembled the code files yet, there might not be any assembly files.
# Instead, generate a list of assembly files based on what's listed in the linker script. # Instead, generate a list of assembly files based on what's listed in the linker script.
@ -137,7 +139,7 @@ CC := ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
# just using build/baserom still probably has some race condiction/dependency bug, but since # just using build/baserom still probably has some race condiction/dependency bug, but since
# it is first and should be completed relatively fast, it should not occur all that often. # it is first and should be completed relatively fast, it should not occur all that often.
$(UNCOMPRESSED_ROM): build/baserom $(TEXTURE_FILES_OUT) $(UNCOMPRESSED_ROM_FILES) $(UNCOMPRESSED_ROM): build/baserom $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(UNCOMPRESSED_ROM_FILES)
./tools/makerom.py ./tables/dmadata_table.txt $@ ./tools/makerom.py ./tables/dmadata_table.txt $@
ifeq ($(COMPARE),1) ifeq ($(COMPARE),1)
@md5sum $(UNCOMPRESSED_ROM) @md5sum $(UNCOMPRESSED_ROM)
@ -302,6 +304,9 @@ build/assets/%.d: assets/%.c
build/%.inc.c: %.png build/%.inc.c: %.png
$(ZAPD) btex -eh -tt $(lastword ,$(subst ., ,$(basename $<))) -i $< -o $@ $(ZAPD) btex -eh -tt $(lastword ,$(subst ., ,$(basename $<))) -i $< -o $@
build/assets/%.bin.inc.c: assets/%.bin
$(ZAPD) bblb -eh -i $< -o $@
build/assets/%.jpg.inc.c: assets/%.jpg build/assets/%.jpg.inc.c: assets/%.jpg
$(ZAPD) bren -eh -i $< -o $@ $(ZAPD) bren -eh -i $< -o $@

View File

@ -37,9 +37,11 @@ def ExtractFunc(fullPath):
basromPath = os.path.join("baserom", "assets", *pathList[2:-1]) basromPath = os.path.join("baserom", "assets", *pathList[2:-1])
outSourcePath = outPath outSourcePath = outPath
isScene = fullPath.startswith("assets/xml/scenes/") ## MM doesn't have _scene prefixed files, so this check is not necessary.
if isScene: ## This _may_ change in the future, so I wont delete this for now.
objectName += "_scene" #isScene = fullPath.startswith("assets/xml/scenes/")
#if isScene:
# objectName += "_scene"
if not globalForce: if not globalForce:
cFile = os.path.join(outPath, objectName + ".c") cFile = os.path.join(outPath, objectName + ".c")

View File

@ -34,10 +34,10 @@ diff_count = args.count
if args.make: if args.make:
check_call(["make", "-j4", "COMPARE=0"]) check_call(["make", "-j4", "COMPARE=0"])
baseimg = f"expected/rom_uncompressed.z64" baseimg = f"expected/mm.us.rev1.rom_uncompressed.z64"
basemap = f"expected/build/mm.map" basemap = f"expected/build/mm.map"
myimg = f"rom_uncompressed.z64" myimg = f"mm.us.rev1.rom_uncompressed.z64"
mymap = f"build/mm.map" mymap = f"build/mm.map"
if not os.path.isfile(baseimg): if not os.path.isfile(baseimg):

View File

@ -2537,33 +2537,33 @@ s32 Entrance_GetTransitionFlags(u16 entranceIndex);
// void func_80132FDC(void); // void func_80132FDC(void);
// void func_80133000(void); // void func_80133000(void);
// void func_80133038(void); // void func_80133038(void);
void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex); void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex);
void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex); void SkelAnime_LodDraw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex);
void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor, s32 dListIndex, RSPMatrix** mtx); void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor, s32 dListIndex, RSPMatrix** mtx);
void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor, s32 dListIndex); void SkelAnime_LodDrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor, s32 dListIndex);
void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor); void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor);
void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor); void SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor);
void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, RSPMatrix** limbMatricies); void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, RSPMatrix** limbMatricies);
void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor); void SkelAnime_DrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor);
void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor, RSPMatrix** mtx); void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor, RSPMatrix** mtx);
void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor); void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor);
void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32 limbCount, Vec3s* dst); void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32 limbCount, Vec3s* dst);
s16 SkelAnime_GetTotalFrames(GenericAnimationHeader* animationSeg); s16 SkelAnime_GetTotalFrames(AnimationHeaderCommon* animationSeg);
s16 SkelAnime_GetFrameCount(GenericAnimationHeader* animationSeg); s16 SkelAnime_GetFrameCount(AnimationHeaderCommon* animationSeg);
Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx); Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx);
Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx); Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx);
Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, RSPMatrix** mtx, Gfx* gfx); Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, RSPMatrix** mtx, Gfx* gfx);
Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx); Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx);
s32 func_80134FFC(s32 arg0, s32 arg1, Vec3s* dst); s32 func_80134FFC(s32 arg0, s32 arg1, Vec3s* dst);
s16 func_801353D4(GenericAnimationHeader* animationSeg); s16 func_801353D4(AnimationHeaderCommon* animationSeg);
s16 SkelAnime_GetTotalFrames2(GenericAnimationHeader* animationSeg); s16 SkelAnime_GetTotalFrames2(AnimationHeaderCommon* animationSeg);
s16 SkelAnime_GetFrameCount2(GenericAnimationHeader* animationSeg); s16 SkelAnime_GetFrameCount2(AnimationHeaderCommon* animationSeg);
void SkelAnime_InterpolateVec3s(s32 limbCount, Vec3s* dst, Vec3s* vec2, Vec3s* vec3, f32 unkf); void SkelAnime_InterpolateVec3s(s32 limbCount, Vec3s* dst, Vec3s* vec2, Vec3s* vec3, f32 unkf);
void SkelAnime_AnimationCtxReset(AnimationContext* animationCtx); void SkelAnime_AnimationCtxReset(AnimationContext* animationCtx);
void func_801358D4(GlobalContext* globalCtx); void func_801358D4(GlobalContext* globalCtx);
void func_801358F4(GlobalContext* globalCtx); void func_801358F4(GlobalContext* globalCtx);
AnimationEntry* SkelAnime_NextEntry(AnimationContext* animationCtx, AnimationType type); AnimationEntry* SkelAnime_NextEntry(AnimationContext* animationCtx, AnimationType type);
void SkelAnime_LoadLinkAnimetion(GlobalContext* globalCtx, LinkAnimetionEntry* linkAnimetionSeg, s32 frame, s32 limbCount, void* ram); void SkelAnime_LoadLinkAnimetion(GlobalContext* globalCtx, LinkAnimationHeader* linkAnimetionSeg, s32 frame, s32 limbCount, void* ram);
void SkelAnime_LoadAnimationType1(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src); void SkelAnime_LoadAnimationType1(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src);
void SkelAnime_LoadAnimationType2(GlobalContext* globalCtx, s32 limbCount, Vec3s* arg2, Vec3s* arg3, f32 arg4); void SkelAnime_LoadAnimationType2(GlobalContext* globalCtx, s32 limbCount, Vec3s* arg2, Vec3s* arg3, f32 arg4);
void SkelAnime_LoadAnimationType3(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index); void SkelAnime_LoadAnimationType3(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index);
@ -2576,7 +2576,7 @@ void SkelAnime_AnimationType3Loaded(GlobalContext* globalCtx, AnimationEntryType
void SkelAnime_AnimationType4Loaded(GlobalContext* globalCtx, AnimationEntryType4* entry); void SkelAnime_AnimationType4Loaded(GlobalContext* globalCtx, AnimationEntryType4* entry);
void SkelAnime_AnimationType5Loaded(GlobalContext* globalCtx, AnimationEntryType5* entry); void SkelAnime_AnimationType5Loaded(GlobalContext* globalCtx, AnimationEntryType5* entry);
void func_80135EE8(GlobalContext* globalCtx, AnimationContext* animationCtx); void func_80135EE8(GlobalContext* globalCtx, AnimationContext* animationCtx);
void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, LinkAnimetionEntry* linkAnimetionEntrySeg, s32 flags, Vec3s* limbDrawTbl, Vec3s* transitionDrawTbl, s32 limbBufCount); void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, LinkAnimationHeader* linkAnimationHeaderSeg, s32 flags, Vec3s* limbDrawTbl, Vec3s* transitionDrawTbl, s32 limbBufCount);
void func_801360A8(SkelAnime* skelAnime); void func_801360A8(SkelAnime* skelAnime);
s32 func_801360E0(GlobalContext* globalCtx, SkelAnime* skelAnime); s32 func_801360E0(GlobalContext* globalCtx, SkelAnime* skelAnime);
s32 func_80136104(GlobalContext* globalCtx, SkelAnime* skelAnime); s32 func_80136104(GlobalContext* globalCtx, SkelAnime* skelAnime);
@ -2584,23 +2584,23 @@ void func_801361BC(GlobalContext* globalCtx, SkelAnime* skelAnime);
s32 func_80136288(GlobalContext* globalCtx, SkelAnime* skelAnime); s32 func_80136288(GlobalContext* globalCtx, SkelAnime* skelAnime);
s32 func_8013631C(GlobalContext* globalCtx, SkelAnime* skelAnime); s32 func_8013631C(GlobalContext* globalCtx, SkelAnime* skelAnime);
void SkelAnime_SetTransition(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 transitionRate); void SkelAnime_SetTransition(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 transitionRate);
void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, f32 playbackSpeed, f32 frame, f32 frameCount, u8 animationMode, f32 transitionRate); void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed, f32 frame, f32 frameCount, u8 animationMode, f32 transitionRate);
void SkelAnime_ChangeLinkAnimDefaultStop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg); void SkelAnime_ChangeLinkAnimDefaultStop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg);
void SkelAnime_ChangeLinkAnimPlaybackStop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, f32 playbackSpeed); void SkelAnime_ChangeLinkAnimPlaybackStop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed);
void SkelAnime_ChangeLinkAnimDefaultRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg); void SkelAnime_ChangeLinkAnimDefaultRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg);
void SkelAnime_ChangeLinkAnimPlaybackRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, f32 playbackSpeed); void SkelAnime_ChangeLinkAnimPlaybackRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed);
void func_8013670C(GlobalContext* globalCtx, SkelAnime* skelAnime); void func_8013670C(GlobalContext* globalCtx, SkelAnime* skelAnime);
void func_8013673C(GlobalContext* globalCtx, SkelAnime* skelAnime); void func_8013673C(GlobalContext* globalCtx, SkelAnime* skelAnime);
void func_8013676C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, f32 frame); void func_8013676C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 frame);
void func_801367B0(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, f32 frame); void func_801367B0(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 frame);
void func_801367F4(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 frame); void func_801367F4(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 frame);
void func_8013682C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, f32 transitionFrame, LinkAnimetionEntry* linkAnimetionEntrySeg2, f32 frame, f32 transitionRate, Vec3s* limbDrawTbl); void func_8013682C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 transitionFrame, LinkAnimationHeader* LinkAnimationHeaderSeg2, f32 frame, f32 transitionRate, Vec3s* limbDrawTbl);
void func_801368CC(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, f32 transitionFrame, LinkAnimetionEntry* linkAnimetionEntrySeg2, f32 frame, f32 transitionRate, Vec3s* limbDrawTbl); void func_801368CC(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 transitionFrame, LinkAnimationHeader* LinkAnimationHeaderSeg2, f32 frame, f32 transitionRate, Vec3s* limbDrawTbl);
void SkelAnime_SetModeStop(SkelAnime* skelAnime); void SkelAnime_SetModeStop(SkelAnime* skelAnime);
s32 func_80136990(SkelAnime* skelAnime, f32 arg1, f32 updateRate); s32 func_80136990(SkelAnime* skelAnime, f32 arg1, f32 updateRate);
s32 func_80136A48(SkelAnime* skelAnime, f32 arg1); s32 func_80136A48(SkelAnime* skelAnime, f32 arg1);
void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount); void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount);
void SkelAnime_InitSV(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount); void SkelAnime_InitSV(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount);
void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg); void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg);
void func_80136C84(SkelAnime* skelAnime); void func_80136C84(SkelAnime* skelAnime);
s32 SkelAnime_FrameUpdateMatrix(SkelAnime* skelAnime); s32 SkelAnime_FrameUpdateMatrix(SkelAnime* skelAnime);

View File

@ -29,6 +29,8 @@
//#define LINK_IS_CHILD (gSaveContext.perm.linkAge != 0) //#define LINK_IS_CHILD (gSaveContext.perm.linkAge != 0)
#define LINK_IS_ADULT (gSaveContext.perm.linkAge == 0) #define LINK_IS_ADULT (gSaveContext.perm.linkAge == 0)
#define CURRENT_DAY (gSaveContext.perm.day % 5)
#define SQ(x) ((x)*(x)) #define SQ(x) ((x)*(x))
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1)) #define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))

View File

@ -644,9 +644,9 @@ typedef struct {
/* 0x0008 */ s32 cutscene; /* 0x0008 */ s32 cutscene;
/* 0x000C */ u16 time; /* 0x000C */ u16 time;
/* 0x000E */ UNK_TYPE1 padE[0x2]; /* 0x000E */ UNK_TYPE1 padE[0x2];
/* 0x0010 */ u32 isNight; /* 0x0010 */ s32 isNight;
/* 0x0014 */ u32 unk14; /* 0x0014 */ u32 unk14;
/* 0x0018 */ u32 day; /* 0x0018 */ s32 day;
/* 0x001C */ u32 daysElapsed; /* 0x001C */ u32 daysElapsed;
/* 0x0020 */ u8 unk20; /* 0x0020 */ u8 unk20;
/* 0x0021 */ UNK_TYPE1 pad21[0x2]; /* 0x0021 */ UNK_TYPE1 pad21[0x2];

View File

@ -24,18 +24,19 @@ typedef struct {
/* 0x007 */ u8 nextLimbIndex; // The parent limb's next limb index into the limb table. /* 0x007 */ u8 nextLimbIndex; // The parent limb's next limb index into the limb table.
/* 0x008 */ Gfx* displayLists[1]; // Display lists for the limb. Index 0 is the normal display list, index 1 is the /* 0x008 */ Gfx* displayLists[1]; // Display lists for the limb. Index 0 is the normal display list, index 1 is the
// far model display list. // far model display list.
} SkelLimbEntry; // Size = 0xC or 0x10 } StandardLimb; // Size = 0xC
// Model has limbs with only rigid meshes
typedef struct { typedef struct {
/* 0x000 */ SkelLimbEntry* limbs[1]; // One or more limbs, index 0 is the root limb. /* 0x000 */ void** skeletonSeg; // Segment address of SkelLimbIndex.
} Skeleton; // Size >= 4
typedef struct {
/* 0x000 */ Skeleton* skeletonSeg; // Segment address of SkelLimbIndex.
/* 0x004 */ u8 limbCount; // Number of limbs in the model. /* 0x004 */ u8 limbCount; // Number of limbs in the model.
/* 0x005 */ char unk05[3]; // unknown, maybe padding? } SkeletonHeader; // size = 0x8
// Model has limbs with flexible meshes
typedef struct {
/* 0x000 */ SkeletonHeader sh;
/* 0x008 */ u8 dListCount; // Number of display lists in the model. /* 0x008 */ u8 dListCount; // Number of display lists in the model.
} SkeletonHeader; // Size = 0xC } FlexSkeletonHeader; // size = 0xC
typedef s16 AnimationRotationValue; typedef s16 AnimationRotationValue;
@ -43,18 +44,18 @@ typedef struct {
/* 0x000 */ u16 x; /* 0x000 */ u16 x;
/* 0x002 */ u16 y; /* 0x002 */ u16 y;
/* 0x004 */ u16 z; /* 0x004 */ u16 z;
} AnimationRotationIndex; // size = 0x06 } JointIndex; // size = 0x06
typedef struct { typedef struct {
/* 0x000 */ s16 frameCount; /* 0x000 */ s16 frameCount;
/* 0x002 */ s16 unk02; /* 0x002 */ s16 unk02;
} GenericAnimationHeader; // size = 0x4 } AnimationHeaderCommon; // size = 0x4
typedef struct { typedef struct {
/* 0x000 */ GenericAnimationHeader genericHeader; /* 0x00 */ AnimationHeaderCommon common;
/* 0x004 */ u32 rotationValueSeg; // referenced as tbl /* 0x04 */ s16* frameData; // referenced as tbl
/* 0x008 */ u32 rotationIndexSeg; // referenced as ref_tbl /* 0x08 */ JointIndex* jointIndices; // referenced as ref_tbl
/* 0x00C */ u16 limit; /* 0x0C */ u16 staticIndexMax;
} AnimationHeader; // size = 0x10 } AnimationHeader; // size = 0x10
typedef enum { typedef enum {
@ -137,9 +138,9 @@ typedef struct AnimationContext {
} AnimationContext; // size = 0xC84 } AnimationContext; // size = 0xC84
typedef struct { typedef struct {
/* 0x000 */ GenericAnimationHeader genericHeader; /* 0x00 */ AnimationHeaderCommon common;
/* 0x004 */ u32 animationSegAddress; /* 0x04 */ u32 segment;
} LinkAnimetionEntry; // size = 0x8 } LinkAnimationHeader; // size = 0x8
struct SkelAnime { struct SkelAnime {
/* 0x00 */ u8 limbCount; // joint_Num /* 0x00 */ u8 limbCount; // joint_Num
@ -150,12 +151,12 @@ struct SkelAnime {
/* 0x01 */ u8 mode; /* 0x01 */ u8 mode;
/* 0x02 */ u8 dListCount; /* 0x02 */ u8 dListCount;
/* 0x03 */ s8 unk03; /* 0x03 */ s8 unk03;
/* 0x04 */ Skeleton* skeleton; /* 0x04 */ void** skeleton; // An array of pointers to limbs. Can be StandardLimb, LodLimb, or SkinLimb.
/* 0x08 */ /* 0x08 */
union { union {
AnimationHeader* animCurrentSeg; AnimationHeader* animCurrentSeg;
LinkAnimetionEntry* linkAnimetionSeg; LinkAnimationHeader* linkAnimetionSeg;
GenericAnimationHeader* genericSeg; AnimationHeaderCommon* genericSeg;
}; };
/* 0x0C */ f32 initialFrame; /* 0x0C */ f32 initialFrame;
/* 0x10 */ f32 animFrameCount; /* 0x10 */ f32 animFrameCount;

View File

@ -8,8 +8,9 @@ s32 func_801370B0(SkelAnime* skelAnime);
s32 func_8013713C(SkelAnime* skelAnime); s32 func_8013713C(SkelAnime* skelAnime);
void SkelAnime_ChangeAnimDefaultRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg); void SkelAnime_ChangeAnimDefaultRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg);
void func_80137748(SkelAnime* skelAnime, Vec3f* pos, s16 angle); void func_80137748(SkelAnime* skelAnime, Vec3f* pos, s16 angle);
void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime,
f32 playbackSpeed, f32 frame, f32 frameCount, u8 animationMode, f32 transitionRate); LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed, f32 frame, f32 frameCount,
u8 animationMode, f32 transitionRate);
void SkelAnime_CopyVec3s(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src); void SkelAnime_CopyVec3s(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src);
void SkelAnime_LinkAnimetionLoaded(GlobalContext* globalCtx, AnimationEntryType0* entry); void SkelAnime_LinkAnimetionLoaded(GlobalContext* globalCtx, AnimationEntryType0* entry);
void SkelAnime_AnimationType1Loaded(GlobalContext* globalCtx, AnimationEntryType1* entry); void SkelAnime_AnimationType1Loaded(GlobalContext* globalCtx, AnimationEntryType1* entry);
@ -30,9 +31,9 @@ s32 D_801F5AB4;
/* /*
* Draws the limb at `limbIndex` with a level of detail display lists index by `dListIndex` * Draws the limb at `limbIndex` with a level of detail display lists index by `dListIndex`
*/ */
void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex) { OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
Gfx* dList; Gfx* dList;
Vec3f pos; Vec3f pos;
Vec3s rot; Vec3s rot;
@ -40,7 +41,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
s32 pad; s32 pad;
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++; limbIndex++;
rot = limbDrawTable[limbIndex]; rot = limbDrawTable[limbIndex];
@ -81,9 +82,9 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
/* /*
* Draws the Skeleton described by `skeleton` with a level of detail display list indexed by `dListIndex` * Draws the Skeleton described by `skeleton` with a level of detail display list indexed by `dListIndex`
*/ */
void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, void SkelAnime_LodDraw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex) { OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
s32 pad; s32 pad;
Gfx* dList; Gfx* dList;
Vec3f pos; Vec3f pos;
@ -99,7 +100,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
pos.x = limbDrawTable[0].x; pos.x = limbDrawTable[0].x;
pos.y = limbDrawTable[0].y; pos.y = limbDrawTable[0].y;
pos.z = limbDrawTable[0].z; pos.z = limbDrawTable[0].z;
@ -136,10 +137,10 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
* Draws the limb at `limbIndex` with a level of detail display lists index by `dListIndex`, Limb matrices come * Draws the limb at `limbIndex` with a level of detail display lists index by `dListIndex`, Limb matrices come
* from a dynamic allocation from the graph arena. * from a dynamic allocation from the graph arena.
*/ */
void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor, OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor,
s32 dListIndex, RSPMatrix** mtx) { s32 dListIndex, RSPMatrix** mtx) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
Gfx* dList[2]; Gfx* dList[2];
Vec3f pos; Vec3f pos;
Vec3s rot; Vec3s rot;
@ -148,7 +149,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton*
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++; limbIndex++;
rot = limbDrawTable[limbIndex]; rot = limbDrawTable[limbIndex];
@ -195,10 +196,10 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton*
* Matricies for the limbs are dynamically allocted from the graph arena. The dynamic allocation occurs * Matricies for the limbs are dynamically allocted from the graph arena. The dynamic allocation occurs
* because the Skeleton is too large to be supported by the normal matrix stack. * because the Skeleton is too large to be supported by the normal matrix stack.
*/ */
void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, s32 dListCount, void SkelAnime_LodDrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount,
OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor, OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor,
s32 dListIndex) { s32 dListIndex) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
s32 pad; s32 pad;
Gfx* dList[2]; Gfx* dList[2];
Vec3f pos; Vec3f pos;
@ -218,7 +219,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li
gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx); gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
pos.x = limbDrawTable[0].x; pos.x = limbDrawTable[0].x;
pos.y = limbDrawTable[0].y; pos.y = limbDrawTable[0].y;
pos.z = limbDrawTable[0].z; pos.z = limbDrawTable[0].z;
@ -258,9 +259,9 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li
/* /*
* Draws the limb of the Skeleton `skeleton` at `limbIndex` * Draws the limb of the Skeleton `skeleton` at `limbIndex`
*/ */
void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor) { OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
Gfx* dList; Gfx* dList;
Vec3f pos; Vec3f pos;
Vec3s rot; Vec3s rot;
@ -269,7 +270,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++; limbIndex++;
rot = limbDrawTable[limbIndex]; rot = limbDrawTable[limbIndex];
pos.x = limbEntry->translation.x; pos.x = limbEntry->translation.x;
@ -305,9 +306,9 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele
} }
} }
void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, void SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor) { PostLimbDraw postLimbDraw, Actor* actor) {
SkelLimbEntry* rootLimb; StandardLimb* rootLimb;
s32 pad; s32 pad;
Gfx* dList; Gfx* dList;
Vec3f pos; Vec3f pos;
@ -322,7 +323,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra
gfxCtx = globalCtx->state.gfxCtx; gfxCtx = globalCtx->state.gfxCtx;
Matrix_Push(); Matrix_Push();
rootLimb = Lib_SegmentedToVirtual(skeleton->limbs[0]); rootLimb = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
pos.x = limbDrawTable[0].x; pos.x = limbDrawTable[0].x;
pos.y = limbDrawTable[0].y; pos.y = limbDrawTable[0].y;
@ -354,10 +355,10 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra
Matrix_Pop(); Matrix_Pop();
} }
void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor,
RSPMatrix** limbMatricies) { RSPMatrix** limbMatricies) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
Gfx* dList[2]; Gfx* dList[2];
Vec3f pos; Vec3f pos;
Vec3s rot; Vec3s rot;
@ -366,7 +367,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++; limbIndex++;
rot = limbDrawTable[limbIndex]; rot = limbDrawTable[limbIndex];
@ -407,9 +408,9 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske
} }
} }
void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, s32 dListCount, void SkelAnime_DrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor) { OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
s32 pad; s32 pad;
Gfx* dList[2]; Gfx* dList[2];
Vec3f pos; Vec3f pos;
@ -430,7 +431,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
pos.x = limbDrawTable[0].x; pos.x = limbDrawTable[0].x;
pos.y = limbDrawTable[0].y; pos.y = limbDrawTable[0].y;
@ -469,10 +470,10 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD
Matrix_Pop(); Matrix_Pop();
} }
void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor,
RSPMatrix** mtx) { RSPMatrix** mtx) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
Gfx* dList[2]; Gfx* dList[2];
Vec3f pos; Vec3f pos;
Vec3s rot; Vec3s rot;
@ -481,7 +482,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++; limbIndex++;
rot = limbDrawTable[limbIndex]; rot = limbDrawTable[limbIndex];
@ -529,9 +530,9 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
} }
} }
void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, s32 dListCount, void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor) { OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
s32 pad; s32 pad;
Gfx* dList[2]; Gfx* dList[2];
Vec3f pos; Vec3f pos;
@ -552,7 +553,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
pos.x = limbDrawTable[0].x; pos.x = limbDrawTable[0].x;
pos.y = limbDrawTable[0].y; pos.y = limbDrawTable[0].y;
@ -600,11 +601,11 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
*/ */
void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32 limbCount, Vec3s* dst) { void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32 limbCount, Vec3s* dst) {
AnimationHeader* animationHeader = Lib_SegmentedToVirtual(animationSeg); AnimationHeader* animationHeader = Lib_SegmentedToVirtual(animationSeg);
AnimationRotationIndex* index = Lib_SegmentedToVirtual(animationHeader->rotationIndexSeg); JointIndex* index = Lib_SegmentedToVirtual(animationHeader->jointIndices);
AnimationRotationValue* rotationValueTable = Lib_SegmentedToVirtual(animationHeader->rotationValueSeg); AnimationRotationValue* rotationValueTable = Lib_SegmentedToVirtual(animationHeader->frameData);
AnimationRotationValue* frameRotationValueTable = &rotationValueTable[currentFrame]; AnimationRotationValue* frameRotationValueTable = &rotationValueTable[currentFrame];
s32 i; s32 i;
u16 limit = animationHeader->limit; u16 limit = animationHeader->staticIndexMax;
for (i = 0; i < limbCount; i++) { for (i = 0; i < limbCount; i++) {
// Debug prints here, this is needed to prevent loop unrolling // Debug prints here, this is needed to prevent loop unrolling
@ -618,13 +619,13 @@ void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32
} }
} }
s16 SkelAnime_GetTotalFrames(GenericAnimationHeader* animationSeg) { s16 SkelAnime_GetTotalFrames(AnimationHeaderCommon* animationSeg) {
GenericAnimationHeader* animation = Lib_SegmentedToVirtual(animationSeg); AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
return animation->frameCount; return animation->frameCount;
} }
s16 SkelAnime_GetFrameCount(GenericAnimationHeader* animationSeg) { s16 SkelAnime_GetFrameCount(AnimationHeaderCommon* animationSeg) {
GenericAnimationHeader* animation = Lib_SegmentedToVirtual(animationSeg); AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
return (u16)animation->frameCount - 1; return (u16)animation->frameCount - 1;
} }
@ -633,16 +634,16 @@ s16 SkelAnime_GetFrameCount(GenericAnimationHeader* animationSeg) {
* Draws the Skeleton `skeleton`'s limb at index `limbIndex`. Appends all generated graphics commands to * Draws the Skeleton `skeleton`'s limb at index `limbIndex`. Appends all generated graphics commands to
* `gfx`. Returns a pointer to the next gfx to be appended to. * `gfx`. Returns a pointer to the next gfx to be appended to.
*/ */
Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx) { OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
Gfx* dList; Gfx* dList;
Vec3f pos; Vec3f pos;
Vec3s rot; Vec3s rot;
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++; limbIndex++;
rot = limbDrawTable[limbIndex]; rot = limbDrawTable[limbIndex];
@ -684,9 +685,9 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel
* Draws the Skeleton `skeleton` Appends all generated graphics to `gfx`, and returns a pointer to the * Draws the Skeleton `skeleton` Appends all generated graphics to `gfx`, and returns a pointer to the
* next gfx to be appended to. * next gfx to be appended to.
*/ */
Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable,
OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx) { OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
s32 pad; s32 pad;
Gfx* dList; Gfx* dList;
Vec3f pos; Vec3f pos;
@ -698,7 +699,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
pos.x = limbDrawTable[0].x; pos.x = limbDrawTable[0].x;
pos.y = limbDrawTable[0].y; pos.y = limbDrawTable[0].y;
@ -734,10 +735,10 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr
* Draws the Skeleton `skeleton` Appends all generated graphics to `gfx`, and returns a pointer to the * Draws the Skeleton `skeleton` Appends all generated graphics to `gfx`, and returns a pointer to the
* next gfx to be appended to. Allocates matricies for display lists on the graph heap. * next gfx to be appended to. Allocates matricies for display lists on the graph heap.
*/ */
Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor,
RSPMatrix** mtx, Gfx* gfx) { RSPMatrix** mtx, Gfx* gfx) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
Gfx* dList1; Gfx* dList1;
Gfx* dList2; Gfx* dList2;
Vec3f pos; Vec3f pos;
@ -745,7 +746,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++; limbIndex++;
rot = limbDrawTable[limbIndex]; rot = limbDrawTable[limbIndex];
@ -789,9 +790,9 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
return gfx; return gfx;
} }
Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, s32 dListCount, Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount,
OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx) { OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx) {
SkelLimbEntry* limbEntry; StandardLimb* limbEntry;
s32 pad; s32 pad;
Gfx* dList1; Gfx* dList1;
Gfx* dList2; Gfx* dList2;
@ -809,7 +810,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
Matrix_Push(); Matrix_Push();
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
pos.x = limbDrawTable[0].x; pos.x = limbDrawTable[0].x;
pos.y = limbDrawTable[0].y; pos.y = limbDrawTable[0].y;
@ -851,8 +852,8 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
// Function is unused. // Function is unused.
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_skelanime/func_80134FFC.asm") #pragma GLOBAL_ASM("./asm/non_matchings/code/z_skelanime/func_80134FFC.asm")
s16 func_801353D4(GenericAnimationHeader* animationSeg) { s16 func_801353D4(AnimationHeaderCommon* animationSeg) {
GenericAnimationHeader* animation = Lib_SegmentedToVirtual(animationSeg); AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
return animation->unk02; return animation->unk02;
} }
@ -861,8 +862,8 @@ s16 func_801353D4(GenericAnimationHeader* animationSeg) {
* Appears to be unused anywhere in the game. Appears to be a clone of * Appears to be unused anywhere in the game. Appears to be a clone of
* SkelAnime_GetTotalFrames * SkelAnime_GetTotalFrames
*/ */
s16 SkelAnime_GetTotalFrames2(GenericAnimationHeader* animationSeg) { s16 SkelAnime_GetTotalFrames2(AnimationHeaderCommon* animationSeg) {
GenericAnimationHeader* animation = Lib_SegmentedToVirtual(animationSeg); AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
return animation->frameCount; return animation->frameCount;
} }
@ -871,8 +872,8 @@ s16 SkelAnime_GetTotalFrames2(GenericAnimationHeader* animationSeg) {
* Appears to be unused anywhere in the game. Appears to be a clone of * Appears to be unused anywhere in the game. Appears to be a clone of
* SkelAnime_GetFrameCount * SkelAnime_GetFrameCount
*/ */
s16 SkelAnime_GetFrameCount2(GenericAnimationHeader* animationSeg) { s16 SkelAnime_GetFrameCount2(AnimationHeaderCommon* animationSeg) {
GenericAnimationHeader* animation = Lib_SegmentedToVirtual(animationSeg); AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
return animation->frameCount - 1; return animation->frameCount - 1;
} }
@ -933,20 +934,20 @@ AnimationEntry* SkelAnime_NextEntry(AnimationContext* animationCtx, AnimationTyp
* The next 6 functions are coordinate with the AnimationType enum * The next 6 functions are coordinate with the AnimationType enum
*/ */
void SkelAnime_LoadLinkAnimetion(GlobalContext* globalCtx, LinkAnimetionEntry* linkAnimetionSeg, s32 frame, void SkelAnime_LoadLinkAnimetion(GlobalContext* globalCtx, LinkAnimationHeader* linkAnimetionSeg, s32 frame,
s32 limbCount, void* ram) { s32 limbCount, void* ram) {
AnimationEntry* entry; AnimationEntry* entry;
LinkAnimetionEntry* linkAnimetionEntry; LinkAnimationHeader* LinkAnimationHeader;
s32 pad; s32 pad;
entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_LINKANIMETION); entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_LINKANIMETION);
if (entry != NULL) { if (entry != NULL) {
linkAnimetionEntry = Lib_SegmentedToVirtual(linkAnimetionSeg); LinkAnimationHeader = Lib_SegmentedToVirtual(linkAnimetionSeg);
osCreateMesgQueue(&entry->types.type0.msgQueue, &entry->types.type0.msg, 1); osCreateMesgQueue(&entry->types.type0.msgQueue, &entry->types.type0.msg, 1);
DmaMgr_SendRequestImpl( DmaMgr_SendRequestImpl(
&entry->types.type0.req, ram, &entry->types.type0.req, ram,
LINK_ANIMETION_OFFSET(linkAnimetionEntry->animationSegAddress, (sizeof(Vec3s) * limbCount + 2) * frame), LINK_ANIMETION_OFFSET(LinkAnimationHeader->segment, (sizeof(Vec3s) * limbCount + 2) * frame),
sizeof(Vec3s) * limbCount + 2, 0, &entry->types.type0.msgQueue, NULL); sizeof(Vec3s) * limbCount + 2, 0, &entry->types.type0.msgQueue, NULL);
} }
} }
@ -1089,16 +1090,16 @@ void func_80135EE8(GlobalContext* globalCtx, AnimationContext* animationCtx) {
D_801F5AB4 = 0; D_801F5AB4 = 0;
} }
void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
LinkAnimetionEntry* linkAnimetionEntrySeg, s32 flags, Vec3s* limbDrawTbl, LinkAnimationHeader* linkAnimationHeaderSeg, s32 flags, Vec3s* limbDrawTbl,
Vec3s* transitionDrawTbl, s32 limbBufCount) { Vec3s* transitionDrawTbl, s32 limbBufCount) {
SkeletonHeader* skeletonHeader; FlexSkeletonHeader* skeletonHeader;
s32 headerCount; s32 headerCount;
s32 limbCount; s32 limbCount;
u32 allocSize; u32 allocSize;
skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg); skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
headerCount = skeletonHeader->limbCount; headerCount = skeletonHeader->sh.limbCount;
skelAnime->initFlags = flags; skelAnime->initFlags = flags;
limbCount = (flags & 2) ? headerCount : 1; limbCount = (flags & 2) ? headerCount : 1;
@ -1112,7 +1113,7 @@ void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime,
skelAnime->limbCount = limbCount; skelAnime->limbCount = limbCount;
skelAnime->dListCount = skeletonHeader->dListCount; skelAnime->dListCount = skeletonHeader->dListCount;
skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->skeletonSeg); skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->sh.skeletonSeg);
allocSize = sizeof(Vec3s) * limbCount; allocSize = sizeof(Vec3s) * limbCount;
if (flags & 8) { if (flags & 8) {
@ -1127,7 +1128,7 @@ void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime,
skelAnime->transitionDrawTbl = (Vec3s*)ALIGN16((u32)transitionDrawTbl); skelAnime->transitionDrawTbl = (Vec3s*)ALIGN16((u32)transitionDrawTbl);
} }
SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimetionEntrySeg, 1.0f, 0.0f, 0.0f, 0, 0.0f); SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimationHeaderSeg, 1.0f, 0.0f, 0.0f, 0, 0.0f);
} }
void func_801360A8(SkelAnime* skelAnime) { void func_801360A8(SkelAnime* skelAnime) {
@ -1213,60 +1214,61 @@ void SkelAnime_SetTransition(GlobalContext* globalCtx, SkelAnime* skelAnime, f32
skelAnime->transitionStep = 1.0f / transitionRate; skelAnime->transitionStep = 1.0f / transitionRate;
} }
void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime,
f32 playbackSpeed, f32 frame, f32 frameCount, u8 animationMode, f32 transitionRate) { LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed, f32 frame, f32 frameCount,
u8 animationMode, f32 transitionRate) {
skelAnime->mode = animationMode; skelAnime->mode = animationMode;
if ((transitionRate != 0.0f) && if ((transitionRate != 0.0f) &&
((linkAnimetionEntrySeg != skelAnime->linkAnimetionSeg) || (frame != skelAnime->animCurrentFrame))) { ((linkAnimationHeaderSeg != skelAnime->linkAnimetionSeg) || (frame != skelAnime->animCurrentFrame))) {
if (transitionRate < 0) { if (transitionRate < 0) {
func_801360A8(skelAnime); func_801360A8(skelAnime);
SkelAnime_CopyVec3s(skelAnime, skelAnime->transitionDrawTbl, skelAnime->limbDrawTbl); SkelAnime_CopyVec3s(skelAnime, skelAnime->transitionDrawTbl, skelAnime->limbDrawTbl);
transitionRate = -transitionRate; transitionRate = -transitionRate;
} else { } else {
skelAnime->animUpdate = func_80136104; skelAnime->animUpdate = func_80136104;
SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimetionEntrySeg, (s32)frame, skelAnime->limbCount, SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)frame, skelAnime->limbCount,
skelAnime->transitionDrawTbl); skelAnime->transitionDrawTbl);
} }
skelAnime->transCurrentFrame = 1.0f; skelAnime->transCurrentFrame = 1.0f;
skelAnime->transitionStep = 1.0f / transitionRate; skelAnime->transitionStep = 1.0f / transitionRate;
} else { } else {
func_801360A8(skelAnime); func_801360A8(skelAnime);
SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimetionEntrySeg, (s32)frame, skelAnime->limbCount, SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)frame, skelAnime->limbCount,
skelAnime->limbDrawTbl); skelAnime->limbDrawTbl);
skelAnime->transCurrentFrame = 0.0f; skelAnime->transCurrentFrame = 0.0f;
} }
skelAnime->linkAnimetionSeg = linkAnimetionEntrySeg; skelAnime->linkAnimetionSeg = linkAnimationHeaderSeg;
skelAnime->animCurrentFrame = 0.0f; skelAnime->animCurrentFrame = 0.0f;
skelAnime->initialFrame = frame; skelAnime->initialFrame = frame;
skelAnime->animCurrentFrame = frame; skelAnime->animCurrentFrame = frame;
skelAnime->animFrameCount = frameCount; skelAnime->animFrameCount = frameCount;
skelAnime->totalFrames = SkelAnime_GetTotalFrames(&linkAnimetionEntrySeg->genericHeader); skelAnime->totalFrames = SkelAnime_GetTotalFrames(&linkAnimationHeaderSeg->common);
skelAnime->animPlaybackSpeed = playbackSpeed; skelAnime->animPlaybackSpeed = playbackSpeed;
} }
void SkelAnime_ChangeLinkAnimDefaultStop(GlobalContext* globalCtx, SkelAnime* skelAnime, void SkelAnime_ChangeLinkAnimDefaultStop(GlobalContext* globalCtx, SkelAnime* skelAnime,
LinkAnimetionEntry* linkAnimetionEntrySeg) { LinkAnimationHeader* linkAnimationHeaderSeg) {
SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimetionEntrySeg, 1.0f, 0.0f, SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimationHeaderSeg, 1.0f, 0.0f,
SkelAnime_GetFrameCount(&linkAnimetionEntrySeg->genericHeader), 2, 0.0f); SkelAnime_GetFrameCount(&linkAnimationHeaderSeg->common), 2, 0.0f);
} }
void SkelAnime_ChangeLinkAnimPlaybackStop(GlobalContext* globalCtx, SkelAnime* skelAnime, void SkelAnime_ChangeLinkAnimPlaybackStop(GlobalContext* globalCtx, SkelAnime* skelAnime,
LinkAnimetionEntry* linkAnimetionEntrySeg, f32 playbackSpeed) { LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed) {
SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimetionEntrySeg, playbackSpeed, 0.0f, SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimationHeaderSeg, playbackSpeed, 0.0f,
SkelAnime_GetFrameCount(&linkAnimetionEntrySeg->genericHeader), 2, 0.0f); SkelAnime_GetFrameCount(&linkAnimationHeaderSeg->common), 2, 0.0f);
} }
void SkelAnime_ChangeLinkAnimDefaultRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime, void SkelAnime_ChangeLinkAnimDefaultRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime,
LinkAnimetionEntry* linkAnimetionEntrySeg) { LinkAnimationHeader* linkAnimationHeaderSeg) {
SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimetionEntrySeg, 1.0f, 0.0f, SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimationHeaderSeg, 1.0f, 0.0f,
SkelAnime_GetFrameCount(&linkAnimetionEntrySeg->genericHeader), 0, 0.0f); SkelAnime_GetFrameCount(&linkAnimationHeaderSeg->common), 0, 0.0f);
} }
void SkelAnime_ChangeLinkAnimPlaybackRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime, void SkelAnime_ChangeLinkAnimPlaybackRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime,
LinkAnimetionEntry* linkAnimetionEntrySeg, f32 playbackSpeed) { LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed) {
SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimetionEntrySeg, playbackSpeed, 0.0f, SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimationHeaderSeg, playbackSpeed, 0.0f,
SkelAnime_GetFrameCount(&linkAnimetionEntrySeg->genericHeader), 0, 0.0f); SkelAnime_GetFrameCount(&linkAnimationHeaderSeg->common), 0, 0.0f);
} }
void func_8013670C(GlobalContext* globalCtx, SkelAnime* skelAnime) { void func_8013670C(GlobalContext* globalCtx, SkelAnime* skelAnime) {
@ -1277,15 +1279,15 @@ void func_8013673C(GlobalContext* globalCtx, SkelAnime* skelAnime) {
SkelAnime_LoadAnimationType1(globalCtx, skelAnime->limbCount, skelAnime->limbDrawTbl, skelAnime->transitionDrawTbl); SkelAnime_LoadAnimationType1(globalCtx, skelAnime->limbCount, skelAnime->limbDrawTbl, skelAnime->transitionDrawTbl);
} }
void func_8013676C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, void func_8013676C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg,
f32 frame) { f32 frame) {
SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimetionEntrySeg, (s32)frame, skelAnime->limbCount, SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)frame, skelAnime->limbCount,
skelAnime->transitionDrawTbl); skelAnime->transitionDrawTbl);
} }
void func_801367B0(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, void func_801367B0(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg,
f32 frame) { f32 frame) {
SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimetionEntrySeg, (s32)frame, skelAnime->limbCount, SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)frame, skelAnime->limbCount,
skelAnime->limbDrawTbl); skelAnime->limbDrawTbl);
} }
@ -1294,32 +1296,32 @@ void func_801367F4(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 frame) {
frame); frame);
} }
void func_8013682C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, void func_8013682C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg,
f32 transitionFrame, LinkAnimetionEntry* linkAnimetionEntrySeg2, f32 frame, f32 transitionRate, f32 transitionFrame, LinkAnimationHeader* LinkAnimationHeaderSeg2, f32 frame, f32 transitionRate,
Vec3s* limbDrawTbl) { Vec3s* limbDrawTbl) {
Vec3s* alignedLimbDrawTbl; Vec3s* alignedLimbDrawTbl;
SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimetionEntrySeg, (s32)transitionFrame, skelAnime->limbCount, SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)transitionFrame, skelAnime->limbCount,
skelAnime->limbDrawTbl); skelAnime->limbDrawTbl);
alignedLimbDrawTbl = (Vec3s*)ALIGN16((u32)limbDrawTbl); alignedLimbDrawTbl = (Vec3s*)ALIGN16((u32)limbDrawTbl);
SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimetionEntrySeg2, (s32)frame, skelAnime->limbCount, SkelAnime_LoadLinkAnimetion(globalCtx, LinkAnimationHeaderSeg2, (s32)frame, skelAnime->limbCount,
alignedLimbDrawTbl); alignedLimbDrawTbl);
SkelAnime_LoadAnimationType2(globalCtx, skelAnime->limbCount, skelAnime->limbDrawTbl, alignedLimbDrawTbl, SkelAnime_LoadAnimationType2(globalCtx, skelAnime->limbCount, skelAnime->limbDrawTbl, alignedLimbDrawTbl,
transitionRate); transitionRate);
} }
void func_801368CC(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, void func_801368CC(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg,
f32 transitionFrame, LinkAnimetionEntry* linkAnimetionEntrySeg2, f32 frame, f32 transitionRate, f32 transitionFrame, LinkAnimationHeader* LinkAnimationHeaderSeg2, f32 frame, f32 transitionRate,
Vec3s* limbDrawTbl) { Vec3s* limbDrawTbl) {
Vec3s* alignedLimbDrawTbl; Vec3s* alignedLimbDrawTbl;
SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimetionEntrySeg, (s32)transitionFrame, skelAnime->limbCount, SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)transitionFrame, skelAnime->limbCount,
skelAnime->transitionDrawTbl); skelAnime->transitionDrawTbl);
alignedLimbDrawTbl = (Vec3s*)ALIGN16((u32)limbDrawTbl); alignedLimbDrawTbl = (Vec3s*)ALIGN16((u32)limbDrawTbl);
SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimetionEntrySeg2, (s32)frame, skelAnime->limbCount, SkelAnime_LoadLinkAnimetion(globalCtx, LinkAnimationHeaderSeg2, (s32)frame, skelAnime->limbCount,
alignedLimbDrawTbl); alignedLimbDrawTbl);
SkelAnime_LoadAnimationType2(globalCtx, skelAnime->limbCount, skelAnime->transitionDrawTbl, alignedLimbDrawTbl, SkelAnime_LoadAnimationType2(globalCtx, skelAnime->limbCount, skelAnime->transitionDrawTbl, alignedLimbDrawTbl,
transitionRate); transitionRate);
@ -1380,14 +1382,14 @@ void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHead
} }
} }
void SkelAnime_InitSV(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, void SkelAnime_InitSV(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount) { AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount) {
SkeletonHeader* skeletonHeader; FlexSkeletonHeader* skeletonHeader;
skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg); skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
skelAnime->limbCount = skeletonHeader->limbCount + 1; skelAnime->limbCount = skeletonHeader->sh.limbCount + 1;
skelAnime->dListCount = skeletonHeader->dListCount; skelAnime->dListCount = skeletonHeader->dListCount;
skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->skeletonSeg); skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->sh.skeletonSeg);
if (limbDrawTbl == NULL) { if (limbDrawTbl == NULL) {
skelAnime->limbDrawTbl = zelda_malloc(sizeof(*skelAnime->limbDrawTbl) * skelAnime->limbCount); skelAnime->limbDrawTbl = zelda_malloc(sizeof(*skelAnime->limbDrawTbl) * skelAnime->limbCount);
@ -1596,7 +1598,7 @@ void SkelAnime_ChangeAnimImpl(SkelAnime* skelAnime, AnimationHeader* animationSe
skelAnime->animCurrentSeg = animationSeg; skelAnime->animCurrentSeg = animationSeg;
skelAnime->initialFrame = frame; skelAnime->initialFrame = frame;
skelAnime->animFrameCount = frameCount; skelAnime->animFrameCount = frameCount;
skelAnime->totalFrames = SkelAnime_GetTotalFrames(&animationSeg->genericHeader); skelAnime->totalFrames = SkelAnime_GetTotalFrames(&animationSeg->common);
if (skelAnime->mode >= 4) { if (skelAnime->mode >= 4) {
skelAnime->animCurrentFrame = 0.0f; skelAnime->animCurrentFrame = 0.0f;
} else { } else {
@ -1614,23 +1616,21 @@ void SkelAnime_ChangeAnim(SkelAnime* skelAnime, AnimationHeader* animationSeg, f
} }
void SkelAnime_ChangeAnimDefaultStop(SkelAnime* skelAnime, AnimationHeader* animationSeg) { void SkelAnime_ChangeAnimDefaultStop(SkelAnime* skelAnime, AnimationHeader* animationSeg) {
SkelAnime_ChangeAnim(skelAnime, animationSeg, 1.0f, 0.0f, SkelAnime_GetFrameCount(&animationSeg->genericHeader), 2, SkelAnime_ChangeAnim(skelAnime, animationSeg, 1.0f, 0.0f, SkelAnime_GetFrameCount(&animationSeg->common), 2, 0.0f);
0.0f);
} }
void SkelAnime_ChangeAnimTransitionStop(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 transitionRate) { void SkelAnime_ChangeAnimTransitionStop(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 transitionRate) {
SkelAnime_ChangeAnim(skelAnime, animationSeg, 1.0f, 0, SkelAnime_GetFrameCount(&animationSeg->genericHeader), 2, SkelAnime_ChangeAnim(skelAnime, animationSeg, 1.0f, 0, SkelAnime_GetFrameCount(&animationSeg->common), 2,
transitionRate); transitionRate);
} }
void SkelAnime_ChangeAnimPlaybackStop(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed) { void SkelAnime_ChangeAnimPlaybackStop(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed) {
SkelAnime_ChangeAnim(skelAnime, animationSeg, playbackSpeed, 0.0f, SkelAnime_ChangeAnim(skelAnime, animationSeg, playbackSpeed, 0.0f, SkelAnime_GetFrameCount(&animationSeg->common),
SkelAnime_GetFrameCount(&animationSeg->genericHeader), 2, 0.0f); 2, 0.0f);
} }
void SkelAnime_ChangeAnimDefaultRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg) { void SkelAnime_ChangeAnimDefaultRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg) {
SkelAnime_ChangeAnim(skelAnime, animationSeg, 1.0f, 0.0f, SkelAnime_GetFrameCount(&animationSeg->genericHeader), 0, SkelAnime_ChangeAnim(skelAnime, animationSeg, 1.0f, 0.0f, SkelAnime_GetFrameCount(&animationSeg->common), 0, 0.0f);
0.0f);
} }
void SkelAnime_ChangeAnimTransitionRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 transitionRate) { void SkelAnime_ChangeAnimTransitionRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 transitionRate) {
@ -1638,8 +1638,8 @@ void SkelAnime_ChangeAnimTransitionRepeat(SkelAnime* skelAnime, AnimationHeader*
} }
void SkelAnime_ChangeAnimPlaybackRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed) { void SkelAnime_ChangeAnimPlaybackRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed) {
SkelAnime_ChangeAnim(skelAnime, animationSeg, playbackSpeed, 0.0f, SkelAnime_ChangeAnim(skelAnime, animationSeg, playbackSpeed, 0.0f, SkelAnime_GetFrameCount(&animationSeg->common),
SkelAnime_GetFrameCount(&animationSeg->genericHeader), 0, 0.0f); 0, 0.0f);
} }
void SkelAnime_AnimSetStop(SkelAnime* skelAnime) { void SkelAnime_AnimSetStop(SkelAnime* skelAnime) {

View File

@ -23,7 +23,7 @@ const ActorInit Dm_Sa_InitVars = {
(ActorFunc)DmSa_Draw, (ActorFunc)DmSa_Draw,
}; };
extern SkeletonHeader D_06013328; extern FlexSkeletonHeader D_06013328;
extern AnimationHeader D_0600CC94; extern AnimationHeader D_0600CC94;
static ActorAnimationEntry D_80A2ED00[] = { { &D_0600CC94, 1.0f, 0, -1.0f, 0, 0 } }; static ActorAnimationEntry D_80A2ED00[] = { { &D_0600CC94, 1.0f, 0, -1.0f, 0, 0 } };
@ -33,7 +33,7 @@ void func_80A2E960(SkelAnime* arg0, ActorAnimationEntry* animations, u16 index)
animations += index; animations += index;
if (animations->frameCount < 0.0f) { if (animations->frameCount < 0.0f) {
frameCount = SkelAnime_GetFrameCount(&animations->animation->genericHeader); frameCount = SkelAnime_GetFrameCount(&animations->animation->common);
} else { } else {
frameCount = animations->frameCount; frameCount = animations->frameCount;
} }

View File

@ -24,7 +24,7 @@ const ActorInit En_Ending_Hero_InitVars = {
(ActorFunc)EnEndingHero_Draw, (ActorFunc)EnEndingHero_Draw,
}; };
extern SkeletonHeader D_0600B0CC; extern FlexSkeletonHeader D_0600B0CC;
extern AnimationHeader D_06000BE0; extern AnimationHeader D_06000BE0;
extern UNK_PTR D_06007350[]; extern UNK_PTR D_06007350[];
extern UNK_PTR D_06009590[]; extern UNK_PTR D_06009590[];

View File

@ -24,7 +24,7 @@ const ActorInit En_Ending_Hero2_InitVars = {
(ActorFunc)EnEndingHero2_Draw, (ActorFunc)EnEndingHero2_Draw,
}; };
extern SkeletonHeader D_06007908; extern FlexSkeletonHeader D_06007908;
extern AnimationHeader D_060011C0; extern AnimationHeader D_060011C0;
void EnEndingHero2_Init(Actor* thisx, GlobalContext* globalCtx) { void EnEndingHero2_Init(Actor* thisx, GlobalContext* globalCtx) {

View File

@ -24,7 +24,7 @@ const ActorInit En_Ending_Hero3_InitVars = {
(ActorFunc)EnEndingHero3_Draw, (ActorFunc)EnEndingHero3_Draw,
}; };
extern SkeletonHeader D_06007150; extern FlexSkeletonHeader D_06007150;
extern AnimationHeader D_06000E50; extern AnimationHeader D_06000E50;
void EnEndingHero3_Init(Actor* thisx, GlobalContext* globalCtx) { void EnEndingHero3_Init(Actor* thisx, GlobalContext* globalCtx) {

View File

@ -24,7 +24,7 @@ const ActorInit En_Ending_Hero4_InitVars = {
(ActorFunc)EnEndingHero4_Draw, (ActorFunc)EnEndingHero4_Draw,
}; };
extern SkeletonHeader D_0600D640; extern FlexSkeletonHeader D_0600D640;
extern AnimationHeader D_06002A84; extern AnimationHeader D_06002A84;
void EnEndingHero4_Init(Actor* thisx, GlobalContext* globalCtx) { void EnEndingHero4_Init(Actor* thisx, GlobalContext* globalCtx) {

View File

@ -24,7 +24,7 @@ const ActorInit En_Ending_Hero5_InitVars = {
(ActorFunc)EnEndingHero5_Draw, (ActorFunc)EnEndingHero5_Draw,
}; };
extern SkeletonHeader D_0600A850; extern FlexSkeletonHeader D_0600A850;
extern AnimationHeader D_06002FA0; extern AnimationHeader D_06002FA0;
extern Gfx D_060070C0[]; extern Gfx D_060070C0[];

View File

@ -117,7 +117,7 @@ void EnGinkoMan_Idle(EnGinkoMan* this, GlobalContext* globalCtx) {
this->curTextId = 0x44C; // would you like to make an account this->curTextId = 0x44C; // would you like to make an account
} else { } else {
func_800BDC5C(&this->skelAnime, animations, GINKO_SITTING); func_800BDC5C(&this->skelAnime, animations, GINKO_SITTING);
if ((((s32)gSaveContext.perm.day % 5) == 3) && (gSaveContext.perm.isNight == 1)) { if ((CURRENT_DAY == 3) && (gSaveContext.perm.isNight == 1)) {
func_801518B0(globalCtx, 0x467, &this->actor); func_801518B0(globalCtx, 0x467, &this->actor);
this->curTextId = 0x467; // "What's this? You need somethin' on a day like this? this->curTextId = 0x467; // "What's this? You need somethin' on a day like this?
} else { } else {
@ -304,7 +304,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { //
func_801518B0(globalCtx, 0x479, &this->actor); func_801518B0(globalCtx, 0x479, &this->actor);
this->curTextId = 0x479; // "Well, are you gonna make a deposit?" this->curTextId = 0x479; // "Well, are you gonna make a deposit?"
} }
} else if ((((s32)gSaveContext.perm.day % 5) == 3) && (gSaveContext.perm.isNight == 1)) { } else if ((CURRENT_DAY == 3) && (gSaveContext.perm.isNight == 1)) {
func_801518B0(globalCtx, 0x46D, &this->actor); func_801518B0(globalCtx, 0x46D, &this->actor);
// "Look, little guy, if it's 'cause of the bad rumors going around, forget it! They're just rumors!" // "Look, little guy, if it's 'cause of the bad rumors going around, forget it! They're just rumors!"
this->curTextId = 0x46D; this->curTextId = 0x46D;
@ -687,8 +687,7 @@ void EnGinkoMan_Stamp(EnGinkoMan* this, GlobalContext* globalCtx) {
case 0x469: // "Excuse me, but let me take a look at you..." case 0x469: // "Excuse me, but let me take a look at you..."
func_800BDC5C(&this->skelAnime, animations, GINKO_SITTING); func_800BDC5C(&this->skelAnime, animations, GINKO_SITTING);
globalCtx->msgCtx.bankRupees = (gSaveContext.perm.bankRupees & 0xFFFF); globalCtx->msgCtx.bankRupees = (gSaveContext.perm.bankRupees & 0xFFFF);
// perm.day cast req for div vs divu if ((CURRENT_DAY == 3) && (gSaveContext.perm.isNight == 1)) {
if ((((s32)gSaveContext.perm.day % 5) == 3) && (gSaveContext.perm.isNight == 1)) {
func_801518B0(globalCtx, 0x46C, &this->actor); func_801518B0(globalCtx, 0x46C, &this->actor);
this->curTextId = 0x46C; // "Ah, yes...[Link], right? this->curTextId = 0x46C; // "Ah, yes...[Link], right?
} else { } else {

View File

@ -34,7 +34,7 @@ extern const ActorInit En_Ginko_Man_InitVars;
#define GINKOMAN_CHOICE_YES 0 #define GINKOMAN_CHOICE_YES 0
#define GINKOMAN_CHOICE_NO 1 #define GINKOMAN_CHOICE_NO 1
extern SkeletonHeader object_ginko_skeleton[]; extern FlexSkeletonHeader object_ginko_skeleton[];
extern Gfx object_ginko_limb15_dlist[]; extern Gfx object_ginko_limb15_dlist[];
extern AnimationHeader object_ginko_floorsmacking_anim[]; extern AnimationHeader object_ginko_floorsmacking_anim[];

View File

@ -23,7 +23,7 @@ s32 EnPoFusen_OverrideLimbDraw(GlobalContext* gCtx, s32 limbIndex, Gfx** dList,
struct Actor* actor); struct Actor* actor);
extern AnimationHeader D_06000040; extern AnimationHeader D_06000040;
extern SkeletonHeader D_060024F0; extern FlexSkeletonHeader D_060024F0;
const ActorInit En_Po_Fusen_InitVars = { const ActorInit En_Po_Fusen_InitVars = {
ACTOR_EN_PO_FUSEN, ACTOR_EN_PO_FUSEN,
@ -75,8 +75,7 @@ void EnPoFusen_Init(Actor* thisx, GlobalContext* globalCtx) {
if (0) {} if (0) {}
this->collider.dim.worldSphere.radius = 40; this->collider.dim.worldSphere.radius = 40;
SkelAnime_InitSV(globalCtx, &this->anime, &D_060024F0, &D_06000040, SkelAnime_InitSV(globalCtx, &this->anime, &D_060024F0, &D_06000040, this->limbDrawTbl, this->transitionDrawTbl, 10);
this->limbDrawTbl, this->transitionDrawTbl, 10);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f); ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
func_800B78B8(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); func_800B78B8(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);

View File

@ -23,7 +23,7 @@ const ActorInit En_Rsn_InitVars = {
(ActorFunc)EnRsn_Draw, (ActorFunc)EnRsn_Draw,
}; };
extern SkeletonHeader D_06009220; extern FlexSkeletonHeader D_06009220;
extern AnimationHeader D_06009120; extern AnimationHeader D_06009120;
extern AnimationHeader D_0600788C; extern AnimationHeader D_0600788C;
extern Gfx D_06005458[]; extern Gfx D_06005458[];

View File

@ -26,8 +26,7 @@ extern Gfx D_060011E0[];
void ObjDinner_Init(Actor* thisx, GlobalContext* globalCtx) { void ObjDinner_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjDinner* this = THIS; ObjDinner* this = THIS;
if (gSaveContext.perm.isNight != 1 || if (gSaveContext.perm.isNight != 1 || (CURRENT_DAY == 3 && gSaveContext.perm.weekEventReg[0x16] & 1)) {
((s32)gSaveContext.perm.day % 5 == 3 && gSaveContext.perm.weekEventReg[0x16] & 1)) {
Actor_MarkForDeath(&this->actor); Actor_MarkForDeath(&this->actor);
} }
Actor_SetScale(&this->actor, 0.1f); Actor_SetScale(&this->actor, 0.1f);

View File

@ -201,8 +201,7 @@ void ObjTokeiStep_Init(Actor* thisx, GlobalContext* globalCtx) {
BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06000968); BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06000968);
ObjTokeiStep_InitSteps(this); ObjTokeiStep_InitSteps(this);
ObjTokeiStep_SetupBeginOpen(this); ObjTokeiStep_SetupBeginOpen(this);
} else if (!((((s32)gSaveContext.perm.day % 5) != 3) || (gSaveContext.perm.time >= 0x4000)) || } else if (!((CURRENT_DAY != 3) || (gSaveContext.perm.time >= 0x4000)) || gSaveContext.perm.day >= 4) {
(s32)gSaveContext.perm.day >= 4) {
this->dyna.actor.draw = ObjTokeiStep_DrawOpen; this->dyna.actor.draw = ObjTokeiStep_DrawOpen;
ObjTokeiStep_InitStepsOpen(this); ObjTokeiStep_InitStepsOpen(this);
ObjTokeiStep_SetupDoNothingOpen(this); ObjTokeiStep_SetupDoNothingOpen(this);