public CollisionPlane(CollisionObject parent, ColPlane *entry, int offset) : this(parent, parent._points[entry->_point1 - offset], parent._points[entry->_point2 - offset]) { _material = entry->_material; _flags = entry->_flags; _type = entry->Type; _flags2 = entry->Flags2; }
public ColPlane(int pInd1, int pInd2, int pLink1, int pLink2, CollisionPlaneType type, CollisionPlaneFlags2 flags2, CollisionPlaneFlags flags, CollisionPlaneMaterial material) { _point1 = (short)pInd1; _point2 = (short)pInd2; _link1 = (short)pLink1; _link2 = (short)pLink2; _magic = -1; _type = (ushort)((int)flags2 | (int)type); _flags = flags; _material = material; }
private void flipCollisionX() { // Swap location of the left node if it hasn't already been flipped if (!_linkLeft.flipped) { Vector2 newCollisionL = new Vector2(0 - _linkLeft.Value._x, _linkLeft.Value._y); //Console.WriteLine(" Old Collision L: (" + _linkLeft.Value._x + "," + _linkLeft.Value._y + ")"); //Console.WriteLine(" New Collision L: " + newCollisionL); _linkLeft.Value = newCollisionL; //Console.WriteLine(" New Collision L: (" + _linkLeft.Value._x + "," + _linkLeft.Value._y + ")"); _linkLeft.flipped = true; } // Swap location of the right node if it hasn't already been flipped if (!_linkRight.flipped) { Vector2 newCollisionR = new Vector2(0 - _linkRight.Value._x, _linkRight.Value._y); //Console.WriteLine(" Old Collision R: (" + _linkRight.Value._x + "," + _linkRight.Value._y + ")"); //Console.WriteLine(" New Collision R: " + newCollisionR); _linkRight.Value = newCollisionR; //Console.WriteLine(" New Collision R: (" + _linkRight.Value._x + "," + _linkRight.Value._y + ")"); _linkRight.flipped = true; } // Swap location of the ledges if (!(IsRightLedge && IsLeftLedge)) { if (IsRightLedge) { IsRightLedge = false; IsLeftLedge = true; } else if (IsLeftLedge) { IsRightLedge = true; IsLeftLedge = false; } } SwapLinks(); if (_type == CollisionPlaneType.RightWall) { _type = CollisionPlaneType.LeftWall; } else if (_type == CollisionPlaneType.LeftWall) { _type = CollisionPlaneType.RightWall; } }
private void flipCollisionY(bool removeFloorFlags) { // Swap location of the left node if it hasn't already been flipped if (!_linkLeft.flipped) { Vector2 newCollisionL = new Vector2(_linkLeft.Value._x, 0 - _linkLeft.Value._y); //Console.WriteLine(" Old Collision L: (" + _linkLeft.Value._x + "," + _linkLeft.Value._y + ")"); //Console.WriteLine(" New Collision L: " + newCollisionL); _linkLeft.Value = newCollisionL; //Console.WriteLine(" New Collision L: (" + _linkLeft.Value._x + "," + _linkLeft.Value._y + ")"); _linkLeft.flipped = true; } // Swap location of the right node if it hasn't already been flipped if (!_linkRight.flipped) { Vector2 newCollisionR = new Vector2(_linkRight.Value._x, 0 - _linkRight.Value._y); //Console.WriteLine(" Old Collision R: (" + _linkRight.Value._x + "," + _linkRight.Value._y + ")"); //Console.WriteLine(" New Collision R: " + newCollisionR); _linkRight.Value = newCollisionR; //Console.WriteLine(" New Collision R: (" + _linkRight.Value._x + "," + _linkRight.Value._y + ")"); _linkRight.flipped = true; } SwapLinks(); if (_type == CollisionPlaneType.Ceiling) { _type = CollisionPlaneType.Floor; } else if (_type == CollisionPlaneType.Floor) { if (removeFloorFlags) { // Unset flags that are floor-exclusive IsRightLedge = false; IsLeftLedge = false; IsFallThrough = false; } _type = CollisionPlaneType.Ceiling; } }
public CollisionPlane(CollisionObject parent, ColPlane* entry, int offset) : this(parent, parent._points[entry->_point1 - offset], parent._points[entry->_point2 - offset]) { _material = entry->_material; _flags = entry->_flags; _type = entry->Type; _flags2 = entry->Flags2; }