Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.
Open
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
28 changes: 27 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ AUDIO = TheForceEngine/TFE_Audio/audioDevice.o \
TheForceEngine/TFE_Audio/audioSystem.o \
TheForceEngine/TFE_Audio/midiDevice.o \
TheForceEngine/TFE_Audio/midiPlayer.o \
TheForceEngine/TFE_Audio/RtAudio.o \
TheForceEngine/TFE_Audio/RtMidi.o

DARKFORCES = TheForceEngine/TFE_DarkForces/Actor/actor.o \
TheForceEngine/TFE_DarkForces/Actor/actorDebug.o \
Expand All @@ -66,19 +68,42 @@ DARKFORCES = TheForceEngine/TFE_DarkForces/Actor/actor.o \
TheForceEngine/TFE_DarkForces/GameUI/delt.o \
TheForceEngine/TFE_DarkForces/GameUI/editBox.o \
TheForceEngine/TFE_DarkForces/GameUI/escapeMenu.o \
TheForceEngine/TFE_DarkForces/GameUI/menu.o \
TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.o \
TheForceEngine/TFE_DarkForces/GameUI/pda.o \
TheForceEngine/TFE_DarkForces/GameUI/uiDraw.o \
TheForceEngine/TFE_DarkForces/agent.o \
TheForceEngine/TFE_DarkForces/animLogic.o \
TheForceEngine/TFE_DarkForces/automap.o \
TheForceEngine/TFE_DarkForces/briefingList.o \
TheForceEngine/TFE_DarkForces/cheats.o \
TheForceEngine/TFE_DarkForces/config.o \
TheForceEngine/TFE_DarkForces/darkForcesMain.o \
TheForceEngine/TFE_DarkForces/gameList.o \
TheForceEngine/TFE_DarkForces/gameMessage.o \
TheForceEngine/TFE_DarkForces/generator.o \
TheForceEngine/TFE_DarkForces/hitEffect.o \
TheForceEngine/TFE_DarkForces/hud.o \
TheForceEngine/TFE_DarkForces/item.o \
TheForceEngine/TFE_DarkForces/Landru/cutscene.o \
TheForceEngine/TFE_DarkForces/Landru/cutsceneList.o \
TheForceEngine/TFE_DarkForces/Landru/cutscene_film.o \
TheForceEngine/TFE_DarkForces/Landru/cutscene_player.o \
TheForceEngine/TFE_DarkForces/Landru/lactor.o \
TheForceEngine/TFE_DarkForces/Landru/lactorAnim.o \
TheForceEngine/TFE_DarkForces/Landru/lactorCust.o \
TheForceEngine/TFE_DarkForces/Landru/lactorDelt.o \
TheForceEngine/TFE_DarkForces/Landru/lcanvas.o \
TheForceEngine/TFE_DarkForces/Landru/ldraw.o \
TheForceEngine/TFE_DarkForces/Landru/lfade.o \
TheForceEngine/TFE_DarkForces/Landru/lfont.o \
TheForceEngine/TFE_DarkForces/Landru/lmusic.o \
TheForceEngine/TFE_DarkForces/Landru/lpalette.o \
TheForceEngine/TFE_DarkForces/Landru/lrect.o \
TheForceEngine/TFE_DarkForces/Landru/lsound.o \
TheForceEngine/TFE_DarkForces/Landru/lsystem.o \
TheForceEngine/TFE_DarkForces/Landru/ltimer.o \
TheForceEngine/TFE_DarkForces/Landru/lview.o \
TheForceEngine/TFE_DarkForces/Landru/textCrawl.o \
TheForceEngine/TFE_DarkForces/logic.o \
TheForceEngine/TFE_DarkForces/mission.o \
TheForceEngine/TFE_DarkForces/pickup.o \
Expand Down Expand Up @@ -189,6 +214,7 @@ SYSTEM = TheForceEngine/TFE_System/log.o \
TheForceEngine/TFE_System/profiler.o \
TheForceEngine/TFE_System/system.o \
TheForceEngine/TFE_System/Threads/Linux/mutexLinux.o \
TheForceEngine/TFE_System/Threads/Linux/signalLinux.o \
TheForceEngine/TFE_System/Threads/Linux/threadLinux.o

UI = TheForceEngine/TFE_Ui/imGUI/imgui.o \
Expand Down
8 changes: 8 additions & 0 deletions TheForceEngine/TFE_DarkForces/GameUI/escapeMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ namespace TFE_DarkForces
s32 dx, dy;
TFE_Input::getAccumulatedMouseMove(&dx, &dy);

MonitorInfo monitorInfo;
TFE_RenderBackend::getCurrentMonitorInfo(&monitorInfo);

// Scale the mouse delta based on monitor resolution.
s32 uiScale = max(100, 100 * monitorInfo.h / 1080);
dx = (dx * uiScale) / 100;
dy = (dy * uiScale) / 100;

