Invert the functionality of CNAT_CollideHalfVehicle

shapetextures
Julius Michaelis 2015-10-21 22:15:33 +02:00
parent 5b9f4bf4d0
commit f356c9053a
5 changed files with 10 additions and 10 deletions

View File

@ -8,7 +8,7 @@ Offset=-4,-10
Vertices=9
VertexX= 0, 0, 0, -2, 2, -4, 4, -2, 2
VertexY= 2, -7, 9, -3, -3, 2, 2, 6, 6
VertexCNAT= 0, 4, 11, 1, 2, 1, 2, 1, 2
VertexCNAT= 128,132, 11,129,130,129,130,129,130
VertexFriction=300,300,100,300,300,300,300,300,300
Value=25
Mass=50

View File

@ -36,7 +36,7 @@ global func HasCNAT(int cnat)
return false;
}
// e.g. clonk->SetVertexCNAT(2, CNAT_CollideHalfVehicle, true); makes the clonk behave correctly wrt. to HalfVehicle
// e.g. clonk->SetVertexCNAT(k, CNAT_CollideHalfVehicle, true); for k != 2 makes the clonk behave correctly wrt. to HalfVehicle
global func SetVertexCNAT(int vtx, int val, bool set)
{
if (val == nil || set == nil)
@ -67,9 +67,9 @@ global func FxIntHalfVehicleFadeJumpStart(object target, proplist effect, int te
}
effect.collideverts = CreateArray();
for (var i = target->GetVertexNum(); i-->0;)
if(target->GetVertex(i, VTX_CNAT) & CNAT_CollideHalfVehicle) {
if(!(target->GetVertex(i, VTX_CNAT) & CNAT_PhaseHalfVehicle)) {
PushBack(effect.collideverts, i);
target->SetVertexCNAT(i, CNAT_CollideHalfVehicle, false);
target->SetVertexCNAT(i, CNAT_PhaseHalfVehicle, true);
}
effect.origpos = target->GetPosition();
return FX_OK;
@ -92,5 +92,5 @@ global func FxIntHalfVehicleFadeJumpStop(object target, proplist effect, int rea
if (reason == FX_Call_RemoveClear)
return;
for (var i = GetLength(effect.collideverts); i-->0;)
target->SetVertexCNAT(effect.collideverts[i], CNAT_CollideHalfVehicle, true);
target->SetVertexCNAT(effect.collideverts[i], CNAT_PhaseHalfVehicle, false);
}

View File

@ -130,9 +130,9 @@ const BYTE // Directional
// Additional flags
CNAT_MultiAttach = 32, // new attachment behaviour; see C4Shape::Attach
CNAT_NoCollision = 64, // turn off collision for this vertex
CNAT_CollideHalfVehicle = 128;
CNAT_PhaseHalfVehicle = 128;
const BYTE CNAT_Flags = CNAT_MultiAttach | CNAT_NoCollision | CNAT_CollideHalfVehicle; // all attchment flags that can be combined with regular attachment
const BYTE CNAT_Flags = CNAT_MultiAttach | CNAT_NoCollision | CNAT_PhaseHalfVehicle; // all attchment flags that can be combined with regular attachment
//=============================== Keyboard Input Controls =====================================================

View File

@ -2514,7 +2514,7 @@ C4ScriptConstDef C4ScriptObjectConstMap[]=
{ "CNAT_Center" ,C4V_Int, CNAT_Center },
{ "CNAT_MultiAttach" ,C4V_Int, CNAT_MultiAttach },
{ "CNAT_NoCollision" ,C4V_Int, CNAT_NoCollision },
{ "CNAT_CollideHalfVehicle" ,C4V_Int, CNAT_CollideHalfVehicle },
{ "CNAT_PhaseHalfVehicle" ,C4V_Int, CNAT_PhaseHalfVehicle },
// vertex data
{ "VTX_X" ,C4V_Int, VTX_X },

View File

@ -189,7 +189,7 @@ void C4Shape::GetVertexOutline(C4Rect &rRect)
inline bool C4Shape::CheckTouchableMaterial(int32_t x, int32_t y, int32_t vtx_i, int32_t ydir, const C4DensityProvider &rDensityProvider) {
return rDensityProvider.GetDensity(x,y) >= ContactDensity &&
((ydir > 0 && (CNAT_CollideHalfVehicle & VtxCNAT[vtx_i])) || !IsMCHalfVehicle(GBackPix(x,y)));
((ydir > 0 && !(CNAT_PhaseHalfVehicle & VtxCNAT[vtx_i])) || !IsMCHalfVehicle(GBackPix(x,y)));
}
// Adjust given position to one pixel before contact
@ -544,7 +544,7 @@ void C4Shape::CompileFunc(StdCompiler *pComp, const C4Shape *default_shape)
{ "CNAT_Center", CNAT_Center },
{ "CNAT_MultiAttach", CNAT_MultiAttach },
{ "CNAT_NoCollision", CNAT_NoCollision },
{ "CNAT_CollideHalfVehicle", CNAT_CollideHalfVehicle },
{ "CNAT_PhaseHalfVehicle", CNAT_PhaseHalfVehicle },
{ NULL, 0 }
};