Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Source/Entities/AHuman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ void AHuman::PreControllerUpdate() {
}
} else {
m_CanActivateBGItem = true;
if (thrownDevice = dynamic_cast<ThrownDevice*>(device)) {
if ((thrownDevice = dynamic_cast<ThrownDevice*>(device))) {
thrownDevice->SetSharpAim(isSharpAiming ? 1.0F : 0);
if (m_Controller.IsState(WEAPON_FIRE)) {
if (m_ArmsState != THROWING_PREP) {
Expand Down Expand Up @@ -2718,7 +2718,7 @@ void AHuman::DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos, int whichSc
return;
}

Actor::DrawHUD(pTargetBitmap, targetPos, whichScreen);
Actor::DrawHUD(pTargetBitmap, targetPos, whichScreen, playerControlled);

if (!m_HUDVisible) {
return;
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/Activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ float Activity::GetPlayerFundsShare(int player) const {
}

void Activity::SetPlayerBrain(Actor* newBrain, int player) {
if ((player >= Players::PlayerOne || player < Players::MaxPlayerCount) && newBrain) {
if ((player >= Players::PlayerOne && player < Players::MaxPlayerCount) && newBrain) {
if (newBrain->GetTeam() != m_Team[player]) {
newBrain->SetTeam(m_Team[player]);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/LimbPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ bool LimbPath::RestartFree(Vector& limbPos, MOID MOIDToIgnore, int ignoreTeam) {
m_CurrentSegment = m_Segments.begin();

// Find the first start segment that has an obstacle on it
int i = 0;
size_t i = 0;
for (; i < m_StartSegCount; ++i) {
Vector segmentStart = GetProgressPos();
++m_CurrentSegment;
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/LimbPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ namespace RTE {
// The number of starting segments, counting into the path from its beginning,
// that upon restart of this path will be tried in reverse order till one which
// yields a starting position that is clear of terrain is found.
int m_StartSegCount;
size_t m_StartSegCount;

// Array containing the actual 'waypoints' or segments for the path.
std::deque<Vector> m_Segments;
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/MovableObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ bool MovableObject::DrawToTerrain(SLTerrain* terrain) {
}
};
BITMAP* tempBitmap = g_SceneMan.GetIntermediateBitmapForSettlingIntoTerrain(static_cast<int>(GetDiameter()));
Vector tempBitmapPos = m_Pos.GetFloored() - Vector(static_cast<float>(tempBitmap->w / 2), static_cast<float>(tempBitmap->w / 2));
Vector tempBitmapPos = m_Pos.GetFloored() - Vector(static_cast<float>(tempBitmap->w) / 2, static_cast<float>(tempBitmap->w) / 2);

clear_bitmap(tempBitmap);
// Draw the object to the temp bitmap, then draw the foreground layer on top of it, then draw it to the foreground layer.
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/MovableObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ namespace RTE {
// Unique ID of particle hit this MO
long int m_ParticleUniqueIDHit;
// Number of sim update frame when last collision was detected
int m_LastCollisionSimFrameNumber;
unsigned int m_LastCollisionSimFrameNumber;
int m_SimUpdatesBetweenScriptedUpdates; //!< The number of Sim updates between each scripted update for this MovableObject.
int m_SimUpdatesSinceLastScriptedUpdate; //!< The counter for the current number of Sim updates since this MovableObject last ran a scripted update.

Expand Down
44 changes: 20 additions & 24 deletions Source/Managers/SceneMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "PresetMan.h"
#include "FrameMan.h"
#include "ActivityMan.h"
#include "UInputMan.h"
#include "CameraMan.h"
#include "ConsoleMan.h"
#include "PrimitiveMan.h"
Expand All @@ -14,14 +13,10 @@
#include "TerrainObject.h"
#include "MovableObject.h"
#include "ContentFile.h"
#include "AHuman.h"
#include "ACRocket.h"
#include "MOPixel.h"
#include "Atom.h"
#include "Material.h"
#include "SoundContainer.h"
// Temp
#include "Controller.h"

#include "tracy/Tracy.hpp"

Expand Down Expand Up @@ -133,7 +128,6 @@ int SceneMan::LoadScene(Scene* pNewScene, bool placeObjects, bool placeUnits) {
g_ConsoleMan.PrintString("SYSTEM: Scene \"" + m_pCurrentScene->GetPresetName() + "\" was loaded");

// Set the proper scales of the unseen obscuring SceneLayers
SceneLayer* pUnseenLayer = 0;
for (int team = Activity::TeamOne; team < Activity::MaxTeamCount; ++team) {
if (!g_ActivityMan.GetActivity()->TeamActive(team))
continue;
Expand Down Expand Up @@ -1046,7 +1040,7 @@ void SceneMan::RestoreUnseenBox(const int posX, const int posY, const int width,
}

bool SceneMan::CastTerrainPenetrationRay(const Vector& start, const Vector& ray, Vector& endPos, int strengthLimit, int skip) {
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
bool stopped = false;
unsigned char materialID;
Expand Down Expand Up @@ -1138,7 +1132,7 @@ bool SceneMan::CastUnseenRay(int team, const Vector& start, const Vector& ray, V
if (!m_pCurrentScene->GetUnseenLayer(team))
return false;

int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
int error, dom, sub, domSteps, skipped = skip;
int size = 40 - GetUnseenResolution(team).GetLargest();
int intPos[2], delta[2], delta2[2], increment[2];
bool affectedAny = false;
Expand Down Expand Up @@ -1202,14 +1196,18 @@ bool SceneMan::CastUnseenRay(int team, const Vector& start, const Vector& ray, V
// Scene wrapping
WrapPosition(intPos[X], intPos[Y]);

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);

// Reveal if we can, save the result
if (reveal) {
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)) {
if (is_unseen) {
RevealUnseenBox(intPos[X] - size / 2, intPos[Y] - size / 2, size, size, team);
affectedAny = true;
}
} else {
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))) {
if (!is_unseen) {
RestoreUnseenBox(intPos[X] - size / 2, intPos[Y] - size / 2, size, size, team);
affectedAny = true;
}
}

Expand Down Expand Up @@ -1246,7 +1244,7 @@ bool SceneMan::CastUnseeRay(int team, const Vector& start, const Vector& ray, Ve

bool SceneMan::CastMaterialRay(const Vector& start, const Vector& ray, unsigned char material, Vector& result, int skip, bool wrap) {

int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
bool foundPixel = false;

Expand Down Expand Up @@ -1339,7 +1337,7 @@ float SceneMan::CastMaterialRay(const Vector& start, const Vector& ray, unsigned
}

bool SceneMan::CastNotMaterialRay(const Vector& start, const Vector& ray, unsigned char material, Vector& result, int skip, bool checkMOs) {
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
bool foundPixel = false;

Expand Down Expand Up @@ -1437,7 +1435,6 @@ float SceneMan::CastStrengthSumRay(const Vector& start, const Vector& end, int s

int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
bool foundPixel = false;
unsigned char materialID;
Material foundMaterial;

Expand Down Expand Up @@ -1522,7 +1519,6 @@ const Material* SceneMan::CastMaxStrengthRayMaterial(const Vector& start, const

int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
bool foundPixel = false;

intPos[X] = std::floor(start.m_X);
intPos[Y] = std::floor(start.m_Y);
Expand Down Expand Up @@ -1600,7 +1596,7 @@ const Material* SceneMan::CastMaxStrengthRayMaterial(const Vector& start, const
}

bool SceneMan::CastStrengthRay(const Vector& start, const Vector& ray, float strength, Vector& result, int skip, unsigned char ignoreMaterial, bool wrap) {
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
bool foundPixel = false;
unsigned char materialID;
Expand Down Expand Up @@ -1693,7 +1689,7 @@ bool SceneMan::CastStrengthRay(const Vector& start, const Vector& ray, float str
}

bool SceneMan::CastWeaknessRay(const Vector& start, const Vector& ray, float strength, Vector& result, int skip, bool wrap) {
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
bool foundPixel = false;
unsigned char materialID;
Expand Down Expand Up @@ -1783,7 +1779,7 @@ bool SceneMan::CastWeaknessRay(const Vector& start, const Vector& ray, float str
}

MOID SceneMan::CastMORay(const Vector& start, const Vector& ray, const std::vector<MOID>& ignoreMOIDs, int ignoreTeam, unsigned char ignoreMaterial, bool ignoreAllTerrain, int skip) {
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
MOID hitMOID = g_NoMOID;
unsigned char hitTerrain = 0;
Expand Down Expand Up @@ -1884,7 +1880,7 @@ MOID SceneMan::CastMORay(const Vector& start, const Vector& ray, const std::vect
}

bool SceneMan::CastFindMORay(const Vector& start, const Vector& ray, MOID targetMOID, Vector& resultPos, unsigned char ignoreMaterial, bool ignoreAllTerrain, int skip, bool findChildMOIDs) {
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
MOID hitMOID = g_NoMOID;
unsigned char hitTerrain = 0;
Expand Down Expand Up @@ -1980,7 +1976,7 @@ const std::vector<MovableObject*>* SceneMan::CastAllMOsRay(const Vector& start,

const SpatialPartitionGrid& partitionGrid = GetMOIDGrid();

int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
unsigned char hitTerrain = 0;

Expand Down Expand Up @@ -2041,7 +2037,7 @@ const std::vector<MovableObject*>* SceneMan::CastAllMOsRay(const Vector& start,

// Detect MOs
std::vector<MovableObject*> hitMOs;
hitMOs = std::move(partitionGrid.GetMOsAtPosition(intPos[X], intPos[Y], ignoreTeam, false));
hitMOs = partitionGrid.GetMOsAtPosition(intPos[X], intPos[Y], ignoreTeam, false);

// Loop through the gotten MOs and check if we're ignoring their IDs - if not, put them onto our return vector
for (MovableObject* mo : hitMOs) {
Expand Down Expand Up @@ -2078,7 +2074,7 @@ const std::vector<MovableObject*>* SceneMan::CastAllMOsRay(const Vector& start,
}

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) {
int hitCount = 0, error, dom, sub, domSteps, skipped = skip;
int error, dom, sub, domSteps, skipped = skip;
int intPos[2], delta[2], delta2[2], increment[2];
bool hitObstacle = false;

Expand Down Expand Up @@ -2591,11 +2587,11 @@ void SceneMan::Draw(BITMAP* targetBitmap, BITMAP* targetGUIBitmap, const Vector&
Box targetDimensions(Vector(), targetBitmap->w, targetBitmap->h);

if (!terrain->WrapsX() && targetBitmap->w > GetSceneWidth()) {
targetBox.SetCorner(Vector(static_cast<float>((targetBitmap->w - GetSceneWidth()) / 2), targetBox.GetCorner().GetY()));
targetBox.SetCorner(Vector(static_cast<float>((targetBitmap->w - GetSceneWidth())) / 2, targetBox.GetCorner().GetY()));
targetBox.SetWidth(static_cast<float>(GetSceneWidth()));
}
if (!terrain->WrapsY() && targetBitmap->h > GetSceneHeight()) {
targetBox.SetCorner(Vector(targetBox.GetCorner().GetX(), static_cast<float>((targetBitmap->h - GetSceneHeight()) / 2)));
targetBox.SetCorner(Vector(targetBox.GetCorner().GetX(), static_cast<float>((targetBitmap->h - GetSceneHeight())) / 2));
targetBox.SetHeight(static_cast<float>(GetSceneHeight()));
}

Expand Down Expand Up @@ -2656,7 +2652,7 @@ void SceneMan::Draw(BITMAP* targetBitmap, BITMAP* targetGUIBitmap, const Vector&

static int s_drawPathfinderDebugForTeam = -2;
if (s_drawPathfinderDebugForTeam > -2) {
m_pCurrentScene->GetPathFinder(static_cast<Activity::Teams>(s_drawPathfinderDebugForTeam)).DebugRender(targetBitmap, targetPos, m_LastUpdatedScreen);
m_pCurrentScene->GetPathFinder(static_cast<Activity::Teams>(s_drawPathfinderDebugForTeam)).DebugRender(targetBitmap, targetPos);
}

if (m_pDebugLayer) {
Expand Down
Loading