s_cursorPosAccum.x = clamp(s_cursorPosAccum.x + dx, 0, displayInfo.width);
s_cursorPosAccum.z = clamp(s_cursorPosAccum.z + dy, 0, displayInfo.height);
if (displayInfo.width >= displayInfo.height)
Expand Down
10 changes: 9 additions & 1 deletion TheForceEngine/TFE_DarkForces/GameUI/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,22 @@ namespace TFE_DarkForces
DisplayInfo displayInfo;
TFE_RenderBackend::getDisplayInfo(&displayInfo);

MonitorInfo monitorInfo;
TFE_RenderBackend::getCurrentMonitorInfo(&monitorInfo);

LRect bounds;
lcanvas_getBounds(&bounds);
s32 width = bounds.right - bounds.left;
s32 width = bounds.right - bounds.left;
s32 height = bounds.bottom - bounds.top;

s32 dx, dy;
TFE_Input::getAccumulatedMouseMove(&dx, &dy);

// Scale the mouse delta based on monitor resolution.
s32 uiScale = max(100, 100 * monitorInfo.h / 1080);
dx = (dx * uiScale) / 100;
dy = (dy * uiScale) / 100;

s_cursorPosAccum.x = clamp(s_cursorPosAccum.x + dx, 0, displayInfo.width);
s_cursorPosAccum.z = clamp(s_cursorPosAccum.z + dy, 0, displayInfo.height);
if (displayInfo.width >= displayInfo.height)
Expand Down
2 changes: 1 addition & 1 deletion TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace TFE_DarkForces

s16 s_briefY;
s32 s_briefingMaxY;
LRect s_overlayRect;
static LRect s_overlayRect;

enum
{
Expand Down
1 change: 0 additions & 1 deletion TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ namespace TFE_DarkForces

extern s16 s_briefY;
extern s32 s_briefingMaxY;
extern LRect s_overlayRect;
}
2 changes: 2 additions & 0 deletions TheForceEngine/TFE_DarkForces/Landru/cutscene_film.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <TFE_Jedi/Renderer/virtualFramebuffer.h>
#include <TFE_FileSystem/filestream.h>
#include <TFE_System/parser.h>
#include <string.h>


using namespace TFE_Jedi;

Expand Down
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/Landru/cutscene_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <TFE_Jedi/Sound/soundSystem.h>
#include <TFE_FileSystem/filestream.h>
#include <TFE_System/parser.h>
#include <string.h>

using namespace TFE_Jedi;

Expand Down
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/Landru/lactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "lview.h"
#include "ltimer.h"
#include <TFE_Game/igame.h>
#include <string.h>
#include <assert.h>

namespace TFE_DarkForces
Expand Down
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/Landru/lcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <TFE_System/system.h>
#include <TFE_Jedi/Math/core_math.h>
#include <TFE_Jedi/Renderer/virtualFramebuffer.h>
#include <string.h>
#include <assert.h>

using namespace TFE_Jedi;
Expand Down
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/Landru/ldraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <TFE_Game/igame.h>
#include <TFE_Jedi/Math/core_math.h>
#include <TFE_Jedi/Renderer/virtualFramebuffer.h>
#include <string.h>
#include <assert.h>
#include <map>

Expand Down
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/Landru/lfont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <TFE_Game/igame.h>
#include <TFE_Jedi/Math/core_math.h>
#include <TFE_Jedi/Renderer/virtualFramebuffer.h>
#include <string.h>
#include <assert.h>
#include <map>

Expand Down
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/Landru/lmusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <TFE_FileSystem/filestream.h>
#include <TFE_FileSystem/paths.h>
#include <TFE_System/parser.h>
#include <string.h>
#include <assert.h>

namespace TFE_DarkForces
Expand Down
7 changes: 6 additions & 1 deletion TheForceEngine/TFE_DarkForces/Landru/lpalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <TFE_Game/igame.h>
#include <TFE_Jedi/Math/core_math.h>
#include <TFE_Jedi/Renderer/virtualFramebuffer.h>
#include <string.h>
#include <assert.h>

using namespace TFE_Jedi;
Expand Down Expand Up @@ -637,6 +638,10 @@ namespace TFE_DarkForces
{
pal->resType = resType;
strcpy(pal->name, name);
_strlwr(pal->name);
#ifdef WIN32
_strlwr(pal->name);
#else
strlwr(pal->name);
#endif
}
}
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/Landru/lsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <TFE_FileSystem/filestream.h>
#include <TFE_FileSystem/paths.h>
#include <TFE_Jedi/Math/core_math.h>
#include <string.h>
#include <assert.h>

using namespace TFE_Jedi;
Expand Down
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/Landru/lview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <TFE_Game/igame.h>
#include <TFE_Jedi/Renderer/virtualFramebuffer.h>
#include <TFE_Jedi/Math/core_math.h>
#include <string.h>
#include <assert.h>

using namespace TFE_Jedi;
Expand Down
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/Landru/textCrawl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <TFE_Jedi/Math/core_math.h>
#include <TFE_Jedi/Math/fixedPoint.h>
#include <TFE_Game/igame.h>
#include <string.h>
#include <assert.h>

