renamed c++ game class to logic

This commit is contained in:
Eric 2022-09-12 12:54:05 -07:00
parent 3f53c70beb
commit 575a97bc44
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
127 changed files with 1178 additions and 1154 deletions

View File

@ -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/__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", "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", "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/a1/66/39cac09bf6b06e56c530835eb181", "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c2/cb/1e9b2d26994e9dcd55d1df152b19",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/2b/cb/6dd8bdf3a077d3aa761f9b8fbd63", "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/4a/ae/c8878226f4a2d507f4ff5f377859",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b5/e9/5c0a89d56a6e483229da89281796", "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/18/0f/9abd66eae1925271ab132163f2e0",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fe/f9/c33d7708c6186bfd96d5e47955a3", "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/54/c0/bb411385e3aefb55ca3fb4150e60",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/73/5b/93a06dabd24015bb45150bf9b504", "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/3c/61/37d143c8b14fb05990c0b8bc8f52",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/cb/e0/a0da487b59ded7b3906f14bfa720", "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f6/61/3958823929bcf2cdd9ca694d0ad7",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d2/fe/bace2357c3c17373a474bb4c2550", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d5/73/b714b3e9a36076dee085fcdc7db2",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/bb/1c/8f71bc4449cd828817e7eb5e685e", "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fc/42/8ad2896d59013850516d54f49b7d",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/59/c0/562d9fdf5769951cd04f4389f0b8", "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d1/7c/c554ffc1f8c71bc08d4b025ccf4e",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/0a/7d/8a7148a088f5b2c7c1fa770368a9", "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/48/a9/94778472d1c43f556fee5e93c0ab",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d8/d3/b107c0c0564b59544af598ebb975", "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/aa/f1/1c36c23d4d5bd6516adddc206514",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c2/10/e29b058f51d202b47315a78e9426", "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/af/76/63cfa6cc0915d35583bcaf30a2e0",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/1a/25/fd41d552ce3c4d3b6097ddf38575", "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/2f/bb/8bfbea820878f58c5cb9cc702ff0",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/68/35/afcdb16cb02aee02aefecda09c18", "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/4b/06/d72c7d9965890905dd3291c7f2c6",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/89/a6/ed6fb097d9f5b7bf213750399b09", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c1/02/c9cfaf45b9003df94a2a8e277075",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c6/e0/ac51274e398c2d4c9ca96918ff24", "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4c/47/a66e6ce399dc00ade26e761f876f",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/83/46/3a7a9981de261f0ade01976d5ff7", "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/b4/a4/6c844726fc0fb13925622b754cc9",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a4/a9/0cfdc1a7499515d9ae1742a1556d", "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/4b/39/91b9746101e23fd615424b1721e5",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/cd/9b/2b5530a52e1da3912f2b89f2de83", "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/31/07/5e49d34cd8bc204fb38e920f133c",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/24/32/c583f30ff2e5f77c02e1716033b8", "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/6d/b1/6c593726c41a32066ba34ccf2ff5",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/26/1d/c05986ea5543313a3d9ad8f87551", "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/81/60/37044e17e52ca125c1d48af83d03",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a9/30/62c8fa6369762561e87708d625ae", "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fb/47/d505c3feea40888985dd335dc8c4",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/32/e2/27313549815bc9201818b4db6c10", "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4f/3d/20c78e744ac26a13b7418166d675",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/48/67/bac46275cec3dbdbee7d4c698406", "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e3/77/67a1fafff2c1918b1661b71ecaa0",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/13/37/b2a85900f3d5f518cc7e67151282", "build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9b/00/f11d8f7f79c9b692b84f6dbd54dc",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7e/4f/2bc692ccdcb53a278ad9b06ddbf1", "build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f8/3a/0cd5030cbe13f99bf23d05ee6cfb",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/38/12/6e9a96f48a7af39f526dcd41ebce", "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5b/2a/3be2a55cbd63f9c42618c4013c87",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8f/f3/deee23add01a2c2d8bb4b6197366", "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/09/ef/8fbfc6032e6a6089215c3dc365a1",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/83/4d/8bdc0827cf90d2cd09e56a1846ed", "build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f8/79/31ecc50de3e52c55a1569b8b9438",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4a/55/b93f1eae564c146ca60f1a23b915", "build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8a/a0/3ef54e3c6c3c777f8a221da16c14",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e7/fc/58cd588c4aecd56e1ef2bba7b11d", "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ee/a8/07c5e78d027bfc1acc88a25932b4",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/21/83/f5bcb13224fec91b6139b7ae83ed", "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ec/f5/a161f6c194a64f371e35e31bbfca",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/69/1a/eb5f3c85fc8f8194cc96b19714b3", "build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/56/45/b6b9259f447f19ef0643b972bc64",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/27/75/a18262f80729191921e12da1b2dc", "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3b/79/592c41691e94807d23a783723861",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4e/a5/7144c121faf50b2e6cf1db40e281", "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/13/d9/36f4cf8527494f419db74ae6c78f",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/29/08/889f9f0cbd89b692cbcdc0dad96c", "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ee/e5/7f0677e6fb8d7cfa169930579712",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/96/8e/6da028cf907b53fa621cf0275352", "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/8c/4c/3bb058268312359ad8be98f35d9a",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/c3/81/6591a6f11570c598e5dee0d58586", "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/0a/09/1708ba819095ed0d708fdf4db96a",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/ee/f9/e0c13708771197ee7f41db988d19", "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/51/79/b0cccbb7292b56b00a9298d1a22f",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/a2/66/c5433ea1cbd812a532d23895379d", "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/20/2a/30500076cd30d44260a8365c02b5",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/c9/21/154dae08aceb0c162c1ba9580ceb", "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/88/a2/ca9e4011d6fa8b366159838b53a1",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/74/c9/fd45708e613a27dcf3782b3d9dfe", "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/af/b2/b3a702920a14288ceb1603f1f091",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/e1/8e/f5a16f655ae1f2b075e80fb3a981", "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/70/57/1c725a736ebba2035fe3a3ec64df",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/02/73/2dd954ea8a85a542ce900047ab6c", "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/ba/b8/e952aa9d40f5453db0acd4361f10",
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7", "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" "src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/98/12/571b2160d69d42580e8f31fa6a8d"
} }

View File

@ -1,4 +1,4 @@
### 1.7.7 (build 20825, api 7, 2022-09-12) ### 1.7.7 (build 20829, api 7, 2022-09-12)
- Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread. - 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. - Improved logging of missing playlist game types.
- Some ba.Lstr functionality can now be used in background threads. - Some ba.Lstr functionality can now be used in background threads.
@ -24,6 +24,7 @@
- Renamed C++ Media to Assets. - 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. - 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.
- Simplified C++ bootstrapping to allocate all globals in one place. - Simplified C++ bootstrapping to allocate all globals in one place.
- Renamed C++ Game class to Logic.
### 1.7.6 (build 20687, api 7, 2022-08-11) ### 1.7.6 (build 20687, api 7, 2022-08-11)
- Cleaned up da MetaSubsystem code. - Cleaned up da MetaSubsystem code.

View File

@ -1 +1 @@
174884230264825984620020844009502663721 304827393730630459319623179535089986346

View File

