Skip to content
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

Replay system part 1 #379

Merged
merged 41 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c324647
record and replay srand() in an action log
NQNStudios May 26, 2024
5374a20
pre-declare action log vars/functions for global use
NQNStudios May 27, 2024
8ae1585
windows and linux record preferences at startup
NQNStudios May 27, 2024
a9f098d
don't save preferences when replaying
NQNStudios Jul 27, 2024
75bd1e9
allow providing base filename for log recording
NQNStudios Jun 13, 2024
aee9d8f
Reorganize global replay code
NQNStudios Jun 13, 2024
fead544
don't double-compile ticpp.cpp
NQNStudios Jun 13, 2024
77b73a9
all scons platforms add src include directories
NQNStudios Jun 13, 2024
8c63c4f
include string and sstream directly
NQNStudios Jun 13, 2024
d692f70
visual studio projects add new files
NQNStudios Jun 13, 2024
f50bfe4
try adding replay.cpp to xcode projects
NQNStudios Jun 13, 2024
c29931e
refactor without raw pointers
NQNStudios Jun 14, 2024
f508235
add cppcodec header library for base64
NQNStudios Jun 14, 2024
4349fb6
action log has_next_action()
NQNStudios Jun 14, 2024
8cee7a4
WIP encode and decode save files in action logs
NQNStudios Jun 14, 2024
63e7a07
put decoded replay save in tempDir
NQNStudios Jun 14, 2024
da76e16
finish_load_party()
NQNStudios Jun 14, 2024
f9a7615
add cppcodec to visual studio include paths
NQNStudios Jun 14, 2024
36a1e1d
xcode add cppcodec to search paths
NQNStudios Jun 14, 2024
aee878e
add src/tools to xcode header search path
NQNStudios Jun 14, 2024
edf7ca3
fix command-line arg docs
NQNStudios Jul 3, 2024
93fffe3
allow parsing locations
NQNStudios Jul 3, 2024
3eaa3fe
record movement actions
NQNStudios Jul 3, 2024
9961a09
no spaces after ifs
NQNStudios Jul 3, 2024
78b615d
only record movement in recording mode
NQNStudios Jul 3, 2024
b3cb33f
replay movement actions
NQNStudios Jul 3, 2024
3a79aac
allow recording action with multiple parameters
NQNStudios Jul 4, 2024
fd785fb
record clicks on dialog controls
NQNStudios Jul 4, 2024
e307bc8
allow peeking the type of next replay action
NQNStudios Jul 4, 2024
3d61a67
parse std::map of replay action info elements
NQNStudios Jul 4, 2024
eade4fd
replay control clicks in open dialogs
NQNStudios Jul 4, 2024
9d36086
pop_next_action() iterate through without actually removing
NQNStudios Jul 5, 2024
391fb3b
record and replay control focus events
NQNStudios Jul 5, 2024
2b68e13
record and replay startup button clicks
NQNStudios Jul 5, 2024
aab34a7
when replaying, don't open file browsers
NQNStudios Jul 5, 2024
5fec4e9
use nullptr
NQNStudios Jul 27, 2024
ded0a2f
use specific stringstream types
NQNStudios Jul 27, 2024
b4c300c
put extern forward-declarations first
NQNStudios Jul 27, 2024
43f1482
make pop_next_action() return a reference
NQNStudios Jul 28, 2024
cea3edd
throw error when checking next_action_type() of null
NQNStudios Jul 28, 2024
c935d55
throw std::strings
NQNStudios Jul 28, 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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
path = deps/TGUI
url = https://github.com/texus/TGUI.git
branch = 0.9
[submodule "deps/cppcodec"]
path = deps/cppcodec
url = https://github.com/tplgy/cppcodec
17 changes: 13 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,8 @@ elif platform == "win32":
vcpkg_other_libs = list(filter(path.exists, vcpkg_other_libs))
vcpkg_other_bins = [path.join(d.get_abspath(), 'bin') for d in vcpkg_other_packages]
vcpkg_other_bins = list(filter(path.exists, vcpkg_other_bins))
project_includes = []
for (root, dirs, files) in os.walk('src'):
project_includes.append(path.join(os.getcwd(), root))

