Skip to content

Commit 49ad146

Browse files
committed
Merge branch 'development' into lerp-improvements
2 parents 0b67c78 + c0ad45b commit 49ad146

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+254
-941
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
<details><summary><b>Added</b></summary>
1010

11+
- New `MovableObject` INI and Lua property `PostEffectEnabled` (R/W), which determines whether or not the screen effect of an MO is enabled. Defaults to `true` for `MOPixels` and `MOSParticles`, `false` for everything else (to avoid backwards compatibility issues).
12+
1113
- `Lerp` can now be used on Vectors and Matrices/Rotations, not just numbers.
1214

1315
</details>
@@ -20,6 +22,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2022

2123
- Improvements to AI navigation in automovers, so they get stuck less often.
2224

25+
- Screen effects (glows) can now show on *any* `MovableObject` they're attached to; you may need to set `EffectAlwaysShows = 1` to see them on `MOSRotatings`. Try `InheritEffectRotAngle = 1` on one of them!
26+
2327
- `LERP` Lua binding has been deprecated, and renamed to `Lerp`.
2428

2529
</details>
@@ -50,6 +54,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5054

5155
</details>
5256

57+
<details><summary><b>Removed</b></summary>
58+
59+
- Removed `Settings.ini` property `SimplifiedCollisionDetection = 0/1`. With the physics detection overhaul in pre-5, this became unnecessary.
60+
61+
</details>
62+
5363
## [Release v6.1.0] - 2024/02/15
5464

5565
<details><summary><b>Added</b></summary>

Source/Entities/ACrab.cpp

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -567,56 +567,6 @@ BITMAP* ACrab::GetGraphicalIcon() const {
567567
return m_GraphicalIcon ? m_GraphicalIcon : (m_pTurret ? m_pTurret->GetSpriteFrame(0) : GetSpriteFrame(0));
568568
}
569569

