beginning bits of scene versioning

This commit is contained in:
Eric 2022-09-12 14:19:23 -07:00
parent 30a29893a1
commit 2a43584d5a
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
15 changed files with 169 additions and 129 deletions

View File

@ -3995,26 +3995,26 @@
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34",
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/eb/f0/36d00e5087e6d76d79672b018cc8",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f2/40/9f3c84455aac48d733b30df6b5b7",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2e/d3/aeacdcc49c0a4954afef6755f560",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/86/b2/80a8128225146f9515ad45c73de1",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ca/59/cbb3fe58cbaabf413340dec12e1a",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/ec/94/076e15d29f647b7eb6b902f37198",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/55/77/07c16135863548bf52cd4cf2b0db",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0c/c0/9ccb23d2b58d57d66dfa95346b32",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ca/13/d71a2a3d204b62ec4cc23a54e384",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c7/f0/f8c0d2e3162111499f60806b29e6",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/66/82/8fdb20a2f00ea4920ec048193f97",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a1/fe/ddc0c3dd421f421494b8e6a0c0cd",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/18/7b/3ccdfcb541be04196f489d8517d6",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/2a/02/d4bb405140bda1c17517717adda8",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/54/74/53d8c3f6b0faa4518dbac71ddff6",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f7/76/1bd98e4b273ef56d9d4051b8e170",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/56/18/d70ca8c1ed2ad1c0d05d082da786",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/00/11/19c14108e432a9dfca5a9ef32ec2",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/a6/34/d209303ed932c0c1fb1c9b480103",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/6b/7b/9f4c160d3d0e6198089898741957",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f2/08/c51a835abdfb830800214b5d4ee2",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/29/86/d7dbef8da1cbf6a2227679baab80",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0a/a1/7fc60dfb937f3aac13386368dc56",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f3/4f/90c63ed7c3ac40a666946d83e61c",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/02/fc/63aaa0249b27e36c5e33391ac301",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d3/ad/5788ce11e94538cea04c48dc3ef0",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/69/12/9dbc452fe20c0f092cf39d50c77f",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f9/33/cf16d5d6c40efbc185a474b9a701",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/10/e6/5c8896149d987ea44b4daf8a6b30",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/2f/46/22652fbf1e6d8644381fa6907fa2",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7a/08/d71c945cffd15214e889af6ae86d",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9c/9f/8fdc621bd6589bf85dad88cb1e7c",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b5/25/f58dd573f8fd0ed2bce92468d2eb",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a2/c8/8abb7f6cf9cca43d4341ba4a0359",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/bc/ed/796ba1a0004b208ac462e7fc022b",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/21/38/dff36d635433f885c46fed606956",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a0/e3/8a438b7be97ea9b5e3a3108014bf",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/f8/8a/33f28e4746adac552e0f65d85b06",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/d0/1b/56a99ad953586b701e238a341d51",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/5e/4c/5082c1b732784f50b30d453bbed9",
"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/fb/47/d505c3feea40888985dd335dc8c4",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4f/3d/20c78e744ac26a13b7418166d675",
@ -4031,14 +4031,14 @@
"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/13/d9/36f4cf8527494f419db74ae6c78f",
"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/f1/e9/a36a2743cc11e888e4d877341724",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/4b/cd/accbffc3bd13d11b4266cad62b44",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/91/c1/fe42b2d9442edffed30f42dbcb1e",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/3b/d3/dc7bf863a0f7a986f8c88024cbe7",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/2b/2a/13183d1ae34b5e46baf5c2cd51eb",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/0d/98/59f17b4afffc44e0fdd7bc3fd6de",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/7e/f0/1946bfea786757842991e01e7749",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/33/68/499d8ceb69645456ee7e25d93a3c",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/9f/5f/8e3d43b1d7c21afc621998c549da",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/33/b5/23da6c12e960e583cb98072ad637",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/43/04/136cab4b0edf4feafae6c279c977",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/95/f7/41e8fe3e7a8ab6786ee5ed4956c2",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/b4/a1/2a5fa558d0bdcc34e6c14b819bea",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/1c/c9/aa2a975716b79c79801d61ecfb54",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/d5/8c/e96d8b68d3c217fa43ce357980df",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/0d/d2/3c11d620c85cc775d284cc9d79c1",
"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"
}

View File

