mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-26 08:05:21 -07:00
fixes framerate drop issues with vine detection
This commit is contained in:
parent
08a4755477
commit
d75bcde79f
1 changed files with 77 additions and 69 deletions
|
@ -694,7 +694,11 @@ class Ground : protected TerrainCueSound {
|
|||
// Move a probe to its next point along a line, ensuring that it remains on the floor. Returns false if the move
|
||||
// would put the probe out of bounds. Does not take walls into account.
|
||||
bool move(s8 gravity = true) {
|
||||
Player* player = GET_PLAYER(actor->play);
|
||||
if (gravity == 2) {
|
||||
if (fabs(player->actor.world.pos.y - pos.y) > 500.0) {
|
||||
return false;
|
||||
}
|
||||
pos.y += probeSpeed;
|
||||
if (!BgCheck_PosInStaticBoundingBox(&actor->play->colCtx, &pos))
|
||||
return false; // Out of bounds.
|
||||
|
@ -803,7 +807,7 @@ class Ground : protected TerrainCueSound {
|
|||
prevPos = pos;
|
||||
setVelocity();
|
||||
f32 step = fabs(velocity.x + velocity.z);
|
||||
|
||||
distToTravel -= (step + fabs(pos.y - pos.y));
|
||||
//checks if link is in the water, needs different logic
|
||||
if (player->stateFlags1 & PLAYER_STATE1_IN_WATER) {
|
||||
pos.y = player->actor.prevPos.y;
|
||||
|
@ -916,10 +920,12 @@ class Ground : protected TerrainCueSound {
|
|||
//or if it is the forward probe, checks if the vine ends otherwise it continues
|
||||
Vec3f wallPos;
|
||||
CollisionPoly* wallPoly = checkWall(pos, prevPos, wallPos);
|
||||
|
||||
if (wallPoly != NULL) {
|
||||
if ((func_80041DB8(&actor->play->colCtx, wallPoly, BGCHECK_SCENE) != 8 &&
|
||||
|
||||
if ((moveMethod == 2) && (func_80041DB8(&actor->play->colCtx, wallPoly, BGCHECK_SCENE) != 8 &&
|
||||
func_80041DB8(&actor->play->colCtx, wallPoly, BGCHECK_SCENE) != 3)) {
|
||||
if (moveMethod == 2) {
|
||||
|
||||
if (fabs(pos.y - player->actor.world.pos.y) < 100) {
|
||||
discoverLedge(pos, false);
|
||||
|
||||
|
@ -928,9 +934,9 @@ class Ground : protected TerrainCueSound {
|
|||
destroyCurrentSound();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (checkVinePlatform(pos, ogRot, playerHeight)){
|
||||
if (moveMethod != 2 && checkVinePlatform(pos, ogRot, playerHeight)){
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
|
@ -939,6 +945,7 @@ class Ground : protected TerrainCueSound {
|
|||
//this means that either the wall poly found above is not a vine or is NULL
|
||||
//the next three secections check infront and behind the probe for wall polys
|
||||
//
|
||||
if (moveMethod != 2) {
|
||||
prevPos = pos;
|
||||
rot.y = player->actor.shape.rot.y;
|
||||
setVelocity();
|
||||
|
@ -947,7 +954,6 @@ class Ground : protected TerrainCueSound {
|
|||
move(false);
|
||||
wallPoly = checkWall(pos, prevPos, wallPos);
|
||||
i += 1;
|
||||
|
||||
}
|
||||
if (wallPoly != NULL) {
|
||||
if ((func_80041DB8(&actor->play->colCtx, wallPoly, BGCHECK_SCENE) != 8 &&
|
||||
|
@ -1010,11 +1016,13 @@ class Ground : protected TerrainCueSound {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
//this means no wall polys were found, first we check for ceilng poly
|
||||
if (moveMethod == 2) {
|
||||
rot.y = player->actor.shape.rot.y;
|
||||
rot.y += 16384;
|
||||
rot.y += 16384;
|
||||
setVelocity();
|
||||
if (!move(moveMethod)) {
|
||||
destroyCurrentSound();
|
||||
|
||||
|
@ -1043,7 +1051,7 @@ class Ground : protected TerrainCueSound {
|
|||
}*///not needed?
|
||||
|
||||
}
|
||||
if (checkPerpendicularWall(pos, ogRot)) {
|
||||
if (moveMethod != 2 && checkPerpendicularWall(pos, ogRot)) {
|
||||
discoverWall(pos);
|
||||
break;
|
||||
}
|
||||
|
@ -1058,7 +1066,7 @@ class Ground : protected TerrainCueSound {
|
|||
break; // Probe is out of bounds.
|
||||
}
|
||||
|
||||
distToTravel -= (step + fabs(pos.y - pos.y));
|
||||
|
||||
if (isPushedAway() && player->stateFlags1 != PLAYER_STATE1_CLIMBING_LADDER) {
|
||||
// Call this a wall for now.
|
||||
discoverWall(pos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue