Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
18421a5
Initial POC commit of replay code
Karjala22 Nov 26, 2024
9ba869b
Added more debug logs and update tick recording
Karjala22 Dec 2, 2024
5d4f089
Working version of replays.
Karjala22 Dec 5, 2024
f9b9a33
Working version of demo replays. Still rare issues with long term rep…
Karjala22 Dec 7, 2024
c647178
Add replay POC
Karjala22 Feb 20, 2025
f705b90
Temp muting logging for events
Karjala22 Feb 20, 2025
e425b75
updating projet files
Karjala22 Feb 20, 2025
e47d5d1
Updating Cmakelist
Karjala22 Feb 23, 2025
c6cd639
updating project and merging some files
Karjala22 Feb 23, 2025
83728b3
Ignoring modcache
Karjala22 Feb 23, 2025
fef63e9
Merge of 1.15 code
Karjala22 Feb 26, 2025
83b0bba
More logging cleanup and simplifying code.
Karjala22 Feb 26, 2025
bde3e4f
More merging of the 1.15 code.
Karjala22 Feb 26, 2025
e8638e7
Additional Merging
Karjala22 Feb 26, 2025
52360e6
updating ui and filters
Karjala22 Feb 26, 2025
5759a7c
ensuring version is 141 instead of 143
Karjala22 Feb 26, 2025
a4af801
Merge branch 'master' into replays
ifeldshteyn Feb 26, 2025
7a3c270
Removing sdl import
Karjala22 Feb 26, 2025
3dd429a
Merge branch 'replays' of https://github.com/ifeldshteyn/TheForceEngi…
Karjala22 Feb 26, 2025
bbcf767
Removed unused dependencies
Karjala22 Feb 26, 2025
c43f888
Removing unreachable code
Karjala22 Feb 26, 2025
5832e6d
Removing inused includes
Karjala22 Feb 26, 2025
62ce1ac
Updating strcpy call
Karjala22 Feb 26, 2025
d02c738
Don't open folder in linux
Karjala22 Feb 26, 2025
01a0ba0
Remove stale replay logging
Karjala22 Feb 26, 2025
cc3af63
Fix up pathing for linux
Karjala22 Feb 26, 2025
8ebfd45
Updating UI to support linux and change the mod checking behavior for…
Karjala22 Feb 26, 2025
1068024
Change functinoality of mod checker.
Karjala22 Feb 26, 2025
8589ab6
temp debug logging
Karjala22 Feb 26, 2025
dd96465
Rewriting log
Karjala22 Feb 27, 2025
c0d9f68
Fix for linux paths and sorting
Karjala22 Feb 27, 2025
f82ef82
Clean up some empty space - make it look nicer on linux.
Karjala22 Feb 27, 2025
2c2b8e2
Updating version - removing eye requirement in the events - adding re…
Karjala22 Feb 28, 2025
845f893
Add logging toggle for replays
Karjala22 Feb 28, 2025
f885f53
update linux offsets
Karjala22 Feb 28, 2025
5b40dd2
Change playback counter
Karjala22 Feb 28, 2025
c53709e
Adding append more for filestreaming.
Karjala22 Feb 28, 2025
0da2621
fix log
Karjala22 Feb 28, 2025
511e44e
never skip priority by default
Karjala22 Mar 3, 2025
63c1166
Adding an option to run a replay via commandline. Also add parameter …
Karjala22 Mar 7, 2025
674ab36
adding param to auto exit.
Karjala22 Mar 7, 2025
7ffed3a
Adding latest editor changes from master.
Karjala22 Mar 7, 2025
d225050
Merge of 1.15 code
Karjala22 Mar 8, 2025
d530d12
Minor cleanup
Karjala22 Mar 8, 2025
626fe4a
Removing spurious log messages
Karjala22 Mar 8, 2025
60cb5e3
Adding replay test mechanism
Karjala22 Mar 10, 2025
de69d8e
Ignore any replays
Karjala22 Mar 10, 2025
f967481
fixing tests workflow
Karjala22 Mar 10, 2025
36e00f0
Fix path
Karjala22 Mar 10, 2025
a3ac19e
more debug
Karjala22 Mar 10, 2025
3918af2
more workflow testing
Karjala22 Mar 10, 2025
a985321
More workflow debugging
Karjala22 Mar 10, 2025
ea75130
More testing
Karjala22 Mar 10, 2025
54df93d
workflow fix
Karjala22 Mar 10, 2025
cc3832b
more bug fixing
Karjala22 Mar 10, 2025
8a98030
more workflow testing
Karjala22 Mar 10, 2025
f86f99d
more workflow test
Karjala22 Mar 10, 2025
11f692a
add cmake Tests folder
Karjala22 Mar 10, 2025
ebd2126
testing
Karjala22 Mar 10, 2025
7d7408b
updating
Karjala22 Mar 10, 2025
d408ada
more tests
Karjala22 Mar 10, 2025
83ac59a
top fix
Karjala22 Mar 10, 2025
d7af3dd
test
Karjala22 Mar 10, 2025
c090e8b
log is ignored - changing to txt
Karjala22 Mar 10, 2025
91f9b34
Disable tests through actions.
Karjala22 Mar 10, 2025
24704d7
Remove mousebot and turret number checking
Karjala22 Mar 10, 2025
fc68b8a
Added testing
Karjala22 Mar 11, 2025
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: 1 addition & 1 deletion .github/workflows/ubuntu-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@
.vs/
Internal/
TheForceEngine/Games/
TheForceEngine/ModCache/
TheForceEngine/Mods/
TheForceEngine/screenshots/
TheForceEngine/Reference/
TheForceEngine/Replays/
TheForceEngine/LawMaker/
TheForceEngine/Backup/
TheForceEngine/Exports/
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ if(ENABLE_TFE)
execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/UI_Images)
execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/UI_Text)
execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/EditorDef)
execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Tests)
include(CreateGitVersionH.cmake)
create_git_version_h()
endif()
Expand Down Expand Up @@ -137,6 +138,7 @@ if(ENABLE_TFE)
"${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Shaders"
"${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/SoundFonts"
"${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Fonts"
"${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Tests"
DESTINATION "${CMAKE_INSTALL_DATADIR}"
FILE_PERMISSIONS
OWNER_READ OWNER_WRITE
Expand Down
6 changes: 3 additions & 3 deletions TheForceEngine/TFE_DarkForces/Actor/mousebot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ namespace TFE_DarkForces
local(tick) = s_curTick;
}
else
{
{
Tick dt = s_curTick - local(tick);
// If enough time has past since the player was last spotted, go back to sleep.
if (dt > 728) // ~5 seconds.
Expand All @@ -164,8 +164,8 @@ namespace TFE_DarkForces
{
local(odd) = (s_curTick & 1) ? JTRUE : JFALSE;
angle14_32 deltaYaw = random(16338);
local(moveMod)->target.yaw = local(odd) ? (local(obj)->yaw + deltaYaw) : (local(obj)->yaw - deltaYaw);

local(moveMod)->target.yaw = local(odd) ? (local(obj)->yaw + deltaYaw) : (local(obj)->yaw - deltaYaw);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it is my turn to nit pick :-)
There seem to be a lot of this in your diffs -- meaningless whitespaces added to lines
I think it would be good to revert as many of them as possible, so your PR commit does not have a whole lot of unnecessary diffs
(Would help in the future if anybody, including yourself, needs to search through the diff while bug hunting etc.)

local(moveMod)->target.speedRotation = random(0x3555) + 0x555;
local(moveMod)->target.flags |= TARGET_MOVE_ROT;
local(flip) = JFALSE;
Expand Down
29 changes: 29 additions & 0 deletions TheForceEngine/TFE_DarkForces/GameUI/agentMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,35 @@ namespace TFE_DarkForces
menu_blitToScreen(s_framebuffer);
}

void agentMenu_setAgentName(const char* name)
{
if (s_agentId < 0 || s_agentId >= MAX_AGENT_COUNT)
{
return;
}
strncpy(s_agentData[s_agentId].name, name, 32);
}

s32 agentMenu_getAgentID()
{
return s_agentId;
}

void agentMenu_setAgentId(s32 id)
{
s_agentId = id;
}

void agentMenu_setAgentCount(s32 count)
{
s_agentCount = count;
}

s32 agentMenu_getAgentCount()
{
return s_agentCount;
}

void agentMenu_createNewAgent()
{
if (s_agentCount < MAX_AGENT_COUNT)
Expand Down
7 changes: 7 additions & 0 deletions TheForceEngine/TFE_DarkForces/GameUI/agentMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,12 @@ namespace TFE_DarkForces
void agentMenu_load(LangHotkeys* hotkeys);

// Reset Presistent State.

s32 agentMenu_getAgentID();
void agentMenu_setAgentId(s32 id);
void agentMenu_setAgentCount(s32 count);
s32 agentMenu_getAgentCount();
void agentMenu_createNewAgent();
void agentMenu_setAgentName(const char* name);
void agentMenu_resetState();
}
28 changes: 22 additions & 6 deletions TheForceEngine/TFE_DarkForces/GameUI/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <TFE_System/system.h>
#include <TFE_Jedi/Renderer/virtualFramebuffer.h>
#include <TFE_Jedi/Renderer/screenDraw.h>
#include <TFE_Input/replay.h>

using namespace TFE_Jedi;

Expand Down Expand Up @@ -62,16 +63,31 @@ namespace TFE_DarkForces
s32 mx, my;
TFE_Input::getMousePos(&mx, &my);
s_cursorPosAccum = { 12*mx/10, my }; // Account for 320x200 in 4:3 scaling.

if (displayInfo.width >= displayInfo.height)

// Load the replay PDA positions.
if (TFE_Input::isDemoPlayback())
{
s_cursorPos.x = clamp(s_cursorPosAccum.x * (s32)height / (s32)displayInfo.height, 0, (s32)width - 3);
s_cursorPos.z = clamp(s_cursorPosAccum.z * (s32)height / (s32)displayInfo.height, 0, (s32)height - 3);
Vec2i pdap = TFE_Input::getPDAPosition();
s_cursorPos = pdap;
}
else
{
s_cursorPos.x = clamp(s_cursorPosAccum.x * (s32)width / (s32)displayInfo.width, 0, (s32)width - 3);
s_cursorPos.z = clamp(s_cursorPosAccum.z * (s32)width / (s32)displayInfo.width, 0, (s32)height - 3);
if (displayInfo.width >= displayInfo.height)
{
s_cursorPos.x = clamp(s_cursorPosAccum.x * (s32)height / (s32)displayInfo.height, 0, (s32)width - 3);
s_cursorPos.z = clamp(s_cursorPosAccum.z * (s32)height / (s32)displayInfo.height, 0, (s32)height - 3);
}
else
{
s_cursorPos.x = clamp(s_cursorPosAccum.x * (s32)width / (s32)displayInfo.width, 0, (s32)width - 3);
s_cursorPos.z = clamp(s_cursorPosAccum.z * (s32)width / (s32)displayInfo.width, 0, (s32)height - 3);
}
}

// Store the PDA positions for replay.
if (TFE_Input::isRecording())
{
TFE_Input::storePDAPosition(s_cursorPos);
}
}