using namespace TFE_Jedi;
Expand Down
16 changes: 12 additions & 4 deletions TheForceEngine/TFE_DarkForces/briefingList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <TFE_System/system.h>
#include <TFE_FileSystem/filestream.h>
#include <TFE_System/parser.h>
#include <string.h>

namespace TFE_DarkForces
{
Expand Down Expand Up @@ -78,10 +79,17 @@ namespace TFE_DarkForces
}
else
{
_strlwr(mission);
_strlwr(archive);
_strlwr(bgAnim);
_strlwr(palette);
#ifdef _WIN32
_strlwr(mission);
_strlwr(archive);
_strlwr(bgAnim);
_strlwr(palette);
#else
strlwr(mission);
strlwr(archive);
strlwr(bgAnim);
strlwr(palette);
#endif

strcpy(info->mission, mission);
strcpy(info->archive, archive);
Expand Down
6 changes: 5 additions & 1 deletion TheForceEngine/TFE_FileSystem/paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ namespace TFE_Paths
{
char fileNameLC[TFE_MAX_PATH];
strcpy(fileNameLC, fileName);
_strlwr(fileNameLC);
#ifdef WIN32
_strlwr(fileNameLC);
#else
strlwr(fileNameLC);
#endif

char filePathFixed[TFE_MAX_PATH];
strcpy(filePathFixed, filePath);
Expand Down
14 changes: 9 additions & 5 deletions TheForceEngine/TFE_FrontEndUI/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace TFE_Console
static ImFont* s_consoleFont;
static f32 s_height;
static f32 s_anim;
static s32 s_fontSize;
static s32 s_historyIndex;
static s32 s_historyScroll;

Expand All @@ -55,8 +56,11 @@ namespace TFE_Console

bool init()
{
s32 scale = TFE_Ui::getUiScale();
s_fontSize = (scale * 20) / 100;

ImGuiIO& io = ImGui::GetIO();
s_consoleFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", 20);
s_consoleFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", s_fontSize);
s_height = 0.0f;
s_anim = 0.0f;
s_historyIndex = -1;
Expand Down Expand Up @@ -561,20 +565,20 @@ namespace TFE_Console
}

const s32 count = (s32)s_history.size();
const s32 elementsPerPage = ((s32)consoleHeight - 36) / 20;
const s32 elementsPerPage = ((s32)consoleHeight - 16 - s_fontSize) / s_fontSize;
s_historyScroll = std::max(0, std::min(s_historyScroll, count - elementsPerPage));
s32 start = count - 1 - s_historyScroll;

s32 y = (s32)consoleHeight - 56;
for (s32 i = start; i >= 0 && y > -20; i--, y -= 20)
s32 y = (s32)consoleHeight - 16 - 2*s_fontSize;
for (s32 i = start; i >= 0 && y > -s_fontSize; i--, y -= s_fontSize)
{
ImGui::SetCursorPosY(f32(y));
ImGui::TextColored(ImVec4(s_history[i].color.x, s_history[i].color.y, s_history[i].color.z, s_history[i].color.w), s_history[i].text.c_str());
}

ImGui::SetKeyboardFocusHere();
ImGui::SetNextItemWidth(f32(w - 16));
ImGui::SetCursorPosY(consoleHeight - 32.0f);
ImGui::SetCursorPosY(consoleHeight - 12.0f - s_fontSize);
u32 flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_NoHorizontalScroll |
ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory;
// Make sure the key to close the console doesn't make its was into the command line.
Expand Down
4 changes: 2 additions & 2 deletions TheForceEngine/TFE_FrontEndUI/editorTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace TFE_FrontEndUI
}
}

bool createTexture(const TextureData* src, const u32* palette, EditorTexture* tex)
bool createTexture(const TextureData* src, const u32* palette, EditorTexture* tex, MagFilter filter)
{
if (!src || !tex) { return false; }
tex->scale = { 1.0f, 1.0f };
Expand All @@ -51,7 +51,7 @@ namespace TFE_FrontEndUI
u32* image = s_imageBuffer.data();
convertDfTextureToTrueColor(src, palette, image);

tex->texture = TFE_RenderBackend::createTexture(src->width, src->height, image);
tex->texture = TFE_RenderBackend::createTexture(src->width, src->height, image, filter);

tex->scale.x = 1.0f;
tex->scale.z = 1.0f;
Expand Down
2 changes: 1 addition & 1 deletion TheForceEngine/TFE_FrontEndUI/editorTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ namespace TFE_FrontEndUI
{
bool convertPalette(const u8* srcPalette, u32* dstPalette);
void convertDfTextureToTrueColor(const TextureData* src, const u32* palette, u32* image);
bool createTexture(const TextureData* src, const u32* palette, EditorTexture* tex);
bool createTexture(const TextureData* src, const u32* palette, EditorTexture* tex, MagFilter filter = MAG_FILTER_NONE);
}
Loading