C++ formatting updates

This commit is contained in:
Eric Froemling 2020-10-27 11:36:22 -05:00
parent 752999da85
commit 82c739f727
18 changed files with 67 additions and 54 deletions

View File

@ -3932,24 +3932,24 @@
"assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450",
"assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e",
"assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/5d/5f/7e353ad61a992fd31b1c27918e89",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/61/77/65d2fd041d9f8fea8d7e4733a5ec",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/70/6c/a1111ede41bda66b5c4dda4162cb",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f6/24/3d45f90a537c7f19496b8dd8101c",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/01/b9/a4862fd7ac4b9bc46109bf0f3fb5",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/70/58/4b5840cd26a0853197fa63c39f26",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/93/de/4dc052ed052de5353044adaf3b56",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f9/5c/69ff3f14bb37bd82956088c16872",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/5c/4d/acecaaafada62747b7beb884348b",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/08/81/f3cfc8bb76bc05b0ee53ccd47b67",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/45/9b/635f9392ba5c0561949e519ec8c3",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/5f/f2/4136816295eca8ffefabc60a8b6e",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/57/c4/65b46cdf99edf156347ed3381223",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/24/06/49b1e54e764a57c0c925cd48d71e",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b1/e9/12e2965cd54d3cbc02f795222441",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/94/e8/4b12bc80273d1527e2a8210cf090",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b3/f2/25d7adfb561752522269fe0677e7",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/e4/37/aa7613de3f87a18a5f981f73786a",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/de/7a/54548afb27b6027ff7c10c41838f",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6b/f3/8e66e8bfdc5ca8fbe5b61838c7b8",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a0/af/d65a065f6da183970c71c2f479d7",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/38/bc/dc1d1354f9a81f9e0120a3de63a7",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/da/9a/0c9617ad9d98f912db70b91dfd20",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/53/28/8e4c340f2accc1cf3dfb600a2981",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/80/d2/d1c6766cf07f4c4828bbd5899f79",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/de/49/2cfc34ac856737d903954db5571b",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/17/9a/fa66aafdf31fc9bdd92ce382c619",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/de/7d9c9a2b7bba34c630130ed759c9",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/43/1d/ee9ee9bf897787f0b469853bb426",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/98/d2/7a106e580aa03db5c9f91ccd8bc8",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/38/28/2cbd3a1eeec91e71ff8f4a048d73",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/25/4d/c9b30b84774de5ee5eed1927d6b1"
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/71/59aa912540741d36fca95baf0cdf",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f7/0e/da229849278095b6dcf26432909a",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/58/e2/e78c6993c58dae2a94aa1c36139b",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8b/28/742e9c33d64ceeb5e1ff87da5577"
}

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-10-26 for Ballistica version 1.5.27 build 20227</em></h4>
<h4><em>last updated on 2020-10-27 for Ballistica version 1.5.27 build 20228</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr>

View File