570-
bool ACrab::CollideAtPoint(HitData& hd) {
571-
return Actor::CollideAtPoint(hd);
572-
573-
/*
574-
hd.ResImpulse[HITOR].Reset();
575-
hd.ResImpulse[HITEE].Reset();
576-
hd.HitRadius[HITEE] = (hd.HitPoint - m_Pos) * c_MPP;
577-
hd.mass[HITEE] = m_Mass;
578-
hd.MomInertia[HITEE] = m_pAtomGroup->GetMomentOfInertia();
579-
hd.HitVel[HITEE] = m_Vel + hd.HitRadius[HITEE].GetPerpendicular() * m_AngularVel;
580-
hd.VelDiff = hd.HitVel[HITOR] - hd.HitVel[HITEE];
581-
Vector hitAcc = -hd.VelDiff * (1 + hd.Body[HITOR]->GetMaterial().restitution * GetMaterial().restitution);
582-
583-
float hittorLever = hd.HitRadius[HITOR].GetPerpendicular().Dot(hd.BitmapNormal);
584-
float hitteeLever = hd.HitRadius[HITEE].GetPerpendicular().Dot(hd.BitmapNormal);
585-
hittorLever *= hittorLever;
586-
hitteeLever *= hitteeLever;
587-
float impulse = hitAcc.Dot(hd.BitmapNormal) / (((1 / hd.mass[HITOR]) + (1 / hd.mass[HITEE])) +
588-
(hittorLever / hd.MomInertia[HITOR]) + (hitteeLever / hd.MomInertia[HITEE]));
589-
590-
hd.ResImpulse[HITOR] = hd.BitmapNormal * impulse * hd.ImpulseFactor[HITOR];
591-
hd.ResImpulse[HITEE] = hd.BitmapNormal * -impulse * hd.ImpulseFactor[HITEE];
592-
593-
////////////////////////////////////////////////////////////////////////////////
594-
// If a particle, which does not penetrate, but bounces, do any additional
595-
// effects of that bounce.
596-
if (!ParticlePenetration())
597-
// TODO: Add blunt trauma effects here!")
598-
;
599-
}
600-
601-
m_Vel += hd.ResImpulse[HITEE] / hd.mass[HITEE];
602-
m_AngularVel += hd.HitRadius[HITEE].GetPerpendicular().Dot(hd.ResImpulse[HITEE]) /
603-
hd.MomInertia[HITEE];
604-
*/
605-
}
606-
607-
/*
608-
bool ACrab::OnBounce(const Vector &pos)
609-
{
610-
return false;
611-
}
612-
613-
614-
bool ACrab::OnSink(const Vector &pos)
615-
{
616-
return false;
617-
}
618-
*/
619-
620570
bool ACrab::HandlePieCommand(PieSliceType pieSliceIndex) {
621571
if (pieSliceIndex != PieSliceType::NoType) {
622572
if (pieSliceIndex == PieSliceType::Reload) {
@@ -1423,29 +1373,6 @@ void ACrab::DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos, int whichScr
14231373
if (!m_HUDVisible) {
14241374
return;
14251375
}
1426-
/*
1427-
// TODO: REMOVE< THIS IS TEMP
1428-
// Draw the AI paths
1429-
list<Vector>::iterator last = m_MovePath.begin();
1430-
Vector waypoint, lastPoint, lineVec;
1431-
for (list<Vector>::iterator lItr = m_MovePath.begin(); lItr != m_MovePath.end(); ++lItr)
1432-
{
1433-
lastPoint = (*last) - targetPos;
1434-
waypoint = lastPoint + g_SceneMan.ShortestDistance(lastPoint, (*lItr) - targetPos);
1435-
line(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, waypoint.m_X, waypoint.m_Y, g_RedColor);
1436-
last = lItr;
1437-
}
1438-
waypoint = m_MoveTarget - targetPos;
1439-
circlefill(pTargetBitmap, waypoint.m_X, waypoint.m_Y, 3, g_RedColor);
1440-
lastPoint = m_PrevPathTarget - targetPos;
1441-
circlefill(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, 2, g_YellowGlowColor);
1442-
lastPoint = m_DigTunnelEndPos - targetPos;
1443-
circlefill(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, 2, g_YellowGlowColor);
1444-
// Raidus
1445-
// waypoint = m_Pos - targetPos;
1446-
// circle(pTargetBitmap, waypoint.m_X, waypoint.m_Y, m_MoveProximityLimit, g_RedColor);
1447-
// TODO: REMOVE THIS IS TEMP
1448-
*/
14491376

14501377
// Player AI drawing
14511378

@@ -1554,63 +1481,6 @@ void ACrab::DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos, int whichScr
15541481
}
15551482
m_HUDStack -= 9;
15561483
}
1557-
1558-
// Print aim angle and rot angle stoff
1559-
/*{
1560-
std::snprintf(str, sizeof(str), "Aim %.2f Rot %.2f Lim %.2f", m_AimAngle, GetRotAngle(), m_AimRange + GetRotAngle());
1561-
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X - 0, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Centre);
1562-
1563-
m_HUDStack += -10;
1564-
}*/
1565-
1566-
/*
1567-
// AI Mode select GUI HUD
1568-
if (m_Controller.IsState(AI_MODE_SET))
1569-
{
1570-
int iconOff = m_apAIIcons[0]->w + 2;
1571-
int iconColor = m_Team == Activity::TeamOne ? AIICON_RED : AIICON_GREEN;
1572-
Vector iconPos = GetCPUPos() - targetPos;
1573-
1574-
if (m_AIMode == AIMODE_SENTRY)
1575-
{
1576-
std::snprintf(str, sizeof(str), "%s", "Sentry");
1577-
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X, iconPos.m_Y - 18, str, GUIFont::Centre);
1578-
}
1579-
else if (m_AIMode == AIMODE_PATROL)
1580-
{
1581-
std::snprintf(str, sizeof(str), "%s", "Patrol");
1582-
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X - 9, iconPos.m_Y - 5, str, GUIFont::Right);
1583-
}
1584-
else if (m_AIMode == AIMODE_BRAINHUNT)
1585-
{
1586-
std::snprintf(str, sizeof(str), "%s", "Brainhunt");
1587-
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X + 9, iconPos.m_Y - 5, str, GUIFont::Left);
1588-
}
1589-
else if (m_AIMode == AIMODE_GOLDDIG)
1590-
{
1591-
std::snprintf(str, sizeof(str), "%s", "Gold Dig");
1592-
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X, iconPos.m_Y + 8, str, GUIFont::Centre);
1593-
}
1594-
1595-
// Draw the mode alternatives if they are not the current one
1596-
if (m_AIMode != AIMODE_SENTRY)
1597-
{
1598-
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_SENTRY], iconPos.m_X - 6, iconPos.m_Y - 6 - iconOff);
1599-
}
1600-
if (m_AIMode != AIMODE_PATROL)
1601-
{
1602-
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_PATROL], iconPos.m_X - 6 - iconOff, iconPos.m_Y - 6);
1603-
}
1604-
if (m_AIMode != AIMODE_BRAINHUNT)
1605-
{
1606-
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_BRAINHUNT], iconPos.m_X - 6 + iconOff, iconPos.m_Y - 6);
1607-
}
1608-
if (m_AIMode != AIMODE_GOLDDIG)
1609-
{
1610-
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_GOLDDIG], iconPos.m_X - 6, iconPos.m_Y - 6 + iconOff);
1611-
}
1612-
}
1613-
*/
16141484
}
16151485
}
16161486

