|
3 | 3 | #include "PresetMan.h" |
4 | 4 | #include "FrameMan.h" |
5 | 5 | #include "ActivityMan.h" |
6 | | -#include "UInputMan.h" |
7 | 6 | #include "CameraMan.h" |
8 | 7 | #include "ConsoleMan.h" |
9 | 8 | #include "PrimitiveMan.h" |
|
14 | 13 | #include "TerrainObject.h" |
15 | 14 | #include "MovableObject.h" |
16 | 15 | #include "ContentFile.h" |
17 | | -#include "AHuman.h" |
18 | | -#include "ACRocket.h" |
19 | 16 | #include "MOPixel.h" |
20 | 17 | #include "Atom.h" |
21 | 18 | #include "Material.h" |
22 | 19 | #include "SoundContainer.h" |
23 | | -// Temp |
24 | | -#include "Controller.h" |
25 | 20 |
|
26 | 21 | #include "tracy/Tracy.hpp" |
27 | 22 |
|
@@ -133,7 +128,6 @@ int SceneMan::LoadScene(Scene* pNewScene, bool placeObjects, bool placeUnits) { |
133 | 128 | g_ConsoleMan.PrintString("SYSTEM: Scene \"" + m_pCurrentScene->GetPresetName() + "\" was loaded"); |
134 | 129 |
|
135 | 130 | // Set the proper scales of the unseen obscuring SceneLayers |
136 | | - SceneLayer* pUnseenLayer = 0; |
137 | 131 | for (int team = Activity::TeamOne; team < Activity::MaxTeamCount; ++team) { |
138 | 132 | if (!g_ActivityMan.GetActivity()->TeamActive(team)) |
139 | 133 | continue; |
@@ -1046,7 +1040,7 @@ void SceneMan::RestoreUnseenBox(const int posX, const int posY, const int width, |
1046 | 1040 | } |
1047 | 1041 |
|
1048 | 1042 | bool SceneMan::CastTerrainPenetrationRay(const Vector& start, const Vector& ray, Vector& endPos, int strengthLimit, int skip) { |
1049 | | - int hitCount = 0, error, dom, sub, domSteps, skipped = skip; |
| 1043 | + int error, dom, sub, domSteps, skipped = skip; |
1050 | 1044 | int intPos[2], delta[2], delta2[2], increment[2]; |
1051 | 1045 | bool stopped = false; |
1052 | 1046 | unsigned char materialID; |
@@ -1138,7 +1132,7 @@ bool SceneMan::CastUnseenRay(int team, const Vector& start, const Vector& ray, V |
1138 | 1132 | if (!m_pCurrentScene->GetUnseenLayer(team)) |
1139 | 1133 | return false; |
1140 | 1134 |
|
1141 | | - int hitCount = 0, error, dom, sub, domSteps, skipped = skip; |
| 1135 | + int error, dom, sub, domSteps, skipped = skip; |
1142 | 1136 | int size = 40 - GetUnseenResolution(team).GetLargest(); |
1143 | 1137 | int intPos[2], delta[2], delta2[2], increment[2]; |
1144 | 1138 | bool affectedAny = false; |
@@ -1202,14 +1196,18 @@ bool SceneMan::CastUnseenRay(int team, const Vector& start, const Vector& ray, V |
1202 | 1196 | // Scene wrapping |
1203 | 1197 | WrapPosition(intPos[X], intPos[Y]); |
1204 | 1198 |
|
| 1199 | + bool is_unseen = IsUnseen(intPos[X], intPos[Y], team) || IsUnseen(intPos[X] - size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y], team) || IsUnseen(intPos[X] + size, intPos[Y], team) || IsUnseen(intPos[X], intPos[Y] - size, team) || IsUnseen(intPos[X], intPos[Y] + size, team); |
| 1200 | + |
1205 | 1201 | // Reveal if we can, save the result |
1206 | 1202 | if (reveal) { |
1207 | | - if (affectedAny = IsUnseen(intPos[X], intPos[Y], team) || IsUnseen(intPos[X] - size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y], team) || IsUnseen(intPos[X] + size, intPos[Y], team) || IsUnseen(intPos[X], intPos[Y] - size, team) || IsUnseen(intPos[X], intPos[Y] + size, team)) { |
| 1203 | + if (is_unseen) { |
1208 | 1204 | RevealUnseenBox(intPos[X] - size / 2, intPos[Y] - size / 2, size, size, team); |
| 1205 | + affectedAny = true; |
1209 | 1206 | } |
1210 | 1207 | } else { |
1211 | | - if (affectedAny = !(IsUnseen(intPos[X], intPos[Y], team) || IsUnseen(intPos[X] - size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] - size, team) || IsUnseen(intPos[X] + size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y] + size, team) || IsUnseen(intPos[X] - size, intPos[Y], team) || IsUnseen(intPos[X] + size, intPos[Y], team) || IsUnseen(intPos[X], intPos[Y] - size, team) || IsUnseen(intPos[X], intPos[Y] + size, team))) { |
| 1208 | + if (!is_unseen) { |
1212 | 1209 | RestoreUnseenBox(intPos[X] - size / 2, intPos[Y] - size / 2, size, size, team); |
| 1210 | + affectedAny = true; |
1213 | 1211 | } |
1214 | 1212 | } |
1215 | 1213 |
|
@@ -1246,7 +1244,7 @@ bool SceneMan::CastUnseeRay(int team, const Vector& start, const Vector& ray, Ve |
1246 | 1244 |
|
1247 | 1245 | bool SceneMan::CastMaterialRay(const Vector& start, const Vector& ray, unsigned char material, Vector& result, int skip, bool wrap) { |
1248 | 1246 |
|
1249 | | - int hitCount = 0, error, dom, sub, domSteps, skipped = skip; |
| 1247 | + int error, dom, sub, domSteps, skipped = skip; |
1250 | 1248 | int intPos[2], delta[2], delta2[2], increment[2]; |
1251 | 1249 | bool foundPixel = false; |
1252 | 1250 |
|
@@ -1339,7 +1337,7 @@ float SceneMan::CastMaterialRay(const Vector& start, const Vector& ray, unsigned |
1339 | 1337 | } |
1340 | 1338 |
|
1341 | 1339 | bool SceneMan::CastNotMaterialRay(const Vector& start, const Vector& ray, unsigned char material, Vector& result, int skip, bool checkMOs) { |
1342 | | - int hitCount = 0, error, dom, sub, domSteps, skipped = skip; |
| 1340 | + int error, dom, sub, domSteps, skipped = skip; |
1343 | 1341 | int intPos[2], delta[2], delta2[2], increment[2]; |
1344 | 1342 | bool foundPixel = false; |
1345 | 1343 |
|
@@ -1437,7 +1435,6 @@ float SceneMan::CastStrengthSumRay(const Vector& start, const Vector& end, int s |
1437 | 1435 |
|
1438 | 1436 | int error, dom, sub, domSteps, skipped = skip; |
1439 | 1437 | int intPos[2], delta[2], delta2[2], increment[2]; |
1440 | | - bool foundPixel = false; |
1441 | 1438 | unsigned char materialID; |
1442 | 1439 | Material foundMaterial; |
1443 | 1440 |
|
@@ -1522,7 +1519,6 @@ const Material* SceneMan::CastMaxStrengthRayMaterial(const Vector& start, const |
1522 | 1519 |
|
1523 | 1520 | int error, dom, sub, domSteps, skipped = skip; |
1524 | 1521 | int intPos[2], delta[2], delta2[2], increment[2]; |
1525 | | - bool foundPixel = false; |
1526 | 1522 |
|
1527 | 1523 | intPos[X] = std::floor(start.m_X); |
1528 | 1524 | intPos[Y] = std::floor(start.m_Y); |
@@ -1600,7 +1596,7 @@ const Material* SceneMan::CastMaxStrengthRayMaterial(const Vector& start, const |
1600 | 1596 | } |
1601 | 1597 |
|
1602 | 1598 | bool SceneMan::CastStrengthRay(const Vector& start, const Vector& ray, float strength, Vector& result, int skip, unsigned char ignoreMaterial, bool wrap) { |
1603 | | - int hitCount = 0, error, dom, sub, domSteps, skipped = skip; |
| 1599 | + int error, dom, sub, domSteps, skipped = skip; |
1604 | 1600 | int intPos[2], delta[2], delta2[2], increment[2]; |
1605 | 1601 | bool foundPixel = false; |
1606 | 1602 | unsigned char materialID; |
@@ -1693,7 +1689,7 @@ bool SceneMan::CastStrengthRay(const Vector& start, const Vector& ray, float str |
1693 | 1689 | } |
1694 | 1690 |
|
1695 | 1691 | bool SceneMan::CastWeaknessRay(const Vector& start, const Vector& ray, float strength, Vector& result, int skip, bool wrap) { |
1696 | | - int hitCount = 0, error, dom, sub, domSteps, skipped = skip; |
| 1692 | + int error, dom, sub, domSteps, skipped = skip; |
1697 | 1693 | int intPos[2], delta[2], delta2[2], increment[2]; |
1698 | 1694 | bool foundPixel = false; |
1699 | 1695 | unsigned char materialID; |
@@ -1783,7 +1779,7 @@ bool SceneMan::CastWeaknessRay(const Vector& start, const Vector& ray, float str |
1783 | 1779 | } |
1784 | 1780 |
|
1785 | 1781 | MOID SceneMan::CastMORay(const Vector& start, const Vector& ray, const std::vector<MOID>& ignoreMOIDs, int ignoreTeam, unsigned char ignoreMaterial, bool ignoreAllTerrain, int skip) { |
1786 | | - int hitCount = 0, error, dom, sub, domSteps, skipped = skip; |
| 1782 | + int error, dom, sub, domSteps, skipped = skip; |
1787 | 1783 | int intPos[2], delta[2], delta2[2], increment[2]; |
1788 | 1784 | MOID hitMOID = g_NoMOID; |
1789 | 1785 | unsigned char hitTerrain = 0; |
@@ -1884,7 +1880,7 @@ MOID SceneMan::CastMORay(const Vector& start, const Vector& ray, const std::vect |
1884 | 1880 | } |
1885 | 1881 |
|
1886 | 1882 | bool SceneMan::CastFindMORay(const Vector& start, const Vector& ray, MOID targetMOID, Vector& resultPos, unsigned char ignoreMaterial, bool ignoreAllTerrain, int skip, bool findChildMOIDs) { |
1887 | | - int hitCount = 0, error, dom, sub, domSteps, skipped = skip; |
| 1883 | + int error, dom, sub, domSteps, skipped = skip; |
1888 | 1884 | int intPos[2], delta[2], delta2[2], increment[2]; |
1889 | 1885 | MOID hitMOID = g_NoMOID; |
1890 | 1886 | unsigned char hitTerrain = 0; |
@@ -1980,7 +1976,7 @@ const std::vector<MovableObject*>* SceneMan::CastAllMOsRay(const Vector& start, |
1980 | 1976 |
|
1981 | 1977 | const SpatialPartitionGrid& partitionGrid = GetMOIDGrid(); |
1982 | 1978 |
|
1983 | | - int hitCount = 0, error, dom, sub, domSteps, skipped = skip; |
| 1979 | + int error, dom, sub, domSteps, skipped = skip; |
1984 | 1980 | int intPos[2], delta[2], delta2[2], increment[2]; |
1985 | 1981 | unsigned char hitTerrain = 0; |
1986 | 1982 |
|
@@ -2041,7 +2037,7 @@ const std::vector<MovableObject*>* SceneMan::CastAllMOsRay(const Vector& start, |
2041 | 2037 |
|
2042 | 2038 | // Detect MOs |
2043 | 2039 | std::vector<MovableObject*> hitMOs; |
2044 | | - hitMOs = std::move(partitionGrid.GetMOsAtPosition(intPos[X], intPos[Y], ignoreTeam, false)); |
| 2040 | + hitMOs = partitionGrid.GetMOsAtPosition(intPos[X], intPos[Y], ignoreTeam, false); |
2045 | 2041 |
|
2046 | 2042 | // Loop through the gotten MOs and check if we're ignoring their IDs - if not, put them onto our return vector |
2047 | 2043 | for (MovableObject* mo : hitMOs) { |
@@ -2078,7 +2074,7 @@ const std::vector<MovableObject*>* SceneMan::CastAllMOsRay(const Vector& start, |
2078 | 2074 | } |
2079 | 2075 |
|
2080 | 2076 | float SceneMan::CastObstacleRay(const Vector& start, const Vector& ray, Vector& obstaclePos, Vector& freePos, const std::vector<MOID>& ignoreMOIDs, int ignoreTeam, unsigned char ignoreMaterial, int skip) { |
2081 | | - int hitCount = 0, error, dom, sub, domSteps, skipped = skip; |
| 2077 | + int error, dom, sub, domSteps, skipped = skip; |
2082 | 2078 | int intPos[2], delta[2], delta2[2], increment[2]; |
2083 | 2079 | bool hitObstacle = false; |
2084 | 2080 |
|
@@ -2591,11 +2587,11 @@ void SceneMan::Draw(BITMAP* targetBitmap, BITMAP* targetGUIBitmap, const Vector& |
2591 | 2587 | Box targetDimensions(Vector(), targetBitmap->w, targetBitmap->h); |
2592 | 2588 |
|
2593 | 2589 | if (!terrain->WrapsX() && targetBitmap->w > GetSceneWidth()) { |
2594 | | - targetBox.SetCorner(Vector(static_cast<float>((targetBitmap->w - GetSceneWidth()) / 2), targetBox.GetCorner().GetY())); |
| 2590 | + targetBox.SetCorner(Vector(static_cast<float>((targetBitmap->w - GetSceneWidth())) / 2, targetBox.GetCorner().GetY())); |
2595 | 2591 | targetBox.SetWidth(static_cast<float>(GetSceneWidth())); |
2596 | 2592 | } |
2597 | 2593 | if (!terrain->WrapsY() && targetBitmap->h > GetSceneHeight()) { |
2598 | | - targetBox.SetCorner(Vector(targetBox.GetCorner().GetX(), static_cast<float>((targetBitmap->h - GetSceneHeight()) / 2))); |
| 2594 | + targetBox.SetCorner(Vector(targetBox.GetCorner().GetX(), static_cast<float>((targetBitmap->h - GetSceneHeight())) / 2)); |
2599 | 2595 | targetBox.SetHeight(static_cast<float>(GetSceneHeight())); |
2600 | 2596 | } |
2601 | 2597 |
|
@@ -2656,7 +2652,7 @@ void SceneMan::Draw(BITMAP* targetBitmap, BITMAP* targetGUIBitmap, const Vector& |
2656 | 2652 |
|
2657 | 2653 | static int s_drawPathfinderDebugForTeam = -2; |
2658 | 2654 | if (s_drawPathfinderDebugForTeam > -2) { |
2659 | | - m_pCurrentScene->GetPathFinder(static_cast<Activity::Teams>(s_drawPathfinderDebugForTeam)).DebugRender(targetBitmap, targetPos, m_LastUpdatedScreen); |
| 2655 | + m_pCurrentScene->GetPathFinder(static_cast<Activity::Teams>(s_drawPathfinderDebugForTeam)).DebugRender(targetBitmap, targetPos); |
2660 | 2656 | } |
2661 | 2657 |
|
2662 | 2658 | if (m_pDebugLayer) { |
|
0 commit comments