@ -21,7 +21,7 @@
namespace ballistica {
// These are set automatically via script; don't change here.
const int kAppBuildNumber = 20228;
const int kAppBuildNumber = 20229;
const char* kAppVersion = "1.5.27";
// Our standalone globals.

View File

@ -100,7 +100,7 @@ float Utils::precalc_rands_3[kPrecalcRandsCount] = {
0.376926f, 0.508574f, 0.809908f, 0.862359f, 0.863431f, 0.884588f,
0.895885f, 0.391311f, 0.976098f, 0.473118f, 0.286659f, 0.0946781f,
0.402437f, 0.347471f};
#else // USE_BAKED_RANDS
#else // USE_BAKED_RANDS
float Utils::precalc_rands_1[kPrecalcRandsCount];
float Utils::precalc_rands_2[kPrecalcRandsCount];
float Utils::precalc_rands_3[kPrecalcRandsCount];

View File

@ -327,7 +327,7 @@ GLContext::~GLContext() {
if (!IsVRMode()) {
BA_PRECONDITION_LOG(sdl_window_);
}
#else // BA_RIFT_MODE
#else // BA_RIFT_MODE
BA_PRECONDITION_LOG(sdl_window_);
#endif // BA_RIFT_BUILD

View File

@ -178,7 +178,7 @@ class GLContext {
assert(surface_);
return surface_;
}
#endif // BA_SDL2_BUILD
#endif // BA_SDL2_BUILD
private:
#if BA_SDL2_BUILD

View File

@ -408,7 +408,7 @@ void RendererGL::CheckGLExtensions() {
supports_depth_textures_ = true;
#if BA_CARDBOARD_BUILD
g_graphics->SetSupportsHighQualityGraphics(false);
#else // BA_CARDBOARD_BUILD
#else // BA_CARDBOARD_BUILD
g_graphics->SetSupportsHighQualityGraphics(true);
#endif // BA_CARDBOARD_BUILD
} else {
@ -2476,7 +2476,7 @@ class RendererGL::PostProcessProgramGL : public RendererGL::ProgramGL {
return s;
}
#else // msaa bug test
#else // msaa bug test
auto GetVertexCode(int flags) -> std::string {
std::string s;
@ -5879,7 +5879,7 @@ auto RendererGL::GetAutoTextureQuality() -> TextureQuality {
// high
#if BA_OUYA_BUILD
qual = TextureQuality::kHigh;
#else // BA_OUYA_BUILD
#else // BA_OUYA_BUILD
// on android we default to high quality mode if we support ETC2;
// otherwise go with medium
if (g_graphics_server->SupportsTextureCompressionType(
@ -5900,7 +5900,7 @@ auto RendererGL::GetAutoTextureQuality() -> TextureQuality {
qual = TextureQuality::kHigh;
}
}
#else // BA_OSTYPE_ANDROID
#else // BA_OSTYPE_ANDROID
{
// On other platforms (mac,pc,etc) just default to high.
qual = TextureQuality::kHigh;

View File

@ -1283,7 +1283,7 @@ void Graphics::DrawFades(FrameDef* frame_def, millisecs_t real_time) {
c.DrawModel(g_media->GetModel(SystemModelID::kVRFade));
c.PopTransform();
c.Submit();
#else // BA_VR_BUILD
#else // BA_VR_BUILD
throw Exception();
#endif // BA_VR_BUILD
} else {

View File

@ -539,7 +539,7 @@ void GraphicsServer::HandleFullscreenToggling(bool do_set_existing_fs,
#if BA_OSTYPE_IOS_TVOS
set_fullscreen_enabled(true);
#else // BA_OSTYPE_IOS_TVOS
#else // BA_OSTYPE_IOS_TVOS
uint32_t fullscreen_flag = SDL_WINDOW_FULLSCREEN_DESKTOP;
SDL_SetWindowFullscreen(gl_context_->sdl_window(),
fullscreen ? fullscreen_flag : 0);

View File

@ -93,7 +93,7 @@ Joystick::Joystick(int sdl_joystick_id, const std::string& custom_device_name,
is_mac_ps3_controller_ = true;
}
#else // BA_ENABLE_SDL_JOYSTICKS
#else // BA_ENABLE_SDL_JOYSTICKS
throw Exception(); // Shouldn't happen.
#endif // BA_ENABLE_SDL_JOYSTICKS
@ -671,8 +671,9 @@ void Joystick::HandleSDLEvent(const SDL_Event* e) {
e2.jaxis.axis = static_cast_check_fit<uint8_t>(analog_lr_);
dpad_right_held_ = (e->type == SDL_JOYBUTTONDOWN);
e2.jaxis.value = static_cast_check_fit<int16_t>(
dpad_right_held_ ? (dpad_left_held_ ? 0 : 32767)
: dpad_left_held_ ? -32767 : 0);
dpad_right_held_ ? (dpad_left_held_ ? 0 : 32767)
: dpad_left_held_ ? -32767
: 0);
e = &e2;
} else if (e->jbutton.button == left_button_
|| e->jbutton.button == left_button2_) {
@ -680,8 +681,9 @@ void Joystick::HandleSDLEvent(const SDL_Event* e) {
e2.jaxis.axis = static_cast_check_fit<uint8_t>(analog_lr_);
dpad_left_held_ = (e->type == SDL_JOYBUTTONDOWN);
e2.jaxis.value = static_cast_check_fit<int16_t>(
dpad_right_held_ ? (dpad_left_held_ ? 0 : 32767)
: dpad_left_held_ ? -32767 : 0);
dpad_right_held_ ? (dpad_left_held_ ? 0 : 32767)
: dpad_left_held_ ? -32767
: 0);
e = &e2;
} else if (e->jbutton.button == up_button_
|| e->jbutton.button == up_button2_) {
@ -689,8 +691,9 @@ void Joystick::HandleSDLEvent(const SDL_Event* e) {
e2.jaxis.axis = static_cast_check_fit<uint8_t>(analog_ud_);
dpad_up_held_ = (e->type == SDL_JOYBUTTONDOWN);
e2.jaxis.value = static_cast_check_fit<int16_t>(
dpad_up_held_ ? (dpad_down_held_ ? 0 : -32767)
: dpad_down_held_ ? 32767 : 0);
dpad_up_held_ ? (dpad_down_held_ ? 0 : -32767)
: dpad_down_held_ ? 32767
: 0);
e = &e2;
} else if (e->jbutton.button == down_button_
|| e->jbutton.button == down_button2_) {
@ -698,8 +701,9 @@ void Joystick::HandleSDLEvent(const SDL_Event* e) {
e2.jaxis.axis = static_cast_check_fit<uint8_t>(analog_ud_);
dpad_down_held_ = (e->type == SDL_JOYBUTTONDOWN);
e2.jaxis.value = static_cast_check_fit<int16_t>(
dpad_up_held_ ? (dpad_down_held_ ? 0 : -32767)
: dpad_down_held_ ? 32767 : 0);
dpad_up_held_ ? (dpad_down_held_ ? 0 : -32767)
: dpad_down_held_ ? 32767
: 0);
e = &e2;
}
break;

View File

@ -1073,7 +1073,7 @@ auto Media::FindMediaFile(FileType type, const std::string& name)
case FileType::kSound:
#if BA_HEADLESS_BUILD
return "headless_dummy_path.sound";
#else // BA_HEADLESS_BUILD
#else // BA_HEADLESS_BUILD
prefix = "audio/";
ext = ".ogg";
break;
@ -1082,7 +1082,7 @@ auto Media::FindMediaFile(FileType type, const std::string& name)
case FileType::kModel:
#if BA_HEADLESS_BUILD
return "headless_dummy_path.model";
#else // BA_HEADLESS_BUILD
#else // BA_HEADLESS_BUILD
prefix = "models/";
ext = ".bob";
break;

View File

@ -200,7 +200,7 @@ void SDLApp::HandleSDLEvent(const SDL_Event& event) {
case SDL_WINDOWEVENT_SIZE_CHANGED: {
#if BA_OSTYPE_IOS_TVOS
// Do nothing here currently.
#else // Generic SDL:
#else // Generic SDL:
int pixels_x, pixels_y;
SDL_GL_GetDrawableSize(g_graphics_server->gl_context()->sdl_window(),
&pixels_x, &pixels_y);
@ -220,7 +220,7 @@ void SDLApp::HandleSDLEvent(const SDL_Event& event) {
default:
break;
}
#else // BA_SDL2_BUILD
#else // BA_SDL2_BUILD
case SDL_VIDEORESIZE: {
screen_dimensions_ = Vector2f(event.resize.w, event.resize.h);
SetScreenResolution(event.resize.w, event.resize.h);

View File

@ -687,7 +687,7 @@ auto PyAndroidGetExternalStoragePath(PyObject* self, PyObject* args,
assert(Utils::IsValidUTF8(path));
return PyUnicode_FromString(path.c_str());
}
#else // BA_OSTYPE_ANDROID
#else // BA_OSTYPE_ANDROID
throw Exception("Only valid on android.");
#endif // BA_OSTYPE_ANDROID
Py_RETURN_NONE;

View File

@ -212,8 +212,8 @@ void ImageNode::Draw(FrameDef* frame_def) {
}
RenderPass& pass(*(vr_use_fixed ? frame_def->GetOverlayFixedPass()
: front_ ? frame_def->overlay_front_pass()
: frame_def->overlay_pass()));
: front_ ? frame_def->overlay_front_pass()
: frame_def->overlay_pass()));
// If the pass we're drawing into changes dimensions, recalc.
// Otherwise we break if a window is resized.

View File

@ -217,9 +217,9 @@ void TerrainNode::Draw(FrameDef* frame_def) {
if (vr_only_ && !IsVRMode()) {
return;
}
ObjectComponent c(overlay_ ? frame_def->overlay_3d_pass()
: background_ ? frame_def->beauty_pass_bg()
: frame_def->beauty_pass());
ObjectComponent c(overlay_ ? frame_def->overlay_3d_pass()
: background_ ? frame_def->beauty_pass_bg()
: frame_def->beauty_pass());
c.SetWorldSpace(true);
c.SetTexture(color_texture_);
if (lighting_) {

View File

@ -359,11 +359,11 @@ void TextNode::Draw(FrameDef* frame_def) {
// make sure we're up to date
Update();
RenderPass& pass(
*(in_world_ ? frame_def->overlay_3d_pass()
: (vr_use_fixed ? frame_def->GetOverlayFixedPass()
: front_ ? frame_def->overlay_front_pass()
: frame_def->overlay_pass())));
RenderPass& pass(*(in_world_
? frame_def->overlay_3d_pass()
: (vr_use_fixed ? frame_def->GetOverlayFixedPass()
: front_ ? frame_def->overlay_front_pass()
: frame_def->overlay_pass())));
if (big_) {
if (text_group_dirty_) {
TextMesh::HAlign h_align;

View File

@ -127,7 +127,7 @@ auto Console::HandleKeyPress(const SDL_Keysym* keysym) -> bool {
#if BA_SDL2_BUILD || BA_MINSDL_BUILD
// (in SDL2/Non-SDL we dont' get chars from keypress events;
// they come through as text edit events)
#else // BA_SDL2_BUILD
#else // BA_SDL2_BUILD
if (keysym->unicode < 0x80 && keysym->unicode > 0) {
std::vector<uint32_t> unichars =
Utils::UnicodeFromUTF8(input_string_, "cjofrh0");

View File

@ -493,12 +493,21 @@ def checkenv() -> None:
# Make sure they've got curl.
if subprocess.run(['which', 'curl'], check=False,
capture_output=True).returncode != 0:
raise CleanError('curl is required; please install it.')
raise CleanError('curl is required; please install it via apt,'
' brew, etc.')
# Make sure they've got our target python version.
if subprocess.run(['which', PYTHON_BIN], check=False,
capture_output=True).returncode != 0:
raise CleanError(f'{PYTHON_BIN} is required; please install it.')
raise CleanError(f'{PYTHON_BIN} is required; please install it'
'via apt, brew, etc.')
# Make sure they've got clang-format.
if subprocess.run(['which', 'clang-format'],
check=False,
capture_output=True).returncode != 0:
raise CleanError('clang-format is required; please install '
'it via apt, brew, etc.')
# Make sure they've got pip for that python version.
if subprocess.run(f'{PYTHON_BIN} -m pip --version',