include_paths=[path.join(vcpkg_installed, 'include')] + vcpkg_other_includes + project_includes
include_paths=[path.join(vcpkg_installed, 'include')] + vcpkg_other_includes
env.Append(
LINKFLAGS=['/SUBSYSTEM:WINDOWS','/ENTRY:mainCRTStartup',f'/MACHINE:X{arch_short}'],
CXXFLAGS=['/EHsc','/MD','/FIglobal.hpp'],
Expand Down Expand Up @@ -358,6 +355,12 @@ if not env.GetOption('clean'):
# If building the tests, make sure Catch2 is cloned
if 'test' in targets and not path.exists('deps/Catch2/README.md'):
subprocess.call(["git", "submodule", "update", "--init", "deps/Catch2"])

# Make sure cppcodec is cloned
if not path.exists('deps/cppcodec/README.md'):
subprocess.call(["git", "submodule", "update", "--init", "deps/cppcodec"])

env.Append(CPPPATH=[path.join(os.getcwd(), 'deps/cppcodec')])

# On Linux, build TGUI from the subtree if necessary
if platform == 'posix':
Expand Down Expand Up @@ -385,6 +388,12 @@ if not env.GetOption('clean'):

env.Append(CPPDEFINES=["TIXML_USE_TICPP"])

project_includes = []
for (root, dirs, files) in os.walk('src'):
project_includes.append(path.join(os.getcwd(), root))

env.Append(CPPPATH=project_includes)

if platform == "win32":
# For the *resource.h headers
env.Append(CPPPATH=["#rsrc/menus"])
Expand Down
1 change: 1 addition & 0 deletions deps/cppcodec
Submodule cppcodec added at 8019b8
6 changes: 4 additions & 2 deletions proj/vs2013/Common/Common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
<ClCompile Include="..\..\..\src\tools\drawable_manager.cpp" />
<ClCompile Include="..\..\..\src\tools\menu_accel.win.cpp" />
<ClCompile Include="..\..\..\src\tools\prefs.win.cpp" />
<ClCompile Include="..\..\..\src\tools\replay.cpp" />
<ClCompile Include="..\..\..\src\tools\undo.cpp" />
<ClCompile Include="..\..\..\src\tools\keymods.cpp" />
<ClCompile Include="..\..\..\src\tools\winutil.win.cpp" />
Expand Down Expand Up @@ -349,6 +350,7 @@
<ClInclude Include="..\..\..\src\tools\gitrev.hpp" />
<ClInclude Include="..\..\..\src\tools\menu_accel.win.hpp" />
<ClInclude Include="..\..\..\src\tools\prefs.hpp" />
<ClInclude Include="..\..\..\src\tools\replay.hpp" />
<ClInclude Include="..\..\..\src\tools\undo.hpp" />
<ClInclude Include="..\..\..\src\tools\vector2d.hpp" />
<ClInclude Include="..\..\..\src\tools\keymods.hpp" />
Expand Down Expand Up @@ -405,7 +407,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;TIXML_USE_TICPP;%(PreprocessorDefinitions);_DEBUG</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\deps\cppcodec;$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<AdditionalOptions>/FS %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4800;4290;4244;4996;4018</DisableSpecificWarnings>
Expand Down Expand Up @@ -434,7 +436,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;TIXML_USE_TICPP;%(PreprocessorDefinitions);NDEBUG</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\deps\cppcodec;$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
<DisableSpecificWarnings>4800;4290;4244;4996;4018</DisableSpecificWarnings>
Expand Down
10 changes: 6 additions & 4 deletions proj/vs2017/Common/Common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<PreprocessorDefinitions>WIN32;_WINDOWS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;TIXML_USE_TICPP;%(PreprocessorDefinitions);NOMINMAX</PreprocessorDefinitions>
<AdditionalUsingDirectories>
</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\deps\cppcodec;$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
Expand All @@ -103,7 +103,7 @@
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_WINDOWS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;TIXML_USE_TICPP;%(PreprocessorDefinitions);NOMINMAX</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\deps\cppcodec;$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
<ForcedIncludeFiles>$(SolutionDir)..\..\src\global.hpp</ForcedIncludeFiles>
</ClCompile>
<Link>
Expand All @@ -126,7 +126,7 @@
<PreprocessorDefinitions>WIN32;_WINDOWS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;TIXML_USE_TICPP;%(PreprocessorDefinitions);NOMINMAX</PreprocessorDefinitions>
<AdditionalUsingDirectories>
</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\deps\cppcodec;$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
Expand All @@ -146,7 +146,7 @@
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_WINDOWS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;TIXML_USE_TICPP;%(PreprocessorDefinitions);NOMINMAX</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\deps\cppcodec;$(SolutionDir)..\..\src\fileio\gzstream;$(SolutionDir)..\..\src\fileio\xml-parser;$(SolutionDir)..\..\src\fileio\resmgr;$(SolutionDir)..\..\src\dialogxml\widgets;$(SolutionDir)..\..\src\dialogxml\dialogs;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\tools;$(SolutionDir)..\..\src\scenario;$(SolutionDir)..\..\src\universe;$(SolutionDir)..\..\src\fileio;$(SolutionDir)..\..\src\dialogxml;$(SolutionDir)..\..\src\gfx;$(SolutionDir)..\..\src</AdditionalIncludeDirectories>
<ForcedIncludeFiles>$(SolutionDir)..\..\src\global.hpp</ForcedIncludeFiles>
</ClCompile>
<Link>
Expand Down Expand Up @@ -408,6 +408,7 @@
<ClCompile Include="..\..\..\src\tools\framerate_limiter.cpp" />
<ClCompile Include="..\..\..\src\tools\menu_accel.win.cpp" />
<ClCompile Include="..\..\..\src\tools\prefs.win.cpp" />
<ClCompile Include="..\..\..\src\tools\replay.cpp" />
<ClCompile Include="..\..\..\src\tools\undo.cpp" />
<ClCompile Include="..\..\..\src\tools\keymods.cpp" />
<ClCompile Include="..\..\..\src\tools\winutil.win.cpp" />
Expand Down Expand Up @@ -498,6 +499,7 @@
<ClInclude Include="..\..\..\src\tools\gitrev.hpp" />
<ClInclude Include="..\..\..\src\tools\menu_accel.win.hpp" />
<ClInclude Include="..\..\..\src\tools\prefs.hpp" />
<ClInclude Include="..\..\..\src\tools\replay.hpp" />
<ClInclude Include="..\..\..\src\tools\undo.hpp" />
<ClInclude Include="..\..\..\src\tools\vector2d.hpp" />
<ClInclude Include="..\..\..\src\tools\keymods.hpp" />
Expand Down
8 changes: 8 additions & 0 deletions proj/xc12/BoE.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
91FCC8F418FF0866007026CE /* pc.appleevents.mm in Sources */ = {isa = PBXBuildFile; fileRef = 91FCC8F318FF069A007026CE /* pc.appleevents.mm */; };
91FD417423DFC9D4003D5B8A /* boe.ui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91FD417223DFC5C1003D5B8A /* boe.ui.cpp */; };
91FE0E3823F084B70084CA6B /* drawable_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91FE0E3523F084B70084CA6B /* drawable_manager.cpp */; };
D384F6A32C1B9D4000A806C3 /* replay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D384F6A22C1B9D4000A806C3 /* replay.cpp */; };
DCCA42001A8C467000E6A9A5 /* SFML.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 91F6F8E218F87F3700E3EA15 /* SFML.framework */; };
DCCA42021A8C467800E6A9A5 /* libz.1.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = DCCA42011A8C467800E6A9A5 /* libz.1.tbd */; };
DCCA42031A8C469400E6A9A5 /* libz.1.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = DCCA42011A8C467800E6A9A5 /* libz.1.tbd */; };
Expand Down Expand Up @@ -895,6 +896,7 @@
91FE0E3623F084B70084CA6B /* drawable_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drawable_manager.hpp; sourceTree = "<group>"; };
91FE0E3723F084B70084CA6B /* event_listener.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = event_listener.hpp; sourceTree = "<group>"; };
91FE0E3B23F084C60084CA6B /* drawable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drawable.hpp; sourceTree = "<group>"; };
D384F6A22C1B9D4000A806C3 /* replay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = replay.cpp; sourceTree = "<group>"; };
DCCA42011A8C467800E6A9A5 /* libz.1.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.1.tbd; path = ../MacOSX.sdk/usr/lib/libz.1.tbd; sourceTree = SDKROOT; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -1251,6 +1253,7 @@
9185BDA11EA041570027C346 /* tools */ = {
isa = PBXGroup;
children = (
D384F6A22C1B9D4000A806C3 /* replay.cpp */,
91C688E70FD702B9000F6D01 /* cursors.mac.mm */,
91FE0E3523F084B70084CA6B /* drawable_manager.cpp */,
91F3204E23E65EA3009650AF /* framerate_limiter.cpp */,
Expand Down Expand Up @@ -2065,6 +2068,7 @@
919CC27D1B37743700273FDA /* tarball.cpp in Sources */,
919CC27E1B37743B00273FDA /* undo.cpp in Sources */,
919CC27F1B37744000273FDA /* winutil.mac.mm in Sources */,
D384F6A32C1B9D4000A806C3 /* replay.cpp in Sources */,
915AF9E81BBF8B5C008AEF49 /* scrollpane.cpp in Sources */,
91E128E71BC1E6DD00C8BE1D /* basicbtns.cpp in Sources */,
91E128ED1BC2076B00C8BE1D /* 3choice.cpp in Sources */,
Expand Down Expand Up @@ -2309,9 +2313,11 @@
/usr/local/include,
/opt/local/include,
/usr/local/Cellar/include,
"$(PROJECT_DIR)/../../deps/cppcodec",
"$(PROJECT_DIR)/../../deps/Catch2/single_include",
"$(PROJECT_DIR)/../../src/fileio/gzstream",
"$(PROJECT_DIR)/../../src/fileio/xml-parser",
"$(PROJECT_DIR)/../../src/tools"
);
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
LIBRARY_SEARCH_PATHS = (
Expand Down Expand Up @@ -2419,9 +2425,11 @@
/usr/local/include,
/opt/local/include,
/usr/local/Cellar/include,
"$(PROJECT_DIR)/../../deps/cppcodec",
"$(PROJECT_DIR)/../../deps/Catch2/single_include",
"$(PROJECT_DIR)/../../src/fileio/gzstream",
"$(PROJECT_DIR)/../../src/fileio/xml-parser",
"$(PROJECT_DIR)/../../src/tools"
);
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
LIBRARY_SEARCH_PATHS = (
Expand Down
2 changes: 2 additions & 0 deletions proj/xc4/BoE.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@
91FE0E3623F084B70084CA6B /* drawable_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drawable_manager.hpp; sourceTree = "<group>"; };
91FE0E3723F084B70084CA6B /* event_listener.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = event_listener.hpp; sourceTree = "<group>"; };
91FE0E3B23F084C60084CA6B /* drawable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drawable.hpp; sourceTree = "<group>"; };
D384F6A12C1B9CE900A806C3 /* replay.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = replay.cpp; sourceTree = "<group>"; };
DCCA42011A8C467800E6A9A5 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -1214,6 +1215,7 @@
9185BDA11EA041570027C346 /* tools */ = {
isa = PBXGroup;
children = (
D384F6A12C1B9CE900A806C3 /* replay.cpp */,
91C688E70FD702B9000F6D01 /* cursors.mac.mm */,
91FE0E3523F084B70084CA6B /* drawable_manager.cpp */,
91F3204E23E65EA3009650AF /* framerate_limiter.cpp */,
Expand Down
20 changes: 19 additions & 1 deletion src/dialogxml/dialogs/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <cmath>
#include <stdexcept>
#include <functional>
#include <sstream>
#include "dialog.hpp"
#include "gfx/tiling.hpp" // for bg
#include "fileio/resmgr/res_dialog.hpp"
Expand All @@ -27,6 +28,7 @@
#include "tools/cursors.hpp"
#include "tools/prefs.hpp"
#include "tools/framerate_limiter.hpp"
#include "replay.hpp"

using namespace std;
using namespace ticpp;
Expand Down Expand Up @@ -534,7 +536,23 @@ void cDialog::handle_events() {
cFramerateLimiter fps_limiter;

while(dialogNotToast) {
while(win.pollEvent(currentEvent)) handle_one_event(currentEvent);
if(replaying){
if(next_action_type() == "control_click"){
Element* next_action = pop_next_action();
auto info = info_from_action(next_action);
eKeyMod mods = static_cast<eKeyMod>(atoi(info["mods"].c_str()));
controls[info["id"]]->triggerClickHandler(*this, info["id"], mods);
}else if(next_action_type() == "control_focus"){
Element* next_action = pop_next_action();
auto info = info_from_action(next_action);
bool losing;
istringstream sstr(info["losing"]);
sstr >> losing;
controls[info["id"]]->triggerFocusHandler(*this, info["id"], losing);
}
}else{
while(win.pollEvent(currentEvent)) handle_one_event(currentEvent);
}

// Ideally, this should be the only draw call that is done in a cycle.
draw();
Expand Down
13 changes: 13 additions & 0 deletions src/dialogxml/widgets/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "mathutil.hpp"
#include "tools/prefs.hpp"
#include "tools/cursors.hpp"
#include "replay.hpp"

void cControl::setText(std::string l){
lbl = l;
Expand Down Expand Up @@ -347,11 +348,23 @@ bool cControl::haveHandler(eDlogEvt t) const {
}

bool cControl::triggerClickHandler(cDialog& dlg, std::string id, eKeyMod mods){
if(recording){
std::stringstream sstr;
sstr << mods;
std::map<std::string, std::string> action_info = {{"id", id}, {"mods", sstr.str()}};
record_action("control_click", action_info);
}
triggerEvent<EVT_CLICK>(dlg, id, mods);
return true;
}

bool cControl::triggerFocusHandler(cDialog& dlg, std::string id, bool losing){
if(recording){
std::stringstream sstr;
sstr << losing;
std::map<std::string, std::string> action_info = {{"id", id}, {"losing", sstr.str()}};
record_action("control_focus", action_info);
}
if(losing) return triggerEvent<EVT_DEFOCUS>(dlg, id);
triggerEvent<EVT_FOCUS>(dlg, id);
return true;
Expand Down
Loading