Compare commits

...

2 Commits

Author SHA1 Message Date
Blake Warner c005911242 fixed 60fps collision issues #252 #310 #311 2022-05-15 09:56:24 -04:00
Blake Warner 6892cff704 fix 60fps elec spires in jabu 2022-05-15 08:03:53 -04:00
6 changed files with 40 additions and 47 deletions

View File

@ -93,9 +93,9 @@ enum BgFlag
BG_STATE_4 = 1 << 4, // 0x00000010
BG_STATE_5 = 1 << 5, // 0x00000020
BG_STATE_6 = 1 << 6, // 0x00000040
BG_STATE_7 = 1 << 7, // 0x00000080
BG_STATE_AT_OR_BELOW_GROUND = 1 << 7, // 0x00000080
BG_STATE_8 = 1 << 8, // 0x00000100
BG_STATE_9 = 1 << 9, // 0x00000200
BG_STATE_COLLIDED_OBJECT = 1 << 9, // 0x00000200
BG_STATE_10 = 1 << 10, // 0x00000400
BG_STATE_11 = 1 << 11, // 0x00000800
BG_STATE_12 = 1 << 12, // 0x00001000

View File

@ -1413,7 +1413,7 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3)
arg2->y += 50.0f;
actor->floorHeight = BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &floorBgId, actor, arg2);
actor->bgCheckFlags &= ~(BG_STATE_1 | BG_STATE_2 | BG_STATE_7);
actor->bgCheckFlags &= ~(BG_STATE_1 | BG_STATE_2 | BG_STATE_AT_OR_BELOW_GROUND);
if(actor->floorHeight <= BGCHECK_Y_MIN)
{
@ -1425,7 +1425,7 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3)
if(floorHeightDiff >= 0.0f)
{ // actor is on or below the ground
actor->bgCheckFlags |= BG_STATE_7;
actor->bgCheckFlags |= BG_STATE_AT_OR_BELOW_GROUND;
if(actor->bgCheckFlags & BG_STATE_4)
{

View File

@ -29,8 +29,8 @@ struct EnBa
/* 0x02FC */ Vec3f unk2FC;
/* 0x0308 */ Vec3f unk308;
/* 0x0314 */ f32 unk314;
/* 0x0318 */ s16 unk318;
/* 0x031A */ s16 unk31A;
/* 0x0318 */ TimerS16 unk318;
/* 0x031A */ TimerS16 unk31A;
/* 0x031C */ s16 unk31C;
/* 0x0320 */ ColliderJntSph collider;
/* 0x0340 */ ColliderJntSphElement colliderItems[2];

View File

@ -195,7 +195,7 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx)
pthis->unk_14C--;
for(i = 0; i < 4; i++)
{
if(!((pthis->unk_14C + (i << 1)) % 4))
if(!((pthis->unk_14C.whole() + (i << 1)) % 4))
{
Vec3f pos;
s16 yaw;

View File

@ -9,8 +9,8 @@ struct EnBx;
struct EnBx
{
/* 0x0000 */ Actor actor;
/* 0x014C */ s16 unk_14C;
/* 0x014E */ s16 unk_14E;
/* 0x014C */ TimerS16 unk_14C;
/* 0x014E */ TimerS16 unk_14E;
/* 0x0150 */ char unk_150[0x4];
/* 0x0154 */ Vec3f unk_154[4];
/* 0x0184 */ Vec3f unk_184[4];

View File

@ -2758,7 +2758,7 @@ void func_808355DC(Player* pthis)
{
pthis->stateFlags1 |= PLAYER_STATE1_17;
if(!(pthis->skelAnime.moveFlags & 0x80) && (pthis->actor.bgCheckFlags & BG_STATE_9) && (D_80853608 < 0x2000))
if(!(pthis->skelAnime.moveFlags & 0x80) && (pthis->actor.bgCheckFlags & BG_STATE_COLLIDED_OBJECT) && (D_80853608 < 0x2000))
{
pthis->currentYaw = pthis->actor.shape.rot.y = pthis->actor.wallYaw + 0x8000;
}
@ -4806,14 +4806,14 @@ s32 func_80839034(GlobalContext* globalCtx, Player* pthis, CollisionPoly* poly,
return 0;
}
void func_808395DC(Player* pthis, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3)
void func_808395DC(Player* pthis, Vec3f* pos, Vec3f* len, Vec3f* result)
{
f32 cos = Math_CosS(pthis->actor.shape.rot.y);
f32 sin = Math_SinS(pthis->actor.shape.rot.y);
arg3->x = arg1->x + ((arg2->x * cos) + (arg2->z * sin));
arg3->y = arg1->y + arg2->y;
arg3->z = arg1->z + ((arg2->z * cos) - (arg2->x * sin));
result->x = pos->x + ((len->x * cos) + (len->z * sin));
result->y = pos->y + len->y;
result->z = pos->z + ((len->z * cos) - (len->x * sin));
}
Actor* Player_SpawnFairy(GlobalContext* globalCtx, Player* pthis, Vec3f* arg2, Vec3f* arg3, s32 type)
@ -4840,18 +4840,18 @@ f32 func_8083973C(GlobalContext* globalCtx, Player* pthis, Vec3f* arg2, Vec3f* a
return func_808396F4(globalCtx, pthis, arg2, arg3, &sp24, &sp20);
}
s32 func_80839768(GlobalContext* globalCtx, Player* pthis, Vec3f* arg2, CollisionPoly** arg3, s32* arg4, Vec3f* arg5)
s32 func_80839768(GlobalContext* globalCtx, Player* pthis, Vec3f* len, CollisionPoly** arg3, s32* arg4, Vec3f* arg5)
{
Vec3f sp44;
Vec3f sp38;
Vec3f posA;
Vec3f posB;
sp44.x = pthis->actor.world.pos.x;
sp44.y = pthis->actor.world.pos.y + arg2->y;
sp44.z = pthis->actor.world.pos.z;
posA.x = pthis->actor.world.pos.x;
posA.y = pthis->actor.world.pos.y + len->y;
posA.z = pthis->actor.world.pos.z;
func_808395DC(pthis, &pthis->actor.world.pos, arg2, &sp38);
func_808395DC(pthis, &pthis->actor.world.pos, len, &posB);
return BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp44, &sp38, arg5, arg3, true, false, false, true, arg4);
return BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, arg5, arg3, true, false, false, true, arg4);
}
s32 func_80839800(Player* pthis, GlobalContext* globalCtx)
@ -7377,7 +7377,7 @@ s32 func_8083F360(GlobalContext* globalCtx, Player* pthis, f32 arg1, f32 arg2, f
{
wallPoly = pthis->actor.wallPoly;
pthis->actor.bgCheckFlags |= BG_STATE_9;
pthis->actor.bgCheckFlags |= BG_STATE_COLLIDED_OBJECT;
pthis->actor.wallBgId = sp78;
D_808535F0 = func_80041DB8(&globalCtx->colCtx, wallPoly, sp78);
@ -7394,7 +7394,7 @@ s32 func_8083F360(GlobalContext* globalCtx, Player* pthis, f32 arg1, f32 arg2, f
return 1;
}
pthis->actor.bgCheckFlags &= ~BG_STATE_9;
pthis->actor.bgCheckFlags &= ~BG_STATE_COLLIDED_OBJECT;
return 0;
}
@ -7462,7 +7462,7 @@ s32 func_8083F7BC(Player* pthis, GlobalContext* globalCtx)
{
DynaPolyActor* wallPolyActor;
if(!(pthis->stateFlags1 & PLAYER_STATE1_11) && (pthis->actor.bgCheckFlags & BG_STATE_9) && (D_80853608 < 0x3000))
if(!(pthis->stateFlags1 & PLAYER_STATE1_11) && (pthis->actor.bgCheckFlags & BG_STATE_COLLIDED_OBJECT) && (D_80853608 < 0x3000))
{
if(((pthis->linearVelocity > 0.0f) && func_8083EC18(pthis, globalCtx, D_808535F0)) || func_8083F0C8(pthis, globalCtx, D_808535F0))
{
@ -7513,7 +7513,7 @@ s32 func_8083F7BC(Player* pthis, GlobalContext* globalCtx)
s32 func_8083F9D0(GlobalContext* globalCtx, Player* pthis)
{
if((pthis->actor.bgCheckFlags & BG_STATE_9) && ((pthis->stateFlags2 & PLAYER_STATE2_4_JYA_COBRA_TURNING) || CHECK_BTN_ALL(sControlInput->cur.button, BTN_A)))
if((pthis->actor.bgCheckFlags & BG_STATE_COLLIDED_OBJECT) && ((pthis->stateFlags2 & PLAYER_STATE2_4_JYA_COBRA_TURNING) || CHECK_BTN_ALL(sControlInput->cur.button, BTN_A)))
{
DynaPolyActor* wallPolyActor = NULL;
@ -7564,7 +7564,7 @@ void func_8083FB7C(Player* pthis, GlobalContext* globalCtx)
s32 func_8083FBC0(Player* pthis, GlobalContext* globalCtx)
{
if(!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && (pthis->actor.bgCheckFlags & BG_STATE_9) && ((D_808535F0 & 8) || (D_808535F0 & 2) || func_80041E4C(&globalCtx->colCtx, pthis->actor.wallPoly, pthis->actor.wallBgId)))
if(!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && (pthis->actor.bgCheckFlags & BG_STATE_COLLIDED_OBJECT) && ((D_808535F0 & 8) || (D_808535F0 & 2) || func_80041E4C(&globalCtx->colCtx, pthis->actor.wallPoly, pthis->actor.wallBgId)))
{
return 0;
}
@ -9572,7 +9572,7 @@ void Player_UpdateFunc_ZView_Backflip(Player* pthis, GlobalContext* globalCtx)
func_80843E14(pthis, NA_SE_VO_LI_FALL_L);
}
if((pthis->actor.bgCheckFlags & BG_STATE_9) && !(pthis->stateFlags2 & PLAYER_STATE2_19) && !(pthis->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE_SWIMMING)) && (pthis->linearVelocity > 0.0f))
if((pthis->actor.bgCheckFlags & BG_STATE_COLLIDED_OBJECT) && !(pthis->stateFlags2 & PLAYER_STATE2_19) && !(pthis->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE_SWIMMING)) && (pthis->linearVelocity > 0.0f))
{
if((pthis->wallHeight >= 150.0f) && (pthis->unk_84B[pthis->unk_846] == 0))
{
@ -9699,7 +9699,7 @@ void Player_UpdateWhenRolling(Player* pthis, GlobalContext* globalCtx)
{
if(pthis->linearVelocity >= 7.0f)
{
if(((pthis->actor.bgCheckFlags & BG_STATE_9) && (D_8085360C < 0x2000)) ||
if(((pthis->actor.bgCheckFlags & BG_STATE_COLLIDED_OBJECT) && (D_8085360C < 0x2000)) ||
((pthis->cylinder.base.ocFlags1 & OC1_HIT) && (cylinderOc = pthis->cylinder.base.oc, ((cylinderOc->id == ACTOR_EN_WOOD02) && (ABS((s16)(pthis->actor.world.rot.y - cylinderOc->yawTowardsPlayer)) > 0x6000)))))
{
if(cylinderOc != NULL)
@ -10402,7 +10402,7 @@ void Player_UpdateFunc_80846050(Player* pthis, GlobalContext* globalCtx)
pthis->heldActor = interactRangeActor;
pthis->actor.child = interactRangeActor;
interactRangeActor->parent = &pthis->actor;
interactRangeActor->bgCheckFlags &= (BG_STATE_8 | BG_STATE_9 | BG_STATE_10 | BG_STATE_11 | BG_STATE_12 | BG_STATE_13 | BG_STATE_14 | BG_STATE_15);
interactRangeActor->bgCheckFlags &= (BG_STATE_8 | BG_STATE_COLLIDED_OBJECT | BG_STATE_10 | BG_STATE_11 | BG_STATE_12 | BG_STATE_13 | BG_STATE_14 | BG_STATE_15);
pthis->unk_3BC.y = interactRangeActor->shape.rot.y - pthis->actor.shape.rot.y;
}
return;
@ -11219,25 +11219,18 @@ void func_80847BA0(GlobalContext* globalCtx, Player* pthis)
D_80853604 = pthis->unk_A7A;
const float heightAdjust = (pthis->actor.velocity.y * 1.5) - (pthis->actor.velocity.y * FRAMERATE_ANIM_SCALER);
if(pthis->stateFlags2 & PLAYER_STATE2_CRAWL)
{
if(TICK_RATE > 20)
{
wallCheckRadius = 10.0f * 0.5f; // TODO FIX HACK
wallCheckHeight = 15.0f * 0.5f;
ceilingCheckHeight = 30.0f * 0.5f;
}
else
{
wallCheckRadius = 10.0f;
wallCheckHeight = 15.0f;
ceilingCheckHeight = 30.0f;
}
wallCheckRadius = 10.0f + heightAdjust;
wallCheckHeight = 15.0f + heightAdjust;
ceilingCheckHeight = 30.0f + heightAdjust;
}
else
{
wallCheckRadius = pthis->ageProperties->unk_38;
wallCheckHeight = 26.0f;
wallCheckHeight = 26.0f + heightAdjust;
ceilingCheckHeight = pthis->ageProperties->unk_00;
}
@ -11254,7 +11247,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* pthis)
}
else if(!(pthis->stateFlags1 & PLAYER_STATE1_0) && ((Player_UpdateFunc_80845EF8 == pthis->playerUpdateFunct) || (Player_UpdateFunc_80845CA4 == pthis->playerUpdateFunct)))
{
pthis->actor.bgCheckFlags &= ~(BG_STATE_3 | BG_STATE_9);
pthis->actor.bgCheckFlags &= ~(BG_STATE_3 | BG_STATE_COLLIDED_OBJECT);
flags = 0x3C;
}
else
@ -11349,7 +11342,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* pthis)
func_80839034(globalCtx, pthis, spC0, pthis->actor.floorBgId);
pthis->actor.bgCheckFlags &= ~BG_STATE_9;
pthis->actor.bgCheckFlags &= ~BG_STATE_COLLIDED_OBJECT;
if(pthis->actor.bgCheckFlags & BG_STATE_3)
{
@ -11363,7 +11356,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* pthis)
if(!(pthis->stateFlags2 & PLAYER_STATE2_CRAWL) && func_80839768(globalCtx, pthis, &D_80854798, &spA0, &sp9C, &D_80858AA8))
{
pthis->actor.bgCheckFlags |= BG_STATE_9;
pthis->actor.bgCheckFlags |= BG_STATE_COLLIDED_OBJECT;
if(pthis->actor.wallPoly != spA0)
{
pthis->actor.wallPoly = spA0;
@ -11397,7 +11390,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* pthis)
}
}
if((pthis->actor.bgCheckFlags & BG_STATE_9) && (D_80853608 < 0x3000))
if((pthis->actor.bgCheckFlags & BG_STATE_COLLIDED_OBJECT) && (D_80853608 < 0x3000))
{
CollisionPoly* wallPoly = pthis->actor.wallPoly;