Expand Down
46 changes: 31 additions & 15 deletions TheForceEngine/TFE_DarkForces/GameUI/pda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
#include <TFE_Jedi/Level/rfont.h>
#include <TFE_Jedi/Renderer/jediRenderer.h>
#include <TFE_Settings/settings.h>
#include <TFE_System/system.h>
#include <TFE_Input/replay.h>
#include <TFE_Input/inputMapping.h>

using namespace TFE_Jedi;
using namespace TFE_Input;
Expand Down Expand Up @@ -126,7 +127,7 @@ namespace TFE_DarkForces
// TFE
reticle_enable(false);
s_mouseAccum = { 0 };

mouseOldPosX = 0, mouseOldPosZ = 0;
pauseLevelSound();
if (!s_pdaLoaded)
{
Expand Down Expand Up @@ -160,6 +161,7 @@ namespace TFE_DarkForces
s_briefingMaxY = -BRIEF_VERT_MARGIN;
}
s_briefY = -BRIEF_VERT_MARGIN;

}
s_overlayRect = s_pdaRect;

Expand All @@ -169,7 +171,7 @@ namespace TFE_DarkForces
}
s_framebuffer = ldraw_getBitmap();
lcanvas_getBounds(&s_viewBounds);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another one

s_pdaArt = lactorAnim_load("pda", &s_viewBounds, 0, 0, 0);
s_palette = lpalette_load("menu");
lactor_setTime(s_pdaArt, -1, -1);
Expand Down Expand Up @@ -210,6 +212,12 @@ namespace TFE_DarkForces
pda_resetState();
}

