Set names for all anim functions

This commit is contained in:
Ryan Dwyer 2022-11-30 21:00:37 +10:00
parent 1c6a5d98a4
commit e59fc870ad
15 changed files with 698 additions and 649 deletions

View File

@ -10,23 +10,23 @@
#include "data.h"
#include "types.h"
void func0f0125a0(s16 animnum, s32 loopframe, s32 endframe, s32 *arg3)
void func0f0125a0(s16 animnum, s32 frame, s32 endframe, s32 totalinttranslate[3])
{
s16 sp48[3];
s16 inttranslate[3];
u32 stack;
arg3[0] = 0;
arg3[1] = 0;
arg3[2] = 0;
totalinttranslate[0] = 0;
totalinttranslate[1] = 0;
totalinttranslate[2] = 0;
while (loopframe < endframe) {
anim0002485c(0, 0, &g_SkelChr, animnum, loopframe, sp48, 0);
while (frame < endframe) {
animGetPosAngleAsInt(0, false, &g_SkelChr, animnum, frame, inttranslate, false);
arg3[0] += sp48[0];
arg3[1] += sp48[1];
arg3[2] += sp48[2];
totalinttranslate[0] += inttranslate[0];
totalinttranslate[1] += inttranslate[1];
totalinttranslate[2] += inttranslate[2];
loopframe++;
frame++;
}
}
@ -88,22 +88,22 @@ void bheadReset(void)
g_Vars.currentplayer->standcnt = 0;
for (i = 0; i < 2; i++) {
s32 spc8[3];
func0f0125a0(var80075c00[i].animnum, var80075c00[i].loopframe, var80075c00[i].endframe, spc8);
var80075c00[i].unk0c = (spc8[2] * 0.1000000089407f) / (var80075c00[i].endframe - var80075c00[i].loopframe);
s32 translate[3];
func0f0125a0(var80075c00[i].animnum, var80075c00[i].loopframe, var80075c00[i].endframe, translate);
var80075c00[i].unk0c = (translate[2] * 0.1000000089407f) / (var80075c00[i].endframe - var80075c00[i].loopframe);
}
{
struct modelrenderdata sp88 = {NULL, 1, 3};
struct modelrenderdata renderdata = {NULL, 1, 3};
Mtxf sp48;
modelSetAnimation(&g_Vars.currentplayer->model, 1, 0, 0, 0.5f, 0);
modelUpdateInfo(&g_Vars.currentplayer->model);
mtx4LoadIdentity(&sp48);
sp88.unk00 = &sp48;
sp88.unk10 = g_Vars.currentplayer->bondheadmatrices;
modelSetMatricesWithAnim(&sp88, &g_Vars.currentplayer->model);
renderdata.unk00 = &sp48;
renderdata.unk10 = g_Vars.currentplayer->bondheadmatrices;
modelSetMatricesWithAnim(&renderdata, &g_Vars.currentplayer->model);
g_Vars.currentplayer->standheight = g_Vars.currentplayer->bondheadmatrices[0].m[3][1];

View File

@ -2356,8 +2356,8 @@ s32 chrTick(struct prop *prop)
s32 sp1e8;
Mtxf sp1a8;
s32 sp1a4;
bool offscreen;
bool offscreen2;
bool invalidframe;
bool invalidframe2;
struct coord sp190;
f32 angle;
struct player *player;
@ -2471,7 +2471,7 @@ s32 chrTick(struct prop *prop)
&& player->cameramode == CAMERAMODE_THIRDPERSON
&& player->visionmode != VISIONMODE_SLAYERROCKET)) {
// Cutscene chr?
offscreen = false;
invalidframe = false;
if (fulltick) {
model->anim->average = false;
@ -2483,15 +2483,15 @@ s32 chrTick(struct prop *prop)
}
}
if (chr->model && chr->model->anim && (g_Anims[chr->model->anim->animnum].flags & ANIMFLAG_04)) {
anim00023d38(chr->model->anim->animnum);
if (chr->model && chr->model->anim && (g_Anims[chr->model->anim->animnum].flags & ANIMFLAG_HASREMAPPEDFRAMES)) {
animLoadHeader(chr->model->anim->animnum);
offscreen = anim0002384c(chr->model->anim->animnum, chr->model->anim->framea) < 0
|| (anim0002384c(chr->model->anim->animnum, chr->model->anim->frameb) < 0
invalidframe = animGetRemappedFrame(chr->model->anim->animnum, chr->model->anim->framea) < 0
|| (animGetRemappedFrame(chr->model->anim->animnum, chr->model->anim->frameb) < 0
&& chr->model->anim->frac != 0.0f);
}
if (offscreen) {
if (invalidframe) {
onscreen = false;
} else {
onscreen = posIsInDrawDistance(&prop->pos);
@ -2577,21 +2577,22 @@ s32 chrTick(struct prop *prop)
chr0f0220ec(chr, lvupdate240, true);
onscreen = func0f08e8ac(prop, &prop->pos, modelGetEffectiveScale(model), true);
} else {
offscreen2 = false;
invalidframe2 = false;
if (fulltick) {
model->anim->average = false;
chr0f0220ec(chr, lvupdate240, true);
}
if (chr->model && chr->model->anim && (g_Anims[chr->model->anim->animnum].flags & ANIMFLAG_04)) {
anim00023d38(chr->model->anim->animnum);
if (chr->model && chr->model->anim && (g_Anims[chr->model->anim->animnum].flags & ANIMFLAG_HASREMAPPEDFRAMES)) {
animLoadHeader(chr->model->anim->animnum);
offscreen2 = anim0002384c(chr->model->anim->animnum, chr->model->anim->framea) < 0
|| (anim0002384c(chr->model->anim->animnum, chr->model->anim->frameb) < 0 && chr->model->anim->frac != 0.0f);
invalidframe2 = animGetRemappedFrame(chr->model->anim->animnum, chr->model->anim->framea) < 0
|| (animGetRemappedFrame(chr->model->anim->animnum, chr->model->anim->frameb) < 0
&& chr->model->anim->frac != 0.0f);
}
if (offscreen2) {
if (invalidframe2) {
onscreen = false;
} else {
onscreen = func0f08e8ac(prop, &prop->pos, modelGetEffectiveScale(model), true);

View File

@ -107,8 +107,8 @@ s32 g_CutsceneFrameOverrun240;
bool g_CutsceneSkipRequested;
f32 g_CutsceneCurTotalFrame60f;
s32 var8009de2c;
f32 g_CutsceneBarFrac; // 0 when bars across the top and bottom, 1 when fullscreen
s32 g_CutsceneTweenDuration60;
f32 g_CutsceneTweenFrac; // 0 when bars across the top and bottom, 1 when fullscreen
u32 var8009de34;
s16 g_SpawnPoints[MAX_SPAWNPOINTS];
s32 g_NumSpawnPoints;
@ -1808,7 +1808,7 @@ void playerStartCutscene2(void)
#endif
g_CutsceneBlurFrac = 0;
var8009de2c = -1;
g_CutsceneTweenDuration60 = -1;
g_InCutscene = 1;
paksStop(true);
@ -1840,26 +1840,26 @@ void playerStartCutscene(s16 animnum)
}
}
void playerReorientForCutsceneStop(u32 arg0)
void playerReorientForCutsceneStop(s32 tweenduration60)
{
struct coord sp94;
struct coord sp88;
struct coord sp7c;
u8 sp7f;
Mtxf sp38;
struct coord rot;
struct coord translate;
struct coord scale;
u8 frameslot;
Mtxf rotmtx;
s32 lastframe;
f32 theta;
u32 stack;
var8009de2c = arg0;
g_CutsceneTweenDuration60 = tweenduration60;
lastframe = animGetNumFrames(g_CutsceneAnimNum) - 1;
anim00023d38(g_CutsceneAnimNum);
sp7f = anim00023ab0(g_CutsceneAnimNum, lastframe);
anim00023d0c();
anim00024050(0, 0, &g_Skel20, g_CutsceneAnimNum, sp7f, &sp94, &sp88, &sp7c);
mtx4LoadRotation(&sp94, &sp38);
animLoadHeader(g_CutsceneAnimNum);
frameslot = animLoadFrame(g_CutsceneAnimNum, lastframe);
animForgetFrameBirths();
animGetRotTranslateScale(0, 0, &g_Skel20, g_CutsceneAnimNum, frameslot, &rot, &translate, &scale);
mtx4LoadRotation(&rot, &rotmtx);
theta = atan2f(-sp38.m[2][0], -sp38.m[2][2]);
theta = atan2f(-rotmtx.m[2][0], -rotmtx.m[2][2]);
theta = (M_BADTAU - theta) * 57.304901123047f;
g_Vars.bond->vv_theta = theta;
@ -1871,12 +1871,12 @@ void playerTickCutscene(bool arg0)
struct coord pos;
struct coord up;
struct coord look;
struct coord sp178;
struct coord sp16c;
struct coord sp160;
u8 sp15f;
Mtxf sp11c;
f32 sp118 = func0f15c888();
struct coord rot;
struct coord translate;
struct coord scale;
u8 frameslot;
Mtxf rotmtx;
f32 translatescale = func0f15c888();
f32 fovy;
s32 endframe;
s8 contpadnum = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex);
@ -1884,7 +1884,7 @@ void playerTickCutscene(bool arg0)
#if PAL
u8 stack3[0x2c];
#endif
f32 barfrac;
f32 tweenfrac;
f32 sp104;
Mtxf spc4;
Mtxf sp84;
@ -1898,7 +1898,7 @@ void playerTickCutscene(bool arg0)
buttons = 0;
}
anim00023d38(g_CutsceneAnimNum);
animLoadHeader(g_CutsceneAnimNum);
endframe = animGetNumFrames(g_CutsceneAnimNum) - 1;
@ -1914,8 +1914,9 @@ void playerTickCutscene(bool arg0)
g_CutsceneCurAnimFrame60 = g_CutsceneCurAnimFrame240 >> 2;
#endif
if (g_Anims[g_CutsceneAnimNum].flags & ANIMFLAG_08) {
while (g_CutsceneCurAnimFrame60 < endframe && anim000239e0(g_CutsceneAnimNum, g_CutsceneCurAnimFrame60)) {
if (g_Anims[g_CutsceneAnimNum].flags & ANIMFLAG_HASCUTSKIPFRAMES) {
while (g_CutsceneCurAnimFrame60 < endframe
&& animIsFrameCutSkipped(g_CutsceneAnimNum, g_CutsceneCurAnimFrame60)) {
#if PAL
g_CutsceneCurAnimFrame240 += 1.2f;
g_CutsceneCurAnimFrame60 = floorf(g_CutsceneCurAnimFrame240 + 0.01f);
@ -1943,33 +1944,35 @@ void playerTickCutscene(bool arg0)
}
g_Vars.in_cutscene = (g_Vars.tickmode == TICKMODE_CUTSCENE && g_CutsceneCurAnimFrame60 < endframe);
sp15f = anim00023ab0(g_CutsceneAnimNum, g_CutsceneCurAnimFrame60);
anim00023d0c();
anim00024050(0, 0, &g_Skel20, g_CutsceneAnimNum, sp15f, &sp178, &sp16c, &sp160);
frameslot = animLoadFrame(g_CutsceneAnimNum, g_CutsceneCurAnimFrame60);
animForgetFrameBirths();
animGetRotTranslateScale(0, 0, &g_Skel20, g_CutsceneAnimNum, frameslot, &rot, &translate, &scale);
pos.x = sp16c.x * sp118;
pos.y = sp16c.y * sp118;
pos.z = sp16c.z * sp118;
pos.x = translate.x * translatescale;
pos.y = translate.y * translatescale;
pos.z = translate.z * translatescale;
mtx4LoadRotation(&sp178, &sp11c);
mtx4LoadRotation(&rot, &rotmtx);
up.x = sp11c.m[1][0];
up.y = sp11c.m[1][1];
up.z = sp11c.m[1][2];
up.x = rotmtx.m[1][0];
up.y = rotmtx.m[1][1];
up.z = rotmtx.m[1][2];
look.x = -sp11c.m[2][0];
look.y = -sp11c.m[2][1];
look.z = -sp11c.m[2][2];
look.x = -rotmtx.m[2][0];
look.y = -rotmtx.m[2][1];
look.z = -rotmtx.m[2][2];
fovy = anim00024c14(1, g_CutsceneAnimNum, sp15f);
g_CutsceneBlurFrac = anim00024c14(2, g_CutsceneAnimNum, sp15f);
g_CutsceneBarFrac = 0;
fovy = animGetCameraValue(1, g_CutsceneAnimNum, frameslot);
g_CutsceneBlurFrac = animGetCameraValue(2, g_CutsceneAnimNum, frameslot);
g_CutsceneTweenFrac = 0;
if (var8009de2c > 0 && var8009de2c >= endframe - g_CutsceneCurAnimFrame60) {
barfrac = 1 - (f32)(endframe - g_CutsceneCurAnimFrame60) / (f32)var8009de2c;
if (g_CutsceneTweenDuration60 > 0 && endframe - g_CutsceneCurAnimFrame60 <= g_CutsceneTweenDuration60) {
// Cutscene is almost done
// Camera is tweening to head and top/bottom bars are shrinking
tweenfrac = 1 - (f32)(endframe - g_CutsceneCurAnimFrame60) / (f32)g_CutsceneTweenDuration60;
g_CutsceneBarFrac = barfrac;
sp104 = 1 - cosf(1.5705462694168f * barfrac);
g_CutsceneTweenFrac = tweenfrac;
sp104 = 1 - cosf(1.5705462694168f * tweenfrac);
bmoveSetMode(MOVEMODE_WALK);
@ -1985,18 +1988,18 @@ void playerTickCutscene(bool arg0)
quaternion0f097044(&sp84, sp64);
quaternion0f0976c0(sp64, sp74);
quaternionSlerp(sp74, sp64, sp104, sp54);
quaternionToMtx(sp54, &sp11c);
quaternionToMtx(sp54, &rotmtx);
up.x = sp11c.m[1][0];
up.y = sp11c.m[1][1];
up.z = sp11c.m[1][2];
up.x = rotmtx.m[1][0];
up.y = rotmtx.m[1][1];
up.z = rotmtx.m[1][2];
look.x = sp11c.m[2][0];
look.y = sp11c.m[2][1];
look.z = sp11c.m[2][2];
look.x = rotmtx.m[2][0];
look.y = rotmtx.m[2][1];
look.z = rotmtx.m[2][2];
g_CutsceneBlurFrac += barfrac * (0 - g_CutsceneBlurFrac);
fovy += barfrac * (60 - fovy);
g_CutsceneBlurFrac += tweenfrac * (0 - g_CutsceneBlurFrac);
fovy += tweenfrac * (60 - fovy);
}
playerSetCameraMode(CAMERAMODE_THIRDPERSON);
@ -2900,11 +2903,11 @@ s16 playerGetViewportHeight(void)
} else if (optionsGetEffectiveScreenSize() == SCREENSIZE_CINEMA) {
height = g_ViModes[g_ViRes].cinemaheight;
} else if (g_InCutscene && !var8009dfc0) {
if (var8009de2c >= 1) {
if (g_CutsceneTweenDuration60 >= 1) {
f32 a = g_ViModes[g_ViRes].wideheight;
f32 b = g_ViModes[g_ViRes].fullheight;
a = a * (1.0f - g_CutsceneBarFrac);
b = b * g_CutsceneBarFrac;
a = a * (1.0f - g_CutsceneTweenFrac);
b = b * g_CutsceneTweenFrac;
height = a + b;
} else {
height = g_ViModes[g_ViRes].wideheight;
@ -2951,11 +2954,11 @@ s16 playerGetViewportTop(void)
} else {
if (optionsGetEffectiveScreenSize() == SCREENSIZE_WIDE) {
if (g_InCutscene && optionsGetCutsceneSubtitles() && g_Vars.stagenum != STAGE_CITRAINING) {
if (var8009de2c >= 1) {
if (g_CutsceneTweenDuration60 >= 1) {
f32 a = g_ViModes[g_ViRes].fulltop;
f32 b = g_ViModes[g_ViRes].widetop;
a = a * (1.0f - g_CutsceneBarFrac);
b = b * g_CutsceneBarFrac;
a = a * (1.0f - g_CutsceneTweenFrac);
b = b * g_CutsceneTweenFrac;
top = a + b;
} else {
top = g_ViModes[g_ViRes].fulltop;
@ -2968,11 +2971,11 @@ s16 playerGetViewportTop(void)
} else {
if (g_InCutscene && !var8009dfc0
&& (!optionsGetCutsceneSubtitles() || g_Vars.stagenum == STAGE_CITRAINING)) {
if (var8009de2c >= 1) {
if (g_CutsceneTweenDuration60 >= 1) {
f32 a = g_ViModes[g_ViRes].widetop;
f32 b = g_ViModes[g_ViRes].fulltop;
a = a * (1.0f - g_CutsceneBarFrac);
b = b * g_CutsceneBarFrac;
a = a * (1.0f - g_CutsceneTweenFrac);
b = b * g_CutsceneTweenFrac;
top = a + b;
} else {
top = g_ViModes[g_ViRes].widetop;

View File

@ -10965,7 +10965,7 @@ s32 objTickPlayer(struct prop *prop)
bool sp564 = true;
bool embedded = false;
bool sp556 = false;
bool sp552 = false;
bool invalidframe = false;
if (obj->hidden & OBJHFLAG_ISRETICK) {
obj->hidden &= ~OBJHFLAG_ISRETICK;
@ -11015,7 +11015,7 @@ s32 objTickPlayer(struct prop *prop)
}
if (model->anim) {
if (g_Anims[model->anim->animnum].flags & 0x02) {
if (g_Anims[model->anim->animnum].flags & ANIMFLAG_02) {
if (g_Vars.tickmode != TICKMODE_CUTSCENE
&& modelGetCurAnimFrame(model) >= modelGetNumAnimFrames(model) - 1) {
modelmgrFreeAnim(model->anim);
@ -11038,11 +11038,11 @@ s32 objTickPlayer(struct prop *prop)
modelTickAnimQuarterSpeed(model, lvupdate240, true);
}
anim00023d38(model->anim->animnum);
animLoadHeader(model->anim->animnum);
if ((g_Anims[model->anim->animnum].flags & 0x04)
&& anim0002384c(model->anim->animnum, model->anim->framea) < 0) {
sp552 = true;
if ((g_Anims[model->anim->animnum].flags & ANIMFLAG_HASREMAPPEDFRAMES)
&& animGetRemappedFrame(model->anim->animnum, model->anim->framea) < 0) {
invalidframe = true;
} else {
if (fulltick) {
modelUpdateInfo(model);
@ -11117,7 +11117,7 @@ s32 objTickPlayer(struct prop *prop)
s32 sp148;
s32 sp144;
s32 i;
struct coord sp128;
struct coord translate;
struct coord sp116 = {0, 0, 0};
f32 sp112;
s32 tagnum;
@ -11132,11 +11132,11 @@ s32 objTickPlayer(struct prop *prop)
sp144 = floorf(model->anim->frame);
for (i = sp148; i <= sp144; i++) {
anim00024b64(0, 0, model->definition->skel, model->anim->animnum, i, &sp128, 0);
animGetTranslateAngle(0, false, model->definition->skel, model->anim->animnum, i, &translate, false);
sp116.x += sp128.x * 0.1f;
sp112 = sp128.y * 0.1f;
sp116.z += sp128.z * 0.1f;
sp116.x += translate.x * 0.1f;
sp112 = translate.y * 0.1f;
sp116.z += translate.z * 0.1f;
}
mtx00016208(obj->realrot, &sp116);
@ -11261,7 +11261,7 @@ s32 objTickPlayer(struct prop *prop)
doorUpdatePortalIfWindowed(prop, playercount);
}
if (sp552) {
if (invalidframe) {
pass2 = false;
} else if (prop == bmoveGetHoverbike() || prop == bmoveGetGrabbedProp()) {
pass2 = posIsInDrawDistance(&prop->pos);

View File

@ -7,31 +7,31 @@
#include "data.h"
#include "types.h"
u16 raceInitAnim(s16 animnum, s32 frame, s32 endframe)
u16 raceGetAnimSumAngleAsInt(s16 animnum, s32 frame, s32 endframe)
{
s16 sp48[4];
u16 count = 0;
s16 inttranslate[3];
u16 sumangle = 0;
while (frame < endframe) {
count += anim0002485c(0, false, &g_SkelChr, animnum, frame, sp48, false);
sumangle += animGetPosAngleAsInt(0, false, &g_SkelChr, animnum, frame, inttranslate, false);
frame++;
}
return count;
return sumangle;
}
s32 race0f000358(s16 animnum, s32 frame, s32 endframe)
s32 raceGetAnimSumForwardAsInt(s16 animnum, s32 frame, s32 endframe)
{
s32 count = 0;
s16 sp44[4];
s32 sumforward = 0;
s16 inttranslate[3];
while (frame < endframe) {
anim0002485c(0, false, &g_SkelChr, animnum, frame, sp44, false);
count += sp44[2];
animGetPosAngleAsInt(0, false, &g_SkelChr, animnum, frame, inttranslate, false);
sumforward += inttranslate[2];
frame++;
}
return count;
return sumforward;
}
s32 raceInitAnimGroup(struct attackanimconfig *configs)
@ -40,13 +40,13 @@ s32 raceInitAnimGroup(struct attackanimconfig *configs)
struct attackanimconfig *config = configs;
while (config->animnum != 0) {
u16 value = raceInitAnim(config->animnum, 0, floor(config->unk04));
u16 angle = raceGetAnimSumAngleAsInt(config->animnum, 0, floor(config->unk04));
if (config->unk04 > 0) {
if (value < 0x8000) {
config->unk08 = value * 0.00009585853695171f / config->unk04;
if (angle < 0x8000) {
config->unk08 = angle * 0.00009585853695171f / config->unk04;
} else {
config->unk08 = (value * 0.00009585853695171f - M_BADTAU) / config->unk04;
config->unk08 = (angle * 0.00009585853695171f - M_BADTAU) / config->unk04;
}
} else {
config->unk08 = 0;
@ -81,11 +81,11 @@ s32 raceCountAnims(struct animtablerow *rows)
f32 race0f0005c0(s16 animnum)
{
f32 tmp = race0f000358(animnum, 0, animGetNumFrames(animnum) - 1) / (f32) animGetNumFrames(animnum);
f32 avgforward = raceGetAnimSumForwardAsInt(animnum, 0, animGetNumFrames(animnum) - 1) / (f32) animGetNumFrames(animnum);
var8005f014[animnum] = tmp;
var8005f014[animnum] = avgforward;
return tmp * 0.1000000089407f;
return avgforward * 0.1000000089407f;
}
void raceInitAnims(void)

View File

@ -34,8 +34,8 @@ extern ALHeap g_SndHeap;
extern u32 var80095200;
extern OSMesgQueue g_PiMesgQueue;
extern struct g_vars g_Vars;
extern u8 **var8009a874;
extern u8 **var8009a888;
extern u8 **g_AnimFrameBytes;
extern u8 **g_AnimHeaderBytes;
extern union filedataptr g_TileFileData;
extern s32 g_TileNumRooms;
extern u32 *g_TileRooms;

View File

@ -247,18 +247,18 @@
#define AMMODE_VIEW 1
#define AMMODE_EDIT 2 // unused
#define ANIMFLAG_LOOP 0x01
#define ANIMFLAG_02 0x02
#define ANIMFLAG_04 0x04
#define ANIMFLAG_08 0x08
#define ANIMFLAG_LOOP 0x01
#define ANIMFLAG_02 0x02
#define ANIMFLAG_HASREMAPPEDFRAMES 0x04
#define ANIMFLAG_HASCUTSKIPFRAMES 0x08
#define ANIMHEADERFLAG_01 0x01 // len 9
#define ANIMHEADERFLAG_02 0x02 // len 9
#define ANIMHEADERFLAG_08 0x08 // len 12
#define ANIMHEADERFLAG_10 0x10 // len 0
#define ANIMHEADERFLAG_20 0x20 // len 15
#define ANIMHEADERFLAG_40 0x40 // len 5
#define ANIMHEADERFLAG_80 0x80 // len 0
#define ANIMFIELD_S16_ROTATE 0x01
#define ANIMFIELD_S16_TRANSLATE 0x02
#define ANIMFIELD_08 0x08
#define ANIMFIELD_F32_ROTATE 0x10
#define ANIMFIELD_S32_TRANSLATE 0x20
#define ANIMFIELD_CAMERA 0x40
#define ANIMFIELD_F32_SCALE 0x80
#define ARTIFACTTYPE_FREE 0
#define ARTIFACTTYPE_CIRCLE 1 // from a sun lens flare or teleport

View File

@ -57,13 +57,13 @@ extern bool g_ModelAnimMergingEnabled;
extern u32 var8005efe0;
extern u32 var8005efec;
extern u32 var8005eff8;
extern u32 var8005f000;
extern u32 g_NextAnimFrameIndex;
extern s16 g_NumAnimations;
extern struct animsummary *g_Anims;
extern u8 *var8005f010;
extern struct animtableentry *g_Anims;
extern u8 *g_AnimToHeaderSlot;
extern s16 *var8005f014;
extern s32 var8005f018;
extern s32 var8005f01c;
extern s32 g_AnimMaxBytesPerFrame;
extern s32 g_AnimMaxHeaderLength;
extern bool g_AnimHostEnabled;
extern s32 var8005f030;
extern s32 g_CdHasSavedBlock;

View File

@ -18,7 +18,7 @@ void playerRemoveChrBody(void);
void playerTickMpSwirl(void);
void playerExecutePreparedWarp(void);
void playerStartCutscene(s16 anim_id);
void playerReorientForCutsceneStop(u32 arg0);
void playerReorientForCutsceneStop(s32 tweenduration60);
void playerTickCutscene(bool arg0);
f32 playerGetCutsceneBlurFrac(void);
void playerSetZoomFovY(f32 fovy, f32 timemax);

View File

@ -6,8 +6,8 @@
void racesInit(void);
u16 raceInitAnim(s16 animnum, s32 frame, s32 endframe);
s32 race0f000358(s16 animnum, s32 startframe, s32 endframe);
u16 raceGetAnimSumAngleAsInt(s16 animnum, s32 frame, s32 endframe);
s32 raceGetAnimSumForwardAsInt(s16 animnum, s32 startframe, s32 endframe);
s32 raceInitAnimGroup(struct attackanimconfig *configs);
void raceInitAnimGroups(struct attackanimgroup **groups);
s32 raceCountAnims(struct animtablerow *rows);

View File

@ -11,17 +11,17 @@ s32 animGetNumFrames(s16 anim_id);
bool animHasFrames(s16 animnum);
s32 animGetNumAnimations(void);
u8 *animDma(u8 *dst, u32 segoffset, u32 len);
s32 anim0002384c(s16 animnum, s32 frame);
bool anim00023908(s16 animnum, s32 frame, s32 *frameptr);
bool anim000239e0(s16 animnum, s32 frame);
u8 anim00023ab0(s16 animnum, s32 framenum);
void anim00023d0c(void);
void anim00023d38(s16 animnum);
s32 anim00023f50(u8 *arg0, u8 arg1, u32 arg2);
s32 anim00023fe0(u8 *arg0, u8 arg1, s32 arg2);
void anim00024050(s32 arg0, bool flip, struct skeleton *skel, s16 animnum, u8 arg4, struct coord *arg5, struct coord *arg6, struct coord *arg7);
u16 anim0002485c(s32 arg0, bool arg1, struct skeleton *skel, s16 animnum, s32 loopframe, s16 *arg5, s32 arg6);
f32 anim00024b64(u32 arg0, u32 arg1, struct skeleton *skel, s16 animnum, u32 arg4, struct coord *coord, u32 arg6);
f32 anim00024c14(s32 arg0, s16 animnum, u8 arg2);
s32 animGetRemappedFrame(s16 animnum, s32 frame);
bool animRemapFrame(s16 animnum, s32 frame, s32 *frameptr);
bool animIsFrameCutSkipped(s16 animnum, s32 frame);
u8 animLoadFrame(s16 animnum, s32 framenum);
void animForgetFrameBirths(void);
void animLoadHeader(s16 animnum);
s32 animReadBits(u8 *ptr, u8 readbitlen, u32 bitoffset);
s32 animReadSignedShort(u8 *arg0, u8 arg1, s32 arg2);
void animGetRotTranslateScale(s32 part, bool flip, struct skeleton *skel, s16 animnum, u8 frameslot, struct coord *rot, struct coord *translate, struct coord *scale);
u16 animGetPosAngleAsInt(s32 part, bool flip, struct skeleton *skel, s16 animnum, s32 framenum, s16 inttranslate[3], bool arg6);
f32 animGetTranslateAngle(s32 part, bool flip, struct skeleton *skel, s16 animnum, s32 framenum, struct coord *pos, bool arg6);
f32 animGetCameraValue(s32 part, s16 animnum, u8 frameslot);
#endif

View File

@ -326,7 +326,7 @@ union filedataptr {
struct attackanimconfig {
/*0x00*/ s16 animnum;
/*0x04*/ f32 unk04;
/*0x04*/ f32 unk04; // frame number
/*0x08*/ f32 unk08;
/*0x0c*/ f32 unk0c;
/*0x10*/ f32 unk10; // frame number
@ -350,10 +350,10 @@ struct model;
struct anim {
/*0x00*/ s16 animnum;
/*0x02*/ s16 animnum2;
/*0x04*/ u8 unk04;
/*0x05*/ u8 unk05;
/*0x06*/ u8 unk06;
/*0x07*/ u8 unk07;
/*0x04*/ u8 frameslot1;
/*0x05*/ u8 frameslot2;
/*0x06*/ u8 frameslot3;
/*0x07*/ u8 frameslot4;
/*0x08*/ s8 flip;
/*0x09*/ s8 flip2;
/*0x0a*/ s8 looping;
@ -401,7 +401,7 @@ struct skeleton {
};
struct modelrodata_chrinfo { // type 0x01
u16 unk00;
u16 animpart;
s16 mtxindex;
f32 unk04;
u16 rwdataindex;
@ -5286,12 +5286,12 @@ struct modelthing {
/*0x16*/ u16 unk16;
};
struct animsummary {
struct animtableentry {
/*0x00*/ u16 numframes;
/*0x02*/ u16 bytesperframe; // in bytes
/*0x04*/ u32 data;
/*0x08*/ u16 headerlen;
/*0x0a*/ u8 initialposbitsperentry;
/*0x0a*/ u8 framelen;
/*0x0b*/ u8 flags;
};

View File

@ -13,26 +13,29 @@
#include "data.h"
#include "types.h"
u8 *var8009a870;
u8 **var8009a874;
s16 *var8009a878;
s16 *var8009a87c;
u8 *var8009a880;
u8 *var8009a884;
u8 **var8009a888;
s16 *var8009a88c;
s32 *var8009a890;
s16 var8009a894;
struct animsummary *var8009a898;
#define ANIM_HEADER_CACHE_SIZE 40
#define ANIM_FRAME_CACHE_SIZE 32
u32 var8005f000 = 0;
s32 var8005f004 = 0;
u8 *g_AnimFrameByteSlots;
u8 **g_AnimFrameBytes;
s16 *g_AnimFrameAnimNums;
s16 *g_AnimFrameFrameNums;
u8 *g_AnimFrameBirths;
u8 *g_AnimHeaderByteSlots;
u8 **g_AnimHeaderBytes;
s16 *g_AnimHeaderAnimNums;
s32 *g_AnimHeaderBirths;
s16 g_NumRomAnimations;
struct animtableentry *g_RomAnims;
u32 g_NextAnimFrameIndex = 0;
s32 g_NextAnimHeaderIndex = 0;
s16 g_NumAnimations = 0;
struct animsummary *g_Anims = NULL;
u8 *var8005f010 = NULL;
struct animtableentry *g_Anims = NULL;
u8 *g_AnimToHeaderSlot = NULL;
s16 *var8005f014 = NULL;
s32 var8005f018 = 176;
s32 var8005f01c = 608;
s32 g_AnimMaxBytesPerFrame = 176;
s32 g_AnimMaxHeaderLength = 608;
bool g_AnimHostEnabled = false;
u8 *g_AnimHostSegment = NULL;
@ -48,36 +51,36 @@ void animsInit(void)
ptr = mempAlloc(tablelen, MEMPOOL_PERMANENT);
dmaExec(ptr, (s32)&_animationsTableRomStart, tablelen);
g_NumAnimations = var8009a894 = ptr[0];
g_Anims = var8009a898 = (struct animsummary *)&ptr[1];
g_NumAnimations = g_NumRomAnimations = ptr[0];
g_Anims = g_RomAnims = (struct animtableentry *)&ptr[1];
var8005f01c = 1;
var8005f018 = 1;
g_AnimMaxHeaderLength = 1;
g_AnimMaxBytesPerFrame = 1;
for (i = 0; i < g_NumAnimations; i++) {
if (g_Anims[i].headerlen > var8005f01c) {
var8005f01c = g_Anims[i].headerlen;
if (g_Anims[i].headerlen > g_AnimMaxHeaderLength) {
g_AnimMaxHeaderLength = g_Anims[i].headerlen;
}
if (g_Anims[i].bytesperframe > var8005f018) {
var8005f018 = g_Anims[i].bytesperframe;
if (g_Anims[i].bytesperframe > g_AnimMaxBytesPerFrame) {
g_AnimMaxBytesPerFrame = g_Anims[i].bytesperframe;
}
}
var8005f01c = ALIGN16(var8005f01c + 34);
var8005f018 = ALIGN16(var8005f018 + 34);
g_AnimMaxHeaderLength = ALIGN16(g_AnimMaxHeaderLength + 34);
g_AnimMaxBytesPerFrame = ALIGN16(g_AnimMaxBytesPerFrame + 34);
var8005f010 = mempAlloc(ALIGN64(g_NumAnimations), MEMPOOL_PERMANENT);
var8005f014 = mempAlloc(ALIGN64(g_NumAnimations * 2), MEMPOOL_PERMANENT);
var8009a870 = mempAlloc(ALIGN64(var8005f018 * 0x20), MEMPOOL_PERMANENT);
var8009a874 = mempAlloc(0x80, MEMPOOL_PERMANENT);
var8009a878 = mempAlloc(0x40, MEMPOOL_PERMANENT);
var8009a87c = mempAlloc(0x40, MEMPOOL_PERMANENT);
var8009a880 = mempAlloc(0x40, MEMPOOL_PERMANENT);
var8009a884 = mempAlloc(ALIGN64(var8005f01c * 40), MEMPOOL_PERMANENT);
var8009a888 = mempAlloc(0xc0, MEMPOOL_PERMANENT);
var8009a88c = mempAlloc(0x80, MEMPOOL_PERMANENT);
var8009a890 = mempAlloc(0xc0, MEMPOOL_PERMANENT);
g_AnimToHeaderSlot = mempAlloc(ALIGN64(g_NumAnimations), MEMPOOL_PERMANENT);
var8005f014 = mempAlloc(ALIGN64(g_NumAnimations * sizeof(*var8005f014)), MEMPOOL_PERMANENT);
g_AnimFrameByteSlots = mempAlloc(ALIGN64(ANIM_FRAME_CACHE_SIZE * g_AnimMaxBytesPerFrame), MEMPOOL_PERMANENT);
g_AnimFrameBytes = mempAlloc(ALIGN64(ANIM_FRAME_CACHE_SIZE * sizeof(*g_AnimFrameBytes)), MEMPOOL_PERMANENT);
g_AnimFrameAnimNums = mempAlloc(ALIGN64(ANIM_FRAME_CACHE_SIZE * sizeof(*g_AnimFrameAnimNums)), MEMPOOL_PERMANENT);
g_AnimFrameFrameNums = mempAlloc(ALIGN64(ANIM_FRAME_CACHE_SIZE * sizeof(*g_AnimFrameFrameNums)), MEMPOOL_PERMANENT);
g_AnimFrameBirths = mempAlloc(ALIGN64(ANIM_FRAME_CACHE_SIZE * sizeof(*g_AnimFrameBirths)), MEMPOOL_PERMANENT);
g_AnimHeaderByteSlots = mempAlloc(ALIGN64(ANIM_HEADER_CACHE_SIZE * g_AnimMaxHeaderLength), MEMPOOL_PERMANENT);
g_AnimHeaderBytes = mempAlloc(ALIGN64(ANIM_HEADER_CACHE_SIZE * sizeof(*g_AnimHeaderBytes)), MEMPOOL_PERMANENT);
g_AnimHeaderAnimNums = mempAlloc(ALIGN64(ANIM_HEADER_CACHE_SIZE * sizeof(*g_AnimHeaderAnimNums)), MEMPOOL_PERMANENT);
g_AnimHeaderBirths = mempAlloc(ALIGN64(ANIM_HEADER_CACHE_SIZE * sizeof(*g_AnimHeaderBirths)), MEMPOOL_PERMANENT);
animsInitTables();
@ -90,26 +93,26 @@ void animsInitTables(void)
s32 i;
for (i = 0; i < g_NumAnimations; i++) {
var8005f010[i] = 0xff;
g_AnimToHeaderSlot[i] = 0xff;
var8005f014[i] = 0;
}
for (i = 0; i < 32; i++) {
var8009a878[i] = 0;
var8009a87c[i] = 0;
var8009a880[i] = 0;
for (i = 0; i < ANIM_FRAME_CACHE_SIZE; i++) {
g_AnimFrameAnimNums[i] = 0;
g_AnimFrameFrameNums[i] = 0;
g_AnimFrameBirths[i] = 0;
}
for (i = 0; i < 40; i++) {
var8009a88c[i] = 0;
var8009a890[i] = -2;
for (i = 0; i < ANIM_HEADER_CACHE_SIZE; i++) {
g_AnimHeaderAnimNums[i] = 0;
g_AnimHeaderBirths[i] = -2;
}
}
void animsReset(void)
{
g_NumAnimations = var8009a894;
g_Anims = var8009a898;
g_NumAnimations = g_NumRomAnimations;
g_Anims = g_RomAnims;
g_AnimHostEnabled = false;
}
@ -140,9 +143,12 @@ u8 *animDma(u8 *dst, u32 segoffset, u32 len)
return dmaExecWithAutoAlign(dst, (u32)&_animationsSegmentRomStart + segoffset, len);
}
s32 anim0002384c(s16 animnum, s32 frame)
/**
* Get a remapped frame, or return -1 if the frame is removed.
*/
s32 animGetRemappedFrame(s16 animnum, s32 frame)
{
u8 *ptr = (u8 *)(var8009a888[var8005f010[animnum]] + g_Anims[animnum].headerlen - 2);
u8 *ptr = (u8 *)(g_AnimHeaderBytes[g_AnimToHeaderSlot[animnum]] + g_Anims[animnum].headerlen - 2);
s32 result = frame;
while (true) {
@ -169,31 +175,31 @@ s32 anim0002384c(s16 animnum, s32 frame)
return result;
}
bool anim00023908(s16 animnum, s32 frame, s32 *frameptr)
bool animRemapFrame(s16 animnum, s32 frame, s32 *frameptr)
{
u8 *ptr = (u8 *)(var8009a888[var8005f010[animnum]] + g_Anims[animnum].headerlen - 2);
u8 *ptr = (u8 *)(g_AnimHeaderBytes[g_AnimToHeaderSlot[animnum]] + g_Anims[animnum].headerlen - 2);
s32 result = frame;
bool ret = true;
while (true) {
s16 value1 = ptr[0] << 8 | ptr[1];
s16 value2;
if (value1 >= 0) {
s16 value2 = ptr[-2] << 8 | ptr[-1];
ptr -= 4;
if (value1 < 0) {
break;
}
if (value1 <= frame) {
if (value2 < frame) {
result = result - value2 + value1 - 1;
continue;
}
value2 = ptr[-2] << 8 | ptr[-1];
ptr -= 4;
if (value1 <= frame) {
if (value2 < frame) {
result = result - value2 + value1 - 1;
} else {
result = result - frame + value1;
ret = false;
break;
}
} else {
break;
}
}
@ -202,11 +208,21 @@ bool anim00023908(s16 animnum, s32 frame, s32 *frameptr)
return ret;
}
bool anim000239e0(s16 animnum, s32 frame)
/**
* Return true if the given animation and frame should be skipped.
*
* Used by cutscenes.
*
* The skip frame numbers are stored at the tail end of the header, prior to the
* frame remapping data. The frame numbers are stored as a list of shorts.
* The list is terminated on the left side with a negative value.
*/
bool animIsFrameCutSkipped(s16 animnum, s32 frame)
{
u8 *ptr = (u8 *)(var8009a888[var8005f010[animnum]] + g_Anims[animnum].headerlen - 2);
u8 *ptr = (u8 *)(g_AnimHeaderBytes[g_AnimToHeaderSlot[animnum]] + g_Anims[animnum].headerlen - 2);
if (g_Anims[animnum].flags & ANIMFLAG_04) {
// Iterate past the ANIMFLAG_HASREMAPPEDFRAMES stuff
if (g_Anims[animnum].flags & ANIMFLAG_HASREMAPPEDFRAMES) {
while (true) {
s16 value1 = ptr[0] << 8 | ptr[1];
@ -237,97 +253,97 @@ bool anim000239e0(s16 animnum, s32 frame)
return false;
}
u8 anim00023ab0(s16 animnum, s32 framenum)
u8 animLoadFrame(s16 animnum, s32 framenum)
{
s32 index = -1;
s32 slot = -1;
s32 i;
s32 offset;
s32 stack;
s32 sp2c = framenum;
s32 loadframenum = framenum;
for (i = 0; i < 32; i++) {
if (var8009a878[i] == animnum && var8009a87c[i] == sp2c) {
index = i;
for (i = 0; i < ANIM_FRAME_CACHE_SIZE; i++) {
if (g_AnimFrameAnimNums[i] == animnum && g_AnimFrameFrameNums[i] == loadframenum) {
slot = i;
break;
}
}
if (index >= 0) {
var8009a880[index] = 1;
if (slot >= 0) {
g_AnimFrameBirths[slot] = 1;
} else {
index = var8005f000;
slot = g_NextAnimFrameIndex;
while (var8009a880[index]) {
index = (index + 1) % 32;
while (g_AnimFrameBirths[slot]) {
slot = (slot + 1) % ANIM_FRAME_CACHE_SIZE;
}
if (g_Anims[animnum].flags & ANIMFLAG_04) {
anim00023908(animnum, framenum, &sp2c);
if (g_Anims[animnum].flags & ANIMFLAG_HASREMAPPEDFRAMES) {
animRemapFrame(animnum, framenum, &loadframenum);
}
if (g_Anims[animnum].bytesperframe) {
offset = g_Anims[animnum].bytesperframe * sp2c + (g_Anims[animnum].data + g_Anims[animnum].headerlen);
var8009a874[index] = animDma(&var8009a870[index * var8005f018], offset, g_Anims[animnum].bytesperframe);
offset = g_Anims[animnum].bytesperframe * loadframenum + (g_Anims[animnum].data + g_Anims[animnum].headerlen);
g_AnimFrameBytes[slot] = animDma(&g_AnimFrameByteSlots[slot * g_AnimMaxBytesPerFrame], offset, g_Anims[animnum].bytesperframe);
} else {
var8009a874[index] = &var8009a870[index * var8005f018];
g_AnimFrameBytes[slot] = &g_AnimFrameByteSlots[slot * g_AnimMaxBytesPerFrame];
}
var8009a878[index] = animnum;
var8009a87c[index] = framenum;
var8009a880[index] = 1;
var8005f000 = (index + 1) % 32;
g_AnimFrameAnimNums[slot] = animnum;
g_AnimFrameFrameNums[slot] = framenum;
g_AnimFrameBirths[slot] = 1;
g_NextAnimFrameIndex = (slot + 1) % ANIM_FRAME_CACHE_SIZE;
}
return index;
return slot;
}
void anim00023d0c(void)
void animForgetFrameBirths(void)
{
s32 i;
for (i = 0; i < 32; i++) {
var8009a880[i] = 0;
for (i = 0; i < ANIM_FRAME_CACHE_SIZE; i++) {
g_AnimFrameBirths[i] = 0;
}
}
void anim00023d38(s16 animnum)
void animLoadHeader(s16 animnum)
{
s32 i;
if (var8005f010[animnum] != 0xff) {
var8009a890[var8005f010[animnum]] = g_Vars.thisframestart240;
var8005f004 = (var8005f010[animnum] + 1) % 40;
if (g_AnimToHeaderSlot[animnum] != 0xff) {
g_AnimHeaderBirths[g_AnimToHeaderSlot[animnum]] = g_Vars.thisframestart240;
g_NextAnimHeaderIndex = (g_AnimToHeaderSlot[animnum] + 1) % ANIM_HEADER_CACHE_SIZE;
} else {
s32 tmp;
s32 bestindex = var8005f004;
s32 slot = g_NextAnimHeaderIndex;
s32 stack;
for (i = 0; i < 40; i++) {
if (var8009a890[i] < var8009a890[bestindex]) {
bestindex = i;
for (i = 0; i < ANIM_HEADER_CACHE_SIZE; i++) {
if (g_AnimHeaderBirths[i] < g_AnimHeaderBirths[slot]) {
slot = i;
}
}
if (var8009a890[bestindex]);
if (g_AnimHeaderBirths[slot]);
if (&g_Vars && &g_Vars);
if (var8009a88c[bestindex]) {
var8005f010[var8009a88c[bestindex]] = 0xff;
if (g_AnimHeaderAnimNums[slot]) {
g_AnimToHeaderSlot[g_AnimHeaderAnimNums[slot]] = 0xff;
}
tmp = g_Anims[animnum].headerlen;
var8009a888[bestindex] = animDma(&var8009a884[bestindex * var8005f01c], g_Anims[animnum].data, tmp);
var8005f010[animnum] = bestindex;
var8009a88c[bestindex] = animnum;
var8009a890[bestindex] = g_Vars.thisframestart240;
var8005f004 = (bestindex + 1) % 40;
g_AnimHeaderBytes[slot] = animDma(&g_AnimHeaderByteSlots[slot * g_AnimMaxHeaderLength], g_Anims[animnum].data, tmp);
g_AnimToHeaderSlot[animnum] = slot;
g_AnimHeaderAnimNums[slot] = animnum;
g_AnimHeaderBirths[slot] = g_Vars.thisframestart240;
g_NextAnimHeaderIndex = (slot + 1) % ANIM_HEADER_CACHE_SIZE;
}
}
#if MATCHING
GLOBAL_ASM(
glabel anim00023f50
glabel animReadBits
/* 23f50: 30cf0007 */ andi $t7,$a2,0x7
/* 23f54: 24180008 */ addiu $t8,$zero,0x8
/* 23f58: 030f4023 */ subu $t0,$t8,$t7
@ -370,93 +386,99 @@ glabel anim00023f50
);
#else
// Mismatch: regalloc
s32 anim00023f50(u8 *arg0, u8 arg1, u32 arg2)
s32 animReadBits(u8 *ptr, u8 readbitlen, u32 bitoffset)
{
u32 result = 0;
u8 numbits;
u8 numbitsthisbyte;
u32 tmp;
arg0 += arg2 / 8;
numbits = 8 - (arg2 % 8);
ptr += bitoffset / 8;
numbitsthisbyte = 8 - (bitoffset % 8);
while (arg1 >= numbits) {
arg1 -= numbits;
result |= (*arg0 & ((1 << numbits) - 1)) << arg1;
arg0++;
numbits = 8;
while (readbitlen >= numbitsthisbyte) {
readbitlen -= numbitsthisbyte;
result |= (*ptr & ((1 << numbitsthisbyte) - 1)) << readbitlen;
ptr++;
numbitsthisbyte = 8;
}
if (arg1 > 0) {
result |= (*arg0 >> (numbits - arg1)) & ((1 << arg1) - 1);
if (readbitlen > 0) {
result |= (*ptr >> (numbitsthisbyte - readbitlen)) & ((1 << readbitlen) - 1);
}
if (arg2 / 8);
if (bitoffset / 8);
return result;
}
#endif
s32 anim00023fe0(u8 *arg0, u8 arg1, s32 arg2)
s32 animReadSignedShort(u8 *ptr, u8 readbitlen, s32 bitoffset)
{
u16 result = anim00023f50(arg0, arg1, arg2);
u16 result = animReadBits(ptr, readbitlen, bitoffset);
if (arg1 < 16 && (result & (1 << (arg1 - 1)))) {
result |= ((1 << (16 - arg1)) - 1) << arg1;
if (readbitlen < 16 && (result & (1 << (readbitlen - 1)))) {
result |= ((1 << (16 - readbitlen)) - 1) << readbitlen;
}
return result;
}
void anim00024050(s32 arg0, bool flip, struct skeleton *skel, s16 animnum, u8 arg4, struct coord *arg5, struct coord *arg6, struct coord *arg7)
/**
* Read the rotation, position and scale values for the given part for the frame
* at the given frameslot.
*
* Both the anim header and frame data must be loaded already.
*/
void animGetRotTranslateScale(s32 part, bool flip, struct skeleton *skel, s16 animnum, u8 frameslot, struct coord *rot, struct coord *translate, struct coord *scale)
{
s32 i;
u16 sp5c[3];
u8 sp5b;
u8 *sp54 = var8009a874[arg4];
u8 bitsperentry;
u16 introt[3];
u8 readbitlen;
u8 *framebytes = g_AnimFrameBytes[frameslot];
u8 framelen;
u8 *ptr;
u8 *end;
s32 sum;
s32 bitoffset;
u32 stack;
if (flip) {
arg0 = skel->things[arg0][1];
part = skel->things[part][1];
}
bitsperentry = g_Anims[animnum].initialposbitsperentry;
ptr = var8009a888[var8005f010[animnum]];
sum = 0;
framelen = g_Anims[animnum].framelen;
ptr = g_AnimHeaderBytes[g_AnimToHeaderSlot[animnum]];
bitoffset = 0;
end = ptr + g_Anims[animnum].headerlen;
for (i = 0; i < arg0 && ptr < end; i++) {
for (i = 0; i < part && ptr < end; i++) {
u8 flags = *ptr;
ptr++;
if (flags & 0x08) {
sum += ptr[2] + ptr[5] + ptr[8] + ptr[11];
if (flags & ANIMFIELD_08) {
bitoffset += ptr[2] + ptr[5] + ptr[8] + ptr[11];
ptr += 12;
} else if (flags & 0x02) {
sum += ptr[2] + ptr[5] + ptr[8];
} else if (flags & ANIMFIELD_S16_TRANSLATE) {
bitoffset += ptr[2] + ptr[5] + ptr[8];
ptr += 9;
} else if (flags & 0x20) {
sum += ptr[0] + ptr[5] + ptr[10];
} else if (flags & ANIMFIELD_S32_TRANSLATE) {
bitoffset += ptr[0] + ptr[5] + ptr[10];
ptr += 15;
}
if (flags & 0x01) {
sum += ptr[2] + ptr[5] + ptr[8];
if (flags & ANIMFIELD_S16_ROTATE) {
bitoffset += ptr[2] + ptr[5] + ptr[8];
ptr += 9;
} else if (flags & 0x10) {
sum += 96;
} else if (flags & ANIMFIELD_F32_ROTATE) {
bitoffset += 96;
}
if (flags & 0x40) {
sum += ptr[0];
if (flags & ANIMFIELD_CAMERA) {
bitoffset += ptr[0];
ptr += 5;
}
if (flags & 0x80) {
sum += 0x60;
if (flags & ANIMFIELD_F32_SCALE) {
bitoffset += 0x60;
}
}
@ -464,211 +486,217 @@ void anim00024050(s32 arg0, bool flip, struct skeleton *skel, s16 animnum, u8 ar
u8 flags = *ptr;
ptr++;
if (flags & 0x02) {
sp5b = ptr[2];
arg6->x = (s16) (anim00023fe0(sp54, sp5b, sum) + (ptr[0] << 8) + ptr[1]);
sum += sp5b;
if (flags & ANIMFIELD_S16_TRANSLATE) {
readbitlen = ptr[2];
translate->x = (s16) (animReadSignedShort(framebytes, readbitlen, bitoffset) + (ptr[0] << 8) + ptr[1]);
bitoffset += readbitlen;
sp5b = ptr[5];
arg6->y = (s16) (anim00023fe0(sp54, sp5b, sum) + (ptr[3] << 8) + ptr[4]);
sum += sp5b;
readbitlen = ptr[5];
translate->y = (s16) (animReadSignedShort(framebytes, readbitlen, bitoffset) + (ptr[3] << 8) + ptr[4]);
bitoffset += readbitlen;
sp5b = ptr[8];
arg6->z = (s16) (anim00023fe0(sp54, sp5b, sum) + (ptr[6] << 8) + ptr[7]);
sum += sp5b;
readbitlen = ptr[8];
translate->z = (s16) (animReadSignedShort(framebytes, readbitlen, bitoffset) + (ptr[6] << 8) + ptr[7]);
bitoffset += readbitlen;
ptr += 9;
} else if (flags & 0x20) {
sp5b = ptr[0];
arg6->x = (anim00023f50(sp54, sp5b, sum) + ((ptr[1] << 24) + (ptr[2] << 16) + (ptr[3] << 8) + ptr[4])) * 0.001f;
sum += sp5b;
} else if (flags & ANIMFIELD_S32_TRANSLATE) {
readbitlen = ptr[0];
translate->x = (animReadBits(framebytes, readbitlen, bitoffset) + ((ptr[1] << 24) + (ptr[2] << 16) + (ptr[3] << 8) + ptr[4])) * 0.001f;
bitoffset += readbitlen;
sp5b = ptr[5];
arg6->y = (anim00023f50(sp54, sp5b, sum) + ((ptr[6] << 24) + (ptr[7] << 16) + (ptr[8] << 8) + ptr[9])) * 0.001f;
sum += sp5b;
readbitlen = ptr[5];
translate->y = (animReadBits(framebytes, readbitlen, bitoffset) + ((ptr[6] << 24) + (ptr[7] << 16) + (ptr[8] << 8) + ptr[9])) * 0.001f;
bitoffset += readbitlen;
sp5b = ptr[10];
arg6->z = (anim00023f50(sp54, sp5b, sum) + ((ptr[11] << 24) + (ptr[12] << 16) + (ptr[13] << 8) + ptr[14])) * 0.001f;
sum += sp5b;
readbitlen = ptr[10];
translate->z = (animReadBits(framebytes, readbitlen, bitoffset) + ((ptr[11] << 24) + (ptr[12] << 16) + (ptr[13] << 8) + ptr[14])) * 0.001f;
bitoffset += readbitlen;
ptr += 15;
} else {
if (flags & 0x08) {
sum += ptr[2] + ptr[5] + ptr[8] + ptr[11];
if (flags & ANIMFIELD_08) {
bitoffset += ptr[2] + ptr[5] + ptr[8] + ptr[11];
ptr += 12;
}
arg6->x = arg6->y = arg6->z = 0.0f;
translate->x = translate->y = translate->z = 0.0f;
}
if (flags & 0x01) {
sp5b = ptr[2];
sp5c[0] = anim00023f50(sp54, sp5b, sum);
sp5c[0] += (ptr[0] << 8) + ptr[1];
sp5c[0] <<= 16 - bitsperentry;
sum += sp5b;
if (flags & ANIMFIELD_S16_ROTATE) {
readbitlen = ptr[2];
introt[0] = animReadBits(framebytes, readbitlen, bitoffset);
introt[0] += (ptr[0] << 8) + ptr[1];
introt[0] <<= 16 - framelen;
bitoffset += readbitlen;
sp5b = ptr[5];
sp5c[1] = anim00023f50(sp54, sp5b, sum);
sp5c[1] += (ptr[3] << 8) + ptr[4];
sp5c[1] <<= 16 - bitsperentry;
sum += sp5b;
readbitlen = ptr[5];
introt[1] = animReadBits(framebytes, readbitlen, bitoffset);
introt[1] += (ptr[3] << 8) + ptr[4];
introt[1] <<= 16 - framelen;
bitoffset += readbitlen;
sp5b = ptr[8];
sp5c[2] = anim00023f50(sp54, sp5b, sum);
sp5c[2] += (ptr[6] << 8) + ptr[7];
sp5c[2] <<= 16 - bitsperentry;
sum += sp5b;
readbitlen = ptr[8];
introt[2] = animReadBits(framebytes, readbitlen, bitoffset);
introt[2] += (ptr[6] << 8) + ptr[7];
introt[2] <<= 16 - framelen;
bitoffset += readbitlen;
arg5->x = sp5c[0] * M_BADTAU / 65536.0f;
rot->x = introt[0] * M_BADTAU / 65536.0f;
if (flip) {
if (sp5c[1] != 0) {
arg5->y = (0x10000 - sp5c[1]) * M_BADTAU / 65536.0f;
if (introt[1] != 0) {
rot->y = (0x10000 - introt[1]) * M_BADTAU / 65536.0f;
} else {
arg5->y = 0.0f;
rot->y = 0.0f;
}
if (sp5c[2] != 0) {
arg5->z = (0x10000 - sp5c[2]) * M_BADTAU / 65536.0f;
if (introt[2] != 0) {
rot->z = (0x10000 - introt[2]) * M_BADTAU / 65536.0f;
} else {
arg5->z = 0.0f;
rot->z = 0.0f;
}
} else {
arg5->y = sp5c[1] * M_BADTAU / 65536.0f;
arg5->z = sp5c[2] * M_BADTAU / 65536.0f;
rot->y = introt[1] * M_BADTAU / 65536.0f;
rot->z = introt[2] * M_BADTAU / 65536.0f;
}
} else if (flags & 0x10) {
} else if (flags & ANIMFIELD_F32_ROTATE) {
s32 sp38;
sp38 = anim00023f50(sp54, 32, sum);
arg5->x = *(f32 *)&sp38;
sum += 32;
sp38 = animReadBits(framebytes, 32, bitoffset);
rot->x = *(f32 *)&sp38;
bitoffset += 32;
sp38 = anim00023f50(sp54, 32, sum);
arg5->y = *(f32 *)&sp38;
sum += 32;
sp38 = animReadBits(framebytes, 32, bitoffset);
rot->y = *(f32 *)&sp38;
bitoffset += 32;
sp38 = anim00023f50(sp54, 32, sum);
arg5->z = *(f32 *)&sp38;
sum += 32;
sp38 = animReadBits(framebytes, 32, bitoffset);
rot->z = *(f32 *)&sp38;
bitoffset += 32;
if (flip) {
if (arg5->y != 0.0f) {
arg5->y = M_BADTAU - arg5->y;
if (rot->y != 0.0f) {
rot->y = M_BADTAU - rot->y;
}
if (arg5->z != 0.0f) {
arg5->z = M_BADTAU - arg5->z;
if (rot->z != 0.0f) {
rot->z = M_BADTAU - rot->z;
}
}
} else {
arg5->x = arg5->y = arg5->z = 0.0f;
rot->x = rot->y = rot->z = 0.0f;
}
if (flags & 0x80) {
s32 sp34;
if (flags & ANIMFIELD_F32_SCALE) {
s32 word;
sp34 = anim00023f50(sp54, 32, sum);
arg7->x = *(f32 *)&sp34;
sum += 32;
word = animReadBits(framebytes, 32, bitoffset);
scale->x = *(f32 *)&word;
bitoffset += 32;
sp34 = anim00023f50(sp54, 32, sum);
arg7->y = *(f32 *)&sp34;
sum += 32;
word = animReadBits(framebytes, 32, bitoffset);
scale->y = *(f32 *)&word;
bitoffset += 32;
sp34 = anim00023f50(sp54, 32, sum);
arg7->z = *(f32 *)&sp34;
word = animReadBits(framebytes, 32, bitoffset);
scale->z = *(f32 *)&word;
} else {
arg7->x = arg7->y = arg7->z = 1.0f;
scale->x = scale->y = scale->z = 1.0f;
}
return;
}
arg5->x = arg5->y = arg5->z = 0.0f;
arg6->x = arg6->y = arg6->z = 0.0f;
arg7->x = arg7->y = arg7->z = 1.0f;
rot->x = rot->y = rot->z = 0.0f;
translate->x = translate->y = translate->z = 0.0f;
scale->x = scale->y = scale->z = 1.0f;
}
u16 anim0002485c(s32 arg0, bool arg1, struct skeleton *skel, s16 animnum, s32 loopframe, s16 *arg5, bool arg6)
/**
* Read the position and Y rotation (?) values for the given part at the given
* frame number.
*
* No data needs to be loaded by the caller - the function will ensure the
* header and frame are loaded.
*/
u16 animGetPosAngleAsInt(s32 part, bool flip, struct skeleton *skel, s16 animnum, s32 framenum, s16 inttranslate[3], bool arg6)
{
u16 result = 0;
s32 sum;
u8 sp2f;
u8 index;
u8 *sp28;
s32 bitoffset;
u8 readbitlen;
u8 slot;
u8 *framebytes;
u8 *ptr;
s32 i;
if (arg6) {
arg5[0] = 0;
arg5[1] = 0;
arg5[2] = var8005f014[animnum];
inttranslate[0] = 0;
inttranslate[1] = 0;
inttranslate[2] = var8005f014[animnum];
} else {
anim00023d38(animnum);
index = anim00023ab0(animnum, loopframe);
anim00023d0c();
animLoadHeader(animnum);
slot = animLoadFrame(animnum, framenum);
animForgetFrameBirths();
sp28 = var8009a874[index];
framebytes = g_AnimFrameBytes[slot];
if (arg1) {
arg0 = skel->things[arg0][1];
if (flip) {
part = skel->things[part][1];
}
// This is iterating the header information in the animation's data
sum = 0;
ptr = var8009a888[var8005f010[animnum]];
bitoffset = 0;
ptr = g_AnimHeaderBytes[g_AnimToHeaderSlot[animnum]];
for (i = 0; i < arg0; i++) {
for (i = 0; i < part; i++) {
u8 flags = *ptr;
ptr++;
if (flags & 0x08) {
sum += ptr[2] + ptr[5] + ptr[8] + ptr[11];
if (flags & ANIMFIELD_08) {
bitoffset += ptr[2] + ptr[5] + ptr[8] + ptr[11];
ptr += 12;
} else if (flags & 0x02) {
sum += ptr[2] + ptr[5] + ptr[8];
} else if (flags & ANIMFIELD_S16_TRANSLATE) {
bitoffset += ptr[2] + ptr[5] + ptr[8];
ptr += 9;
} else if (flags & 0x20) {
sum += ptr[0] + ptr[5] + ptr[10];
} else if (flags & ANIMFIELD_S32_TRANSLATE) {
bitoffset += ptr[0] + ptr[5] + ptr[10];
ptr += 15;
}
if (flags & 0x01) {
sum += ptr[2] + ptr[5] + ptr[8];
if (flags & ANIMFIELD_S16_ROTATE) {
bitoffset += ptr[2] + ptr[5] + ptr[8];
ptr += 9;
} else if (flags & 0x10) {
sum += 96;
} else if (flags & ANIMFIELD_F32_ROTATE) {
bitoffset += 96;
}
if (flags & 0x40) {
sum += *ptr;
if (flags & ANIMFIELD_CAMERA) {
bitoffset += *ptr;
ptr += 5;
}
if (flags & 0x80) {
sum += 96;
if (flags & ANIMFIELD_F32_SCALE) {
bitoffset += 96;
}
}
sp2f = ptr[3];
arg5[0] = anim00023fe0(sp28, sp2f, sum) + ptr[1] * 256 + ptr[2];
sum += sp2f;
readbitlen = ptr[3];
inttranslate[0] = animReadSignedShort(framebytes, readbitlen, bitoffset) + ptr[1] * 256 + ptr[2];
bitoffset += readbitlen;
sp2f = ptr[6];
arg5[1] = anim00023fe0(sp28, sp2f, sum) + ptr[4] * 256 + ptr[5];
sum += sp2f;
readbitlen = ptr[6];
inttranslate[1] = animReadSignedShort(framebytes, readbitlen, bitoffset) + ptr[4] * 256 + ptr[5];
bitoffset += readbitlen;
sp2f = ptr[9];
arg5[2] = anim00023fe0(sp28, sp2f, sum) + ptr[7] * 256 + ptr[8];
sum += sp2f;
readbitlen = ptr[9];
inttranslate[2] = animReadSignedShort(framebytes, readbitlen, bitoffset) + ptr[7] * 256 + ptr[8];
bitoffset += readbitlen;
sp2f = ptr[12];
result = anim00023fe0(sp28, sp2f, sum) + ptr[10] * 256 + ptr[11];
readbitlen = ptr[12];
result = animReadSignedShort(framebytes, readbitlen, bitoffset) + ptr[10] * 256 + ptr[11];
if (arg1) {
arg5[0] = -arg5[0];
if (flip) {
inttranslate[0] = -inttranslate[0];
if (result != 0) {
result = 0x10000 - result;
@ -679,58 +707,67 @@ u16 anim0002485c(s32 arg0, bool arg1, struct skeleton *skel, s16 animnum, s32 lo
return result;
}
f32 anim00024b64(u32 arg0, u32 arg1, struct skeleton *arg2, s16 animnum, u32 arg4, struct coord *coord, u32 arg6)
f32 animGetTranslateAngle(s32 part, bool flip, struct skeleton *skel, s16 animnum, s32 framenum, struct coord *translate, bool arg6)
{
s16 sp30[3];
s16 inttranslate[3];
f32 value = anim0002485c(arg0, arg1, arg2, animnum, arg4, sp30, arg6);
f32 angle = animGetPosAngleAsInt(part, flip, skel, animnum, framenum, inttranslate, arg6);
coord->x = sp30[0];
coord->y = sp30[1];
coord->z = sp30[2];
translate->x = inttranslate[0];
translate->y = inttranslate[1];
translate->z = inttranslate[2];
return value * M_BADTAU / 65536.0f;
return angle * M_BADTAU / 65536.0f;
}
f32 anim00024c14(s32 arg0, s16 animnum, u8 arg2)
/**
* Return a camera value (FOV Y or blur frac) for the current frame.
*
* The function assumes the current frame's data has been loaded.
* Its slot is provided by the frameslot argument.
*
* When part = 1, the returned value is the FOV Y.
* When part = 2, the returned value is the blur frac.
*/
f32 animGetCameraValue(s32 part, s16 animnum, u8 frameslot)
{
u32 stack[2];
u8 *sp24 = var8009a874[arg2];
u8 *ptr = var8009a888[var8005f010[animnum]];
u8 *framebytes = g_AnimFrameBytes[frameslot];
u8 *ptr = g_AnimHeaderBytes[g_AnimToHeaderSlot[animnum]];
f32 result = 0;
s32 total = 0;
s32 bitoffset = 0;
s32 i;
u8 *end = ptr + g_Anims[animnum].headerlen;
for (i = 0; i < arg0 && ptr < end; i++) {
for (i = 0; i < part && ptr < end; i++) {
u8 flags = ptr[0];
ptr++;
if (flags & ANIMHEADERFLAG_08) {
total += ptr[2] + ptr[5] + ptr[8] + ptr[11];
if (flags & ANIMFIELD_08) {
bitoffset += ptr[2] + ptr[5] + ptr[8] + ptr[11];
ptr += 12;
} else if (flags & ANIMHEADERFLAG_02) {
total += ptr[2] + ptr[5] + ptr[8];
} else if (flags & ANIMFIELD_S16_TRANSLATE) {
bitoffset += ptr[2] + ptr[5] + ptr[8];
ptr += 9;
} else if (flags & ANIMHEADERFLAG_20) {
total += ptr[0] + ptr[5] + ptr[10];
} else if (flags & ANIMFIELD_S32_TRANSLATE) {
bitoffset += ptr[0] + ptr[5] + ptr[10];
ptr += 15;
}
if (flags & ANIMHEADERFLAG_01) {
total += ptr[2] + ptr[5] + ptr[8];
if (flags & ANIMFIELD_S16_ROTATE) {
bitoffset += ptr[2] + ptr[5] + ptr[8];
ptr += 9;
} else if (flags & ANIMHEADERFLAG_10) {
total += 0x60;
} else if (flags & ANIMFIELD_F32_ROTATE) {
bitoffset += 0x60;
}
if (flags & ANIMHEADERFLAG_40) {
total += ptr[0];
if (flags & ANIMFIELD_CAMERA) {
bitoffset += ptr[0];
ptr += 5;
}
if (flags & ANIMHEADERFLAG_80) {
total += 0x60;
if (flags & ANIMFIELD_F32_SCALE) {
bitoffset += 0x60;
}
}
@ -738,9 +775,17 @@ f32 anim00024c14(s32 arg0, s16 animnum, u8 arg2)
u8 flags = ptr[0];
ptr++;
if (flags & ANIMHEADERFLAG_40) {
total = anim00023f50(sp24, ptr[0], total);
result = (total + ptr[1] * 0x1000000 + ptr[2] * 0x10000 + ptr[3] * 0x100 + ptr[4]) * 0.001f;
if (flags & ANIMFIELD_CAMERA) {
/**
* In the header:
* ptr[0] = number of bits to read in the frame data
* ptr[1,2,3,4] = base value
*
* The value in the frame data is an adjustment value that is added
* to the base value.
*/
s32 framevalue = animReadBits(framebytes, ptr[0], bitoffset);
result = (framevalue + ptr[1] * 0x1000000 + ptr[2] * 0x10000 + ptr[3] * 0x100 + ptr[4]) * 0.001f;
}
}

View File

@ -734,27 +734,27 @@ void modelUpdateChrNodeMtx(struct modelrenderdata *arg0, struct model *model, st
Mtxf *sp24c;
u32 stack1;
Mtxf *mtx = &model->matrices[rodata->chrinfo.mtxindex];
s32 sp240 = rodata->chrinfo.unk00;
s32 animpart = rodata->chrinfo.animpart;
struct skeleton *skel = model->definition->skel;
struct coord sp230;
struct coord sp224;
struct coord sp218;
struct coord rot1;
struct coord translate1;
struct coord scale1;
Mtxf sp1d8;
Mtxf sp198;
Mtxf sp158;
f32 sp154;
struct coord sp148;
struct coord sp13c;
struct coord sp130;
struct coord sp124;
struct coord sp118;
struct coord sp10c;
struct coord rot2;
struct coord translate2;
struct coord scale2;
struct coord rot3;
struct coord translate3;
struct coord scale3;
f32 spfc[4];
f32 spec[4];
f32 spdc[4];
struct coord spd0;
struct coord spc4;
struct coord spb8;
struct coord rot4;
struct coord translate4;
struct coord scale4;
Mtxf sp78;
Mtxf sp38;
@ -766,7 +766,7 @@ void modelUpdateChrNodeMtx(struct modelrenderdata *arg0, struct model *model, st
sp24c = arg0->unk00;
}
anim00024050(sp240, anim->flip, skel, anim->animnum, anim->unk04, &sp230, &sp224, &sp218);
animGetRotTranslateScale(animpart, anim->flip, skel, anim->animnum, anim->frameslot1, &rot1, &translate1, &scale1);
if (g_Vars.in_cutscene && anim->speed > 0) {
#if VERSION >= VERSION_PAL_BETA
@ -779,33 +779,33 @@ void modelUpdateChrNodeMtx(struct modelrenderdata *arg0, struct model *model, st
}
if (sp154 != 0.0f) {
anim00024050(sp240, anim->flip, skel, anim->animnum, anim->unk05, &sp148, &sp13c, &sp130);
modelTweenRot(&sp230, &sp148, sp154);
animGetRotTranslateScale(animpart, anim->flip, skel, anim->animnum, anim->frameslot2, &rot2, &translate2, &scale2);
modelTweenRot(&rot1, &rot2, sp154);
}
if (anim->fracmerge != 0.0f) {
anim00024050(sp240, anim->flip2, skel, anim->animnum2, anim->unk06, &sp124, &sp118, &sp10c);
animGetRotTranslateScale(animpart, anim->flip2, skel, anim->animnum2, anim->frameslot3, &rot3, &translate3, &scale3);
if (anim->frac2 != 0.0f) {
anim00024050(sp240, anim->flip2, skel, anim->animnum2, anim->unk07, &spd0, &spc4, &spb8);
modelTweenRot(&sp124, &spd0, anim->frac2);
animGetRotTranslateScale(animpart, anim->flip2, skel, anim->animnum2, anim->frameslot4, &rot4, &translate4, &scale4);
modelTweenRot(&rot3, &rot4, anim->frac2);
}
if ((g_Anims[anim->animnum].flags & ANIMFLAG_02) && (g_Anims[anim->animnum2].flags & ANIMFLAG_02) == 0) {
mtx4LoadYRotation(rwdata->chrinfo.yrot, &sp78);
mtx4LoadRotation(&sp124, &sp38);
mtx4LoadRotation(&rot3, &sp38);
mtx00015be0(&sp78, &sp38);
quaternion0f097044(&sp38, spec);
} else {
quaternion0f096ca0(&sp124, spec);
quaternion0f096ca0(&rot3, spec);
}
quaternion0f096ca0(&sp230, spfc);
quaternion0f096ca0(&rot1, spfc);
quaternion0f0976c0(spfc, spec);
quaternionSlerp(spfc, spec, anim->fracmerge, spdc);
quaternionToMtx(spdc, &sp1d8);
} else {
mtx4LoadRotation(&sp230, &sp1d8);
mtx4LoadRotation(&rot1, &sp1d8);
}
if (g_Anims[anim->animnum].flags & ANIMFLAG_02) {
@ -1053,38 +1053,38 @@ void modelUpdatePositionNodeMtx(struct modelrenderdata *renderdata, struct model
{
struct anim *anim;
struct modelrodata_position *rodata = &node->rodata->position;
s32 partnum;
s32 animpart;
struct skeleton *skel;
struct coord sp144;
struct coord sp138;
struct coord sp12c;
struct coord rot1;
struct coord translate1;
struct coord scale1;
bool sp128;
Mtxf spe8;
Mtxf *mtx;
f32 spe0;
struct coord spd4;
struct coord spc8;
struct coord spbc;
struct coord spb0;
struct coord spa4;
struct coord sp98;
struct coord rot2;
struct coord translate2;
struct coord scale2;
struct coord rot3;
struct coord translate3;
struct coord scale3;
f32 sp88[4];
f32 sp78[4];
f32 sp68[4];
struct coord sp5c;
struct coord sp50;
struct coord sp44;
struct coord rot4;
struct coord translate4;
struct coord scale4;
anim = model->anim;
if (anim != NULL) {
partnum = rodata->part;
animpart = rodata->part;
skel = model->definition->skel;
if (anim->animnum != 0) {
sp128 = (g_Anims[anim->animnum].flags & ANIMFLAG_02) && node == model->definition->rootnode;
anim00024050(partnum, anim->flip, skel, anim->animnum, anim->unk04, &sp144, &sp138, &sp12c);
animGetRotTranslateScale(animpart, anim->flip, skel, anim->animnum, anim->frameslot1, &rot1, &translate1, &scale1);
if (g_Vars.in_cutscene && anim->speed > 0.0f) {
#if VERSION >= VERSION_PAL_BETA
@ -1097,8 +1097,8 @@ void modelUpdatePositionNodeMtx(struct modelrenderdata *renderdata, struct model
}
if (spe0 != 0.0f) {
anim00024050(partnum, anim->flip, skel, anim->animnum, anim->unk05, &spd4, &spc8, &spbc);
modelTweenRot(&sp144, &spd4, spe0);
animGetRotTranslateScale(animpart, anim->flip, skel, anim->animnum, anim->frameslot2, &rot2, &translate2, &scale2);
modelTweenRot(&rot1, &rot2, spe0);
#if VERSION >= VERSION_PAL_BETA
if (sp128 || var8005efd8_2)
@ -1106,71 +1106,71 @@ void modelUpdatePositionNodeMtx(struct modelrenderdata *renderdata, struct model
if (sp128)
#endif
{
modelTweenPos(&sp138, &spc8, spe0);
modelTweenPos(&translate1, &translate2, spe0);
}
}
} else {
sp138.f[0] = sp138.f[1] = sp138.f[2] = 0.0f;
sp144.f[0] = sp144.f[1] = sp144.f[2] = 0.0f;
sp12c.f[0] = sp12c.f[1] = sp12c.f[2] = 1.0f;
translate1.f[0] = translate1.f[1] = translate1.f[2] = 0.0f;
rot1.f[0] = rot1.f[1] = rot1.f[2] = 0.0f;
scale1.f[0] = scale1.f[1] = scale1.f[2] = 1.0f;
sp128 = false;
}
if (anim->fracmerge != 0.0f) {
anim00024050(partnum, anim->flip2, skel, anim->animnum2, anim->unk06, &spb0, &spa4, &sp98);
animGetRotTranslateScale(animpart, anim->flip2, skel, anim->animnum2, anim->frameslot3, &rot3, &translate3, &scale3);
if (anim->frac2 != 0.0f) {
anim00024050(partnum, anim->flip2, skel, anim->animnum2, anim->unk07, &sp5c, &sp50, &sp44);
modelTweenRot(&spb0, &sp5c, anim->frac2);
animGetRotTranslateScale(animpart, anim->flip2, skel, anim->animnum2, anim->frameslot4, &rot4, &translate4, &scale4);
modelTweenRot(&rot3, &rot4, anim->frac2);
}
quaternion0f096ca0(&sp144, sp88);
quaternion0f096ca0(&spb0, sp78);
quaternion0f096ca0(&rot1, sp88);
quaternion0f096ca0(&rot3, sp78);
quaternion0f0976c0(sp88, sp78);
quaternionSlerp(sp88, sp78, anim->fracmerge, sp68);
if (sp138.f[0] != 0.0f || sp138.f[1] != 0.0f || sp138.f[2] != 0.0f) {
sp138.x *= anim->animscale;
sp138.y *= anim->animscale;
sp138.z *= anim->animscale;
if (translate1.f[0] != 0.0f || translate1.f[1] != 0.0f || translate1.f[2] != 0.0f) {
translate1.x *= anim->animscale;
translate1.y *= anim->animscale;
translate1.z *= anim->animscale;
if (node != model->definition->rootnode) {
sp138.x += rodata->pos.x;
sp138.y += rodata->pos.y;
sp138.z += rodata->pos.z;
translate1.x += rodata->pos.x;
translate1.y += rodata->pos.y;
translate1.z += rodata->pos.z;
}
modelPositionJointUsingQuatRot(renderdata, model, node, sp68, &sp138, &sp12c);
modelPositionJointUsingQuatRot(renderdata, model, node, sp68, &translate1, &scale1);
} else if (node != model->definition->rootnode) {
modelPositionJointUsingQuatRot(renderdata, model, node, sp68, &rodata->pos, &sp12c);
modelPositionJointUsingQuatRot(renderdata, model, node, sp68, &rodata->pos, &scale1);
} else {
modelPositionJointUsingQuatRot(renderdata, model, node, sp68, &sp138, &sp12c);
modelPositionJointUsingQuatRot(renderdata, model, node, sp68, &translate1, &scale1);
}
} else if (sp128) {
f32 mult = func0f15c888();
sp138.x *= mult;
sp138.y *= mult;
sp138.z *= mult;
translate1.x *= mult;
translate1.y *= mult;
translate1.z *= mult;
modelPositionJointUsingVecRot(renderdata, model, node, &sp144, &sp138, true, &sp12c);
} else if (sp138.f[0] != 0.0f || sp138.f[1] != 0.0f || sp138.f[2] != 0.0f) {
sp138.x *= anim->animscale;
sp138.y *= anim->animscale;
sp138.z *= anim->animscale;
modelPositionJointUsingVecRot(renderdata, model, node, &rot1, &translate1, true, &scale1);
} else if (translate1.f[0] != 0.0f || translate1.f[1] != 0.0f || translate1.f[2] != 0.0f) {
translate1.x *= anim->animscale;
translate1.y *= anim->animscale;
translate1.z *= anim->animscale;
if (node != model->definition->rootnode) {
sp138.x += rodata->pos.x;
sp138.y += rodata->pos.y;
sp138.z += rodata->pos.z;
translate1.x += rodata->pos.x;
translate1.y += rodata->pos.y;
translate1.z += rodata->pos.z;
}
modelPositionJointUsingVecRot(renderdata, model, node, &sp144, &sp138, false, &sp12c);
modelPositionJointUsingVecRot(renderdata, model, node, &rot1, &translate1, false, &scale1);
} else if (node != model->definition->rootnode) {
modelPositionJointUsingVecRot(renderdata, model, node, &sp144, &rodata->pos, false, &sp12c);
modelPositionJointUsingVecRot(renderdata, model, node, &rot1, &rodata->pos, false, &scale1);
} else {
modelPositionJointUsingVecRot(renderdata, model, node, &sp144, &sp138, false, &sp12c);
modelPositionJointUsingVecRot(renderdata, model, node, &rot1, &translate1, false, &scale1);
}
} else {
if (node->parent) {
@ -1588,23 +1588,23 @@ void modelSetMatricesWithAnim(struct modelrenderdata *renderdata, struct model *
}
}
anim00023d38(anim->animnum);
anim->unk04 = anim00023ab0(anim->animnum, anim->framea);
animLoadHeader(anim->animnum);
anim->frameslot1 = animLoadFrame(anim->animnum, anim->framea);
if (anim->frac != 0) {
anim->unk05 = anim00023ab0(anim->animnum, anim->frameb);
anim->frameslot2 = animLoadFrame(anim->animnum, anim->frameb);
}
if (anim->animnum2) {
anim00023d38(anim->animnum2);
anim->unk06 = anim00023ab0(anim->animnum2, anim->frame2a);
animLoadHeader(anim->animnum2);
anim->frameslot3 = animLoadFrame(anim->animnum2, anim->frame2a);
if (anim->frac2 != 0) {
anim->unk07 = anim00023ab0(anim->animnum2, anim->frame2b);
anim->frameslot4 = animLoadFrame(anim->animnum2, anim->frame2b);
}
}
anim00023d0c();
animForgetFrameBirths();
}
modelSetMatrices(renderdata, model);
@ -1807,16 +1807,16 @@ void modelSetAnimation2(struct model *model, s16 animnum, s32 flip, f32 fstartfr
u32 stack;
struct modelrodata_chrinfo *rodata = &model->definition->rootnode->rodata->chrinfo;
struct modelrwdata_chrinfo *rwdata = (struct modelrwdata_chrinfo *) modelGetNodeRwData(model, model->definition->rootnode);
s32 spa4 = rodata->unk00;
s32 animpart = rodata->animpart;
struct skeleton *skel = model->definition->skel;
f32 scale;
f32 sp98;
f32 sp94;
struct coord sp88 = {0, 0, 0};
struct coord translate = {0, 0, 0};
f32 sp84;
u8 sp83;
struct coord sp74;
struct coord sp68;
u8 frameslot;
struct coord rot1;
struct coord scale1;
f32 sp64;
struct coord sp58;
struct coord sp4c;
@ -1827,43 +1827,43 @@ void modelSetAnimation2(struct model *model, s16 animnum, s32 flip, f32 fstartfr
if (g_Anims[anim->animnum].flags & ANIMFLAG_02) {
sp64 = func0f15c888();
anim00023d38(anim->animnum);
sp83 = anim00023ab0(anim->animnum, anim->framea);
anim00023d0c();
anim00024050(spa4, anim->flip, skel, anim->animnum, sp83, &sp74, &sp88, &sp68);
animLoadHeader(anim->animnum);
frameslot = animLoadFrame(anim->animnum, anim->framea);
animForgetFrameBirths();
animGetRotTranslateScale(animpart, anim->flip, skel, anim->animnum, frameslot, &rot1, &translate, &scale1);
rwdata->unk34.x = sp88.x * sp64;
rwdata->unk34.y = sp88.y * sp64;
rwdata->unk34.z = sp88.z * sp64;
rwdata->unk34.x = translate.x * sp64;
rwdata->unk34.y = translate.y * sp64;
rwdata->unk34.z = translate.z * sp64;
rwdata->unk30 = rwdata->yrot;
if (anim->frac == 0) {
rwdata->unk01 = 0;
} else {
anim00023d38(anim->animnum);
sp83 = anim00023ab0(anim->animnum, anim->frameb);
anim00023d0c();
anim00024050(spa4, anim->flip, skel, anim->animnum, sp83, &sp74, &sp88, &sp68);
animLoadHeader(anim->animnum);
frameslot = animLoadFrame(anim->animnum, anim->frameb);
animForgetFrameBirths();
animGetRotTranslateScale(animpart, anim->flip, skel, anim->animnum, frameslot, &rot1, &translate, &scale1);
rwdata->unk24.x = sp88.x * sp64;
rwdata->unk24.y = sp88.y * sp64;
rwdata->unk24.z = sp88.z * sp64;
rwdata->unk24.x = translate.x * sp64;
rwdata->unk24.y = translate.y * sp64;
rwdata->unk24.z = translate.z * sp64;
rwdata->unk20 = rwdata->yrot;
rwdata->unk01 = 1;
}
} else {
sp84 = anim00024b64(spa4, anim->flip, skel, anim->animnum, anim->frameb, &sp88, anim->average);
sp84 = animGetTranslateAngle(animpart, anim->flip, skel, anim->animnum, anim->frameb, &translate, anim->average);
scale = model->scale * anim->animscale;
if (scale != 1) {
sp88.x *= scale;
sp88.y *= scale;
sp88.z *= scale;
translate.x *= scale;
translate.y *= scale;
translate.z *= scale;
}
if (anim->average) {
sp88.y = rwdata->pos.y - rwdata->ground;
translate.y = rwdata->pos.y - rwdata->ground;
}
sp98 = cosf(rwdata->yrot);
@ -1876,9 +1876,9 @@ void modelSetAnimation2(struct model *model, s16 animnum, s32 flip, f32 fstartfr
rwdata->unk30 = rwdata->yrot;
sp58.x = rwdata->unk34.f[0] + sp88.f[0] * sp98 + sp88.f[2] * sp94;
sp58.y = sp88.f[1];
sp58.z = rwdata->unk34.f[2] - sp88.f[0] * sp94 + sp88.f[2] * sp98;
sp58.x = rwdata->unk34.f[0] + translate.f[0] * sp98 + translate.f[2] * sp94;
sp58.y = translate.f[1];
sp58.z = rwdata->unk34.f[2] - translate.f[0] * sp94 + translate.f[2] * sp98;
rwdata->unk24.x = sp58.f[0];
rwdata->unk24.y = sp58.f[1];
@ -1894,9 +1894,9 @@ void modelSetAnimation2(struct model *model, s16 animnum, s32 flip, f32 fstartfr
rwdata->unk01 = 1;
} else {
x = sp88.f[0] * sp98 + sp88.f[2] * sp94;
y = sp88.f[1];
z = -sp88.f[0] * sp94 + sp88.f[2] * sp98;
x = translate.f[0] * sp98 + translate.f[2] * sp94;
y = translate.f[1];
z = -translate.f[0] * sp94 + translate.f[2] * sp98;
sp4c.f[0] = rwdata->pos.f[0] + x * (1 - anim->frac);
sp4c.f[1] = y;
@ -2168,13 +2168,13 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
struct modelrwdata_chrinfo *rwdata = modelGetNodeRwData(model, rootnode);
if (rwdata->unk00 == 0) {
s32 sp118 = rodata->unk00;
s32 animpart = rodata->animpart;
struct skeleton *skel = model->definition->skel;
f32 scale = model->scale * anim->animscale;
f32 sine;
f32 cosine;
struct coord spfc = {0, 0, 0};
u8 s0;
struct coord translate = {0, 0, 0};
u8 frameslot;
f32 f20;
s32 floorcur;
s32 floorend;
@ -2188,8 +2188,8 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
f32 absspeed2;
f32 f22;
s32 s0frame;
struct coord spa8;
struct coord sp9c;
struct coord rot1;
struct coord scale1;
struct coord sp90;
u32 stack;
@ -2245,14 +2245,14 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
spe0.y = spd0.y;
spe0.z = spd0.z;
} else {
anim00023d38(anim->animnum);
s0 = anim00023ab0(anim->animnum, s0frame);
anim00023d0c();
anim00024050(sp118, anim->flip, skel, anim->animnum, s0, &spa8, &spfc, &sp9c);
animLoadHeader(anim->animnum);
frameslot = animLoadFrame(anim->animnum, s0frame);
animForgetFrameBirths();
animGetRotTranslateScale(animpart, anim->flip, skel, anim->animnum, frameslot, &rot1, &translate, &scale1);
spe0.x = spfc.x * f20;
spe0.y = spfc.y * f20;
spe0.z = spfc.z * f20;
spe0.x = translate.x * f20;
spe0.y = translate.y * f20;
spe0.z = translate.z * f20;
}
floorcur = floorend;
@ -2266,17 +2266,17 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
s0frame = modelConstrainOrWrapAnimFrame(floorcur, anim->animnum, anim->endframe);
anim->frameb = s0frame;
anim00023d38(anim->animnum);
s0 = anim00023ab0(anim->animnum, s0frame);
animLoadHeader(anim->animnum);
frameslot = animLoadFrame(anim->animnum, s0frame);
anim00023d0c();
anim00024050(sp118, anim->flip, skel, anim->animnum, s0, &spa8, &spfc, &sp9c);
animForgetFrameBirths();
animGetRotTranslateScale(animpart, anim->flip, skel, anim->animnum, frameslot, &rot1, &translate, &scale1);
spc8 = true;
spd0.x = spfc.x * f20;
spd0.y = spfc.y * f20;
spd0.z = spfc.z * f20;
spd0.x = translate.x * f20;
spd0.y = translate.y * f20;
spd0.z = translate.z * f20;
}
} else {
while (true) {
@ -2303,17 +2303,17 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
f30 = spcc;
}
} else {
f22 = anim00024b64(sp118, anim->flip, skel, anim->animnum, s0frame, &spfc, anim->average);
f22 = animGetTranslateAngle(animpart, anim->flip, skel, anim->animnum, s0frame, &translate, anim->average);
if (scale != 1.0f) {
spfc.x *= scale;
spfc.y *= scale;
spfc.z *= scale;
translate.x *= scale;
translate.y *= scale;
translate.z *= scale;
}
if (!forwards) {
spfc.x = -spfc.x;
spfc.z = -spfc.z;
translate.x = -translate.x;
translate.z = -translate.z;
if (f22 > 0.0f) {
f22 = M_BADTAU - f22;
@ -2321,15 +2321,15 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
}
if (anim->average) {
spfc.y = rwdata->pos.y - rwdata->ground;
translate.y = rwdata->pos.y - rwdata->ground;
}
cosine = cosf(rwdata->yrot);
sine = sinf(rwdata->yrot);
spe0.x += spfc.x * cosine + spfc.z * sine;
spe0.y = spfc.y;
spe0.z += (-spfc.x * sine) + (spfc.z * cosine);
spe0.x += translate.x * cosine + translate.z * sine;
spe0.y = translate.y;
spe0.z += (-translate.x * sine) + (translate.z * cosine);
if (rwdata->unk18 == 0.0f) {
f30 += f22;
@ -2350,19 +2350,19 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
anim->frameb = s0frame;
if (anim->frameb != anim->framea) {
f22 = anim00024b64(sp118, anim->flip, skel, anim->animnum, s0frame, &spfc, anim->average);
f22 = animGetTranslateAngle(animpart, anim->flip, skel, anim->animnum, s0frame, &translate, anim->average);
spc8 = true;
if (scale != 1.0f) {
spfc.x *= scale;
spfc.y *= scale;
spfc.z *= scale;
translate.x *= scale;
translate.y *= scale;
translate.z *= scale;
}
if (!forwards) {
spfc.x = -spfc.x;
spfc.z = -spfc.z;
translate.x = -translate.x;
translate.z = -translate.z;
if (f22 > 0.0f) {
f22 = M_BADTAU - f22;
@ -2370,15 +2370,15 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
}
if (anim->average) {
spfc.y = rwdata->unk34.y;
translate.y = rwdata->unk34.y;
}
cosine = cosf(rwdata->unk30);
sine = sinf(rwdata->unk30);
if (g_ModelAnimMergingEnabled && anim->animnum2) {
spd0.x = spfc.x * cosine + spfc.f[2] * sine;
spd0.z = -spfc.x * sine + spfc.f[2] * cosine;
spd0.x = translate.x * cosine + translate.f[2] * sine;
spd0.z = -translate.x * sine + translate.f[2] * cosine;
if (absspeed > 0.0f) {
f32 f0 = anim->fracmerge - anim->playspeed / (absspeed * anim->timemerge);
@ -2402,11 +2402,11 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
spd0.x += spe0.x;
spd0.z += spe0.z;
spd0.y = spfc.y;
spd0.y = translate.y;
} else {
spd0.x = spe0.x + spfc.x * cosine + spfc.f[2] * sine;
spd0.y = spfc.y;
spd0.z = spe0.z - spfc.x * sine + spfc.f[2] * cosine;
spd0.x = spe0.x + translate.x * cosine + translate.f[2] * sine;
spd0.y = translate.y;
spd0.z = spe0.z - translate.x * sine + translate.f[2] * cosine;
}
if (rwdata->unk5c > 0.0f && absspeed > 0.0f) {
@ -2479,17 +2479,17 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
s0frame = modelConstrainOrWrapAnimFrame(floorend2 + 1, anim->animnum2, anim->endframe2);
anim->frame2b = s0frame;
anim00024b64(sp118, anim->flip2, skel, anim->animnum2, s0frame, &spfc, anim->average);
animGetTranslateAngle(animpart, anim->flip2, skel, anim->animnum2, s0frame, &translate, anim->average);
if (scale != 1.0f) {
spfc.y *= scale;
translate.y *= scale;
}
if (anim->average) {
spfc.y = rwdata->unk4c.y;
translate.y = rwdata->unk4c.y;
}
rwdata->unk40.y = spfc.y;
rwdata->unk40.y = translate.y;
rwdata->unk02 = 1;
}
@ -3359,7 +3359,7 @@ void modelRenderNodeChrGunfire(struct modelrenderdata *renderdata, struct model
struct coord spe0;
f32 spdc;
f32 spd8;
f32 spd4;
f32 rot2;
f32 spd0;
f32 spcc;
f32 spc8;
@ -3411,7 +3411,7 @@ void modelRenderNodeChrGunfire(struct modelrenderdata *renderdata, struct model
spdc = cosf(spf0);
spd8 = sinf(spf0);
spd4 = cosf(spec);
rot2 = cosf(spec);
spd0 = sinf(spec);
scale = 0.75f + (random() % 128) * (1.0f / 256.0f); // 0.75 to 1.25
@ -3424,8 +3424,8 @@ void modelRenderNodeChrGunfire(struct modelrenderdata *renderdata, struct model
spc8 = sp9c.f[2] * spd8 * 0.5f;
spc4 = sp9c.f[1] * spd0 * 0.5f;
spc0 = sp9c.f[0] * spd4 * spd8 * 0.5f;
spbc = sp9c.f[2] * spd4 * spdc * 0.5f;
spc0 = sp9c.f[0] * rot2 * spd8 * 0.5f;
spbc = sp9c.f[2] * rot2 * spdc * 0.5f;
negspcc = -spcc;
negspc8 = -spc8;

View File

@ -163,14 +163,14 @@ glabel model00018680
nop
or $t0, $sp, $zero
addi $t1, $zero, 0x0
lui $t4, %hi(var8005f010)
addiu $t4, $t4, %lo(var8005f010)
lui $t4, %hi(g_AnimToHeaderSlot)
addiu $t4, $t4, %lo(g_AnimToHeaderSlot)
lw $t4, 0x0($t4)
lh $t5, 0x0($a2)
add $t4, $t4, $t5
lbu $t3, 0x0($t4)
lui $t4, %hi(var8009a888)
addiu $t4, $t4, %lo(var8009a888)
lui $t4, %hi(g_AnimHeaderBytes)
addiu $t4, $t4, %lo(g_AnimHeaderBytes)
lw $t4, 0x0($t4)
sll $t3, $t3, 0x2
add $t4, $t4, $t3
@ -185,8 +185,8 @@ glabel model00018680
lh $t5, 0x8($t4)
lbu $t4, 0xa($t4)
add $t3, $t2, $t5
lui $t5, %hi(var8009a874)
addiu $t5, $t5, %lo(var8009a874)
lui $t5, %hi(g_AnimFrameBytes)
addiu $t5, $t5, %lo(g_AnimFrameBytes)
lw $t5, 0x0($t5)
beq $t2, $t3, .L00018874
addi $v0, $zero, 0x0
@ -216,14 +216,14 @@ glabel model00018680
mul.s $f0, $f0, $f2
addi $t1, $zero, 0x0
trunc.w.s $f0, $f0
lui $t4, %hi(var8005f010)
addiu $t4, $t4, %lo(var8005f010)
lui $t4, %hi(g_AnimToHeaderSlot)
addiu $t4, $t4, %lo(g_AnimToHeaderSlot)
lw $t4, 0x0($t4)
lh $t5, 0x0($a2)
add $t4, $t4, $t5
lbu $t3, 0x0($t4)
lui $t4, %hi(var8009a888)
addiu $t4, $t4, %lo(var8009a888)
lui $t4, %hi(g_AnimHeaderBytes)
addiu $t4, $t4, %lo(g_AnimHeaderBytes)
lw $t4, 0x0($t4)
sll $t3, $t3, 0x2
add $t4, $t4, $t3
@ -238,8 +238,8 @@ glabel model00018680
lh $t5, 0x8($t4)
lbu $t4, 0xa($t4)
add $t3, $t2, $t5
lui $t5, %hi(var8009a874)
addiu $t5, $t5, %lo(var8009a874)
lui $t5, %hi(g_AnimFrameBytes)
addiu $t5, $t5, %lo(g_AnimFrameBytes)
lw $t5, 0x0($t5)
beq $t2, $t3, .L00018874
addi $v0, $zero, 0x0
@ -258,14 +258,14 @@ glabel model00018680
or $t0, $sp, $zero
addiu $t0, $t0, 0x3c0
addi $t1, $zero, 0x0
lui $t4, %hi(var8005f010)
addiu $t4, $t4, %lo(var8005f010)
lui $t4, %hi(g_AnimToHeaderSlot)
addiu $t4, $t4, %lo(g_AnimToHeaderSlot)
lw $t4, 0x0($t4)
lh $t5, 0x2($a2)
add $t4, $t4, $t5
lbu $t3, 0x0($t4)
lui $t4, %hi(var8009a888)
addiu $t4, $t4, %lo(var8009a888)
lui $t4, %hi(g_AnimHeaderBytes)
addiu $t4, $t4, %lo(g_AnimHeaderBytes)
lw $t4, 0x0($t4)
sll $t3, $t3, 0x2
add $t4, $t4, $t3
@ -280,8 +280,8 @@ glabel model00018680
lh $t5, 0x8($t4)
lbu $t4, 0xa($t4)
add $t3, $t2, $t5
lui $t5, %hi(var8009a874)
addiu $t5, $t5, %lo(var8009a874)
lui $t5, %hi(g_AnimFrameBytes)
addiu $t5, $t5, %lo(g_AnimFrameBytes)
lw $t5, 0x0($t5)
beq $t2, $t3, .L000189cc
addi $v0, $zero, 0x0
@ -303,14 +303,14 @@ glabel model00018680
mul.s $f0, $f0, $f2
addi $t1, $zero, 0x0
trunc.w.s $f0, $f0
lui $t4, %hi(var8005f010)
addiu $t4, $t4, %lo(var8005f010)
lui $t4, %hi(g_AnimToHeaderSlot)
addiu $t4, $t4, %lo(g_AnimToHeaderSlot)
lw $t4, 0x0($t4)
lh $t5, 0x2($a2)
add $t4, $t4, $t5
lbu $t3, 0x0($t4)
lui $t4, %hi(var8009a888)
addiu $t4, $t4, %lo(var8009a888)
lui $t4, %hi(g_AnimHeaderBytes)
addiu $t4, $t4, %lo(g_AnimHeaderBytes)
lw $t4, 0x0($t4)
sll $t3, $t3, 0x2
add $t4, $t4, $t3
@ -325,8 +325,8 @@ glabel model00018680
lh $t5, 0x8($t4)
lbu $t4, 0xa($t4)
add $t3, $t2, $t5
lui $t5, %hi(var8009a874)
addiu $t5, $t5, %lo(var8009a874)
lui $t5, %hi(g_AnimFrameBytes)
addiu $t5, $t5, %lo(g_AnimFrameBytes)
lw $t5, 0x0($t5)
beq $t2, $t3, .L000189cc
addi $v0, $zero, 0x0