mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 06:13:45 -07:00
improves terrain detection for drops into liquid
This commit is contained in:
parent
d236b9df45
commit
f3c1707485
2 changed files with 46 additions and 20 deletions
|
@ -863,6 +863,7 @@ void accessible_stick_warning(AccessibleActor* actor) {
|
||||||
ActorAccessibility_InitPolicy(&policy, "Torch", accessible_torches, 0);
|
ActorAccessibility_InitPolicy(&policy, "Torch", accessible_torches, 0);
|
||||||
policy.n = 1;
|
policy.n = 1;
|
||||||
policy.pitch = 1.1;
|
policy.pitch = 1.1;
|
||||||
|
policy.distance = 800;
|
||||||
ActorAccessibility_AddSupportedActor(ACTOR_OBJ_SYOKUDAI, policy);
|
ActorAccessibility_AddSupportedActor(ACTOR_OBJ_SYOKUDAI, policy);
|
||||||
ActorAccessibility_InitPolicy(&policy, "Deku Tree Moving Platform", accessible_hasi, 0);
|
ActorAccessibility_InitPolicy(&policy, "Deku Tree Moving Platform", accessible_hasi, 0);
|
||||||
//policy.volume = 1.3;
|
//policy.volume = 1.3;
|
||||||
|
|
|
@ -170,18 +170,36 @@ class Decline : protected TerrainCueSound {
|
||||||
|
|
||||||
};
|
};
|
||||||
class Ledge :protected TerrainCueSound {
|
class Ledge :protected TerrainCueSound {
|
||||||
bool climbable;//Distinguishes between a ledge link can fall from and one he can climb up.
|
s8 savedType;//Distinguishes between a ledge link can fall from and one he can climb up.
|
||||||
Vec3s probeRot;
|
Vec3s probeRot;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Ledge(AccessibleActor* actor, Vec3f pos, Vec3s probeRot, bool above = false) : TerrainCueSound(actor, pos) {
|
Ledge(AccessibleActor* actor, Vec3f pos, Vec3s probeRot, s8 type = 0) : TerrainCueSound(actor, pos) {
|
||||||
if (above)
|
if (type == 1)
|
||||||
currentPitch = 2.0;
|
currentPitch = 2.0;
|
||||||
climbable = above;
|
savedType = type;
|
||||||
currentSFX = climbable ? NA_SE_EV_WOOD_BOUND : NA_SE_EV_WIND_TRAP;
|
switch (type) {
|
||||||
shouldLoop = !climbable;
|
case 0:
|
||||||
|
currentSFX = NA_SE_EV_WIND_TRAP;
|
||||||
|
shouldLoop = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
currentSFX = NA_SE_EV_WOOD_BOUND;
|
||||||
|
shouldLoop = 0;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
currentSFX = NA_SE_PL_LAND_WATER0;
|
||||||
|
shouldLoop = 0;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
currentSFX = NA_SE_SY_WARNING_COUNT_N;
|
||||||
|
shouldLoop = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
this->probeRot = probeRot;
|
this->probeRot = probeRot;
|
||||||
if (!above) {
|
if (type == 0) {
|
||||||
if (probeRot.y == 0)
|
if (probeRot.y == 0)
|
||||||
currentPitch = 0.4;
|
currentPitch = 0.4;
|
||||||
else if (probeRot.y < 0)
|
else if (probeRot.y < 0)
|
||||||
|
@ -196,12 +214,12 @@ class Ledge :protected TerrainCueSound {
|
||||||
virtual ~Ledge() {
|
virtual ~Ledge() {
|
||||||
|
|
||||||
}
|
}
|
||||||
bool isClimbable() {
|
s8 type() {
|
||||||
return climbable;
|
return savedType;
|
||||||
|
|
||||||
}
|
}
|
||||||
void run() {
|
void run() {
|
||||||
if (!climbable)
|
if (savedType==0)
|
||||||
return;//Downward ledges play a looping sound and do not need ongoing maintenance.
|
return;//Downward ledges play a looping sound and do not need ongoing maintenance.
|
||||||
if (restFrames == 0)
|
if (restFrames == 0)
|
||||||
{
|
{
|
||||||
|
@ -453,13 +471,13 @@ class Lava : protected TerrainCueSound {
|
||||||
}
|
}
|
||||||
// Play a sound from the position of a previously discovered ledge.
|
// Play a sound from the position of a previously discovered ledge.
|
||||||
|
|
||||||
void discoverLedge(Vec3f pos, bool upper = false) {
|
void discoverLedge(Vec3f pos, s8 type = 0) {
|
||||||
if (terrainDiscovered == DISCOVERED_LEDGE && ledge.isClimbable() == upper)
|
if (terrainDiscovered == DISCOVERED_LEDGE && ledge.type() == type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
destroyCurrentSound();
|
destroyCurrentSound();
|
||||||
|
|
||||||
new (&ledge) Ledge(actor, pos, relRot, upper);
|
new (&ledge) Ledge(actor, pos, relRot, type);
|
||||||
currentSound = (TerrainCueSound*)&ledge;
|
currentSound = (TerrainCueSound*)&ledge;
|
||||||
terrainDiscovered = DISCOVERED_LEDGE;
|
terrainDiscovered = DISCOVERED_LEDGE;
|
||||||
}
|
}
|
||||||
|
@ -1185,23 +1203,30 @@ class Lava : protected TerrainCueSound {
|
||||||
player->stateFlags1 != PLAYER_STATE1_CLIMBING_LADDER) {
|
player->stateFlags1 != PLAYER_STATE1_CLIMBING_LADDER) {
|
||||||
// This is a fall.
|
// This is a fall.
|
||||||
|
|
||||||
discoverLedge(pos);
|
bool foundLiquid = false;
|
||||||
if (((pos.y - player->actor.prevPos.y) < player->actor.yDistToWater-30) &&
|
if (((pos.y - player->actor.prevPos.y) < player->actor.yDistToWater-30) &&
|
||||||
(player->actor.yDistToWater < 0)) {
|
(player->actor.yDistToWater < 0)) {
|
||||||
discoverWater(pos);
|
discoverLedge(pos, 2);
|
||||||
|
foundLiquid = true;
|
||||||
}
|
}
|
||||||
if (rdist(pos) < 100.0) {
|
else if (rdist(pos) < 100.0) {
|
||||||
s8 i = 5;
|
s8 i = 50;
|
||||||
|
Vec3f_ oldPos = pos;
|
||||||
while (i > 0) {
|
while (i > 0) {
|
||||||
move();
|
move();
|
||||||
if (checkForLava(pos)) {
|
if (checkForLava(pos)) {
|
||||||
discoverLava(pos);
|
discoverLedge(pos, 3);
|
||||||
|
foundLiquid = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i += 1;
|
i -= 1;
|
||||||
}
|
}
|
||||||
|
pos = oldPos;
|
||||||
}
|
}
|
||||||
|
if (!foundLiquid) {
|
||||||
|
discoverLedge(pos);
|
||||||
|
}
|
||||||
|
|
||||||
testForPlatform();
|
testForPlatform();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue