diff --git a/.efrocachemap b/.efrocachemap index 29edee20..64defef2 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3995,50 +3995,50 @@ "assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e", "assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34", "ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a", - "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/33/fa/2b4dc04a7e94af821486c0baaadd", - "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/39/c0/0a8c20d90b3bb0b605f56cf57cd6", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9d/9e/36bc9196a661b7ac730309363b25", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/78/61/3ee51d8c85ac897cb48326059f4f", - "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/41/24/ea579f7f46ee8764b99aa1f740e6", - "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d7/79/db7ba776fe53a432f501cc524f29", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/67/8c/fd54c4640fe9574c819eb93235de", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d0/23/0ed4f59b045bd996e9e8c3adac25", - "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/7b/7a/65e4a1a866aa716f339934316888", - "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/4c/96/40086b7256c6b69500231234816f", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/25/4e/65658e3b1137e29c26e5a250cb7f", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a4/d3/9e94f9f4a3f326ab3fb4563605e8", - "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/70/82/54ac546d3d6404259c025e4697a6", - "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/8c/71/35e658ed48d1732ac1ace9a651d0", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cb/c1/66f115696b5694b203d2a3e3f3b6", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/76/7e/ef8ca6f4baae2d3540658a43238e", - "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/e5/01/48f01b3bfb0e11dfa298809751d6", - "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/4e/35/3e14be7308b3b8a4d7ee00223d02", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/2f/8d/5bf66b9999ac4a0b109ce6a93ee9", - "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/6f/ba/6814ccb61a86032c381b59092b92", - "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e0/b3/7ccccfd8721033582cabdfe11f73", + "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c7/7c/11757954adb7da34c0e8cb6a6470", + "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/30/4e/361603ee5faf75168ddefd070b44", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b6/2e/e3bd12f2c9e7baa173479686485d", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1e/fe/0f73516a00159f6cd4b4791f010d", + "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/60/a4/f6798a377123b4f0ea58067173b9", + "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/60/0d/772009d20e18def687f6b76021f8", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ec/98/ca24d22fa6870cf2fa4b1dc81e2a", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ab/71/616a553794306a406be45697895c", + "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/41/14/bae7db8e7361d538096253c36792", + "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/91/5f/d2bfb2b30befdae9270a119d51b5", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d8/07/bd414612e9bf05f2a3c0b531a552", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/49/64/5943868e08758fc103e8ce70f334", + "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/1a/a9/bae1d4c1840d6e4c1931c529e4f8", + "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/22/a9/75669c9a475fc8080ce422ce2baa", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e1/87/95cbc6fc53e43e206f43eb3a1c61", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a4/1b/9a6145a32ef40fd3b8357cfbfb30", + "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/6a/a5/5afd24a1043a652af8ae76ec33ea", + "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/dd/3a/71c400bbac9edc5fa7b63e099ae7", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/dc/18/7e47d66f054e81314b39c14b26dc", + "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/43/25/36e8e8fc1eac369727f9639bbcf9", + "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e7/25/6fb628f1f5260834692bdeab63b0", "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/d2/d18cbc017a7d64001f96718cc5ed", - "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/64/9b/78cdb9eda7b30611774769859caa", + "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8e/e5/cfbcc97e2b8c7ee46d0422e54380", "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/06/70/9e5becbdf873ea42fae9541dd123", - "build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8e/1b/8a766948a66967084da94255ad51", + "build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0d/18/6a515fce87613b2293a8f7bf1a35", "build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a3/47/f46d4455e6ee1ebb397508495d90", - "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/54/ea/a250bddec2d7285ea5f4e9a29864", + "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/14/49/890119e5ff8800edf3b3cda113df", "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4c/32/de6296fdbd72d6a82d47a2403efd", - "build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d2/1d/c111bdf386178fd46eff2c5a8cff", - "build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3b/a5/e0aa43ca227c6bfa2ae8f44add14", - "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b5/6d/7506bdad0891a0e7cb6d04c6b018", - "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/95/bc/affcb077742c90c9d51fd2dc4274", - "build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/cd/c2/72b9276880eddb6121542c052b1d", - "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c8/d2/5df66f66e26c1beb8a1e2b1f0613", - "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7e/57/593e8ceeee37a65972f1fb30d2cd", - "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2f/fc/a2ac394899e6527f8def0cad4d8a", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/b9/00/54be93a362cac005b111902cf725", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/cf/33/0aba47dbe0848b9a0fe65e3fe5ac", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/7f/a5/705f0b9b047d439d7b8805e684a1", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/e1/11/91da47c90faced11f80ce365e6ca", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/f0/47/fec8d08adc467bc46516ce39423a", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/c0/cb/36553e332fb3297e8f632387fdbb", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/a7/96/f19a4cc19386511d732533ead3d3", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/0c/23/5d5da73cd643d4fb344849768bf3", + "build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/89/94/c90bb234585a62a097c6f6642e7d", + "build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/39/2c/773ff4c64734bcd6205080a0563d", + "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0c/18/4a032d351000cf732bb7494d85f7", + "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4b/9d/be9915b6f1f1a0d83ae11885bd42", + "build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/31/d2/e658b66d64c828f85d84a9b0d482", + "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/31/26/5c531133795d1381ced85e519b10", + "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/24/4f/c0a11a834ae10e9706bf92879d23", + "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a3/c6/d9b0509fe23a07de2ccee6ba1fd4", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/1b/93/23b7d341894fb875acaefe0804c5", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/86/e1/65b4096af71168842a99278708da", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/d8/91/3b918141edeaeb3034e558f54246", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/74/ff/12db4137ed498dbbffd892c5000f", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/41/0a/18695d2503c1062d7b2f47c88380", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/2d/59/5bd72f8f691f041059cab3df99d5", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/3b/63/7eeb46b7832e1135e58345866abf", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/89/e4/0b7890024077f73e328b20b543f5", "src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7", "src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/98/12/571b2160d69d42580e8f31fa6a8d" } \ No newline at end of file diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index 013a0841..06bafff1 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -433,6 +433,7 @@ clrhdr clrnames clrred + cmakelist cmakelists cmakeserver cmath diff --git a/CHANGELOG.md b/CHANGELOG.md index ccf592e0..41ea3be9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.7 (build 20806, api 7, 2022-09-10) +### 1.7.7 (build 20809, api 7, 2022-09-10) - Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread. - Improved logging of missing playlist game types. - Some ba.Lstr functionality can now be used in background threads. @@ -20,8 +20,9 @@ - There is now a `_bainternal.py` dummy-module alongside the existing `_ba.py` one. Be sure to exclude it from any script collections used by the game (the same as `_ba.py`). - Added checks to make sure _ba or _bainternal arent used outside of ba. Any 'internal' functionality needed outside of ba should be exposed through ba.internal. _ba and _bainternal are internal implementation details. - Removed C++ Module class and simplified Thread class. The Module class was an old relic of long ago before C++ had lambdas and its existence was pretty pointless and confusing these days. -- Renamed C++ App to AppFlavor and AppGlobals to App -- Renamed C++ Media to Assets +- Renamed C++ App to AppFlavor and AppGlobals to App. +- Renamed C++ Media to Assets. +- Removed 'scores to beat' list in coop which was only ever functional in limited cases on the Mac version. Perhaps that feature can reappear in a cross-platform way sometime. ### 1.7.6 (build 20687, api 7, 2022-08-11) - Cleaned up da MetaSubsystem code. diff --git a/Makefile b/Makefile index 53284308..59935c80 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,10 @@ help: # Set env-var BA_ENABLE_IRONY_BUILD_DB=1 to enable creating/updating a # cmake compile-commands database for use with irony for emacs (and possibly # other tools). +# FIXME - this can break if we move/rename files and then run 'make update' +# because it tries to use the previous cmakelist with the no-longer-valid +# filename *before* it updates the cmakelist. Need to rethink order of +# operations there. ifeq ($(BA_ENABLE_IRONY_BUILD_DB),1) PREREQ_IRONY = .cache/irony/compile_commands.json endif diff --git a/assets/src/ba_data/python/._bainternal_sources_hash b/assets/src/ba_data/python/._bainternal_sources_hash index 4f751038..1da66812 100644 --- a/assets/src/ba_data/python/._bainternal_sources_hash +++ b/assets/src/ba_data/python/._bainternal_sources_hash @@ -1 +1 @@ -319717366410279141138094934973337011486 \ No newline at end of file +174884230264825984620020844009502663721 \ No newline at end of file diff --git a/assets/src/ba_data/python/ba/_bootstrap.py b/assets/src/ba_data/python/ba/_bootstrap.py index bb1b9804..3b9fd900 100644 --- a/assets/src/ba_data/python/ba/_bootstrap.py +++ b/assets/src/ba_data/python/ba/_bootstrap.py @@ -38,7 +38,7 @@ def bootstrap() -> None: # Give a soft warning if we're being used with a different binary # version than we expect. - expected_build = 20806 + expected_build = 20809 running_build: int = env['build_number'] if running_build != expected_build: print( diff --git a/assets/src/ba_data/python/ba/_coopgame.py b/assets/src/ba_data/python/ba/_coopgame.py index ecae427b..6e380d84 100644 --- a/assets/src/ba_data/python/ba/_coopgame.py +++ b/assets/src/ba_data/python/ba/_coopgame.py @@ -55,19 +55,6 @@ class CoopGameActivity(GameActivity[PlayerType, TeamType]): # Preload achievement images in case we get some. _ba.timer(2.0, WeakCall(self._preload_achievements)) - # Let's ask the server for a 'time-to-beat' value. - levelname = self._get_coop_level_name() - campaign = self.session.campaign - assert campaign is not None - config_str = (str(len(self.players)) + 'p' + campaign.getlevel( - self.settings_raw['name']).get_score_version_string().replace( - ' ', '_')) - _ba.get_scores_to_beat(levelname, config_str, - WeakCall(self._on_got_scores_to_beat)) - - def _on_got_scores_to_beat(self, scores: list[dict[str, Any]]) -> None: - pass - def _show_standard_scores_to_beat_ui(self, scores: list[dict[str, Any]]) -> None: from efro.util import asserttype diff --git a/assets/src/ba_data/python/ba/internal.py b/assets/src/ba_data/python/ba/internal.py index d5b47820..fdf99803 100644 --- a/assets/src/ba_data/python/ba/internal.py +++ b/assets/src/ba_data/python/ba/internal.py @@ -9,16 +9,16 @@ defensively) in mods. from __future__ import annotations from _ba import ( - get_scores_to_beat, show_online_score_ui, set_ui_input_device, - is_party_icon_visible, getinputdevice, add_clean_frame_callback, - unlock_all_input, increment_analytics_count, set_debug_speed_exponent, - get_special_widget, get_qrcode_texture, get_string_height, - get_string_width, show_app_invite, appnameupper, lock_all_input, - open_file_externally, fade_screen, appname, have_incentivized_ad, - has_video_ads, workspaces_in_use, set_party_icon_always_visible, - connect_to_party, get_game_port, end_host_scanning, host_scan_cycle, - charstr, get_public_party_enabled, get_public_party_max_size, - set_public_party_name, set_public_party_max_size, set_authenticate_clients, + show_online_score_ui, set_ui_input_device, is_party_icon_visible, + getinputdevice, add_clean_frame_callback, unlock_all_input, + increment_analytics_count, set_debug_speed_exponent, get_special_widget, + get_qrcode_texture, get_string_height, get_string_width, show_app_invite, + appnameupper, lock_all_input, open_file_externally, fade_screen, appname, + have_incentivized_ad, has_video_ads, workspaces_in_use, + set_party_icon_always_visible, connect_to_party, get_game_port, + end_host_scanning, host_scan_cycle, charstr, get_public_party_enabled, + get_public_party_max_size, set_public_party_name, + set_public_party_max_size, set_authenticate_clients, set_public_party_enabled, reset_random_player_names, new_host_session, get_foreground_host_session, get_local_active_input_devices_count, get_ui_input_device, is_in_replay, set_replay_speed_exponent, @@ -78,7 +78,6 @@ from ba._internal import ( sign_out_v1, sign_in_v1, mark_config_dirty) __all__ = [ - 'get_scores_to_beat', 'show_online_score_ui', 'set_ui_input_device', 'is_party_icon_visible', diff --git a/assets/src/ba_data/python/bastd/activity/coopjoin.py b/assets/src/ba_data/python/bastd/activity/coopjoin.py index 3e60af76..b8cc8af5 100644 --- a/assets/src/ba_data/python/bastd/activity/coopjoin.py +++ b/assets/src/ba_data/python/bastd/activity/coopjoin.py @@ -10,7 +10,7 @@ import ba from ba.internal import JoinActivity if TYPE_CHECKING: - from typing import Any, Sequence + pass class CoopJoinActivity(JoinActivity): @@ -24,17 +24,6 @@ class CoopJoinActivity(JoinActivity): session = self.session assert isinstance(session, ba.CoopSession) - # Let's show a list of scores-to-beat for 1 player at least. - assert session.campaign is not None - level_name_full = (session.campaign.name + ':' + - session.campaign_level_name) - config_str = ('1p' + session.campaign.getlevel( - session.campaign_level_name).get_score_version_string().replace( - ' ', '_')) - ba.internal.get_scores_to_beat( - level_name_full, config_str, - ba.WeakCall(self._on_got_scores_to_beat)) - def on_transition_in(self) -> None: from bastd.actor.controlsguide import ControlsGuide from bastd.actor.text import Text @@ -53,143 +42,61 @@ class CoopJoinActivity(JoinActivity): position=(0, -95)).autoretain() ControlsGuide(delay=1.0).autoretain() - def _on_got_scores_to_beat(self, - scores: list[dict[str, Any]] | None) -> None: - # pylint: disable=too-many-locals - # pylint: disable=too-many-statements - from efro.util import asserttype - from bastd.actor.text import Text + ba.pushcall(self._show_remaining_achievements) - # Sort by originating date so that the most recent is first. - if scores is not None: - scores.sort(reverse=True, - key=lambda score: asserttype(score['time'], int)) + def _show_remaining_achievements(self) -> None: + from bastd.actor.text import Text # We only show achievements and challenges for CoopGameActivities. session = self.session assert isinstance(session, ba.CoopSession) gameinstance = session.get_current_game_instance() - if isinstance(gameinstance, ba.CoopGameActivity): - score_type = gameinstance.get_score_type() - if scores is not None: - achievement_challenges = [ - a for a in scores if a['type'] == 'achievement_challenge' - ] - score_challenges = [ - a for a in scores if a['type'] == 'score_challenge' - ] - else: - achievement_challenges = score_challenges = [] + if not isinstance(gameinstance, ba.CoopGameActivity): + return - delay = 1.0 - vpos = -140.0 - spacing = 25 - delay_inc = 0.1 + delay = 1.0 + vpos = -140.0 - def _add_t( - text: str | ba.Lstr, - h_offs: float = 0.0, - scale: float = 1.0, - color: Sequence[float] = (1.0, 1.0, 1.0, 0.46) - ) -> None: - Text(text, - scale=scale * 0.76, - h_align=Text.HAlign.LEFT, + # Now list our remaining achievements for this level. + assert self.session.campaign is not None + assert isinstance(self.session, ba.CoopSession) + levelname = (self.session.campaign.name + ':' + + self.session.campaign_level_name) + ts_h_offs = 60 + + if not (ba.app.demo_mode or ba.app.arcade_mode): + achievements = [ + a for a in ba.app.ach.achievements_for_coop_level(levelname) + if not a.complete + ] + have_achievements = bool(achievements) + achievements = [a for a in achievements if not a.complete] + vrmode = ba.app.vr_mode + if have_achievements: + Text(ba.Lstr(resource='achievementsRemainingText'), + host_only=True, + position=(ts_h_offs - 10, vpos), + transition=Text.Transition.FADE_IN, + scale=1.1 * 0.76, h_attach=Text.HAttach.LEFT, v_attach=Text.VAttach.TOP, - transition=Text.Transition.FADE_IN, - transition_delay=delay, - color=color, - position=(60 + h_offs, vpos)).autoretain() - - if score_challenges: - _add_t(ba.Lstr(value='${A}:', - subs=[('${A}', - ba.Lstr(resource='scoreChallengesText')) - ]), - scale=1.1) - delay += delay_inc - vpos -= spacing - for chal in score_challenges: - _add_t(str(chal['value'] if score_type == 'points' else ba. - timestring(int(chal['value']) * 10, - timeformat=ba.TimeFormat.MILLISECONDS - ).evaluate()) + ' (1 player)', - h_offs=30, - color=(0.9, 0.7, 1.0, 0.8)) - delay += delay_inc - vpos -= 0.6 * spacing - _add_t(chal['player'], - h_offs=40, - color=(0.8, 1, 0.8, 0.6), - scale=0.8) - delay += delay_inc - vpos -= 1.2 * spacing - vpos -= 0.5 * spacing - - if achievement_challenges: - _add_t(ba.Lstr( - value='${A}:', - subs=[('${A}', - ba.Lstr(resource='achievementChallengesText'))]), - scale=1.1) - delay += delay_inc - vpos -= spacing - for chal in achievement_challenges: - _add_t(str(chal['value']), - h_offs=30, - color=(0.9, 0.7, 1.0, 0.8)) - delay += delay_inc - vpos -= 0.6 * spacing - _add_t(chal['player'], - h_offs=40, - color=(0.8, 1, 0.8, 0.6), - scale=0.8) - delay += delay_inc - vpos -= 1.2 * spacing - vpos -= 0.5 * spacing - - # Now list our remaining achievements for this level. - assert self.session.campaign is not None - assert isinstance(self.session, ba.CoopSession) - levelname = (self.session.campaign.name + ':' + - self.session.campaign_level_name) - ts_h_offs = 60 - - if not (ba.app.demo_mode or ba.app.arcade_mode): - achievements = [ - a - for a in ba.app.ach.achievements_for_coop_level(levelname) - if not a.complete - ] - have_achievements = bool(achievements) - achievements = [a for a in achievements if not a.complete] - vrmode = ba.app.vr_mode - if have_achievements: - Text(ba.Lstr(resource='achievementsRemainingText'), + color=(1, 1, 1.2, 1) if vrmode else (0.8, 0.8, 1, 1), + shadow=1.0, + flatness=1.0 if vrmode else 0.6, + transition_delay=delay).autoretain() + hval = ts_h_offs + 50 + vpos -= 35 + for ach in achievements: + delay += 0.05 + ach.create_display(hval, vpos, delay, style='in_game') + vpos -= 55 + if not achievements: + Text(ba.Lstr(resource='noAchievementsRemainingText'), host_only=True, - position=(ts_h_offs - 10, vpos), + position=(ts_h_offs + 15, vpos + 10), transition=Text.Transition.FADE_IN, - scale=1.1 * 0.76, + scale=0.7, h_attach=Text.HAttach.LEFT, v_attach=Text.VAttach.TOP, - color=(1, 1, 1.2, 1) if vrmode else (0.8, 0.8, 1, 1), - shadow=1.0, - flatness=1.0 if vrmode else 0.6, - transition_delay=delay).autoretain() - hval = ts_h_offs + 50 - vpos -= 35 - for ach in achievements: - delay += 0.05 - ach.create_display(hval, vpos, delay, style='in_game') - vpos -= 55 - if not achievements: - Text(ba.Lstr(resource='noAchievementsRemainingText'), - host_only=True, - position=(ts_h_offs + 15, vpos + 10), - transition=Text.Transition.FADE_IN, - scale=0.7, - h_attach=Text.HAttach.LEFT, - v_attach=Text.VAttach.TOP, - color=(1, 1, 1, 0.5), - transition_delay=delay + 0.5).autoretain() + color=(1, 1, 1, 0.5), + transition_delay=delay + 0.5).autoretain() diff --git a/ballisticacore-cmake/.idea/dictionaries/ericf.xml b/ballisticacore-cmake/.idea/dictionaries/ericf.xml index 160953f7..597eda1d 100644 --- a/ballisticacore-cmake/.idea/dictionaries/ericf.xml +++ b/ballisticacore-cmake/.idea/dictionaries/ericf.xml @@ -230,6 +230,7 @@ clientinfo clienttobasn clipcount + cmakelist cmath cmds cmdvals diff --git a/ballisticacore-cmake/CMakeLists.txt b/ballisticacore-cmake/CMakeLists.txt index 68b79db8..34c4d99d 100644 --- a/ballisticacore-cmake/CMakeLists.txt +++ b/ballisticacore-cmake/CMakeLists.txt @@ -348,15 +348,12 @@ add_executable(ballisticacore ${BA_SRC_ROOT}/ballistica/game/friend_score_set.h ${BA_SRC_ROOT}/ballistica/game/game.cc ${BA_SRC_ROOT}/ballistica/game/game.h - ${BA_SRC_ROOT}/ballistica/game/game_stream.cc - ${BA_SRC_ROOT}/ballistica/game/game_stream.h ${BA_SRC_ROOT}/ballistica/game/host_activity.cc ${BA_SRC_ROOT}/ballistica/game/host_activity.h ${BA_SRC_ROOT}/ballistica/game/player.cc ${BA_SRC_ROOT}/ballistica/game/player.h ${BA_SRC_ROOT}/ballistica/game/player_spec.cc ${BA_SRC_ROOT}/ballistica/game/player_spec.h - ${BA_SRC_ROOT}/ballistica/game/score_to_beat.h ${BA_SRC_ROOT}/ballistica/game/session/client_session.cc ${BA_SRC_ROOT}/ballistica/game/session/client_session.h ${BA_SRC_ROOT}/ballistica/game/session/host_session.cc @@ -638,6 +635,8 @@ add_executable(ballisticacore ${BA_SRC_ROOT}/ballistica/scene/node/time_display_node.h ${BA_SRC_ROOT}/ballistica/scene/scene.cc ${BA_SRC_ROOT}/ballistica/scene/scene.h + ${BA_SRC_ROOT}/ballistica/scene/scene_stream.cc + ${BA_SRC_ROOT}/ballistica/scene/scene_stream.h ${BA_SRC_ROOT}/ballistica/ui/console.cc ${BA_SRC_ROOT}/ballistica/ui/console.h ${BA_SRC_ROOT}/ballistica/ui/root_ui.cc diff --git a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj index 82c02cee..3e188941 100644 --- a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj +++ b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj @@ -339,15 +339,12 @@ - - - @@ -629,6 +626,8 @@ + + diff --git a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters index 3644f340..ba9bcbbd 100644 --- a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters +++ b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters @@ -451,12 +451,6 @@ ballistica\game - - ballistica\game - - - ballistica\game - ballistica\game @@ -475,9 +469,6 @@ ballistica\game - - ballistica\game - ballistica\game\session @@ -1321,6 +1312,12 @@ ballistica\scene + + ballistica\scene + + + ballistica\scene + ballistica\ui diff --git a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj index cca83bf4..f99ff553 100644 --- a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj +++ b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj @@ -334,15 +334,12 @@ - - - @@ -624,6 +621,8 @@ + + diff --git a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters index 3644f340..ba9bcbbd 100644 --- a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters +++ b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters @@ -451,12 +451,6 @@ ballistica\game - - ballistica\game - - - ballistica\game - ballistica\game @@ -475,9 +469,6 @@ ballistica\game - - ballistica\game - ballistica\game\session @@ -1321,6 +1312,12 @@ ballistica\scene + + ballistica\scene + + + ballistica\scene + ballistica\ui diff --git a/src/ballistica/app/app_flavor.cc b/src/ballistica/app/app_flavor.cc index 37d59fc7..6d01350a 100644 --- a/src/ballistica/app/app_flavor.cc +++ b/src/ballistica/app/app_flavor.cc @@ -291,15 +291,6 @@ void AppFlavor::PushPurchaseAckCall(const std::string& purchase, [purchase, order_id] { g_platform->PurchaseAck(purchase, order_id); }); } -void AppFlavor::PushGetScoresToBeatCall(const std::string& level, - const std::string& config, - void* py_callback) { - thread()->PushCall([level, config, py_callback] { - assert(InMainThread()); - g_platform->GetScoresToBeat(level, config, py_callback); - }); -} - void AppFlavor::PushPurchaseCall(const std::string& item) { thread()->PushCall([item] { assert(InMainThread()); diff --git a/src/ballistica/app/app_flavor.h b/src/ballistica/app/app_flavor.h index 14688fb4..65fcb317 100644 --- a/src/ballistica/app/app_flavor.h +++ b/src/ballistica/app/app_flavor.h @@ -108,9 +108,6 @@ class AppFlavor { const std::string& game_version, int64_t score) -> void; auto PushAchievementReportCall(const std::string& achievement) -> void; - auto PushGetScoresToBeatCall(const std::string& level, - const std::string& config, void* py_callback) - -> void; auto PushOpenURLCall(const std::string& url) -> void; auto PushStringEditCall(const std::string& name, const std::string& value, int max_chars) -> void; diff --git a/src/ballistica/assets/component/collide_model.cc b/src/ballistica/assets/component/collide_model.cc index b86d5778..99435d4f 100644 --- a/src/ballistica/assets/component/collide_model.cc +++ b/src/ballistica/assets/component/collide_model.cc @@ -2,9 +2,9 @@ #include "ballistica/assets/component/collide_model.h" -#include "ballistica/game/game_stream.h" #include "ballistica/python/class/python_class_collide_model.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -12,7 +12,7 @@ CollideModel::CollideModel(const std::string& name, Scene* scene) : AssetComponent(name, scene), dead_(false) { assert(InLogicThread()); if (scene) { - if (GameStream* os = scene->GetGameStream()) { + if (SceneStream* os = scene->GetSceneStream()) { os->AddCollideModel(this); } } @@ -30,7 +30,7 @@ void CollideModel::MarkDead() { return; } if (Scene* s = scene()) { - if (GameStream* os = s->GetGameStream()) { + if (SceneStream* os = s->GetSceneStream()) { os->RemoveCollideModel(this); } } diff --git a/src/ballistica/assets/component/data.cc b/src/ballistica/assets/component/data.cc index 1f760ebb..17b23702 100644 --- a/src/ballistica/assets/component/data.cc +++ b/src/ballistica/assets/component/data.cc @@ -2,9 +2,9 @@ #include "ballistica/assets/component/data.h" -#include "ballistica/game/game_stream.h" #include "ballistica/python/class/python_class_data.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -13,7 +13,7 @@ Data::Data(const std::string& name, Scene* scene) assert(InLogicThread()); if (scene) { - if (GameStream* os = scene->GetGameStream()) { + if (SceneStream* os = scene->GetSceneStream()) { os->AddData(this); } } @@ -31,7 +31,7 @@ void Data::MarkDead() { return; } if (Scene* s = scene()) { - if (GameStream* os = s->GetGameStream()) { + if (SceneStream* os = s->GetSceneStream()) { os->RemoveData(this); } } diff --git a/src/ballistica/assets/component/model.cc b/src/ballistica/assets/component/model.cc index 88679733..196ebbf6 100644 --- a/src/ballistica/assets/component/model.cc +++ b/src/ballistica/assets/component/model.cc @@ -2,9 +2,9 @@ #include "ballistica/assets/component/model.h" -#include "ballistica/game/game_stream.h" #include "ballistica/python/class/python_class_model.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -13,7 +13,7 @@ Model::Model(const std::string& name, Scene* scene) assert(InLogicThread()); if (scene) { - if (GameStream* os = scene->GetGameStream()) { + if (SceneStream* os = scene->GetSceneStream()) { os->AddModel(this); } } @@ -31,7 +31,7 @@ void Model::MarkDead() { return; } if (Scene* s = scene()) { - if (GameStream* os = s->GetGameStream()) { + if (SceneStream* os = s->GetSceneStream()) { os->RemoveModel(this); } } diff --git a/src/ballistica/assets/component/sound.cc b/src/ballistica/assets/component/sound.cc index 7f4962df..9c76aba2 100644 --- a/src/ballistica/assets/component/sound.cc +++ b/src/ballistica/assets/component/sound.cc @@ -4,9 +4,9 @@ #include "ballistica/assets/assets.h" #include "ballistica/assets/data/sound_data.h" -#include "ballistica/game/game_stream.h" #include "ballistica/python/class/python_class_sound.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -14,7 +14,7 @@ Sound::Sound(const std::string& name, Scene* scene) : AssetComponent(name, scene) { assert(InLogicThread()); if (scene) { - if (GameStream* os = scene->GetGameStream()) { + if (SceneStream* os = scene->GetSceneStream()) { os->AddSound(this); } } @@ -30,7 +30,7 @@ Sound::~Sound() { MarkDead(); } void Sound::MarkDead() { if (dead_) return; if (Scene* s = scene()) { - if (GameStream* os = s->GetGameStream()) { + if (SceneStream* os = s->GetSceneStream()) { os->RemoveSound(this); } } diff --git a/src/ballistica/assets/component/texture.cc b/src/ballistica/assets/component/texture.cc index 4a350773..52994fdb 100644 --- a/src/ballistica/assets/component/texture.cc +++ b/src/ballistica/assets/component/texture.cc @@ -2,10 +2,10 @@ #include "ballistica/assets/component/texture.h" -#include "ballistica/game/game_stream.h" #include "ballistica/graphics/renderer.h" #include "ballistica/python/class/python_class_texture.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -15,7 +15,7 @@ Texture::Texture(const std::string& name, Scene* scene) // Add to the provided scene to get a numeric ID. if (scene) { - if (GameStream* os = scene->GetGameStream()) { + if (SceneStream* os = scene->GetSceneStream()) { os->AddTexture(this); } } @@ -43,7 +43,7 @@ void Texture::MarkDead() { return; } if (Scene* s = scene()) { - if (GameStream* os = s->GetGameStream()) { + if (SceneStream* os = s->GetSceneStream()) { os->RemoveTexture(this); } } diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index e0d92007..57429cf6 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -23,7 +23,7 @@ namespace ballistica { // These are set automatically via script; don't modify them here. -const int kAppBuildNumber = 20806; +const int kAppBuildNumber = 20809; const char* kAppVersion = "1.7.7"; // Our standalone globals. diff --git a/src/ballistica/core/types.h b/src/ballistica/core/types.h index b6d1d74d..fcc3ad19 100644 --- a/src/ballistica/core/types.h +++ b/src/ballistica/core/types.h @@ -131,7 +131,6 @@ class NodeAttributeConnection; class NodeAttributeUnbound; class Object; class ObjectComponent; -class GameStream; class Part; class Python; class Platform; @@ -163,6 +162,7 @@ class RootUI; class RootWidget; class Runnable; class Scene; +class SceneStream; class ScoreToBeat; class SDLApp; class SDLContext; diff --git a/src/ballistica/dynamics/material/impact_sound_material_action.cc b/src/ballistica/dynamics/material/impact_sound_material_action.cc index fa06c9ea..b0eb9871 100644 --- a/src/ballistica/dynamics/material/impact_sound_material_action.cc +++ b/src/ballistica/dynamics/material/impact_sound_material_action.cc @@ -4,10 +4,10 @@ #include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/material/material_context.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/session/client_session.h" #include "ballistica/generic/utils.h" #include "ballistica/graphics/graphics_server.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -17,7 +17,7 @@ auto ImpactSoundMaterialAction::GetFlattenedSize() -> size_t { } void ImpactSoundMaterialAction::Flatten(char** buffer, - GameStream* output_stream) { + SceneStream* output_stream) { assert(sounds.size() < 100); auto sound_count{static_cast(sounds.size())}; Utils::EmbedInt8(buffer, sound_count); diff --git a/src/ballistica/dynamics/material/impact_sound_material_action.h b/src/ballistica/dynamics/material/impact_sound_material_action.h index f7d18f9f..c3b2398a 100644 --- a/src/ballistica/dynamics/material/impact_sound_material_action.h +++ b/src/ballistica/dynamics/material/impact_sound_material_action.h @@ -26,7 +26,7 @@ class ImpactSoundMaterialAction : public MaterialAction { const Object::Ref& p) override; auto GetType() const -> Type override { return Type::IMPACT_SOUND; } auto GetFlattenedSize() -> size_t override; - void Flatten(char** buffer, GameStream* output_stream) override; + void Flatten(char** buffer, SceneStream* output_stream) override; void Restore(const char** buffer, ClientSession* cs) override; private: diff --git a/src/ballistica/dynamics/material/material.cc b/src/ballistica/dynamics/material/material.cc index 397f295c..4a6e07a5 100644 --- a/src/ballistica/dynamics/material/material.cc +++ b/src/ballistica/dynamics/material/material.cc @@ -5,9 +5,9 @@ // #include "ballistica/dynamics/material/material_action.h" #include "ballistica/dynamics/material/material_component.h" #include "ballistica/dynamics/material/material_condition_node.h" -#include "ballistica/game/game_stream.h" #include "ballistica/python/python_sys.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -16,7 +16,7 @@ Material::Material(std::string name_in, Scene* scene) // If we're being made in a scene with an output stream, // write ourself to it. assert(scene); - if (GameStream* os = scene->GetGameStream()) { + if (SceneStream* os = scene->GetSceneStream()) { os->AddMaterial(this); } } @@ -30,7 +30,7 @@ void Material::MarkDead() { // If we're in a scene with an output-stream, inform them of our demise. Scene* scene = scene_.get(); if (scene) { - if (GameStream* os = scene->GetGameStream()) { + if (SceneStream* os = scene->GetSceneStream()) { os->RemoveMaterial(this); } } @@ -62,13 +62,13 @@ void Material::Apply(MaterialContext* s, const Part* src_part, void Material::AddComponent(const Object::Ref& c) { // If there's an output stream, push this to that first - if (GameStream* output_stream = scene()->GetGameStream()) { + if (SceneStream* output_stream = scene()->GetSceneStream()) { output_stream->AddMaterialComponent(this, c.get()); } components_.push_back(c); } -void Material::DumpComponents(GameStream* out) { +void Material::DumpComponents(SceneStream* out) { for (auto& i : components_) { assert(i.exists()); out->AddMaterialComponent(this, i.get()); diff --git a/src/ballistica/dynamics/material/material.h b/src/ballistica/dynamics/material/material.h index 85b5c7a4..a8f86199 100644 --- a/src/ballistica/dynamics/material/material.h +++ b/src/ballistica/dynamics/material/material.h @@ -30,7 +30,7 @@ class Material : public Object { auto BorrowPyRef() -> PyObject* { return GetPyRef(false); } void MarkDead(); auto scene() const -> Scene* { return scene_.get(); } - void DumpComponents(GameStream* out); + void DumpComponents(SceneStream* out); auto stream_id() const -> int64_t { return stream_id_; } void set_stream_id(int64_t val) { assert(stream_id_ == -1); diff --git a/src/ballistica/dynamics/material/material_action.h b/src/ballistica/dynamics/material/material_action.h index 443992fb..b722bf73 100644 --- a/src/ballistica/dynamics/material/material_action.h +++ b/src/ballistica/dynamics/material/material_action.h @@ -28,7 +28,7 @@ class MaterialAction : public Object { const Object::Ref& p) = 0; virtual void Execute(Node* node1, Node* node2, Scene* scene) {} virtual auto GetFlattenedSize() -> size_t { return 0; } - virtual void Flatten(char** buffer, GameStream* output_stream) {} + virtual void Flatten(char** buffer, SceneStream* output_stream) {} virtual void Restore(const char** buffer, ClientSession* cs) {} auto IsNeededOnClient() -> bool { switch (GetType()) { diff --git a/src/ballistica/dynamics/material/material_component.cc b/src/ballistica/dynamics/material/material_component.cc index 6e7fb561..e211ff15 100644 --- a/src/ballistica/dynamics/material/material_component.cc +++ b/src/ballistica/dynamics/material/material_component.cc @@ -143,7 +143,7 @@ auto MaterialComponent::GetFlattenedSize() -> size_t { return size; } -void MaterialComponent::Flatten(char** buffer, GameStream* output_stream) { +void MaterialComponent::Flatten(char** buffer, SceneStream* output_stream) { // Embed a byte telling whether we have conditions. Utils::EmbedInt8(buffer, conditions.exists()); diff --git a/src/ballistica/dynamics/material/material_component.h b/src/ballistica/dynamics/material/material_component.h index a7ec3abf..cdc426f6 100644 --- a/src/ballistica/dynamics/material/material_component.h +++ b/src/ballistica/dynamics/material/material_component.h @@ -18,7 +18,7 @@ class MaterialComponent : public Object { } auto GetFlattenedSize() -> size_t; - void Flatten(char** buffer, GameStream* output_stream); + void Flatten(char** buffer, SceneStream* output_stream); void Restore(const char** buffer, ClientSession* cs); // Actions are stored as shared pointers so references diff --git a/src/ballistica/dynamics/material/material_condition_node.cc b/src/ballistica/dynamics/material/material_condition_node.cc index 895c9f07..6fb5a663 100644 --- a/src/ballistica/dynamics/material/material_condition_node.cc +++ b/src/ballistica/dynamics/material/material_condition_node.cc @@ -3,9 +3,9 @@ #include "ballistica/dynamics/material/material_condition_node.h" #include "ballistica/dynamics/material/material.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/session/client_session.h" #include "ballistica/generic/utils.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -22,7 +22,7 @@ auto MaterialConditionNode::GetFlattenedSize() -> size_t { return size; } -void MaterialConditionNode::Flatten(char** buffer, GameStream* output_stream) { +void MaterialConditionNode::Flatten(char** buffer, SceneStream* output_stream) { // Pack our opmode in. Or if we're a leaf note stick zero in. Utils::EmbedInt8(buffer, static_cast(opmode)); if (opmode == OpMode::LEAF_NODE) { diff --git a/src/ballistica/dynamics/material/material_condition_node.h b/src/ballistica/dynamics/material/material_condition_node.h index 0764bf31..dc6ea0b5 100644 --- a/src/ballistica/dynamics/material/material_condition_node.h +++ b/src/ballistica/dynamics/material/material_condition_node.h @@ -50,7 +50,7 @@ class MaterialConditionNode : public Object { } } auto GetFlattenedSize() -> size_t; - void Flatten(char** buffer, GameStream* output_stream); + void Flatten(char** buffer, SceneStream* output_stream); void Restore(const char** buffer, ClientSession* cs); }; diff --git a/src/ballistica/dynamics/material/node_message_material_action.h b/src/ballistica/dynamics/material/node_message_material_action.h index eb1ecd85..64eae91c 100644 --- a/src/ballistica/dynamics/material/node_message_material_action.h +++ b/src/ballistica/dynamics/material/node_message_material_action.h @@ -27,7 +27,7 @@ class NodeMessageMaterialAction : public MaterialAction { // 1 byte for bools + data return static_cast(1 + data.GetFlattenedSize()); } - void Flatten(char** buffer, GameStream* output_stream) override { + void Flatten(char** buffer, SceneStream* output_stream) override { Utils::EmbedBools(buffer, target_other, at_disconnect); data.embed(buffer); } diff --git a/src/ballistica/dynamics/material/node_mod_material_action.cc b/src/ballistica/dynamics/material/node_mod_material_action.cc index 9e799a45..0e207f45 100644 --- a/src/ballistica/dynamics/material/node_mod_material_action.cc +++ b/src/ballistica/dynamics/material/node_mod_material_action.cc @@ -13,7 +13,7 @@ auto NodeModMaterialAction::GetType() const -> MaterialAction::Type { auto NodeModMaterialAction::GetFlattenedSize() -> size_t { return 1 + 4; } -void NodeModMaterialAction::Flatten(char** buffer, GameStream* output_stream) { +void NodeModMaterialAction::Flatten(char** buffer, SceneStream* output_stream) { Utils::EmbedInt8(buffer, static_cast(attr)); Utils::EmbedFloat32(buffer, attr_val); } diff --git a/src/ballistica/dynamics/material/node_mod_material_action.h b/src/ballistica/dynamics/material/node_mod_material_action.h index 27fd9a3d..77902e5f 100644 --- a/src/ballistica/dynamics/material/node_mod_material_action.h +++ b/src/ballistica/dynamics/material/node_mod_material_action.h @@ -19,7 +19,7 @@ class NodeModMaterialAction : public MaterialAction { const Object::Ref& p) override; auto GetType() const -> Type override; auto GetFlattenedSize() -> size_t override; - void Flatten(char** buffer, GameStream* output_stream) override; + void Flatten(char** buffer, SceneStream* output_stream) override; void Restore(const char** buffer, ClientSession* cs) override; }; diff --git a/src/ballistica/dynamics/material/part_mod_material_action.cc b/src/ballistica/dynamics/material/part_mod_material_action.cc index 95599bc4..62a18200 100644 --- a/src/ballistica/dynamics/material/part_mod_material_action.cc +++ b/src/ballistica/dynamics/material/part_mod_material_action.cc @@ -13,7 +13,7 @@ auto PartModMaterialAction::GetType() const -> MaterialAction::Type { auto PartModMaterialAction::GetFlattenedSize() -> size_t { return 1 + 4; } -void PartModMaterialAction::Flatten(char** buffer, GameStream* output_stream) { +void PartModMaterialAction::Flatten(char** buffer, SceneStream* output_stream) { Utils::EmbedInt8(buffer, static_cast(attr)); Utils::EmbedFloat32(buffer, attr_val); } diff --git a/src/ballistica/dynamics/material/part_mod_material_action.h b/src/ballistica/dynamics/material/part_mod_material_action.h index 151e0dde..f192e59d 100644 --- a/src/ballistica/dynamics/material/part_mod_material_action.h +++ b/src/ballistica/dynamics/material/part_mod_material_action.h @@ -19,7 +19,7 @@ class PartModMaterialAction : public MaterialAction { const Object::Ref& p) override; auto GetType() const -> Type override; auto GetFlattenedSize() -> size_t override; - void Flatten(char** buffer, GameStream* output_stream) override; + void Flatten(char** buffer, SceneStream* output_stream) override; void Restore(const char** buffer, ClientSession* cs) override; }; diff --git a/src/ballistica/dynamics/material/roll_sound_material_action.cc b/src/ballistica/dynamics/material/roll_sound_material_action.cc index 9d371db1..b9969a3b 100644 --- a/src/ballistica/dynamics/material/roll_sound_material_action.cc +++ b/src/ballistica/dynamics/material/roll_sound_material_action.cc @@ -5,17 +5,17 @@ #include "ballistica/assets/component/sound.h" #include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/material/material_context.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/session/client_session.h" #include "ballistica/generic/utils.h" #include "ballistica/graphics/graphics_server.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { auto RollSoundMaterialAction::GetFlattenedSize() -> size_t { return 4 + 2 + 2; } void RollSoundMaterialAction::Flatten(char** buffer, - GameStream* output_stream) { + SceneStream* output_stream) { Utils::EmbedInt32NBO(buffer, static_cast_check_fit( output_stream->GetSoundID(sound.get()))); Utils::EmbedFloat16NBO(buffer, target_impulse); diff --git a/src/ballistica/dynamics/material/roll_sound_material_action.h b/src/ballistica/dynamics/material/roll_sound_material_action.h index 691c9298..88e25b80 100644 --- a/src/ballistica/dynamics/material/roll_sound_material_action.h +++ b/src/ballistica/dynamics/material/roll_sound_material_action.h @@ -24,7 +24,7 @@ class RollSoundMaterialAction : public MaterialAction { const Object::Ref& p) override; auto GetType() const -> Type override { return Type::ROLL_SOUND; } auto GetFlattenedSize() -> size_t override; - void Flatten(char** buffer, GameStream* output_stream) override; + void Flatten(char** buffer, SceneStream* output_stream) override; void Restore(const char** buffer, ClientSession* cs) override; }; diff --git a/src/ballistica/dynamics/material/skid_sound_material_action.cc b/src/ballistica/dynamics/material/skid_sound_material_action.cc index b608355c..652bfe29 100644 --- a/src/ballistica/dynamics/material/skid_sound_material_action.cc +++ b/src/ballistica/dynamics/material/skid_sound_material_action.cc @@ -4,17 +4,17 @@ #include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/material/material_context.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/session/client_session.h" #include "ballistica/generic/utils.h" #include "ballistica/graphics/graphics_server.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { auto SkidSoundMaterialAction::GetFlattenedSize() -> size_t { return 4 + 2 + 2; } void SkidSoundMaterialAction::Flatten(char** buffer, - GameStream* output_stream) { + SceneStream* output_stream) { Utils::EmbedInt32NBO(buffer, static_cast_check_fit( output_stream->GetSoundID(sound.get()))); Utils::EmbedFloat16NBO(buffer, target_impulse); diff --git a/src/ballistica/dynamics/material/skid_sound_material_action.h b/src/ballistica/dynamics/material/skid_sound_material_action.h index 3bfe9058..63723629 100644 --- a/src/ballistica/dynamics/material/skid_sound_material_action.h +++ b/src/ballistica/dynamics/material/skid_sound_material_action.h @@ -24,7 +24,7 @@ class SkidSoundMaterialAction : public MaterialAction { const Object::Ref& p) override; auto GetType() const -> Type override { return Type::SKID_SOUND; } auto GetFlattenedSize() -> size_t override; - void Flatten(char** buffer, GameStream* output_stream) override; + void Flatten(char** buffer, SceneStream* output_stream) override; void Restore(const char** buffer, ClientSession* cs) override; }; diff --git a/src/ballistica/dynamics/material/sound_material_action.cc b/src/ballistica/dynamics/material/sound_material_action.cc index db5bd6b7..9b9221b0 100644 --- a/src/ballistica/dynamics/material/sound_material_action.cc +++ b/src/ballistica/dynamics/material/sound_material_action.cc @@ -3,9 +3,9 @@ #include "ballistica/dynamics/material/sound_material_action.h" #include "ballistica/dynamics/material/material_context.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/session/client_session.h" #include "ballistica/generic/utils.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -18,7 +18,7 @@ void SoundMaterialAction::Apply(MaterialContext* context, const Part* src_part, auto SoundMaterialAction::GetFlattenedSize() -> size_t { return 4 + 2; } -void SoundMaterialAction::Flatten(char** buffer, GameStream* output_stream) { +void SoundMaterialAction::Flatten(char** buffer, SceneStream* output_stream) { Utils::EmbedInt32NBO(buffer, static_cast_check_fit( output_stream->GetSoundID(sound_.get()))); Utils::EmbedFloat16NBO(buffer, volume_); diff --git a/src/ballistica/dynamics/material/sound_material_action.h b/src/ballistica/dynamics/material/sound_material_action.h index 8d7a0bc7..8e6089b5 100644 --- a/src/ballistica/dynamics/material/sound_material_action.h +++ b/src/ballistica/dynamics/material/sound_material_action.h @@ -19,7 +19,7 @@ class SoundMaterialAction : public MaterialAction { const Object::Ref& p) override; auto GetType() const -> Type override { return Type::SOUND; } auto GetFlattenedSize() -> size_t override; - void Flatten(char** buffer, GameStream* output_stream) override; + void Flatten(char** buffer, SceneStream* output_stream) override; void Restore(const char** buffer, ClientSession* cs) override; private: diff --git a/src/ballistica/game/game.cc b/src/ballistica/game/game.cc index 07ac3ec9..b2c57cab 100644 --- a/src/ballistica/game/game.cc +++ b/src/ballistica/game/game.cc @@ -13,7 +13,6 @@ #include "ballistica/game/friend_score_set.h" #include "ballistica/game/host_activity.h" #include "ballistica/game/player.h" -#include "ballistica/game/score_to_beat.h" #include "ballistica/game/session/client_session.h" #include "ballistica/game/session/host_session.h" #include "ballistica/game/session/net_client_session.h" @@ -1171,22 +1170,6 @@ void Game::GameServiceAchievementList( g_app_internal->DispatchRemoteAchievementList(achievements); } -void Game::PushScoresToBeatResponseCall(bool success, - const std::list& scores, - void* py_callback) { - thread()->PushCall([this, success, scores, py_callback] { - ScoresToBeatResponse(success, scores, py_callback); - }); -} - -void Game::ScoresToBeatResponse(bool success, - const std::list& scores, - void* py_callback) { - assert(g_python); - assert(InLogicThread()); - g_python->DispatchScoresToBeatResponse(success, scores, py_callback); -} - void Game::PushPlaySoundCall(SystemSoundID sound) { thread()->PushCall( [sound] { g_audio->PlaySound(g_assets->GetSound(sound)); }); diff --git a/src/ballistica/game/game.h b/src/ballistica/game/game.h index 226e451f..5c4cbf7d 100644 --- a/src/ballistica/game/game.h +++ b/src/ballistica/game/game.h @@ -54,9 +54,6 @@ class Game { auto PushGameServiceAchievementListCall( const std::set& achievements) -> void; - auto PushScoresToBeatResponseCall(bool success, - const std::list& scores, - void* py_callback) -> void; auto PushToggleCollisionGeometryDisplayCall() -> void; auto PushToggleDebugInfoDisplayCall() -> void; auto PushToggleManualCameraCall() -> void; @@ -256,8 +253,6 @@ class Game { float pixel_width, float pixel_height) -> void; auto GameServiceAchievementList(const std::set& achievements) -> void; - auto ScoresToBeatResponse(bool success, const std::list& scores, - void* py_callback) -> void; auto PruneMedia() -> void; auto Update() -> void; diff --git a/src/ballistica/game/host_activity.cc b/src/ballistica/game/host_activity.cc index 82a83bd0..850a5886 100644 --- a/src/ballistica/game/host_activity.cc +++ b/src/ballistica/game/host_activity.cc @@ -8,7 +8,6 @@ #include "ballistica/assets/component/sound.h" #include "ballistica/assets/component/texture.h" #include "ballistica/dynamics/material/material.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/player.h" #include "ballistica/game/session/host_session.h" #include "ballistica/generic/lambda_runnable.h" @@ -19,6 +18,7 @@ #include "ballistica/python/python_sys.h" #include "ballistica/scene/node/globals_node.h" #include "ballistica/scene/node/node_type.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -36,7 +36,7 @@ HostActivity::HostActivity(HostSession* host_session) { scene_ = Object::New(0); // If there's an output stream, add to it. - if (GameStream* out = host_session->GetGameStream()) { + if (SceneStream* out = host_session->GetSceneStream()) { out->AddScene(scene_.get()); } } @@ -110,9 +110,9 @@ HostActivity::~HostActivity() { } } -auto HostActivity::GetGameStream() const -> GameStream* { +auto HostActivity::GetSceneStream() const -> SceneStream* { if (!host_session_.exists()) return nullptr; - return host_session_->GetGameStream(); + return host_session_->GetSceneStream(); } auto HostActivity::SetGlobalsNode(GlobalsNode* node) -> void { @@ -314,7 +314,7 @@ void HostActivity::SetIsForeground(bool val) { g_game->SetForegroundScene(sg); // Also push it to clients. - if (GameStream* out = GetGameStream()) { + if (SceneStream* out = GetSceneStream()) { out->SetForegroundScene(scene_.get()); } } @@ -433,7 +433,7 @@ void HostActivity::Draw(FrameDef* frame_def) { scene()->Draw(frame_def); } -void HostActivity::DumpFullState(GameStream* out) { +void HostActivity::DumpFullState(SceneStream* out) { // Add our scene. if (scene_.exists()) { scene_->Dump(out); diff --git a/src/ballistica/game/host_activity.h b/src/ballistica/game/host_activity.h index 4aebc6a2..c42edeb2 100644 --- a/src/ballistica/game/host_activity.h +++ b/src/ballistica/game/host_activity.h @@ -69,8 +69,8 @@ class HostActivity : public ContextTarget { auto getAllowKickIdlePlayers() const -> bool { return allow_kick_idle_players_; } - auto GetGameStream() const -> GameStream*; - auto DumpFullState(GameStream* out) -> void; + auto GetSceneStream() const -> SceneStream*; + auto DumpFullState(SceneStream* out) -> void; auto SetGlobalsNode(GlobalsNode* node) -> void; auto SetIsForeground(bool val) -> void; auto RegisterPyActivity(PyObject* pyActivity) -> void; diff --git a/src/ballistica/game/score_to_beat.h b/src/ballistica/game/score_to_beat.h deleted file mode 100644 index 39b084b8..00000000 --- a/src/ballistica/game/score_to_beat.h +++ /dev/null @@ -1,28 +0,0 @@ -// Released under the MIT License. See LICENSE for details. - -#ifndef BALLISTICA_GAME_SCORE_TO_BEAT_H_ -#define BALLISTICA_GAME_SCORE_TO_BEAT_H_ - -#include -#include - -namespace ballistica { - -// Do we still need this? -class ScoreToBeat { - public: - ScoreToBeat(std::string player_in, std::string type_in, std::string value_in, - double timeIn) - : player(std::move(player_in)), - type(std::move(type_in)), - value(std::move(value_in)), - time(timeIn) {} - std::string player; - std::string type; - std::string value; - double time; -}; - -} // namespace ballistica - -#endif // BALLISTICA_GAME_SCORE_TO_BEAT_H_ diff --git a/src/ballistica/game/session/client_session.cc b/src/ballistica/game/session/client_session.cc index 4cd0d1b6..b1b4994c 100644 --- a/src/ballistica/game/session/client_session.cc +++ b/src/ballistica/game/session/client_session.cc @@ -14,13 +14,13 @@ #include "ballistica/dynamics/material/material_component.h" #include "ballistica/dynamics/material/material_condition_node.h" #include "ballistica/dynamics/rigid_body.h" -#include "ballistica/game/game_stream.h" #include "ballistica/graphics/graphics.h" #include "ballistica/networking/networking.h" #include "ballistica/python/python.h" #include "ballistica/scene/node/node_attribute.h" #include "ballistica/scene/node/node_type.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -1063,7 +1063,7 @@ void ClientSession::GetCorrectionMessages( } } -void ClientSession::DumpFullState(GameStream* out) { +void ClientSession::DumpFullState(SceneStream* out) { // Add all scenes. for (auto&& i : scenes()) { if (Scene* sg = i.get()) { diff --git a/src/ballistica/game/session/client_session.h b/src/ballistica/game/session/client_session.h index 6d01a8b3..4779a269 100644 --- a/src/ballistica/game/session/client_session.h +++ b/src/ballistica/game/session/client_session.h @@ -86,7 +86,7 @@ class ClientSession : public Session { virtual auto FetchMessages() -> void {} virtual void Error(const std::string& description); void End(); - void DumpFullState(GameStream* out) override; + void DumpFullState(SceneStream* out) override; /// Reset target base time to equal current. This can be used during command /// buffer underruns to cause playback to pause momentarily instead of diff --git a/src/ballistica/game/session/host_session.cc b/src/ballistica/game/session/host_session.cc index 21035c87..2a35b169 100644 --- a/src/ballistica/game/session/host_session.cc +++ b/src/ballistica/game/session/host_session.cc @@ -6,7 +6,6 @@ #include "ballistica/assets/component/model.h" #include "ballistica/assets/component/sound.h" #include "ballistica/assets/component/texture.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/host_activity.h" #include "ballistica/game/player.h" #include "ballistica/generic/lambda_runnable.h" @@ -17,6 +16,7 @@ #include "ballistica/python/python_command.h" #include "ballistica/python/python_context_call.h" #include "ballistica/python/python_sys.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -51,7 +51,7 @@ HostSession::HostSession(PyObject* session_type_obj) do_replay = false; } - output_stream_ = Object::New(this, do_replay); + output_stream_ = Object::New(this, do_replay); // Make a scene for our session-level nodes, etc. scene_ = Object::New(0); @@ -499,7 +499,7 @@ void HostSession::Update(int time_advance) { ProcessPlayerTimeOuts(); - GameStream* output_stream = GetGameStream(); + SceneStream* output_stream = GetSceneStream(); // Advance base time by the specified amount, // firing all timers along the way. @@ -656,7 +656,7 @@ auto HostSession::GetUnusedPlayerName(Player* p, const std::string& base_name) return name_test; } -void HostSession::DumpFullState(GameStream* out) { +void HostSession::DumpFullState(SceneStream* out) { // Add session-scene. if (scene_.exists()) { scene_->Dump(out); diff --git a/src/ballistica/game/session/host_session.h b/src/ballistica/game/session/host_session.h index e594e52d..2f5e7546 100644 --- a/src/ballistica/game/session/host_session.h +++ b/src/ballistica/game/session/host_session.h @@ -64,11 +64,11 @@ class HostSession : public Session { return scene_.get(); } void RegisterCall(PythonContextCall* call); - auto GetGameStream() const -> GameStream* { return output_stream_.get(); } + auto GetSceneStream() const -> SceneStream* { return output_stream_.get(); } auto is_main_menu() const -> bool { return is_main_menu_; } // fixme remove this - void DumpFullState(GameStream* out) override; + void DumpFullState(SceneStream* out) override; void GetCorrectionMessages(bool blend, std::vector >* messages); auto base_time() const -> millisecs_t { return base_time_; } @@ -98,7 +98,7 @@ class HostSession : public Session { void IssuePlayerLeft(Player* player); bool is_main_menu_; // FIXME: Remove this. - Object::Ref output_stream_; + Object::Ref output_stream_; Timer* step_scene_timer_; millisecs_t base_time_ = 0; TimerList sim_timers_; diff --git a/src/ballistica/game/session/replay_client_session.cc b/src/ballistica/game/session/replay_client_session.cc index f924439f..3d299168 100644 --- a/src/ballistica/game/session/replay_client_session.cc +++ b/src/ballistica/game/session/replay_client_session.cc @@ -5,13 +5,13 @@ #include "ballistica/dynamics/material/material.h" #include "ballistica/game/connection/connection_set.h" #include "ballistica/game/connection/connection_to_client.h" -#include "ballistica/game/game_stream.h" #include "ballistica/generic/huffman.h" #include "ballistica/generic/utils.h" #include "ballistica/math/vector3f.h" #include "ballistica/networking/networking.h" #include "ballistica/platform/platform.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -67,7 +67,7 @@ void ReplayClientSession::OnClientConnected(ConnectionToClient* c) { // we create a temporary output stream just for the purpose of building // a giant session-commands message that we can send to the client // to build its state up to where we are currently. - GameStream out(nullptr, false); + SceneStream out(nullptr, false); // go ahead and dump our full state.. DumpFullState(&out); diff --git a/src/ballistica/game/session/session.cc b/src/ballistica/game/session/session.cc index 6085642f..0a93eede 100644 --- a/src/ballistica/game/session/session.cc +++ b/src/ballistica/game/session/session.cc @@ -30,7 +30,7 @@ void Session::GraphicsQualityChanged(GraphicsQuality q) {} void Session::DebugSpeedMultChanged() {} -void Session::DumpFullState(GameStream* out) { +void Session::DumpFullState(SceneStream* out) { Log("Session::DumpFullState() being called; shouldn't happen."); } diff --git a/src/ballistica/game/session/session.h b/src/ballistica/game/session/session.h index a6e4f7ca..476cc11f 100644 --- a/src/ballistica/game/session/session.h +++ b/src/ballistica/game/session/session.h @@ -33,7 +33,7 @@ class Session : public ContextTarget { virtual void DebugSpeedMultChanged(); auto benchmark_type() const -> BenchmarkType { return benchmark_type_; } void set_benchmark_type(BenchmarkType val) { benchmark_type_ = val; } - virtual void DumpFullState(GameStream* s); + virtual void DumpFullState(SceneStream* s); private: BenchmarkType benchmark_type_ = BenchmarkType::kNone; diff --git a/src/ballistica/platform/apple/platform_apple.h b/src/ballistica/platform/apple/platform_apple.h index 1208489b..90055735 100644 --- a/src/ballistica/platform/apple/platform_apple.h +++ b/src/ballistica/platform/apple/platform_apple.h @@ -57,8 +57,6 @@ class PlatformApple : public Platform { auto IsOSPlayingMusic() -> bool override; auto SetHardwareCursorVisible(bool visible) -> void override; auto QuitApp() -> void override; - auto GetScoresToBeat(const std::string& level, const std::string& config, - void* py_callback) -> void override; auto OpenFileExternally(const std::string& path) -> void override; auto OpenDirExternally(const std::string& path) -> void override; auto MacMusicAppInit() -> void override; diff --git a/src/ballistica/platform/platform.cc b/src/ballistica/platform/platform.cc index 0a074a7c..45b3855f 100644 --- a/src/ballistica/platform/platform.cc +++ b/src/ballistica/platform/platform.cc @@ -24,7 +24,6 @@ #include "ballistica/dynamics/bg/bg_dynamics_server.h" #include "ballistica/game/friend_score_set.h" #include "ballistica/game/game.h" -#include "ballistica/game/score_to_beat.h" #include "ballistica/generic/utils.h" #include "ballistica/graphics/camera.h" #include "ballistica/graphics/graphics.h" @@ -1093,39 +1092,36 @@ void Platform::SetHardwareCursorVisible(bool visible) { #endif } -void Platform::QuitApp() { exit(g_app->return_value); } +auto Platform::QuitApp() -> void { exit(g_app->return_value); } -void Platform::GetScoresToBeat(const std::string& level, - const std::string& config, void* py_callback) { - // By default, return nothing. - g_game->PushScoresToBeatResponseCall(false, std::list(), - py_callback); -} - -void Platform::OpenFileExternally(const std::string& path) { +auto Platform::OpenFileExternally(const std::string& path) -> void { Log("OpenFileExternally() unimplemented"); } -void Platform::OpenDirExternally(const std::string& path) { +auto Platform::OpenDirExternally(const std::string& path) -> void { Log("OpenDirExternally() unimplemented"); } -void Platform::MacMusicAppInit() { Log("MacMusicAppInit() unimplemented"); } +auto Platform::MacMusicAppInit() -> void { + Log("MacMusicAppInit() unimplemented"); +} auto Platform::MacMusicAppGetVolume() -> int { Log("MacMusicAppGetVolume() unimplemented"); return 0; } -void Platform::MacMusicAppSetVolume(int volume) { +auto Platform::MacMusicAppSetVolume(int volume) -> void { Log("MacMusicAppSetVolume() unimplemented"); } -void Platform::MacMusicAppGetLibrarySource() { +auto Platform::MacMusicAppGetLibrarySource() -> void { Log("MacMusicAppGetLibrarySource() unimplemented"); } -void Platform::MacMusicAppStop() { Log("MacMusicAppStop() unimplemented"); } +auto Platform::MacMusicAppStop() -> void { + Log("MacMusicAppStop() unimplemented"); +} auto Platform::MacMusicAppPlayPlaylist(const std::string& playlist) -> bool { Log("MacMusicAppPlayPlaylist() unimplemented"); @@ -1136,7 +1132,7 @@ auto Platform::MacMusicAppGetPlaylists() -> std::list { return {}; } -void Platform::SetCurrentThreadName(const std::string& name) { +auto Platform::SetCurrentThreadName(const std::string& name) -> void { // Currently we leave the main thread alone, otherwise we show up as // "BallisticaMainThread" under "top" on linux (should check other platforms). if (InMainThread()) { @@ -1149,7 +1145,7 @@ void Platform::SetCurrentThreadName(const std::string& name) { #endif } -void Platform::Unlink(const char* path) { +auto Platform::Unlink(const char* path) -> void { // This default implementation covers non-windows platforms. #if BA_OSTYPE_WINDOWS throw Exception(); @@ -1186,7 +1182,7 @@ auto Platform::IsEventPushMode() -> bool { return false; } auto Platform::GetDisplayResolution(int* x, int* y) -> bool { return false; } -void Platform::CloseSocket(int socket) { +auto Platform::CloseSocket(int socket) -> void { // This default implementation covers non-windows platforms. #if BA_OSTYPE_WINDOWS throw Exception(); diff --git a/src/ballistica/platform/platform.h b/src/ballistica/platform/platform.h index f1596019..248e285c 100644 --- a/src/ballistica/platform/platform.h +++ b/src/ballistica/platform/platform.h @@ -491,11 +491,6 @@ class Platform { /// Quit the app (can be immediate or via posting some high level event). virtual auto QuitApp() -> void; - // Note to self: do we want to deprecate this?... - virtual auto GetScoresToBeat(const std::string& level, - const std::string& config, void* py_callback) - -> void; - /// Open a file using the system default method (in another app, etc.) virtual auto OpenFileExternally(const std::string& path) -> void; diff --git a/src/ballistica/python/class/python_class_node.cc b/src/ballistica/python/class/python_class_node.cc index a9e6b395..b6f11427 100644 --- a/src/ballistica/python/class/python_class_node.cc +++ b/src/ballistica/python/class/python_class_node.cc @@ -5,9 +5,9 @@ #include #include "ballistica/core/thread.h" -#include "ballistica/game/game_stream.h" #include "ballistica/python/python.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -277,7 +277,7 @@ auto PythonClassNode::HandleMessage(PythonClassNode* self, PyObject* args) if (user_message_obj) { node->DispatchUserMessage(user_message_obj, "Node User-Message dispatch"); } else { - if (GameStream* output_stream = node->scene()->GetGameStream()) { + if (SceneStream* output_stream = node->scene()->GetSceneStream()) { output_stream->NodeMessage(node, b.data(), b.size()); } node->DispatchNodeMessage(b.data()); @@ -335,7 +335,7 @@ auto PythonClassNode::ConnectAttr(PythonClassNode* self, PyObject* args) dst_node->type()->GetAttribute(std::string(dst_attr_name)); // Push to output_stream first to catch scene mismatch errors. - if (GameStream* output_stream = node->scene()->GetGameStream()) { + if (SceneStream* output_stream = node->scene()->GetSceneStream()) { output_stream->ConnectNodeAttribute(node, src_attr, dst_node, dst_attr); } diff --git a/src/ballistica/python/methods/python_methods_app.cc b/src/ballistica/python/methods/python_methods_app.cc index 3bb4d412..4f12a15a 100644 --- a/src/ballistica/python/methods/python_methods_app.cc +++ b/src/ballistica/python/methods/python_methods_app.cc @@ -7,7 +7,6 @@ #include "ballistica/assets/component/texture.h" #include "ballistica/core/logging.h" #include "ballistica/game/connection/connection_set.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/host_activity.h" #include "ballistica/game/session/host_session.h" #include "ballistica/game/session/replay_client_session.h" @@ -17,6 +16,7 @@ #include "ballistica/python/python.h" #include "ballistica/python/python_context_call_runnable.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" #include "ballistica/ui/ui.h" namespace ballistica { @@ -499,8 +499,8 @@ auto PyScreenMessage(PyObject* self, PyObject* args, PyObject* keywds) PyExcType::kValue); } Scene* context_scene = Context::current().GetMutableScene(); - GameStream* output_stream = - context_scene ? context_scene->GetGameStream() : nullptr; + SceneStream* output_stream = + context_scene ? context_scene->GetSceneStream() : nullptr; Texture* texture = nullptr; Texture* tint_texture = nullptr; diff --git a/src/ballistica/python/methods/python_methods_gameplay.cc b/src/ballistica/python/methods/python_methods_gameplay.cc index 25fc1f9c..aabcf0d2 100644 --- a/src/ballistica/python/methods/python_methods_gameplay.cc +++ b/src/ballistica/python/methods/python_methods_gameplay.cc @@ -12,7 +12,6 @@ #include "ballistica/dynamics/material/material_action.h" #include "ballistica/game/connection/connection_set.h" #include "ballistica/game/connection/connection_to_client.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/host_activity.h" #include "ballistica/generic/json.h" #include "ballistica/graphics/graphics.h" @@ -25,6 +24,7 @@ #include "ballistica/scene/node/node.h" #include "ballistica/scene/node/node_type.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -341,7 +341,7 @@ auto PyEmitFx(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* { e.spread = spread; e.chunk_type = chunk_type; e.tendril_type = tendril_type; - if (GameStream* output_stream = scene->GetGameStream()) { + if (SceneStream* output_stream = scene->GetSceneStream()) { output_stream->EmitBGDynamics(e); } #if !BA_HEADLESS_BUILD @@ -489,27 +489,6 @@ auto PyGetGameRoster(PyObject* self, PyObject* args, PyObject* keywds) BA_PYTHON_CATCH; } -auto PyGetScoresToBeat(PyObject* self, PyObject* args, PyObject* keywds) - -> PyObject* { - BA_PYTHON_TRY; - const char* level; - const char* config; - PyObject* callback_obj = Py_None; - static const char* kwlist[] = {"level", "config", "callback", nullptr}; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "ssO", - const_cast(kwlist), &level, &config, - &callback_obj)) { - return nullptr; - } - - // Allocate a Call object for this and pass its pointer to the main thread; - // we'll ref/de-ref it when it comes back. - auto* call = Object::NewDeferred(callback_obj); - g_app_flavor->PushGetScoresToBeatCall(level, config, call); - Py_RETURN_NONE; - BA_PYTHON_CATCH; -} - auto PySetDebugSpeedExponent(PyObject* self, PyObject* args) -> PyObject* { BA_PYTHON_TRY; int speed; @@ -627,13 +606,6 @@ auto PythonMethodsGameplay::GetMethods() -> std::vector { "Sets the debug speed scale for the game. Actual speed is " "pow(2,speed)."}, - {"get_scores_to_beat", (PyCFunction)PyGetScoresToBeat, - METH_VARARGS | METH_KEYWORDS, - "get_scores_to_beat(level: str, config: str, callback: Callable) -> " - "None\n" - "\n" - "(internal)"}, - {"get_game_roster", (PyCFunction)PyGetGameRoster, METH_VARARGS | METH_KEYWORDS, "get_game_roster() -> list[dict[str, Any]]\n" diff --git a/src/ballistica/python/methods/python_methods_system.cc b/src/ballistica/python/methods/python_methods_system.cc index 4500fedd..aac12fa6 100644 --- a/src/ballistica/python/methods/python_methods_system.cc +++ b/src/ballistica/python/methods/python_methods_system.cc @@ -10,7 +10,6 @@ #include "ballistica/app/app_flavor.h" #include "ballistica/assets/assets.h" #include "ballistica/assets/component/texture.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/host_activity.h" #include "ballistica/game/session/host_session.h" #include "ballistica/game/session/replay_client_session.h" @@ -21,6 +20,7 @@ #include "ballistica/python/python_context_call_runnable.h" #include "ballistica/python/python_sys.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { diff --git a/src/ballistica/python/python.cc b/src/ballistica/python/python.cc index 80ccd37c..5739a151 100644 --- a/src/ballistica/python/python.cc +++ b/src/ballistica/python/python.cc @@ -11,10 +11,8 @@ #include "ballistica/core/thread.h" #include "ballistica/dynamics/material/material.h" #include "ballistica/game/friend_score_set.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/host_activity.h" #include "ballistica/game/player.h" -#include "ballistica/game/score_to_beat.h" #include "ballistica/game/v1_account.h" #include "ballistica/graphics/graphics.h" #include "ballistica/input/device/joystick.h" @@ -47,6 +45,7 @@ #include "ballistica/python/python_command.h" #include "ballistica/python/python_context_call_runnable.h" #include "ballistica/scene/node/node_attribute.h" +#include "ballistica/scene/scene_stream.h" #include "ballistica/ui/ui.h" #include "ballistica/ui/widget/text_widget.h" @@ -1275,33 +1274,6 @@ void Python::HandleLocalChatMessage(const std::string& message) { obj(ObjID::kHandleLocalChatMessageCall).Call(args); } -void Python::DispatchScoresToBeatResponse( - bool success, const std::list& scores_to_beat, - void* callback_in) { - // callback_in was a newly allocated PythonContextCall. - // This will make it ref-counted so it'll die when we're done with it - auto callback( - Object::MakeRefCounted(static_cast(callback_in))); - - // Empty type denotes error. - if (!success) { - PythonRef args(Py_BuildValue("(O)", Py_None), PythonRef::kSteal); - callback->Run(args); - } else { - PyObject* py_list = PyList_New(0); - for (const auto& i : scores_to_beat) { - PyObject* val = Py_BuildValue("{sssssssd}", "player", i.player.c_str(), - "type", i.type.c_str(), "value", - i.value.c_str(), "time", i.time); - PyList_Append(py_list, val); - Py_DECREF(val); - } - PythonRef args(Py_BuildValue("(O)", py_list), PythonRef::kSteal); - Py_DECREF(py_list); - callback->Run(args); - } -} - // Put together a node message with all args on the provided tuple (starting // with arg_offset) returns false on failure, true on success. void Python::DoBuildNodeMessage(PyObject* args, int arg_offset, Buffer* b, @@ -1506,7 +1478,7 @@ auto Python::GetPythonFileLocation(bool pretty) -> std::string { void Python::SetNodeAttr(Node* node, const char* attr_name, PyObject* value_obj) { assert(node); - GameStream* out_stream = node->scene()->GetGameStream(); + SceneStream* out_stream = node->scene()->GetSceneStream(); NodeAttribute attr = node->GetAttribute(attr_name); switch (attr.type()) { case NodeAttributeType::kFloat: { @@ -1820,7 +1792,7 @@ auto Python::DoNewNode(PyObject* args, PyObject* keywds) -> Node* { // do. try { // Tell clients to do the same. - if (GameStream* output_stream = scene->GetGameStream()) { + if (SceneStream* output_stream = scene->GetSceneStream()) { output_stream->NodeOnCreate(node); } node->OnCreate(); diff --git a/src/ballistica/python/python.h b/src/ballistica/python/python.h index bd3e82a1..95eb02ca 100644 --- a/src/ballistica/python/python.h +++ b/src/ballistica/python/python.h @@ -127,10 +127,6 @@ class Python { /// Pass a chat message along to the python UI layer for handling.. auto HandleLocalChatMessage(const std::string& message) -> void; - auto DispatchScoresToBeatResponse( - bool success, const std::list& scores_to_beat, - void* PyCallback) -> void; - /// Pop up an in-game window to show a url (NOT in a browser). auto ShowURL(const std::string& url) -> void; diff --git a/src/ballistica/python/python_sys.h b/src/ballistica/python/python_sys.h index dd4068bd..23508ae6 100644 --- a/src/ballistica/python/python_sys.h +++ b/src/ballistica/python/python_sys.h @@ -3,11 +3,11 @@ #ifndef BALLISTICA_PYTHON_PYTHON_SYS_H_ #define BALLISTICA_PYTHON_PYTHON_SYS_H_ -// Any code that actually runs any python logic should include this. -// This header pulls in the actual python includes and also defines some handy -// macros and functions for working with python objects. +// Any code that actually runs any Python logic should include this. +// This header pulls in the actual Python includes and also defines some handy +// macros and functions for working with Python objects. -// This is the ONE place we actually include python. +// This is the ONE place we actually include Python. #include #include #include diff --git a/src/ballistica/scene/node/node.cc b/src/ballistica/scene/node/node.cc index 1b056791..e61d147c 100644 --- a/src/ballistica/scene/node/node.cc +++ b/src/ballistica/scene/node/node.cc @@ -3,13 +3,13 @@ #include "ballistica/scene/node/node.h" #include "ballistica/dynamics/part.h" -#include "ballistica/game/game_stream.h" #include "ballistica/python/class/python_class_node.h" #include "ballistica/python/python.h" #include "ballistica/python/python_context_call.h" #include "ballistica/scene/node/node_attribute.h" #include "ballistica/scene/node/node_attribute_connection.h" #include "ballistica/scene/scene.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -30,7 +30,7 @@ void Node::AddToScene(Scene* scene) { // id_ = scene->next_node_id_++; // our_iterator_ = // scene->nodes_.insert(scene->nodes_.end(), Object::Ref(this)); - if (GameStream* os = scene->GetGameStream()) { + if (SceneStream* os = scene->GetSceneStream()) { os->AddNode(this); } } @@ -71,7 +71,7 @@ Node::~Node() { // If we were going to an output stream, inform them of our demise. assert(scene()); - if (GameStream* output_stream = scene()->GetGameStream()) { + if (SceneStream* output_stream = scene()->GetSceneStream()) { output_stream->RemoveNode(this); } } diff --git a/src/ballistica/scene/scene.cc b/src/ballistica/scene/scene.cc index 39fc3544..0f3ede77 100644 --- a/src/ballistica/scene/scene.cc +++ b/src/ballistica/scene/scene.cc @@ -8,7 +8,6 @@ #include "ballistica/dynamics/bg/bg_dynamics.h" #include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/part.h" -#include "ballistica/game/game_stream.h" #include "ballistica/game/player.h" #include "ballistica/graphics/camera.h" #include "ballistica/graphics/graphics.h" @@ -39,6 +38,7 @@ #include "ballistica/scene/node/text_node.h" #include "ballistica/scene/node/texture_sequence_node.h" #include "ballistica/scene/node/time_display_node.h" +#include "ballistica/scene/scene_stream.h" namespace ballistica { @@ -106,7 +106,7 @@ void Scene::SetupNodeMessageType(const std::string& name, NodeMessageType val, g_app->node_message_formats[static_cast(val)] = format; } -auto Scene::GetGameStream() const -> GameStream* { +auto Scene::GetSceneStream() const -> SceneStream* { return output_stream_.get(); } @@ -372,7 +372,7 @@ auto Scene::NewNode(const std::string& type_string, const std::string& name, return node.get(); // NOLINT } -void Scene::Dump(GameStream* stream) { +void Scene::Dump(SceneStream* stream) { assert(InLogicThread()); stream->AddScene(this); @@ -382,7 +382,7 @@ void Scene::Dump(GameStream* stream) { } } -void Scene::DumpNodes(GameStream* out) { +void Scene::DumpNodes(SceneStream* out) { // Dumps commands to the output stream to recreate scene's nodes // in their current state. @@ -623,7 +623,7 @@ auto Scene::GetCorrectionMessage(bool blended) -> std::vector { return message; } -void Scene::SetOutputStream(GameStream* val) { output_stream_ = val; } +void Scene::SetOutputStream(SceneStream* val) { output_stream_ = val; } auto Scene::AddNode(Node* node, int64_t* node_id, NodeList::iterator* i) -> void { diff --git a/src/ballistica/scene/scene.h b/src/ballistica/scene/scene.h index b55f4c97..9907a029 100644 --- a/src/ballistica/scene/scene.h +++ b/src/ballistica/scene/scene.h @@ -53,7 +53,7 @@ class Scene : public Object { auto DeleteNode(Node* node) -> void; auto shutting_down() const -> bool { return shutting_down_; } auto set_shutting_down(bool val) -> void { shutting_down_ = val; } - auto GetGameStream() const -> GameStream*; + auto GetSceneStream() const -> SceneStream*; auto SetPlayerNode(int id, PlayerNode* n) -> void; auto GetPlayerNode(int id) -> PlayerNode*; auto use_fixed_vr_overlay() const -> bool { return use_fixed_vr_overlay_; } @@ -63,11 +63,11 @@ class Scene : public Object { auto increment_bg_cover_count() -> void { bg_cover_count_++; } auto decrement_bg_cover_count() -> void { bg_cover_count_--; } auto has_bg_cover() const -> bool { return (bg_cover_count_ > 0); } - auto Dump(GameStream* out) -> void; - auto DumpNodes(GameStream* out) -> void; + auto Dump(SceneStream* out) -> void; + auto DumpNodes(SceneStream* out) -> void; auto GetCorrectionMessage(bool blended) -> std::vector; - auto SetOutputStream(GameStream* val) -> void; + auto SetOutputStream(SceneStream* val) -> void; auto stream_id() const -> int64_t { return stream_id_; } auto set_stream_id(int64_t val) -> void { assert(stream_id_ == -1); @@ -91,7 +91,7 @@ class Scene : public Object { GlobalsNode* globals_node_{}; // Current globals node (if any). std::unordered_map > player_nodes_; int64_t stream_id_{-1}; - Object::WeakRef output_stream_; + Object::WeakRef output_stream_; bool use_fixed_vr_overlay_{}; Context context_; // Context we were made in. millisecs_t time_{}; diff --git a/src/ballistica/game/game_stream.cc b/src/ballistica/scene/scene_stream.cc similarity index 82% rename from src/ballistica/game/game_stream.cc rename to src/ballistica/scene/scene_stream.cc index 4f2c7437..f3b7074b 100644 --- a/src/ballistica/game/game_stream.cc +++ b/src/ballistica/scene/scene_stream.cc @@ -1,6 +1,6 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/game/game_stream.h" +#include "ballistica/scene/scene_stream.h" #include "ballistica/app/app.h" #include "ballistica/assets/assets_server.h" @@ -25,7 +25,7 @@ namespace ballistica { -GameStream::GameStream(HostSession* host_session, bool save_replay) +SceneStream::SceneStream(HostSession* host_session, bool save_replay) : time_(0), host_session_(host_session), next_flush_time_(0), @@ -50,7 +50,7 @@ GameStream::GameStream(HostSession* host_session, bool save_replay) } } -GameStream::~GameStream() { +SceneStream::~SceneStream() { // Ship our last commands (if it matters..) Flush(); @@ -117,17 +117,17 @@ GameStream::~GameStream() { } // Pull the current built-up message. -auto GameStream::GetOutMessage() const -> std::vector { +auto SceneStream::GetOutMessage() const -> std::vector { assert(!host_session_); // this should only be getting used for // standalone temp ones.. if (!out_command_.empty()) { - Log("Error: GameStream shutting down with non-empty outCommand"); + Log("Error: SceneStream shutting down with non-empty outCommand"); } return out_message_; } template -auto GameStream::GetPointerCount(const std::vector& vec) -> size_t { +auto SceneStream::GetPointerCount(const std::vector& vec) -> size_t { size_t count = 0; auto size = vec.size(); @@ -143,8 +143,8 @@ auto GameStream::GetPointerCount(const std::vector& vec) -> size_t { // Given a vector of pointers, return an index to an available (nullptr) entry, // expanding the vector if need be. template -auto GameStream::GetFreeIndex(std::vector* vec, - std::vector* free_indices) -> size_t { +auto SceneStream::GetFreeIndex(std::vector* vec, + std::vector* free_indices) -> size_t { // If we have any free indices, use one of them. if (!free_indices->empty()) { size_t val = free_indices->back(); @@ -159,8 +159,8 @@ auto GameStream::GetFreeIndex(std::vector* vec, // Add an entry. template -void GameStream::Add(T* val, std::vector* vec, - std::vector* free_indices) { +void SceneStream::Add(T* val, std::vector* vec, + std::vector* free_indices) { // This should only get used when we're being driven by the host-session. assert(host_session_); assert(val); @@ -172,8 +172,8 @@ void GameStream::Add(T* val, std::vector* vec, // Remove an entry. template -void GameStream::Remove(T* val, std::vector* vec, - std::vector* free_indices) { +void SceneStream::Remove(T* val, std::vector* vec, + std::vector* free_indices) { assert(val); assert(val->stream_id() >= 0); assert(static_cast(vec->size()) > val->stream_id()); @@ -185,7 +185,7 @@ void GameStream::Remove(T* val, std::vector* vec, val->clear_stream_id(); } -void GameStream::Fail() { +void SceneStream::Fail() { Log("Error writing replay file"); if (writing_replay_) { // Sanity check: We should only ever be writing one replay at once. @@ -199,9 +199,9 @@ void GameStream::Fail() { } } -void GameStream::Flush() { +void SceneStream::Flush() { if (!out_command_.empty()) - Log("Error: GameStream flushing down with non-empty outCommand"); + Log("Error: SceneStream flushing down with non-empty outCommand"); if (!out_message_.empty()) { ShipSessionCommandsMessage(); } @@ -211,7 +211,7 @@ void GameStream::Flush() { #pragma ide diagnostic ignored "ConstantParameter" // Writes just a command. -void GameStream::WriteCommand(SessionCommand cmd) { +void SceneStream::WriteCommand(SessionCommand cmd) { assert(out_command_.empty()); // For now just use full size values. @@ -224,7 +224,7 @@ void GameStream::WriteCommand(SessionCommand cmd) { #pragma clang diagnostic pop // Writes a command plus an int to the stream, using whatever size is optimal. -void GameStream::WriteCommandInt32(SessionCommand cmd, int32_t value) { +void SceneStream::WriteCommandInt32(SessionCommand cmd, int32_t value) { assert(out_command_.empty()); // For now just use full size values. @@ -236,8 +236,8 @@ void GameStream::WriteCommandInt32(SessionCommand cmd, int32_t value) { memcpy(ptr, vals, 4); } -void GameStream::WriteCommandInt32_2(SessionCommand cmd, int32_t value1, - int32_t value2) { +void SceneStream::WriteCommandInt32_2(SessionCommand cmd, int32_t value1, + int32_t value2) { assert(out_command_.empty()); // For now just use full size vals. @@ -249,8 +249,8 @@ void GameStream::WriteCommandInt32_2(SessionCommand cmd, int32_t value1, memcpy(ptr, vals, 8); } -void GameStream::WriteCommandInt32_3(SessionCommand cmd, int32_t value1, - int32_t value2, int32_t value3) { +void SceneStream::WriteCommandInt32_3(SessionCommand cmd, int32_t value1, + int32_t value2, int32_t value3) { assert(out_command_.empty()); // For now just use full size vals. @@ -262,9 +262,9 @@ void GameStream::WriteCommandInt32_3(SessionCommand cmd, int32_t value1, memcpy(ptr, vals, 12); } -void GameStream::WriteCommandInt32_4(SessionCommand cmd, int32_t value1, - int32_t value2, int32_t value3, - int32_t value4) { +void SceneStream::WriteCommandInt32_4(SessionCommand cmd, int32_t value1, + int32_t value2, int32_t value3, + int32_t value4) { assert(out_command_.empty()); // For now just use full size vals. @@ -280,33 +280,33 @@ void GameStream::WriteCommandInt32_4(SessionCommand cmd, int32_t value1, // adding these placeholders for if/when we do. // They will also catch values greater than 32 bits in debug mode. // We'll need a protocol update to add support for 64 bit over the wire. -void GameStream::WriteCommandInt64(SessionCommand cmd, int64_t value) { +void SceneStream::WriteCommandInt64(SessionCommand cmd, int64_t value) { WriteCommandInt32(cmd, static_cast_check_fit(value)); } -void GameStream::WriteCommandInt64_2(SessionCommand cmd, int64_t value1, - int64_t value2) { +void SceneStream::WriteCommandInt64_2(SessionCommand cmd, int64_t value1, + int64_t value2) { WriteCommandInt32_2(cmd, static_cast_check_fit(value1), static_cast_check_fit(value2)); } -void GameStream::WriteCommandInt64_3(SessionCommand cmd, int64_t value1, - int64_t value2, int64_t value3) { +void SceneStream::WriteCommandInt64_3(SessionCommand cmd, int64_t value1, + int64_t value2, int64_t value3) { WriteCommandInt32_3(cmd, static_cast_check_fit(value1), static_cast_check_fit(value2), static_cast_check_fit(value3)); } -void GameStream::WriteCommandInt64_4(SessionCommand cmd, int64_t value1, - int64_t value2, int64_t value3, - int64_t value4) { +void SceneStream::WriteCommandInt64_4(SessionCommand cmd, int64_t value1, + int64_t value2, int64_t value3, + int64_t value4) { WriteCommandInt32_4(cmd, static_cast_check_fit(value1), static_cast_check_fit(value2), static_cast_check_fit(value3), static_cast_check_fit(value4)); } -void GameStream::WriteString(const std::string& s) { +void SceneStream::WriteString(const std::string& s) { // Write length int. auto string_size = s.size(); auto size = out_command_.size(); @@ -317,13 +317,13 @@ void GameStream::WriteString(const std::string& s) { } } -void GameStream::WriteFloat(float val) { +void SceneStream::WriteFloat(float val) { auto size = static_cast(out_command_.size()); out_command_.resize(size + sizeof(val)); memcpy(&out_command_[size], &val, 4); } -void GameStream::WriteFloats(size_t count, const float* vals) { +void SceneStream::WriteFloats(size_t count, const float* vals) { assert(count > 0); auto size = out_command_.size(); size_t vals_size = sizeof(float) * count; @@ -331,7 +331,7 @@ void GameStream::WriteFloats(size_t count, const float* vals) { memcpy(&(out_command_[size]), vals, vals_size); } -void GameStream::WriteInts32(size_t count, const int32_t* vals) { +void SceneStream::WriteInts32(size_t count, const int32_t* vals) { assert(count > 0); auto size = out_command_.size(); size_t vals_size = sizeof(int32_t) * count; @@ -339,7 +339,7 @@ void GameStream::WriteInts32(size_t count, const int32_t* vals) { memcpy(&(out_command_[size]), vals, vals_size); } -void GameStream::WriteInts64(size_t count, const int64_t* vals) { +void SceneStream::WriteInts64(size_t count, const int64_t* vals) { // FIXME: we don't actually support writing 64 bit values to the wire // at the moment; will need a protocol update for that. // This is just implemented as a placeholder. @@ -350,7 +350,7 @@ void GameStream::WriteInts64(size_t count, const int64_t* vals) { WriteInts32(count, vals32.data()); } -void GameStream::WriteChars(size_t count, const char* vals) { +void SceneStream::WriteChars(size_t count, const char* vals) { assert(count > 0); auto size = out_command_.size(); auto vals_size = static_cast(count); @@ -358,7 +358,7 @@ void GameStream::WriteChars(size_t count, const char* vals) { memcpy(&(out_command_[size]), vals, vals_size); } -void GameStream::ShipSessionCommandsMessage() { +void SceneStream::ShipSessionCommandsMessage() { BA_PRECONDITION(!out_message_.empty()); // Send this message to all client-connections we're attached to. @@ -372,7 +372,7 @@ void GameStream::ShipSessionCommandsMessage() { last_send_time_ = GetRealTime(); } -void GameStream::AddMessageToReplay(const std::vector& message) { +void SceneStream::AddMessageToReplay(const std::vector& message) { assert(writing_replay_); assert(g_assets_server); @@ -392,7 +392,7 @@ void GameStream::AddMessageToReplay(const std::vector& message) { g_assets_server->PushAddMessageToReplayCall(message); } -void GameStream::SendPhysicsCorrection(bool blend) { +void SceneStream::SendPhysicsCorrection(bool blend) { assert(host_session_); std::vector > messages; @@ -410,7 +410,7 @@ void GameStream::SendPhysicsCorrection(bool blend) { } } -void GameStream::EndCommand(bool is_time_set) { +void SceneStream::EndCommand(bool is_time_set) { assert(!out_command_.empty()); int out_message_size; @@ -456,7 +456,7 @@ void GameStream::EndCommand(bool is_time_set) { out_command_.clear(); } -auto GameStream::IsValidScene(Scene* s) -> bool { +auto SceneStream::IsValidScene(Scene* s) -> bool { if (!host_session_) { return true; // We don't build lists in this mode so can't verify this. } @@ -465,7 +465,7 @@ auto GameStream::IsValidScene(Scene* s) -> bool { && scenes_[s->stream_id()] == s); } -auto GameStream::IsValidNode(Node* n) -> bool { +auto SceneStream::IsValidNode(Node* n) -> bool { if (!host_session_) { return true; // We don't build lists in this mode so can't verify this. } @@ -474,7 +474,7 @@ auto GameStream::IsValidNode(Node* n) -> bool { && nodes_[n->stream_id()] == n); } -auto GameStream::IsValidTexture(Texture* n) -> bool { +auto SceneStream::IsValidTexture(Texture* n) -> bool { if (!host_session_) { return true; // We don't build lists in this mode so can't verify this. } @@ -483,7 +483,7 @@ auto GameStream::IsValidTexture(Texture* n) -> bool { && textures_[n->stream_id()] == n); } -auto GameStream::IsValidModel(Model* n) -> bool { +auto SceneStream::IsValidModel(Model* n) -> bool { if (!host_session_) { return true; // We don't build lists in this mode so can't verify this. } @@ -492,7 +492,7 @@ auto GameStream::IsValidModel(Model* n) -> bool { && models_[n->stream_id()] == n); } -auto GameStream::IsValidSound(Sound* n) -> bool { +auto SceneStream::IsValidSound(Sound* n) -> bool { if (!host_session_) { return true; // We don't build lists in this mode so can't verify this. } @@ -501,7 +501,7 @@ auto GameStream::IsValidSound(Sound* n) -> bool { && sounds_[n->stream_id()] == n); } -auto GameStream::IsValidData(Data* n) -> bool { +auto SceneStream::IsValidData(Data* n) -> bool { if (!host_session_) { return true; // We don't build lists in this mode so can't verify this. } @@ -510,7 +510,7 @@ auto GameStream::IsValidData(Data* n) -> bool { && datas_[n->stream_id()] == n); } -auto GameStream::IsValidCollideModel(CollideModel* n) -> bool { +auto SceneStream::IsValidCollideModel(CollideModel* n) -> bool { if (!host_session_) { return true; // We don't build lists in this mode so can't verify this. } @@ -519,7 +519,7 @@ auto GameStream::IsValidCollideModel(CollideModel* n) -> bool { && collide_models_[n->stream_id()] == n); } -auto GameStream::IsValidMaterial(Material* n) -> bool { +auto SceneStream::IsValidMaterial(Material* n) -> bool { if (!host_session_) { return true; // We don't build lists in this mode so can't verify this. } @@ -528,13 +528,13 @@ auto GameStream::IsValidMaterial(Material* n) -> bool { && materials_[n->stream_id()] == n); } -void GameStream::SetTime(millisecs_t t) { +void SceneStream::SetTime(millisecs_t t) { if (time_ == t) { return; // Ignore redundants. } millisecs_t diff = t - time_; if (diff > 255) { - Log("Error: GameStream got time diff > 255; not expected."); + Log("Error: SceneStream got time diff > 255; not expected."); diff = 255; } WriteCommandInt64(SessionCommand::kBaseTimeStep, diff); @@ -542,7 +542,7 @@ void GameStream::SetTime(millisecs_t t) { EndCommand(true); } -void GameStream::AddScene(Scene* s) { +void SceneStream::AddScene(Scene* s) { // Host mode. if (host_session_) { Add(s, &scenes_, &free_indices_scene_graphs_); @@ -556,19 +556,19 @@ void GameStream::AddScene(Scene* s) { EndCommand(); } -void GameStream::RemoveScene(Scene* s) { +void SceneStream::RemoveScene(Scene* s) { WriteCommandInt64(SessionCommand::kRemoveSceneGraph, s->stream_id()); Remove(s, &scenes_, &free_indices_scene_graphs_); EndCommand(); } -void GameStream::StepScene(Scene* s) { +void SceneStream::StepScene(Scene* s) { assert(IsValidScene(s)); WriteCommandInt64(SessionCommand::kStepSceneGraph, s->stream_id()); EndCommand(); } -void GameStream::AddNode(Node* n) { +void SceneStream::AddNode(Node* n) { assert(n); if (host_session_) { Add(n, &nodes_, &free_indices_nodes_); @@ -583,26 +583,26 @@ void GameStream::AddNode(Node* n) { EndCommand(); } -void GameStream::NodeOnCreate(Node* n) { +void SceneStream::NodeOnCreate(Node* n) { assert(IsValidNode(n)); WriteCommandInt64(SessionCommand::kNodeOnCreate, n->stream_id()); EndCommand(); } -void GameStream::SetForegroundScene(Scene* sg) { +void SceneStream::SetForegroundScene(Scene* sg) { assert(IsValidScene(sg)); WriteCommandInt64(SessionCommand::kSetForegroundSceneGraph, sg->stream_id()); EndCommand(); } -void GameStream::RemoveNode(Node* n) { +void SceneStream::RemoveNode(Node* n) { assert(IsValidNode(n)); WriteCommandInt64(SessionCommand::kRemoveNode, n->stream_id()); Remove(n, &nodes_, &free_indices_nodes_); EndCommand(); } -void GameStream::AddTexture(Texture* t) { +void SceneStream::AddTexture(Texture* t) { // Register an ID in host mode. if (host_session_) { Add(t, &textures_, &free_indices_textures_); @@ -617,14 +617,14 @@ void GameStream::AddTexture(Texture* t) { EndCommand(); } -void GameStream::RemoveTexture(Texture* t) { +void SceneStream::RemoveTexture(Texture* t) { assert(IsValidTexture(t)); WriteCommandInt64(SessionCommand::kRemoveTexture, t->stream_id()); Remove(t, &textures_, &free_indices_textures_); EndCommand(); } -void GameStream::AddModel(Model* t) { +void SceneStream::AddModel(Model* t) { // Register an ID in host mode. if (host_session_) { Add(t, &models_, &free_indices_models_); @@ -639,14 +639,14 @@ void GameStream::AddModel(Model* t) { EndCommand(); } -void GameStream::RemoveModel(Model* t) { +void SceneStream::RemoveModel(Model* t) { assert(IsValidModel(t)); WriteCommandInt64(SessionCommand::kRemoveModel, t->stream_id()); Remove(t, &models_, &free_indices_models_); EndCommand(); } -void GameStream::AddSound(Sound* t) { +void SceneStream::AddSound(Sound* t) { // Register an ID in host mode. if (host_session_) { Add(t, &sounds_, &free_indices_sounds_); @@ -661,14 +661,14 @@ void GameStream::AddSound(Sound* t) { EndCommand(); } -void GameStream::RemoveSound(Sound* t) { +void SceneStream::RemoveSound(Sound* t) { assert(IsValidSound(t)); WriteCommandInt64(SessionCommand::kRemoveSound, t->stream_id()); Remove(t, &sounds_, &free_indices_sounds_); EndCommand(); } -void GameStream::AddData(Data* t) { +void SceneStream::AddData(Data* t) { // Register an ID in host mode. if (host_session_) { Add(t, &datas_, &free_indices_datas_); @@ -683,14 +683,14 @@ void GameStream::AddData(Data* t) { EndCommand(); } -void GameStream::RemoveData(Data* t) { +void SceneStream::RemoveData(Data* t) { assert(IsValidData(t)); WriteCommandInt64(SessionCommand::kRemoveData, t->stream_id()); Remove(t, &datas_, &free_indices_datas_); EndCommand(); } -void GameStream::AddCollideModel(CollideModel* t) { +void SceneStream::AddCollideModel(CollideModel* t) { if (host_session_) { Add(t, &collide_models_, &free_indices_collide_models_); } else { @@ -704,14 +704,14 @@ void GameStream::AddCollideModel(CollideModel* t) { EndCommand(); } -void GameStream::RemoveCollideModel(CollideModel* t) { +void SceneStream::RemoveCollideModel(CollideModel* t) { assert(IsValidCollideModel(t)); WriteCommandInt64(SessionCommand::kRemoveCollideModel, t->stream_id()); Remove(t, &collide_models_, &free_indices_collide_models_); EndCommand(); } -void GameStream::AddMaterial(Material* m) { +void SceneStream::AddMaterial(Material* m) { if (host_session_) { Add(m, &materials_, &free_indices_materials_); } else { @@ -724,14 +724,14 @@ void GameStream::AddMaterial(Material* m) { EndCommand(); } -void GameStream::RemoveMaterial(Material* m) { +void SceneStream::RemoveMaterial(Material* m) { assert(IsValidMaterial(m)); WriteCommandInt64(SessionCommand::kRemoveMaterial, m->stream_id()); Remove(m, &materials_, &free_indices_materials_); EndCommand(); } -void GameStream::AddMaterialComponent(Material* m, MaterialComponent* c) { +void SceneStream::AddMaterialComponent(Material* m, MaterialComponent* c) { assert(IsValidMaterial(m)); auto flattened_size = c->GetFlattenedSize(); assert(flattened_size > 0 && flattened_size < 10000); @@ -750,10 +750,10 @@ void GameStream::AddMaterialComponent(Material* m, MaterialComponent* c) { EndCommand(); } -void GameStream::ConnectNodeAttribute(Node* src_node, - NodeAttributeUnbound* src_attr, - Node* dst_node, - NodeAttributeUnbound* dst_attr) { +void SceneStream::ConnectNodeAttribute(Node* src_node, + NodeAttributeUnbound* src_attr, + Node* dst_node, + NodeAttributeUnbound* dst_attr) { assert(IsValidNode(src_node)); assert(IsValidNode(dst_node)); assert(src_attr->node_type() == src_node->type()); @@ -768,7 +768,7 @@ void GameStream::ConnectNodeAttribute(Node* src_node, EndCommand(); } -void GameStream::NodeMessage(Node* node, const char* buffer, size_t size) { +void SceneStream::NodeMessage(Node* node, const char* buffer, size_t size) { assert(IsValidNode(node)); BA_PRECONDITION(size > 0 && size < 10000); WriteCommandInt64_2(SessionCommand::kNodeMessage, node->stream_id(), @@ -777,7 +777,7 @@ void GameStream::NodeMessage(Node* node, const char* buffer, size_t size) { EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, float val) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, float val) { assert(IsValidNode(attr.node)); WriteCommandInt64_2(SessionCommand::kSetNodeAttrFloat, attr.node->stream_id(), attr.index()); @@ -785,22 +785,22 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, float val) { EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, int64_t val) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, int64_t val) { assert(IsValidNode(attr.node)); WriteCommandInt64_3(SessionCommand::kSetNodeAttrInt32, attr.node->stream_id(), attr.index(), val); EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, bool val) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, bool val) { assert(IsValidNode(attr.node)); WriteCommandInt64_3(SessionCommand::kSetNodeAttrBool, attr.node->stream_id(), attr.index(), val); EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, - const std::vector& vals) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, + const std::vector& vals) { assert(IsValidNode(attr.node)); size_t count{vals.size()}; WriteCommandInt64_3(SessionCommand::kSetNodeAttrFloats, @@ -812,8 +812,8 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, - const std::vector& vals) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, + const std::vector& vals) { assert(IsValidNode(attr.node)); size_t count{vals.size()}; WriteCommandInt64_3(SessionCommand::kSetNodeAttrInt32s, @@ -825,8 +825,8 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, - const std::string& val) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, + const std::string& val) { assert(IsValidNode(attr.node)); WriteCommandInt64_2(SessionCommand::kSetNodeAttrString, attr.node->stream_id(), attr.index()); @@ -834,7 +834,7 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, Node* val) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, Node* val) { assert(IsValidNode(attr.node)); if (val) { assert(IsValidNode(val)); @@ -850,8 +850,8 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, Node* val) { EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, - const std::vector& vals) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, + const std::vector& vals) { assert(IsValidNode(attr.node)); if (g_buildconfig.debug_build()) { for (auto val : vals) { @@ -878,12 +878,12 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, Player* val) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, Player* val) { // cout << "SET PLAYER ATTR " << attr.getIndex() << endl; } -void GameStream::SetNodeAttr(const NodeAttribute& attr, - const std::vector& vals) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, + const std::vector& vals) { assert(IsValidNode(attr.node)); if (g_buildconfig.debug_build()) { for (auto val : vals) { @@ -911,7 +911,7 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, Texture* val) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, Texture* val) { if (val) { assert(IsValidNode(attr.node)); assert(IsValidTexture(val)); @@ -927,8 +927,8 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, Texture* val) { EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, - const std::vector& vals) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, + const std::vector& vals) { assert(IsValidNode(attr.node)); if (g_buildconfig.debug_build()) { for (auto val : vals) { @@ -956,7 +956,7 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, Sound* val) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, Sound* val) { if (val) { assert(IsValidNode(attr.node)); assert(IsValidSound(val)); @@ -972,8 +972,8 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, Sound* val) { EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, - const std::vector& vals) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, + const std::vector& vals) { assert(IsValidNode(attr.node)); if (g_buildconfig.debug_build()) { for (auto val : vals) { @@ -1001,7 +1001,7 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, Model* val) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, Model* val) { if (val) { assert(IsValidNode(attr.node)); assert(IsValidModel(val)); @@ -1017,8 +1017,8 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, Model* val) { EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, - const std::vector& vals) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, + const std::vector& vals) { assert(IsValidNode(attr.node)); if (g_buildconfig.debug_build()) { for (auto val : vals) { @@ -1045,7 +1045,7 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, } EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, CollideModel* val) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, CollideModel* val) { if (val) { assert(IsValidNode(attr.node)); assert(IsValidCollideModel(val)); @@ -1060,8 +1060,8 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, CollideModel* val) { } EndCommand(); } -void GameStream::SetNodeAttr(const NodeAttribute& attr, - const std::vector& vals) { +void SceneStream::SetNodeAttr(const NodeAttribute& attr, + const std::vector& vals) { assert(IsValidNode(attr.node)); if (g_buildconfig.debug_build()) { for (auto val : vals) { @@ -1089,8 +1089,8 @@ void GameStream::SetNodeAttr(const NodeAttribute& attr, EndCommand(); } -void GameStream::PlaySoundAtPosition(Sound* sound, float volume, float x, - float y, float z) { +void SceneStream::PlaySoundAtPosition(Sound* sound, float volume, float x, + float y, float z) { assert(IsValidSound(sound)); assert(IsValidScene(sound->scene())); @@ -1103,7 +1103,7 @@ void GameStream::PlaySoundAtPosition(Sound* sound, float volume, float x, EndCommand(); } -void GameStream::EmitBGDynamics(const BGDynamicsEmission& e) { +void SceneStream::EmitBGDynamics(const BGDynamicsEmission& e) { WriteCommandInt64_4(SessionCommand::kEmitBGDynamics, static_cast(e.emit_type), e.count, static_cast(e.chunk_type), @@ -1121,7 +1121,7 @@ void GameStream::EmitBGDynamics(const BGDynamicsEmission& e) { EndCommand(); } -void GameStream::PlaySound(Sound* sound, float volume) { +void SceneStream::PlaySound(Sound* sound, float volume) { assert(IsValidSound(sound)); assert(IsValidScene(sound->scene())); @@ -1131,11 +1131,11 @@ void GameStream::PlaySound(Sound* sound, float volume) { EndCommand(); } -void GameStream::ScreenMessageTop(const std::string& val, float r, float g, - float b, Texture* texture, - Texture* tint_texture, float tint_r, - float tint_g, float tint_b, float tint2_r, - float tint2_g, float tint2_b) { +void SceneStream::ScreenMessageTop(const std::string& val, float r, float g, + float b, Texture* texture, + Texture* tint_texture, float tint_r, + float tint_g, float tint_b, float tint2_r, + float tint2_g, float tint2_b) { assert(IsValidTexture(texture)); assert(IsValidTexture(tint_texture)); assert(IsValidScene(texture->scene())); @@ -1157,8 +1157,8 @@ void GameStream::ScreenMessageTop(const std::string& val, float r, float g, EndCommand(); } -void GameStream::ScreenMessageBottom(const std::string& val, float r, float g, - float b) { +void SceneStream::ScreenMessageBottom(const std::string& val, float r, float g, + float b) { WriteCommand(SessionCommand::kScreenMessageBottom); WriteString(val); float color[3]; @@ -1169,27 +1169,27 @@ void GameStream::ScreenMessageBottom(const std::string& val, float r, float g, EndCommand(); } -auto GameStream::GetSoundID(Sound* s) -> int64_t { +auto SceneStream::GetSoundID(Sound* s) -> int64_t { assert(IsValidSound(s)); return s->stream_id(); } -auto GameStream::GetMaterialID(Material* m) -> int64_t { +auto SceneStream::GetMaterialID(Material* m) -> int64_t { assert(IsValidMaterial(m)); return m->stream_id(); } -void GameStream::OnClientConnected(ConnectionToClient* c) { +void SceneStream::OnClientConnected(ConnectionToClient* c) { // Sanity check - abort if its on either of our lists already. for (auto& connections_to_client : connections_to_clients_) { if (connections_to_client == c) { - Log("Error: GameStream::OnClientConnected() got duplicate connection."); + Log("Error: SceneStream::OnClientConnected() got duplicate connection."); return; } } for (auto& i : connections_to_clients_ignored_) { if (i == c) { - Log("Error: GameStream::OnClientConnected() got duplicate connection."); + Log("Error: SceneStream::OnClientConnected() got duplicate connection."); return; } } @@ -1208,7 +1208,7 @@ void GameStream::OnClientConnected(ConnectionToClient* c) { // We create a temporary output stream just for the purpose of building // a giant session-commands message to reconstruct everything in our // host-session in its current form. - GameStream out(nullptr, false); + SceneStream out(nullptr, false); // Ask the host-session that we came from to dump it's complete state. host_session_->DumpFullState(&out); @@ -1226,7 +1226,7 @@ void GameStream::OnClientConnected(ConnectionToClient* c) { } } -void GameStream::OnClientDisconnected(ConnectionToClient* c) { +void SceneStream::OnClientDisconnected(ConnectionToClient* c) { // Search for it on either our ignored or regular lists. for (auto i = connections_to_clients_.begin(); i != connections_to_clients_.end(); i++) { @@ -1242,7 +1242,7 @@ void GameStream::OnClientDisconnected(ConnectionToClient* c) { return; } } - Log("Error: GameStream::OnClientDisconnected() called for connection not on " + Log("Error: SceneStream::OnClientDisconnected() called for connection not on " "lists"); } diff --git a/src/ballistica/game/game_stream.h b/src/ballistica/scene/scene_stream.h similarity index 96% rename from src/ballistica/game/game_stream.h rename to src/ballistica/scene/scene_stream.h index 0cb56b24..43187319 100644 --- a/src/ballistica/game/game_stream.h +++ b/src/ballistica/scene/scene_stream.h @@ -1,7 +1,7 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_GAME_GAME_STREAM_H_ -#define BALLISTICA_GAME_GAME_STREAM_H_ +#ifndef BALLISTICA_SCENE_SCENE_STREAM_H_ +#define BALLISTICA_SCENE_SCENE_STREAM_H_ #include #include @@ -13,10 +13,10 @@ namespace ballistica { // A mechanism for dumping a live session or session-creation-commands to a // stream of messages that can be saved to file or sent over the network. -class GameStream : public Object, public ClientControllerInterface { +class SceneStream : public Object, public ClientControllerInterface { public: - GameStream(HostSession* host_session, bool save_replay); - ~GameStream() override; + SceneStream(HostSession* host_session, bool save_replay); + ~SceneStream() override; auto SetTime(millisecs_t t) -> void; auto AddScene(Scene* s) -> void; auto RemoveScene(Scene* s) -> void; @@ -169,4 +169,4 @@ class GameStream : public Object, public ClientControllerInterface { } // namespace ballistica -#endif // BALLISTICA_GAME_GAME_STREAM_H_ +#endif // BALLISTICA_SCENE_SCENE_STREAM_H_