@ -1,4 +1,4 @@
### 1.7.7 (build 20831, api 7, 2022-09-12)
### 1.7.7 (build 20833, 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.
- Improved logging of missing playlist game types.
- Some ba.Lstr functionality can now be used in background threads.

View File

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

View File

@ -637,6 +637,8 @@ add_executable(ballisticacore
${BA_SRC_ROOT}/ballistica/scene/scene.h
${BA_SRC_ROOT}/ballistica/scene/scene_stream.cc
${BA_SRC_ROOT}/ballistica/scene/scene_stream.h
${BA_SRC_ROOT}/ballistica/scene/v1/scene_v1.cc
${BA_SRC_ROOT}/ballistica/scene/v1/scene_v1.h
${BA_SRC_ROOT}/ballistica/ui/console.cc
${BA_SRC_ROOT}/ballistica/ui/console.h
${BA_SRC_ROOT}/ballistica/ui/root_ui.cc

View File

@ -628,6 +628,8 @@
<ClInclude Include="..\..\src\ballistica\scene\scene.h" />
<ClCompile Include="..\..\src\ballistica\scene\scene_stream.cc" />
<ClInclude Include="..\..\src\ballistica\scene\scene_stream.h" />
<ClCompile Include="..\..\src\ballistica\scene\v1\scene_v1.cc" />
<ClInclude Include="..\..\src\ballistica\scene\v1\scene_v1.h" />
<ClCompile Include="..\..\src\ballistica\ui\console.cc" />
<ClInclude Include="..\..\src\ballistica\ui\console.h" />
<ClCompile Include="..\..\src\ballistica\ui\root_ui.cc" />

View File

@ -1318,6 +1318,12 @@
<ClInclude Include="..\..\src\ballistica\scene\scene_stream.h">
<Filter>ballistica\scene</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\scene\v1\scene_v1.cc">
<Filter>ballistica\scene\v1</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\scene\v1\scene_v1.h">
<Filter>ballistica\scene\v1</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\ui\console.cc">
<Filter>ballistica\ui</Filter>
</ClCompile>
@ -1677,6 +1683,7 @@
<Filter Include="ballistica\python\methods" />
<Filter Include="ballistica\scene" />
<Filter Include="ballistica\scene\node" />
<Filter Include="ballistica\scene\v1" />
<Filter Include="ballistica\ui" />
<Filter Include="ballistica\ui\widget" />
<Filter Include="external" />

View File

@ -623,6 +623,8 @@
<ClInclude Include="..\..\src\ballistica\scene\scene.h" />
<ClCompile Include="..\..\src\ballistica\scene\scene_stream.cc" />
<ClInclude Include="..\..\src\ballistica\scene\scene_stream.h" />
<ClCompile Include="..\..\src\ballistica\scene\v1\scene_v1.cc" />
<ClInclude Include="..\..\src\ballistica\scene\v1\scene_v1.h" />
<ClCompile Include="..\..\src\ballistica\ui\console.cc" />
<ClInclude Include="..\..\src\ballistica\ui\console.h" />
<ClCompile Include="..\..\src\ballistica\ui\root_ui.cc" />

View File

@ -1318,6 +1318,12 @@
<ClInclude Include="..\..\src\ballistica\scene\scene_stream.h">
<Filter>ballistica\scene</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\scene\v1\scene_v1.cc">
<Filter>ballistica\scene\v1</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\scene\v1\scene_v1.h">
<Filter>ballistica\scene\v1</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\ui\console.cc">
<Filter>ballistica\ui</Filter>
</ClCompile>
@ -1677,6 +1683,7 @@
<Filter Include="ballistica\python\methods" />
<Filter Include="ballistica\scene" />
<Filter Include="ballistica\scene\node" />
<Filter Include="ballistica\scene\v1" />
<Filter Include="ballistica\ui" />
<Filter Include="ballistica\ui\widget" />
<Filter Include="external" />

View File

@ -10,11 +10,9 @@
#include "ballistica/assets/assets_server.h"
#include "ballistica/audio/audio.h"
#include "ballistica/audio/audio_server.h"
#include "ballistica/core/context.h"
#include "ballistica/core/fatal_error.h"
#include "ballistica/core/logging.h"
#include "ballistica/core/thread.h"
#include "ballistica/dynamics/bg/bg_dynamics.h"
#include "ballistica/dynamics/bg/bg_dynamics_server.h"
#include "ballistica/graphics/graphics_server.h"
#include "ballistica/graphics/text/text_graphics.h"
@ -27,12 +25,13 @@
#include "ballistica/platform/stdio_console.h"
#include "ballistica/python/python.h"
#include "ballistica/scene/scene.h"
#include "ballistica/scene/v1/scene_v1.h"
#include "ballistica/ui/ui.h"
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kAppBuildNumber = 20831;
const int kAppBuildNumber = 20833;
const char* kAppVersion = "1.7.7";
// Our standalone globals.
@ -62,6 +61,7 @@ NetworkReader* g_network_reader{};
NetworkWriter* g_network_writer{};
Platform* g_platform{};
Python* g_python{};
SceneV1* g_scene_v1{};
StdioConsole* g_stdio_console{};
TextGraphics* g_text_graphics{};
UI* g_ui{};
@ -104,7 +104,6 @@ auto BallisticaMain(int argc, char** argv) -> int {
// Create a Thread wrapper around the current (main) thread.
g_main_thread =
new Thread(ThreadIdentifier::kMain, ThreadSource::kWrapMain);
Thread::UpdateMainThreadID();
// Bootstrap our Python environment as early as we can (depends on
// g_platform for locating OS-specific paths).
@ -131,7 +130,7 @@ auto BallisticaMain(int argc, char** argv) -> int {
g_input = new Input();
g_app_internal = CreateAppInternal();
g_logic = new Logic();
Scene::Init();
g_scene_v1 = new SceneV1();
if (!HeadlessMode()) {
g_bg_dynamics = new BGDynamics();
g_bg_dynamics_server = new BGDynamicsServer();
@ -140,7 +139,7 @@ auto BallisticaMain(int argc, char** argv) -> int {
g_stdio_console = new StdioConsole();
}
// Ok at this point we can be considered up-and-running.
// At this point all of our globals should exist.
g_app->is_bootstrapped = true;
// -------------------------------------------------------------------------

View File

@ -125,6 +125,7 @@ extern NetworkReader* g_network_reader;
extern NetworkWriter* g_network_writer;
extern Platform* g_platform;
extern Python* g_python;
extern SceneV1* g_scene_v1;
extern StdioConsole* g_stdio_console;
extern TextGraphics* g_text_graphics;
extern UI* g_ui;

View File

@ -162,6 +162,7 @@ class RootUI;
class RootWidget;
class Runnable;
class Scene;
class SceneV1;
class SceneStream;
class ScoreToBeat;
class SDLApp;

View File

@ -5,107 +5,18 @@
#include "ballistica/app/app.h"
#include "ballistica/assets/component/sound.h"
#include "ballistica/audio/audio.h"
#include "ballistica/dynamics/bg/bg_dynamics.h"
#include "ballistica/dynamics/dynamics.h"
#include "ballistica/dynamics/part.h"
#include "ballistica/graphics/camera.h"
#include "ballistica/graphics/graphics.h"
#include "ballistica/input/device/input_device.h"
#include "ballistica/logic/player.h"
#include "ballistica/networking/networking.h"
#include "ballistica/python/python_context_call.h"
#include "ballistica/scene/node/anim_curve_node.h"
#include "ballistica/scene/node/bomb_node.h"
#include "ballistica/scene/node/combine_node.h"
#include "ballistica/scene/node/explosion_node.h"
#include "ballistica/scene/node/flag_node.h"
#include "ballistica/scene/node/flash_node.h"
#include "ballistica/scene/node/globals_node.h"
#include "ballistica/scene/node/image_node.h"
#include "ballistica/scene/node/light_node.h"
#include "ballistica/scene/node/locator_node.h"
#include "ballistica/scene/node/math_node.h"
#include "ballistica/scene/node/node_attribute_connection.h"
#include "ballistica/scene/node/null_node.h"
#include "ballistica/scene/node/player_node.h"
#include "ballistica/scene/node/region_node.h"
#include "ballistica/scene/node/scorch_node.h"
#include "ballistica/scene/node/session_globals_node.h"
#include "ballistica/scene/node/shield_node.h"
#include "ballistica/scene/node/sound_node.h"
#include "ballistica/scene/node/spaz_node.h"
#include "ballistica/scene/node/terrain_node.h"
#include "ballistica/scene/node/text_node.h"
#include "ballistica/scene/node/texture_sequence_node.h"
#include "ballistica/scene/node/time_display_node.h"
#include "ballistica/scene/scene_stream.h"
namespace ballistica {
void Scene::Init() {
NodeType* node_types[] = {NullNode::InitType(),
GlobalsNode::InitType(),
SessionGlobalsNode::InitType(),
PropNode::InitType(),
FlagNode::InitType(),
BombNode::InitType(),
ExplosionNode::InitType(),
ShieldNode::InitType(),
LightNode::InitType(),
TextNode::InitType(),
AnimCurveNode::InitType(),
ImageNode::InitType(),
TerrainNode::InitType(),
MathNode::InitType(),
LocatorNode::InitType(),
PlayerNode::InitType(),
CombineNode::InitType(),
SoundNode::InitType(),
SpazNode::InitType(),
RegionNode::InitType(),
ScorchNode::InitType(),
FlashNode::InitType(),
TextureSequenceNode::InitType(),
TimeDisplayNode::InitType()};
int next_type_id = 0;
assert(g_app != nullptr);
for (auto* t : node_types) {
g_app->node_types[t->name()] = t;
g_app->node_types_by_id[next_type_id] = t;
t->set_id(next_type_id++);
}
// Types: I is 32 bit int, i is 16 bit int, c is 8 bit int,
// F is 32 bit float, f is 16 bit float,
// s is string, b is bool.
SetupNodeMessageType("flash", NodeMessageType::kFlash, "");
SetupNodeMessageType("footing", NodeMessageType::kFooting, "c");
SetupNodeMessageType("impulse", NodeMessageType::kImpulse, "fffffffffifff");
SetupNodeMessageType("kick_back", NodeMessageType::kKickback, "fffffff");
SetupNodeMessageType("celebrate", NodeMessageType::kCelebrate, "i");
SetupNodeMessageType("celebrate_l", NodeMessageType::kCelebrateL, "i");
SetupNodeMessageType("celebrate_r", NodeMessageType::kCelebrateR, "i");
SetupNodeMessageType("knockout", NodeMessageType::kKnockout, "f");
SetupNodeMessageType("hurt_sound", NodeMessageType::kHurtSound, "");
SetupNodeMessageType("picked_up", NodeMessageType::kPickedUp, "");
SetupNodeMessageType("jump_sound", NodeMessageType::kJumpSound, "");
SetupNodeMessageType("attack_sound", NodeMessageType::kAttackSound, "");
SetupNodeMessageType("scream_sound", NodeMessageType::kScreamSound, "");
SetupNodeMessageType("stand", NodeMessageType::kStand, "ffff");
}
void Scene::SetupNodeMessageType(const std::string& name, NodeMessageType val,
const std::string& format) {
assert(g_app != nullptr);
g_app->node_message_types[name] = val;
assert(static_cast<int>(val) >= 0);
if (g_app->node_message_formats.size() <= static_cast<size_t>(val)) {
g_app->node_message_formats.resize(static_cast<size_t>(val) + 1);
}
g_app->node_message_formats[static_cast<size_t>(val)] = format;
}
auto Scene::GetSceneStream() const -> SceneStream* {
return output_stream_.get();
}

View File

@ -15,7 +15,6 @@ namespace ballistica {
class Scene : public Object {
public:
static auto Init() -> void;
explicit Scene(millisecs_t starttime);
~Scene() override;
auto Step() -> void;
@ -85,9 +84,6 @@ class Scene : public Object {
auto set_globals_node(GlobalsNode* node) -> void { globals_node_ = node; }
private:
static auto SetupNodeMessageType(const std::string& name, NodeMessageType val,
const std::string& format) -> void;
GlobalsNode* globals_node_{}; // Current globals node (if any).
std::unordered_map<int, Object::WeakRef<PlayerNode> > player_nodes_;
int64_t stream_id_{-1};

View File

@ -0,0 +1,96 @@
// Released under the MIT License. See LICENSE for details.
#include "ballistica/scene/v1/scene_v1.h"
#include "ballistica/app/app.h"
#include "ballistica/scene/node/anim_curve_node.h"
#include "ballistica/scene/node/bomb_node.h"
#include "ballistica/scene/node/combine_node.h"
#include "ballistica/scene/node/explosion_node.h"
#include "ballistica/scene/node/flag_node.h"
#include "ballistica/scene/node/flash_node.h"
#include "ballistica/scene/node/globals_node.h"
#include "ballistica/scene/node/image_node.h"
#include "ballistica/scene/node/light_node.h"
#include "ballistica/scene/node/locator_node.h"
#include "ballistica/scene/node/math_node.h"
#include "ballistica/scene/node/null_node.h"
#include "ballistica/scene/node/player_node.h"
#include "ballistica/scene/node/region_node.h"
#include "ballistica/scene/node/scorch_node.h"
#include "ballistica/scene/node/session_globals_node.h"
#include "ballistica/scene/node/shield_node.h"
#include "ballistica/scene/node/sound_node.h"
#include "ballistica/scene/node/spaz_node.h"
#include "ballistica/scene/node/terrain_node.h"
#include "ballistica/scene/node/text_node.h"
#include "ballistica/scene/node/texture_sequence_node.h"
#include "ballistica/scene/node/time_display_node.h"
namespace ballistica {
static void SetupNodeMessageType(const std::string& name, NodeMessageType val,
const std::string& format) {
assert(g_app != nullptr);
g_app->node_message_types[name] = val;
assert(static_cast<int>(val) >= 0);
if (g_app->node_message_formats.size() <= static_cast<size_t>(val)) {
g_app->node_message_formats.resize(static_cast<size_t>(val) + 1);
}
g_app->node_message_formats[static_cast<size_t>(val)] = format;
}
SceneV1::SceneV1() {
NodeType* node_types[] = {NullNode::InitType(),
GlobalsNode::InitType(),
SessionGlobalsNode::InitType(),
PropNode::InitType(),
FlagNode::InitType(),
BombNode::InitType(),
ExplosionNode::InitType(),
ShieldNode::InitType(),
LightNode::InitType(),
TextNode::InitType(),
AnimCurveNode::InitType(),
ImageNode::InitType(),
TerrainNode::InitType(),
MathNode::InitType(),
LocatorNode::InitType(),
PlayerNode::InitType(),
CombineNode::InitType(),
SoundNode::InitType(),
SpazNode::InitType(),
RegionNode::InitType(),
ScorchNode::InitType(),
FlashNode::InitType(),
TextureSequenceNode::InitType(),
TimeDisplayNode::InitType()};
int next_type_id = 0;
assert(g_app != nullptr);
for (auto* t : node_types) {
g_app->node_types[t->name()] = t;
g_app->node_types_by_id[next_type_id] = t;
t->set_id(next_type_id++);
}
// Types: I is 32 bit int, i is 16 bit int, c is 8 bit int,
// F is 32 bit float, f is 16 bit float,
// s is string, b is bool.
SetupNodeMessageType("flash", NodeMessageType::kFlash, "");
SetupNodeMessageType("footing", NodeMessageType::kFooting, "c");
SetupNodeMessageType("impulse", NodeMessageType::kImpulse, "fffffffffifff");
SetupNodeMessageType("kick_back", NodeMessageType::kKickback, "fffffff");
SetupNodeMessageType("celebrate", NodeMessageType::kCelebrate, "i");
SetupNodeMessageType("celebrate_l", NodeMessageType::kCelebrateL, "i");
SetupNodeMessageType("celebrate_r", NodeMessageType::kCelebrateR, "i");
SetupNodeMessageType("knockout", NodeMessageType::kKnockout, "f");
SetupNodeMessageType("hurt_sound", NodeMessageType::kHurtSound, "");
SetupNodeMessageType("picked_up", NodeMessageType::kPickedUp, "");
SetupNodeMessageType("jump_sound", NodeMessageType::kJumpSound, "");
SetupNodeMessageType("attack_sound", NodeMessageType::kAttackSound, "");
SetupNodeMessageType("scream_sound", NodeMessageType::kScreamSound, "");
SetupNodeMessageType("stand", NodeMessageType::kStand, "ffff");
}
} // namespace ballistica

View File

@ -0,0 +1,16 @@
// Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_SCENE_V1_SCENE_V1_H_
#define BALLISTICA_SCENE_V1_SCENE_V1_H_
namespace ballistica {
// Overall scene subsystem.
class SceneV1 {
public:
SceneV1();
};
} // namespace ballistica
#endif // BALLISTICA_SCENE_V1_SCENE_V1_H_