@ -38,7 +38,7 @@ def bootstrap() -> None:
# Give a soft warning if we're being used with a different binary # Give a soft warning if we're being used with a different binary
# version than we expect. # version than we expect.
expected_build = 20825 expected_build = 20829
running_build: int = env['build_number'] running_build: int = env['build_number']
if running_build != expected_build: if running_build != expected_build:
print( print(

View File

@ -332,40 +332,6 @@ add_executable(ballisticacore
${BA_SRC_ROOT}/ballistica/dynamics/part.h ${BA_SRC_ROOT}/ballistica/dynamics/part.h
${BA_SRC_ROOT}/ballistica/dynamics/rigid_body.cc ${BA_SRC_ROOT}/ballistica/dynamics/rigid_body.cc
${BA_SRC_ROOT}/ballistica/dynamics/rigid_body.h ${BA_SRC_ROOT}/ballistica/dynamics/rigid_body.h
${BA_SRC_ROOT}/ballistica/game/client_controller_interface.h
${BA_SRC_ROOT}/ballistica/game/connection/connection.cc
${BA_SRC_ROOT}/ballistica/game/connection/connection.h
${BA_SRC_ROOT}/ballistica/game/connection/connection_set.cc
${BA_SRC_ROOT}/ballistica/game/connection/connection_set.h
${BA_SRC_ROOT}/ballistica/game/connection/connection_to_client.cc
${BA_SRC_ROOT}/ballistica/game/connection/connection_to_client.h
${BA_SRC_ROOT}/ballistica/game/connection/connection_to_client_udp.cc
${BA_SRC_ROOT}/ballistica/game/connection/connection_to_client_udp.h
${BA_SRC_ROOT}/ballistica/game/connection/connection_to_host.cc
${BA_SRC_ROOT}/ballistica/game/connection/connection_to_host.h
${BA_SRC_ROOT}/ballistica/game/connection/connection_to_host_udp.cc
${BA_SRC_ROOT}/ballistica/game/connection/connection_to_host_udp.h
${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/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/session/client_session.cc
${BA_SRC_ROOT}/ballistica/game/session/client_session.h
${BA_SRC_ROOT}/ballistica/game/session/host_session.cc
${BA_SRC_ROOT}/ballistica/game/session/host_session.h
${BA_SRC_ROOT}/ballistica/game/session/net_client_session.cc
${BA_SRC_ROOT}/ballistica/game/session/net_client_session.h
${BA_SRC_ROOT}/ballistica/game/session/replay_client_session.cc
${BA_SRC_ROOT}/ballistica/game/session/replay_client_session.h
${BA_SRC_ROOT}/ballistica/game/session/session.cc
${BA_SRC_ROOT}/ballistica/game/session/session.h
${BA_SRC_ROOT}/ballistica/game/v1_account.cc
${BA_SRC_ROOT}/ballistica/game/v1_account.h
${BA_SRC_ROOT}/ballistica/generic/base64.cc ${BA_SRC_ROOT}/ballistica/generic/base64.cc
${BA_SRC_ROOT}/ballistica/generic/base64.h ${BA_SRC_ROOT}/ballistica/generic/base64.h
${BA_SRC_ROOT}/ballistica/generic/buffer.h ${BA_SRC_ROOT}/ballistica/generic/buffer.h
@ -485,6 +451,40 @@ add_executable(ballisticacore
${BA_SRC_ROOT}/ballistica/input/remote_app.cc ${BA_SRC_ROOT}/ballistica/input/remote_app.cc
${BA_SRC_ROOT}/ballistica/input/remote_app.h ${BA_SRC_ROOT}/ballistica/input/remote_app.h
${BA_SRC_ROOT}/ballistica/internal/app_internal.h ${BA_SRC_ROOT}/ballistica/internal/app_internal.h
${BA_SRC_ROOT}/ballistica/logic/client_controller_interface.h
${BA_SRC_ROOT}/ballistica/logic/connection/connection.cc
${BA_SRC_ROOT}/ballistica/logic/connection/connection.h
${BA_SRC_ROOT}/ballistica/logic/connection/connection_set.cc
${BA_SRC_ROOT}/ballistica/logic/connection/connection_set.h
${BA_SRC_ROOT}/ballistica/logic/connection/connection_to_client.cc
${BA_SRC_ROOT}/ballistica/logic/connection/connection_to_client.h
${BA_SRC_ROOT}/ballistica/logic/connection/connection_to_client_udp.cc
${BA_SRC_ROOT}/ballistica/logic/connection/connection_to_client_udp.h
${BA_SRC_ROOT}/ballistica/logic/connection/connection_to_host.cc
${BA_SRC_ROOT}/ballistica/logic/connection/connection_to_host.h
${BA_SRC_ROOT}/ballistica/logic/connection/connection_to_host_udp.cc
${BA_SRC_ROOT}/ballistica/logic/connection/connection_to_host_udp.h
${BA_SRC_ROOT}/ballistica/logic/friend_score_set.h
${BA_SRC_ROOT}/ballistica/logic/host_activity.cc
${BA_SRC_ROOT}/ballistica/logic/host_activity.h
${BA_SRC_ROOT}/ballistica/logic/logic.cc
${BA_SRC_ROOT}/ballistica/logic/logic.h
${BA_SRC_ROOT}/ballistica/logic/player.cc
${BA_SRC_ROOT}/ballistica/logic/player.h
${BA_SRC_ROOT}/ballistica/logic/player_spec.cc
${BA_SRC_ROOT}/ballistica/logic/player_spec.h
${BA_SRC_ROOT}/ballistica/logic/session/client_session.cc
${BA_SRC_ROOT}/ballistica/logic/session/client_session.h
${BA_SRC_ROOT}/ballistica/logic/session/host_session.cc
${BA_SRC_ROOT}/ballistica/logic/session/host_session.h
${BA_SRC_ROOT}/ballistica/logic/session/net_client_session.cc
${BA_SRC_ROOT}/ballistica/logic/session/net_client_session.h
${BA_SRC_ROOT}/ballistica/logic/session/replay_client_session.cc
${BA_SRC_ROOT}/ballistica/logic/session/replay_client_session.h
${BA_SRC_ROOT}/ballistica/logic/session/session.cc
${BA_SRC_ROOT}/ballistica/logic/session/session.h
${BA_SRC_ROOT}/ballistica/logic/v1_account.cc
${BA_SRC_ROOT}/ballistica/logic/v1_account.h
${BA_SRC_ROOT}/ballistica/math/matrix44f.cc ${BA_SRC_ROOT}/ballistica/math/matrix44f.cc
${BA_SRC_ROOT}/ballistica/math/matrix44f.h ${BA_SRC_ROOT}/ballistica/math/matrix44f.h
${BA_SRC_ROOT}/ballistica/math/point2d.h ${BA_SRC_ROOT}/ballistica/math/point2d.h

View File

@ -323,40 +323,6 @@
<ClInclude Include="..\..\src\ballistica\dynamics\part.h" /> <ClInclude Include="..\..\src\ballistica\dynamics\part.h" />
<ClCompile Include="..\..\src\ballistica\dynamics\rigid_body.cc" /> <ClCompile Include="..\..\src\ballistica\dynamics\rigid_body.cc" />
<ClInclude Include="..\..\src\ballistica\dynamics\rigid_body.h" /> <ClInclude Include="..\..\src\ballistica\dynamics\rigid_body.h" />
<ClInclude Include="..\..\src\ballistica\game\client_controller_interface.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection_set.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection_set.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_client.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_client.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_client_udp.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_client_udp.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_host.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_host.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_host_udp.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_host_udp.h" />
<ClInclude Include="..\..\src\ballistica\game\friend_score_set.h" />
<ClCompile Include="..\..\src\ballistica\game\game.cc" />
<ClInclude Include="..\..\src\ballistica\game\game.h" />
<ClCompile Include="..\..\src\ballistica\game\host_activity.cc" />
<ClInclude Include="..\..\src\ballistica\game\host_activity.h" />
<ClCompile Include="..\..\src\ballistica\game\player.cc" />
<ClInclude Include="..\..\src\ballistica\game\player.h" />
<ClCompile Include="..\..\src\ballistica\game\player_spec.cc" />
<ClInclude Include="..\..\src\ballistica\game\player_spec.h" />
<ClCompile Include="..\..\src\ballistica\game\session\client_session.cc" />
<ClInclude Include="..\..\src\ballistica\game\session\client_session.h" />
<ClCompile Include="..\..\src\ballistica\game\session\host_session.cc" />
<ClInclude Include="..\..\src\ballistica\game\session\host_session.h" />
<ClCompile Include="..\..\src\ballistica\game\session\net_client_session.cc" />
<ClInclude Include="..\..\src\ballistica\game\session\net_client_session.h" />
<ClCompile Include="..\..\src\ballistica\game\session\replay_client_session.cc" />
<ClInclude Include="..\..\src\ballistica\game\session\replay_client_session.h" />
<ClCompile Include="..\..\src\ballistica\game\session\session.cc" />
<ClInclude Include="..\..\src\ballistica\game\session\session.h" />
<ClCompile Include="..\..\src\ballistica\game\v1_account.cc" />
<ClInclude Include="..\..\src\ballistica\game\v1_account.h" />
<ClCompile Include="..\..\src\ballistica\generic\base64.cc" /> <ClCompile Include="..\..\src\ballistica\generic\base64.cc" />
<ClInclude Include="..\..\src\ballistica\generic\base64.h" /> <ClInclude Include="..\..\src\ballistica\generic\base64.h" />
<ClInclude Include="..\..\src\ballistica\generic\buffer.h" /> <ClInclude Include="..\..\src\ballistica\generic\buffer.h" />
@ -476,6 +442,40 @@
<ClCompile Include="..\..\src\ballistica\input\remote_app.cc" /> <ClCompile Include="..\..\src\ballistica\input\remote_app.cc" />
<ClInclude Include="..\..\src\ballistica\input\remote_app.h" /> <ClInclude Include="..\..\src\ballistica\input\remote_app.h" />
<ClInclude Include="..\..\src\ballistica\internal\app_internal.h" /> <ClInclude Include="..\..\src\ballistica\internal\app_internal.h" />
<ClInclude Include="..\..\src\ballistica\logic\client_controller_interface.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_set.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_set.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_client.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_client.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_client_udp.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_client_udp.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_host.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_host.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_host_udp.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_host_udp.h" />
<ClInclude Include="..\..\src\ballistica\logic\friend_score_set.h" />
<ClCompile Include="..\..\src\ballistica\logic\host_activity.cc" />
<ClInclude Include="..\..\src\ballistica\logic\host_activity.h" />
<ClCompile Include="..\..\src\ballistica\logic\logic.cc" />
<ClInclude Include="..\..\src\ballistica\logic\logic.h" />
<ClCompile Include="..\..\src\ballistica\logic\player.cc" />
<ClInclude Include="..\..\src\ballistica\logic\player.h" />
<ClCompile Include="..\..\src\ballistica\logic\player_spec.cc" />
<ClInclude Include="..\..\src\ballistica\logic\player_spec.h" />
<ClCompile Include="..\..\src\ballistica\logic\session\client_session.cc" />
<ClInclude Include="..\..\src\ballistica\logic\session\client_session.h" />
<ClCompile Include="..\..\src\ballistica\logic\session\host_session.cc" />
<ClInclude Include="..\..\src\ballistica\logic\session\host_session.h" />
<ClCompile Include="..\..\src\ballistica\logic\session\net_client_session.cc" />
<ClInclude Include="..\..\src\ballistica\logic\session\net_client_session.h" />
<ClCompile Include="..\..\src\ballistica\logic\session\replay_client_session.cc" />
<ClInclude Include="..\..\src\ballistica\logic\session\replay_client_session.h" />
<ClCompile Include="..\..\src\ballistica\logic\session\session.cc" />
<ClInclude Include="..\..\src\ballistica\logic\session\session.h" />
<ClCompile Include="..\..\src\ballistica\logic\v1_account.cc" />
<ClInclude Include="..\..\src\ballistica\logic\v1_account.h" />
<ClCompile Include="..\..\src\ballistica\math\matrix44f.cc" /> <ClCompile Include="..\..\src\ballistica\math\matrix44f.cc" />
<ClInclude Include="..\..\src\ballistica\math\matrix44f.h" /> <ClInclude Include="..\..\src\ballistica\math\matrix44f.h" />
<ClInclude Include="..\..\src\ballistica\math\point2d.h" /> <ClInclude Include="..\..\src\ballistica\math\point2d.h" />

View File

@ -403,108 +403,6 @@
<ClInclude Include="..\..\src\ballistica\dynamics\rigid_body.h"> <ClInclude Include="..\..\src\ballistica\dynamics\rigid_body.h">
<Filter>ballistica\dynamics</Filter> <Filter>ballistica\dynamics</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ballistica\game\client_controller_interface.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection_set.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection_set.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_client.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_client.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_client_udp.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_client_udp.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_host.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_host.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_host_udp.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_host_udp.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ballistica\game\friend_score_set.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\game.cc">
<Filter>ballistica\game</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\game.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\host_activity.cc">
<Filter>ballistica\game</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\host_activity.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\player.cc">
<Filter>ballistica\game</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\player.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\player_spec.cc">
<Filter>ballistica\game</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\player_spec.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\session\client_session.cc">
<Filter>ballistica\game\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\session\client_session.h">
<Filter>ballistica\game\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\session\host_session.cc">
<Filter>ballistica\game\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\session\host_session.h">
<Filter>ballistica\game\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\session\net_client_session.cc">
<Filter>ballistica\game\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\session\net_client_session.h">
<Filter>ballistica\game\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\session\replay_client_session.cc">
<Filter>ballistica\game\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\session\replay_client_session.h">
<Filter>ballistica\game\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\session\session.cc">
<Filter>ballistica\game\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\session\session.h">
<Filter>ballistica\game\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\v1_account.cc">
<Filter>ballistica\game</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\v1_account.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\generic\base64.cc"> <ClCompile Include="..\..\src\ballistica\generic\base64.cc">
<Filter>ballistica\generic</Filter> <Filter>ballistica\generic</Filter>
</ClCompile> </ClCompile>
@ -862,6 +760,108 @@
<ClInclude Include="..\..\src\ballistica\internal\app_internal.h"> <ClInclude Include="..\..\src\ballistica\internal\app_internal.h">
<Filter>ballistica\internal</Filter> <Filter>ballistica\internal</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ballistica\logic\client_controller_interface.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_set.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_set.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_client.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_client.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_client_udp.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_client_udp.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_host.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_host.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_host_udp.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_host_udp.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ballistica\logic\friend_score_set.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\host_activity.cc">
<Filter>ballistica\logic</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\host_activity.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\logic.cc">
<Filter>ballistica\logic</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\logic.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\player.cc">
<Filter>ballistica\logic</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\player.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\player_spec.cc">
<Filter>ballistica\logic</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\player_spec.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\session\client_session.cc">
<Filter>ballistica\logic\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\session\client_session.h">
<Filter>ballistica\logic\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\session\host_session.cc">
<Filter>ballistica\logic\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\session\host_session.h">
<Filter>ballistica\logic\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\session\net_client_session.cc">
<Filter>ballistica\logic\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\session\net_client_session.h">
<Filter>ballistica\logic\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\session\replay_client_session.cc">
<Filter>ballistica\logic\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\session\replay_client_session.h">
<Filter>ballistica\logic\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\session\session.cc">
<Filter>ballistica\logic\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\session\session.h">
<Filter>ballistica\logic\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\v1_account.cc">
<Filter>ballistica\logic</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\v1_account.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\math\matrix44f.cc"> <ClCompile Include="..\..\src\ballistica\math\matrix44f.cc">
<Filter>ballistica\math</Filter> <Filter>ballistica\math</Filter>
</ClCompile> </ClCompile>
@ -1652,9 +1652,6 @@
<Filter Include="ballistica\dynamics" /> <Filter Include="ballistica\dynamics" />
<Filter Include="ballistica\dynamics\bg" /> <Filter Include="ballistica\dynamics\bg" />
<Filter Include="ballistica\dynamics\material" /> <Filter Include="ballistica\dynamics\material" />
<Filter Include="ballistica\game" />
<Filter Include="ballistica\game\connection" />
<Filter Include="ballistica\game\session" />
<Filter Include="ballistica\generic" /> <Filter Include="ballistica\generic" />
<Filter Include="ballistica\graphics" /> <Filter Include="ballistica\graphics" />
<Filter Include="ballistica\graphics\component" /> <Filter Include="ballistica\graphics\component" />
@ -1665,6 +1662,9 @@
<Filter Include="ballistica\input" /> <Filter Include="ballistica\input" />
<Filter Include="ballistica\input\device" /> <Filter Include="ballistica\input\device" />
<Filter Include="ballistica\internal" /> <Filter Include="ballistica\internal" />
<Filter Include="ballistica\logic" />
<Filter Include="ballistica\logic\connection" />
<Filter Include="ballistica\logic\session" />
<Filter Include="ballistica\math" /> <Filter Include="ballistica\math" />
<Filter Include="ballistica\networking" /> <Filter Include="ballistica\networking" />
<Filter Include="ballistica\platform" /> <Filter Include="ballistica\platform" />

View File

@ -318,40 +318,6 @@
<ClInclude Include="..\..\src\ballistica\dynamics\part.h" /> <ClInclude Include="..\..\src\ballistica\dynamics\part.h" />
<ClCompile Include="..\..\src\ballistica\dynamics\rigid_body.cc" /> <ClCompile Include="..\..\src\ballistica\dynamics\rigid_body.cc" />
<ClInclude Include="..\..\src\ballistica\dynamics\rigid_body.h" /> <ClInclude Include="..\..\src\ballistica\dynamics\rigid_body.h" />
<ClInclude Include="..\..\src\ballistica\game\client_controller_interface.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection_set.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection_set.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_client.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_client.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_client_udp.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_client_udp.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_host.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_host.h" />
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_host_udp.cc" />
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_host_udp.h" />
<ClInclude Include="..\..\src\ballistica\game\friend_score_set.h" />
<ClCompile Include="..\..\src\ballistica\game\game.cc" />
<ClInclude Include="..\..\src\ballistica\game\game.h" />
<ClCompile Include="..\..\src\ballistica\game\host_activity.cc" />
<ClInclude Include="..\..\src\ballistica\game\host_activity.h" />
<ClCompile Include="..\..\src\ballistica\game\player.cc" />
<ClInclude Include="..\..\src\ballistica\game\player.h" />
<ClCompile Include="..\..\src\ballistica\game\player_spec.cc" />
<ClInclude Include="..\..\src\ballistica\game\player_spec.h" />
<ClCompile Include="..\..\src\ballistica\game\session\client_session.cc" />
<ClInclude Include="..\..\src\ballistica\game\session\client_session.h" />
<ClCompile Include="..\..\src\ballistica\game\session\host_session.cc" />
<ClInclude Include="..\..\src\ballistica\game\session\host_session.h" />
<ClCompile Include="..\..\src\ballistica\game\session\net_client_session.cc" />
<ClInclude Include="..\..\src\ballistica\game\session\net_client_session.h" />
<ClCompile Include="..\..\src\ballistica\game\session\replay_client_session.cc" />
<ClInclude Include="..\..\src\ballistica\game\session\replay_client_session.h" />
<ClCompile Include="..\..\src\ballistica\game\session\session.cc" />
<ClInclude Include="..\..\src\ballistica\game\session\session.h" />
<ClCompile Include="..\..\src\ballistica\game\v1_account.cc" />
<ClInclude Include="..\..\src\ballistica\game\v1_account.h" />
<ClCompile Include="..\..\src\ballistica\generic\base64.cc" /> <ClCompile Include="..\..\src\ballistica\generic\base64.cc" />
<ClInclude Include="..\..\src\ballistica\generic\base64.h" /> <ClInclude Include="..\..\src\ballistica\generic\base64.h" />
<ClInclude Include="..\..\src\ballistica\generic\buffer.h" /> <ClInclude Include="..\..\src\ballistica\generic\buffer.h" />
@ -471,6 +437,40 @@
<ClCompile Include="..\..\src\ballistica\input\remote_app.cc" /> <ClCompile Include="..\..\src\ballistica\input\remote_app.cc" />
<ClInclude Include="..\..\src\ballistica\input\remote_app.h" /> <ClInclude Include="..\..\src\ballistica\input\remote_app.h" />
<ClInclude Include="..\..\src\ballistica\internal\app_internal.h" /> <ClInclude Include="..\..\src\ballistica\internal\app_internal.h" />
<ClInclude Include="..\..\src\ballistica\logic\client_controller_interface.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_set.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_set.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_client.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_client.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_client_udp.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_client_udp.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_host.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_host.h" />
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_host_udp.cc" />
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_host_udp.h" />
<ClInclude Include="..\..\src\ballistica\logic\friend_score_set.h" />
<ClCompile Include="..\..\src\ballistica\logic\host_activity.cc" />
<ClInclude Include="..\..\src\ballistica\logic\host_activity.h" />
<ClCompile Include="..\..\src\ballistica\logic\logic.cc" />
<ClInclude Include="..\..\src\ballistica\logic\logic.h" />
<ClCompile Include="..\..\src\ballistica\logic\player.cc" />
<ClInclude Include="..\..\src\ballistica\logic\player.h" />
<ClCompile Include="..\..\src\ballistica\logic\player_spec.cc" />
<ClInclude Include="..\..\src\ballistica\logic\player_spec.h" />
<ClCompile Include="..\..\src\ballistica\logic\session\client_session.cc" />
<ClInclude Include="..\..\src\ballistica\logic\session\client_session.h" />
<ClCompile Include="..\..\src\ballistica\logic\session\host_session.cc" />
<ClInclude Include="..\..\src\ballistica\logic\session\host_session.h" />
<ClCompile Include="..\..\src\ballistica\logic\session\net_client_session.cc" />
<ClInclude Include="..\..\src\ballistica\logic\session\net_client_session.h" />
<ClCompile Include="..\..\src\ballistica\logic\session\replay_client_session.cc" />
<ClInclude Include="..\..\src\ballistica\logic\session\replay_client_session.h" />
<ClCompile Include="..\..\src\ballistica\logic\session\session.cc" />
<ClInclude Include="..\..\src\ballistica\logic\session\session.h" />
<ClCompile Include="..\..\src\ballistica\logic\v1_account.cc" />
<ClInclude Include="..\..\src\ballistica\logic\v1_account.h" />
<ClCompile Include="..\..\src\ballistica\math\matrix44f.cc" /> <ClCompile Include="..\..\src\ballistica\math\matrix44f.cc" />
<ClInclude Include="..\..\src\ballistica\math\matrix44f.h" /> <ClInclude Include="..\..\src\ballistica\math\matrix44f.h" />
<ClInclude Include="..\..\src\ballistica\math\point2d.h" /> <ClInclude Include="..\..\src\ballistica\math\point2d.h" />

View File

@ -403,108 +403,6 @@
<ClInclude Include="..\..\src\ballistica\dynamics\rigid_body.h"> <ClInclude Include="..\..\src\ballistica\dynamics\rigid_body.h">
<Filter>ballistica\dynamics</Filter> <Filter>ballistica\dynamics</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ballistica\game\client_controller_interface.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection_set.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection_set.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_client.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_client.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_client_udp.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_client_udp.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_host.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_host.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\connection\connection_to_host_udp.cc">
<Filter>ballistica\game\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\connection\connection_to_host_udp.h">
<Filter>ballistica\game\connection</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ballistica\game\friend_score_set.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\game.cc">
<Filter>ballistica\game</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\game.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\host_activity.cc">
<Filter>ballistica\game</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\host_activity.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\player.cc">
<Filter>ballistica\game</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\player.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\player_spec.cc">
<Filter>ballistica\game</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\player_spec.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\session\client_session.cc">
<Filter>ballistica\game\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\session\client_session.h">
<Filter>ballistica\game\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\session\host_session.cc">
<Filter>ballistica\game\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\session\host_session.h">
<Filter>ballistica\game\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\session\net_client_session.cc">
<Filter>ballistica\game\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\session\net_client_session.h">
<Filter>ballistica\game\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\session\replay_client_session.cc">
<Filter>ballistica\game\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\session\replay_client_session.h">
<Filter>ballistica\game\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\session\session.cc">
<Filter>ballistica\game\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\session\session.h">
<Filter>ballistica\game\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\game\v1_account.cc">
<Filter>ballistica\game</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\game\v1_account.h">
<Filter>ballistica\game</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\generic\base64.cc"> <ClCompile Include="..\..\src\ballistica\generic\base64.cc">
<Filter>ballistica\generic</Filter> <Filter>ballistica\generic</Filter>
</ClCompile> </ClCompile>
@ -862,6 +760,108 @@
<ClInclude Include="..\..\src\ballistica\internal\app_internal.h"> <ClInclude Include="..\..\src\ballistica\internal\app_internal.h">
<Filter>ballistica\internal</Filter> <Filter>ballistica\internal</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ballistica\logic\client_controller_interface.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_set.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_set.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_client.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_client.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_client_udp.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_client_udp.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_host.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_host.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\connection\connection_to_host_udp.cc">
<Filter>ballistica\logic\connection</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\connection\connection_to_host_udp.h">
<Filter>ballistica\logic\connection</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ballistica\logic\friend_score_set.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\host_activity.cc">
<Filter>ballistica\logic</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\host_activity.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\logic.cc">
<Filter>ballistica\logic</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\logic.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\player.cc">
<Filter>ballistica\logic</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\player.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\player_spec.cc">
<Filter>ballistica\logic</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\player_spec.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\session\client_session.cc">
<Filter>ballistica\logic\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\session\client_session.h">
<Filter>ballistica\logic\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\session\host_session.cc">
<Filter>ballistica\logic\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\session\host_session.h">
<Filter>ballistica\logic\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\session\net_client_session.cc">
<Filter>ballistica\logic\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\session\net_client_session.h">
<Filter>ballistica\logic\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\session\replay_client_session.cc">
<Filter>ballistica\logic\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\session\replay_client_session.h">
<Filter>ballistica\logic\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\session\session.cc">
<Filter>ballistica\logic\session</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\session\session.h">
<Filter>ballistica\logic\session</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\logic\v1_account.cc">
<Filter>ballistica\logic</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\logic\v1_account.h">
<Filter>ballistica\logic</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\math\matrix44f.cc"> <ClCompile Include="..\..\src\ballistica\math\matrix44f.cc">
<Filter>ballistica\math</Filter> <Filter>ballistica\math</Filter>
</ClCompile> </ClCompile>
@ -1652,9 +1652,6 @@
<Filter Include="ballistica\dynamics" /> <Filter Include="ballistica\dynamics" />
<Filter Include="ballistica\dynamics\bg" /> <Filter Include="ballistica\dynamics\bg" />
<Filter Include="ballistica\dynamics\material" /> <Filter Include="ballistica\dynamics\material" />
<Filter Include="ballistica\game" />
<Filter Include="ballistica\game\connection" />
<Filter Include="ballistica\game\session" />
<Filter Include="ballistica\generic" /> <Filter Include="ballistica\generic" />
<Filter Include="ballistica\graphics" /> <Filter Include="ballistica\graphics" />
<Filter Include="ballistica\graphics\component" /> <Filter Include="ballistica\graphics\component" />
@ -1665,6 +1662,9 @@
<Filter Include="ballistica\input" /> <Filter Include="ballistica\input" />
<Filter Include="ballistica\input\device" /> <Filter Include="ballistica\input\device" />
<Filter Include="ballistica\internal" /> <Filter Include="ballistica\internal" />
<Filter Include="ballistica\logic" />
<Filter Include="ballistica\logic\connection" />
<Filter Include="ballistica\logic\session" />
<Filter Include="ballistica\math" /> <Filter Include="ballistica\math" />
<Filter Include="ballistica\networking" /> <Filter Include="ballistica\networking" />
<Filter Include="ballistica\platform" /> <Filter Include="ballistica\platform" />

View File

@ -4,11 +4,11 @@
#include "ballistica/app/stress_test.h" #include "ballistica/app/stress_test.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/graphics/renderer.h" #include "ballistica/graphics/renderer.h"
#include "ballistica/input/device/touch_input.h" #include "ballistica/input/device/touch_input.h"
#include "ballistica/input/input.h" #include "ballistica/input/input.h"
#include "ballistica/logic/logic.h"
#include "ballistica/networking/network_reader.h" #include "ballistica/networking/network_reader.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
#include "ballistica/networking/telnet_server.h" #include "ballistica/networking/telnet_server.h"
@ -196,7 +196,7 @@ void AppFlavor::OnResume() {
// Also let the Python layer do what it needs to // Also let the Python layer do what it needs to
// (starting/stopping music, etc.). // (starting/stopping music, etc.).
g_python->PushObjCall(Python::ObjID::kHandleAppResumeCall); g_python->PushObjCall(Python::ObjID::kHandleAppResumeCall);
g_game->PushOnAppResumeCall(); g_logic->PushOnAppResumeCall();
g_graphics->SetGyroEnabled(true); g_graphics->SetGyroEnabled(true);
@ -211,7 +211,7 @@ void AppFlavor::OnResume() {
// If we've been completely backgrounded, // If we've been completely backgrounded,
// send a menu-press command to the game; this will // send a menu-press command to the game; this will
// bring up a pause menu if we're in the game/etc. // bring up a pause menu if we're in the game/etc.
g_game->PushMainMenuPressCall(nullptr); g_logic->PushMainMenuPressCall(nullptr);
} }
} }

View File

@ -4,9 +4,9 @@
#include "ballistica/app/app_flavor_vr.h" #include "ballistica/app/app_flavor_vr.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/graphics/renderer.h" #include "ballistica/graphics/renderer.h"
#include "ballistica/logic/logic.h"
namespace ballistica { namespace ballistica {
@ -87,7 +87,7 @@ auto AppFlavorVR::VRSetHands(const VRHandsState& state) -> void {
renderer->VRSetHands(state); renderer->VRSetHands(state);
// ALSO ship it off to the game/ui thread to actually handle input from it. // ALSO ship it off to the game/ui thread to actually handle input from it.
g_game->PushVRHandsState(state); g_logic->PushVRHandsState(state);
} }
auto AppFlavorVR::VRDrawEye(int eye, float yaw, float pitch, float roll, auto AppFlavorVR::VRDrawEye(int eye, float yaw, float pitch, float roll,

View File

@ -82,7 +82,7 @@ void StressTest::Update() {
texture_count = g_assets->total_texture_count(); texture_count = g_assets->total_texture_count();
sound_count = g_assets->total_sound_count(); sound_count = g_assets->total_sound_count();
} }
assert(g_game); assert(g_logic);
std::string mem_usage = g_platform->GetMemUsageInfo(); std::string mem_usage = g_platform->GetMemUsageInfo();
fprintf(stress_test_stats_file_, "%d,%.1f,%d,%d,%d,%d,%d,%s\n", fprintf(stress_test_stats_file_, "%d,%.1f,%d,%d,%d,%d,%d,%s\n",
static_cast_check_fit<int>(GetRealTime()), avg, node_count, static_cast_check_fit<int>(GetRealTime()), avg, node_count,

View File

@ -14,10 +14,10 @@
#include "ballistica/assets/data/sound_data.h" #include "ballistica/assets/data/sound_data.h"
#include "ballistica/audio/audio_server.h" #include "ballistica/audio/audio_server.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h"
#include "ballistica/generic/timer.h" #include "ballistica/generic/timer.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/graphics/text/text_packer.h" #include "ballistica/graphics/text/text_packer.h"
#include "ballistica/logic/logic.h"
#include "ballistica/python/python_sys.h" #include "ballistica/python/python_sys.h"
namespace ballistica { namespace ballistica {
@ -813,8 +813,8 @@ auto Assets::RunPendingLoadList(std::vector<Object::Ref<T>*>* c_list) -> bool {
// if we dumped anything on the pending loads done list, shake the game thread // if we dumped anything on the pending loads done list, shake the game thread
// to tell it to kill the reference.. // to tell it to kill the reference..
if (!l_finished.empty()) { if (!l_finished.empty()) {
assert(g_game); assert(g_logic);
g_game->PushHavePendingLoadsDoneCall(); g_logic->PushHavePendingLoadsDoneCall();
} }
return (!l.empty()); return (!l.empty());
} }
@ -1186,7 +1186,7 @@ void Assets::AddPendingLoad(Object::Ref<AssetComponentData>* c) {
std::scoped_lock lock(pending_load_list_mutex_); std::scoped_lock lock(pending_load_list_mutex_);
pending_loads_other_.push_back(c); pending_loads_other_.push_back(c);
} }
g_game->PushHavePendingLoadsCall(); g_logic->PushHavePendingLoadsCall();
break; break;
} }
} }

View File

@ -11,8 +11,8 @@
#include "ballistica/audio/audio_streamer.h" #include "ballistica/audio/audio_streamer.h"
#include "ballistica/audio/ogg_stream.h" #include "ballistica/audio/ogg_stream.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h"
#include "ballistica/generic/timer.h" #include "ballistica/generic/timer.h"
#include "ballistica/logic/logic.h"
#include "ballistica/math/vector3f.h" #include "ballistica/math/vector3f.h"
// Need to move away from OpenAL on Apple stuff. // Need to move away from OpenAL on Apple stuff.
@ -1114,7 +1114,7 @@ void AudioServer::PushComponentUnloadCall(
} }
// ...and then ship these pointers back to the game thread, so it can free // ...and then ship these pointers back to the game thread, so it can free
// the references. // the references.
g_game->PushFreeAssetComponentRefsCall(components); g_logic->PushFreeAssetComponentRefsCall(components);
}); });
} }
@ -1131,7 +1131,8 @@ void AudioServer::AddSoundRefDelete(const Object::Ref<SoundData>* c) {
sound_ref_delete_list_.push_back(c); sound_ref_delete_list_.push_back(c);
} }
// Now push a call to the game thread to do the deletes. // Now push a call to the game thread to do the deletes.
g_game->thread()->PushCall([] { g_audio_server->ClearSoundRefDeleteList(); }); g_logic->thread()->PushCall(
[] { g_audio_server->ClearSoundRefDeleteList(); });
} }
void AudioServer::ClearSoundRefDeleteList() { void AudioServer::ClearSoundRefDeleteList() {

View File

@ -40,7 +40,7 @@ class AudioServer {
auto PushComponentUnloadCall( auto PushComponentUnloadCall(
const std::vector<Object::Ref<AssetComponentData>*>& components) -> void; const std::vector<Object::Ref<AssetComponentData>*>& components) -> void;
/// For use by g_game_module(). /// For use by g_logic_module().
auto ClearSoundRefDeleteList() -> void; auto ClearSoundRefDeleteList() -> void;
auto paused() const -> bool { return paused_; } auto paused() const -> bool { return paused_; }

View File

@ -16,11 +16,11 @@
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/dynamics/bg/bg_dynamics.h" #include "ballistica/dynamics/bg/bg_dynamics.h"
#include "ballistica/dynamics/bg/bg_dynamics_server.h" #include "ballistica/dynamics/bg/bg_dynamics_server.h"
#include "ballistica/game/v1_account.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/graphics/text/text_graphics.h" #include "ballistica/graphics/text/text_graphics.h"
#include "ballistica/input/input.h" #include "ballistica/input/input.h"
#include "ballistica/internal/app_internal.h" #include "ballistica/internal/app_internal.h"
#include "ballistica/logic/v1_account.h"
#include "ballistica/networking/network_writer.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
@ -32,7 +32,7 @@
namespace ballistica { namespace ballistica {
// These are set automatically via script; don't modify them here. // These are set automatically via script; don't modify them here.
const int kAppBuildNumber = 20825; const int kAppBuildNumber = 20829;
const char* kAppVersion = "1.7.7"; const char* kAppVersion = "1.7.7";
// Our standalone globals. // Our standalone globals.
@ -50,7 +50,7 @@ AudioServer* g_audio_server{};
BGDynamics* g_bg_dynamics{}; BGDynamics* g_bg_dynamics{};
BGDynamicsServer* g_bg_dynamics_server{}; BGDynamicsServer* g_bg_dynamics_server{};
Context* g_context{}; Context* g_context{};
Game* g_game{}; Logic* g_logic{};
Graphics* g_graphics{}; Graphics* g_graphics{};
GraphicsServer* g_graphics_server{}; GraphicsServer* g_graphics_server{};
Input* g_input{}; Input* g_input{};
@ -129,7 +129,7 @@ auto BallisticaMain(int argc, char** argv) -> int {
g_network_writer = new NetworkWriter(); g_network_writer = new NetworkWriter();
g_input = new Input(); g_input = new Input();
g_app_internal = CreateAppInternal(); g_app_internal = CreateAppInternal();
g_game = new Game(); g_logic = new Logic();
Scene::Init(); Scene::Init();
if (!HeadlessMode()) { if (!HeadlessMode()) {
g_bg_dynamics = new BGDynamics(); g_bg_dynamics = new BGDynamics();
@ -146,7 +146,7 @@ auto BallisticaMain(int argc, char** argv) -> int {
// Phase 2: Set things in motion. // Phase 2: Set things in motion.
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
g_game->OnAppStart(); g_logic->OnAppStart();
g_audio_server->OnAppStart(); g_audio_server->OnAppStart();
g_assets_server->OnAppStart(); g_assets_server->OnAppStart();
g_platform->OnAppStart(); g_platform->OnAppStart();
@ -156,7 +156,7 @@ auto BallisticaMain(int argc, char** argv) -> int {
} }
// Ok; now that we're bootstrapped, tell the game thread to read and apply // Ok; now that we're bootstrapped, tell the game thread to read and apply
// the config which should kick off the real action. // the config which should kick off the real action.
g_game->PushApplyConfigCall(); g_logic->PushApplyConfigCall();
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Phase 3/4: Create a screen and/or kick off game (in other threads). // Phase 3/4: Create a screen and/or kick off game (in other threads).
@ -263,7 +263,7 @@ auto GetAppInstanceUUID() -> const std::string& {
} }
auto InLogicThread() -> bool { auto InLogicThread() -> bool {
return (g_game && g_game->thread()->IsCurrent()); return (g_logic && g_logic->thread()->IsCurrent());
} }
auto InMainThread() -> bool { auto InMainThread() -> bool {
@ -297,10 +297,10 @@ auto Log(const std::string& msg, bool to_stdout, bool to_server) -> void {
auto IsVRMode() -> bool { return g_app->vr_mode; } auto IsVRMode() -> bool { return g_app->vr_mode; }
void ScreenMessage(const std::string& s, const Vector3f& color) { void ScreenMessage(const std::string& s, const Vector3f& color) {
if (g_game) { if (g_logic) {
g_game->PushScreenMessage(s, color); g_logic->PushScreenMessage(s, color);
} else { } else {
Log("ScreenMessage before g_game init (will be lost): '" + s + "'"); Log("ScreenMessage before g_logic init (will be lost): '" + s + "'");
} }
} }

View File

@ -113,10 +113,10 @@ extern AudioServer* g_audio_server;
extern BGDynamics* g_bg_dynamics; extern BGDynamics* g_bg_dynamics;
extern BGDynamicsServer* g_bg_dynamics_server; extern BGDynamicsServer* g_bg_dynamics_server;
extern Context* g_context; extern Context* g_context;
extern Game* g_game;
extern Graphics* g_graphics; extern Graphics* g_graphics;
extern GraphicsServer* g_graphics_server; extern GraphicsServer* g_graphics_server;
extern Input* g_input; extern Input* g_input;
extern Logic* g_logic;
extern Thread* g_main_thread; extern Thread* g_main_thread;
extern Assets* g_assets; extern Assets* g_assets;
extern AssetsServer* g_assets_server; extern AssetsServer* g_assets_server;

View File

@ -2,8 +2,8 @@
#include "ballistica/core/context.h" #include "ballistica/core/context.h"
#include "ballistica/game/host_activity.h"
#include "ballistica/generic/runnable.h" #include "ballistica/generic/runnable.h"
#include "ballistica/logic/host_activity.h"
#include "ballistica/ui/ui.h" #include "ballistica/ui/ui.h"
namespace ballistica { namespace ballistica {

View File

@ -5,8 +5,8 @@
#include <map> #include <map>
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/game/game.h"
#include "ballistica/internal/app_internal.h" #include "ballistica/internal/app_internal.h"
#include "ballistica/logic/logic.h"
#include "ballistica/networking/telnet_server.h" #include "ballistica/networking/telnet_server.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
@ -16,8 +16,8 @@ namespace ballistica {
static void PrintCommon(const std::string& s) { static void PrintCommon(const std::string& s) {
// Print to in-game console. // Print to in-game console.
{ {
if (g_game != nullptr) { if (g_logic != nullptr) {
g_game->PushConsolePrintCall(s); g_logic->PushConsolePrintCall(s);
} else { } else {
if (g_platform != nullptr) { if (g_platform != nullptr) {
g_platform->HandleLog( g_platform->HandleLog(

View File

@ -81,7 +81,6 @@ class DataData;
class Dynamics; class Dynamics;
class FrameDef; class FrameDef;
struct FriendScoreSet; struct FriendScoreSet;
class Game;
class GLContext; class GLContext;
class GlobalsNode; class GlobalsNode;
class Graphics; class Graphics;
@ -97,6 +96,7 @@ struct JointFixedEF;
class Joystick; class Joystick;
class JsonDict; class JsonDict;
class KeyboardInput; class KeyboardInput;
class Logic;
class Material; class Material;
class MaterialAction; class MaterialAction;
class MaterialComponent; class MaterialComponent;

View File

@ -10,9 +10,9 @@
#include "ballistica/dynamics/bg/bg_dynamics_shadow_data.h" #include "ballistica/dynamics/bg/bg_dynamics_shadow_data.h"
#include "ballistica/dynamics/bg/bg_dynamics_volume_light_data.h" #include "ballistica/dynamics/bg/bg_dynamics_volume_light_data.h"
#include "ballistica/dynamics/collision_cache.h" #include "ballistica/dynamics/collision_cache.h"
#include "ballistica/game/game.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/logic/logic.h"
namespace ballistica { namespace ballistica {
@ -87,7 +87,7 @@ class BGDynamicsServer::Terrain {
// back to the main thread to get freed. // back to the main thread to get freed.
if (collide_model_) { if (collide_model_) {
Object::Ref<CollideModelData>* ref = collide_model_; Object::Ref<CollideModelData>* ref = collide_model_;
g_game->thread()->PushCall([ref] { g_logic->thread()->PushCall([ref] {
(**ref).set_last_used_time(GetRealTime()); (**ref).set_last_used_time(GetRealTime());
delete ref; delete ref;
}); });
@ -2315,7 +2315,7 @@ void BGDynamicsServer::Step(StepData* step_data) {
// Now generate a snapshot of our state and send it to the game thread, // Now generate a snapshot of our state and send it to the game thread,
// so they can draw us. // so they can draw us.
BGDynamicsDrawSnapshot* snapshot = CreateDrawSnapshot(); BGDynamicsDrawSnapshot* snapshot = CreateDrawSnapshot();
g_game->thread()->PushCall([snapshot] { g_logic->thread()->PushCall([snapshot] {
snapshot->SetLogicThreadOwnership(); snapshot->SetLogicThreadOwnership();
g_bg_dynamics->SetDrawSnapshot(snapshot); g_bg_dynamics->SetDrawSnapshot(snapshot);
}); });

View File

@ -4,9 +4,9 @@
#include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/dynamics.h"
#include "ballistica/dynamics/material/material_context.h" #include "ballistica/dynamics/material/material_context.h"
#include "ballistica/game/session/client_session.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/logic/session/client_session.h"
#include "ballistica/scene/scene_stream.h" #include "ballistica/scene/scene_stream.h"
namespace ballistica { namespace ballistica {

View File

@ -3,8 +3,8 @@
#include "ballistica/dynamics/material/material_condition_node.h" #include "ballistica/dynamics/material/material_condition_node.h"
#include "ballistica/dynamics/material/material.h" #include "ballistica/dynamics/material/material.h"
#include "ballistica/game/session/client_session.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/logic/session/client_session.h"
#include "ballistica/scene/scene_stream.h" #include "ballistica/scene/scene_stream.h"
namespace ballistica { namespace ballistica {

View File

@ -5,9 +5,9 @@
#include "ballistica/assets/component/sound.h" #include "ballistica/assets/component/sound.h"
#include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/dynamics.h"
#include "ballistica/dynamics/material/material_context.h" #include "ballistica/dynamics/material/material_context.h"
#include "ballistica/game/session/client_session.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/logic/session/client_session.h"
#include "ballistica/scene/scene_stream.h" #include "ballistica/scene/scene_stream.h"
namespace ballistica { namespace ballistica {

View File

@ -4,9 +4,9 @@
#include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/dynamics.h"
#include "ballistica/dynamics/material/material_context.h" #include "ballistica/dynamics/material/material_context.h"
#include "ballistica/game/session/client_session.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/logic/session/client_session.h"
#include "ballistica/scene/scene_stream.h" #include "ballistica/scene/scene_stream.h"
namespace ballistica { namespace ballistica {

View File

@ -3,8 +3,8 @@
#include "ballistica/dynamics/material/sound_material_action.h" #include "ballistica/dynamics/material/sound_material_action.h"
#include "ballistica/dynamics/material/material_context.h" #include "ballistica/dynamics/material/material_context.h"
#include "ballistica/game/session/client_session.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/logic/session/client_session.h"
#include "ballistica/scene/scene_stream.h" #include "ballistica/scene/scene_stream.h"
namespace ballistica { namespace ballistica {

View File

@ -71,7 +71,7 @@ class Part : public Object {
// node/part combo. // node/part combo.
auto IsCollidingWith(int64_t node, int part) const -> bool; auto IsCollidingWith(int64_t node, int part) const -> bool;
// Used by g_game to inform us we're now colliding with another part // Used by g_logic to inform us we're now colliding with another part
// if colliding is false, we've stopped colliding with this part. // if colliding is false, we've stopped colliding with this part.
void SetCollidingWith(int64_t node_id, int part, bool colliding, void SetCollidingWith(int64_t node_id, int part, bool colliding,
bool physical); bool physical);

View File

@ -5,8 +5,8 @@
#include "ballistica/ballistica.h" #include "ballistica/ballistica.h"
#include "ballistica/core/object.h" #include "ballistica/core/object.h"
#include "ballistica/game/game.h"
#include "ballistica/generic/runnable.h" #include "ballistica/generic/runnable.h"
#include "ballistica/logic/logic.h"
namespace ballistica { namespace ballistica {
@ -16,18 +16,18 @@ template <typename T>
class RealTimer : public Object { class RealTimer : public Object {
public: public:
RealTimer(millisecs_t length, bool repeat, T* delegate) { RealTimer(millisecs_t length, bool repeat, T* delegate) {
assert(g_game); assert(g_logic);
assert(InLogicThread()); assert(InLogicThread());
timer_id_ = g_game->NewRealTimer( timer_id_ = g_logic->NewRealTimer(
length, repeat, Object::New<Runnable, Callback>(delegate, this)); length, repeat, Object::New<Runnable, Callback>(delegate, this));
} }
void SetLength(uint32_t length) { void SetLength(uint32_t length) {
assert(InLogicThread()); assert(InLogicThread());
g_game->SetRealTimerLength(timer_id_, length); g_logic->SetRealTimerLength(timer_id_, length);
} }
~RealTimer() override { ~RealTimer() override {
assert(InLogicThread()); assert(InLogicThread());
g_game->DeleteRealTimer(timer_id_); g_logic->DeleteRealTimer(timer_id_);
} }
private: private:

View File

@ -5,10 +5,6 @@
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/app/app_flavor.h" #include "ballistica/app/app_flavor.h"
#include "ballistica/dynamics/bg/bg_dynamics.h" #include "ballistica/dynamics/bg/bg_dynamics.h"
#include "ballistica/game/connection/connection_set.h"
#include "ballistica/game/connection/connection_to_client.h"
#include "ballistica/game/connection/connection_to_host.h"
#include "ballistica/game/session/session.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/graphics/camera.h" #include "ballistica/graphics/camera.h"
#include "ballistica/graphics/component/empty_component.h" #include "ballistica/graphics/component/empty_component.h"
@ -22,6 +18,10 @@
#include "ballistica/graphics/net_graph.h" #include "ballistica/graphics/net_graph.h"
#include "ballistica/graphics/text/text_graphics.h" #include "ballistica/graphics/text/text_graphics.h"
#include "ballistica/input/input.h" #include "ballistica/input/input.h"
#include "ballistica/logic/connection/connection_set.h"
#include "ballistica/logic/connection/connection_to_client.h"
#include "ballistica/logic/connection/connection_to_host.h"
#include "ballistica/logic/session/session.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_context_call.h" #include "ballistica/python/python_context_call.h"
#include "ballistica/scene/node/globals_node.h" #include "ballistica/scene/node/globals_node.h"
@ -293,7 +293,7 @@ void Graphics::DrawMiscOverlays(RenderPass* pass) {
// Add in/out data for any host connection. // Add in/out data for any host connection.
if (ConnectionToHost* connection_to_host = if (ConnectionToHost* connection_to_host =
g_game->connections()->connection_to_host()) { g_logic->connections()->connection_to_host()) {
if (connection_to_host->can_communicate()) show = true; if (connection_to_host->can_communicate()) show = true;
in_size += connection_to_host->GetBytesInPerSecond(); in_size += connection_to_host->GetBytesInPerSecond();
in_size_compressed += connection_to_host->GetBytesInPerSecondCompressed(); in_size_compressed += connection_to_host->GetBytesInPerSecondCompressed();
@ -307,7 +307,7 @@ void Graphics::DrawMiscOverlays(RenderPass* pass) {
ping = connection_to_host->average_ping(); ping = connection_to_host->average_ping();
} else { } else {
int connected_count = 0; int connected_count = 0;
for (auto&& i : g_game->connections()->connections_to_clients()) { for (auto&& i : g_logic->connections()->connections_to_clients()) {
ConnectionToClient* client = i.second.get(); ConnectionToClient* client = i.second.get();
if (client->can_communicate()) { if (client->can_communicate()) {
show = true; show = true;
@ -879,7 +879,7 @@ void Graphics::FadeScreen(bool to, millisecs_t time, PyObject* endcall) {
if (g_buildconfig.debug_build()) { if (g_buildconfig.debug_build()) {
Log("WARNING: 2 fades overlapping; running first fade-end-call early"); Log("WARNING: 2 fades overlapping; running first fade-end-call early");
} }
g_game->PushPythonCall(fade_end_call_); g_logic->PushPythonCall(fade_end_call_);
fade_end_call_.Clear(); fade_end_call_.Clear();
} }
set_fade_start_on_next_draw_ = true; set_fade_start_on_next_draw_ = true;
@ -991,17 +991,17 @@ void Graphics::BuildAndPushFrameDef() {
// We should not be building/pushing any frames until after // We should not be building/pushing any frames until after
// app-launch-commands have been run.. // app-launch-commands have been run..
BA_PRECONDITION_FATAL(g_game->ran_app_launch_commands()); BA_PRECONDITION_FATAL(g_logic->ran_app_launch_commands());
// This should no longer be necessary.. // This should no longer be necessary..
WaitForRendererToExist(); WaitForRendererToExist();
Session* session = g_game->GetForegroundSession(); Session* session = g_logic->GetForegroundSession();
bool session_fills_screen = session ? session->DoesFillScreen() : false; bool session_fills_screen = session ? session->DoesFillScreen() : false;
millisecs_t real_time = GetRealTime(); millisecs_t real_time = GetRealTime();
// Store how much time this frame_def represents. // Store how much time this frame_def represents.
millisecs_t net_time = g_game->master_time(); millisecs_t net_time = g_logic->master_time();
millisecs_t elapsed = millisecs_t elapsed =
std::min(millisecs_t{50}, net_time - last_create_frame_def_time_); std::min(millisecs_t{50}, net_time - last_create_frame_def_time_);
last_create_frame_def_time_ = net_time; last_create_frame_def_time_ = net_time;
@ -1010,7 +1010,7 @@ void Graphics::BuildAndPushFrameDef() {
FrameDef* frame_def = GetEmptyFrameDef(); FrameDef* frame_def = GetEmptyFrameDef();
frame_def->set_real_time(real_time); frame_def->set_real_time(real_time);
frame_def->set_base_time(g_game->master_time()); frame_def->set_base_time(g_logic->master_time());
frame_def->set_base_time_elapsed(elapsed); frame_def->set_base_time_elapsed(elapsed);
frame_def->set_frame_number(frame_def_count_++); frame_def->set_frame_number(frame_def_count_++);
@ -1238,7 +1238,7 @@ void Graphics::DrawFades(FrameDef* frame_def, millisecs_t real_time) {
} else { } else {
fade_ = 0; fade_ = 0;
if (!was_done && fade_end_call_.exists()) { if (!was_done && fade_end_call_.exists()) {
g_game->PushPythonCall(fade_end_call_); g_logic->PushPythonCall(fade_end_call_);
fade_end_call_.Clear(); fade_end_call_.Clear();
} }
} }
@ -1801,7 +1801,7 @@ void Graphics::ScreenResize(float virtual_width, float virtual_height,
void Graphics::ScreenMessageEntry::UpdateTranslation() { void Graphics::ScreenMessageEntry::UpdateTranslation() {
if (translation_dirty) { if (translation_dirty) {
s_translated = g_game->CompileResourceString( s_translated = g_logic->CompileResourceString(
s_raw, "Graphics::ScreenMessageEntry::UpdateTranslation"); s_raw, "Graphics::ScreenMessageEntry::UpdateTranslation");
translation_dirty = false; translation_dirty = false;
mesh_dirty = true; mesh_dirty = true;

View File

@ -86,7 +86,7 @@ auto GraphicsServer::GetRenderFrameDef() -> FrameDef* {
// Tell the game thread we're ready for the next frame_def so it can start // Tell the game thread we're ready for the next frame_def so it can start
// building it while we render this one. // building it while we render this one.
g_game->PushFrameDefRequest(); g_logic->PushFrameDefRequest();
return frame_def; return frame_def;
} }
@ -197,7 +197,7 @@ void GraphicsServer::ReloadMedia() {
// Now tell the game thread to kick off loads for everything, flip on // Now tell the game thread to kick off loads for everything, flip on
// progress bar drawing, and then tell the graphics thread to stop ignoring // progress bar drawing, and then tell the graphics thread to stop ignoring
// frame-defs. // frame-defs.
g_game->thread()->PushCall([this] { g_logic->thread()->PushCall([this] {
g_assets->MarkAllAssetsForLoad(); g_assets->MarkAllAssetsForLoad();
g_graphics->EnableProgressBar(false); g_graphics->EnableProgressBar(false);
PushRemoveRenderHoldCall(); PushRemoveRenderHoldCall();
@ -248,7 +248,7 @@ void GraphicsServer::RebuildLostContext() {
// Now tell the game thread to kick off loads for everything, flip on progress // Now tell the game thread to kick off loads for everything, flip on progress
// bar drawing, and then tell the graphics thread to stop ignoring frame-defs. // bar drawing, and then tell the graphics thread to stop ignoring frame-defs.
g_game->thread()->PushCall([this] { g_logic->thread()->PushCall([this] {
g_assets->MarkAllAssetsForLoad(); g_assets->MarkAllAssetsForLoad();
g_graphics->EnableProgressBar(false); g_graphics->EnableProgressBar(false);
PushRemoveRenderHoldCall(); PushRemoveRenderHoldCall();
@ -356,7 +356,7 @@ void GraphicsServer::SetScreen(bool fullscreen, int width, int height,
// what types of textures to load, etc) // what types of textures to load, etc)
if (!initial_screen_created_) { if (!initial_screen_created_) {
initial_screen_created_ = true; initial_screen_created_ = true;
g_game->PushInitialScreenCreatedCall(); g_logic->PushInitialScreenCreatedCall();
} }
} }
@ -403,8 +403,8 @@ void GraphicsServer::HandleFullContextScreenRebuild(
UpdateVirtualScreenRes(); UpdateVirtualScreenRes();
// Inform the game thread of the latest values. // Inform the game thread of the latest values.
g_game->PushScreenResizeCall(res_x_virtual_, res_y_virtual_, res_x_, g_logic->PushScreenResizeCall(res_x_virtual_, res_y_virtual_, res_x_,
res_y_); res_y_);
} }
if (!renderer_) { if (!renderer_) {
@ -462,7 +462,7 @@ void GraphicsServer::HandleFullContextScreenRebuild(
// Now tell the game thread to kick off loads for everything, flip on // Now tell the game thread to kick off loads for everything, flip on
// progress bar drawing, and then tell the graphics thread to stop ignoring // progress bar drawing, and then tell the graphics thread to stop ignoring
// frame-defs. // frame-defs.
g_game->thread()->PushCall([this] { g_logic->thread()->PushCall([this] {
g_assets->MarkAllAssetsForLoad(); g_assets->MarkAllAssetsForLoad();
g_graphics->set_internal_components_inited(false); g_graphics->set_internal_components_inited(false);
g_graphics->EnableProgressBar(false); g_graphics->EnableProgressBar(false);
@ -514,7 +514,7 @@ void GraphicsServer::VideoResize(float h, float v) {
UpdateVirtualScreenRes(); UpdateVirtualScreenRes();
// Inform the game thread of the latest values. // Inform the game thread of the latest values.
g_game->PushScreenResizeCall(res_x_virtual_, res_y_virtual_, res_x_, res_y_); g_logic->PushScreenResizeCall(res_x_virtual_, res_y_virtual_, res_x_, res_y_);
if (renderer_) { if (renderer_) {
renderer_->ScreenSizeChanged(); renderer_->ScreenSizeChanged();
} }
@ -775,7 +775,7 @@ void GraphicsServer::PushComponentUnloadCall(
} }
// ..and then ship these pointers back to the game thread so it can free the // ..and then ship these pointers back to the game thread so it can free the
// references. // references.
g_game->PushFreeAssetComponentRefsCall(components); g_logic->PushFreeAssetComponentRefsCall(components);
}); });
} }

View File

@ -4,13 +4,13 @@
#include "ballistica/graphics/vr_graphics.h" #include "ballistica/graphics/vr_graphics.h"
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/game/game.h"
#include "ballistica/graphics/camera.h" #include "ballistica/graphics/camera.h"
#include "ballistica/graphics/component/object_component.h" #include "ballistica/graphics/component/object_component.h"
#include "ballistica/graphics/component/simple_component.h" #include "ballistica/graphics/component/simple_component.h"
#include "ballistica/graphics/component/special_component.h" #include "ballistica/graphics/component/special_component.h"
#include "ballistica/graphics/frame_def.h" #include "ballistica/graphics/frame_def.h"
#include "ballistica/graphics/render_pass.h" #include "ballistica/graphics/render_pass.h"
#include "ballistica/logic/logic.h"
#include "ballistica/scene/node/globals_node.h" #include "ballistica/scene/node/globals_node.h"
namespace ballistica { namespace ballistica {
@ -290,7 +290,7 @@ void VRGraphics::DrawVRControllers(FrameDef* frame_def) {
} }
// test right hand // test right hand
const VRHandsState& s(g_game->vr_hands_state()); const VRHandsState& s(g_logic->vr_hands_state());
switch (s.r.type) { switch (s.r.type) {
case VRHandType::kOculusTouchR: case VRHandType::kOculusTouchR:

View File

@ -2,8 +2,8 @@
#include "ballistica/input/device/client_input_device.h" #include "ballistica/input/device/client_input_device.h"
#include "ballistica/game/connection/connection_to_client.h" #include "ballistica/logic/connection/connection_to_client.h"
#include "ballistica/game/player.h" #include "ballistica/logic/player.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
namespace ballistica { namespace ballistica {

View File

@ -6,11 +6,11 @@
#include <unordered_map> #include <unordered_map>
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/game/connection/connection_to_host.h"
#include "ballistica/game/player.h"
#include "ballistica/game/session/host_session.h"
#include "ballistica/game/session/net_client_session.h"
#include "ballistica/internal/app_internal.h" #include "ballistica/internal/app_internal.h"
#include "ballistica/logic/connection/connection_to_host.h"
#include "ballistica/logic/player.h"
#include "ballistica/logic/session/host_session.h"
#include "ballistica/logic/session/net_client_session.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
#include "ballistica/python/class/python_class_input_device.h" #include "ballistica/python/class/python_class_input_device.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
@ -109,13 +109,13 @@ auto InputDevice::GetDefaultPlayerName() -> std::string {
auto InputDevice::GetButtonName(int id) -> std::string { auto InputDevice::GetButtonName(int id) -> std::string {
// By default just say 'button 1' or whatnot. // By default just say 'button 1' or whatnot.
// FIXME: should return this in Lstr json form. // FIXME: should return this in Lstr json form.
return g_game->GetResourceString("buttonText") + " " + std::to_string(id); return g_logic->GetResourceString("buttonText") + " " + std::to_string(id);
} }
auto InputDevice::GetAxisName(int id) -> std::string { auto InputDevice::GetAxisName(int id) -> std::string {
// By default just return 'axis 5' or whatnot. // By default just return 'axis 5' or whatnot.
// FIXME: should return this in Lstr json form. // FIXME: should return this in Lstr json form.
return g_game->GetResourceString("axisText") + " " + std::to_string(id); return g_logic->GetResourceString("axisText") + " " + std::to_string(id);
} }
auto InputDevice::HasMeaningfulButtonNames() -> bool { return false; } auto InputDevice::HasMeaningfulButtonNames() -> bool { return false; }
@ -207,7 +207,7 @@ void InputDevice::RequestPlayer() {
assert(InLogicThread()); assert(InLogicThread());
// Make note that we're being used in some way. // Make note that we're being used in some way.
last_input_time_ = g_game->master_time(); last_input_time_ = g_logic->master_time();
if (player_.exists()) { if (player_.exists()) {
Log("Error: InputDevice::RequestPlayer()" Log("Error: InputDevice::RequestPlayer()"
@ -222,14 +222,14 @@ void InputDevice::RequestPlayer() {
// If we have a local host-session, ask it for a player.. otherwise if we have // If we have a local host-session, ask it for a player.. otherwise if we have
// a client-session, ask it for a player. // a client-session, ask it for a player.
assert(g_game); assert(g_logic);
if (auto* hs = dynamic_cast<HostSession*>(g_game->GetForegroundSession())) { if (auto* hs = dynamic_cast<HostSession*>(g_logic->GetForegroundSession())) {
{ {
Python::ScopedCallLabel label("requestPlayer"); Python::ScopedCallLabel label("requestPlayer");
hs->RequestPlayer(this); hs->RequestPlayer(this);
} }
} else if (auto* client_session = dynamic_cast<NetClientSession*>( } else if (auto* client_session = dynamic_cast<NetClientSession*>(
g_game->GetForegroundSession())) { g_logic->GetForegroundSession())) {
if (ConnectionToHost* connection_to_host = if (ConnectionToHost* connection_to_host =
client_session->connection_to_host()) { client_session->connection_to_host()) {
std::vector<uint8_t> data(2); std::vector<uint8_t> data(2);
@ -270,7 +270,7 @@ void InputDevice::Update() {
void InputDevice::UpdateLastInputTime() { void InputDevice::UpdateLastInputTime() {
// Keep our own individual time, and also let // Keep our own individual time, and also let
// the overall input system know something happened. // the overall input system know something happened.
last_input_time_ = g_game->master_time(); last_input_time_ = g_logic->master_time();
g_input->mark_input_active(); g_input->mark_input_active();
} }

View File

@ -6,9 +6,9 @@
#include "ballistica/app/app_flavor.h" #include "ballistica/app/app_flavor.h"
#include "ballistica/audio/audio.h" #include "ballistica/audio/audio.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/connection/connection_set.h"
#include "ballistica/game/player.h"
#include "ballistica/graphics/renderer.h" #include "ballistica/graphics/renderer.h"
#include "ballistica/logic/connection/connection_set.h"
#include "ballistica/logic/player.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_command.h" #include "ballistica/python/python_command.h"
#include "ballistica/ui/root_ui.h" #include "ballistica/ui/root_ui.h"
@ -183,13 +183,13 @@ auto Joystick::GetButtonName(int index) -> std::string {
if (strstr(GetDeviceName().c_str(), "Samsung Game Pad EI")) { if (strstr(GetDeviceName().c_str(), "Samsung Game Pad EI")) {
switch (index) { switch (index) {
case 101: case 101:
return g_game->CharStr(SpecialChar::kDiceButton4); // Y return g_logic->CharStr(SpecialChar::kDiceButton4); // Y
case 100: case 100:
return g_game->CharStr(SpecialChar::kDiceButton3); // X return g_logic->CharStr(SpecialChar::kDiceButton3); // X
case 98: case 98:
return g_game->CharStr(SpecialChar::kDiceButton2); // B return g_logic->CharStr(SpecialChar::kDiceButton2); // B
case 97: case 97:
return g_game->CharStr(SpecialChar::kDiceButton1); // A return g_logic->CharStr(SpecialChar::kDiceButton1); // A
default: default:
break; break;
} }
@ -272,13 +272,13 @@ auto Joystick::GetButtonName(int index) -> std::string {
case 204: case 204:
return "B16"; return "B16";
case 90: case 90:
return g_game->CharStr(SpecialChar::kRewindButton); return g_logic->CharStr(SpecialChar::kRewindButton);
case 91: case 91:
return g_game->CharStr(SpecialChar::kFastForwardButton); return g_logic->CharStr(SpecialChar::kFastForwardButton);
case 24: case 24:
return g_game->CharStr(SpecialChar::kDpadCenterButton); return g_logic->CharStr(SpecialChar::kDpadCenterButton);
case 86: case 86:
return g_game->CharStr(SpecialChar::kPlayPauseButton); return g_logic->CharStr(SpecialChar::kPlayPauseButton);
default: default:
break; break;
} }
@ -536,7 +536,7 @@ void Joystick::HandleSDLEvent(const SDL_Event* e) {
// If we've got a child joystick, send them any events they're set to handle. // If we've got a child joystick, send them any events they're set to handle.
if (child_joy_stick_) { if (child_joy_stick_) {
assert(g_game); assert(g_logic);
bool send = false; bool send = false;
switch (e->type) { switch (e->type) {
@ -762,14 +762,14 @@ void Joystick::HandleSDLEvent(const SDL_Event* e) {
} else { } else {
// If there's no menu up, // If there's no menu up,
// tell the game to pop it up and snag menu ownership for ourself. // tell the game to pop it up and snag menu ownership for ourself.
g_game->PushMainMenuPressCall(this); g_logic->PushMainMenuPressCall(this);
return; return;
} }
} }
// On our oculus build, select presses reset the orientation. // On our oculus build, select presses reset the orientation.
if (e->jbutton.button == vr_reorient_button_ && IsVRMode()) { if (e->jbutton.button == vr_reorient_button_ && IsVRMode()) {
ScreenMessage(g_game->GetResourceString("vrOrientationResetText"), ScreenMessage(g_logic->GetResourceString("vrOrientationResetText"),
{0, 1, 0}); {0, 1, 0});
g_app->reset_vr_orientation = true; g_app->reset_vr_orientation = true;
return; return;
@ -991,8 +991,8 @@ void Joystick::HandleSDLEvent(const SDL_Event* e) {
} else { } else {
// FIXME: Need a call we can make for this. // FIXME: Need a call we can make for this.
bool do_party_button = false; bool do_party_button = false;
int party_size = g_game->GetPartySize(); int party_size = g_logic->GetPartySize();
if (party_size > 1 || g_game->connections()->connection_to_host() if (party_size > 1 || g_logic->connections()->connection_to_host()
|| g_ui->root_ui()->always_draw_party_icon()) { || g_ui->root_ui()->always_draw_party_icon()) {
do_party_button = true; do_party_button = true;
} }
@ -1533,7 +1533,7 @@ auto Joystick::GetPartyButtonName() const -> std::string {
if (g_buildconfig.iircade_build()) { if (g_buildconfig.iircade_build()) {
return "X"; return "X";
} }
return g_game->CharStr(SpecialChar::kTopButton); return g_logic->CharStr(SpecialChar::kTopButton);
} }
} // namespace ballistica } // namespace ballistica

View File

@ -2,7 +2,7 @@
#include "ballistica/input/device/keyboard_input.h" #include "ballistica/input/device/keyboard_input.h"
#include "ballistica/game/player.h" #include "ballistica/logic/player.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/ui/ui.h" #include "ballistica/ui/ui.h"
@ -139,7 +139,7 @@ auto KeyboardInput::HandleKey(const SDL_Keysym* keysym, bool repeat, bool down)
// Bring up menu if start is pressed. // Bring up menu if start is pressed.
if (keysym->sym == start_key_ && !repeat && g_ui && g_ui->screen_root_widget() if (keysym->sym == start_key_ && !repeat && g_ui && g_ui->screen_root_widget()
&& g_ui->screen_root_widget()->GetChildCount() == 0) { && g_ui->screen_root_widget()->GetChildCount() == 0) {
g_game->PushMainMenuPressCall(this); g_logic->PushMainMenuPressCall(this);
return true; return true;
} }

View File

@ -2,9 +2,9 @@
#include "ballistica/input/device/test_input.h" #include "ballistica/input/device/test_input.h"
#include "ballistica/game/game.h"
#include "ballistica/input/device/joystick.h" #include "ballistica/input/device/joystick.h"
#include "ballistica/input/input.h" #include "ballistica/input/input.h"
#include "ballistica/logic/logic.h"
#include "ballistica/platform/min_sdl.h" #include "ballistica/platform/min_sdl.h"
namespace ballistica { namespace ballistica {

View File

@ -4,10 +4,10 @@
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/app/app_config.h" #include "ballistica/app/app_config.h"
#include "ballistica/game/host_activity.h"
#include "ballistica/game/player.h"
#include "ballistica/graphics/camera.h" #include "ballistica/graphics/camera.h"
#include "ballistica/graphics/component/simple_component.h" #include "ballistica/graphics/component/simple_component.h"
#include "ballistica/logic/host_activity.h"
#include "ballistica/logic/player.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/scene/node/player_node.h" #include "ballistica/scene/node/player_node.h"
#include "ballistica/ui/ui.h" #include "ballistica/ui/ui.h"
@ -504,12 +504,12 @@ void TouchInput::Draw(FrameDef* frame_def) {
// to pull a node for the player we're attached to. // to pull a node for the player we're attached to.
if (HostActivity* host_activity = if (HostActivity* host_activity =
g_game->GetForegroundContext().GetHostActivity()) { g_logic->GetForegroundContext().GetHostActivity()) {
if (Player* player = GetPlayer()) { if (Player* player = GetPlayer()) {
player_node = host_activity->scene()->GetPlayerNode(player->id()); player_node = host_activity->scene()->GetPlayerNode(player->id());
} }
} else { } else {
if (Scene* scene = g_game->GetForegroundScene()) { if (Scene* scene = g_logic->GetForegroundScene()) {
player_node = scene->GetPlayerNode(remote_player_id()); player_node = scene->GetPlayerNode(remote_player_id());
} }
} }
@ -944,8 +944,9 @@ auto TouchInput::HandleTouchDown(void* touch, float x, float y) -> bool {
// ..so lets issue a warning to that effect if there's already // ..so lets issue a warning to that effect if there's already
// controllers active.. (only if we got a player though). // controllers active.. (only if we got a player though).
if (attached_to_player() && g_input->HaveControllerWithPlayer()) { if (attached_to_player() && g_input->HaveControllerWithPlayer()) {
ScreenMessage(g_game->GetResourceString("touchScreenJoinWarningText"), ScreenMessage(
{1.0f, 1.0f, 0.0f}); g_logic->GetResourceString("touchScreenJoinWarningText"),
{1.0f, 1.0f, 0.0f});
} }
} }
} else { } else {

View File

@ -6,12 +6,12 @@
#include "ballistica/app/app_config.h" #include "ballistica/app/app_config.h"
#include "ballistica/audio/audio.h" #include "ballistica/audio/audio.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/player.h"
#include "ballistica/graphics/camera.h" #include "ballistica/graphics/camera.h"
#include "ballistica/input/device/joystick.h" #include "ballistica/input/device/joystick.h"
#include "ballistica/input/device/keyboard_input.h" #include "ballistica/input/device/keyboard_input.h"
#include "ballistica/input/device/test_input.h" #include "ballistica/input/device/test_input.h"
#include "ballistica/input/device/touch_input.h" #include "ballistica/input/device/touch_input.h"
#include "ballistica/logic/player.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/ui/console.h" #include "ballistica/ui/console.h"
#include "ballistica/ui/root_ui.h" #include "ballistica/ui/root_ui.h"
@ -321,7 +321,7 @@ static const char* const scancode_names[SDL_NUM_SCANCODES] = {
Input::Input() {} Input::Input() {}
void Input::PushCreateKeyboardInputDevices() { void Input::PushCreateKeyboardInputDevices() {
g_game->thread()->PushCall([this] { CreateKeyboardInputDevices(); }); g_logic->thread()->PushCall([this] { CreateKeyboardInputDevices(); });
} }
void Input::CreateKeyboardInputDevices() { void Input::CreateKeyboardInputDevices() {
@ -337,7 +337,7 @@ void Input::CreateKeyboardInputDevices() {
} }
void Input::PushDestroyKeyboardInputDevices() { void Input::PushDestroyKeyboardInputDevices() {
g_game->thread()->PushCall([this] { DestroyKeyboardInputDevices(); }); g_logic->thread()->PushCall([this] { DestroyKeyboardInputDevices(); });
} }
void Input::DestroyKeyboardInputDevices() { void Input::DestroyKeyboardInputDevices() {
@ -460,25 +460,25 @@ void Input::AnnounceConnects() {
// If there's been several connected, just give a number. // If there's been several connected, just give a number.
if (explicit_bool(do_print)) { if (explicit_bool(do_print)) {
if (newly_connected_controllers_.size() > 1) { if (newly_connected_controllers_.size() > 1) {
std::string s = g_game->GetResourceString("controllersDetectedText"); std::string s = g_logic->GetResourceString("controllersDetectedText");
Utils::StringReplaceOne( Utils::StringReplaceOne(
&s, "${COUNT}", &s, "${COUNT}",
std::to_string(newly_connected_controllers_.size())); std::to_string(newly_connected_controllers_.size()));
ScreenMessage(s); ScreenMessage(s);
} else { } else {
ScreenMessage(g_game->GetResourceString("controllerDetectedText")); ScreenMessage(g_logic->GetResourceString("controllerDetectedText"));
} }
} }
} else { } else {
// If there's been several connected, just give a number. // If there's been several connected, just give a number.
if (newly_connected_controllers_.size() > 1) { if (newly_connected_controllers_.size() > 1) {
std::string s = g_game->GetResourceString("controllersConnectedText"); std::string s = g_logic->GetResourceString("controllersConnectedText");
Utils::StringReplaceOne( Utils::StringReplaceOne(
&s, "${COUNT}", std::to_string(newly_connected_controllers_.size())); &s, "${COUNT}", std::to_string(newly_connected_controllers_.size()));
ScreenMessage(s); ScreenMessage(s);
} else { } else {
// If its just one, name it. // If its just one, name it.
std::string s = g_game->GetResourceString("controllerConnectedText"); std::string s = g_logic->GetResourceString("controllerConnectedText");
Utils::StringReplaceOne(&s, "${CONTROLLER}", Utils::StringReplaceOne(&s, "${CONTROLLER}",
newly_connected_controllers_.front()); newly_connected_controllers_.front());
ScreenMessage(s); ScreenMessage(s);
@ -492,13 +492,13 @@ void Input::AnnounceConnects() {
void Input::AnnounceDisconnects() { void Input::AnnounceDisconnects() {
// If there's been several connected, just give a number. // If there's been several connected, just give a number.
if (newly_disconnected_controllers_.size() > 1) { if (newly_disconnected_controllers_.size() > 1) {
std::string s = g_game->GetResourceString("controllersDisconnectedText"); std::string s = g_logic->GetResourceString("controllersDisconnectedText");
Utils::StringReplaceOne( Utils::StringReplaceOne(
&s, "${COUNT}", std::to_string(newly_disconnected_controllers_.size())); &s, "${COUNT}", std::to_string(newly_disconnected_controllers_.size()));
ScreenMessage(s); ScreenMessage(s);
} else { } else {
// If its just one, name it. // If its just one, name it.
std::string s = g_game->GetResourceString("controllerDisconnectedText"); std::string s = g_logic->GetResourceString("controllerDisconnectedText");
Utils::StringReplaceOne(&s, "${CONTROLLER}", Utils::StringReplaceOne(&s, "${CONTROLLER}",
newly_disconnected_controllers_.front()); newly_disconnected_controllers_.front());
ScreenMessage(s); ScreenMessage(s);
@ -520,9 +520,9 @@ void Input::ShowStandardInputDeviceConnectedMessage(InputDevice* j) {
// Set a timer to go off and announce the accumulated additions. // Set a timer to go off and announce the accumulated additions.
if (connect_print_timer_id_ != 0) { if (connect_print_timer_id_ != 0) {
g_game->DeleteRealTimer(connect_print_timer_id_); g_logic->DeleteRealTimer(connect_print_timer_id_);
} }
connect_print_timer_id_ = g_game->NewRealTimer( connect_print_timer_id_ = g_logic->NewRealTimer(
250, false, NewLambdaRunnable([this] { AnnounceConnects(); })); 250, false, NewLambdaRunnable([this] { AnnounceConnects(); }));
} }
@ -535,15 +535,15 @@ void Input::ShowStandardInputDeviceDisconnectedMessage(InputDevice* j) {
// Set a timer to go off and announce the accumulated additions. // Set a timer to go off and announce the accumulated additions.
if (disconnect_print_timer_id_ != 0) { if (disconnect_print_timer_id_ != 0) {
g_game->DeleteRealTimer(disconnect_print_timer_id_); g_logic->DeleteRealTimer(disconnect_print_timer_id_);
} }
disconnect_print_timer_id_ = g_game->NewRealTimer( disconnect_print_timer_id_ = g_logic->NewRealTimer(
250, false, NewLambdaRunnable([this] { AnnounceDisconnects(); })); 250, false, NewLambdaRunnable([this] { AnnounceDisconnects(); }));
} }
void Input::PushAddInputDeviceCall(InputDevice* input_device, void Input::PushAddInputDeviceCall(InputDevice* input_device,
bool standard_message) { bool standard_message) {
g_game->thread()->PushCall([this, input_device, standard_message] { g_logic->thread()->PushCall([this, input_device, standard_message] {
AddInputDevice(input_device, standard_message); AddInputDevice(input_device, standard_message);
}); });
} }
@ -605,7 +605,7 @@ void Input::AddInputDevice(InputDevice* input, bool standard_message) {
void Input::PushRemoveInputDeviceCall(InputDevice* input_device, void Input::PushRemoveInputDeviceCall(InputDevice* input_device,
bool standard_message) { bool standard_message) {
g_game->thread()->PushCall([this, input_device, standard_message] { g_logic->thread()->PushCall([this, input_device, standard_message] {
RemoveInputDevice(input_device, standard_message); RemoveInputDevice(input_device, standard_message);
}); });
} }
@ -636,8 +636,8 @@ void Input::RemoveInputDevice(InputDevice* input, bool standard_message) {
// a call to do it; otherwise its possible that someone tries // a call to do it; otherwise its possible that someone tries
// to access the player's inputdevice before the call goes // to access the player's inputdevice before the call goes
// through which would lead to an exception. // through which would lead to an exception.
g_game->RemovePlayer(input->GetPlayer()); g_logic->RemovePlayer(input->GetPlayer());
// g_game->PushRemovePlayerCall(input->GetPlayer()); // g_logic->PushRemovePlayerCall(input->GetPlayer());
} }
if (input->GetRemotePlayer() != nullptr) { if (input->GetRemotePlayer() != nullptr) {
input->RemoveRemotePlayerFromGame(); input->RemoveRemotePlayerFromGame();
@ -672,7 +672,7 @@ void Input::UpdateInputDeviceCounts() {
if (input_device.exists() if (input_device.exists()
&& ((*input_device).IsTouchScreen() || (*input_device).IsKeyboard() && ((*input_device).IsTouchScreen() || (*input_device).IsKeyboard()
|| ((*input_device).last_input_time() != 0 || ((*input_device).last_input_time() != 0
&& g_game->master_time() - (*input_device).last_input_time() && g_logic->master_time() - (*input_device).last_input_time()
< 60000))) { < 60000))) {
total++; total++;
if (!(*input_device).IsTouchScreen()) { if (!(*input_device).IsTouchScreen()) {
@ -703,7 +703,7 @@ auto Input::GetLocalActiveInputDeviceCount() -> int {
assert(InLogicThread()); assert(InLogicThread());
// This can get called alot so lets cache the value. // This can get called alot so lets cache the value.
millisecs_t current_time = g_game->master_time(); millisecs_t current_time = g_logic->master_time();
if (current_time != last_get_local_active_input_device_count_check_time_) { if (current_time != last_get_local_active_input_device_count_check_time_) {
last_get_local_active_input_device_count_check_time_ = current_time; last_get_local_active_input_device_count_check_time_ = current_time;
@ -715,7 +715,7 @@ auto Input::GetLocalActiveInputDeviceCount() -> int {
&& !input_device->IsTouchScreen() && !input_device->IsUIOnly() && !input_device->IsTouchScreen() && !input_device->IsUIOnly()
&& input_device->IsLocal() && input_device->IsLocal()
&& (input_device->last_input_time() != 0 && (input_device->last_input_time() != 0
&& g_game->master_time() - input_device->last_input_time() && g_logic->master_time() - input_device->last_input_time()
< 60000)) { < 60000)) {
count++; count++;
} }
@ -1061,7 +1061,7 @@ void Input::HandleBackPress(bool from_toolbar) {
// if available). // if available).
if (g_ui->screen_root_widget()->GetChildCount() == 0 if (g_ui->screen_root_widget()->GetChildCount() == 0
&& g_ui->overlay_root_widget()->GetChildCount() == 0) { && g_ui->overlay_root_widget()->GetChildCount() == 0) {
g_game->PushMainMenuPressCall(touch_input_); g_logic->PushMainMenuPressCall(touch_input_);
} else { } else {
if (from_toolbar) { if (from_toolbar) {
// NOTE - this means the toolbar back button can never apply to overlay // NOTE - this means the toolbar back button can never apply to overlay
@ -1076,7 +1076,7 @@ void Input::HandleBackPress(bool from_toolbar) {
} }
void Input::PushTextInputEvent(const std::string& text) { void Input::PushTextInputEvent(const std::string& text) {
g_game->thread()->PushCall([this, text] { g_logic->thread()->PushCall([this, text] {
mark_input_active(); mark_input_active();
// Ignore if input is locked. // Ignore if input is locked.
@ -1093,7 +1093,7 @@ void Input::PushTextInputEvent(const std::string& text) {
auto Input::PushJoystickEvent(const SDL_Event& event, InputDevice* input_device) auto Input::PushJoystickEvent(const SDL_Event& event, InputDevice* input_device)
-> void { -> void {
g_game->thread()->PushCall([this, event, input_device] { g_logic->thread()->PushCall([this, event, input_device] {
HandleJoystickEvent(event, input_device); HandleJoystickEvent(event, input_device);
}); });
} }
@ -1125,11 +1125,11 @@ void Input::HandleJoystickEvent(const SDL_Event& event,
} }
void Input::PushKeyPressEvent(const SDL_Keysym& keysym) { void Input::PushKeyPressEvent(const SDL_Keysym& keysym) {
g_game->thread()->PushCall([this, keysym] { HandleKeyPress(&keysym); }); g_logic->thread()->PushCall([this, keysym] { HandleKeyPress(&keysym); });
} }
void Input::PushKeyReleaseEvent(const SDL_Keysym& keysym) { void Input::PushKeyReleaseEvent(const SDL_Keysym& keysym) {
g_game->thread()->PushCall([this, keysym] { HandleKeyRelease(&keysym); }); g_logic->thread()->PushCall([this, keysym] { HandleKeyRelease(&keysym); });
} }
void Input::HandleKeyPress(const SDL_Keysym* keysym) { void Input::HandleKeyPress(const SDL_Keysym* keysym) {
@ -1194,7 +1194,7 @@ void Input::HandleKeyPress(const SDL_Keysym* keysym) {
// Command-Q or Control-Q quits. // Command-Q or Control-Q quits.
if (!repeat_press && keysym->sym == SDLK_q if (!repeat_press && keysym->sym == SDLK_q
&& ((keysym->mod & KMOD_CTRL) || (keysym->mod & KMOD_GUI))) { // NOLINT && ((keysym->mod & KMOD_CTRL) || (keysym->mod & KMOD_GUI))) { // NOLINT
g_game->PushConfirmQuitCall(); g_logic->PushConfirmQuitCall();
return; return;
} }
} }
@ -1223,7 +1223,7 @@ void Input::HandleKeyPress(const SDL_Keysym* keysym) {
// If there's no dialogs/windows up, ask for a menu (owned by the // If there's no dialogs/windows up, ask for a menu (owned by the
// touch-screen if available). // touch-screen if available).
if (g_ui->screen_root_widget()->GetChildCount() == 0) { if (g_ui->screen_root_widget()->GetChildCount() == 0) {
g_game->PushMainMenuPressCall(touch_input_); g_logic->PushMainMenuPressCall(touch_input_);
} }
} }
handled = true; handled = true;
@ -1237,12 +1237,12 @@ void Input::HandleKeyPress(const SDL_Keysym* keysym) {
case SDLK_EQUALS: case SDLK_EQUALS:
case SDLK_PLUS: case SDLK_PLUS:
g_game->ChangeGameSpeed(1); g_logic->ChangeGameSpeed(1);
handled = true; handled = true;
break; break;
case SDLK_MINUS: case SDLK_MINUS:
g_game->ChangeGameSpeed(-1); g_logic->ChangeGameSpeed(-1);
handled = true; handled = true;
break; break;
@ -1253,12 +1253,12 @@ void Input::HandleKeyPress(const SDL_Keysym* keysym) {
} }
case SDLK_F7: case SDLK_F7:
g_game->PushToggleManualCameraCall(); g_logic->PushToggleManualCameraCall();
handled = true; handled = true;
break; break;
case SDLK_F8: case SDLK_F8:
g_game->PushToggleDebugInfoDisplayCall(); g_logic->PushToggleDebugInfoDisplayCall();
handled = true; handled = true;
break; break;
@ -1268,7 +1268,7 @@ void Input::HandleKeyPress(const SDL_Keysym* keysym) {
break; break;
case SDLK_F10: case SDLK_F10:
g_game->PushToggleCollisionGeometryDisplayCall(); g_logic->PushToggleCollisionGeometryDisplayCall();
handled = true; handled = true;
break; break;
@ -1281,7 +1281,7 @@ void Input::HandleKeyPress(const SDL_Keysym* keysym) {
if (g_ui->screen_root_widget()->GetChildCount() == 0 if (g_ui->screen_root_widget()->GetChildCount() == 0
&& g_ui->overlay_root_widget()->GetChildCount() == 0) { && g_ui->overlay_root_widget()->GetChildCount() == 0) {
if (keyboard_input_) { if (keyboard_input_) {
g_game->PushMainMenuPressCall(keyboard_input_); g_logic->PushMainMenuPressCall(keyboard_input_);
} }
} else { } else {
// Ok there's a UI up.. send along a cancel message. // Ok there's a UI up.. send along a cancel message.
@ -1378,7 +1378,7 @@ auto Input::UpdateModKeyStates(const SDL_Keysym* keysym, bool press) -> void {
} }
auto Input::PushMouseScrollEvent(const Vector2f& amount) -> void { auto Input::PushMouseScrollEvent(const Vector2f& amount) -> void {
g_game->thread()->PushCall([this, amount] { HandleMouseScroll(amount); }); g_logic->thread()->PushCall([this, amount] { HandleMouseScroll(amount); });
} }
auto Input::HandleMouseScroll(const Vector2f& amount) -> void { auto Input::HandleMouseScroll(const Vector2f& amount) -> void {
@ -1411,7 +1411,7 @@ auto Input::HandleMouseScroll(const Vector2f& amount) -> void {
auto Input::PushSmoothMouseScrollEvent(const Vector2f& velocity, bool momentum) auto Input::PushSmoothMouseScrollEvent(const Vector2f& velocity, bool momentum)
-> void { -> void {
g_game->thread()->PushCall([this, velocity, momentum] { g_logic->thread()->PushCall([this, velocity, momentum] {
HandleSmoothMouseScroll(velocity, momentum); HandleSmoothMouseScroll(velocity, momentum);
}); });
} }
@ -1446,7 +1446,8 @@ auto Input::HandleSmoothMouseScroll(const Vector2f& velocity, bool momentum)
} }
auto Input::PushMouseMotionEvent(const Vector2f& position) -> void { auto Input::PushMouseMotionEvent(const Vector2f& position) -> void {
g_game->thread()->PushCall([this, position] { HandleMouseMotion(position); }); g_logic->thread()->PushCall(
[this, position] { HandleMouseMotion(position); });
} }
auto Input::HandleMouseMotion(const Vector2f& position) -> void { auto Input::HandleMouseMotion(const Vector2f& position) -> void {
@ -1497,7 +1498,7 @@ auto Input::HandleMouseMotion(const Vector2f& position) -> void {
} }
auto Input::PushMouseDownEvent(int button, const Vector2f& position) -> void { auto Input::PushMouseDownEvent(int button, const Vector2f& position) -> void {
g_game->thread()->PushCall( g_logic->thread()->PushCall(
[this, button, position] { HandleMouseDown(button, position); }); [this, button, position] { HandleMouseDown(button, position); });
} }
@ -1574,7 +1575,7 @@ auto Input::HandleMouseDown(int button, const Vector2f& position) -> void {
} }
auto Input::PushMouseUpEvent(int button, const Vector2f& position) -> void { auto Input::PushMouseUpEvent(int button, const Vector2f& position) -> void {
g_game->thread()->PushCall( g_logic->thread()->PushCall(
[this, button, position] { HandleMouseUp(button, position); }); [this, button, position] { HandleMouseUp(button, position); });
} }
@ -1623,7 +1624,7 @@ auto Input::HandleMouseUp(int button, const Vector2f& position) -> void {
} }
void Input::PushTouchEvent(const TouchEvent& e) { void Input::PushTouchEvent(const TouchEvent& e) {
g_game->thread()->PushCall([e, this] { HandleTouchEvent(e); }); g_logic->thread()->PushCall([e, this] { HandleTouchEvent(e); });
} }
void Input::HandleTouchEvent(const TouchEvent& e) { void Input::HandleTouchEvent(const TouchEvent& e) {

View File

@ -11,9 +11,9 @@
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/assets/assets.h" #include "ballistica/assets/assets.h"
#include "ballistica/game/game.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/input/input.h" #include "ballistica/input/input.h"
#include "ballistica/logic/logic.h"
#include "ballistica/math/vector3f.h" #include "ballistica/math/vector3f.h"
#include "ballistica/networking/network_reader.h" #include "ballistica/networking/network_reader.h"
#include "ballistica/platform/min_sdl.h" #include "ballistica/platform/min_sdl.h"
@ -165,10 +165,10 @@ void RemoteAppServer::HandleData(int socket, uint8_t* buffer, size_t amt,
// Replace ${CONTROLLER} with it in our message. // Replace ${CONTROLLER} with it in our message.
std::string s = std::string s =
g_game->GetResourceString("controllerDisconnectedText"); g_logic->GetResourceString("controllerDisconnectedText");
Utils::StringReplaceOne(&s, "${CONTROLLER}", m); Utils::StringReplaceOne(&s, "${CONTROLLER}", m);
g_game->PushScreenMessage(s, Vector3f(1, 1, 1)); g_logic->PushScreenMessage(s, Vector3f(1, 1, 1));
g_game->PushPlaySoundCall(SystemSoundID::kCorkPop); g_logic->PushPlaySoundCall(SystemSoundID::kCorkPop);
g_input->PushRemoveInputDeviceCall(client->joystick_, false); g_input->PushRemoveInputDeviceCall(client->joystick_, false);
client->joystick_ = nullptr; client->joystick_ = nullptr;
client->in_use = false; client->in_use = false;
@ -367,10 +367,10 @@ auto RemoteAppServer::GetClient(int request_id, struct sockaddr* addr,
snprintf(m, sizeof(m), "%s", clients_[i].display_name); snprintf(m, sizeof(m), "%s", clients_[i].display_name);
// Replace ${CONTROLLER} with it in our message. // Replace ${CONTROLLER} with it in our message.
std::string s = g_game->GetResourceString("controllerReconnectedText"); std::string s = g_logic->GetResourceString("controllerReconnectedText");
Utils::StringReplaceOne(&s, "${CONTROLLER}", m); Utils::StringReplaceOne(&s, "${CONTROLLER}", m);
g_game->PushScreenMessage(s, Vector3f(1, 1, 1)); g_logic->PushScreenMessage(s, Vector3f(1, 1, 1));
g_game->PushPlaySoundCall(SystemSoundID::kGunCock); g_logic->PushPlaySoundCall(SystemSoundID::kGunCock);
} }
clients_[i].in_use = true; clients_[i].in_use = true;
return i; return i;
@ -407,10 +407,10 @@ auto RemoteAppServer::GetClient(int request_id, struct sockaddr* addr,
snprintf(m, sizeof(m), "%s", clients_[i].display_name); snprintf(m, sizeof(m), "%s", clients_[i].display_name);
// Replace ${CONTROLLER} with it in our message. // Replace ${CONTROLLER} with it in our message.
std::string s = g_game->GetResourceString("controllerConnectedText"); std::string s = g_logic->GetResourceString("controllerConnectedText");
Utils::StringReplaceOne(&s, "${CONTROLLER}", m); Utils::StringReplaceOne(&s, "${CONTROLLER}", m);
g_game->PushScreenMessage(s, Vector3f(1, 1, 1)); g_logic->PushScreenMessage(s, Vector3f(1, 1, 1));
g_game->PushPlaySoundCall(SystemSoundID::kGunCock); g_logic->PushPlaySoundCall(SystemSoundID::kGunCock);
std::string utf8 = Utils::GetValidUTF8(clients_[i].display_name, "rsgc1"); std::string utf8 = Utils::GetValidUTF8(clients_[i].display_name, "rsgc1");
clients_[i].joystick_ = Object::NewDeferred<Joystick>( clients_[i].joystick_ = Object::NewDeferred<Joystick>(
-1, // not an sdl joystick -1, // not an sdl joystick
@ -425,7 +425,7 @@ auto RemoteAppServer::GetClient(int request_id, struct sockaddr* addr,
if (Utils::UTF8StringLength(utf8.c_str()) <= 10) { if (Utils::UTF8StringLength(utf8.c_str()) <= 10) {
clients_[i].joystick_->set_custom_default_player_name(utf8); clients_[i].joystick_->set_custom_default_player_name(utf8);
} }
assert(g_game); assert(g_logic);
g_input->PushAddInputDeviceCall(clients_[i].joystick_, false); g_input->PushAddInputDeviceCall(clients_[i].joystick_, false);
return i; return i;
} }
@ -512,7 +512,7 @@ void RemoteAppServer::HandleRemoteEvent(RemoteAppClient* client,
break; break;
} }
if (send) { if (send) {
assert(g_game); assert(g_logic);
g_input->PushJoystickEvent(e, client->joystick_); g_input->PushJoystickEvent(e, client->joystick_);
} }
#pragma clang diagnostic pop #pragma clang diagnostic pop
@ -542,7 +542,7 @@ void RemoteAppServer::HandleRemoteFloatEvent(RemoteAppClient* client,
break; break;
} }
if (send) { if (send) {
assert(g_game); assert(g_logic);
g_input->PushJoystickEvent(e, client->joystick_); g_input->PushJoystickEvent(e, client->joystick_);
} }
#pragma clang diagnostic pop #pragma clang diagnostic pop

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_CLIENT_CONTROLLER_INTERFACE_H_ #ifndef BALLISTICA_LOGIC_CLIENT_CONTROLLER_INTERFACE_H_
#define BALLISTICA_GAME_CLIENT_CONTROLLER_INTERFACE_H_ #define BALLISTICA_LOGIC_CLIENT_CONTROLLER_INTERFACE_H_
#include "ballistica/ballistica.h" #include "ballistica/ballistica.h"
@ -19,4 +19,4 @@ class ClientControllerInterface {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_CLIENT_CONTROLLER_INTERFACE_H_ #endif // BALLISTICA_LOGIC_CLIENT_CONTROLLER_INTERFACE_H_

View File

@ -1,6 +1,6 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/connection/connection.h" #include "ballistica/logic/connection/connection.h"
#include "ballistica/generic/huffman.h" #include "ballistica/generic/huffman.h"
#include "ballistica/generic/json.h" #include "ballistica/generic/json.h"

View File

@ -1,14 +1,14 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_CONNECTION_CONNECTION_H_ #ifndef BALLISTICA_LOGIC_CONNECTION_CONNECTION_H_
#define BALLISTICA_GAME_CONNECTION_CONNECTION_H_ #define BALLISTICA_LOGIC_CONNECTION_CONNECTION_H_
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "ballistica/core/object.h" #include "ballistica/core/object.h"
#include "ballistica/game/player_spec.h" #include "ballistica/logic/player_spec.h"
#include "ballistica/python/python_ref.h" #include "ballistica/python/python_ref.h"
namespace ballistica { namespace ballistica {
@ -142,4 +142,4 @@ class Connection : public Object {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_CONNECTION_CONNECTION_H_ #endif // BALLISTICA_LOGIC_CONNECTION_CONNECTION_H_

View File

@ -1,14 +1,14 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/connection/connection_set.h" #include "ballistica/logic/connection/connection_set.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/connection/connection_to_client_udp.h"
#include "ballistica/game/connection/connection_to_host_udp.h"
#include "ballistica/game/game.h"
#include "ballistica/game/player.h"
#include "ballistica/game/session/host_session.h"
#include "ballistica/input/device/input_device.h" #include "ballistica/input/device/input_device.h"
#include "ballistica/logic/connection/connection_to_client_udp.h"
#include "ballistica/logic/connection/connection_to_host_udp.h"
#include "ballistica/logic/logic.h"
#include "ballistica/logic/player.h"
#include "ballistica/logic/session/host_session.h"
#include "ballistica/networking/network_writer.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
@ -113,7 +113,7 @@ void ConnectionSet::SendChatMessage(const std::string& message,
// spec out of their name(s). // spec out of their name(s).
std::string p_name_combined; std::string p_name_combined;
if (auto* hs = if (auto* hs =
dynamic_cast<HostSession*>(g_game->GetForegroundSession())) { dynamic_cast<HostSession*>(g_logic->GetForegroundSession())) {
for (auto&& p : hs->players()) { for (auto&& p : hs->players()) {
InputDevice* input_device = p->GetInputDevice(); InputDevice* input_device = p->GetInputDevice();
if (p->accepted() && p->name_is_real() && input_device != nullptr if (p->accepted() && p->name_is_real() && input_device != nullptr
@ -192,7 +192,7 @@ void ConnectionSet::SendChatMessage(const std::string& message,
// And display locally if the message is addressed to all. // And display locally if the message is addressed to all.
if (clients == nullptr) { if (clients == nullptr) {
g_game->LocalDisplayChatMessage(msg_out); g_logic->LocalDisplayChatMessage(msg_out);
} }
} }
} }
@ -216,14 +216,14 @@ void ConnectionSet::PushUDPConnectionPacketCall(
const std::vector<uint8_t>& data, const SockAddr& addr) { const std::vector<uint8_t>& data, const SockAddr& addr) {
// Avoid buffer-full errors if something is causing us to write too often; // Avoid buffer-full errors if something is causing us to write too often;
// these are unreliable messages so its ok to just drop them. // these are unreliable messages so its ok to just drop them.
if (!g_game->thread()->CheckPushSafety()) { if (!g_logic->thread()->CheckPushSafety()) {
BA_LOG_ONCE( BA_LOG_ONCE(
"Ignoring excessive udp-connection input packets; (could this be a " "Ignoring excessive udp-connection input packets; (could this be a "
"flood attack?)."); "flood attack?).");
return; return;
} }
g_game->thread()->PushCall( g_logic->thread()->PushCall(
[this, data, addr] { UDPConnectionPacket(data, addr); }); [this, data, addr] { UDPConnectionPacket(data, addr); });
} }
@ -284,7 +284,7 @@ auto ConnectionSet::PrepareForLaunchHostSession() -> void {
connection_to_host_->RequestDisconnect(); connection_to_host_->RequestDisconnect();
connection_to_host_.Clear(); connection_to_host_.Clear();
has_connection_to_host_ = false; has_connection_to_host_ = false;
g_game->UpdateGameRoster(); g_logic->UpdateGameRoster();
} }
} }
@ -303,9 +303,9 @@ auto ConnectionSet::HandleClientDisconnected(int id) -> void {
// gone. Also inform everyone who just left so they can announce it // gone. Also inform everyone who just left so they can announce it
// (technically could consolidate these messages but whatever...). // (technically could consolidate these messages but whatever...).
if (was_connected) { if (was_connected) {
g_game->UpdateGameRoster(); g_logic->UpdateGameRoster();
for (auto&& connection : connections_to_clients_) { for (auto&& connection : connections_to_clients_) {
if (g_game->ShouldAnnouncePartyJoinsAndLeaves()) { if (g_logic->ShouldAnnouncePartyJoinsAndLeaves()) {
connection.second->SendReliableMessage(leave_msg); connection.second->SendReliableMessage(leave_msg);
} }
} }
@ -339,7 +339,7 @@ auto ConnectionSet::DisconnectClient(int client_id, int ban_seconds) -> bool {
// If this is considered a kick, add an entry to our banned list so we // If this is considered a kick, add an entry to our banned list so we
// know not to let them back in for a while. // know not to let them back in for a while.
if (ban_seconds > 0) { if (ban_seconds > 0) {
g_game->BanPlayer(i->second->peer_spec(), 1000 * ban_seconds); g_logic->BanPlayer(i->second->peer_spec(), 1000 * ban_seconds);
} }
i->second->RequestDisconnect(); i->second->RequestDisconnect();
@ -354,24 +354,24 @@ auto ConnectionSet::DisconnectClient(int client_id, int ban_seconds) -> bool {
} }
void ConnectionSet::PushClientDisconnectedCall(int id) { void ConnectionSet::PushClientDisconnectedCall(int id) {
g_game->thread()->PushCall([this, id] { HandleClientDisconnected(id); }); g_logic->thread()->PushCall([this, id] { HandleClientDisconnected(id); });
} }
void ConnectionSet::PushDisconnectedFromHostCall() { void ConnectionSet::PushDisconnectedFromHostCall() {
g_game->thread()->PushCall([this] { g_logic->thread()->PushCall([this] {
if (connection_to_host_.exists()) { if (connection_to_host_.exists()) {
bool was_connected = connection_to_host_->can_communicate(); bool was_connected = connection_to_host_->can_communicate();
connection_to_host_.Clear(); connection_to_host_.Clear();
has_connection_to_host_ = false; has_connection_to_host_ = false;
// Clear out our party roster. // Clear out our party roster.
g_game->UpdateGameRoster(); g_logic->UpdateGameRoster();
// Go back to main menu *if* the connection was fully connected. // Go back to main menu *if* the connection was fully connected.
// Otherwise we're still probably sitting at the main menu // Otherwise we're still probably sitting at the main menu
// so no need to reset it. // so no need to reset it.
if (was_connected) { if (was_connected) {
g_game->RunMainMenu(); g_logic->RunMainMenu();
} }
} }
}); });
@ -379,10 +379,10 @@ void ConnectionSet::PushDisconnectedFromHostCall() {
void ConnectionSet::PushHostConnectedUDPCall(const SockAddr& addr, void ConnectionSet::PushHostConnectedUDPCall(const SockAddr& addr,
bool print_connect_progress) { bool print_connect_progress) {
g_game->thread()->PushCall([this, addr, print_connect_progress] { g_logic->thread()->PushCall([this, addr, print_connect_progress] {
// Attempt to disconnect any clients we have, turn off public-party // Attempt to disconnect any clients we have, turn off public-party
// advertising, etc. // advertising, etc.
g_game->CleanUpBeforeConnectingToHost(); g_logic->CleanUpBeforeConnectingToHost();
print_udp_connect_progress_ = print_connect_progress; print_udp_connect_progress_ = print_connect_progress;
connection_to_host_ = Object::New<ConnectionToHostUDP>(addr); connection_to_host_ = Object::New<ConnectionToHostUDP>(addr);
has_connection_to_host_ = true; has_connection_to_host_ = true;
@ -391,7 +391,7 @@ void ConnectionSet::PushHostConnectedUDPCall(const SockAddr& addr,
} }
void ConnectionSet::PushDisconnectFromHostCall() { void ConnectionSet::PushDisconnectFromHostCall() {
g_game->thread()->PushCall([this] { g_logic->thread()->PushCall([this] {
if (connection_to_host_.exists()) { if (connection_to_host_.exists()) {
connection_to_host_->RequestDisconnect(); connection_to_host_->RequestDisconnect();
} }
@ -562,7 +562,7 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
keep_trying = hc->SwitchProtocol(); keep_trying = hc->SwitchProtocol();
if (!keep_trying) { if (!keep_trying) {
if (!printed_host_disconnect_) { if (!printed_host_disconnect_) {
ScreenMessage(g_game->GetResourceString( ScreenMessage(g_logic->GetResourceString(
"connectionFailedVersionMismatchText"), "connectionFailedVersionMismatchText"),
{1, 0, 0}); {1, 0, 0});
printed_host_disconnect_ = true; printed_host_disconnect_ = true;
@ -572,22 +572,23 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
if (!printed_host_disconnect_) { if (!printed_host_disconnect_) {
if (print_udp_connect_progress_) { if (print_udp_connect_progress_) {
ScreenMessage( ScreenMessage(
g_game->GetResourceString("connectionFailedPartyFullText"), g_logic->GetResourceString("connectionFailedPartyFullText"),
{1, 0, 0}); {1, 0, 0});
} }
printed_host_disconnect_ = true; printed_host_disconnect_ = true;
} }
} else if (data[0] == BA_PACKET_CLIENT_DENY_ALREADY_IN_PARTY) { } else if (data[0] == BA_PACKET_CLIENT_DENY_ALREADY_IN_PARTY) {
if (!printed_host_disconnect_) { if (!printed_host_disconnect_) {
ScreenMessage(g_game->GetResourceString( ScreenMessage(g_logic->GetResourceString(
"connectionFailedHostAlreadyInPartyText"), "connectionFailedHostAlreadyInPartyText"),
{1, 0, 0}); {1, 0, 0});
printed_host_disconnect_ = true; printed_host_disconnect_ = true;
} }
} else { } else {
if (!printed_host_disconnect_) { if (!printed_host_disconnect_) {
ScreenMessage(g_game->GetResourceString("connectionRejectedText"), ScreenMessage(
{1, 0, 0}); g_logic->GetResourceString("connectionRejectedText"),
{1, 0, 0});
printed_host_disconnect_ = true; printed_host_disconnect_ = true;
} }
} }
@ -615,7 +616,7 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
std::string client_instance_uuid = &(client_instance_buffer[0]); std::string client_instance_uuid = &(client_instance_buffer[0]);
if (static_cast<int>(connections_to_clients_.size() + 1) if (static_cast<int>(connections_to_clients_.size() + 1)
>= g_game->public_party_max_size()) { >= g_logic->public_party_max_size()) {
// If we've reached our party size limit (including ourself in that // If we've reached our party size limit (including ourself in that
// count), reject. // count), reject.
@ -730,7 +731,7 @@ void ConnectionSet::SetClientInfoFromMasterServer(
client->HandleMasterServerClientInfo(info_obj); client->HandleMasterServerClientInfo(info_obj);
// Roster will now include account-id... // Roster will now include account-id...
g_game->mark_game_roster_dirty(); g_logic->mark_game_roster_dirty();
break; break;
} }
} }

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_CONNECTION_CONNECTION_SET_H_ #ifndef BALLISTICA_LOGIC_CONNECTION_CONNECTION_SET_H_
#define BALLISTICA_GAME_CONNECTION_CONNECTION_SET_H_ #define BALLISTICA_LOGIC_CONNECTION_CONNECTION_SET_H_
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
@ -118,4 +118,4 @@ class ConnectionSet {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_CONNECTION_CONNECTION_SET_H_ #endif // BALLISTICA_LOGIC_CONNECTION_CONNECTION_SET_H_

View File

@ -1,17 +1,17 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/connection/connection_to_client.h" #include "ballistica/logic/connection/connection_to_client.h"
#include "ballistica/assets/assets.h" #include "ballistica/assets/assets.h"
#include "ballistica/audio/audio.h" #include "ballistica/audio/audio.h"
#include "ballistica/game/client_controller_interface.h"
#include "ballistica/game/connection/connection_set.h"
#include "ballistica/game/game.h"
#include "ballistica/game/player.h"
#include "ballistica/game/session/host_session.h"
#include "ballistica/generic/json.h" #include "ballistica/generic/json.h"
#include "ballistica/input/device/client_input_device.h" #include "ballistica/input/device/client_input_device.h"
#include "ballistica/internal/app_internal.h" #include "ballistica/internal/app_internal.h"
#include "ballistica/logic/client_controller_interface.h"
#include "ballistica/logic/connection/connection_set.h"
#include "ballistica/logic/logic.h"
#include "ballistica/logic/player.h"
#include "ballistica/logic/session/host_session.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_sys.h" #include "ballistica/python/python_sys.h"
@ -69,8 +69,8 @@ ConnectionToClient::~ConnectionToClient() {
} }
// If they had been announced as connected, announce their departure. // If they had been announced as connected, announce their departure.
if (can_communicate() && g_game->ShouldAnnouncePartyJoinsAndLeaves()) { if (can_communicate() && g_logic->ShouldAnnouncePartyJoinsAndLeaves()) {
std::string s = g_game->GetResourceString("playerLeftPartyText"); std::string s = g_logic->GetResourceString("playerLeftPartyText");
Utils::StringReplaceOne(&s, "${NAME}", peer_spec().GetDisplayString()); Utils::StringReplaceOne(&s, "${NAME}", peer_spec().GetDisplayString());
ScreenMessage(s, {1, 0.5f, 0.0f}); ScreenMessage(s, {1, 0.5f, 0.0f});
g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kCorkPop)); g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kCorkPop));
@ -174,7 +174,7 @@ void ConnectionToClient::HandleGamePacket(const std::vector<uint8_t>& data) {
// Compare this against our blocked specs.. if there's a match, reject // Compare this against our blocked specs.. if there's a match, reject
// them. // them.
if (g_game->IsPlayerBanned(peer_spec())) { if (g_logic->IsPlayerBanned(peer_spec())) {
Error(""); Error("");
return; return;
} }
@ -193,7 +193,7 @@ void ConnectionToClient::HandleGamePacket(const std::vector<uint8_t>& data) {
// connection attempt so this will only apply to things like Google // connection attempt so this will only apply to things like Google
// Play invites where we probably want to be more verbose as // Play invites where we probably want to be more verbose as
// to why the game just died. // to why the game just died.
s = g_game->GetResourceString("incompatibleVersionPlayerText"); s = g_logic->GetResourceString("incompatibleVersionPlayerText");
Utils::StringReplaceOne(&s, "${NAME}", Utils::StringReplaceOne(&s, "${NAME}",
peer_spec().GetDisplayString()); peer_spec().GetDisplayString());
} }
@ -210,8 +210,8 @@ void ConnectionToClient::HandleGamePacket(const std::vector<uint8_t>& data) {
next_kick_vote_allow_time_ = GetRealTime() + kNewClientKickVoteDelay; next_kick_vote_allow_time_ = GetRealTime() + kNewClientKickVoteDelay;
// At this point we have their name, so lets announce their arrival. // At this point we have their name, so lets announce their arrival.
if (g_game->ShouldAnnouncePartyJoinsAndLeaves()) { if (g_logic->ShouldAnnouncePartyJoinsAndLeaves()) {
std::string s = g_game->GetResourceString("playerJoinedPartyText"); std::string s = g_logic->GetResourceString("playerJoinedPartyText");
Utils::StringReplaceOne(&s, "${NAME}", Utils::StringReplaceOne(&s, "${NAME}",
peer_spec().GetDisplayString()); peer_spec().GetDisplayString());
ScreenMessage(s, {0.5f, 1, 0.5f}); ScreenMessage(s, {0.5f, 1, 0.5f});
@ -220,7 +220,7 @@ void ConnectionToClient::HandleGamePacket(const std::vector<uint8_t>& data) {
// Also mark the time for flashing the 'someone just joined your // Also mark the time for flashing the 'someone just joined your
// party' message in the corner. // party' message in the corner.
g_game->set_last_connection_to_client_join_time(GetRealTime()); g_logic->set_last_connection_to_client_join_time(GetRealTime());
// Added midway through protocol 29: // Added midway through protocol 29:
// We now send a json dict of info about ourself first thing. This // We now send a json dict of info about ourself first thing. This
@ -234,10 +234,10 @@ void ConnectionToClient::HandleGamePacket(const std::vector<uint8_t>& data) {
cJSON_CreateNumber(kAppBuildNumber)); cJSON_CreateNumber(kAppBuildNumber));
// Add a name entry if we've got a public party name set. // Add a name entry if we've got a public party name set.
if (!g_game->public_party_name().empty()) { if (!g_logic->public_party_name().empty()) {
cJSON_AddItemToObject( cJSON_AddItemToObject(
info_dict, "n", info_dict, "n",
cJSON_CreateString(g_game->public_party_name().c_str())); cJSON_CreateString(g_logic->public_party_name().c_str()));
} }
std::string info = cJSON_PrintUnformatted(info_dict); std::string info = cJSON_PrintUnformatted(info_dict);
cJSON_Delete(info_dict); cJSON_Delete(info_dict);
@ -253,23 +253,23 @@ void ConnectionToClient::HandleGamePacket(const std::vector<uint8_t>& data) {
join_msg[0] = BA_MESSAGE_PARTY_MEMBER_JOINED; join_msg[0] = BA_MESSAGE_PARTY_MEMBER_JOINED;
memcpy(&(join_msg[1]), joiner_spec.c_str(), joiner_spec.size()); memcpy(&(join_msg[1]), joiner_spec.c_str(), joiner_spec.size());
for (auto&& i : g_game->connections()->connections_to_clients()) { for (auto&& i : g_logic->connections()->connections_to_clients()) {
// Also send a 'party-member-joined' notification to all clients // Also send a 'party-member-joined' notification to all clients
// *except* the new one. // *except* the new one.
if (i.second.exists() && i.second.get() != this if (i.second.exists() && i.second.get() != this
&& g_game->ShouldAnnouncePartyJoinsAndLeaves()) { && g_logic->ShouldAnnouncePartyJoinsAndLeaves()) {
i.second->SendReliableMessage(join_msg); i.second->SendReliableMessage(join_msg);
} }
} }
// Update the game party roster and send it to all clients (including // Update the game party roster and send it to all clients (including
// this new one). // this new one).
g_game->UpdateGameRoster(); g_logic->UpdateGameRoster();
// Lastly, we hand this connection over to whoever is currently // Lastly, we hand this connection over to whoever is currently
// feeding client connections. // feeding client connections.
if (g_game->connections()->client_controller()) { if (g_logic->connections()->client_controller()) {
SetController(g_game->connections()->client_controller()); SetController(g_logic->connections()->client_controller());
} }
} }
break; break;
@ -295,7 +295,7 @@ void ConnectionToClient::SendScreenMessage(const std::string& s, float r,
// Older clients don't support the screen-message message, so in that case // Older clients don't support the screen-message message, so in that case
// we just send it as a chat-message from <HOST>. // we just send it as a chat-message from <HOST>.
if (build_number() < 14248) { if (build_number() < 14248) {
std::string value = g_game->CompileResourceString(s, "sendScreenMessage"); std::string value = g_logic->CompileResourceString(s, "sendScreenMessage");
std::string our_spec_string = std::string our_spec_string =
PlayerSpec::GetDummyPlayerSpec("<HOST>").GetSpecString(); PlayerSpec::GetDummyPlayerSpec("<HOST>").GetSpecString();
std::vector<uint8_t> msg_out(1 + 1 + our_spec_string.size() + value.size()); std::vector<uint8_t> msg_out(1 + 1 + our_spec_string.size() + value.size());
@ -347,10 +347,10 @@ void ConnectionToClient::HandleMessagePacket(
case BA_MESSAGE_KICK_VOTE: { case BA_MESSAGE_KICK_VOTE: {
if (buffer.size() == 2) { if (buffer.size() == 2) {
for (auto&& i : g_game->connections()->connections_to_clients()) { for (auto&& i : g_logic->connections()->connections_to_clients()) {
ConnectionToClient* client = i.second.get(); ConnectionToClient* client = i.second.get();
if (client->id() == static_cast<int>(buffer[1])) { if (client->id() == static_cast<int>(buffer[1])) {
g_game->StartKickVote(this, client); g_logic->StartKickVote(this, client);
break; break;
} }
} }
@ -409,7 +409,7 @@ void ConnectionToClient::HandleMessagePacket(
// Newer type using json. // Newer type using json.
// Only accept peer info if we've not gotten official info from // Only accept peer info if we've not gotten official info from
// the master server (and if we're allowing it in general). // the master server (and if we're allowing it in general).
if (!g_game->require_client_authentication() if (!g_logic->require_client_authentication()
&& !got_info_from_master_server_) { && !got_info_from_master_server_) {
std::vector<char> b2(buffer.size()); std::vector<char> b2(buffer.size());
memcpy(&(b2[0]), &(buffer[1]), buffer.size() - 1); memcpy(&(b2[0]), &(buffer[1]), buffer.size() - 1);
@ -460,13 +460,13 @@ void ConnectionToClient::HandleMessagePacket(
// If we require client-info and don't have it from this guy yet, // If we require client-info and don't have it from this guy yet,
// ignore their chat messages (prevent bots from jumping in and // ignore their chat messages (prevent bots from jumping in and
// spamming before we can verify their identities) // spamming before we can verify their identities)
if (g_game->require_client_authentication() if (g_logic->require_client_authentication()
&& !got_info_from_master_server_) { && !got_info_from_master_server_) {
Log("Ignoring chat message from peer with no client info."); Log("Ignoring chat message from peer with no client info.");
SendScreenMessage(R"({"r":"loadingTryAgainText"})", 1, 0, 0); SendScreenMessage(R"({"r":"loadingTryAgainText"})", 1, 0, 0);
} else if (last_chat_times_.size() >= 5) { } else if (last_chat_times_.size() >= 5) {
chat_block_time_ = now + next_chat_block_seconds_ * 1000; chat_block_time_ = now + next_chat_block_seconds_ * 1000;
g_game->connections()->SendScreenMessageToAll( g_logic->connections()->SendScreenMessageToAll(
R"({"r":"internal.chatBlockedText","s":[["${NAME}",)" R"({"r":"internal.chatBlockedText","s":[["${NAME}",)"
+ Utils::GetJSONString( + Utils::GetJSONString(
GetCombinedSpec().GetDisplayString().c_str()) GetCombinedSpec().GetDisplayString().c_str())
@ -498,7 +498,7 @@ void ConnectionToClient::HandleMessagePacket(
"{\"t\":[\"serverResponses\"," "{\"t\":[\"serverResponses\","
"\"Message is too long.\"]}", "\"Message is too long.\"]}",
1, 0, 0); 1, 0, 0);
} else if (g_game->kick_vote_in_progress() } else if (g_logic->kick_vote_in_progress()
&& (!strcmp(b2.data(), "1") && (!strcmp(b2.data(), "1")
|| !strcmp(b2.data(), "2"))) { || !strcmp(b2.data(), "2"))) {
// Special case - if there's a kick vote going on, take '1' or // Special case - if there's a kick vote going on, take '1' or
@ -535,14 +535,14 @@ void ConnectionToClient::HandleMessagePacket(
// Send it out to all clients. // Send it out to all clients.
for (auto&& i : for (auto&& i :
g_game->connections()->connections_to_clients()) { g_logic->connections()->connections_to_clients()) {
if (i.second->can_communicate()) { if (i.second->can_communicate()) {
i.second->SendReliableMessage(msg_out); i.second->SendReliableMessage(msg_out);
} }
} }
// Display it locally. // Display it locally.
g_game->LocalDisplayChatMessage(msg_out); g_logic->LocalDisplayChatMessage(msg_out);
} }
} }
} }
@ -598,7 +598,7 @@ void ConnectionToClient::HandleMessagePacket(
ClientInputDevice* cid = GetClientInputDevice(buffer[1]); ClientInputDevice* cid = GetClientInputDevice(buffer[1]);
if (auto* hs = if (auto* hs =
dynamic_cast<HostSession*>(g_game->GetForegroundSession())) { dynamic_cast<HostSession*>(g_logic->GetForegroundSession())) {
if (!cid->attached_to_player()) { if (!cid->attached_to_player()) {
millisecs_t seconds_since_last_left = millisecs_t seconds_since_last_left =
(GetRealTime() - last_remove_player_time_) / 1000; (GetRealTime() - last_remove_player_time_) / 1000;
@ -615,7 +615,7 @@ void ConnectionToClient::HandleMessagePacket(
+ "\"]]}", + "\"]]}",
1, 1, 0); 1, 1, 0);
} else { } else {
bool still_waiting = (g_game->require_client_authentication() bool still_waiting = (g_logic->require_client_authentication()
&& !got_info_from_master_server_); && !got_info_from_master_server_);
// If we're not allowing peer client-info and have yet to get // If we're not allowing peer client-info and have yet to get
// master-server info for this client, delay their join (we'll // master-server info for this client, delay their join (we'll
@ -652,7 +652,7 @@ void ConnectionToClient::HandleMessagePacket(
SendScreenMessage(R"({"r":"errorUnknownText"})", 1, 0, 0); SendScreenMessage(R"({"r":"errorUnknownText"})", 1, 0, 0);
Log("Client data limit exceeded by '" + peer_spec().GetShortName() Log("Client data limit exceeded by '" + peer_spec().GetShortName()
+ "'; kicking."); + "'; kicking.");
g_game->BanPlayer(peer_spec(), 1000 * 60); g_logic->BanPlayer(peer_spec(), 1000 * 60);
Error(""); Error("");
return; return;
} }
@ -666,7 +666,7 @@ void ConnectionToClient::HandleMessagePacket(
auto ConnectionToClient::GetCombinedSpec() -> PlayerSpec { auto ConnectionToClient::GetCombinedSpec() -> PlayerSpec {
// Look for players coming from this client-connection. // Look for players coming from this client-connection.
// If we find any, make a spec out of their name(s). // If we find any, make a spec out of their name(s).
if (auto* hs = dynamic_cast<HostSession*>(g_game->GetForegroundSession())) { if (auto* hs = dynamic_cast<HostSession*>(g_logic->GetForegroundSession())) {
std::string p_name_combined; std::string p_name_combined;
for (auto&& p : hs->players()) { for (auto&& p : hs->players()) {
InputDevice* input_device = p->GetInputDevice(); InputDevice* input_device = p->GetInputDevice();
@ -733,7 +733,7 @@ void ConnectionToClient::HandleMasterServerClientInfo(PyObject* info_obj) {
// If the server returned no valid account info for them // If the server returned no valid account info for them
// and we're not trusting peers, kick this fella right out // and we're not trusting peers, kick this fella right out
// and ban him for a short bit (to hopefully limit rejoin spam). // and ban him for a short bit (to hopefully limit rejoin spam).
if (g_game->require_client_authentication()) { if (g_logic->require_client_authentication()) {
SendScreenMessage( SendScreenMessage(
"{\"t\":[\"serverResponses\"," "{\"t\":[\"serverResponses\","
"\"Your account was rejected. Are you signed in?\"]}", "\"Your account was rejected. Are you signed in?\"]}",
@ -744,7 +744,7 @@ void ConnectionToClient::HandleMasterServerClientInfo(PyObject* info_obj) {
// Not benning anymore. People were exploiting this by impersonating // Not benning anymore. People were exploiting this by impersonating
// other players using their public ids to get them banned from // other players using their public ids to get them banned from
// their own servers/etc. // their own servers/etc.
// g_game->BanPlayer(peer_spec(), 1000 * 60); // g_logic->BanPlayer(peer_spec(), 1000 * 60);
Error(""); Error("");
} }
} }
@ -755,8 +755,8 @@ auto ConnectionToClient::IsAdmin() const -> bool {
if (peer_public_account_id_.empty()) { if (peer_public_account_id_.empty()) {
return false; return false;
} }
return (g_game->admin_public_ids().find(peer_public_account_id_) return (g_logic->admin_public_ids().find(peer_public_account_id_)
!= g_game->admin_public_ids().end()); != g_logic->admin_public_ids().end());
} }
} // namespace ballistica } // namespace ballistica

View File

@ -1,13 +1,13 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_CONNECTION_CONNECTION_TO_CLIENT_H_ #ifndef BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_CLIENT_H_
#define BALLISTICA_GAME_CONNECTION_CONNECTION_TO_CLIENT_H_ #define BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_CLIENT_H_
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "ballistica/game/connection/connection.h" #include "ballistica/logic/connection/connection.h"
namespace ballistica { namespace ballistica {
@ -83,4 +83,4 @@ class ConnectionToClient : public Connection {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_CONNECTION_CONNECTION_TO_CLIENT_H_ #endif // BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_CLIENT_H_

View File

@ -1,9 +1,9 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/connection/connection_to_client_udp.h" #include "ballistica/logic/connection/connection_to_client_udp.h"
#include "ballistica/game/connection/connection_set.h" #include "ballistica/logic/connection/connection_set.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/networking/network_writer.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
@ -16,7 +16,7 @@ ConnectionToClientUDP::ConnectionToClientUDP(const SockAddr& addr,
request_id_(request_id), request_id_(request_id),
addr_(new SockAddr(addr)), addr_(new SockAddr(addr)),
client_instance_uuid_(std::move(client_name)), client_instance_uuid_(std::move(client_name)),
last_client_response_time_(g_game->master_time()), last_client_response_time_(g_logic->master_time()),
did_die_(false) {} did_die_(false) {}
ConnectionToClientUDP::~ConnectionToClientUDP() { ConnectionToClientUDP::~ConnectionToClientUDP() {
@ -46,7 +46,7 @@ void ConnectionToClientUDP::SendGamePacketCompressed(
void ConnectionToClientUDP::Update() { void ConnectionToClientUDP::Update() {
ConnectionToClient::Update(); ConnectionToClient::Update();
millisecs_t current_time = g_game->master_time(); millisecs_t current_time = g_logic->master_time();
// if its been long enough since we've heard anything from the host, error. // if its been long enough since we've heard anything from the host, error.
if (current_time - last_client_response_time_ if (current_time - last_client_response_time_
@ -60,7 +60,7 @@ void ConnectionToClientUDP::Update() {
void ConnectionToClientUDP::HandleGamePacket( void ConnectionToClientUDP::HandleGamePacket(
const std::vector<uint8_t>& buffer) { const std::vector<uint8_t>& buffer) {
// keep track of when we last heard from the host for disconnect purposes // keep track of when we last heard from the host for disconnect purposes
last_client_response_time_ = g_game->master_time(); last_client_response_time_ = g_logic->master_time();
ConnectionToClient::HandleGamePacket(buffer); ConnectionToClient::HandleGamePacket(buffer);
} }
@ -70,7 +70,7 @@ void ConnectionToClientUDP::Die() {
return; return;
} }
// this will actually clear the object.. // this will actually clear the object..
g_game->connections()->PushClientDisconnectedCall(id()); g_logic->connections()->PushClientDisconnectedCall(id());
did_die_ = true; did_die_ = true;
} }

View File

@ -1,13 +1,13 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_CONNECTION_CONNECTION_TO_CLIENT_UDP_H_ #ifndef BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_CLIENT_UDP_H_
#define BALLISTICA_GAME_CONNECTION_CONNECTION_TO_CLIENT_UDP_H_ #define BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_CLIENT_UDP_H_
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "ballistica/game/connection/connection_to_client.h" #include "ballistica/logic/connection/connection_to_client.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
@ -40,4 +40,4 @@ class ConnectionToClientUDP : public ConnectionToClient {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_CONNECTION_CONNECTION_TO_CLIENT_UDP_H_ #endif // BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_CLIENT_UDP_H_

View File

@ -1,15 +1,15 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/connection/connection_to_host.h" #include "ballistica/logic/connection/connection_to_host.h"
#include "ballistica/assets/assets.h" #include "ballistica/assets/assets.h"
#include "ballistica/audio/audio.h" #include "ballistica/audio/audio.h"
#include "ballistica/game/game.h"
#include "ballistica/game/session/net_client_session.h"
#include "ballistica/generic/json.h" #include "ballistica/generic/json.h"
#include "ballistica/input/device/input_device.h" #include "ballistica/input/device/input_device.h"
#include "ballistica/input/input.h" #include "ballistica/input/input.h"
#include "ballistica/internal/app_internal.h" #include "ballistica/internal/app_internal.h"
#include "ballistica/logic/logic.h"
#include "ballistica/logic/session/net_client_session.h"
#include "ballistica/math/vector3f.h" #include "ballistica/math/vector3f.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
@ -32,16 +32,16 @@ ConnectionToHost::~ConnectionToHost() {
// '${PEER-NAME}'s party'. // '${PEER-NAME}'s party'.
std::string s; std::string s;
if (!party_name_.empty()) { if (!party_name_.empty()) {
s = g_game->GetResourceString("leftGameText"); s = g_logic->GetResourceString("leftGameText");
Utils::StringReplaceOne(&s, "${NAME}", party_name_); Utils::StringReplaceOne(&s, "${NAME}", party_name_);
} else { } else {
s = g_game->GetResourceString("leftPartyText"); s = g_logic->GetResourceString("leftPartyText");
Utils::StringReplaceOne(&s, "${NAME}", peer_spec().GetDisplayString()); Utils::StringReplaceOne(&s, "${NAME}", peer_spec().GetDisplayString());
} }
ScreenMessage(s, {1, 0.5f, 0.0f}); ScreenMessage(s, {1, 0.5f, 0.0f});
g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kCorkPop)); g_audio->PlaySound(g_assets->GetSound(SystemSoundID::kCorkPop));
} else { } else {
ScreenMessage(g_game->GetResourceString("connectionRejectedText"), ScreenMessage(g_logic->GetResourceString("connectionRejectedText"),
{1, 0, 0}); {1, 0, 0});
} }
} }
@ -126,9 +126,9 @@ void ConnectionToHost::HandleGamePacket(const std::vector<uint8_t>& data) {
if (!compatible) { if (!compatible) {
if (their_protocol_version > kProtocolVersion) { if (their_protocol_version > kProtocolVersion) {
Error(g_game->GetResourceString("incompatibleNewerVersionHostText")); Error(g_logic->GetResourceString("incompatibleNewerVersionHostText"));
} else { } else {
Error(g_game->GetResourceString("incompatibleVersionHostText")); Error(g_logic->GetResourceString("incompatibleVersionHostText"));
} }
return; return;
} }
@ -175,7 +175,7 @@ void ConnectionToHost::HandleGamePacket(const std::vector<uint8_t>& data) {
peer_hash_ = g_app_internal->CalcV1PeerHash(peer_hash_input_); peer_hash_ = g_app_internal->CalcV1PeerHash(peer_hash_input_);
set_can_communicate(true); set_can_communicate(true);
g_game->LaunchClientSession(); g_logic->LaunchClientSession();
// NOTE: // NOTE:
// we don't actually print a 'connected' message until after // we don't actually print a 'connected' message until after
@ -185,7 +185,7 @@ void ConnectionToHost::HandleGamePacket(const std::vector<uint8_t>& data) {
// Wire ourselves up to drive the client-session we're in. // Wire ourselves up to drive the client-session we're in.
auto* cs = auto* cs =
dynamic_cast<NetClientSession*>(g_game->GetForegroundSession()); dynamic_cast<NetClientSession*>(g_logic->GetForegroundSession());
assert(cs); assert(cs);
assert(!cs->connection_to_host()); assert(!cs->connection_to_host());
client_session_ = cs; client_session_ = cs;
@ -321,7 +321,7 @@ void ConnectionToHost::HandleMessagePacket(const std::vector<uint8_t>& buffer) {
cJSON* new_roster = cJSON* new_roster =
cJSON_Parse(reinterpret_cast<const char*>(&(buffer[1]))); cJSON_Parse(reinterpret_cast<const char*>(&(buffer[1])));
if (new_roster) { if (new_roster) {
g_game->SetGameRoster(new_roster); g_logic->SetGameRoster(new_roster);
} }
} }
break; break;
@ -372,7 +372,7 @@ void ConnectionToHost::HandleMessagePacket(const std::vector<uint8_t>& buffer) {
std::vector<char> str_buffer(buffer.size()); std::vector<char> str_buffer(buffer.size());
memcpy(&(str_buffer[0]), &(buffer[1]), buffer.size() - 1); memcpy(&(str_buffer[0]), &(buffer[1]), buffer.size() - 1);
str_buffer[str_buffer.size() - 1] = 0; str_buffer[str_buffer.size() - 1] = 0;
std::string s = g_game->GetResourceString("playerJoinedPartyText"); std::string s = g_logic->GetResourceString("playerJoinedPartyText");
Utils::StringReplaceOne( Utils::StringReplaceOne(
&s, "${NAME}", PlayerSpec(str_buffer.data()).GetDisplayString()); &s, "${NAME}", PlayerSpec(str_buffer.data()).GetDisplayString());
ScreenMessage(s, {0.5f, 1.0f, 0.5f}); ScreenMessage(s, {0.5f, 1.0f, 0.5f});
@ -387,7 +387,7 @@ void ConnectionToHost::HandleMessagePacket(const std::vector<uint8_t>& buffer) {
std::vector<char> str_buffer(buffer.size()); std::vector<char> str_buffer(buffer.size());
memcpy(&(str_buffer[0]), &(buffer[1]), buffer.size() - 1); memcpy(&(str_buffer[0]), &(buffer[1]), buffer.size() - 1);
str_buffer[str_buffer.size() - 1] = 0; str_buffer[str_buffer.size() - 1] = 0;
std::string s = g_game->GetResourceString("playerLeftPartyText"); std::string s = g_logic->GetResourceString("playerLeftPartyText");
Utils::StringReplaceOne( Utils::StringReplaceOne(
&s, "${NAME}", PlayerSpec(&(str_buffer[0])).GetDisplayString()); &s, "${NAME}", PlayerSpec(&(str_buffer[0])).GetDisplayString());
ScreenMessage(s, {1, 0.5f, 0.0f}); ScreenMessage(s, {1, 0.5f, 0.0f});
@ -441,7 +441,7 @@ void ConnectionToHost::HandleMessagePacket(const std::vector<uint8_t>& buffer) {
} }
case BA_MESSAGE_CHAT: { case BA_MESSAGE_CHAT: {
g_game->LocalDisplayChatMessage(buffer); g_logic->LocalDisplayChatMessage(buffer);
break; break;
} }
@ -479,10 +479,10 @@ void ConnectionToHost::HandleMessagePacket(const std::vector<uint8_t>& buffer) {
// If we've got a name for their party, use it; otherwise call it // If we've got a name for their party, use it; otherwise call it
// '${NAME}'s party'. // '${NAME}'s party'.
if (!party_name_.empty()) { if (!party_name_.empty()) {
s = g_game->GetResourceString("connectedToGameText"); s = g_logic->GetResourceString("connectedToGameText");
Utils::StringReplaceOne(&s, "${NAME}", party_name_); Utils::StringReplaceOne(&s, "${NAME}", party_name_);
} else { } else {
s = g_game->GetResourceString("connectedToPartyText"); s = g_logic->GetResourceString("connectedToPartyText");
Utils::StringReplaceOne(&s, "${NAME}", peer_spec().GetDisplayString()); Utils::StringReplaceOne(&s, "${NAME}", peer_spec().GetDisplayString());
} }
ScreenMessage(s, {0.5f, 1, 0.5f}); ScreenMessage(s, {0.5f, 1, 0.5f});

View File

@ -1,12 +1,12 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_CONNECTION_CONNECTION_TO_HOST_H_ #ifndef BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_HOST_H_
#define BALLISTICA_GAME_CONNECTION_CONNECTION_TO_HOST_H_ #define BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_HOST_H_
#include <string> #include <string>
#include <vector> #include <vector>
#include "ballistica/game/connection/connection.h" #include "ballistica/logic/connection/connection.h"
namespace ballistica { namespace ballistica {
@ -44,4 +44,4 @@ class ConnectionToHost : public Connection {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_CONNECTION_CONNECTION_TO_HOST_H_ #endif // BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_HOST_H_

View File

@ -1,9 +1,9 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/connection/connection_to_host_udp.h" #include "ballistica/logic/connection/connection_to_host_udp.h"
#include "ballistica/game/connection/connection_set.h" #include "ballistica/logic/connection/connection_set.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/math/vector3f.h" #include "ballistica/math/vector3f.h"
#include "ballistica/networking/network_writer.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
@ -28,10 +28,10 @@ ConnectionToHostUDP::ConnectionToHostUDP(const SockAddr& addr)
last_client_id_request_time_(0), last_client_id_request_time_(0),
last_disconnect_request_time_(0), last_disconnect_request_time_(0),
did_die_(false), did_die_(false),
last_host_response_time_(g_game->master_time()) { last_host_response_time_(g_logic->master_time()) {
GetRequestID(); GetRequestID();
if (g_game->connections()->GetPrintUDPConnectProgress()) { if (g_logic->connections()->GetPrintUDPConnectProgress()) {
ScreenMessage(g_game->GetResourceString("connectingToPartyText")); ScreenMessage(g_logic->GetResourceString("connectingToPartyText"));
} }
} }
@ -54,7 +54,7 @@ void ConnectionToHostUDP::GetRequestID() {
void ConnectionToHostUDP::Update() { void ConnectionToHostUDP::Update() {
ConnectionToHost::Update(); ConnectionToHost::Update();
millisecs_t current_time = g_game->master_time(); millisecs_t current_time = g_logic->master_time();
// If we've not gotten a client_id from the host yet, keep pestering it. // If we've not gotten a client_id from the host yet, keep pestering it.
if (!errored()) { if (!errored()) {
@ -80,7 +80,7 @@ void ConnectionToHostUDP::Update() {
> (can_communicate() ? 10000u : 5000u)) { > (can_communicate() ? 10000u : 5000u)) {
// If the connection never got established, announce it failed. // If the connection never got established, announce it failed.
if (!can_communicate()) { if (!can_communicate()) {
ScreenMessage(g_game->GetResourceString("connectionFailedText"), ScreenMessage(g_logic->GetResourceString("connectionFailedText"),
{1, 0, 0}); {1, 0, 0});
} }
@ -113,8 +113,8 @@ void ConnectionToHostUDP::Die() {
Log("Error: posting multiple die messages; probably not good."); Log("Error: posting multiple die messages; probably not good.");
return; return;
} }
if (g_game->connections()->connection_to_host() == this) { if (g_logic->connections()->connection_to_host() == this) {
g_game->connections()->PushDisconnectedFromHostCall(); g_logic->connections()->PushDisconnectedFromHostCall();
did_die_ = true; did_die_ = true;
} else { } else {
Log("Error: Running update for non-current host-connection; shouldn't " Log("Error: Running update for non-current host-connection; shouldn't "
@ -134,7 +134,7 @@ void ConnectionToHostUDP::SendDisconnectRequest() {
void ConnectionToHostUDP::HandleGamePacket(const std::vector<uint8_t>& buffer) { void ConnectionToHostUDP::HandleGamePacket(const std::vector<uint8_t>& buffer) {
// Keep track of when we last heard from the host for time-out purposes. // Keep track of when we last heard from the host for time-out purposes.
last_host_response_time_ = g_game->master_time(); last_host_response_time_ = g_logic->master_time();
ConnectionToHost::HandleGamePacket(buffer); ConnectionToHost::HandleGamePacket(buffer);
} }

View File

@ -1,13 +1,13 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_CONNECTION_CONNECTION_TO_HOST_UDP_H_ #ifndef BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_HOST_UDP_H_
#define BALLISTICA_GAME_CONNECTION_CONNECTION_TO_HOST_UDP_H_ #define BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_HOST_UDP_H_
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "ballistica/game/connection/connection_to_host.h" #include "ballistica/logic/connection/connection_to_host.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
namespace ballistica { namespace ballistica {
@ -46,4 +46,4 @@ class ConnectionToHostUDP : public ConnectionToHost {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_CONNECTION_CONNECTION_TO_HOST_UDP_H_ #endif // BALLISTICA_LOGIC_CONNECTION_CONNECTION_TO_HOST_UDP_H_

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_FRIEND_SCORE_SET_H_ #ifndef BALLISTICA_LOGIC_FRIEND_SCORE_SET_H_
#define BALLISTICA_GAME_FRIEND_SCORE_SET_H_ #define BALLISTICA_LOGIC_FRIEND_SCORE_SET_H_
#include <list> #include <list>
#include <string> #include <string>
@ -27,4 +27,4 @@ struct FriendScoreSet {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_FRIEND_SCORE_SET_H_ #endif // BALLISTICA_LOGIC_FRIEND_SCORE_SET_H_

View File

@ -1,6 +1,6 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/host_activity.h" #include "ballistica/logic/host_activity.h"
#include "ballistica/assets/component/collide_model.h" #include "ballistica/assets/component/collide_model.h"
#include "ballistica/assets/component/data.h" #include "ballistica/assets/component/data.h"
@ -8,11 +8,11 @@
#include "ballistica/assets/component/sound.h" #include "ballistica/assets/component/sound.h"
#include "ballistica/assets/component/texture.h" #include "ballistica/assets/component/texture.h"
#include "ballistica/dynamics/material/material.h" #include "ballistica/dynamics/material/material.h"
#include "ballistica/game/player.h"
#include "ballistica/game/session/host_session.h"
#include "ballistica/generic/lambda_runnable.h" #include "ballistica/generic/lambda_runnable.h"
#include "ballistica/generic/timer.h" #include "ballistica/generic/timer.h"
#include "ballistica/input/device/input_device.h" #include "ballistica/input/device/input_device.h"
#include "ballistica/logic/player.h"
#include "ballistica/logic/session/host_session.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_context_call.h" #include "ballistica/python/python_context_call.h"
#include "ballistica/python/python_sys.h" #include "ballistica/python/python_sys.h"
@ -239,7 +239,7 @@ void HostActivity::UpdateStepTimerLength() {
step_scene_timer_->SetLength( step_scene_timer_->SetLength(
std::max(1, static_cast<int>( std::max(1, static_cast<int>(
round(static_cast<float>(kGameStepMilliseconds) round(static_cast<float>(kGameStepMilliseconds)
/ (game_speed_ * g_game->debug_speed_mult())))), / (game_speed_ * g_logic->debug_speed_mult())))),
true, base_time_); true, base_time_);
} }
} }
@ -311,7 +311,7 @@ void HostActivity::SetIsForeground(bool val) {
Scene* sg = scene(); Scene* sg = scene();
if (val && sg) { if (val && sg) {
// Set it locally. // Set it locally.
g_game->SetForegroundScene(sg); g_logic->SetForegroundScene(sg);
// Also push it to clients. // Also push it to clients.
if (SceneStream* out = GetSceneStream()) { if (SceneStream* out = GetSceneStream()) {

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_HOST_ACTIVITY_H_ #ifndef BALLISTICA_LOGIC_HOST_ACTIVITY_H_
#define BALLISTICA_GAME_HOST_ACTIVITY_H_ #define BALLISTICA_LOGIC_HOST_ACTIVITY_H_
#include <list> #include <list>
#include <string> #include <string>
@ -120,4 +120,4 @@ class HostActivity : public ContextTarget {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_HOST_ACTIVITY_H_ #endif // BALLISTICA_LOGIC_HOST_ACTIVITY_H_

View File

@ -1,23 +1,12 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/app/app_config.h" #include "ballistica/app/app_config.h"
#include "ballistica/app/app_flavor.h" #include "ballistica/app/app_flavor.h"
#include "ballistica/audio/audio.h" #include "ballistica/audio/audio.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/dynamics/bg/bg_dynamics.h" #include "ballistica/dynamics/bg/bg_dynamics.h"
#include "ballistica/game/connection/connection_set.h"
#include "ballistica/game/connection/connection_to_client_udp.h"
#include "ballistica/game/connection/connection_to_host_udp.h"
#include "ballistica/game/friend_score_set.h"
#include "ballistica/game/host_activity.h"
#include "ballistica/game/player.h"
#include "ballistica/game/session/client_session.h"
#include "ballistica/game/session/host_session.h"
#include "ballistica/game/session/net_client_session.h"
#include "ballistica/game/session/replay_client_session.h"
#include "ballistica/game/v1_account.h"
#include "ballistica/generic/json.h" #include "ballistica/generic/json.h"
#include "ballistica/generic/timer.h" #include "ballistica/generic/timer.h"
#include "ballistica/graphics/graphics.h" #include "ballistica/graphics/graphics.h"
@ -27,6 +16,17 @@
#include "ballistica/input/device/keyboard_input.h" #include "ballistica/input/device/keyboard_input.h"
#include "ballistica/input/device/touch_input.h" #include "ballistica/input/device/touch_input.h"
#include "ballistica/internal/app_internal.h" #include "ballistica/internal/app_internal.h"
#include "ballistica/logic/connection/connection_set.h"
#include "ballistica/logic/connection/connection_to_client_udp.h"
#include "ballistica/logic/connection/connection_to_host_udp.h"
#include "ballistica/logic/friend_score_set.h"
#include "ballistica/logic/host_activity.h"
#include "ballistica/logic/player.h"
#include "ballistica/logic/session/client_session.h"
#include "ballistica/logic/session/host_session.h"
#include "ballistica/logic/session/net_client_session.h"
#include "ballistica/logic/session/replay_client_session.h"
#include "ballistica/logic/v1_account.h"
#include "ballistica/networking/network_writer.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
#include "ballistica/networking/telnet_server.h" #include "ballistica/networking/telnet_server.h"
@ -64,12 +64,12 @@ const int kMaxChatMessages = 40;
// Go with 5 minute ban. // Go with 5 minute ban.
const int kKickBanSeconds = 5 * 60; const int kKickBanSeconds = 5 * 60;
Game::Game() Logic::Logic()
: game_roster_(cJSON_CreateArray()), : game_roster_(cJSON_CreateArray()),
realtimers_(new TimerList()), realtimers_(new TimerList()),
connections_(std::make_unique<ConnectionSet>()) { connections_(std::make_unique<ConnectionSet>()) {
// We're a singleton; make sure we don't already exist. // We're a singleton; make sure we don't already exist.
assert(g_game == nullptr); assert(g_logic == nullptr);
InitSpecialChars(); InitSpecialChars();
@ -82,11 +82,11 @@ Game::Game()
// bits of C++ logic. // bits of C++ logic.
thread_->SetAcquiresPythonGIL(); thread_->SetAcquiresPythonGIL();
} }
auto Game::OnAppStart() -> void { auto Logic::OnAppStart() -> void {
thread_->PushCallSynchronous([this] { StartInThread(); }); thread_->PushCallSynchronous([this] { StartInThread(); });
} }
auto Game::StartInThread() -> void { auto Logic::StartInThread() -> void {
try { try {
// We want to be informed when our thread is pausing. // We want to be informed when our thread is pausing.
thread()->AddPauseCallback( thread()->AddPauseCallback(
@ -112,7 +112,7 @@ auto Game::StartInThread() -> void {
} }
} }
auto Game::OnThreadPause() -> void { auto Logic::OnThreadPause() -> void {
ScopedSetContext cp(GetUIContextTarget()); ScopedSetContext cp(GetUIContextTarget());
// Let Python and internal layers do their thing. // Let Python and internal layers do their thing.
@ -120,7 +120,7 @@ auto Game::OnThreadPause() -> void {
g_app_internal->OnLogicThreadPause(); g_app_internal->OnLogicThreadPause();
} }
void Game::InitSpecialChars() { void Logic::InitSpecialChars() {
std::scoped_lock lock(special_char_mutex_); std::scoped_lock lock(special_char_mutex_);
special_char_strings_[SpecialChar::kDownArrow] = "\xee\x80\x84"; special_char_strings_[SpecialChar::kDownArrow] = "\xee\x80\x84";
@ -224,37 +224,37 @@ void Game::InitSpecialChars() {
special_char_strings_[SpecialChar::kV2Logo] = "\xee\x81\xA3"; special_char_strings_[SpecialChar::kV2Logo] = "\xee\x81\xA3";
} }
void Game::SetGameRoster(cJSON* r) { void Logic::SetGameRoster(cJSON* r) {
if (game_roster_ != nullptr) { if (game_roster_ != nullptr) {
cJSON_Delete(game_roster_); cJSON_Delete(game_roster_);
} }
game_roster_ = r; game_roster_ = r;
} }
void Game::ResetActivityTracking() { void Logic::ResetActivityTracking() {
largest_draw_time_increment_since_last_reset_ = 0; largest_draw_time_increment_since_last_reset_ = 0;
first_draw_real_time_ = last_draw_real_time_ = g_platform->GetTicks(); first_draw_real_time_ = last_draw_real_time_ = g_platform->GetTicks();
} }
#if BA_VR_BUILD #if BA_VR_BUILD
void Game::PushVRHandsState(const VRHandsState& state) { void Logic::PushVRHandsState(const VRHandsState& state) {
thread()->PushCall([this, state] { vr_hands_state_ = state; }); thread()->PushCall([this, state] { vr_hands_state_ = state; });
} }
#endif // BA_VR_BUILD #endif // BA_VR_BUILD
void Game::PushMediaPruneCall(int level) { void Logic::PushMediaPruneCall(int level) {
thread()->PushCall([level] { thread()->PushCall([level] {
assert(InLogicThread()); assert(InLogicThread());
g_assets->Prune(level); g_assets->Prune(level);
}); });
} }
void Game::PushSetV1LoginCall(V1AccountType account_type, void Logic::PushSetV1LoginCall(V1AccountType account_type,
V1LoginState account_state, V1LoginState account_state,
const std::string& account_name, const std::string& account_name,
const std::string& account_id) { const std::string& account_id) {
thread()->PushCall( thread()->PushCall(
[this, account_type, account_state, account_name, account_id] { [this, account_type, account_state, account_name, account_id] {
g_v1_account->SetLogin(account_type, account_state, account_name, g_v1_account->SetLogin(account_type, account_state, account_name,
@ -262,11 +262,11 @@ void Game::PushSetV1LoginCall(V1AccountType account_type,
}); });
} }
void Game::PushInitialScreenCreatedCall() { void Logic::PushInitialScreenCreatedCall() {
thread()->PushCall([this] { InitialScreenCreated(); }); thread()->PushCall([this] { InitialScreenCreated(); });
} }
void Game::InitialScreenCreated() { void Logic::InitialScreenCreated() {
assert(InLogicThread()); assert(InLogicThread());
// Ok; graphics-server is telling us we've got a screen. // Ok; graphics-server is telling us we've got a screen.
@ -300,10 +300,10 @@ void Game::InitialScreenCreated() {
RunAppLaunchCommands(); RunAppLaunchCommands();
} }
void Game::PruneMedia() { g_assets->Prune(); } void Logic::PruneMedia() { g_assets->Prune(); }
// Launch into main menu or whatever else. // Launch into main menu or whatever else.
void Game::RunAppLaunchCommands() { void Logic::RunAppLaunchCommands() {
assert(InLogicThread()); assert(InLogicThread());
assert(!ran_app_launch_commands_); assert(!ran_app_launch_commands_);
@ -332,7 +332,7 @@ void Game::RunAppLaunchCommands() {
} }
// Set up our sleeping based on what we're doing. // Set up our sleeping based on what we're doing.
void Game::UpdateProcessTimer() { void Logic::UpdateProcessTimer() {
assert(InLogicThread()); assert(InLogicThread());
// This might get called before we set up our timer in some cases. (such as // This might get called before we set up our timer in some cases. (such as
@ -353,7 +353,7 @@ void Game::UpdateProcessTimer() {
} }
} }
void Game::PruneSessions() { void Logic::PruneSessions() {
bool have_dead_session = false; bool have_dead_session = false;
for (auto&& i : sessions_) { for (auto&& i : sessions_) {
if (i.exists()) { if (i.exists()) {
@ -381,7 +381,7 @@ void Game::PruneSessions() {
} }
} }
void Game::UpdateKickVote() { void Logic::UpdateKickVote() {
if (!kick_vote_in_progress_) { if (!kick_vote_in_progress_) {
return; return;
} }
@ -486,7 +486,7 @@ void Game::UpdateKickVote() {
} }
} }
void Game::HandleQuitOnIdle() { void Logic::HandleQuitOnIdle() {
if (idle_exit_minutes_) { if (idle_exit_minutes_) {
float idle_seconds{g_input->input_idle_time() * 0.001f}; float idle_seconds{g_input->input_idle_time() * 0.001f};
if (!idle_exiting_ && idle_seconds > (idle_exit_minutes_.value() * 60.0f)) { if (!idle_exiting_ && idle_seconds > (idle_exit_minutes_.value() * 60.0f)) {
@ -504,7 +504,7 @@ void Game::HandleQuitOnIdle() {
} }
// Bring our scenes, real-time timers, etc up to date. // Bring our scenes, real-time timers, etc up to date.
void Game::Update() { void Logic::Update() {
auto startms{Platform::GetCurrentMilliseconds()}; auto startms{Platform::GetCurrentMilliseconds()};
assert(InLogicThread()); assert(InLogicThread());
millisecs_t real_time = GetRealTime(); millisecs_t real_time = GetRealTime();
@ -662,7 +662,7 @@ void Game::Update() {
} }
// Reset the game to a blank slate. // Reset the game to a blank slate.
void Game::Reset() { void Logic::Reset() {
assert(InLogicThread()); assert(InLogicThread());
// Tear down any existing setup. // Tear down any existing setup.
@ -676,7 +676,7 @@ void Game::Reset() {
// If all is well our sessions should all be dead. // If all is well our sessions should all be dead.
if (g_app->session_count != 0) { if (g_app->session_count != 0) {
Log("Error: session-count is non-zero (" Log("Error: session-count is non-zero ("
+ std::to_string(g_app->session_count) + ") on Game::Reset."); + std::to_string(g_app->session_count) + ") on Logic::Reset.");
} }
// Note: we don't clear real-time timers anymore. Should we?.. // Note: we don't clear real-time timers anymore. Should we?..
@ -697,11 +697,11 @@ void Game::Reset() {
} }
} }
auto Game::IsInUIContext() const -> bool { auto Logic::IsInUIContext() const -> bool {
return (g_ui && Context::current().target.get() == g_ui); return (g_ui && Context::current().target.get() == g_ui);
} }
void Game::PushShowURLCall(const std::string& url) { void Logic::PushShowURLCall(const std::string& url) {
thread()->PushCall([url] { thread()->PushCall([url] {
assert(InLogicThread()); assert(InLogicThread());
assert(g_python); assert(g_python);
@ -709,7 +709,7 @@ void Game::PushShowURLCall(const std::string& url) {
}); });
} }
auto Game::GetForegroundContext() -> Context { auto Logic::GetForegroundContext() -> Context {
Session* s = GetForegroundSession(); Session* s = GetForegroundSession();
if (s) { if (s) {
return s->GetForegroundContext(); return s->GetForegroundContext();
@ -718,7 +718,7 @@ auto Game::GetForegroundContext() -> Context {
} }
} }
void Game::PushBackButtonCall(InputDevice* input_device) { void Logic::PushBackButtonCall(InputDevice* input_device) {
thread()->PushCall([this, input_device] { thread()->PushCall([this, input_device] {
assert(InLogicThread()); assert(InLogicThread());
@ -740,7 +740,7 @@ void Game::PushBackButtonCall(InputDevice* input_device) {
}); });
} }
void Game::PushStringEditSetCall(const std::string& value) { void Logic::PushStringEditSetCall(const std::string& value) {
thread()->PushCall([value] { thread()->PushCall([value] {
if (!g_ui) { if (!g_ui) {
Log("Error: No ui on StringEditSetEvent."); Log("Error: No ui on StringEditSetEvent.");
@ -757,7 +757,7 @@ void Game::PushStringEditSetCall(const std::string& value) {
}); });
} }
void Game::PushStringEditCancelCall() { void Logic::PushStringEditCancelCall() {
thread()->PushCall([] { thread()->PushCall([] {
if (!g_ui) { if (!g_ui) {
Log("Error: No ui in PushStringEditCancelCall."); Log("Error: No ui in PushStringEditCancelCall.");
@ -768,12 +768,12 @@ void Game::PushStringEditCancelCall() {
// Called by a newly made Session instance to set itself as the current // Called by a newly made Session instance to set itself as the current
// session. // session.
void Game::SetForegroundSession(Session* s) { void Logic::SetForegroundSession(Session* s) {
assert(InLogicThread()); assert(InLogicThread());
foreground_session_ = s; foreground_session_ = s;
} }
void Game::SetForegroundScene(Scene* sg) { void Logic::SetForegroundScene(Scene* sg) {
assert(InLogicThread()); assert(InLogicThread());
if (foreground_scene_.get() != sg) { if (foreground_scene_.get() != sg) {
foreground_scene_ = sg; foreground_scene_ = sg;
@ -785,7 +785,7 @@ void Game::SetForegroundScene(Scene* sg) {
} }
} }
void Game::LaunchClientSession() { void Logic::LaunchClientSession() {
if (in_update_) { if (in_update_) {
throw Exception( throw Exception(
"can't launch a session from within a session update; use " "can't launch a session from within a session update; use "
@ -814,7 +814,7 @@ void Game::LaunchClientSession() {
} }
} }
void Game::LaunchReplaySession(const std::string& file_name) { void Logic::LaunchReplaySession(const std::string& file_name) {
if (in_update_) if (in_update_)
throw Exception( throw Exception(
"can't launch a session from within a session update; use " "can't launch a session from within a session update; use "
@ -844,8 +844,8 @@ void Game::LaunchReplaySession(const std::string& file_name) {
} }
} }
void Game::LaunchHostSession(PyObject* session_type_obj, void Logic::LaunchHostSession(PyObject* session_type_obj,
BenchmarkType benchmark_type) { BenchmarkType benchmark_type) {
if (in_update_) { if (in_update_) {
throw Exception( throw Exception(
"can't call host_session() from within session update; use " "can't call host_session() from within session update; use "
@ -879,7 +879,7 @@ void Game::LaunchHostSession(PyObject* session_type_obj,
} }
} }
void Game::RunMainMenu() { void Logic::RunMainMenu() {
assert(InLogicThread()); assert(InLogicThread());
if (g_app->shutting_down) { if (g_app->shutting_down) {
return; return;
@ -896,7 +896,7 @@ void Game::RunMainMenu() {
// Commands run via the in-game console. These are a bit more 'casual' and run // Commands run via the in-game console. These are a bit more 'casual' and run
// in the current visible context. // in the current visible context.
void Game::PushInGameConsoleScriptCommand(const std::string& command) { void Logic::PushInGameConsoleScriptCommand(const std::string& command) {
thread()->PushCall([this, command] { thread()->PushCall([this, command] {
// These are always run in whichever context is 'visible'. // These are always run in whichever context is 'visible'.
ScopedSetContext cp(GetForegroundContext()); ScopedSetContext cp(GetForegroundContext());
@ -925,7 +925,7 @@ void Game::PushInGameConsoleScriptCommand(const std::string& command) {
} }
// Commands run via stdin. // Commands run via stdin.
void Game::PushStdinScriptCommand(const std::string& command) { void Logic::PushStdinScriptCommand(const std::string& command) {
thread()->PushCall([this, command] { thread()->PushCall([this, command] {
// These are always run in whichever context is 'visible'. // These are always run in whichever context is 'visible'.
ScopedSetContext cp(GetForegroundContext()); ScopedSetContext cp(GetForegroundContext());
@ -959,7 +959,7 @@ void Game::PushStdinScriptCommand(const std::string& command) {
}); });
} }
void Game::PushInterruptSignalCall() { void Logic::PushInterruptSignalCall() {
thread()->PushCall([this] { thread()->PushCall([this] {
assert(InLogicThread()); assert(InLogicThread());
@ -974,7 +974,7 @@ void Game::PushInterruptSignalCall() {
}); });
} }
void Game::PushAskUserForTelnetAccessCall() { void Logic::PushAskUserForTelnetAccessCall() {
thread()->PushCall([this] { thread()->PushCall([this] {
assert(InLogicThread()); assert(InLogicThread());
ScopedSetContext cp(GetUIContext()); ScopedSetContext cp(GetUIContext());
@ -982,7 +982,7 @@ void Game::PushAskUserForTelnetAccessCall() {
}); });
} }
void Game::PushPythonCall(const Object::Ref<PythonContextCall>& call) { void Logic::PushPythonCall(const Object::Ref<PythonContextCall>& call) {
// Since we're mucking with refs, need to limit to game thread. // Since we're mucking with refs, need to limit to game thread.
BA_PRECONDITION(InLogicThread()); BA_PRECONDITION(InLogicThread());
BA_PRECONDITION(call->object_strong_ref_count() > 0); BA_PRECONDITION(call->object_strong_ref_count() > 0);
@ -992,8 +992,8 @@ void Game::PushPythonCall(const Object::Ref<PythonContextCall>& call) {
}); });
} }
void Game::PushPythonCallArgs(const Object::Ref<PythonContextCall>& call, void Logic::PushPythonCallArgs(const Object::Ref<PythonContextCall>& call,
const PythonRef& args) { const PythonRef& args) {
// Since we're mucking with refs, need to limit to game thread. // Since we're mucking with refs, need to limit to game thread.
BA_PRECONDITION(InLogicThread()); BA_PRECONDITION(InLogicThread());
BA_PRECONDITION(call->object_strong_ref_count() > 0); BA_PRECONDITION(call->object_strong_ref_count() > 0);
@ -1003,7 +1003,7 @@ void Game::PushPythonCallArgs(const Object::Ref<PythonContextCall>& call,
}); });
} }
void Game::PushPythonWeakCall(const Object::WeakRef<PythonContextCall>& call) { void Logic::PushPythonWeakCall(const Object::WeakRef<PythonContextCall>& call) {
// Since we're mucking with refs, need to limit to game thread. // Since we're mucking with refs, need to limit to game thread.
BA_PRECONDITION(InLogicThread()); BA_PRECONDITION(InLogicThread());
@ -1019,7 +1019,7 @@ void Game::PushPythonWeakCall(const Object::WeakRef<PythonContextCall>& call) {
}); });
} }
void Game::PushPythonWeakCallArgs( void Logic::PushPythonWeakCallArgs(
const Object::WeakRef<PythonContextCall>& call, const PythonRef& args) { const Object::WeakRef<PythonContextCall>& call, const PythonRef& args) {
// Since we're mucking with refs, need to limit to game thread. // Since we're mucking with refs, need to limit to game thread.
BA_PRECONDITION(InLogicThread()); BA_PRECONDITION(InLogicThread());
@ -1033,7 +1033,7 @@ void Game::PushPythonWeakCallArgs(
}); });
} }
void Game::PushPythonRawCallable(PyObject* callable) { void Logic::PushPythonRawCallable(PyObject* callable) {
thread()->PushCall([this, callable] { thread()->PushCall([this, callable] {
assert(InLogicThread()); assert(InLogicThread());
@ -1049,18 +1049,18 @@ void Game::PushPythonRawCallable(PyObject* callable) {
}); });
} }
void Game::PushScreenMessage(const std::string& message, void Logic::PushScreenMessage(const std::string& message,
const Vector3f& color) { const Vector3f& color) {
thread()->PushCall( thread()->PushCall(
[message, color] { g_graphics->AddScreenMessage(message, color); }); [message, color] { g_graphics->AddScreenMessage(message, color); });
} }
void Game::SetReplaySpeedExponent(int val) { void Logic::SetReplaySpeedExponent(int val) {
replay_speed_exponent_ = std::min(3, std::max(-3, val)); replay_speed_exponent_ = std::min(3, std::max(-3, val));
replay_speed_mult_ = powf(2.0f, static_cast<float>(replay_speed_exponent_)); replay_speed_mult_ = powf(2.0f, static_cast<float>(replay_speed_exponent_));
} }
void Game::SetDebugSpeedExponent(int val) { void Logic::SetDebugSpeedExponent(int val) {
debug_speed_exponent_ = val; debug_speed_exponent_ = val;
debug_speed_mult_ = powf(2.0f, static_cast<float>(debug_speed_exponent_)); debug_speed_mult_ = powf(2.0f, static_cast<float>(debug_speed_exponent_));
@ -1068,7 +1068,7 @@ void Game::SetDebugSpeedExponent(int val) {
if (s) s->DebugSpeedMultChanged(); if (s) s->DebugSpeedMultChanged();
} }
void Game::ChangeGameSpeed(int offs) { void Logic::ChangeGameSpeed(int offs) {
assert(InLogicThread()); assert(InLogicThread());
// If we're in a replay session, adjust playback speed there. // If we're in a replay session, adjust playback speed there.
@ -1095,40 +1095,40 @@ void Game::ChangeGameSpeed(int offs) {
} }
} }
auto Game::GetUIContext() const -> Context { auto Logic::GetUIContext() const -> Context {
return Context(GetUIContextTarget()); return Context(GetUIContextTarget());
} }
void Game::PushToggleManualCameraCall() { void Logic::PushToggleManualCameraCall() {
thread()->PushCall([] { g_graphics->ToggleManualCamera(); }); thread()->PushCall([] { g_graphics->ToggleManualCamera(); });
} }
void Game::PushToggleDebugInfoDisplayCall() { void Logic::PushToggleDebugInfoDisplayCall() {
thread()->PushCall([] { g_graphics->ToggleNetworkDebugDisplay(); }); thread()->PushCall([] { g_graphics->ToggleNetworkDebugDisplay(); });
} }
void Game::PushToggleCollisionGeometryDisplayCall() { void Logic::PushToggleCollisionGeometryDisplayCall() {
thread()->PushCall([] { g_graphics->ToggleDebugDraw(); }); thread()->PushCall([] { g_graphics->ToggleDebugDraw(); });
} }
void Game::PushMainMenuPressCall(InputDevice* device) { void Logic::PushMainMenuPressCall(InputDevice* device) {
thread()->PushCall([this, device] { MainMenuPress(device); }); thread()->PushCall([this, device] { MainMenuPress(device); });
} }
void Game::MainMenuPress(InputDevice* device) { void Logic::MainMenuPress(InputDevice* device) {
assert(InLogicThread()); assert(InLogicThread());
g_python->HandleDeviceMenuPress(device); g_python->HandleDeviceMenuPress(device);
} }
void Game::PushScreenResizeCall(float virtual_width, float virtual_height, void Logic::PushScreenResizeCall(float virtual_width, float virtual_height,
float pixel_width, float pixel_height) { float pixel_width, float pixel_height) {
thread()->PushCall([=] { thread()->PushCall([=] {
ScreenResize(virtual_width, virtual_height, pixel_width, pixel_height); ScreenResize(virtual_width, virtual_height, pixel_width, pixel_height);
}); });
} }
void Game::ScreenResize(float virtual_width, float virtual_height, void Logic::ScreenResize(float virtual_width, float virtual_height,
float pixel_width, float pixel_height) { float pixel_width, float pixel_height) {
assert(InLogicThread()); assert(InLogicThread());
assert(g_graphics != nullptr); assert(g_graphics != nullptr);
if (g_graphics) { if (g_graphics) {
@ -1143,30 +1143,30 @@ void Game::ScreenResize(float virtual_width, float virtual_height,
} }
} }
void Game::PushGameServiceAchievementListCall( void Logic::PushGameServiceAchievementListCall(
const std::set<std::string>& achievements) { const std::set<std::string>& achievements) {
thread()->PushCall( thread()->PushCall(
[this, achievements] { GameServiceAchievementList(achievements); }); [this, achievements] { GameServiceAchievementList(achievements); });
} }
void Game::GameServiceAchievementList( void Logic::GameServiceAchievementList(
const std::set<std::string>& achievements) { const std::set<std::string>& achievements) {
assert(g_python); assert(g_python);
assert(InLogicThread()); assert(InLogicThread());
g_app_internal->DispatchRemoteAchievementList(achievements); g_app_internal->DispatchRemoteAchievementList(achievements);
} }
void Game::PushPlaySoundCall(SystemSoundID sound) { void Logic::PushPlaySoundCall(SystemSoundID sound) {
thread()->PushCall( thread()->PushCall(
[sound] { g_audio->PlaySound(g_assets->GetSound(sound)); }); [sound] { g_audio->PlaySound(g_assets->GetSound(sound)); });
} }
void Game::PushFriendScoreSetCall(const FriendScoreSet& score_set) { void Logic::PushFriendScoreSetCall(const FriendScoreSet& score_set) {
thread()->PushCall( thread()->PushCall(
[score_set] { g_python->HandleFriendScoresCB(score_set); }); [score_set] { g_python->HandleFriendScoresCB(score_set); });
} }
void Game::PushConfirmQuitCall() { void Logic::PushConfirmQuitCall() {
thread()->PushCall([this] { thread()->PushCall([this] {
assert(InLogicThread()); assert(InLogicThread());
if (HeadlessMode()) { if (HeadlessMode()) {
@ -1197,7 +1197,7 @@ void Game::PushConfirmQuitCall() {
}); });
} }
void Game::Draw() { void Logic::Draw() {
g_graphics->BuildAndPushFrameDef(); g_graphics->BuildAndPushFrameDef();
// Now bring the game up to date. // Now bring the game up to date.
@ -1228,11 +1228,11 @@ void Game::Draw() {
} }
} }
void Game::PushFrameDefRequest() { void Logic::PushFrameDefRequest() {
thread()->PushCall([this] { Draw(); }); thread()->PushCall([this] { Draw(); });
} }
void Game::PushOnAppResumeCall() { void Logic::PushOnAppResumeCall() {
thread()->PushCall([] { thread()->PushCall([] {
// Wipe out whatever input device was in control of the UI. // Wipe out whatever input device was in control of the UI.
assert(g_ui); assert(g_ui);
@ -1241,7 +1241,7 @@ void Game::PushOnAppResumeCall() {
} }
// Look through everything in our config dict and act on it. // Look through everything in our config dict and act on it.
void Game::ApplyConfig() { void Logic::ApplyConfig() {
assert(InLogicThread()); assert(InLogicThread());
// Not relevant for fullscreen anymore // Not relevant for fullscreen anymore
@ -1399,11 +1399,11 @@ void Game::ApplyConfig() {
g_platform->ApplyConfig(); g_platform->ApplyConfig();
} }
void Game::PushApplyConfigCall() { void Logic::PushApplyConfigCall() {
thread()->PushCall([this] { ApplyConfig(); }); thread()->PushCall([this] { ApplyConfig(); });
} }
void Game::PushRemoveGraphicsServerRenderHoldCall() { void Logic::PushRemoveGraphicsServerRenderHoldCall() {
thread()->PushCall([] { thread()->PushCall([] {
// This call acts as a flush of sorts; when it goes through, // This call acts as a flush of sorts; when it goes through,
// we push a call to the graphics server saying its ok for it // we push a call to the graphics server saying its ok for it
@ -1413,7 +1413,7 @@ void Game::PushRemoveGraphicsServerRenderHoldCall() {
}); });
} }
void Game::PushFreeAssetComponentRefsCall( void Logic::PushFreeAssetComponentRefsCall(
const std::vector<Object::Ref<AssetComponentData>*>& components) { const std::vector<Object::Ref<AssetComponentData>*>& components) {
thread()->PushCall([components] { thread()->PushCall([components] {
for (auto&& i : components) { for (auto&& i : components) {
@ -1422,18 +1422,18 @@ void Game::PushFreeAssetComponentRefsCall(
}); });
} }
void Game::PushHavePendingLoadsDoneCall() { void Logic::PushHavePendingLoadsDoneCall() {
thread()->PushCall([] { g_assets->ClearPendingLoadsDoneList(); }); thread()->PushCall([] { g_assets->ClearPendingLoadsDoneList(); });
} }
void Game::ToggleConsole() { void Logic::ToggleConsole() {
assert(InLogicThread()); assert(InLogicThread());
if (auto console = g_app->console) { if (auto console = g_app->console) {
console->ToggleState(); console->ToggleState();
} }
} }
void Game::PushConsolePrintCall(const std::string& msg) { void Logic::PushConsolePrintCall(const std::string& msg) {
thread()->PushCall([msg] { thread()->PushCall([msg] {
// Send them to the console if its been created or store them // Send them to the console if its been created or store them
// for when it is (unless we're headless in which case it never will). // for when it is (unless we're headless in which case it never will).
@ -1445,18 +1445,18 @@ void Game::PushConsolePrintCall(const std::string& msg) {
}); });
} }
void Game::PushHavePendingLoadsCall() { void Logic::PushHavePendingLoadsCall() {
thread()->PushCall([this] { thread()->PushCall([this] {
have_pending_loads_ = true; have_pending_loads_ = true;
UpdateProcessTimer(); UpdateProcessTimer();
}); });
} }
void Game::PushShutdownCall(bool soft) { void Logic::PushShutdownCall(bool soft) {
thread()->PushCall([this, soft] { Shutdown(soft); }); thread()->PushCall([this, soft] { Shutdown(soft); });
} }
void Game::Shutdown(bool soft) { void Logic::Shutdown(bool soft) {
assert(InLogicThread()); assert(InLogicThread());
if (!g_app->shutting_down) { if (!g_app->shutting_down) {
@ -1483,13 +1483,13 @@ void Game::Shutdown(bool soft) {
} }
} }
void Game::ResetInput() { void Logic::ResetInput() {
assert(InLogicThread()); assert(InLogicThread());
g_input->ResetKeyboardHeldKeys(); g_input->ResetKeyboardHeldKeys();
g_input->ResetJoyStickHeldButtons(); g_input->ResetJoyStickHeldButtons();
} }
auto Game::RemovePlayer(Player* player) -> void { auto Logic::RemovePlayer(Player* player) -> void {
assert(InLogicThread()); assert(InLogicThread());
if (HostSession* host_session = player->GetHostSession()) { if (HostSession* host_session = player->GetHostSession()) {
host_session->RemovePlayer(player); host_session->RemovePlayer(player);
@ -1498,31 +1498,33 @@ auto Game::RemovePlayer(Player* player) -> void {
} }
} }
auto Game::NewRealTimer(millisecs_t length, bool repeat, auto Logic::NewRealTimer(millisecs_t length, bool repeat,
const Object::Ref<Runnable>& runnable) -> int { const Object::Ref<Runnable>& runnable) -> int {
int offset = 0; int offset = 0;
Timer* t = realtimers_->NewTimer(GetRealTime(), length, offset, Timer* t = realtimers_->NewTimer(GetRealTime(), length, offset,
repeat ? -1 : 0, runnable); repeat ? -1 : 0, runnable);
return t->id(); return t->id();
} }
void Game::DeleteRealTimer(int timer_id) { realtimers_->DeleteTimer(timer_id); } void Logic::DeleteRealTimer(int timer_id) {
realtimers_->DeleteTimer(timer_id);
}
void Game::SetRealTimerLength(int timer_id, millisecs_t length) { void Logic::SetRealTimerLength(int timer_id, millisecs_t length) {
Timer* t = realtimers_->GetTimer(timer_id); Timer* t = realtimers_->GetTimer(timer_id);
if (t) { if (t) {
t->SetLength(length); t->SetLength(length);
} else { } else {
Log("Error: Game::SetRealTimerLength() called on nonexistent timer."); Log("Error: Logic::SetRealTimerLength() called on nonexistent timer.");
} }
} }
void Game::Process() { void Logic::Process() {
have_pending_loads_ = g_assets->RunPendingLoadsLogicThread(); have_pending_loads_ = g_assets->RunPendingLoadsLogicThread();
UpdateProcessTimer(); UpdateProcessTimer();
} }
void Game::SetLanguageKeys( void Logic::SetLanguageKeys(
const std::unordered_map<std::string, std::string>& language) { const std::unordered_map<std::string, std::string>& language) {
assert(InLogicThread()); assert(InLogicThread());
{ {
@ -1730,8 +1732,8 @@ auto DoCompileResourceString(cJSON* obj) -> std::string {
return result; return result;
} }
auto Game::CompileResourceString(const std::string& s, const std::string& loc, auto Logic::CompileResourceString(const std::string& s, const std::string& loc,
bool* valid) -> std::string { bool* valid) -> std::string {
assert(g_python != nullptr); assert(g_python != nullptr);
bool dummyvalid; bool dummyvalid;
@ -1767,7 +1769,7 @@ auto Game::CompileResourceString(const std::string& s, const std::string& loc,
return result; return result;
} }
auto Game::GetResourceString(const std::string& key) -> std::string { auto Logic::GetResourceString(const std::string& key) -> std::string {
std::string val; std::string val;
{ {
std::scoped_lock lock(language_mutex_); std::scoped_lock lock(language_mutex_);
@ -1779,7 +1781,7 @@ auto Game::GetResourceString(const std::string& key) -> std::string {
return val; return val;
} }
auto Game::CharStr(SpecialChar id) -> std::string { auto Logic::CharStr(SpecialChar id) -> std::string {
std::scoped_lock lock(special_char_mutex_); std::scoped_lock lock(special_char_mutex_);
std::string val; std::string val;
auto i = special_char_strings_.find(id); auto i = special_char_strings_.find(id);
@ -1793,7 +1795,7 @@ auto Game::CharStr(SpecialChar id) -> std::string {
return val; return val;
} }
auto Game::ShouldAnnouncePartyJoinsAndLeaves() -> bool { auto Logic::ShouldAnnouncePartyJoinsAndLeaves() -> bool {
assert(InLogicThread()); assert(InLogicThread());
// At the moment we don't announce these for public internet parties.. (too // At the moment we don't announce these for public internet parties.. (too
@ -1801,7 +1803,7 @@ auto Game::ShouldAnnouncePartyJoinsAndLeaves() -> bool {
return !public_party_enabled(); return !public_party_enabled();
} }
void Game::CleanUpBeforeConnectingToHost() { void Logic::CleanUpBeforeConnectingToHost() {
// We can't have connected clients and a host-connection at the same time. // We can't have connected clients and a host-connection at the same time.
// Make a minimal attempt to disconnect any client connections we have, but // Make a minimal attempt to disconnect any client connections we have, but
// get them off the list immediately. // get them off the list immediately.
@ -1815,13 +1817,13 @@ void Game::CleanUpBeforeConnectingToHost() {
SetPublicPartyEnabled(false); SetPublicPartyEnabled(false);
} }
auto Game::GetPartySize() const -> int { auto Logic::GetPartySize() const -> int {
assert(InLogicThread()); assert(InLogicThread());
assert(game_roster_ != nullptr); assert(game_roster_ != nullptr);
return cJSON_GetArraySize(game_roster_); return cJSON_GetArraySize(game_roster_);
} }
void Game::LocalDisplayChatMessage(const std::vector<uint8_t>& buffer) { void Logic::LocalDisplayChatMessage(const std::vector<uint8_t>& buffer) {
// 1 type byte, 1 spec-len byte, 1 or more spec chars, 0 or more msg chars. // 1 type byte, 1 spec-len byte, 1 or more spec chars, 0 or more msg chars.
if (buffer.size() > 3) { if (buffer.size() > 3) {
size_t spec_len = buffer[1]; size_t spec_len = buffer[1];
@ -1862,7 +1864,7 @@ void Game::LocalDisplayChatMessage(const std::vector<uint8_t>& buffer) {
} }
} }
auto Game::GetGameRosterMessage() -> std::vector<uint8_t> { auto Logic::GetGameRosterMessage() -> std::vector<uint8_t> {
// This message is simply a flattened json string of our roster (including // This message is simply a flattened json string of our roster (including
// terminating char). // terminating char).
char* s = cJSON_PrintUnformatted(game_roster_); char* s = cJSON_PrintUnformatted(game_roster_);
@ -1875,7 +1877,7 @@ auto Game::GetGameRosterMessage() -> std::vector<uint8_t> {
return msg; return msg;
} }
auto Game::IsPlayerBanned(const PlayerSpec& spec) -> bool { auto Logic::IsPlayerBanned(const PlayerSpec& spec) -> bool {
millisecs_t current_time = GetRealTime(); millisecs_t current_time = GetRealTime();
// Now is a good time to prune no-longer-banned specs. // Now is a good time to prune no-longer-banned specs.
@ -1892,8 +1894,8 @@ auto Game::IsPlayerBanned(const PlayerSpec& spec) -> bool {
return false; return false;
} }
void Game::StartKickVote(ConnectionToClient* starter, void Logic::StartKickVote(ConnectionToClient* starter,
ConnectionToClient* target) { ConnectionToClient* target) {
// Restrict votes per client. // Restrict votes per client.
millisecs_t current_time = GetRealTime(); millisecs_t current_time = GetRealTime();
@ -1991,11 +1993,11 @@ void Game::StartKickVote(ConnectionToClient* starter,
} }
} }
void Game::BanPlayer(const PlayerSpec& spec, millisecs_t duration) { void Logic::BanPlayer(const PlayerSpec& spec, millisecs_t duration) {
banned_players_.emplace_back(GetRealTime() + duration, spec); banned_players_.emplace_back(GetRealTime() + duration, spec);
} }
void Game::UpdateGameRoster() { void Logic::UpdateGameRoster() {
assert(InLogicThread()); assert(InLogicThread());
assert(game_roster_ != nullptr); assert(game_roster_ != nullptr);
@ -2106,7 +2108,7 @@ void Game::UpdateGameRoster() {
game_roster_dirty_ = true; game_roster_dirty_ = true;
} }
void Game::SetPublicPartyEnabled(bool val) { void Logic::SetPublicPartyEnabled(bool val) {
assert(InLogicThread()); assert(InLogicThread());
if (val == public_party_enabled_) { if (val == public_party_enabled_) {
return; return;
@ -2115,7 +2117,7 @@ void Game::SetPublicPartyEnabled(bool val) {
g_app_internal->PushPublicPartyState(); g_app_internal->PushPublicPartyState();
} }
void Game::SetPublicPartySize(int count) { void Logic::SetPublicPartySize(int count) {
assert(InLogicThread()); assert(InLogicThread());
if (count == public_party_size_) { if (count == public_party_size_) {
return; return;
@ -2129,7 +2131,7 @@ void Game::SetPublicPartySize(int count) {
} }
} }
void Game::SetPublicPartyMaxSize(int count) { void Logic::SetPublicPartyMaxSize(int count) {
assert(InLogicThread()); assert(InLogicThread());
if (count == public_party_max_size_) { if (count == public_party_max_size_) {
return; return;
@ -2143,7 +2145,7 @@ void Game::SetPublicPartyMaxSize(int count) {
} }
} }
void Game::SetPublicPartyName(const std::string& name) { void Logic::SetPublicPartyName(const std::string& name) {
assert(InLogicThread()); assert(InLogicThread());
if (name == public_party_name_) { if (name == public_party_name_) {
return; return;
@ -2157,7 +2159,7 @@ void Game::SetPublicPartyName(const std::string& name) {
} }
} }
void Game::SetPublicPartyStatsURL(const std::string& url) { void Logic::SetPublicPartyStatsURL(const std::string& url) {
assert(InLogicThread()); assert(InLogicThread());
if (url == public_party_stats_url_) { if (url == public_party_stats_url_) {
return; return;
@ -2171,7 +2173,7 @@ void Game::SetPublicPartyStatsURL(const std::string& url) {
} }
} }
void Game::SetPublicPartyPlayerCount(int count) { void Logic::SetPublicPartyPlayerCount(int count) {
assert(InLogicThread()); assert(InLogicThread());
if (count == public_party_player_count_) { if (count == public_party_player_count_) {
return; return;

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_GAME_H_ #ifndef BALLISTICA_LOGIC_LOGIC_H_
#define BALLISTICA_GAME_GAME_H_ #define BALLISTICA_LOGIC_LOGIC_H_
#include <list> #include <list>
#include <memory> #include <memory>
@ -22,9 +22,9 @@ const int kMaxPartyNameCombinedSize = 25;
/// The Game Module generally runs on a dedicated thread; it manages /// The Game Module generally runs on a dedicated thread; it manages
/// all game logic, builds frame_defs to send to the graphics-server for /// all game logic, builds frame_defs to send to the graphics-server for
/// rendering, etc. /// rendering, etc.
class Game { class Logic {
public: public:
Game(); Logic();
auto OnAppStart() -> void; auto OnAppStart() -> void;
auto LaunchHostSession(PyObject* session_type_obj, auto LaunchHostSession(PyObject* session_type_obj,
@ -338,4 +338,4 @@ class Game {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_GAME_H_ #endif // BALLISTICA_LOGIC_LOGIC_H_

View File

@ -1,11 +1,11 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/player.h" #include "ballistica/logic/player.h"
#include "ballistica/game/host_activity.h"
#include "ballistica/game/session/host_session.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/input/device/joystick.h" #include "ballistica/input/device/joystick.h"
#include "ballistica/logic/host_activity.h"
#include "ballistica/logic/session/host_session.h"
#include "ballistica/python/class/python_class_session_player.h" #include "ballistica/python/class/python_class_session_player.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_context_call.h" #include "ballistica/python/python_context_call.h"
@ -367,7 +367,7 @@ void Player::SetName(const std::string& name, const std::string& full_name,
// If we're already in the game and our name is changing, we need to update // If we're already in the game and our name is changing, we need to update
// the roster. // the roster.
if (accepted_) { if (accepted_) {
g_game->UpdateGameRoster(); g_logic->UpdateGameRoster();
} }
} }

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_PLAYER_H_ #ifndef BALLISTICA_LOGIC_PLAYER_H_
#define BALLISTICA_GAME_PLAYER_H_ #define BALLISTICA_LOGIC_PLAYER_H_
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
@ -164,4 +164,4 @@ class Player : public Object {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_PLAYER_H_ #endif // BALLISTICA_LOGIC_PLAYER_H_

View File

@ -1,12 +1,12 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/player_spec.h" #include "ballistica/logic/player_spec.h"
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/game/game.h"
#include "ballistica/game/v1_account.h"
#include "ballistica/generic/json.h" #include "ballistica/generic/json.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/logic/logic.h"
#include "ballistica/logic/v1_account.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
namespace ballistica { namespace ballistica {
@ -84,9 +84,9 @@ auto PlayerSpec::GetAccountPlayerSpec() -> PlayerSpec {
} else { } else {
// Headless builds fall back to V1 public-party name if that's available. // Headless builds fall back to V1 public-party name if that's available.
if (g_buildconfig.headless_build() if (g_buildconfig.headless_build()
&& !g_game->public_party_name().empty()) { && !g_logic->public_party_name().empty()) {
spec.name_ = spec.name_ =
Utils::GetValidUTF8(g_game->public_party_name().c_str(), "bsgp3r"); Utils::GetValidUTF8(g_logic->public_party_name().c_str(), "bsgp3r");
} else { } else {
// Or lastly fall back to device name. // Or lastly fall back to device name.
spec.name_ = spec.name_ =

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_PLAYER_SPEC_H_ #ifndef BALLISTICA_LOGIC_PLAYER_SPEC_H_
#define BALLISTICA_GAME_PLAYER_SPEC_H_ #define BALLISTICA_LOGIC_PLAYER_SPEC_H_
#include <string> #include <string>
@ -56,4 +56,4 @@ class PlayerSpec {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_PLAYER_SPEC_H_ #endif // BALLISTICA_LOGIC_PLAYER_SPEC_H_

View File

@ -1,6 +1,6 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/session/client_session.h" #include "ballistica/logic/session/client_session.h"
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/assets/component/collide_model.h" #include "ballistica/assets/component/collide_model.h"
@ -360,7 +360,7 @@ void ClientSession::Update(int time_advance) {
} }
case SessionCommand::kSetForegroundSceneGraph: { case SessionCommand::kSetForegroundSceneGraph: {
Scene* scene = GetScene(ReadInt32()); Scene* scene = GetScene(ReadInt32());
g_game->SetForegroundScene(scene); g_logic->SetForegroundScene(scene);
break; break;
} }
case SessionCommand::kNodeMessage: { case SessionCommand::kNodeMessage: {

View File

@ -1,14 +1,14 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_SESSION_CLIENT_SESSION_H_ #ifndef BALLISTICA_LOGIC_SESSION_CLIENT_SESSION_H_
#define BALLISTICA_GAME_SESSION_CLIENT_SESSION_H_ #define BALLISTICA_LOGIC_SESSION_CLIENT_SESSION_H_
#include <list> #include <list>
#include <string> #include <string>
#include <vector> #include <vector>
#include "ballistica/game/client_controller_interface.h" #include "ballistica/logic/client_controller_interface.h"
#include "ballistica/game/session/session.h" #include "ballistica/logic/session/session.h"
namespace ballistica { namespace ballistica {
@ -135,4 +135,4 @@ class ClientSession : public Session {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_SESSION_CLIENT_SESSION_H_ #endif // BALLISTICA_LOGIC_SESSION_CLIENT_SESSION_H_

View File

@ -1,17 +1,17 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/session/host_session.h" #include "ballistica/logic/session/host_session.h"
#include "ballistica/assets/component/data.h" #include "ballistica/assets/component/data.h"
#include "ballistica/assets/component/model.h" #include "ballistica/assets/component/model.h"
#include "ballistica/assets/component/sound.h" #include "ballistica/assets/component/sound.h"
#include "ballistica/assets/component/texture.h" #include "ballistica/assets/component/texture.h"
#include "ballistica/game/host_activity.h"
#include "ballistica/game/player.h"
#include "ballistica/generic/lambda_runnable.h" #include "ballistica/generic/lambda_runnable.h"
#include "ballistica/generic/timer.h" #include "ballistica/generic/timer.h"
#include "ballistica/graphics/graphics.h" #include "ballistica/graphics/graphics.h"
#include "ballistica/input/device/input_device.h" #include "ballistica/input/device/input_device.h"
#include "ballistica/logic/host_activity.h"
#include "ballistica/logic/player.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_command.h" #include "ballistica/python/python_command.h"
#include "ballistica/python/python_context_call.h" #include "ballistica/python/python_context_call.h"
@ -22,7 +22,7 @@ namespace ballistica {
HostSession::HostSession(PyObject* session_type_obj) HostSession::HostSession(PyObject* session_type_obj)
: last_kick_idle_players_decrement_time_(GetRealTime()) { : last_kick_idle_players_decrement_time_(GetRealTime()) {
assert(g_game); assert(g_logic);
assert(InLogicThread()); assert(InLogicThread());
assert(session_type_obj != nullptr); assert(session_type_obj != nullptr);
@ -34,7 +34,7 @@ HostSession::HostSession(PyObject* session_type_obj)
"bastd.mainmenu.MainMenuSession")); "bastd.mainmenu.MainMenuSession"));
// Log("MAIN MENU? " + std::to_string(is_main_menu())); // Log("MAIN MENU? " + std::to_string(is_main_menu()));
kick_idle_players_ = g_game->kick_idle_players(); kick_idle_players_ = g_logic->kick_idle_players();
// Create a timer to step our session scene. // Create a timer to step our session scene.
step_scene_timer_ = step_scene_timer_ =
@ -90,7 +90,7 @@ HostSession::HostSession(PyObject* session_type_obj)
// Lastly, keep the python layer fed with our latest player count in case // Lastly, keep the python layer fed with our latest player count in case
// it is updating the master-server with our current/max player counts. // it is updating the master-server with our current/max player counts.
g_game->SetPublicPartyPlayerCount(static_cast<int>(players_.size())); g_logic->SetPublicPartyPlayerCount(static_cast<int>(players_.size()));
} }
auto HostSession::GetHostSession() -> HostSession* { return this; } auto HostSession::GetHostSession() -> HostSession* { return this; }
@ -272,12 +272,12 @@ void HostSession::RequestPlayer(InputDevice* device) {
// If he was accepted, update our game roster with the new info. // If he was accepted, update our game roster with the new info.
if (accept) { if (accept) {
g_game->UpdateGameRoster(); g_logic->UpdateGameRoster();
} }
// Lastly, keep the python layer fed with our latest player count in case it // Lastly, keep the python layer fed with our latest player count in case it
// is updating the master-server with our current/max player counts. // is updating the master-server with our current/max player counts.
g_game->SetPublicPartyPlayerCount(static_cast<int>(players_.size())); g_logic->SetPublicPartyPlayerCount(static_cast<int>(players_.size()));
} }
void HostSession::RemovePlayer(Player* player) { void HostSession::RemovePlayer(Player* player) {
@ -296,11 +296,11 @@ void HostSession::RemovePlayer(Player* player) {
} }
// Update our game roster with the departure. // Update our game roster with the departure.
g_game->UpdateGameRoster(); g_logic->UpdateGameRoster();
// Lastly, keep the python layer fed with our latest player count in case // Lastly, keep the python layer fed with our latest player count in case
// it is updating the master-server with our current/max player counts. // it is updating the master-server with our current/max player counts.
g_game->SetPublicPartyPlayerCount(static_cast<int>(players_.size())); g_logic->SetPublicPartyPlayerCount(static_cast<int>(players_.size()));
return; return;
} }
@ -369,7 +369,7 @@ void HostSession::SetForegroundHostActivity(HostActivity* a) {
// Now go through telling each host-activity whether it's foregrounded or not. // Now go through telling each host-activity whether it's foregrounded or not.
// FIXME: Dying sessions never get told they're un-foregrounded.. could that // FIXME: Dying sessions never get told they're un-foregrounded.. could that
// ever be a problem? // ever be a problem?
bool session_is_foreground = (g_game->GetForegroundSession() != nullptr); bool session_is_foreground = (g_logic->GetForegroundSession() != nullptr);
for (auto&& i : host_activities_) { for (auto&& i : host_activities_) {
i->SetIsForeground(session_is_foreground && (i == a)); i->SetIsForeground(session_is_foreground && (i == a));
} }
@ -442,7 +442,7 @@ void HostSession::DecrementPlayerTimeOuts(millisecs_t millisecs) {
assert(player); assert(player);
if (player->time_out() < millisecs) { if (player->time_out() < millisecs) {
std::string kick_str = std::string kick_str =
g_game->GetResourceString("kickIdlePlayersKickedText"); g_logic->GetResourceString("kickIdlePlayersKickedText");
Utils::StringReplaceOne(&kick_str, "${NAME}", player->GetName()); Utils::StringReplaceOne(&kick_str, "${NAME}", player->GetName());
ScreenMessage(kick_str); ScreenMessage(kick_str);
RemovePlayer(player); RemovePlayer(player);
@ -450,12 +450,12 @@ void HostSession::DecrementPlayerTimeOuts(millisecs_t millisecs) {
} else if (player->time_out() > BA_PLAYER_TIME_OUT_WARN } else if (player->time_out() > BA_PLAYER_TIME_OUT_WARN
&& (player->time_out() - millisecs <= BA_PLAYER_TIME_OUT_WARN)) { && (player->time_out() - millisecs <= BA_PLAYER_TIME_OUT_WARN)) {
std::string kick_str_1 = std::string kick_str_1 =
g_game->GetResourceString("kickIdlePlayersWarning1Text"); g_logic->GetResourceString("kickIdlePlayersWarning1Text");
Utils::StringReplaceOne(&kick_str_1, "${NAME}", player->GetName()); Utils::StringReplaceOne(&kick_str_1, "${NAME}", player->GetName());
Utils::StringReplaceOne(&kick_str_1, "${COUNT}", Utils::StringReplaceOne(&kick_str_1, "${COUNT}",
std::to_string(BA_PLAYER_TIME_OUT_WARN / 1000)); std::to_string(BA_PLAYER_TIME_OUT_WARN / 1000));
ScreenMessage(kick_str_1); ScreenMessage(kick_str_1);
ScreenMessage(g_game->GetResourceString("kickIdlePlayersWarning2Text")); ScreenMessage(g_logic->GetResourceString("kickIdlePlayersWarning2Text"));
} }
player->set_time_out(player->time_out() - millisecs); player->set_time_out(player->time_out() - millisecs);
} }

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_SESSION_HOST_SESSION_H_ #ifndef BALLISTICA_LOGIC_SESSION_HOST_SESSION_H_
#define BALLISTICA_GAME_SESSION_HOST_SESSION_H_ #define BALLISTICA_LOGIC_SESSION_HOST_SESSION_H_
#include <list> #include <list>
#include <string> #include <string>
@ -9,8 +9,8 @@
#include <vector> #include <vector>
#include "ballistica/core/context.h" #include "ballistica/core/context.h"
#include "ballistica/game/session/session.h"
#include "ballistica/generic/timer_list.h" #include "ballistica/generic/timer_list.h"
#include "ballistica/logic/session/session.h"
#include "ballistica/python/python_ref.h" #include "ballistica/python/python_ref.h"
namespace ballistica { namespace ballistica {
@ -128,4 +128,4 @@ class HostSession : public Session {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_SESSION_HOST_SESSION_H_ #endif // BALLISTICA_LOGIC_SESSION_HOST_SESSION_H_

View File

@ -1,12 +1,12 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/session/net_client_session.h" #include "ballistica/logic/session/net_client_session.h"
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/assets/assets_server.h" #include "ballistica/assets/assets_server.h"
#include "ballistica/game/connection/connection_to_host.h"
#include "ballistica/graphics/graphics.h" #include "ballistica/graphics/graphics.h"
#include "ballistica/graphics/net_graph.h" #include "ballistica/graphics/net_graph.h"
#include "ballistica/logic/connection/connection_to_host.h"
namespace ballistica { namespace ballistica {

View File

@ -1,11 +1,11 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_SESSION_NET_CLIENT_SESSION_H_ #ifndef BALLISTICA_LOGIC_SESSION_NET_CLIENT_SESSION_H_
#define BALLISTICA_GAME_SESSION_NET_CLIENT_SESSION_H_ #define BALLISTICA_LOGIC_SESSION_NET_CLIENT_SESSION_H_
#include <vector> #include <vector>
#include "ballistica/game/session/client_session.h" #include "ballistica/logic/session/client_session.h"
namespace ballistica { namespace ballistica {
@ -59,4 +59,4 @@ class NetClientSession : public ClientSession {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_SESSION_NET_CLIENT_SESSION_H_ #endif // BALLISTICA_LOGIC_SESSION_NET_CLIENT_SESSION_H_

View File

@ -1,12 +1,12 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/session/replay_client_session.h" #include "ballistica/logic/session/replay_client_session.h"
#include "ballistica/dynamics/material/material.h" #include "ballistica/dynamics/material/material.h"
#include "ballistica/game/connection/connection_set.h"
#include "ballistica/game/connection/connection_to_client.h"
#include "ballistica/generic/huffman.h" #include "ballistica/generic/huffman.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/logic/connection/connection_set.h"
#include "ballistica/logic/connection/connection_to_client.h"
#include "ballistica/math/vector3f.h" #include "ballistica/math/vector3f.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
@ -17,13 +17,13 @@ namespace ballistica {
auto ReplayClientSession::GetActualTimeAdvance(int advance_in) -> int { auto ReplayClientSession::GetActualTimeAdvance(int advance_in) -> int {
return static_cast<int>( return static_cast<int>(
round(advance_in * pow(2.0f, g_game->replay_speed_exponent()))); round(advance_in * pow(2.0f, g_logic->replay_speed_exponent())));
} }
ReplayClientSession::ReplayClientSession(std::string filename) ReplayClientSession::ReplayClientSession(std::string filename)
: file_name_(std::move(filename)) { : file_name_(std::move(filename)) {
// take responsibility for feeding all clients to this device.. // take responsibility for feeding all clients to this device..
g_game->connections()->RegisterClientController(this); g_logic->connections()->RegisterClientController(this);
// go ahead and just do a reset here, which will get things going.. // go ahead and just do a reset here, which will get things going..
Reset(true); Reset(true);
@ -31,7 +31,7 @@ ReplayClientSession::ReplayClientSession(std::string filename)
ReplayClientSession::~ReplayClientSession() { ReplayClientSession::~ReplayClientSession() {
// we no longer are responsible for feeding clients to this device.. // we no longer are responsible for feeding clients to this device..
g_game->connections()->UnregisterClientController(this); g_logic->connections()->UnregisterClientController(this);
if (file_) { if (file_) {
fclose(file_); fclose(file_);
@ -198,7 +198,7 @@ void ReplayClientSession::FetchMessages() {
void ReplayClientSession::Error(const std::string& description) { void ReplayClientSession::Error(const std::string& description) {
// Close the replay, announce something went wrong with it, and then do // Close the replay, announce something went wrong with it, and then do
// standard error response.. // standard error response..
ScreenMessage(g_game->GetResourceString("replayReadErrorText"), {1, 0, 0}); ScreenMessage(g_logic->GetResourceString("replayReadErrorText"), {1, 0, 0});
if (file_) { if (file_) {
fclose(file_); fclose(file_);
file_ = nullptr; file_ = nullptr;
@ -246,7 +246,7 @@ void ReplayClientSession::OnReset(bool rewind) {
return; return;
} }
if (version > kProtocolVersion || version < kProtocolVersionMin) { if (version > kProtocolVersion || version < kProtocolVersionMin) {
ScreenMessage(g_game->GetResourceString("replayVersionErrorText"), ScreenMessage(g_logic->GetResourceString("replayVersionErrorText"),
{1, 0, 0}); {1, 0, 0});
End(); End();
return; return;

View File

@ -1,13 +1,13 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_SESSION_REPLAY_CLIENT_SESSION_H_ #ifndef BALLISTICA_LOGIC_SESSION_REPLAY_CLIENT_SESSION_H_
#define BALLISTICA_GAME_SESSION_REPLAY_CLIENT_SESSION_H_ #define BALLISTICA_LOGIC_SESSION_REPLAY_CLIENT_SESSION_H_
#include <string> #include <string>
#include <vector> #include <vector>
#include "ballistica/game/client_controller_interface.h" #include "ballistica/logic/client_controller_interface.h"
#include "ballistica/game/session/client_session.h" #include "ballistica/logic/session/client_session.h"
namespace ballistica { namespace ballistica {
@ -39,4 +39,4 @@ class ReplayClientSession : public ClientSession,
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_SESSION_REPLAY_CLIENT_SESSION_H_ #endif // BALLISTICA_LOGIC_SESSION_REPLAY_CLIENT_SESSION_H_

View File

@ -1,9 +1,9 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/session/session.h" #include "ballistica/logic/session/session.h"
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
namespace ballistica { namespace ballistica {
@ -11,7 +11,7 @@ Session::Session() {
g_app->session_count++; g_app->session_count++;
// New sessions immediately become foreground. // New sessions immediately become foreground.
g_game->SetForegroundSession(this); g_logic->SetForegroundSession(this);
} }
Session::~Session() { g_app->session_count--; } Session::~Session() { g_app->session_count--; }

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_SESSION_SESSION_H_ #ifndef BALLISTICA_LOGIC_SESSION_SESSION_H_
#define BALLISTICA_GAME_SESSION_SESSION_H_ #define BALLISTICA_LOGIC_SESSION_SESSION_H_
#include "ballistica/core/context.h" #include "ballistica/core/context.h"
#include "ballistica/core/object.h" #include "ballistica/core/object.h"
@ -41,4 +41,4 @@ class Session : public ContextTarget {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_SESSION_SESSION_H_ #endif // BALLISTICA_LOGIC_SESSION_SESSION_H_

View File

@ -1,11 +1,11 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/game/v1_account.h" #include "ballistica/logic/v1_account.h"
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/game/game.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/internal/app_internal.h" #include "ballistica/internal/app_internal.h"
#include "ballistica/logic/logic.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
namespace ballistica { namespace ballistica {
@ -66,24 +66,24 @@ auto V1Account::AccountTypeToString(V1AccountType type) -> std::string {
auto V1Account::AccountTypeToIconString(V1AccountType type) -> std::string { auto V1Account::AccountTypeToIconString(V1AccountType type) -> std::string {
switch (type) { switch (type) {
case V1AccountType::kTest: case V1AccountType::kTest:
return g_game->CharStr(SpecialChar::kTestAccount); return g_logic->CharStr(SpecialChar::kTestAccount);
case V1AccountType::kNvidiaChina: case V1AccountType::kNvidiaChina:
return g_game->CharStr(SpecialChar::kNvidiaLogo); return g_logic->CharStr(SpecialChar::kNvidiaLogo);
case V1AccountType::kGooglePlay: case V1AccountType::kGooglePlay:
return g_game->CharStr(SpecialChar::kGooglePlayGamesLogo); return g_logic->CharStr(SpecialChar::kGooglePlayGamesLogo);
case V1AccountType::kSteam: case V1AccountType::kSteam:
return g_game->CharStr(SpecialChar::kSteamLogo); return g_logic->CharStr(SpecialChar::kSteamLogo);
case V1AccountType::kOculus: case V1AccountType::kOculus:
return g_game->CharStr(SpecialChar::kOculusLogo); return g_logic->CharStr(SpecialChar::kOculusLogo);
case V1AccountType::kGameCenter: case V1AccountType::kGameCenter:
return g_game->CharStr(SpecialChar::kGameCenterLogo); return g_logic->CharStr(SpecialChar::kGameCenterLogo);
case V1AccountType::kGameCircle: case V1AccountType::kGameCircle:
return g_game->CharStr(SpecialChar::kGameCircleLogo); return g_logic->CharStr(SpecialChar::kGameCircleLogo);
case V1AccountType::kDevice: case V1AccountType::kDevice:
case V1AccountType::kServer: case V1AccountType::kServer:
return g_game->CharStr(SpecialChar::kLocalAccount); return g_logic->CharStr(SpecialChar::kLocalAccount);
case V1AccountType::kV2: case V1AccountType::kV2:
return g_game->CharStr(SpecialChar::kV2Logo); return g_logic->CharStr(SpecialChar::kV2Logo);
default: default:
return ""; return "";
} }

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GAME_V1_ACCOUNT_H_ #ifndef BALLISTICA_LOGIC_V1_ACCOUNT_H_
#define BALLISTICA_GAME_V1_ACCOUNT_H_ #define BALLISTICA_LOGIC_V1_ACCOUNT_H_
#include <mutex> #include <mutex>
#include <string> #include <string>
@ -63,4 +63,4 @@ class V1Account {
} // namespace ballistica } // namespace ballistica
#endif // BALLISTICA_GAME_V1_ACCOUNT_H_ #endif // BALLISTICA_LOGIC_V1_ACCOUNT_H_

View File

@ -2,11 +2,11 @@
#include "ballistica/networking/network_reader.h" #include "ballistica/networking/network_reader.h"
#include "ballistica/game/connection/connection_set.h"
#include "ballistica/game/game.h"
#include "ballistica/game/player_spec.h"
#include "ballistica/generic/json.h" #include "ballistica/generic/json.h"
#include "ballistica/input/remote_app.h" #include "ballistica/input/remote_app.h"
#include "ballistica/logic/connection/connection_set.h"
#include "ballistica/logic/logic.h"
#include "ballistica/logic/player_spec.h"
#include "ballistica/math/vector3f.h" #include "ballistica/math/vector3f.h"
#include "ballistica/networking/network_writer.h" #include "ballistica/networking/network_writer.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
@ -97,8 +97,8 @@ static auto HandleJSONPing(const std::string& data_str) -> std::string {
int party_size = 0; int party_size = 0;
int party_size_max = 10; int party_size_max = 10;
if (g_python != nullptr) { if (g_python != nullptr) {
party_size = g_game->public_party_size(); party_size = g_logic->public_party_size();
party_size_max = g_game->public_party_max_size(); party_size_max = g_logic->public_party_max_size();
} }
snprintf(buffer, sizeof(buffer), R"({"b":%d,"ps":%d,"psmx":%d})", snprintf(buffer, sizeof(buffer), R"({"b":%d,"ps":%d,"psmx":%d})",
kAppBuildNumber, party_size, party_size_max); kAppBuildNumber, party_size, party_size_max);
@ -110,7 +110,7 @@ static auto HandleGameQuery(const char* buffer, size_t size,
if (size == 5) { if (size == 5) {
// If we're already in a party, don't advertise since they // If we're already in a party, don't advertise since they
// wouldn't be able to join us anyway. // wouldn't be able to join us anyway.
if (g_game->connections()->has_connection_to_host()) { if (g_logic->connections()->has_connection_to_host()) {
return; return;
} }
@ -348,7 +348,7 @@ auto NetworkReader::RunThread() -> int {
// connections.. pass them to the game thread to wrangle. // connections.. pass them to the game thread to wrangle.
std::vector<uint8_t> msg_buffer(rresult2); std::vector<uint8_t> msg_buffer(rresult2);
memcpy(&(msg_buffer[0]), buffer, rresult2); memcpy(&(msg_buffer[0]), buffer, rresult2);
g_game->connections()->PushUDPConnectionPacketCall( g_logic->connections()->PushUDPConnectionPacketCall(
msg_buffer, SockAddr(from)); msg_buffer, SockAddr(from));
break; break;
} }

View File

@ -3,7 +3,7 @@
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/game/player_spec.h" #include "ballistica/logic/player_spec.h"
#include "ballistica/networking/network_reader.h" #include "ballistica/networking/network_reader.h"
#include "ballistica/networking/sockaddr.h" #include "ballistica/networking/sockaddr.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"

View File

@ -5,7 +5,7 @@
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/core/context.h" #include "ballistica/core/context.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/networking/networking.h" #include "ballistica/networking/networking.h"
#include "ballistica/networking/networking_sys.h" #include "ballistica/networking/networking_sys.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
@ -106,16 +106,16 @@ auto TelnetServer::RunThread() -> int {
} }
// If we dont have access and havnt asked the user for it yet, ask them. // If we dont have access and havnt asked the user for it yet, ask them.
if (!user_has_granted_access_ && g_game if (!user_has_granted_access_ && g_logic
&& !have_asked_user_for_access_) { && !have_asked_user_for_access_) {
g_game->PushAskUserForTelnetAccessCall(); g_logic->PushAskUserForTelnetAccessCall();
have_asked_user_for_access_ = true; have_asked_user_for_access_ = true;
} }
// Require password for each connection if we have one // Require password for each connection if we have one
reading_password_ = require_password_; reading_password_ = require_password_;
if (g_game) { if (g_logic) {
if (reading_password_) { if (reading_password_) {
PushPrint(password_prompt); PushPrint(password_prompt);
} else { } else {
@ -144,7 +144,7 @@ auto TelnetServer::RunThread() -> int {
if (result > 1 && (buffer[result - 2] == '\r')) if (result > 1 && (buffer[result - 2] == '\r'))
buffer[result - 2] = 0; buffer[result - 2] = 0;
} }
if (g_game) { if (g_logic) {
if (user_has_granted_access_) { if (user_has_granted_access_) {
if (reading_password_) { if (reading_password_) {
if (GetRealTime() - last_try_time_ < 2000) { if (GetRealTime() - last_try_time_ < 2000) {
@ -163,7 +163,7 @@ auto TelnetServer::RunThread() -> int {
PushTelnetScriptCommand(buffer); PushTelnetScriptCommand(buffer);
} }
} else { } else {
PushPrint(g_game->GetResourceString("telnetAccessDeniedText")); PushPrint(g_logic->GetResourceString("telnetAccessDeniedText"));
} }
} }
} }
@ -185,13 +185,13 @@ auto TelnetServer::RunThread() -> int {
#pragma clang diagnostic pop #pragma clang diagnostic pop
void TelnetServer::PushTelnetScriptCommand(const std::string& command) { void TelnetServer::PushTelnetScriptCommand(const std::string& command) {
assert(g_game); assert(g_logic);
if (g_game == nullptr) { if (g_logic == nullptr) {
return; return;
} }
g_game->thread()->PushCall([this, command] { g_logic->thread()->PushCall([this, command] {
// These are always run in whichever context is 'visible'. // These are always run in whichever context is 'visible'.
ScopedSetContext cp(g_game->GetForegroundContext()); ScopedSetContext cp(g_logic->GetForegroundContext());
if (!g_app->user_ran_commands) { if (!g_app->user_ran_commands) {
g_app->user_ran_commands = true; g_app->user_ran_commands = true;
} }
@ -216,8 +216,8 @@ void TelnetServer::PushTelnetScriptCommand(const std::string& command) {
} }
void TelnetServer::PushPrint(const std::string& s) { void TelnetServer::PushPrint(const std::string& s) {
assert(g_game); assert(g_logic);
g_game->thread()->PushCall([this, s] { Print(s); }); g_logic->thread()->PushCall([this, s] { Print(s); });
} }
void TelnetServer::Print(const std::string& s) { void TelnetServer::Print(const std::string& s) {

View File

@ -22,14 +22,14 @@
#include "ballistica/app/app_flavor.h" #include "ballistica/app/app_flavor.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/dynamics/bg/bg_dynamics_server.h" #include "ballistica/dynamics/bg/bg_dynamics_server.h"
#include "ballistica/game/friend_score_set.h"
#include "ballistica/game/game.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/graphics/camera.h" #include "ballistica/graphics/camera.h"
#include "ballistica/graphics/graphics.h" #include "ballistica/graphics/graphics.h"
#include "ballistica/graphics/mesh/sprite_mesh.h" #include "ballistica/graphics/mesh/sprite_mesh.h"
#include "ballistica/graphics/vr_graphics.h" #include "ballistica/graphics/vr_graphics.h"
#include "ballistica/input/input.h" #include "ballistica/input/input.h"
#include "ballistica/logic/friend_score_set.h"
#include "ballistica/logic/logic.h"
#include "ballistica/networking/networking_sys.h" #include "ballistica/networking/networking_sys.h"
#include "ballistica/platform/sdl/sdl_app.h" #include "ballistica/platform/sdl/sdl_app.h"
#include "ballistica/platform/stdio_console.h" #include "ballistica/platform/stdio_console.h"
@ -849,7 +849,7 @@ void Platform::GetFriendScores(const std::string& game,
const std::string& game_version, void* data) { const std::string& game_version, void* data) {
// As a default, just fail gracefully. // As a default, just fail gracefully.
Log("FIXME: GetFriendScores unimplemented"); Log("FIXME: GetFriendScores unimplemented");
g_game->PushFriendScoreSetCall(FriendScoreSet(false, data)); g_logic->PushFriendScoreSetCall(FriendScoreSet(false, data));
} }
void Platform::SubmitScore(const std::string& game, const std::string& version, void Platform::SubmitScore(const std::string& game, const std::string& version,
@ -940,7 +940,7 @@ void Platform::DrainAutoReleasePool(void* pool) { throw Exception(); }
void Platform::OpenURL(const std::string& url) { void Platform::OpenURL(const std::string& url) {
// Can't open URLs in VR - just tell the game thread to show the url. // Can't open URLs in VR - just tell the game thread to show the url.
if (IsVRMode()) { if (IsVRMode()) {
g_game->PushShowURLCall(url); g_logic->PushShowURLCall(url);
return; return;
} }
@ -1277,10 +1277,10 @@ auto Platform::HavePermission(Permission p) -> bool {
#if !BA_OSTYPE_WINDOWS #if !BA_OSTYPE_WINDOWS
static void HandleSIGINT(int s) { static void HandleSIGINT(int s) {
if (g_game) { if (g_logic) {
g_game->PushInterruptSignalCall(); g_logic->PushInterruptSignalCall();
} else { } else {
Log("SigInt handler called before g_game exists."); Log("SigInt handler called before g_logic exists.");
} }
} }
#endif #endif

View File

@ -7,11 +7,11 @@
#include "ballistica/app/stress_test.h" #include "ballistica/app/stress_test.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/dynamics/bg/bg_dynamics.h" #include "ballistica/dynamics/bg/bg_dynamics.h"
#include "ballistica/game/game.h"
#include "ballistica/graphics/gl/gl_sys.h" #include "ballistica/graphics/gl/gl_sys.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/input/device/joystick.h" #include "ballistica/input/device/joystick.h"
#include "ballistica/input/input.h" #include "ballistica/input/input.h"
#include "ballistica/logic/logic.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
@ -155,7 +155,7 @@ void SDLApp::HandleSDLEvent(const SDL_Event& event) {
#endif #endif
case SDL_QUIT: case SDL_QUIT:
g_game->PushShutdownCall(false); g_logic->PushShutdownCall(false);
break; break;
#if BA_OSTYPE_MACOS && BA_XCODE_BUILD && !BA_HEADLESS_BUILD #if BA_OSTYPE_MACOS && BA_XCODE_BUILD && !BA_HEADLESS_BUILD

View File

@ -8,7 +8,7 @@
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
namespace ballistica { namespace ballistica {
@ -32,7 +32,7 @@ auto StdioConsole::OnAppStart() -> void {
// We send this to the logic thread so it happens AFTER the // We send this to the logic thread so it happens AFTER the
// results of the last script-command message we may have just sent. // results of the last script-command message we may have just sent.
if (stdin_is_terminal) { if (stdin_is_terminal) {
g_game->thread()->PushCall([] { g_logic->thread()->PushCall([] {
if (!g_app->shutting_down) { if (!g_app->shutting_down) {
printf(">>> "); printf(">>> ");
fflush(stdout); fflush(stdout);
@ -53,7 +53,7 @@ auto StdioConsole::OnAppStart() -> void {
&& pending_input_[pending_input_.size() - 1] == '\n') { && pending_input_[pending_input_.size() - 1] == '\n') {
// Get rid of the last newline and ship it to the game. // Get rid of the last newline and ship it to the game.
pending_input_.pop_back(); pending_input_.pop_back();
g_game->PushStdinScriptCommand(pending_input_); g_logic->PushStdinScriptCommand(pending_input_);
pending_input_.clear(); pending_input_.clear();
} }
} else { } else {

View File

@ -32,7 +32,7 @@
#pragma comment(lib, "SDL2main.lib") #pragma comment(lib, "SDL2main.lib")
#endif #endif
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/networking/networking_sys.h" #include "ballistica/networking/networking_sys.h"
#include "ballistica/platform/min_sdl.h" #include "ballistica/platform/min_sdl.h"
@ -108,10 +108,10 @@ PlatformWindows::PlatformWindows() {
BOOL WINAPI CtrlHandler(DWORD fdwCtrlType) { BOOL WINAPI CtrlHandler(DWORD fdwCtrlType) {
switch (fdwCtrlType) { switch (fdwCtrlType) {
case CTRL_C_EVENT: case CTRL_C_EVENT:
if (g_game) { if (g_logic) {
g_game->PushInterruptSignalCall(); g_logic->PushInterruptSignalCall();
} else { } else {
Log("SigInt handler called before g_game exists."); Log("SigInt handler called before g_logic exists.");
} }
return TRUE; return TRUE;

View File

@ -3,10 +3,10 @@
#include "ballistica/python/class/python_class_activity_data.h" #include "ballistica/python/class/python_class_activity_data.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h"
#include "ballistica/game/host_activity.h"
#include "ballistica/game/session/host_session.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/logic/host_activity.h"
#include "ballistica/logic/logic.h"
#include "ballistica/logic/session/host_session.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
namespace ballistica { namespace ballistica {
@ -85,7 +85,7 @@ void PythonClassActivityData::tp_dealloc(PythonClassActivityData* self) {
// it if need be; otherwise do it immediately. // it if need be; otherwise do it immediately.
if (!InLogicThread()) { if (!InLogicThread()) {
Object::WeakRef<HostActivity>* h = self->host_activity_; Object::WeakRef<HostActivity>* h = self->host_activity_;
g_game->thread()->PushCall([h] { delete h; }); g_logic->thread()->PushCall([h] { delete h; });
} else { } else {
delete self->host_activity_; delete self->host_activity_;
} }

View File

@ -4,7 +4,7 @@
#include "ballistica/assets/component/collide_model.h" #include "ballistica/assets/component/collide_model.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
namespace ballistica { namespace ballistica {
@ -105,7 +105,7 @@ void PythonClassCollideModel::tp_dealloc(PythonClassCollideModel* self) {
// be; otherwise do it immediately // be; otherwise do it immediately
if (!InLogicThread()) { if (!InLogicThread()) {
Object::Ref<CollideModel>* c = self->collide_model_; Object::Ref<CollideModel>* c = self->collide_model_;
g_game->thread()->PushCall([c] { Delete(c); }); g_logic->thread()->PushCall([c] { Delete(c); });
} else { } else {
Delete(self->collide_model_); Delete(self->collide_model_);
} }

View File

@ -3,9 +3,9 @@
#include "ballistica/python/class/python_class_context.h" #include "ballistica/python/class/python_class_context.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h" #include "ballistica/logic/host_activity.h"
#include "ballistica/game/host_activity.h" #include "ballistica/logic/logic.h"
#include "ballistica/game/session/host_session.h" #include "ballistica/logic/session/host_session.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/ui/ui.h" #include "ballistica/ui/ui.h"
@ -145,11 +145,11 @@ auto PythonClassContext::tp_new(PyTypeObject* type, PyObject* args,
if (Python::IsPyString(source_obj)) { if (Python::IsPyString(source_obj)) {
std::string source = Python::GetPyString(source_obj); std::string source = Python::GetPyString(source_obj);
if (source == "ui") { if (source == "ui") {
cs = Context(g_game->GetUIContextTarget()); cs = Context(g_logic->GetUIContextTarget());
} else if (source == "UI") { } else if (source == "UI") {
BA_LOG_ONCE("'UI' context-target option is deprecated; please use 'ui'"); BA_LOG_ONCE("'UI' context-target option is deprecated; please use 'ui'");
Python::PrintStackTrace(); Python::PrintStackTrace();
cs = Context(g_game->GetUIContextTarget()); cs = Context(g_logic->GetUIContextTarget());
} else if (source == "current") { } else if (source == "current") {
cs = Context::current(); cs = Context::current();
} else if (source == "empty") { } else if (source == "empty") {
@ -188,7 +188,7 @@ void PythonClassContext::tp_dealloc(PythonClassContext* self) {
if (!InLogicThread()) { if (!InLogicThread()) {
Context* c = self->context_; Context* c = self->context_;
Context* c2 = self->context_prev_; Context* c2 = self->context_prev_;
g_game->thread()->PushCall([c, c2] { g_logic->thread()->PushCall([c, c2] {
delete c; delete c;
delete c2; delete c2;
}); });

View File

@ -3,7 +3,7 @@
#include "ballistica/python/class/python_class_context_call.h" #include "ballistica/python/class/python_class_context_call.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_context_call.h" #include "ballistica/python/python_context_call.h"
@ -119,7 +119,7 @@ void PythonClassContextCall::tp_dealloc(PythonClassContextCall* self) {
// be; otherwise do it immediately // be; otherwise do it immediately
if (!InLogicThread()) { if (!InLogicThread()) {
Object::Ref<PythonContextCall>* c = self->context_call_; Object::Ref<PythonContextCall>* c = self->context_call_;
g_game->thread()->PushCall([c] { delete c; }); g_logic->thread()->PushCall([c] { delete c; });
} else { } else {
delete self->context_call_; delete self->context_call_;
} }

View File

@ -4,7 +4,7 @@
#include "ballistica/assets/component/data.h" #include "ballistica/assets/component/data.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
namespace ballistica { namespace ballistica {
@ -102,7 +102,7 @@ void PythonClassData::tp_dealloc(PythonClassData* self) {
// be; otherwise do it immediately // be; otherwise do it immediately
if (!InLogicThread()) { if (!InLogicThread()) {
Object::Ref<Data>* s = self->data_; Object::Ref<Data>* s = self->data_;
g_game->thread()->PushCall([s] { Delete(s); }); g_logic->thread()->PushCall([s] { Delete(s); });
} else { } else {
Delete(self->data_); Delete(self->data_);
} }

View File

@ -3,8 +3,8 @@
#include "ballistica/python/class/python_class_input_device.h" #include "ballistica/python/class/python_class_input_device.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/player.h"
#include "ballistica/input/device/input_device.h" #include "ballistica/input/device/input_device.h"
#include "ballistica/logic/player.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
namespace ballistica { namespace ballistica {
@ -143,7 +143,7 @@ void PythonClassInputDevice::tp_dealloc(PythonClassInputDevice* self) {
// until the delete goes through; could that ever be a problem? // until the delete goes through; could that ever be a problem?
if (!InLogicThread()) { if (!InLogicThread()) {
Object::WeakRef<InputDevice>* d = self->input_device_; Object::WeakRef<InputDevice>* d = self->input_device_;
g_game->thread()->PushCall([d] { delete d; }); g_logic->thread()->PushCall([d] { delete d; });
} else { } else {
delete self->input_device_; delete self->input_device_;
} }

View File

@ -15,8 +15,8 @@
#include "ballistica/dynamics/material/roll_sound_material_action.h" #include "ballistica/dynamics/material/roll_sound_material_action.h"
#include "ballistica/dynamics/material/skid_sound_material_action.h" #include "ballistica/dynamics/material/skid_sound_material_action.h"
#include "ballistica/dynamics/material/sound_material_action.h" #include "ballistica/dynamics/material/sound_material_action.h"
#include "ballistica/game/game.h" #include "ballistica/logic/host_activity.h"
#include "ballistica/game/host_activity.h" #include "ballistica/logic/logic.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
namespace ballistica { namespace ballistica {
@ -148,7 +148,7 @@ void PythonClassMaterial::tp_dealloc(PythonClassMaterial* self) {
// need be.. otherwise do it immediately. // need be.. otherwise do it immediately.
if (!InLogicThread()) { if (!InLogicThread()) {
Object::Ref<Material>* ptr = self->material_; Object::Ref<Material>* ptr = self->material_;
g_game->thread()->PushCall([ptr] { Delete(ptr); }); g_logic->thread()->PushCall([ptr] { Delete(ptr); });
} else { } else {
Delete(self->material_); Delete(self->material_);
} }

View File

@ -4,7 +4,7 @@
#include "ballistica/assets/component/model.h" #include "ballistica/assets/component/model.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
namespace ballistica { namespace ballistica {
@ -103,7 +103,7 @@ void PythonClassModel::tp_dealloc(PythonClassModel* self) {
// be; otherwise do it immediately // be; otherwise do it immediately
if (!InLogicThread()) { if (!InLogicThread()) {
Object::Ref<Model>* m = self->model_; Object::Ref<Model>* m = self->model_;
g_game->thread()->PushCall([m] { Delete(m); }); g_logic->thread()->PushCall([m] { Delete(m); });
} else { } else {
Delete(self->model_); Delete(self->model_);
} }

View File

@ -114,7 +114,7 @@ void PythonClassNode::tp_dealloc(PythonClassNode* self) {
// be; otherwise do it immediately. // be; otherwise do it immediately.
if (!InLogicThread()) { if (!InLogicThread()) {
Object::WeakRef<Node>* n = self->node_; Object::WeakRef<Node>* n = self->node_;
g_game->thread()->PushCall([n] { delete n; }); g_logic->thread()->PushCall([n] { delete n; });
} else { } else {
delete self->node_; delete self->node_;
} }

View File

@ -3,9 +3,9 @@
#include "ballistica/python/class/python_class_session_data.h" #include "ballistica/python/class/python_class_session_data.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h"
#include "ballistica/game/session/session.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/logic/logic.h"
#include "ballistica/logic/session/session.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
namespace ballistica { namespace ballistica {
@ -83,7 +83,7 @@ void PythonClassSessionData::tp_dealloc(PythonClassSessionData* self) {
// until the delete goes through; could that ever be a problem? // until the delete goes through; could that ever be a problem?
if (!InLogicThread()) { if (!InLogicThread()) {
Object::WeakRef<Session>* s = self->session_; Object::WeakRef<Session>* s = self->session_;
g_game->thread()->PushCall([s] { delete s; }); g_logic->thread()->PushCall([s] { delete s; });
} else { } else {
delete self->session_; delete self->session_;
} }

View File

@ -3,10 +3,10 @@
#include "ballistica/python/class/python_class_session_player.h" #include "ballistica/python/class/python_class_session_player.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/host_activity.h"
#include "ballistica/game/player.h"
#include "ballistica/game/session/host_session.h"
#include "ballistica/input/device/input_device.h" #include "ballistica/input/device/input_device.h"
#include "ballistica/logic/host_activity.h"
#include "ballistica/logic/player.h"
#include "ballistica/logic/session/host_session.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
namespace ballistica { namespace ballistica {
@ -188,7 +188,7 @@ void PythonClassSessionPlayer::tp_dealloc(PythonClassSessionPlayer* self) {
// be; otherwise do it immediately. // be; otherwise do it immediately.
if (!InLogicThread()) { if (!InLogicThread()) {
Object::WeakRef<Player>* p = self->player_; Object::WeakRef<Player>* p = self->player_;
g_game->thread()->PushCall([p] { delete p; }); g_logic->thread()->PushCall([p] { delete p; });
} else { } else {
delete self->player_; delete self->player_;
} }

View File

@ -4,7 +4,7 @@
#include "ballistica/assets/component/sound.h" #include "ballistica/assets/component/sound.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
namespace ballistica { namespace ballistica {
@ -102,7 +102,7 @@ void PythonClassSound::tp_dealloc(PythonClassSound* self) {
// be; otherwise do it immediately // be; otherwise do it immediately
if (!InLogicThread()) { if (!InLogicThread()) {
Object::Ref<Sound>* s = self->sound_; Object::Ref<Sound>* s = self->sound_;
g_game->thread()->PushCall([s] { Delete(s); }); g_logic->thread()->PushCall([s] { Delete(s); });
} else { } else {
Delete(self->sound_); Delete(self->sound_);
} }

View File

@ -4,7 +4,7 @@
#include "ballistica/assets/component/texture.h" #include "ballistica/assets/component/texture.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
namespace ballistica { namespace ballistica {
@ -95,7 +95,7 @@ void PythonClassTexture::tp_dealloc(PythonClassTexture* self) {
// be; otherwise do it immediately. // be; otherwise do it immediately.
if (!InLogicThread()) { if (!InLogicThread()) {
Object::Ref<Texture>* t = self->texture_; Object::Ref<Texture>* t = self->texture_;
g_game->thread()->PushCall([t] { Delete(t); }); g_logic->thread()->PushCall([t] { Delete(t); });
} else { } else {
Delete(self->texture_); Delete(self->texture_);
} }

View File

@ -3,7 +3,7 @@
#include "ballistica/python/class/python_class_timer.h" #include "ballistica/python/class/python_class_timer.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h" #include "ballistica/logic/logic.h"
#include "ballistica/python/python_context_call_runnable.h" #include "ballistica/python/python_context_call_runnable.h"
namespace ballistica { namespace ballistica {
@ -167,7 +167,7 @@ void PythonClassTimer::tp_dealloc(PythonClassTimer* self) {
auto a1 = self->time_type_; auto a1 = self->time_type_;
auto a2 = self->timer_id_; auto a2 = self->timer_id_;
auto a3 = self->context_; auto a3 = self->context_;
g_game->thread()->PushCall( g_logic->thread()->PushCall(
[a0, a1, a2, a3] { PythonClassTimer::DoDelete(a0, a1, a2, a3); }); [a0, a1, a2, a3] { PythonClassTimer::DoDelete(a0, a1, a2, a3); });
} else { } else {
DoDelete(self->have_timer_, self->time_type_, self->timer_id_, DoDelete(self->have_timer_, self->time_type_, self->timer_id_,

View File

@ -3,9 +3,9 @@
#include "ballistica/python/class/python_class_widget.h" #include "ballistica/python/class/python_class_widget.h"
#include "ballistica/core/thread.h" #include "ballistica/core/thread.h"
#include "ballistica/game/game.h"
#include "ballistica/generic/utils.h" #include "ballistica/generic/utils.h"
#include "ballistica/graphics/graphics.h" #include "ballistica/graphics/graphics.h"
#include "ballistica/logic/logic.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/ui/widget/container_widget.h" #include "ballistica/ui/widget/container_widget.h"
@ -93,7 +93,7 @@ void PythonClassWidget::tp_dealloc(PythonClassWidget* self) {
// need be // need be
if (!InLogicThread()) { if (!InLogicThread()) {
Object::WeakRef<Widget>* w = self->widget_; Object::WeakRef<Widget>* w = self->widget_;
g_game->thread()->PushCall([w] { delete w; }); g_logic->thread()->PushCall([w] { delete w; });
} else { } else {
delete self->widget_; delete self->widget_;
} }

View File

@ -6,11 +6,11 @@
#include "ballistica/app/app_flavor.h" #include "ballistica/app/app_flavor.h"
#include "ballistica/assets/component/texture.h" #include "ballistica/assets/component/texture.h"
#include "ballistica/core/logging.h" #include "ballistica/core/logging.h"
#include "ballistica/game/connection/connection_set.h"
#include "ballistica/game/host_activity.h"
#include "ballistica/game/session/host_session.h"
#include "ballistica/game/session/replay_client_session.h"
#include "ballistica/graphics/graphics.h" #include "ballistica/graphics/graphics.h"
#include "ballistica/logic/connection/connection_set.h"
#include "ballistica/logic/host_activity.h"
#include "ballistica/logic/session/host_session.h"
#include "ballistica/logic/session/replay_client_session.h"
#include "ballistica/python/class/python_class_activity_data.h" #include "ballistica/python/class/python_class_activity_data.h"
#include "ballistica/python/class/python_class_session_data.h" #include "ballistica/python/class/python_class_session_data.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
@ -107,7 +107,7 @@ auto PyNewHostSession(PyObject* self, PyObject* args, PyObject* keywds)
PyExcType::kValue); PyExcType::kValue);
} }
} }
g_game->LaunchHostSession(sessiontype_obj, benchmark_type); g_logic->LaunchHostSession(sessiontype_obj, benchmark_type);
Py_RETURN_NONE; Py_RETURN_NONE;
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
} }
@ -123,7 +123,7 @@ auto PyNewReplaySession(PyObject* self, PyObject* args, PyObject* keywds)
return nullptr; return nullptr;
} }
file_name = Python::GetPyString(file_name_obj); file_name = Python::GetPyString(file_name_obj);
g_game->LaunchReplaySession(file_name); g_logic->LaunchReplaySession(file_name);
Py_RETURN_NONE; Py_RETURN_NONE;
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
} }
@ -137,7 +137,7 @@ auto PyIsInReplay(PyObject* self, PyObject* args, PyObject* keywds)
const_cast<char**>(kwlist))) { const_cast<char**>(kwlist))) {
return nullptr; return nullptr;
} }
if (dynamic_cast<ReplayClientSession*>(g_game->GetForegroundSession())) { if (dynamic_cast<ReplayClientSession*>(g_logic->GetForegroundSession())) {
Py_RETURN_TRUE; Py_RETURN_TRUE;
} else { } else {
Py_RETURN_FALSE; Py_RETURN_FALSE;
@ -199,7 +199,7 @@ auto PyGetForegroundHostSession(PyObject* self, PyObject* args,
// Note: we return None if not in the game thread. // Note: we return None if not in the game thread.
HostSession* s = InLogicThread() HostSession* s = InLogicThread()
? g_game->GetForegroundContext().GetHostSession() ? g_logic->GetForegroundContext().GetHostSession()
: nullptr; : nullptr;
if (s != nullptr) { if (s != nullptr) {
PyObject* obj = s->GetSessionPyObj(); PyObject* obj = s->GetSessionPyObj();
@ -303,12 +303,12 @@ auto PyPushCall(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
// just increment the python object's refcount and pass it along raw; // just increment the python object's refcount and pass it along raw;
// the game thread decrements it on the other end. // the game thread decrements it on the other end.
Py_INCREF(call_obj); Py_INCREF(call_obj);
g_game->PushPythonRawCallable(call_obj); g_logic->PushPythonRawCallable(call_obj);
} else { } else {
if (!InLogicThread()) { if (!InLogicThread()) {
throw Exception("You must use from_other_thread mode."); throw Exception("You must use from_other_thread mode.");
} }
g_game->PushPythonCall(Object::New<PythonContextCall>(call_obj)); g_logic->PushPythonCall(Object::New<PythonContextCall>(call_obj));
} }
Py_RETURN_NONE; Py_RETURN_NONE;
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
@ -483,11 +483,11 @@ auto PyScreenMessage(PyObject* self, PyObject* args, PyObject* keywds)
std::vector<int32_t> client_ids; std::vector<int32_t> client_ids;
if (clients_obj != Py_None) { if (clients_obj != Py_None) {
std::vector<int> client_ids2 = Python::GetPyInts(clients_obj); std::vector<int> client_ids2 = Python::GetPyInts(clients_obj);
g_game->connections()->SendScreenMessageToSpecificClients( g_logic->connections()->SendScreenMessageToSpecificClients(
message, color.x, color.y, color.z, client_ids2); message, color.x, color.y, color.z, client_ids2);
} else { } else {
g_game->connections()->SendScreenMessageToAll(message, color.x, color.y, g_logic->connections()->SendScreenMessageToAll(message, color.x, color.y,
color.z); color.z);
} }
} else { } else {
// Currently specifying client_ids only works for transient messages; we'd // Currently specifying client_ids only works for transient messages; we'd
@ -610,7 +610,7 @@ auto PyQuit(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
} }
} }
if (!handled) { if (!handled) {
g_game->PushShutdownCall(false); g_logic->PushShutdownCall(false);
} }
Py_RETURN_NONE; Py_RETURN_NONE;
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
@ -630,7 +630,7 @@ auto PyApplyConfig(PyObject* self, PyObject* args) -> PyObject* {
// Hmm; python runs in the game thread; technically we could just run // Hmm; python runs in the game thread; technically we could just run
// ApplyConfig() immediately (though pushing is probably safer). // ApplyConfig() immediately (though pushing is probably safer).
g_game->PushApplyConfigCall(); g_logic->PushApplyConfigCall();
Py_RETURN_NONE; Py_RETURN_NONE;
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
} }

View File

@ -12,8 +12,8 @@
#include "ballistica/assets/component/model.h" #include "ballistica/assets/component/model.h"
#include "ballistica/assets/component/sound.h" #include "ballistica/assets/component/sound.h"
#include "ballistica/assets/component/texture.h" #include "ballistica/assets/component/texture.h"
#include "ballistica/game/host_activity.h"
#include "ballistica/graphics/graphics_server.h" #include "ballistica/graphics/graphics_server.h"
#include "ballistica/logic/host_activity.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_sys.h" #include "ballistica/python/python_sys.h"
#include "ballistica/ui/ui.h" #include "ballistica/ui/ui.h"

View File

@ -10,13 +10,13 @@
#include "ballistica/dynamics/collision.h" #include "ballistica/dynamics/collision.h"
#include "ballistica/dynamics/dynamics.h" #include "ballistica/dynamics/dynamics.h"
#include "ballistica/dynamics/material/material_action.h" #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/host_activity.h"
#include "ballistica/generic/json.h" #include "ballistica/generic/json.h"
#include "ballistica/graphics/graphics.h" #include "ballistica/graphics/graphics.h"
#include "ballistica/input/device/input_device.h" #include "ballistica/input/device/input_device.h"
#include "ballistica/internal/app_internal.h" #include "ballistica/internal/app_internal.h"
#include "ballistica/logic/connection/connection_set.h"
#include "ballistica/logic/connection/connection_to_client.h"
#include "ballistica/logic/host_activity.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_context_call_runnable.h" #include "ballistica/python/python_context_call_runnable.h"
@ -45,7 +45,7 @@ auto PyNewNode(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
auto PyPrintNodes(PyObject* self, PyObject* args) -> PyObject* { auto PyPrintNodes(PyObject* self, PyObject* args) -> PyObject* {
BA_PYTHON_TRY; BA_PYTHON_TRY;
HostActivity* host_activity = HostActivity* host_activity =
g_game->GetForegroundContext().GetHostActivity(); g_logic->GetForegroundContext().GetHostActivity();
if (!host_activity) { if (!host_activity) {
throw Exception(PyExcType::kContext); throw Exception(PyExcType::kContext);
} }
@ -383,7 +383,7 @@ auto PyGetForegroundHostActivity(PyObject* self, PyObject* args,
// Note: we return None if not in the game thread. // Note: we return None if not in the game thread.
HostActivity* h = InLogicThread() HostActivity* h = InLogicThread()
? g_game->GetForegroundContext().GetHostActivity() ? g_logic->GetForegroundContext().GetHostActivity()
: nullptr; : nullptr;
if (h != nullptr) { if (h != nullptr) {
PyObject* obj = h->GetPyActivity(); PyObject* obj = h->GetPyActivity();
@ -404,7 +404,7 @@ auto PyGetGameRoster(PyObject* self, PyObject* args, PyObject* keywds)
return nullptr; return nullptr;
} }
PythonRef py_client_list(PyList_New(0), PythonRef::kSteal); PythonRef py_client_list(PyList_New(0), PythonRef::kSteal);
cJSON* party = g_game->game_roster(); cJSON* party = g_logic->game_roster();
assert(party); assert(party);
int len = cJSON_GetArraySize(party); int len = cJSON_GetArraySize(party);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
@ -458,8 +458,8 @@ auto PyGetGameRoster(PyObject* self, PyObject* args, PyObject* keywds)
account_id = g_app_internal->GetPublicV1AccountID(); account_id = g_app_internal->GetPublicV1AccountID();
} else { } else {
auto client2 = auto client2 =
g_game->connections()->connections_to_clients().find(clientid); g_logic->connections()->connections_to_clients().find(clientid);
if (client2 != g_game->connections()->connections_to_clients().end()) { if (client2 != g_logic->connections()->connections_to_clients().end()) {
account_id = client2->second->peer_public_account_id(); account_id = client2->second->peer_public_account_id();
} }
} }
@ -500,7 +500,7 @@ auto PySetDebugSpeedExponent(PyObject* self, PyObject* args) -> PyObject* {
throw Exception(PyExcType::kContext); throw Exception(PyExcType::kContext);
} }
#if BA_DEBUG_BUILD #if BA_DEBUG_BUILD
g_game->SetDebugSpeedExponent(speed); g_logic->SetDebugSpeedExponent(speed);
#else #else
throw Exception("This call only functions in the debug build."); throw Exception("This call only functions in the debug build.");
#endif #endif
@ -510,8 +510,8 @@ auto PySetDebugSpeedExponent(PyObject* self, PyObject* args) -> PyObject* {
auto PyGetReplaySpeedExponent(PyObject* self, PyObject* args) -> PyObject* { auto PyGetReplaySpeedExponent(PyObject* self, PyObject* args) -> PyObject* {
BA_PYTHON_TRY; BA_PYTHON_TRY;
assert(g_game); assert(g_logic);
return PyLong_FromLong(g_game->replay_speed_exponent()); return PyLong_FromLong(g_logic->replay_speed_exponent());
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
} }
@ -519,8 +519,8 @@ auto PySetReplaySpeedExponent(PyObject* self, PyObject* args) -> PyObject* {
BA_PYTHON_TRY; BA_PYTHON_TRY;
int speed; int speed;
if (!PyArg_ParseTuple(args, "i", &speed)) return nullptr; if (!PyArg_ParseTuple(args, "i", &speed)) return nullptr;
assert(g_game); assert(g_logic);
g_game->SetReplaySpeedExponent(speed); g_logic->SetReplaySpeedExponent(speed);
Py_RETURN_NONE; Py_RETURN_NONE;
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
} }
@ -533,8 +533,8 @@ auto PyResetGameActivityTracking(PyObject* self, PyObject* args,
const_cast<char**>(kwlist))) { const_cast<char**>(kwlist))) {
return nullptr; return nullptr;
} }
if (g_game) { if (g_logic) {
g_game->ResetActivityTracking(); g_logic->ResetActivityTracking();
} }
Py_RETURN_NONE; Py_RETURN_NONE;
BA_PYTHON_CATCH; BA_PYTHON_CATCH;

View File

@ -2,10 +2,10 @@
#include "ballistica/python/methods/python_methods_graphics.h" #include "ballistica/python/methods/python_methods_graphics.h"
#include "ballistica/game/game.h"
#include "ballistica/graphics/camera.h" #include "ballistica/graphics/camera.h"
#include "ballistica/graphics/graphics.h" #include "ballistica/graphics/graphics.h"
#include "ballistica/graphics/text/text_graphics.h" #include "ballistica/graphics/text/text_graphics.h"
#include "ballistica/logic/logic.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_context_call_runnable.h" #include "ballistica/python/python_context_call_runnable.h"
@ -52,7 +52,7 @@ auto PySetCameraPosition(PyObject* self, PyObject* args, PyObject* keywds)
const_cast<char**>(kwlist), &x, &y, &z)) { const_cast<char**>(kwlist), &x, &y, &z)) {
return nullptr; return nullptr;
} }
assert(g_game); assert(g_logic);
g_graphics->camera()->SetPosition(x, y, z); g_graphics->camera()->SetPosition(x, y, z);
Py_RETURN_NONE; Py_RETURN_NONE;
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
@ -69,7 +69,7 @@ auto PySetCameraTarget(PyObject* self, PyObject* args, PyObject* keywds)
const_cast<char**>(kwlist), &x, &y, &z)) { const_cast<char**>(kwlist), &x, &y, &z)) {
return nullptr; return nullptr;
} }
assert(g_game); assert(g_logic);
g_graphics->camera()->SetTarget(x, y, z); g_graphics->camera()->SetTarget(x, y, z);
Py_RETURN_NONE; Py_RETURN_NONE;
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
@ -84,7 +84,7 @@ auto PySetCameraManual(PyObject* self, PyObject* args, PyObject* keywds)
const_cast<char**>(kwlist), &value)) { const_cast<char**>(kwlist), &value)) {
return nullptr; return nullptr;
} }
assert(g_game); assert(g_logic);
g_graphics->camera()->SetManual(value); g_graphics->camera()->SetManual(value);
Py_RETURN_NONE; Py_RETURN_NONE;
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
@ -98,10 +98,10 @@ auto PyCharStr(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
const_cast<char**>(kwlist), &name_obj)) { const_cast<char**>(kwlist), &name_obj)) {
return nullptr; return nullptr;
} }
assert(g_game); assert(g_logic);
auto id(Python::GetPyEnum_SpecialChar(name_obj)); auto id(Python::GetPyEnum_SpecialChar(name_obj));
assert(Utils::IsValidUTF8(g_game->CharStr(id))); assert(Utils::IsValidUTF8(g_logic->CharStr(id)));
return PyUnicode_FromString(g_game->CharStr(id).c_str()); return PyUnicode_FromString(g_logic->CharStr(id).c_str());
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
} }
@ -164,7 +164,7 @@ auto PyEvaluateLstr(PyObject* self, PyObject* args, PyObject* keywds)
return nullptr; return nullptr;
} }
return PyUnicode_FromString( return PyUnicode_FromString(
g_game->CompileResourceString(value, "evaluate_lstr").c_str()); g_logic->CompileResourceString(value, "evaluate_lstr").c_str());
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
} }
@ -188,7 +188,7 @@ auto PyGetStringHeight(PyObject* self, PyObject* args, PyObject* keywds)
} }
s = Python::GetPyString(s_obj); s = Python::GetPyString(s_obj);
#if BA_DEBUG_BUILD #if BA_DEBUG_BUILD
if (g_game->CompileResourceString(s, "get_string_height test") != s) { if (g_logic->CompileResourceString(s, "get_string_height test") != s) {
BA_LOG_PYTHON_TRACE( BA_LOG_PYTHON_TRACE(
"resource-string passed to get_string_height; this should be avoided"); "resource-string passed to get_string_height; this should be avoided");
} }
@ -218,7 +218,7 @@ auto PyGetStringWidth(PyObject* self, PyObject* args, PyObject* keywds)
} }
s = Python::GetPyString(s_obj); s = Python::GetPyString(s_obj);
#if BA_DEBUG_BUILD #if BA_DEBUG_BUILD
if (g_game->CompileResourceString(s, "get_string_width debug test") != s) { if (g_logic->CompileResourceString(s, "get_string_width debug test") != s) {
BA_LOG_PYTHON_TRACE( BA_LOG_PYTHON_TRACE(
"resource-string passed to get_string_width; this should be avoided"); "resource-string passed to get_string_width; this should be avoided");
} }

View File

@ -3,10 +3,10 @@
#include "ballistica/python/methods/python_methods_input.h" #include "ballistica/python/methods/python_methods_input.h"
#include "ballistica/app/app.h" #include "ballistica/app/app.h"
#include "ballistica/game/game.h"
#include "ballistica/input/device/input_device.h" #include "ballistica/input/device/input_device.h"
#include "ballistica/input/device/touch_input.h" #include "ballistica/input/device/touch_input.h"
#include "ballistica/input/input.h" #include "ballistica/input/input.h"
#include "ballistica/logic/logic.h"
#include "ballistica/platform/platform.h" #include "ballistica/platform/platform.h"
#include "ballistica/python/python.h" #include "ballistica/python/python.h"
#include "ballistica/python/python_sys.h" #include "ballistica/python/python_sys.h"

Some files were not shown because too many files have changed in this diff Show More