Skip to content

Commit

Permalink
Renamed XNASlopes physics option to MBUSlopes and added MBGSlopes option
Browse files Browse the repository at this point in the history
  • Loading branch information
HumanGamer committed Mar 25, 2024
1 parent b1cdeec commit d070011
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
7 changes: 5 additions & 2 deletions engine/source/game/marble/marble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2274,8 +2274,11 @@ ConsoleMethod(Marble, setPhysics, void, 3, 3, "(physics)")
physicsStrings[Marble::XNA] = "XNA";
physicsFlags[Marble::XNA] = Marble::XNA;

physicsStrings[Marble::XNASlopes] = "XNASlopes";
physicsFlags[Marble::XNASlopes] = Marble::XNASlopes;
physicsStrings[Marble::MBUSlopes] = "MBUSlopes";
physicsFlags[Marble::MBUSlopes] = Marble::MBUSlopes;

physicsStrings[Marble::MBGSlopes] = "MBGSlopes";
physicsFlags[Marble::MBGSlopes] = Marble::MBGSlopes;

S32 i = 0;
while (dStricmp(physicsStrings[i], physics))
Expand Down
3 changes: 2 additions & 1 deletion engine/source/game/marble/marble.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class Marble : public ShapeBase
MBU,
MBG,
XNA,
XNASlopes,
MBUSlopes,
MBGSlopes,
MBPhysics_Count
};

Expand Down
10 changes: 5 additions & 5 deletions engine/source/game/marble/marblecollision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,19 +592,19 @@ void Marble::findContacts(U32 contactMask, const Point3D* inPos, const F32* inRa

if (PlaneD(vertPlane + vertex, vertex, vertex + plane).distToPlane(contactVert) >= 0.0) {
if (PlaneD(lastVertex - vertPlane, lastVertex, lastVertex + plane).distToPlane(contactVert) >= 0.0) {
if (mPhysics == MBG)
if (mPhysics == MBG || mPhysics == MBGSlopes)
finalContact = vertPlane.project(contactVert);
else
contactVert = vertPlane.project(contactVert);
break;
}
if (mPhysics == MBG)
if (mPhysics == MBG || mPhysics == MBGSlopes)
finalContact = lastVertex;
else
contactVert = lastVertex;
}
else {
if (mPhysics == MBG)
if (mPhysics == MBG || mPhysics == MBGSlopes)
finalContact = vertex;
else
contactVert = vertex;
Expand All @@ -628,7 +628,7 @@ void Marble::findContacts(U32 contactMask, const Point3D* inPos, const F32* inRa

U32 materialId = poly->material;
Point3D delta;
if (mPhysics == MBG)
if (mPhysics == MBG || mPhysics == MBGSlopes)
delta = *pos - finalContact;
else
delta = *pos - contactVert;
Expand All @@ -655,7 +655,7 @@ void Marble::findContacts(U32 contactMask, const Point3D* inPos, const F32* inRa

contact.restitution = restitution;
contact.normal = normal;
if (mPhysics == MBG)
if (mPhysics == MBG || mPhysics == MBGSlopes)
contact.position = finalContact;
else
contact.position = contactVert;
Expand Down
6 changes: 3 additions & 3 deletions engine/source/game/marble/marblephysics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void Marble::applyContactForces(const Move* move, bool isCentered, Point3D& aCon
}
}

if (mPhysics != XNASlopes)
if (mPhysics != MBUSlopes && mPhysics != MBGSlopes)
{
for (S32 i = 0; i < mContacts.size(); i++)
{
Expand Down Expand Up @@ -265,7 +265,7 @@ bool Marble::computeMoveForces(Point3D& aControl, Point3D& desiredOmega, const M
Point2F currentVelocity(mDot(sideDir, rollVelocity), mDot(motionDir, rollVelocity));

Point2F mv(move->x, move->y);
if (mPhysics != MBG)
if (mPhysics != MBG && mPhysics != MBGSlopes)
{
// Prevent increasing marble speed with diagonal movement (on the ground)
mv *= 1.538461565971375;
Expand Down Expand Up @@ -677,7 +677,7 @@ void Marble::advancePhysics(const Move* move, U32 timeDelta)
}

it++;
} while (mPhysics == MBG || it <= 10);
} while (mPhysics == MBG || mPhysics == MBGSlopes || it <= 10);

for (S32 i = 0; i < smPathItrVec.size(); i++)
smPathItrVec[i]->popTickState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name = $Text::LevelNameMP26;
difficulty = "4";
gameType = "MultiPlayer";
gameMode = "Scrum";
physics = "XNASlopes";
physics = "MBUSlopes";
time = "300000";
maxGemsPerGroup = "9";
desc = "A preview mission";
Expand Down

0 comments on commit d070011

Please sign in to comment.