Decompile func0f019d0c

This commit is contained in:
Ryan Dwyer 2020-05-30 22:56:16 +10:00
parent 66a5bd9ab3
commit 97df4b0e59
7 changed files with 35 additions and 49 deletions

View File

@ -5414,8 +5414,8 @@ void func0f0cbf50(void)
g_Vars.currentplayer->vv_verta = -90;
}
g_Vars.currentplayer->vv_costheta = cosf(DEG2RAD(g_Vars.currentplayer->vv_theta));
g_Vars.currentplayer->vv_sintheta = sinf(DEG2RAD(g_Vars.currentplayer->vv_theta));
g_Vars.currentplayer->vv_costheta = cosf(BADDEG2RAD(g_Vars.currentplayer->vv_theta));
g_Vars.currentplayer->vv_sintheta = sinf(BADDEG2RAD(g_Vars.currentplayer->vv_theta));
g_Vars.currentplayer->vv_verta360 = g_Vars.currentplayer->vv_verta;
@ -5423,8 +5423,8 @@ void func0f0cbf50(void)
g_Vars.currentplayer->vv_verta360 += 360;
}
g_Vars.currentplayer->vv_cosverta = cosf(DEG2RAD(g_Vars.currentplayer->vv_verta360));
g_Vars.currentplayer->vv_sinverta = sinf(DEG2RAD(g_Vars.currentplayer->vv_verta360));
g_Vars.currentplayer->vv_cosverta = cosf(BADDEG2RAD(g_Vars.currentplayer->vv_verta360));
g_Vars.currentplayer->vv_sinverta = sinf(BADDEG2RAD(g_Vars.currentplayer->vv_verta360));
g_Vars.currentplayer->bond2.unk00.x = -g_Vars.currentplayer->vv_sintheta;
g_Vars.currentplayer->bond2.unk00.y = 0;
@ -5434,7 +5434,7 @@ void func0f0cbf50(void)
struct chrdata *chr = g_Vars.currentplayer->prop->chr;
if (chr && chr->animdata) {
func0f03e538(chr, DEG2RAD(360 - g_Vars.currentplayer->vv_theta));
func0f03e538(chr, BADDEG2RAD(360 - g_Vars.currentplayer->vv_theta));
}
}
}
@ -5512,7 +5512,7 @@ void func0f0cc3b8(f32 arg0, f32 arg1, f32 arg2, f32 *arg3, f32 arg4)
}
func0f1138a4(sp244, arg2);
func000162e8(DEG2RAD(360 - g_Vars.currentplayer->vv_verta360), sp180);
func000162e8(BADDEG2RAD(360 - g_Vars.currentplayer->vv_verta360), sp180);
if (optionsGetHeadRoll(g_Vars.currentplayerstats->mpindex)) {
func00016d58(sp116,
@ -5522,7 +5522,7 @@ void func0f0cc3b8(f32 arg0, f32 arg1, f32 arg2, f32 *arg3, f32 arg4)
func000159fc(sp116, sp180);
}
func00016374(DEG2RAD(360 - g_Vars.currentplayer->vv_theta), sp116);
func00016374(BADDEG2RAD(360 - g_Vars.currentplayer->vv_theta), sp116);
func000159fc(sp116, sp180);
if (arg3) {

View File

@ -913,7 +913,7 @@ bool chrFaceCover(struct chrdata *chr)
chr->act_stand.unk038 = 0;
chr->act_stand.face_entitytype = ENTITYTYPE_DIRECTION;
chr->act_stand.unk03c = 1;
//chr->act_stand.face_entityid = func0f096750(-cover.look->x, -cover.look->z) * (0x4000 / DEG2RAD(90));
//chr->act_stand.face_entityid = func0f096750(-cover.look->x, -cover.look->z) * (0x4000 / BADDEG2RAD(90));
chr->act_stand.face_entityid = func0f096750(-cover.look->x, -cover.look->z) * 10432.039f;
return true;
@ -1304,8 +1304,8 @@ void chrDoSurprisedOneHand(struct chrdata *chr)
struct prop *prop = chrGetTargetProp(chr);
f32 angle = chrGetAngleToPos(chr, &prop->pos);
// DEG2RAD(10) doesn't match due to float precision :(
if (angle < 0.17450514435768f || angle > DEG2RAD(350)) {
// BADDEG2RAD(10) doesn't match due to float precision :(
if (angle < 0.17450514435768f || angle > BADDEG2RAD(350)) {
chrStopFiring(chr);
chr->actiontype = ACT_SURPRISED;
chr->act_surprised.type = 1;
@ -12548,10 +12548,10 @@ bool chrTryJumpOut(struct chrdata *chr)
// This commented code is what the floats represent, but mismatches due
// to float precision:
//if (angle < DEG2RAD(45) || angle > DEG2RAD(315)
// || (angle > DEG2RAD(135) && angle < DEG2RAD(225))) {
//if (angle < BADDEG2RAD(45) || angle > BADDEG2RAD(315)
// || (angle > BADDEG2RAD(135) && angle < BADDEG2RAD(225))) {
if (angle < 0.7852731347084f || angle > 5.4969120025635f
|| (angle > 2.3558194637299f && angle < DEG2RAD(225))) {
|| (angle > 2.3558194637299f && angle < BADDEG2RAD(225))) {
bool side = (random() % 2) == 0;
if (chrCanJumpInDirection(chr, side, 200)) {

View File

@ -4340,26 +4340,10 @@ glabel var7f1a84a8
/* f019d08: 00000000 */ sll $zero,$zero,0x0
);
GLOBAL_ASM(
glabel func0f019d0c
.late_rodata
glabel var7f1a84ac
.word 0x40490fdb
glabel var7f1a84b0
.word 0x3fc90fdb
.text
/* f019d0c: 3c013f80 */ lui $at,0x3f80
/* f019d10: 44812000 */ mtc1 $at,$f4
/* f019d14: 3c017f1b */ lui $at,%hi(var7f1a84ac)
/* f019d18: c42884ac */ lwc1 $f8,%lo(var7f1a84ac)($at)
/* f019d1c: 460c2081 */ sub.s $f2,$f4,$f12
/* f019d20: 3c017f1b */ lui $at,%hi(var7f1a84b0)
/* f019d24: c43084b0 */ lwc1 $f16,%lo(var7f1a84b0)($at)
/* f019d28: 46021180 */ add.s $f6,$f2,$f2
/* f019d2c: 46083282 */ mul.s $f10,$f6,$f8
/* f019d30: 03e00008 */ jr $ra
/* f019d34: 46105001 */ sub.s $f0,$f10,$f16
);
f32 func0f019d0c(f32 arg0)
{
return ((1.0f - arg0) + (1.0f - arg0)) * M_PI - DEG2RAD(90);
}
GLOBAL_ASM(
glabel titleRenderRareLogo

View File

@ -11127,7 +11127,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_DARK_COMBAT, HEAD_VD,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta / 2),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta / 2),
// ailistFindById(GAILIST_INIT_COOP_100),
// 0);
// } else if (stageGetIndex(g_Vars.stagenum) == STAGEINDEX_MBR) {
@ -11135,7 +11135,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_MRBLONDE, HEAD_MRBLONDE,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta),
// ailistFindById(GAILIST_INIT_COOP_100),
// 0);
// } else {
@ -11143,7 +11143,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_DARK_COMBAT, HEAD_VD,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta / 2),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta / 2),
// ailistFindById(GAILIST_INIT_COOP_100),
// 0);
// }
@ -11183,7 +11183,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_MRBLONDE, HEAD_MRBLONDE,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta),
// ailistFindById(GAILIST_INIT_COOP_100),
// 0);
// } else {
@ -11191,7 +11191,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_CARRINGTON, HEAD_JAMIE,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta),
// ailistFindById(GAILIST_INIT_COOP_200),
// 0);
// }
@ -11229,7 +11229,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_MRBLONDE, HEAD_MRBLONDE,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta),
// ailistFindById(GAILIST_INIT_COOP_100),
// 0);
// } else {
@ -11237,7 +11237,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_MRBLONDE, HEAD_MARK2,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta),
// ailistFindById(GAILIST_INIT_COOP_100),
// 0);
// }
@ -11277,7 +11277,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_MRBLONDE, HEAD_MRBLONDE,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta),
// ailistFindById(GAILIST_INIT_COOP_100),
// 0);
// } else {
@ -11285,7 +11285,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_CISOLDIER, HEAD_CHRIST,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta),
// ailistFindById(GAILIST_INIT_COOP_100),
// 0);
// }
@ -11326,7 +11326,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_MRBLONDE, HEAD_MRBLONDE,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta),
// ailistFindById(GAILIST_INIT_COOP_100),
// 0);
// } else {
@ -11334,7 +11334,7 @@ glabel var7f1ad6ac
// prop = chrSpawnAtCoord(BODY_ELVIS1, HEAD_MAIAN_S,
// &g_Vars.currentplayer->prop->pos,
// g_Vars.currentplayer->prop->rooms,
// DEG2RAD(g_Vars.currentplayer->vv_theta),
// BADDEG2RAD(g_Vars.currentplayer->vv_theta),
// ailistFindById(GAILIST_INIT_COOP_100),
// 0);
// }