Source/Entities/ACrab.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,6 @@ namespace RTE {
125125
/// @param newLeg The new Leg to use.
126126
void SetRightBGLeg(Leg* newLeg);
127127

128-
/// Calculates the collision response when another MO's Atom collides with
129-
/// this MO's physical representation. The effects will be applied
130-
/// directly to this MO, and also represented in the passed in HitData.
131-
/// @param hitData Reference to the HitData struct which describes the collision. This
132-
/// will be modified to represent the results of the collision.
133-
/// @return Whether the collision has been deemed valid. If false, then disregard
134-
/// any impulses in the Hitdata.
135-
bool CollideAtPoint(HitData& hitData) override;
136-
137128
/// Tries to handle the activated PieSlice in this object's PieMenu, if there is one, based on its SliceType.
138129
/// @param pieSliceType The SliceType of the PieSlice being handled.
139130
/// @return Whether or not the activated PieSlice SliceType was able to be handled.

Source/Entities/ACraft.cpp

Lines changed: 17 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -752,8 +752,9 @@ void ACraft::DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos, int whichSc
752752
m_HUDStack = -m_CharHeight / 2;
753753

754754
// Only do HUD if on a team
755-
if (m_Team < 0)
755+
if (m_Team < 0) {
756756
return;
757+
}
757758

758759
// Only draw if the team viewing this is on the same team OR has seen the space where this is located.
759760
int viewingTeam = g_ActivityMan.GetActivity()->GetTeamOfPlayer(g_ActivityMan.GetActivity()->PlayerOfScreen(whichScreen));
@@ -771,93 +772,39 @@ void ACraft::DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos, int whichSc
771772
GUIFont* pSmallFont = g_FrameMan.GetSmallFont();
772773

773774
// Draw hud guides for the Exits, depending on whether the doors are open
774-
if (m_HatchState == OPEN) // || m_HatchState == OPENING)
775-
{
775+
if (m_HatchState == OPEN /* || m_HatchState == OPENING*/) {
776776
// Doors open and inventory not empty yet, so show arrows pointing out of the exits since things are still coming out
777777
if (!IsInventoryEmpty()) {
778778
// --------
779779
// | \ \
780-
// -+- | |
780+
// -+- | |
781781
// | / /
782782
// --------
783783
// Make the dotted lines crawl out of the exit, indicating that things are still coming out
784-
if (--m_ExitLinePhase < 0)
784+
if (--m_ExitLinePhase < 0) {
785785
m_ExitLinePhase = EXITLINESPACING - 1;
786+
}
786787
}
787788
// Inventory empty and doors open, so show arrows pointing into the exits IF the delay to allow for things to eject away all the way has passed
788789
else if (m_ExitTimer.IsPastSimMS(EXITSUCKDELAYMS)) {
789790
// Make the dotted lines crawl back into the exit, inviting people to jump in
790-
if (++m_ExitLinePhase >= EXITLINESPACING)
791+
if (++m_ExitLinePhase >= EXITLINESPACING) {
791792
m_ExitLinePhase = 0;
793+
}
792794
}
793795

794-
Vector exitRadius;
795-
Vector exitCorner;
796-
Vector arrowVec;
797796
// Draw the actual dotted lines
798797
for (std::list<Exit>::iterator exit = m_Exits.begin(); exit != m_Exits.end(); ++exit) {
799-
if (exit->CheckIfClear(m_Pos, m_Rotation, 18)) {
800-
exitRadius = RotateOffset(exit->GetVelocity().GetPerpendicular().SetMagnitude(exit->GetRadius()));
801-
exitCorner = m_Pos - targetPos + RotateOffset(exit->GetOffset()) + exitRadius;
802-
arrowVec = RotateOffset(exit->GetVelocity().SetMagnitude(exit->GetRange()));
803-
g_FrameMan.DrawLine(pTargetBitmap, exitCorner, exitCorner + arrowVec, 120, 120, EXITLINESPACING, m_ExitLinePhase);
804-
exitCorner -= exitRadius * 2;
805-
g_FrameMan.DrawLine(pTargetBitmap, exitCorner, exitCorner + arrowVec, 120, 120, EXITLINESPACING, m_ExitLinePhase);
798+
if (!exit->CheckIfClear(m_Pos, m_Rotation, 18)) {
799+
continue;
806800
}
807-
}
808-
}
809801

810-
// Only show extra HUD if this guy is controlled by a player
811-
if (m_Controller.IsPlayerControlled() && pSmallFont && pSymbolFont) {
812-
AllegroBitmap pBitmapInt(pTargetBitmap);
813-
/*
814-
// AI Mode select GUI HUD
815-
if (m_Controller && m_Controller.IsState(PIE_MENU_ACTIVE))
816-
{
817-
char str[64];
818-
int iconOff = m_apAIIcons[0]->w + 2;
819-
int iconColor = m_Team == Activity::TeamOne ? AIICON_RED : AIICON_GREEN;
820-
Vector iconPos = GetCPUPos() - targetPos;
821-
822-
if (m_AIMode == AIMODE_RETURN)
823-
{
824-
std::snprintf(str, sizeof(str), "%s", "Return");
825-
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X, iconPos.m_Y - 18, str, GUIFont::Centre);
826-
}
827-
else if (m_AIMode == AIMODE_DELIVER)
828-
{
829-
std::snprintf(str, sizeof(str), "%s", "Deliver");
830-
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X - 9, iconPos.m_Y - 5, str, GUIFont::Right);
831-
}
832-
else if (m_AIMode == AIMODE_SCUTTLE)
833-
{
834-
std::snprintf(str, sizeof(str), "%s", "Scuttle");
835-
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X + 9, iconPos.m_Y - 5, str, GUIFont::Left);
836-
}
837-
else if (m_AIMode == AIMODE_STAY)
838-
{
839-
std::snprintf(str, sizeof(str), "%s", "Stay");
840-
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X, iconPos.m_Y + 8, str, GUIFont::Centre);
841-
}
842-
843-
// Draw the mode alternatives if they are not the current one
844-
if (m_AIMode != AIMODE_RETURN)
845-
{
846-
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_RETURN], iconPos.m_X - 6, iconPos.m_Y - 6 - iconOff);
847-
}
848-
if (m_AIMode != AIMODE_DELIVER)
849-
{
850-
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_DELIVER], iconPos.m_X - 6 - iconOff, iconPos.m_Y - 6);
851-
}
852-
if (m_AIMode != AIMODE_SCUTTLE)
853-
{
854-
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_SCUTTLE], iconPos.m_X - 6 + iconOff, iconPos.m_Y - 6);
855-
}
856-
if (m_AIMode != AIMODE_STAY)
857-
{
858-
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_STAY], iconPos.m_X - 6, iconPos.m_Y - 6 + iconOff);
859-
}
860-
}
861-
*/
802+
Vector exitRadius = RotateOffset(exit->GetVelocity().GetPerpendicular().SetMagnitude(exit->GetRadius()));
803+
Vector exitCorner = m_Pos - targetPos + RotateOffset(exit->GetOffset()) + exitRadius;
804+
Vector arrowVec = RotateOffset(exit->GetVelocity().SetMagnitude(exit->GetRange()));
805+
g_FrameMan.DrawLine(pTargetBitmap, exitCorner, exitCorner + arrowVec, 120, 120, EXITLINESPACING, m_ExitLinePhase);
806+
exitCorner -= exitRadius * 2;
807+
g_FrameMan.DrawLine(pTargetBitmap, exitCorner, exitCorner + arrowVec, 120, 120, EXITLINESPACING, m_ExitLinePhase);
808+
}
862809
}
863810
}

0 commit comments

Comments
 (0)