// Reset the tab to the map to support replay consistency.
void pda_resetTab()
{
s_pdaMode = PDA_MODE_MAP;
}

void pda_resetState()
{
s_pdaOpen = JFALSE;
Expand Down Expand Up @@ -246,6 +254,7 @@ namespace TFE_DarkForces
TFE_Jedi::renderer_setType(RendererType(graphics->rendererIndex));
TFE_Jedi::renderer_setLimits();
}

}

void pda_update()
Expand All @@ -255,7 +264,10 @@ namespace TFE_DarkForces
return;
}

if (inputMapping_getActionState(IADF_PDA_TOGGLE) == STATE_PRESSED || TFE_Input::keyPressed(KEY_ESCAPE))
// Special case to support Escape during demo playback
if (inputMapping_getActionState(IADF_PDA_TOGGLE) == STATE_PRESSED
|| TFE_Input::keyPressed(KEY_ESCAPE)
|| inputMapping_getAction(IADF_MENU_TOGGLE) == STATE_PRESSED)
{
pda_close();
return;
Expand All @@ -277,10 +289,10 @@ namespace TFE_DarkForces
u32 outWidth, outHeight;
vfb_getResolution(&outWidth, &outHeight);
memset(vfb_getCpuBuffer(), 0, outWidth * outHeight);

// Draw the overlay *behind* the main view - which means we must blit it to the view.
pda_drawOverlay();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple more

// Finally draw the PDA background and UI controls.
lcanvas_eraseRect(&s_viewBounds);
lactor_setState(s_pdaArt, 0, 0);
Expand Down Expand Up @@ -351,12 +363,16 @@ namespace TFE_DarkForces
// Ensure that mouse movements are not lost between updates.
pda_handleMouseAccum(&wdx, &wdy);

// Ensure PDA key presses handle replay data
bool mouseDown = TFE_Input::isDemoPlayback() && inputMapping_getAction(IADF_PRIMARY_FIRE) == STATE_DOWN || TFE_Input::mouseDown(MBUTTON_LEFT);
bool mousePressed = TFE_Input::isDemoPlayback() && inputMapping_getAction(IADF_PRIMARY_FIRE) == STATE_PRESSED || TFE_Input::mousePressed(MBUTTON_LEFT);

// Handle Mouse Panning
if (TFE_Input::mouseDown(MBUTTON_LEFT))
if (mouseDown)
{
s32 mouseX, mouseZ;
TFE_Input::getMousePos(&mouseX, &mouseZ);

// Calculate deltas
fixed16_16 deltaX = (mouseX - mouseOldPosX) << 16;
fixed16_16 deltaZ = (mouseZ - mouseOldPosZ) << 16;
Expand All @@ -377,7 +393,7 @@ namespace TFE_DarkForces
mouseMoveReset = true;
}

if (TFE_Input::mousePressed(MBUTTON_LEFT) || s_simulatePressed >= 0 || wdy)
if (s_simulatePressed >= 0 || wdy || mousePressed)
{
s_buttonPressed = -1;
s32 count = (s_pdaMode == PDA_MODE_MAP || s_pdaMode == PDA_MODE_BRIEF) ? PDA_BTN_COUNT : PDA_BTN_EXIT + 1;
Expand All @@ -386,8 +402,8 @@ namespace TFE_DarkForces
lactor_setState(s_pdaArt, 2 * (1 + i), 0);
LRect buttonRect;
lactorAnim_getFrame(s_pdaArt, &buttonRect);

if (!TFE_Input::mousePressed(MBUTTON_LEFT))
if (!TFE_Input::mousePressed(MBUTTON_LEFT) && !mousePressed)
{
if (i == s_simulatePressed)
{
Expand All @@ -408,7 +424,7 @@ namespace TFE_DarkForces
}
}

if (s_pdaMode == PDA_MODE_MAP && (s_buttonPressed || wdy) && s_frameReady)
if (s_pdaMode == PDA_MODE_MAP && (s_buttonPressed || wdy || mousePressed) && s_frameReady)
{
// Add support for mouse wheel scrolling.
if (wdy < 0)
Expand Down Expand Up @@ -464,7 +480,7 @@ namespace TFE_DarkForces
} break;
}
}
else if (s_pdaMode == PDA_MODE_BRIEF && (s_buttonPressed || wdy) && s_frameReady)
else if (s_pdaMode == PDA_MODE_BRIEF && (s_buttonPressed || wdy || mousePressed) && s_frameReady)
{
// Add support for mouse wheel scrolling.
if (wdy > 0) // up
Expand Down Expand Up @@ -506,7 +522,7 @@ namespace TFE_DarkForces
}
}
}
else if (TFE_Input::mouseDown(MBUTTON_LEFT) && s_buttonPressed >= 0)
else if (mouseDown && s_buttonPressed >= 0)
{
lactor_setState(s_pdaArt, 2 * (1 + s_buttonPressed), 0);
LRect buttonRect;
Expand Down Expand Up @@ -850,7 +866,7 @@ namespace TFE_DarkForces
u32 outWidth, outHeight;
vfb_getResolution(&outWidth, &outHeight);
memset(vfb_getCpuBuffer(), 0, outWidth * outHeight);

u32 palette[256] = { 0 };
vfb_setPalette(palette);
}
Expand Down
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/GameUI/pda.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace TFE_DarkForces
void pda_start(const char* levelName);
void pda_cleanup();
void pda_resetState();
void pda_resetTab();

