Disabled scaling and hangling under water, fixed vertices for swimming clonk

Please note that the dive animation is putting the clonk to low compared to its center this should be fixed by one of the OC modelers.
stable-5.4
Maikel de Vries 2013-10-06 14:55:48 +02:00
parent fbdd4f7d6b
commit 9e8dd57dbb
2 changed files with 37 additions and 14 deletions

View File

@ -889,13 +889,29 @@ func StartSwim()
if(!InLiquid()) return;
if(!GetEffect("IntSwim", this))
AddEffect("IntSwim", this, 1, 1, this);
SetVertex(1,VTX_Y,-4,2);
return SetSwimmingVertices(true);
}
func StopSwim()
{
if(GetAction() != "Swim") RemoveEffect("IntSwim", this);
SetVertex(1,VTX_Y,-7,2);
return SetSwimmingVertices(false);
}
func SetSwimmingVertices(bool is_swimming)
{
var vtx_list = [[0,2,0], [0,-7,4], [0,9,11], [-2,-3,1], [2,-3,2], [-4,2,1], [4,2,2], [-2,6,1], [2,6,2]];
if (is_swimming)
vtx_list = [[0,3,0], [0,-2,4], [0,7,11], [-4,0,1], [4,0,2], [-5,3,1], [5,3,2], [-4,4,1], [4,4,2]];
for (var i = 0; i < GetVertexNum(); i++)
{
SetVertex(i, VTX_X, vtx_list[i][0], 2);
SetVertex(i, VTX_Y, vtx_list[i][1], 2);
SetVertex(i, VTX_CNAT, vtx_list[i][2], 2);
}
return;
}
func FxIntSwimStart(pTarget, effect, fTmp)

View File

@ -3125,7 +3125,7 @@ void C4Object::ContactAction()
break;
case DFA_SWIM:
// Try corner scale out
if (!GBackLiquid(GetX(), GetY() - 1))
if (!GBackLiquid(GetX(),GetY()-1+Def->Float*Con/FullCon-1))
if (ObjectActionCornerScale(this)) return;
break;
}
@ -3194,11 +3194,15 @@ void C4Object::ContactAction()
}
return;
case DFA_SWIM:
// Try scale
if (ComDirLike(Action.ComDir, COMD_Left))
if (ObjectActionScale(this,DIR_Left)) return;
// Try corner scale out
if (ObjectActionCornerScale(this)) return;
// Only scale if swimming at the surface
if (!GBackLiquid(GetX(),GetY()-1+Def->Float*Con/FullCon-1))
{
// Try scale, only if swimming at the surface.
if (ComDirLike(Action.ComDir, COMD_Left))
if (ObjectActionScale(this,DIR_Left)) return;
// Try corner scale out
if (ObjectActionCornerScale(this)) return;
}
return;
case DFA_HANGLE:
// Hangle: Try scale
@ -3244,12 +3248,15 @@ void C4Object::ContactAction()
}
return;
case DFA_SWIM:
// Try scale
if (ComDirLike(Action.ComDir, COMD_Right))
if (ObjectActionScale(this,DIR_Right)) return;
// Try corner scale out
if (ObjectActionCornerScale(this)) return;
// Skip to enable walk out
// Only scale if swimming at the surface
if (!GBackLiquid(GetX(),GetY()-1+Def->Float*Con/FullCon-1))
{
// Try scale
if (ComDirLike(Action.ComDir, COMD_Right))
if (ObjectActionScale(this,DIR_Right)) return;
// Try corner scale out
if (ObjectActionCornerScale(this)) return;
}
return;
case DFA_HANGLE:
// Hangle: Try scale