View File

@ -468,8 +468,8 @@ void func0f19a37c(struct chrdata *chr)
func0f04031c(&prop->pos, 16.666666f, &sp56, sp152);
} else {
// These numbers are about 2 billionths away from DEG2RAD(20),
// but tweaking the multiplier in DEG2RAD doesn't make this match
// These numbers are about 2 billionths away from BADDEG2RAD(20),
// but tweaking the multiplier in BADDEG2RAD doesn't make this match
// without creating mismatches in other places :(
sp152[0] = cosf(0.34901028871536f) * sinf(sp80);
sp152[1] = sinf(0.34901028871536f);

View File

@ -30,7 +30,7 @@ Gfx *titleRenderNintendoLogo(Gfx *gdl);
void titleInitRareLogo(void);
void titleExitRareLogo(void);
void titleTickRareLogo(void);
u32 func0f019d0c(void);
f32 func0f019d0c(f32 arg0);
Gfx *titleRenderRareLogo(Gfx *gdl);
void titleInitModeSkip(void);
void titleInitNoController(void);

View File

@ -8,7 +8,9 @@
#define M_BADTAU (M_BADPI * 2)
#define M_TAU (M_PI * 2)
#define DEG2RAD(deg) ((deg) * (M_BADPI / 180.0f))
#define RAD2DEG(rad) ((rad) * (180.0f / M_BADPI))
#define BADDEG2RAD(deg) ((deg) * (M_BADPI / 180.0f))
#define DEG2RAD(deg) ((deg) * (M_PI / 180.0f))
#define BADRAD2DEG(rad) ((rad) * (180.0f / M_BADPI))
#endif