Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
90a13a9
Inital seperation of sim and render. Very broken
Causeless Jan 9, 2023
95777c0
Added render deltatime
Causeless Jan 9, 2023
d1fc3d1
Atomicized performanceMan stats
Causeless Jan 9, 2023
3eb3e86
Fixed crash from updating pathing in render thread
Causeless Jan 9, 2023
cb87f4f
Whoops.
Causeless Jan 9, 2023
2721fc8
Fixed MOs jittering behind true positions
Causeless Jan 9, 2023
b2643dc
Various preparatory tweaks
Causeless Jan 9, 2023
3477337
Fixes to buffer Scene/Activity state when drawing
Causeless Jan 9, 2023
65bd609
Half-but-not-really fixes to performance measurements
Causeless Jan 9, 2023
f28bbf0
Temp stop crashing
Causeless Jan 9, 2023
9aa602d
Fixed that all rendering stopped working
Causeless Jan 9, 2023
c4e09a9
Stopped infinite memory buildup
Causeless Jan 9, 2023
b08002c
Whoops, fixed.
Causeless Jan 9, 2023
a7a021d
Avoid slight copy cost
Causeless Jan 9, 2023
70935a5
Fixed MO stuttering
Causeless Jan 9, 2023
5caedcc
Less broken way of having infinite timescale for testing
Causeless Jan 9, 2023
b71a0f2
Add some TODOs
Causeless Jan 10, 2023
b40896d
Include ThreadMan, move threading-related stuff into there
Causeless Jan 10, 2023
65bec61
Moved MO layer from sceneman into threadman
Causeless Jan 10, 2023
d899f3f
Little comment clarifications
Causeless Jan 10, 2023
7ecf00c
More TODOs and perhaps a questionable method of inter-thread message …
Causeless Jan 10, 2023
f35ed11
Fixed inverted check
Causeless Jan 10, 2023
5f45043
Move draws to render thread.
Causeless Jan 11, 2023
9dcbd2c
Fixed infinite loop with 0 frame duration
Causeless Jan 11, 2023
ed3af1d
Draw stuff in world dump
Causeless Jan 11, 2023
64f5b67
No need to disable this
Causeless Jan 11, 2023
27566a7
Evntually I'll fix these... eventually
Causeless Jan 11, 2023
31b27d1
Fixed pause menu crash
Causeless Jan 11, 2023
7c093ab
Various fixes and tweaks.
Causeless Jan 12, 2023
0cb3891
More comments for future reference
Causeless Jan 12, 2023
5cb86b1
THis should hopefully work...
Causeless Jan 12, 2023
7fc74c0
Wiped all references to MOID layer or simplified collision detection
Causeless Jan 12, 2023
4540da7
Culled all references to OneSimUpdatePerFrame, DrawnSimUpdate etc.
Causeless Jan 12, 2023
93ebf5f
Draws should now we properly wrapped on both X and Y axis.
Causeless Jan 12, 2023
c1a816c
Whoops, that wasn't a fix
Causeless Jan 12, 2023
9389edc
Removed more MOID layer stuff
Causeless Jan 12, 2023
70b83a7
Fixed scene seam drawing
Causeless Jan 12, 2023
707432a
Handle MOSParticle Y wrapping
Causeless Jan 12, 2023
f57f749
mega-changes to "properly" (I wish) queue draws.
Causeless Jan 13, 2023
8938721
Fixed wrapping
Causeless Jan 13, 2023
b7d489d
Fixed PerformanceMan readings
Causeless Jan 13, 2023
6f0aba3
Smooth cursor movement. Still very hacky
Causeless Jan 13, 2023
4c74b58
Fixed physics detection
Causeless Jan 13, 2023
11e1263
Fixed jitter with things that don't HFlip, and made things safer
Causeless Jan 13, 2023
10dfcb8
Fixed crash
Causeless Jan 13, 2023
892915d
Reenabled transparency, seems to work now that copying isn't being do…
Causeless Jan 13, 2023
ababe4e
Removed a TODO
Causeless Jan 13, 2023
f2c247f
First pass of interpolated render
Causeless Jan 14, 2023
b6dbc2b
Extra todo
Causeless Jan 14, 2023
d6ee34d
Slight improvement to trails
Causeless Jan 14, 2023
3f29f3a
Added proper rotational interpolation
Causeless Jan 14, 2023
09ca56a
Bunch of fixes and cleanup to render interp
Causeless Jan 15, 2023
52d982e
Fixed issue with not being able to start a new activity after already…
Causeless Jan 15, 2023
a46aa42
Fixed purple pixels
Causeless Jan 16, 2023
6583b08
Fixed assert when restarting activities
Causeless Jan 16, 2023
24f46e0
Fixed render interpolation when wrapping
Causeless Jan 16, 2023
f85fc88
Little bit of cleanup and removal of comented out code in prep for HU…
Causeless Jan 17, 2023
700f61f
Comments on future design architecture
Causeless Jan 17, 2023
35a67f4
Added Lerp with rotational matrices
Causeless Jan 17, 2023
fb7636c
Extra comment
Causeless Jan 18, 2023
b454bd3
Handle timing more accurately with timescale changing (no more "jump"…
Causeless Jan 24, 2023
718e57b
Removed old code and inaccurate comment
Causeless Jan 25, 2023
58dfd18
Fixed merge issues. I'm terrified of what shit might've slipped throu…
Causeless Jan 25, 2023
4b07b87
Added comment
Causeless Jan 25, 2023
c529b4e
Some cleanup to dumpster-fire that is DrawHUD
Causeless Jan 26, 2023
14b30bf
Don't tell me what to do
Causeless Jan 26, 2023
68d799b
Removed some of the release/acquires I'm sure are unnecessary
Causeless Jan 26, 2023
6d2b7ce
Removed some pointless commented out code
Causeless Jan 29, 2023
259249d
Added ThreadMan to Windows build
Causeless Feb 1, 2023
508d0e0
Fixed wounds being interpolated from 0,0 when added
Causeless Feb 1, 2023
09cb3ce
Consistent mass distribution with bouncing
Causeless Feb 8, 2023
0dcbbc2
Made area distrubution type an ini property
Causeless Feb 8, 2023
1e87c99
Fixed inputs being swallowed
Causeless Feb 9, 2023
246c629
Door rotation lerp now uses a proper shortest-angle aware lerp
Causeless Feb 15, 2023
395807d
Fixed MSPU/MSPF mixup
Causeless Nov 13, 2023
59a6317
Fixed sim speed going above timescale
Causeless Nov 13, 2023
d8ff0bf
Stopped massive sim state transfer overhead. Better to be crashy than…
Causeless Nov 13, 2023
47600a8
post-merge fixup
Causeless Dec 25, 2023
a082c84
Unmultithreaded the multithreading
Causeless Dec 25, 2023
64a59c7
Made things mostly-work
Causeless Dec 25, 2023
d1c9c2b
Fix compile
Causeless Dec 25, 2023
4644730
slight optimization
Causeless Dec 25, 2023
201c72c
Fix input inconsistency. Also made server updates more consistent wit…
Causeless Dec 25, 2023
7b386c0
Made update ordering slightly more accurate
Causeless Dec 25, 2023
a106d34
Post-rebase cleanup to catch all the forced-through merge conflicts
Causeless Dec 26, 2023
c34164a
Removed duplicate ThreadMan source
Causeless Dec 26, 2023
19e2b93
Removed duplicate info
Causeless Dec 26, 2023
d9a37fd
Fixed messed up changelog
Causeless Dec 26, 2023
2bd2ff1
Remove trailing comma
Causeless Dec 26, 2023
2cf663b
Removes unnecessary ugly hack to allow activity copying to renderable…
Causeless Dec 26, 2023
16f16a1
Merge branch 'development' into interpolated-render
Causeless Dec 31, 2023
35545b6
Fixed merge issue
Causeless Dec 31, 2023
0a8ddc0
Fixed build
Causeless Jan 1, 2024
4a7e114
Merge remote-tracking branch 'source/interpolated-render' into interp…
traunts Jan 2, 2024
5441895
Merge branch 'development' into interpolated-render
traunts Jan 2, 2024
81bdda4
Merge branch 'development' into interpolated-render
Causeless Jan 5, 2024
d9b338a
Merge branch 'development' into interpolated-render
Causeless Jan 20, 2024
6ea2d54
format
HeliumAnt Jan 20, 2024
2036758
Merge branch 'development' into interpolated-render
HeliumAnt Jan 20, 2024
72151a8
fix eof newlines
HeliumAnt Jan 20, 2024
71454b9
apply doxygen
HeliumAnt Jan 20, 2024
a2eb998
Merge branch 'development' into interpolated-render
HeliumAnt Jan 20, 2024
a8c76cf
Merge branch 'development' into interpolated-render
Causeless Jan 21, 2024
f646b6d
Merge branch 'development' into interpolated-render
Causeless Jan 21, 2024
7abae62
Merge branch 'development' into interpolated-render
Causeless Jan 21, 2024
e048273
Post merge fixes... almost everything is clearly unindented though so…
Causeless Jan 21, 2024
f037b66
Merge branch 'development' into interpolated-render
Causeless Jan 21, 2024
1e61bf2
re-run clang format
Causeless Jan 21, 2024
935c40e
Merge branch 'development' into interpolated-render
Causeless Jan 21, 2024
706fa7b
Merge branch 'development' into interpolated-render
Causeless Jan 22, 2024
49bb84a
Merge branch 'development' into interpolated-render
Causeless Jan 22, 2024
2caee8f
Merge branch 'development' into interpolated-render
Causeless Feb 13, 2024
2c3fc1d
Merge branch 'development' into interpolated-render
Causeless Feb 14, 2024
bc9059b
Merge branch 'development' into interpolated-render
Causeless Feb 18, 2024
9389d60
Merge branch 'development' into interpolated-render
Causeless Feb 18, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- Removed `RealToSimCap` and `OneSimUpdatePerFrame`. Instead we try to always target 60fps, even if it slows the simulation down a little.

- Removed `Settings.ini` property `SimplifiedCollisionDetection = 0/1`. With the physics detection overhaul in pre-5, this became unnecessary.

</details>

***
Expand Down
29 changes: 19 additions & 10 deletions Source/Activities/GameActivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1229,8 +1229,6 @@ void GameActivity::Update() {
else if (m_ViewState[player] == ViewState::ActorSelect) {
// Continuously display message
g_FrameMan.SetScreenText("Select a body to switch control to...", ScreenOfPlayer(player));
// Get cursor input
m_PlayerController[player].RelativeCursorMovement(m_ActorCursor[player]);

// Find the actor closest to the cursor, if any within the radius
Vector markedDistance;
Expand Down Expand Up @@ -1284,10 +1282,6 @@ void GameActivity::Update() {
}
}

// Set the view to the cursor pos
g_SceneMan.ForceBounds(m_ActorCursor[player]);
g_CameraMan.SetScrollTarget(m_ActorCursor[player], 0.1, ScreenOfPlayer(player));

if (m_pLastMarkedActor[player]) {
if (!g_MovableMan.ValidMO(m_pLastMarkedActor[player])) {
m_pLastMarkedActor[player] = nullptr;
Expand Down Expand Up @@ -1701,9 +1695,6 @@ void GameActivity::Update() {
m_pBuyGUI[player]->Update();
}

// Trap the mouse if we're in gameplay and not in menus
g_UInputMan.TrapMousePos(!m_pBuyGUI[player]->IsEnabled() && !m_InventoryMenuGUI[player]->IsEnabledAndNotCarousel() && !m_LuaLockActor[player], player);

// Start LZ picking mode if a purchase was made
if (m_pBuyGUI[player]->PurchaseMade()) {
m_LZCursorWidth[player] = std::min(m_pBuyGUI[player]->GetDeliveryWidth(), g_FrameMan.GetPlayerScreenWidth() - 24);
Expand Down Expand Up @@ -1889,8 +1880,23 @@ void GameActivity::DrawGUI(BITMAP* pTargetBitmap, const Vector& targetPos, int w

// Iterate through all players, drawing each currently used LZ cursor.
for (int player = Players::PlayerOne; player < Players::MaxPlayerCount; ++player) {
if (!(m_IsActive[player] && m_IsHuman[player]))
if (!(m_IsActive[player] && m_IsHuman[player])) {
continue;
}

// TODO_MULTITHREAD properly formalize this. Maybe an UpdateRender/UpdateRealTime function on things?
m_PlayerController[player].Update();
// Trap the mouse if we're in gameplay and not in menus
g_UInputMan.TrapMousePos(!m_pBuyGUI[player]->IsEnabled() && !m_InventoryMenuGUI[player]->IsEnabledAndNotCarousel() && !m_LuaLockActor[player], player);
if (m_ViewState[player] == ViewState::ActorSelect) {
// Get cursor input
m_PlayerController[player].RelativeCursorMovement(m_ActorCursor[player]);

// Set the view to the cursor pos
g_SceneMan.ForceBounds(m_ActorCursor[player]);
g_CameraMan.SetScrollTarget(m_ActorCursor[player], 0.1, ScreenOfPlayer(player));
}
// TODO_MULTITHREAD

if (m_ViewState[player] == ViewState::LandingZoneSelect) {
int halfWidth = std::max(m_LZCursorWidth[player] / 2, 36);
Expand Down Expand Up @@ -1989,6 +1995,8 @@ void GameActivity::DrawGUI(BITMAP* pTargetBitmap, const Vector& targetPos, int w
float rightStackY = leftStackY;

// Draw the objective points this player should care about
// TODO_MULTITHREAD
#ifndef MULTITHREAD_SIM_AND_RENDER
for (std::list<ObjectivePoint>::iterator itr = m_Objectives.begin(); itr != m_Objectives.end(); ++itr) {
// Only draw objectives of the same team as the current player
if (itr->m_Team == team) {
Expand Down Expand Up @@ -2051,6 +2059,7 @@ void GameActivity::DrawGUI(BITMAP* pTargetBitmap, const Vector& targetPos, int w
}
}
}
#endif

// Team Icon up in the top left corner
const Icon* pIcon = GetTeamIcon(m_Team[PoS]);
Expand Down
80 changes: 0 additions & 80 deletions Source/Entities/ACrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1423,29 +1423,6 @@ void ACrab::DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos, int whichScr
if (!m_HUDVisible) {
return;
}
/*
// TODO: REMOVE< THIS IS TEMP
// Draw the AI paths
list<Vector>::iterator last = m_MovePath.begin();
Vector waypoint, lastPoint, lineVec;
for (list<Vector>::iterator lItr = m_MovePath.begin(); lItr != m_MovePath.end(); ++lItr)
{
lastPoint = (*last) - targetPos;
waypoint = lastPoint + g_SceneMan.ShortestDistance(lastPoint, (*lItr) - targetPos);
line(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, waypoint.m_X, waypoint.m_Y, g_RedColor);
last = lItr;
}
waypoint = m_MoveTarget - targetPos;
circlefill(pTargetBitmap, waypoint.m_X, waypoint.m_Y, 3, g_RedColor);
lastPoint = m_PrevPathTarget - targetPos;
circlefill(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, 2, g_YellowGlowColor);
lastPoint = m_DigTunnelEndPos - targetPos;
circlefill(pTargetBitmap, lastPoint.m_X, lastPoint.m_Y, 2, g_YellowGlowColor);
// Raidus
// waypoint = m_Pos - targetPos;
// circle(pTargetBitmap, waypoint.m_X, waypoint.m_Y, m_MoveProximityLimit, g_RedColor);
// TODO: REMOVE THIS IS TEMP
*/

// Player AI drawing

Expand Down Expand Up @@ -1554,63 +1531,6 @@ void ACrab::DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos, int whichScr
}
m_HUDStack -= 9;
}

// Print aim angle and rot angle stoff
/*{
std::snprintf(str, sizeof(str), "Aim %.2f Rot %.2f Lim %.2f", m_AimAngle, GetRotAngle(), m_AimRange + GetRotAngle());
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X - 0, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Centre);

m_HUDStack += -10;
}*/

/*
// AI Mode select GUI HUD
if (m_Controller.IsState(AI_MODE_SET))
{
int iconOff = m_apAIIcons[0]->w + 2;
int iconColor = m_Team == Activity::TeamOne ? AIICON_RED : AIICON_GREEN;
Vector iconPos = GetCPUPos() - targetPos;

if (m_AIMode == AIMODE_SENTRY)
{
std::snprintf(str, sizeof(str), "%s", "Sentry");
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X, iconPos.m_Y - 18, str, GUIFont::Centre);
}
else if (m_AIMode == AIMODE_PATROL)
{
std::snprintf(str, sizeof(str), "%s", "Patrol");
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X - 9, iconPos.m_Y - 5, str, GUIFont::Right);
}
else if (m_AIMode == AIMODE_BRAINHUNT)
{
std::snprintf(str, sizeof(str), "%s", "Brainhunt");
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X + 9, iconPos.m_Y - 5, str, GUIFont::Left);
}
else if (m_AIMode == AIMODE_GOLDDIG)
{
std::snprintf(str, sizeof(str), "%s", "Gold Dig");
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X, iconPos.m_Y + 8, str, GUIFont::Centre);
}

// Draw the mode alternatives if they are not the current one
if (m_AIMode != AIMODE_SENTRY)
{
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_SENTRY], iconPos.m_X - 6, iconPos.m_Y - 6 - iconOff);
}
if (m_AIMode != AIMODE_PATROL)
{
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_PATROL], iconPos.m_X - 6 - iconOff, iconPos.m_Y - 6);
}
if (m_AIMode != AIMODE_BRAINHUNT)
{
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_BRAINHUNT], iconPos.m_X - 6 + iconOff, iconPos.m_Y - 6);
}
if (m_AIMode != AIMODE_GOLDDIG)
{
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_GOLDDIG], iconPos.m_X - 6, iconPos.m_Y - 6 + iconOff);
}
}
*/
}
}

Expand Down
87 changes: 17 additions & 70 deletions Source/Entities/ACraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,9 @@ void ACraft::DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos, int whichSc
m_HUDStack = -m_CharHeight / 2;

// Only do HUD if on a team
if (m_Team < 0)
if (m_Team < 0) {
return;
}

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

// Draw hud guides for the Exits, depending on whether the doors are open
if (m_HatchState == OPEN) // || m_HatchState == OPENING)
{
if (m_HatchState == OPEN) {
// Doors open and inventory not empty yet, so show arrows pointing out of the exits since things are still coming out
if (!IsInventoryEmpty()) {
// --------
// | \ \
// -+- | |
// -+- | |
// | / /
// --------
// Make the dotted lines crawl out of the exit, indicating that things are still coming out
if (--m_ExitLinePhase < 0)
if (--m_ExitLinePhase < 0) {
m_ExitLinePhase = EXITLINESPACING - 1;
}
}
// 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
else if (m_ExitTimer.IsPastSimMS(EXITSUCKDELAYMS)) {
// Make the dotted lines crawl back into the exit, inviting people to jump in
if (++m_ExitLinePhase >= EXITLINESPACING)
if (++m_ExitLinePhase >= EXITLINESPACING) {
m_ExitLinePhase = 0;
}
}

Vector exitRadius;
Vector exitCorner;
Vector arrowVec;
// Draw the actual dotted lines
for (std::list<Exit>::iterator exit = m_Exits.begin(); exit != m_Exits.end(); ++exit) {
if (exit->CheckIfClear(m_Pos, m_Rotation, 18)) {
exitRadius = RotateOffset(exit->GetVelocity().GetPerpendicular().SetMagnitude(exit->GetRadius()));
exitCorner = m_Pos - targetPos + RotateOffset(exit->GetOffset()) + exitRadius;
arrowVec = RotateOffset(exit->GetVelocity().SetMagnitude(exit->GetRange()));
g_FrameMan.DrawLine(pTargetBitmap, exitCorner, exitCorner + arrowVec, 120, 120, EXITLINESPACING, m_ExitLinePhase);
exitCorner -= exitRadius * 2;
g_FrameMan.DrawLine(pTargetBitmap, exitCorner, exitCorner + arrowVec, 120, 120, EXITLINESPACING, m_ExitLinePhase);
if (!exit->CheckIfClear(m_Pos, m_Rotation, 18)) {
continue;
}
}
}

// Only show extra HUD if this guy is controlled by a player
if (m_Controller.IsPlayerControlled() && pSmallFont && pSymbolFont) {
AllegroBitmap pBitmapInt(pTargetBitmap);
/*
// AI Mode select GUI HUD
if (m_Controller && m_Controller.IsState(PIE_MENU_ACTIVE))
{
char str[64];
int iconOff = m_apAIIcons[0]->w + 2;
int iconColor = m_Team == Activity::TeamOne ? AIICON_RED : AIICON_GREEN;
Vector iconPos = GetCPUPos() - targetPos;

if (m_AIMode == AIMODE_RETURN)
{
std::snprintf(str, sizeof(str), "%s", "Return");
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X, iconPos.m_Y - 18, str, GUIFont::Centre);
}
else if (m_AIMode == AIMODE_DELIVER)
{
std::snprintf(str, sizeof(str), "%s", "Deliver");
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X - 9, iconPos.m_Y - 5, str, GUIFont::Right);
}
else if (m_AIMode == AIMODE_SCUTTLE)
{
std::snprintf(str, sizeof(str), "%s", "Scuttle");
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X + 9, iconPos.m_Y - 5, str, GUIFont::Left);
}
else if (m_AIMode == AIMODE_STAY)
{
std::snprintf(str, sizeof(str), "%s", "Stay");
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X, iconPos.m_Y + 8, str, GUIFont::Centre);
}

// Draw the mode alternatives if they are not the current one
if (m_AIMode != AIMODE_RETURN)
{
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_RETURN], iconPos.m_X - 6, iconPos.m_Y - 6 - iconOff);
}
if (m_AIMode != AIMODE_DELIVER)
{
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_DELIVER], iconPos.m_X - 6 - iconOff, iconPos.m_Y - 6);
}
if (m_AIMode != AIMODE_SCUTTLE)
{
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_SCUTTLE], iconPos.m_X - 6 + iconOff, iconPos.m_Y - 6);
}
if (m_AIMode != AIMODE_STAY)
{
draw_sprite(pTargetBitmap, m_apAIIcons[AIMODE_STAY], iconPos.m_X - 6, iconPos.m_Y - 6 + iconOff);
}
}
*/
Vector exitRadius = RotateOffset(exit->GetVelocity().GetPerpendicular().SetMagnitude(exit->GetRadius()));
Vector exitCorner = m_Pos - targetPos + RotateOffset(exit->GetOffset()) + exitRadius;
Vector arrowVec = RotateOffset(exit->GetVelocity().SetMagnitude(exit->GetRange()));
g_FrameMan.DrawLine(pTargetBitmap, exitCorner, exitCorner + arrowVec, 120, 120, EXITLINESPACING, m_ExitLinePhase);
exitCorner -= exitRadius * 2;
g_FrameMan.DrawLine(pTargetBitmap, exitCorner, exitCorner + arrowVec, 120, 120, EXITLINESPACING, m_ExitLinePhase);
}
}
}
12 changes: 5 additions & 7 deletions Source/Entities/ADoor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,13 @@ void ADoor::Update() {
// Lose health when door is lost, spinning out of control until grinds to halt
if (!m_Door && m_Status != DYING && m_Status != DEAD) {
m_SpriteAnimMode = ALWAYSLOOP;
m_SpriteAnimDuration = static_cast<int>(LERP(0, m_MaxHealth, 10.0F, static_cast<float>(m_InitialSpriteAnimDuration), m_Health));
m_SpriteAnimDuration = static_cast<int>(Lerp(0, m_MaxHealth, 10.0F, static_cast<float>(m_InitialSpriteAnimDuration), m_Health));

if (m_DoorMoveSound) {
if (!m_DoorMoveSound->IsBeingPlayed()) {
m_DoorMoveSound->Play(m_Pos);
}
m_DoorMoveSound->SetPitch(LERP(10.0F, static_cast<float>(m_InitialSpriteAnimDuration), 2.0F, 1.0F, static_cast<float>(m_SpriteAnimDuration)));
m_DoorMoveSound->SetPitch(Lerp(10.0F, static_cast<float>(m_InitialSpriteAnimDuration), 2.0F, 1.0F, static_cast<float>(m_SpriteAnimDuration)));
}

m_Health -= 0.4F;
Expand Down Expand Up @@ -551,11 +551,8 @@ void ADoor::UpdateDoorAttachableActions() {
m_DoorState = CLOSED;
}
} else {
Vector updatedOffset(LERP(0, m_DoorMoveTime, startOffset.m_X, endOffset.m_X, m_DoorMoveTimer.GetElapsedSimTimeMS()), LERP(0, m_DoorMoveTime, startOffset.m_Y, endOffset.m_Y, m_DoorMoveTimer.GetElapsedSimTimeMS()));

// TODO: Make this work across rotation 0. Probably the best solution would be to setup an angle LERP that properly handles the 2PI border and +- angles.
// TODO_MULTITHREAD: multithread branch has lerped rotation, so once that's done!
float updatedAngle = LERP(0, m_DoorMoveTime, startAngle, endAngle, m_DoorMoveTimer.GetElapsedSimTimeMS());
Vector updatedOffset(Lerp(0, m_DoorMoveTime, startOffset.m_X, endOffset.m_X, m_DoorMoveTimer.GetElapsedSimTimeMS()), Lerp(0, m_DoorMoveTime, startOffset.m_Y, endOffset.m_Y, m_DoorMoveTimer.GetElapsedSimTimeMS()));
float updatedAngle = Lerp(0, m_DoorMoveTime, Matrix(startAngle), Matrix(endAngle), m_DoorMoveTimer.GetElapsedSimTimeMS()).GetRadAngle();

m_Door->SetParentOffset(updatedOffset);
m_Door->SetRotAngle(m_Rotation.GetRadAngle() + (updatedAngle * GetFlipFactor()));
Expand All @@ -574,6 +571,7 @@ void ADoor::DrawHUD(BITMAP* targetBitmap, const Vector& targetPos, int whichScre
if (!m_HUDVisible) {
return;
}

// Only draw if the team viewing this is on the same team OR has seen the space where this is located.
int viewingTeam = g_ActivityMan.GetActivity()->GetTeamOfPlayer(g_ActivityMan.GetActivity()->PlayerOfScreen(whichScreen));
if (viewingTeam != m_Team && viewingTeam != Activity::NoTeam && (!g_SettingsMan.ShowEnemyHUD() || g_SceneMan.IsUnseen(m_Pos.GetFloorIntX(), m_Pos.GetFloorIntY(), viewingTeam))) {
Expand Down
4 changes: 2 additions & 2 deletions Source/Entities/AEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ int AEmitter::GetTotalBurstSize() const {
}

float AEmitter::GetScaledThrottle(float throttle, float multiplier) const {
float throttleFactor = LERP(-1.0f, 1.0f, m_NegativeThrottleMultiplier, m_PositiveThrottleMultiplier, throttle);
return LERP(m_NegativeThrottleMultiplier, m_PositiveThrottleMultiplier, -1.0f, 1.0f, throttleFactor * multiplier);
float throttleFactor = Lerp(-1.0f, 1.0f, m_NegativeThrottleMultiplier, m_PositiveThrottleMultiplier, throttle);
return Lerp(m_NegativeThrottleMultiplier, m_PositiveThrottleMultiplier, -1.0f, 1.0f, throttleFactor * multiplier);
}

void AEmitter::SetFlash(Attachable* newFlash) {
Expand Down
4 changes: 2 additions & 2 deletions Source/Entities/AEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ namespace RTE {

/// Gets the adjusted throttle multiplier that is factored into the emission rate of this AEmitter.
/// @return The throttle strength as a multiplier.
float GetThrottleFactor() const { return LERP(-1.0f, 1.0f, m_NegativeThrottleMultiplier, m_PositiveThrottleMultiplier, m_Throttle); }
float GetThrottleFactor() const { return Lerp(-1.0f, 1.0f, m_NegativeThrottleMultiplier, m_PositiveThrottleMultiplier, m_Throttle); }

/// Gets the throttle value that will achieve a given throttle factor that is factored into the emission rate of this AEmitter.
/// @return The throttle value that will achieve the given throttle factor.
float GetThrottleForThrottleFactor(float throttleFactor) const { return LERP(m_NegativeThrottleMultiplier, m_PositiveThrottleMultiplier, -1.0f, 1.0f, throttleFactor); }
float GetThrottleForThrottleFactor(float throttleFactor) const { return Lerp(m_NegativeThrottleMultiplier, m_PositiveThrottleMultiplier, -1.0f, 1.0f, throttleFactor); }

/// Returns a scaled throttle value that represents a linear increase of force.
/// Because of (bad) reasons, throttle is in the range -1.0F to 1.0F, where -1.0F is "minimum force" and 1.0F is "maximum force".
Expand Down
Loading