@@ -371,7 +371,7 @@ namespace RTE {
371
371
}
372
372
#ifdef DEBUG_BUILD
373
373
// Draw the positions of the Atoms at the start of each segment, for visual debugging.
374
- putpixel (g_SceneMan.GetMOColorBitmap (), atom->GetCurrentPos ().GetIntX (), atom->GetCurrentPos ().GetIntY (), 122 );
374
+ // putpixel(g_SceneMan.GetMOColorBitmap(), atom->GetCurrentPos().GetIntX(), atom->GetCurrentPos().GetIntY(), 122);
375
375
#endif
376
376
}
377
377
@@ -752,7 +752,7 @@ namespace RTE {
752
752
753
753
HitData hitData;
754
754
755
- std::map<MOID, std::set<Atom *>>MOIgnoreMap;
755
+ std::map<MOID, std::set<Atom *>> MOIgnoreMap;
756
756
std::map<MOID, std::deque<std::pair<Atom *, Vector>>> hitMOAtoms;
757
757
std::deque<std::pair<Atom *, Vector>> hitTerrAtoms;
758
758
std::deque<std::pair<Atom *, Vector>> penetratingAtoms;
@@ -799,9 +799,6 @@ namespace RTE {
799
799
delta[X] = nextPosition.GetFloorIntX () - intPos[X];
800
800
delta[Y] = nextPosition.GetFloorIntY () - intPos[Y];
801
801
802
- hit[X] = false ;
803
- hit[Y] = false ;
804
-
805
802
if (delta[X] == 0 && delta[Y] == 0 ) {
806
803
break ;
807
804
}
@@ -848,6 +845,9 @@ namespace RTE {
848
845
if (delta[X] > 1000 ) { delta[X] = 1000 ; }
849
846
if (delta[Y] > 1000 ) { delta[Y] = 1000 ; }
850
847
848
+ hit[X] = false ;
849
+ hit[Y] = false ;
850
+
851
851
// Bresenham's line drawing algorithm execution
852
852
for (int domSteps = 0 ; domSteps < delta[dom] && !(hit[X] || hit[Y]); ++domSteps) {
853
853
if (subStepped) { ++subSteps; }
@@ -880,7 +880,7 @@ namespace RTE {
880
880
if (hitMOs) {
881
881
tempMOID = g_SceneMan.GetMOIDPixel (intPos[X] + flippedOffset.GetFloorIntX (), intPos[Y] + flippedOffset.GetFloorIntY ());
882
882
// Check the ignore map for Atoms that should ignore hits against certain MOs.
883
- if (tempMOID != g_NoMOID && (MOIgnoreMap.count (tempMOID) != 0 )) { ignoreHit = ( MOIgnoreMap.at (tempMOID).count (atom) != 0 ) ; }
883
+ if (tempMOID != g_NoMOID && (MOIgnoreMap.count (tempMOID) != 0 )) { ignoreHit = MOIgnoreMap.at (tempMOID).count (atom) != 0 ; }
884
884
}
885
885
886
886
if (hitMOs && tempMOID && !ignoreHit) {
@@ -891,7 +891,7 @@ namespace RTE {
891
891
hitMOAtoms.insert ({ tempMOID, newDeque });
892
892
} else {
893
893
// If another Atom of this group has already hit this same MO during this step, go ahead and add the new Atom to the corresponding deque for that MOID.
894
- ( hitMOAtoms.at (tempMOID) ).push_back ({ atom, flippedOffset });
894
+ hitMOAtoms.at (tempMOID).push_back ({ atom, flippedOffset });
895
895
}
896
896
// Count the number of Atoms of this group that hit MOs this step. Used to properly distribute the mass of the owner MO in later collision responses during this step.
897
897
atomsHitMOsCount++;
@@ -902,7 +902,7 @@ namespace RTE {
902
902
903
903
#ifdef DEBUG_BUILD
904
904
// Draw the positions of the hit points on screen for easy debugging.
905
- putpixel (g_SceneMan.GetMOColorBitmap (), std::floor (position.m_X + flippedOffset.m_X ), std::floor (position.m_Y + flippedOffset.m_Y ), 122 );
905
+ // putpixel(g_SceneMan.GetMOColorBitmap(), std::floor(position.m_X + flippedOffset.m_X), std::floor(position.m_Y + flippedOffset.m_Y), 122);
906
906
#endif
907
907
}
908
908
@@ -977,12 +977,12 @@ namespace RTE {
977
977
// if (hitData.HitPoint.IsZero()) {
978
978
// NOTE: THis can actually be wrong since there may not in fact be a corner pixel, but two pixels hit on X and Y directions
979
979
hitData.HitPoint = (sub == X) ? Vector (static_cast <float >(hitPos[X]), static_cast <float >(intPos[Y])) : Vector (static_cast <float >(intPos[X]), static_cast <float >(hitPos[Y]));
980
- /*
981
- // We hit pixels in both sub and dom directions on the other MO, a corner hit.
982
- } else {
983
- hitData.HitPoint.SetXY(hitPos[X], hitPos[Y]);
984
- }
985
- */
980
+ /*
981
+ // We hit pixels in both sub and dom directions on the other MO, a corner hit.
982
+ } else {
983
+ hitData.HitPoint.SetXY(hitPos[X], hitPos[Y]);
984
+ }
985
+ */
986
986
hitData.BitmapNormal [sub] = static_cast <float >(-increment[sub]);
987
987
}
988
988
@@ -1014,7 +1014,7 @@ namespace RTE {
1014
1014
}
1015
1015
}
1016
1016
}
1017
- // If any MO's were hit, continue on to the next leg without doing terrain stuff now.
1017
+ // If any MOs were hit, continue on to the next leg without doing terrain stuff now.
1018
1018
// Any terrain collisions will be taken care of on the next leg, when the effects of these MO hits have been applied.
1019
1019
hitTerrAtoms.clear ();
1020
1020
}
@@ -1030,14 +1030,14 @@ namespace RTE {
1030
1030
1031
1031
massDist = mass / static_cast <float >(hitTerrAtoms.size () * (m_Resolution ? m_Resolution : 1 ));
1032
1032
1033
- for (std::deque<std::pair<Atom *, Vector>>::iterator aoItr = hitTerrAtoms.begin (); aoItr != hitTerrAtoms.end (); ) {
1034
- if (g_SceneMan.WillPenetrate (intPos[X] + (*aoItr ).second .GetFloorIntX (), intPos[Y] + (*aoItr ).second .GetFloorIntY (), forceVel, massDist)) {
1035
- // Move the penetrating Atom to the pen. list from the coll. list.
1036
- penetratingAtoms.push_back ({ (*aoItr ).first , (*aoItr ).second });
1037
- aoItr = hitTerrAtoms.erase (aoItr );
1033
+ for (std::deque<std::pair<Atom *, Vector>>::iterator atomItr = hitTerrAtoms.begin (); atomItr != hitTerrAtoms.end (); ) {
1034
+ if (g_SceneMan.WillPenetrate (intPos[X] + (*atomItr ).second .GetFloorIntX (), intPos[Y] + (*atomItr ).second .GetFloorIntY (), forceVel, massDist)) {
1035
+ // Move the penetrating Atom to the penetrating list from the collision list.
1036
+ penetratingAtoms.push_back ({ (*atomItr ).first , (*atomItr ).second });
1037
+ atomItr = hitTerrAtoms.erase (atomItr );
1038
1038
somethingPenetrated = true ;
1039
1039
} else {
1040
- ++aoItr ;
1040
+ ++atomItr ;
1041
1041
}
1042
1042
}
1043
1043
} while (!hitTerrAtoms.empty () && somethingPenetrated);
@@ -1054,7 +1054,7 @@ namespace RTE {
1054
1054
didWrap = !g_SceneMan.WrapPosition (intPos[X], intPos[Y]) && didWrap;
1055
1055
1056
1056
// Call the call-on-bounce function, if requested.
1057
- // if (m_OwnerMO && callOnBounce) { halted = m_OwnerMO->OnBounce(position); }
1057
+ // if (m_OwnerMO && callOnBounce) { halted = m_OwnerMO->OnBounce(position); }
1058
1058
1059
1059
// Calculate the distributed mass that each bouncing Atom has.
1060
1060
massDist = mass / static_cast <float >((hitTerrAtoms.size ()/* + atomsHitMOsCount*/ ) * (m_Resolution ? m_Resolution : 1 ));
@@ -1523,9 +1523,9 @@ namespace RTE {
1523
1523
1524
1524
for (const Atom *atom : m_Atoms) {
1525
1525
if (!useLimbPos) {
1526
- atomPos = (m_OwnerMO->GetPos () + (atom->GetOffset ().GetXFlipped (m_OwnerMO->m_HFlipped ))).GetFloored ();
1526
+ atomPos = (m_OwnerMO->GetPos () + (atom->GetOffset ().GetXFlipped (m_OwnerMO->m_HFlipped ) * m_OwnerMO-> GetRotMatrix () )).GetFloored ();
1527
1527
} else {
1528
- atomPos = (m_LimbPos + (atom->GetOffset ().GetXFlipped (m_OwnerMO->m_HFlipped ))).GetFloored ();
1528
+ atomPos = (m_LimbPos + (atom->GetOffset ().GetXFlipped (m_OwnerMO->m_HFlipped ) * m_OwnerMO-> GetRotMatrix () )).GetFloored ();
1529
1529
}
1530
1530
// Draw normal first, then draw the Atom position
1531
1531
if (!atom->GetNormal ().IsZero ()) {
0 commit comments