Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 6e5d95e

Browse files
committed
Small edits to DrawThrowingReticule
1 parent 2aab872 commit 6e5d95e

File tree

2 files changed

+74
-88
lines changed

2 files changed

+74
-88
lines changed

Entities/AHuman.cpp

Lines changed: 73 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -4419,38 +4419,24 @@ void AHuman::Update()
44194419
//////////////////////////////////////////////////////////////////////////////////////////
44204420
// Description: Draws an aiming aid in front of this HeldDevice for throwing.
44214421

4422-
void AHuman::DrawThrowingReticule(BITMAP *pTargetBitmap, const Vector &targetPos, float amount)
4422+
void AHuman::DrawThrowingReticule(BITMAP *pTargetBitmap, const Vector &targetPos, double amount) const
44234423
{
44244424
const int pointCount = 9;
44254425
Vector points[pointCount];
4426-
// Color colors[pointCount];
4427-
4428-
points[0].SetXY(0, 0);
4429-
// colors[0].SetRGB(255, 225, 0);
4430-
points[1].SetXY(4, 0);
4431-
// colors[1].SetRGB(250, 210, 5);
4432-
points[2].SetXY(8, 0);
4433-
// colors[2].SetRGB(250, 180, 5);
4434-
points[3].SetXY(12, 0);
4435-
// colors[3].SetRGB(250, 160, 5);
4436-
points[4].SetXY(16, 0);
4437-
// colors[4].SetRGB(242, 120, 5);
4438-
points[5].SetXY(20, 0);
4439-
// colors[5].SetRGB(240, 90, 6);
4440-
points[6].SetXY(24, 0);
4441-
// colors[6].SetRGB(240, 50, 8);
4442-
points[7].SetXY(28, 0);
4443-
// colors[7].SetRGB(230, 40, 10);
4444-
points[8].SetXY(32, 0);
4445-
// colors[8].SetRGB(230, 30, 10);
4426+
//Color colors[pointCount];
4427+
4428+
for (int index = 0; index < pointCount; index++) {
4429+
points[index].SetXY(static_cast<float>(index * 4), 0.0F);
4430+
//colors[index].SetRGB(255 - index * 3, 225 - index * 20, index);
4431+
}
44464432

44474433
Vector outOffset(m_HFlipped ? -15 : 15, -4);
44484434
// Matrix aimMatrix(m_AimAngle);
44494435
// aimMatrix.SetXFlipped(m_HFlipped);
44504436

44514437
acquire_bitmap(pTargetBitmap);
44524438

4453-
for (int i = 0; i < (pointCount * amount); ++i) {
4439+
for (int i = 0; i < pointCount * amount; ++i) {
44544440
points[i].FlipX(m_HFlipped);
44554441
points[i] += outOffset;
44564442
points[i].RadRotate(m_HFlipped ? -m_AimAngle : m_AimAngle);
@@ -4459,9 +4445,9 @@ void AHuman::DrawThrowingReticule(BITMAP *pTargetBitmap, const Vector &targetPos
44594445
points[i] += m_pFGArm->GetParentOffset();
44604446

44614447
// Put the flickering glows on the reticule dots, in absolute scene coordinates
4462-
g_PostProcessMan.RegisterGlowDotEffect(points[i], YellowDot, 55.0F + RandomNum(0.0F, 100.0F));
4448+
g_PostProcessMan.RegisterGlowDotEffect(points[i], YellowDot, 55 + RandomNum(0, 100));
44634449

4464-
putpixel(pTargetBitmap, points[i].m_X - targetPos.m_X, points[i].m_Y - targetPos.m_Y, g_YellowGlowColor);
4450+
putpixel(pTargetBitmap, points[i].GetFloorIntX() - targetPos.GetFloorIntX(), points[i].GetFloorIntY() - targetPos.GetFloorIntY(), g_YellowGlowColor);
44654451
}
44664452

44674453
release_bitmap(pTargetBitmap);
@@ -4659,23 +4645,23 @@ void AHuman::Draw(BITMAP *pTargetBitmap,
46594645
m_Paths[m_HFlipped][CLIMB].Draw(pTargetBitmap, targetPos, 165);
46604646
}
46614647

4662-
if (mode == g_DrawColor && !onlyPhysical)
4663-
{
4664-
acquire_bitmap(pTargetBitmap);
4665-
putpixel(pTargetBitmap, std::floor(m_Pos.m_X),
4666-
std::floor(m_Pos.m_Y),
4667-
64);
4668-
putpixel(pTargetBitmap, std::floor(m_Pos.m_X),
4669-
std::floor(m_Pos.m_Y),
4670-
64);
4671-
release_bitmap(pTargetBitmap);
4672-
4673-
// m_pAtomGroup->Draw(pTargetBitmap, targetPos, false, 122);
4674-
m_pFGFootGroup->Draw(pTargetBitmap, targetPos, true, 13);
4675-
m_pBGFootGroup->Draw(pTargetBitmap, targetPos, true, 13);
4676-
m_pFGHandGroup->Draw(pTargetBitmap, targetPos, true, 13);
4677-
m_pBGHandGroup->Draw(pTargetBitmap, targetPos, true, 13);
4678-
}
4648+
if (mode == g_DrawColor && !onlyPhysical)
4649+
{
4650+
acquire_bitmap(pTargetBitmap);
4651+
putpixel(pTargetBitmap, std::floor(m_Pos.m_X),
4652+
std::floor(m_Pos.m_Y),
4653+
64);
4654+
putpixel(pTargetBitmap, std::floor(m_Pos.m_X),
4655+
std::floor(m_Pos.m_Y),
4656+
64);
4657+
release_bitmap(pTargetBitmap);
4658+
4659+
// m_pAtomGroup->Draw(pTargetBitmap, targetPos, false, 122);
4660+
m_pFGFootGroup->Draw(pTargetBitmap, targetPos, true, 13);
4661+
m_pBGFootGroup->Draw(pTargetBitmap, targetPos, true, 13);
4662+
m_pFGHandGroup->Draw(pTargetBitmap, targetPos, true, 13);
4663+
m_pBGHandGroup->Draw(pTargetBitmap, targetPos, true, 13);
4664+
}
46794665
#endif
46804666
}
46814667

@@ -4687,67 +4673,67 @@ void AHuman::Draw(BITMAP *pTargetBitmap,
46874673
// BITMAP of choice.
46884674

46894675
void AHuman::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScreen, bool playerControlled) {
4690-
if (!m_HUDVisible)
4691-
return;
4676+
if (!m_HUDVisible)
4677+
return;
46924678

4693-
// Only do HUD if on a team
4694-
if (m_Team < 0)
4695-
return;
4679+
// Only do HUD if on a team
4680+
if (m_Team < 0)
4681+
return;
46964682

4697-
// Only draw if the team viewing this is on the same team OR has seen the space where this is located
4698-
int viewingTeam = g_ActivityMan.GetActivity()->GetTeamOfPlayer(g_ActivityMan.GetActivity()->PlayerOfScreen(whichScreen));
4699-
if (viewingTeam != m_Team && viewingTeam != Activity::NoTeam)
4700-
{
4701-
if (g_SceneMan.IsUnseen(m_Pos.m_X, m_Pos.m_Y, viewingTeam))
4702-
return;
4703-
}
4683+
// Only draw if the team viewing this is on the same team OR has seen the space where this is located
4684+
int viewingTeam = g_ActivityMan.GetActivity()->GetTeamOfPlayer(g_ActivityMan.GetActivity()->PlayerOfScreen(whichScreen));
4685+
if (viewingTeam != m_Team && viewingTeam != Activity::NoTeam)
4686+
{
4687+
if (g_SceneMan.IsUnseen(m_Pos.m_X, m_Pos.m_Y, viewingTeam))
4688+
return;
4689+
}
47044690

4705-
Actor::DrawHUD(pTargetBitmap, targetPos, whichScreen);
4691+
Actor::DrawHUD(pTargetBitmap, targetPos, whichScreen);
47064692

47074693
#ifdef DEBUG_BUILD
4708-
// Limbpath debug drawing
4709-
m_Paths[FGROUND][WALK].Draw(pTargetBitmap, targetPos, 122);
4710-
m_Paths[FGROUND][CRAWL].Draw(pTargetBitmap, targetPos, 122);
4711-
m_Paths[FGROUND][ARMCRAWL].Draw(pTargetBitmap, targetPos, 13);
4712-
m_Paths[FGROUND][CLIMB].Draw(pTargetBitmap, targetPos, 98);
4713-
4714-
m_Paths[BGROUND][WALK].Draw(pTargetBitmap, targetPos, 122);
4715-
m_Paths[BGROUND][CRAWL].Draw(pTargetBitmap, targetPos, 122);
4716-
m_Paths[BGROUND][ARMCRAWL].Draw(pTargetBitmap, targetPos, 13);
4717-
m_Paths[BGROUND][CLIMB].Draw(pTargetBitmap, targetPos, 98);
4718-
4719-
// Draw the AI paths
4720-
list<Vector>::iterator last = m_MovePath.begin();
4721-
Vector waypoint, lastPoint, lineVec;
4722-
for (list<Vector>::iterator lItr = m_MovePath.begin(); lItr != m_MovePath.end(); ++lItr)
4723-
{
4724-
lastPoint = (*last) - targetPos;
4725-
waypoint = lastPoint + g_SceneMan.ShortestDistance(lastPoint, (*lItr) - targetPos);
4726-
line(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, waypoint.m_X, waypoint.m_Y, g_RedColor);
4727-
last = lItr;
4728-
}
4729-
waypoint = m_MoveTarget - targetPos;
4730-
circlefill(pTargetBitmap, waypoint.m_X, waypoint.m_Y, 3, g_RedColor);
4731-
lastPoint = m_PrevPathTarget - targetPos;
4732-
circlefill(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, 2, g_YellowGlowColor);
4733-
lastPoint = m_DigTunnelEndPos - targetPos;
4734-
circlefill(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, 2, g_YellowGlowColor);
4735-
// Raidus
4694+
// Limbpath debug drawing
4695+
m_Paths[FGROUND][WALK].Draw(pTargetBitmap, targetPos, 122);
4696+
m_Paths[FGROUND][CRAWL].Draw(pTargetBitmap, targetPos, 122);
4697+
m_Paths[FGROUND][ARMCRAWL].Draw(pTargetBitmap, targetPos, 13);
4698+
m_Paths[FGROUND][CLIMB].Draw(pTargetBitmap, targetPos, 98);
4699+
4700+
m_Paths[BGROUND][WALK].Draw(pTargetBitmap, targetPos, 122);
4701+
m_Paths[BGROUND][CRAWL].Draw(pTargetBitmap, targetPos, 122);
4702+
m_Paths[BGROUND][ARMCRAWL].Draw(pTargetBitmap, targetPos, 13);
4703+
m_Paths[BGROUND][CLIMB].Draw(pTargetBitmap, targetPos, 98);
4704+
4705+
// Draw the AI paths
4706+
list<Vector>::iterator last = m_MovePath.begin();
4707+
Vector waypoint, lastPoint, lineVec;
4708+
for (list<Vector>::iterator lItr = m_MovePath.begin(); lItr != m_MovePath.end(); ++lItr)
4709+
{
4710+
lastPoint = (*last) - targetPos;
4711+
waypoint = lastPoint + g_SceneMan.ShortestDistance(lastPoint, (*lItr) - targetPos);
4712+
line(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, waypoint.m_X, waypoint.m_Y, g_RedColor);
4713+
last = lItr;
4714+
}
4715+
waypoint = m_MoveTarget - targetPos;
4716+
circlefill(pTargetBitmap, waypoint.m_X, waypoint.m_Y, 3, g_RedColor);
4717+
lastPoint = m_PrevPathTarget - targetPos;
4718+
circlefill(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, 2, g_YellowGlowColor);
4719+
lastPoint = m_DigTunnelEndPos - targetPos;
4720+
circlefill(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, 2, g_YellowGlowColor);
4721+
// Raidus
47364722
// waypoint = m_Pos - targetPos;
47374723
// circle(pTargetBitmap, waypoint.m_X, waypoint.m_Y, m_MoveProximityLimit, g_RedColor);
47384724
#endif
47394725

4740-
// Player AI drawing
4726+
// Player AI drawing
47414727

4742-
// Device aiming reticule
4728+
// Device aiming reticule
47434729
if (m_Controller.IsState(AIM_SHARP) && m_pFGArm && m_pFGArm->IsAttached() && m_pFGArm->HoldsHeldDevice()) {
47444730
m_pFGArm->GetHeldDevice()->DrawHUD(pTargetBitmap, targetPos, whichScreen, m_Controller.IsPlayerControlled());
47454731
}
4732+
47464733

4747-
4748-
// Throwing reticule
4734+
// Throwing reticule
47494735
if (m_ArmsState == THROWING_PREP) {
4750-
DrawThrowingReticule(pTargetBitmap, targetPos, std::min(static_cast<float>(m_ThrowTmr.GetElapsedSimTimeMS() / m_ThrowPrepTime), 1.0F));
4736+
DrawThrowingReticule(pTargetBitmap, targetPos, std::min(m_ThrowTmr.GetElapsedSimTimeMS() / m_ThrowPrepTime, 1.0));
47514737
}
47524738

47534739
//////////////////////////////////////

Entities/AHuman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ ClassInfoGetters
958958
// reticule should be drawn, to indicate force in the throw.
959959
// Return value: None.
960960

961-
void DrawThrowingReticule(BITMAP *pTargetBitmap, const Vector &targetPos = Vector(), float amount = 1.0);
961+
void DrawThrowingReticule(BITMAP *pTargetBitmap, const Vector &targetPos = Vector(), double amount = 1.0) const;
962962

963963

964964
// Member variables

0 commit comments

Comments
 (0)