-
Notifications
You must be signed in to change notification settings - Fork 77
Replays POC #492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Replays POC #492
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 9ba869b
Added more debug logs and update tick recording
Karjala22 5d4f089
Working version of replays.
Karjala22 f9b9a33
Working version of demo replays. Still rare issues with long term rep…
Karjala22 c647178
Add replay POC
Karjala22 f705b90
Temp muting logging for events
Karjala22 e425b75
updating projet files
Karjala22 e47d5d1
Updating Cmakelist
Karjala22 c6cd639
updating project and merging some files
Karjala22 83728b3
Ignoring modcache
Karjala22 fef63e9
Merge of 1.15 code
Karjala22 83b0bba
More logging cleanup and simplifying code.
Karjala22 bde3e4f
More merging of the 1.15 code.
Karjala22 e8638e7
Additional Merging
Karjala22 52360e6
updating ui and filters
Karjala22 5759a7c
ensuring version is 141 instead of 143
Karjala22 a4af801
Merge branch 'master' into replays
ifeldshteyn 7a3c270
Removing sdl import
Karjala22 3dd429a
Merge branch 'replays' of https://github.com/ifeldshteyn/TheForceEngi…
Karjala22 bbcf767
Removed unused dependencies
Karjala22 c43f888
Removing unreachable code
Karjala22 5832e6d
Removing inused includes
Karjala22 62ce1ac
Updating strcpy call
Karjala22 d02c738
Don't open folder in linux
Karjala22 01a0ba0
Remove stale replay logging
Karjala22 cc3af63
Fix up pathing for linux
Karjala22 8ebfd45
Updating UI to support linux and change the mod checking behavior for…
Karjala22 1068024
Change functinoality of mod checker.
Karjala22 8589ab6
temp debug logging
Karjala22 dd96465
Rewriting log
Karjala22 c0d9f68
Fix for linux paths and sorting
Karjala22 f82ef82
Clean up some empty space - make it look nicer on linux.
Karjala22 2c2b8e2
Updating version - removing eye requirement in the events - adding re…
Karjala22 845f893
Add logging toggle for replays
Karjala22 f885f53
update linux offsets
Karjala22 5b40dd2
Change playback counter
Karjala22 c53709e
Adding append more for filestreaming.
Karjala22 0da2621
fix log
Karjala22 511e44e
never skip priority by default
Karjala22 63c1166
Adding an option to run a replay via commandline. Also add parameter …
Karjala22 674ab36
adding param to auto exit.
Karjala22 7ffed3a
Adding latest editor changes from master.
Karjala22 d225050
Merge of 1.15 code
Karjala22 d530d12
Minor cleanup
Karjala22 626fe4a
Removing spurious log messages
Karjala22 60cb5e3
Adding replay test mechanism
Karjala22 de69d8e
Ignore any replays
Karjala22 f967481
fixing tests workflow
Karjala22 36e00f0
Fix path
Karjala22 a3ac19e
more debug
Karjala22 3918af2
more workflow testing
Karjala22 a985321
More workflow debugging
Karjala22 ea75130
More testing
Karjala22 54df93d
workflow fix
Karjala22 cc3832b
more bug fixing
Karjala22 8a98030
more workflow testing
Karjala22 f86f99d
more workflow test
Karjala22 11f692a
add cmake Tests folder
Karjala22 ebd2126
testing
Karjala22 7d7408b
updating
Karjala22 d408ada
more tests
Karjala22 83ac59a
top fix
Karjala22 d7af3dd
test
Karjala22 c090e8b
log is ignored - changing to txt
Karjala22 91f9b34
Disable tests through actions.
Karjala22 24704d7
Remove mousebot and turret number checking
Karjala22 fc68b8a
Added testing
Karjala22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -126,7 +127,7 @@ namespace TFE_DarkForces | |
// TFE | ||
reticle_enable(false); | ||
s_mouseAccum = { 0 }; | ||
|
||
mouseOldPosX = 0, mouseOldPosZ = 0; | ||
pauseLevelSound(); | ||
if (!s_pdaLoaded) | ||
{ | ||
|
@@ -160,6 +161,7 @@ namespace TFE_DarkForces | |
s_briefingMaxY = -BRIEF_VERT_MARGIN; | ||
} | ||
s_briefY = -BRIEF_VERT_MARGIN; | ||
|
||
} | ||
s_overlayRect = s_pdaRect; | ||
|
||
|
@@ -169,7 +171,7 @@ namespace TFE_DarkForces | |
} | ||
s_framebuffer = ldraw_getBitmap(); | ||
lcanvas_getBounds(&s_viewBounds); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
@@ -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; | ||
|
@@ -246,6 +254,7 @@ namespace TFE_DarkForces | |
TFE_Jedi::renderer_setType(RendererType(graphics->rendererIndex)); | ||
TFE_Jedi::renderer_setLimits(); | ||
} | ||
|
||
} | ||
|
||
void pda_update() | ||
|
@@ -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; | ||
|
@@ -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(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
@@ -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; | ||
|
@@ -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; | ||
|
@@ -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) | ||
{ | ||
|
@@ -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) | ||
|
@@ -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 | ||
|
@@ -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; | ||
|
@@ -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); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.)