JBool pda_isOpen();
void pda_update();
Expand Down
6 changes: 5 additions & 1 deletion TheForceEngine/TFE_DarkForces/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ namespace TFE_DarkForces

void agent_serialize(Stream* stream);
void agent_restartEndLevelTask();

s32 agent_loadData();
JBool agent_loadLevelList(const char* fileName);
void agent_updateAgentSavedData();
void agent_levelEndTask();

JBool agent_readConfigData(FileStream* file, s32 agentId, LevelSaveData* saveData);
JBool agent_writeAgentConfigData(FileStream* file, s32 agentId, const LevelSaveData* saveData);
void agent_writeSavedData(s32 agentId, LevelSaveData* saveData);
void agent_readSavedData(s32 agentId, LevelSaveData* levelData);
void agent_readSavedDataForLevel(s32 agentId, s32 levelIndex);
void agent_saveLevelCompletion(u8 diff, s32 levelIndex);
s32 agent_saveInventory(s32 agentId, s32 nextLevel);
Expand All @@ -72,6 +74,8 @@ namespace TFE_DarkForces

void agent_levelComplete();
void agent_createLevelEndTask();

JBool createDarkPilotConfig(const char* path);

extern AgentData s_agentData[MAX_AGENT_COUNT];
extern s32 s_maxLevelIndex;
Expand Down
Loading