internal work

This commit is contained in:
Eric Froemling 2021-04-14 23:37:55 -07:00
parent 6196b9bd4e
commit 39ebaa76a0
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
66 changed files with 556 additions and 362 deletions

View File

@ -3932,40 +3932,40 @@
"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_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/6b/cb/19189b08a2e2fb1eb992ce9409c3",
"build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f7/4d/1fa868632c30ebfacfc38c6b117d",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7d/b8/49192d8bdbb04f541279f1be0e5b",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4c/45/a35cc2aa7d366acf296ff8c1cc9d",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/52/15/30ee7f43e310f28fc45d2cddf572",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/96/0a/2f1783c6132c52b81f52deb32848",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cf/8b/1d445ffa286f7244aad7d1ce5e73",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/67/6d/3cc48fa4a8a782658f3bcb05896a",
"build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f8/25/ba027f4b3cf7b71219da09c21c75",
"build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/3b/f1/de985e1c1353d1b08f32f9f3e3a8",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/50/e8/2dc9822aed07127c510475d4f84c",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/53/a4/7ccb111c3808cdfbc040e3d7ceb4",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/2b/3d/c440f8c0ed420b764b7c8a919c28",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/60/fc/87cfc12a101a1602a10d56590a1c",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5e/53/031857aa1a70492d21941851c4a0",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3f/5e/b45d379238a9c0e8e37f46cf1f0d",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/10/b1/b90ce616c5af2ddb545f56832994",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/cb/fb/dfafe1bde1ad7f7331e1bfc4e63d",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/db/13/bd6517c55cd8e129e17e7f9c2616",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/ea/9d/70f2fe7e9c1101710410763d75bf",
"build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/cb/ed/e47dfe8c0b1ed07fa6e14b15823e",
"build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b0/f5/432df1b69d95c0be2c452109ec80",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/cb/33/49607104f1a4daeff9203ac70279",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/85/5a/95e462b25713e0984d086b9cc4dc",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1d/f6/f812e186bd658a393523e9dcfeab",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/47/50/5cc79eccc31f272b22e535563f4f",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1e/bf/bf4842f01b740ca1430bacc5381e",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d5/92/dac101043f5b24e4e25424b0c471",
"build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6c/52/3ccd81f47f7e02376a3e3ba91b54",
"build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9d/30/9e0c9323ac0c070167595a4b3015",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4f/e6/e838ab1f57c90a2ab541b4524f5d",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d0/18/dbcc2d1e67a5d7887a8ff48759d0",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c8/bb/32515f5226bb06103d2184058dce",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2b/83/ef8718694732f24d733be72286eb",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d9/4e/5706b74a4fc9879e22e7305c81bb",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d3/68/3e284f68dd2d1b9f69b0f6db86c9"
"build/prefab/full/linux_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/cc/c6/de49df32988ff2af73ab9a4c6571",
"build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/95/97/f6a1324ee16fbc9337914ca0bc97",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/bf/f5/1e86cc48dc80b6a45d3093307572",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/06/42/56e114de5a1cd3be38ced2a22e7c",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/03/9e/7b98f72572f805d9724cb2ac02a8",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9c/06/41db5f80a6128bbb92b2800579f6",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cb/d8/8f9d77f8ade2019501c8bcf706e0",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/df/bf/7a286415b507c22b6da1e97ab2b4",
"build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/01/77/52cdc3cc7821937f29cfc7603925",
"build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/67/0a/e6f6c546ebcc558c5c8e053db473",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fa/84/9e94f985a3800e982cc951013103",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c1/e5/a292713721a27bc32e0cd358d0de",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c1/e5/a858dc7ad170f604b92b3174c679",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/e5/5a/b566e513d303b2ada7d989e5e960",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c5/23/c0f694ccbdbb9f165fa5a1e2261a",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6b/c7/c3e9e67734aeebf6eea398709cdc",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/89/c8/8b189db0198c5da280c40cd93478",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/d9/53/7aa5bc4721c5059e7e389e14881d",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/79/33/5eaf44c0165e4b159ffc72c2b8db",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/74/ff/4d34e2d4e06279628719eaee0d00",
"build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/77/82/a686d8e79268f3eedc6b9df19823",
"build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e7/87/02c66778dde288509a5277ba69a5",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/79/a5/46f07164fcdbe1b91717e243b892",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6d/fa/ec0729da657c4e32ad9b7003f35a",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/41/84/e054c6fb551d59403c26041e1ee4",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/63/ee/26d31df7b2bb9eb5e95370b3059a",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e4/74/49599bc0fea61ee417abc05998d5",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d2/42/8e9d71c5f5dd25c9f3373bb7f2ee",
"build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/08/40/f4635ffe8782a392a3f45917aafd",
"build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c3/17/929233c7f1d476ac5701fe51585d",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/03/95/0c63acb4484b44f34608c43e9368",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d8/ca/0194b8c635cba7d9ad4ae46b20b6",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/69/e6/a11756db0dc21d359a3e2d2e588f",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/62/85/e6361b234a737f31be4bfcc312a2",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f9/b6/b24a4ec933cde35037a7ca204dce",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/91/de/59e991f26802c4d695b14777e5bd"
}

View File

@ -617,6 +617,7 @@
<w>eftools</w>
<w>efxjtp</w>
<w>eids</w>
<w>elapsedf</w>
<w>elementtree</w>
<w>elim</w>
<w>emitfx</w>
@ -1977,6 +1978,7 @@
<w>sourceimages</w>
<w>sourcelines</w>
<w>sourcenode</w>
<w>spacecount</w>
<w>spacelen</w>
<w>spacingstr</w>
<w>spammers</w>

View File

@ -38,6 +38,7 @@
<w>alphapixels</w>
<w>alsa</w>
<w>alsoft</w>
<w>anchorx</w>
<w>animcurve</w>
<w>aniso</w>
<w>ansiwrap</w>
@ -265,6 +266,7 @@
<w>efro</w>
<w>efrohack</w>
<w>efrohome</w>
<w>elapsedf</w>
<w>elems</w>
<w>elevenbase</w>
<w>elevenbits</w>
@ -859,6 +861,7 @@
<w>soffs</w>
<w>solaris</w>
<w>sourcenode</w>
<w>spacecount</w>
<w>spaz</w>
<w>spead</w>
<w>sphrand</w>

View File

@ -4,6 +4,9 @@
<inspection_tool class="ArrayIssues" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CannotResolve" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ClangTidy" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="External" level="WARNING" enabled="false">
<option name="clangTidyChecks" value="-*,bugprone-argument-comment,bugprone-assert-side-effect,bugprone-bad-signal-to-kill-thread,bugprone-branch-clone,bugprone-copy-constructor-init,bugprone-dangling-handle,bugprone-dynamic-static-initializers,bugprone-fold-init-type,bugprone-forward-declaration-namespace,bugprone-forwarding-reference-overload,bugprone-inaccurate-erase,bugprone-incorrect-roundings,bugprone-integer-division,bugprone-lambda-function-name,bugprone-macro-parentheses,bugprone-macro-repeated-side-effects,bugprone-misplaced-operator-in-strlen-in-alloc,bugprone-misplaced-pointer-arithmetic-in-alloc,bugprone-misplaced-widening-cast,bugprone-move-forwarding-reference,bugprone-multiple-statement-macro,bugprone-no-escape,bugprone-not-null-terminated-result,bugprone-parent-virtual-call,bugprone-posix-return,bugprone-sizeof-container,bugprone-sizeof-expression,bugprone-spuriously-wake-up-functions,bugprone-string-constructor,bugprone-string-integer-assignment,bugprone-string-literal-with-embedded-nul,bugprone-suspicious-enum-usage,bugprone-suspicious-include,bugprone-suspicious-memset-usage,bugprone-suspicious-missing-comma,bugprone-suspicious-semicolon,bugprone-suspicious-string-compare,bugprone-swapped-arguments,bugprone-terminating-continue,bugprone-throw-keyword-missing,bugprone-too-small-loop-variable,bugprone-undefined-memory-manipulation,bugprone-undelegated-constructor,bugprone-unhandled-self-assignment,bugprone-unused-raii,bugprone-unused-return-value,bugprone-use-after-move,bugprone-virtual-near-miss,cert-dcl21-cpp,cert-dcl58-cpp,cert-err34-c,cert-err52-cpp,cert-err58-cpp,cert-err60-cpp,cert-flp30-c,cert-msc50-cpp,cert-msc51-cpp,cppcoreguidelines-interfaces-global-init,cppcoreguidelines-narrowing-conversions,cppcoreguidelines-pro-type-member-init,cppcoreguidelines-slicing,google-default-arguments,google-explicit-constructor,google-runtime-operator,hicpp-exception-baseclass,hicpp-multiway-paths-covered,misc-misplaced-const,misc-new-delete-overloads,misc-no-recursion,misc-non-copyable-objects,misc-throw-by-value-catch-by-reference,misc-unconventional-assign-operator,misc-uniqueptr-reset-release,modernize-avoid-bind,modernize-concat-nested-namespaces,modernize-deprecated-headers,modernize-deprecated-ios-base-aliases,modernize-loop-convert,modernize-make-shared,modernize-make-unique,modernize-pass-by-value,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-replace-auto-ptr,modernize-replace-disallow-copy-and-assign-macro,modernize-replace-random-shuffle,modernize-return-braced-init-list,modernize-shrink-to-fit,modernize-unary-static-assert,modernize-use-auto,modernize-use-bool-literals,modernize-use-emplace,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-override,modernize-use-transparent-functors,modernize-use-uncaught-exceptions,mpi-buffer-deref,mpi-type-mismatch,openmp-use-default-none,performance-faster-string-find,performance-for-range-copy,performance-implicit-conversion-in-loop,performance-inefficient-algorithm,performance-inefficient-string-concatenation,performance-inefficient-vector-operation,performance-move-const-arg,performance-move-constructor-init,performance-no-automatic-move,performance-noexcept-move-constructor,performance-trivially-destructible,performance-type-promotion-in-math-fn,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,portability-simd-intrinsics,readability-avoid-const-params-in-decls,readability-const-return-type,readability-container-size-empty,readability-delete-null-pointer,readability-deleted-default,readability-inconsistent-declaration-parameter-name,readability-misleading-indentation,readability-misplaced-array-index,readability-non-const-parameter,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-smartptr-get,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-subscript-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,readability-string-compare,readability-uniqueptr-delete-release,readability-use-anyofallof,-misc-no-recursion" />
</scope>
<option name="clangTidyChecks" value="-*,bugprone-argument-comment,bugprone-assert-side-effect,bugprone-bad-signal-to-kill-thread,bugprone-branch-clone,bugprone-copy-constructor-init,bugprone-dangling-handle,bugprone-dynamic-static-initializers,bugprone-fold-init-type,bugprone-forward-declaration-namespace,bugprone-forwarding-reference-overload,bugprone-inaccurate-erase,bugprone-incorrect-roundings,bugprone-integer-division,bugprone-lambda-function-name,bugprone-macro-parentheses,bugprone-macro-repeated-side-effects,bugprone-misplaced-operator-in-strlen-in-alloc,bugprone-misplaced-pointer-arithmetic-in-alloc,bugprone-misplaced-widening-cast,bugprone-move-forwarding-reference,bugprone-multiple-statement-macro,bugprone-no-escape,bugprone-not-null-terminated-result,bugprone-parent-virtual-call,bugprone-posix-return,bugprone-sizeof-container,bugprone-sizeof-expression,bugprone-spuriously-wake-up-functions,bugprone-string-constructor,bugprone-string-integer-assignment,bugprone-string-literal-with-embedded-nul,bugprone-suspicious-enum-usage,bugprone-suspicious-include,bugprone-suspicious-memset-usage,bugprone-suspicious-missing-comma,bugprone-suspicious-semicolon,bugprone-suspicious-string-compare,bugprone-swapped-arguments,bugprone-terminating-continue,bugprone-throw-keyword-missing,bugprone-too-small-loop-variable,bugprone-undefined-memory-manipulation,bugprone-undelegated-constructor,bugprone-unhandled-self-assignment,bugprone-unused-raii,bugprone-unused-return-value,bugprone-use-after-move,bugprone-virtual-near-miss,cert-dcl21-cpp,cert-dcl58-cpp,cert-err34-c,cert-err52-cpp,cert-err58-cpp,cert-err60-cpp,cert-flp30-c,cert-msc50-cpp,cert-msc51-cpp,cppcoreguidelines-interfaces-global-init,cppcoreguidelines-narrowing-conversions,cppcoreguidelines-pro-type-member-init,cppcoreguidelines-slicing,google-default-arguments,google-explicit-constructor,google-runtime-operator,hicpp-exception-baseclass,hicpp-multiway-paths-covered,misc-misplaced-const,misc-new-delete-overloads,misc-no-recursion,misc-non-copyable-objects,misc-throw-by-value-catch-by-reference,misc-unconventional-assign-operator,misc-uniqueptr-reset-release,modernize-avoid-bind,modernize-concat-nested-namespaces,modernize-deprecated-headers,modernize-deprecated-ios-base-aliases,modernize-loop-convert,modernize-make-shared,modernize-make-unique,modernize-pass-by-value,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-replace-auto-ptr,modernize-replace-disallow-copy-and-assign-macro,modernize-replace-random-shuffle,modernize-return-braced-init-list,modernize-shrink-to-fit,modernize-unary-static-assert,modernize-use-auto,modernize-use-bool-literals,modernize-use-emplace,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-override,modernize-use-transparent-functors,modernize-use-uncaught-exceptions,mpi-buffer-deref,mpi-type-mismatch,openmp-use-default-none,performance-faster-string-find,performance-for-range-copy,performance-implicit-conversion-in-loop,performance-inefficient-algorithm,performance-inefficient-string-concatenation,performance-inefficient-vector-operation,performance-move-const-arg,performance-move-constructor-init,performance-no-automatic-move,performance-noexcept-move-constructor,performance-trivially-destructible,performance-type-promotion-in-math-fn,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,portability-simd-intrinsics,readability-avoid-const-params-in-decls,readability-const-return-type,readability-container-size-empty,readability-delete-null-pointer,readability-deleted-default,readability-inconsistent-declaration-parameter-name,readability-misleading-indentation,readability-misplaced-array-index,readability-non-const-parameter,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-smartptr-get,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-subscript-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,readability-string-compare,readability-uniqueptr-delete-release,readability-use-anyofallof,-misc-no-recursion" />
</inspection_tool>
<inspection_tool class="ConstructionIsNotAllowed" enabled="false" level="WARNING" enabled_by_default="false" />

View File

@ -1,8 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$">
<contentRoot DIR="$PROJECT_DIR$/.." />
</component>
<component name="CidrRootsConfiguration">
<excludeRoots>
<file path="$PROJECT_DIR$/../.assetcache" />
<file path="$PROJECT_DIR$/../.cache" />
<file path="$PROJECT_DIR$/../.mypy_cache" />
<file path="$PROJECT_DIR$/../.pytest_cache" />
<file path="$PROJECT_DIR$/../assets" />
<file path="$PROJECT_DIR$/../ballisticacore-android" />
<file path="$PROJECT_DIR$/.idea" />
<file path="$PROJECT_DIR$/build" />
<file path="$PROJECT_DIR$/build-server" />
@ -22,6 +30,16 @@
<file path="$PROJECT_DIR$/src/external/windows" />
<file path="$PROJECT_DIR$/src/generated" />
<file path="$PROJECT_DIR$/src/generated_src" />
<file path="$PROJECT_DIR$/../ballisticacore-ios.xcodeproj" />
<file path="$PROJECT_DIR$/../ballisticacore-mac.xcodeproj" />
<file path="$PROJECT_DIR$/../ballisticacore-windows" />
<file path="$PROJECT_DIR$/../ballisticacore-xcode" />
<file path="$PROJECT_DIR$/../build" />
<file path="$PROJECT_DIR$/../config" />
<file path="$PROJECT_DIR$/../docs" />
<file path="$PROJECT_DIR$/../resources" />
<file path="$PROJECT_DIR$/../tests" />
<file path="$PROJECT_DIR$/../tools" />
</excludeRoots>
</component>
<component name="JavaScriptSettings">

View File

@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="External" pattern="file[BallisticaCore]:src/external//*" />
</component>

View File

@ -81,7 +81,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
"${CMAKE_CXX_FLAGS} -Wno-psabi")
endif()
set(BA_SRC_ROOT src)
set(BA_SRC_ROOT ../src)
include_directories(${BA_SRC_ROOT})
add_compile_options(-include ballistica/config/config_cmake.h)
@ -642,7 +642,7 @@ target_include_directories(ballisticacore PRIVATE
target_link_libraries(ballisticacore PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/prefablib/libballisticacore_internal.a ode pthread ${Python_LIBRARIES}
${SDL2_LIBRARIES} ${EXTRA_LIBRARIES} dl)
${SDL2_LIBRARIES} ${EXTRA_LIBRARIES} dl z)
# Hack for building on rpi (might be due to my manually built Python 3.8)
# Hopefully can remove later...

View File

@ -1 +0,0 @@
../src

View File

@ -21,6 +21,7 @@
"name": "BallisticaCore",
"public": true,
"pylint_ignored_untracked_deps": [
"__main__",
"astroid.modutils",
"astroid",
"pylint.lint",

View File

@ -30,7 +30,10 @@ ignore_missing_imports = True
[mypy-xml.*]
ignore_missing_imports = True
[mypy-vis_cleanup]
# We delete a bunch of stuff from _ba in here
# which our public stub module doesn't list,
# so we get complaints that they don't exist.
[mypy-ba_embedded_vis_cleanup]
ignore_errors = True
[mypy-bastd.mapdata.*]

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2021-04-13 for Ballistica version 1.6.0 build 20332</em></h4>
<h4><em>last updated on 2021-04-14 for Ballistica version 1.6.0 build 20335</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

@ -137,13 +137,13 @@ void App::RunEvents() {
void App::UpdatePauseResume() {
if (actually_paused_) {
// Unpause if no one wants pause.
if (!sys_paused_app_ && !user_paused_app_) {
if (!sys_paused_app_) {
OnResume();
actually_paused_ = false;
}
} else {
// Pause if anyone wants.
if (sys_paused_app_ || user_paused_app_) {
if (sys_paused_app_) {
OnPause();
actually_paused_ = true;
}
@ -264,7 +264,7 @@ void App::PrimeEventPump() {
void App::PushShowOnlineScoreUICall(const std::string& show,
const std::string& game,
const std::string& game_version) {
PushCall([this, show, game, game_version] {
PushCall([show, game, game_version] {
assert(InMainThread());
g_platform->ShowOnlineScoreUI(show, game, game_version);
});
@ -272,7 +272,7 @@ void App::PushShowOnlineScoreUICall(const std::string& show,
void App::PushNetworkSetupCall(int port, int telnet_port, bool enable_telnet,
const std::string& telnet_password) {
PushCall([this, port, telnet_port, enable_telnet, telnet_password] {
PushCall([port, telnet_port, enable_telnet, telnet_password] {
assert(InMainThread());
// Kick these off if they don't exist.
// (do we want to support changing ports on existing ones?)
@ -293,59 +293,58 @@ void App::PushNetworkSetupCall(int port, int telnet_port, bool enable_telnet,
void App::PushPurchaseAckCall(const std::string& purchase,
const std::string& order_id) {
PushCall([this, purchase, order_id] {
g_platform->PurchaseAck(purchase, order_id);
});
PushCall(
[purchase, order_id] { g_platform->PurchaseAck(purchase, order_id); });
}
void App::PushGetScoresToBeatCall(const std::string& level,
const std::string& config,
void* py_callback) {
PushCall([this, level, config, py_callback] {
PushCall([level, config, py_callback] {
assert(InMainThread());
g_platform->GetScoresToBeat(level, config, py_callback);
});
}
void App::PushPurchaseCall(const std::string& item) {
PushCall([this, item] {
PushCall([item] {
assert(InMainThread());
g_platform->Purchase(item);
});
}
void App::PushRestorePurchasesCall() {
PushCall([this] {
PushCall([] {
assert(InMainThread());
g_platform->RestorePurchases();
});
}
void App::PushOpenURLCall(const std::string& url) {
PushCall([this, url] { g_platform->OpenURL(url); });
PushCall([url] { g_platform->OpenURL(url); });
}
void App::PushGetFriendScoresCall(const std::string& game,
const std::string& game_version, void* data) {
PushCall([this, game, game_version, data] {
PushCall([game, game_version, data] {
g_platform->GetFriendScores(game, game_version, data);
});
}
void App::PushSubmitScoreCall(const std::string& game,
const std::string& game_version, int64_t score) {
PushCall([this, game, game_version, score] {
PushCall([game, game_version, score] {
g_platform->SubmitScore(game, game_version, score);
});
}
void App::PushAchievementReportCall(const std::string& achievement) {
PushCall([this, achievement] { g_platform->ReportAchievement(achievement); });
PushCall([achievement] { g_platform->ReportAchievement(achievement); });
}
void App::PushStringEditCall(const std::string& name, const std::string& value,
int max_chars) {
PushCall([this, name, value, max_chars] {
PushCall([name, value, max_chars] {
static millisecs_t last_edit_time = 0;
millisecs_t t = GetRealTime();
@ -367,7 +366,7 @@ void App::PushSetStressTestingCall(bool enable, int player_count) {
}
void App::PushResetAchievementsCall() {
PushCall([this] { g_platform->ResetAchievements(); });
PushCall([] { g_platform->ResetAchievements(); });
}
void App::OnBootstrapComplete() {
@ -390,7 +389,7 @@ void App::OnBootstrapComplete() {
}
void App::PushCursorUpdate(bool vis) {
PushCall([this, vis] {
PushCall([vis] {
assert(InMainThread());
g_platform->SetHardwareCursorVisible(vis);
});

View File

@ -133,7 +133,6 @@ class App : public Module {
bool done_{};
bool server_wrapper_managed_{};
bool sys_paused_app_{};
bool user_paused_app_{};
bool actually_paused_{};
std::unique_ptr<StressTest> stress_test_;
millisecs_t last_resize_draw_event_time_{};

View File

@ -87,7 +87,7 @@ auto Audio::IsSoundPlaying(uint32_t play_id) -> bool {
return result;
}
auto Audio::SourceBeginExisting(uint32_t play_id, uint32_t debug_id)
auto Audio::SourceBeginExisting(uint32_t play_id, int debug_id)
-> AudioSource* {
BA_DEBUG_FUNCTION_TIMER_BEGIN();
uint32_t source_id = AudioServer::source_id_from_play_id(play_id);

View File

@ -34,7 +34,7 @@ class Audio {
// If a sound play id is playing, locks and returns its sound source.
// on success, you must unlock the source once done with it.
auto SourceBeginExisting(uint32_t play_id, uint32_t debug_id) -> AudioSource*;
auto SourceBeginExisting(uint32_t play_id, int debug_id) -> AudioSource*;
// Return true if the sound id is currently valid. This is not guaranteed
// to be super accurate, but can be used to determine if a sound is still

View File

@ -37,8 +37,8 @@ const bool kShowInUseSounds = false;
int AudioServer::al_source_count_ = 0;
struct AudioServer::Impl {
Impl() {}
~Impl() {}
Impl() = default;
~Impl() = default;
#if BA_ENABLE_AUDIO
ALCcontext* alc_context_{};
@ -417,7 +417,6 @@ AudioServer::AudioServer(Thread* thread)
}
AudioServer::~AudioServer() {
delete impl_;
#if BA_ENABLE_AUDIO
sound_source_refs_.clear();
@ -434,6 +433,7 @@ AudioServer::~AudioServer() {
assert(al_source_count_ == 0);
#endif // BA_ENABLE_AUDIO
delete impl_;
}
void AudioServer::UpdateAvailableSources() {

View File

@ -49,6 +49,11 @@ auto AudioStreamer::Play() -> bool {
alSourcePlay(source_);
CHECK_AL_ERROR;
// Suppress 'always returns true' lint.
if (explicit_bool(false)) {
return false;
}
return true;
}
@ -132,11 +137,17 @@ auto AudioStreamer::Stream(ALuint buffer) -> bool {
CHECK_AL_ERROR;
DoStream(pcm, &size, &rate);
if (size > 0) {
alBufferData(buffer, al_format(), pcm, size, rate);
alBufferData(buffer, al_format(), pcm, size, static_cast<ALsizei>(rate));
CHECK_AL_ERROR;
} else {
eof_ = true;
}
// Suppress 'always returns true' lint.
if (explicit_bool(false)) {
return false;
}
return true;
}

View File

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

View File

@ -21,9 +21,9 @@ auto FatalError::ReportFatalError(const std::string& message,
// blessed build. If we are, our main goal is to communicate as much info
// about the error to the master server, and communicating to the user is
// a stretch goal.
// If we are unblessed or modified, the main goals are communicating the error
// to the user and exiting the app cleanly (so we don't pollute our crash
// records with results of user tinkering).
// If we are unblessed or modified, the main goals are communicating the
// error to the user and exiting the app cleanly (so we don't pollute our
// crash records with results of user tinkering).
// Try to avoid crash reports if we're not a clean blessed build.
// bool exit_cleanly = !IsUnmodifiedBlessedBuild();

View File

@ -287,16 +287,6 @@ void Thread::GetThreadMessages(std::list<ThreadMessage>* messages) {
}
}
void Thread::WriteToOwner(const void* data, uint32_t size) {
assert(std::this_thread::get_id() == thread_id());
{
std::unique_lock<std::mutex> lock(data_to_client_mutex_);
data_to_client_.emplace_back(size);
memcpy(&(data_to_client_.back()[0]), data, size);
}
data_to_client_cv_.notify_all();
}
Thread::Thread(ThreadIdentifier identifier_in, ThreadType type_in)
: type_(type_in), identifier_(identifier_in) {
switch (type_) {
@ -419,6 +409,11 @@ auto Thread::ThreadMain() -> int {
throw;
}
}
// Silence some lint complaints about always returning 0.
if (explicit_bool(false)) {
return 1;
}
return 0;
}
}
@ -438,6 +433,9 @@ void Thread::Quit() {
Thread::~Thread() = default;
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantConditionsOC"
void Thread::LogThreadMessageTally() {
// Prevent recursion.
if (!writing_tally_) {
@ -498,6 +496,7 @@ void Thread::LogThreadMessageTally() {
writing_tally_ = false;
}
}
#pragma clang diagnostic pop
void Thread::PushThreadMessage(const ThreadMessage& t) {
{
@ -555,6 +554,19 @@ void Thread::PushThreadMessage(const ThreadMessage& t) {
thread_message_cv_.notify_all();
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantParameter"
void Thread::WriteToOwner(const void* data, uint32_t size) {
assert(std::this_thread::get_id() == thread_id());
{
std::unique_lock<std::mutex> lock(data_to_client_mutex_);
data_to_client_.emplace_back(size);
memcpy(&(data_to_client_.back()[0]), data, size);
}
data_to_client_cv_.notify_all();
}
void Thread::ReadFromThread(std::unique_lock<std::mutex>* lock, void* buffer,
uint32_t size) {
// Threads cant read from themselves.. could load to lock-deadlock.
@ -572,6 +584,8 @@ void Thread::ReadFromThread(std::unique_lock<std::mutex>* lock, void* buffer,
data_to_client_.pop_front();
}
#pragma clang diagnostic pop
void Thread::SetThreadsPaused(bool paused) {
threads_paused_ = paused;
for (auto&& i : g_app_globals->pausable_threads) {

View File

@ -362,8 +362,6 @@ void BGDynamics::DrawChunks(FrameDef* frame_def,
c.SetColor(0.9f, 0.6f, 0.3f, 1.0f);
break;
}
default:
throw Exception();
}
c.DrawModelInstanced(model, *draw_snapshot, kModelDrawFlagNoReflection);
c.Submit();

View File

@ -1689,7 +1689,8 @@ auto BGDynamicsServer::CreateDrawSnapshot() -> BGDynamicsDrawSnapshot* {
float flicker = i->flicker_;
float shadow_dist = i->shadow_dist_;
float life = std::min(
1.0f, (static_cast<float>(time_) - i->birth_time_) / i->lifespan_);
1.0f, (static_cast<float>(time_) - static_cast<float>(i->birth_time_))
/ i->lifespan_);
// Shrink our matrix down over time.
switch (type) {
@ -2218,7 +2219,8 @@ void BGDynamicsServer::PushTooSlowCall() {
if (chunk_count_ > 0 || tendril_count_thick_ > 0
|| tendril_count_thin_ > 0) {
// Ok lets kill a small percentage of our oldest chunks.
int killcount = static_cast<int>(0.1f * chunks_.size());
int killcount =
static_cast<int>(0.1f * static_cast<float>(chunks_.size()));
int killed = 0;
auto i = chunks_.begin();
while (i != chunks_.end()) {
@ -2236,7 +2238,7 @@ void BGDynamicsServer::PushTooSlowCall() {
i = i_next;
}
// ...and tendrils.
killcount = static_cast<int>(0.2f * tendrils_.size());
killcount = static_cast<int>(0.2f * static_cast<float>(tendrils_.size()));
for (int j = 0; j < killcount; j++) {
Tendril* t = *tendrils_.begin();
if (t->type_ == BGDynamicsTendrilType::kThinSmoke) {

View File

@ -75,8 +75,13 @@ void MaterialConditionNode::Restore(const char** buffer, ClientSession* cs) {
val1 = Utils::ExtractInt32NBO(buffer);
val2 = Utils::ExtractInt32NBO(buffer);
break;
// Currently not reachable, but guarding in case GetValueCount changes.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
default:
throw Exception();
#pragma clang diagnostic pop
}
} else {
// not a leaf node - make ourself some children

View File

@ -425,8 +425,6 @@ auto RigidBody::SetDimensions(float d1, float d2, float d3, float m1, float m2,
case Shape::kTrimesh: // NOLINT(bugprone-branch-clone)
// Trimesh bodies not supported yet.
throw Exception();
default:
throw Exception();
}
// Need to handle groups here.

View File

@ -904,7 +904,7 @@ void Game::PushInGameConsoleScriptCommand(const std::string& command) {
g_app_globals->user_ran_commands = true;
}
if (cmd.CanEval()) {
PyObject* obj = cmd.RunReturnObj(true);
PyObject* obj = cmd.RunReturnObj(true, nullptr);
if (obj && obj != Py_None) {
PyObject* s = PyObject_Repr(obj);
if (s) {
@ -935,7 +935,7 @@ void Game::PushStdinScriptCommand(const std::string& command) {
// Eval this if possible (so we can possibly print return value).
if (cmd.CanEval()) {
if (PyObject* obj = cmd.RunReturnObj(true)) {
if (PyObject* obj = cmd.RunReturnObj(true, nullptr)) {
// Print the value if we're running directly from a terminal
// (or being run under the server-manager)
if ((IsStdinATerminal() || g_app->server_wrapper_managed())

View File

@ -15,7 +15,7 @@ namespace ballistica {
// stream of messages that can be saved to file or sent over the network.
class GameStream : public Object, public ClientControllerInterface {
public:
GameStream(HostSession* host_session, bool saveReplay);
GameStream(HostSession* host_session, bool save_replay);
~GameStream() override;
auto SetTime(millisecs_t t) -> void;
auto AddScene(Scene* s) -> void;

View File

@ -120,8 +120,8 @@ auto base64_decode(const std::string& encoded_string, bool urlsafe)
in_++;
if (i == 4) {
for (i = 0; i < 4; i++) {
char_array_4[i] =
static_cast<unsigned char>(base64_chars.find(char_array_4[i]));
char_array_4[i] = static_cast<unsigned char>(
base64_chars.find(static_cast<char>(char_array_4[i])));
}
char_array_3[0] = static_cast<unsigned char>(
@ -131,7 +131,7 @@ auto base64_decode(const std::string& encoded_string, bool urlsafe)
char_array_3[2] = static_cast<unsigned char>(
((char_array_4[2] & 0x3u) << 6u) + char_array_4[3]);
for (i = 0; (i < 3); i++) ret += char_array_3[i];
for (i = 0; (i < 3); i++) ret += static_cast<char>(char_array_3[i]);
i = 0;
}
}
@ -140,8 +140,8 @@ auto base64_decode(const std::string& encoded_string, bool urlsafe)
char_array_4[j] = 0;
}
for (int j = 0; j < 4; j++) { // NOLINT(modernize-loop-convert)
char_array_4[j] =
static_cast<unsigned char>(base64_chars.find(char_array_4[j]));
char_array_4[j] = static_cast<unsigned char>(
base64_chars.find(static_cast<char>(char_array_4[j])));
}
char_array_3[0] = static_cast<unsigned char>(
(char_array_4[0] << 2u) + ((char_array_4[1] & 0x30u) >> 4u));
@ -150,7 +150,7 @@ auto base64_decode(const std::string& encoded_string, bool urlsafe)
char_array_3[2] = static_cast<unsigned char>(
((char_array_4[2] & 0x3u) << 6u) + char_array_4[3]);
for (int j = 0; (j < i - 1); j++) {
ret += char_array_3[j];
ret += static_cast<char>(char_array_3[j]);
}
}
return ret;

View File

@ -865,6 +865,9 @@ auto cJSON_DetachItemFromArray(cJSON* array, int which) -> cJSON* {
void cJSON_DeleteItemFromArray(cJSON* array, int which) {
cJSON_Delete(cJSON_DetachItemFromArray(array, which));
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantFunctionResult"
auto cJSON_DetachItemFromObject(cJSON* object, const char* string) -> cJSON* {
int i = 0;
cJSON* c = object->child;
@ -875,6 +878,9 @@ auto cJSON_DetachItemFromObject(cJSON* object, const char* string) -> cJSON* {
if (c) return cJSON_DetachItemFromArray(object, i);
return nullptr;
}
#pragma clang diagnostic pop
void cJSON_DeleteItemFromObject(cJSON* object, const char* string) {
cJSON_Delete(cJSON_DetachItemFromObject(object, string));
}

View File

@ -243,7 +243,7 @@ auto Utils::GetValidUTF8(const char* str, const char* loc) -> std::string {
for (i = 0; i < f_size; i++) {
c = (unsigned char)(str)[i];
if (c < 127) { // normal ASCII
to.append(1, c);
to.append(1, static_cast<char>(c));
}
}
@ -268,19 +268,19 @@ auto Utils::GetValidUTF8(const char* str, const char* loc) -> std::string {
c = (unsigned char)(str)[i];
if (c < 32) { // control char
if (c == 9 || c == 10 || c == 13) { // allow only \t \n \r
to.append(1, c);
to.append(1, static_cast<char>(c));
}
continue;
} else if (c < 127) { // normal ASCII
to.append(1, c);
to.append(1, static_cast<char>(c));
continue;
} else if (c < 160) {
// control char (nothing should be defined here either
// ASCI, ISO_8859-1 or UTF8, so skipping)
if (c2 == 128) { // fix microsoft mess, add euro
to.append(1, (unsigned char)(226));
to.append(1, (unsigned char)(130));
to.append(1, (unsigned char)(172));
to.append(1, static_cast<char>((unsigned char)(226)));
to.append(1, static_cast<char>((unsigned char)(130)));
to.append(1, static_cast<char>((unsigned char)(172)));
}
if (c2 == 133) { // fix IBM mess, add NEL = \n\r
to.append(1, 10);
@ -288,11 +288,11 @@ auto Utils::GetValidUTF8(const char* str, const char* loc) -> std::string {
}
continue;
} else if (c < 192) { // invalid for UTF8, converting ASCII
to.append(1, (unsigned char)194);
to.append(1, c);
to.append(1, static_cast<char>((unsigned char)194));
to.append(1, static_cast<char>(c));
continue;
} else if (c < 194) { // invalid for UTF8, converting ASCII
to.append(1, (unsigned char)195);
to.append(1, static_cast<char>((unsigned char)195));
to.append(1, c - 64);
continue;
} else if (c < 224 && i + 1 < f_size) { // possibly 2byte UTF8
@ -300,8 +300,8 @@ auto Utils::GetValidUTF8(const char* str, const char* loc) -> std::string {
if (c2 > 127 && c2 < 192) { // valid 2byte UTF8
if (c == 194 && c2 < 160) { // control char, skipping
} else {
to.append(1, c);
to.append(1, c2);
to.append(1, static_cast<char>(c));
to.append(1, static_cast<char>(c2));
}
i++;
continue;
@ -310,9 +310,9 @@ auto Utils::GetValidUTF8(const char* str, const char* loc) -> std::string {
c2 = (unsigned char)(str)[i + 1];
c3 = (unsigned char)(str)[i + 2];
if (c2 > 127 && c2 < 192 && c3 > 127 && c3 < 192) { // valid 3byte UTF8
to.append(1, c);
to.append(1, c2);
to.append(1, c3);
to.append(1, static_cast<char>(c));
to.append(1, static_cast<char>(c2));
to.append(1, static_cast<char>(c3));
i += 2;
continue;
}
@ -323,17 +323,17 @@ auto Utils::GetValidUTF8(const char* str, const char* loc) -> std::string {
if (c2 > 127 && c2 < 192 && c3 > 127 && c3 < 192 && c4 > 127
&& c4 < 192) {
// valid 4byte UTF8
to.append(1, c);
to.append(1, c2);
to.append(1, c3);
to.append(1, c4);
to.append(1, static_cast<char>(c));
to.append(1, static_cast<char>(c2));
to.append(1, static_cast<char>(c3));
to.append(1, static_cast<char>(c4));
i += 3;
continue;
}
}
// invalid UTF8, converting ASCII
// (c>245 || string too short for multi-byte))
to.append(1, (unsigned char)195);
to.append(1, static_cast<char>((unsigned char)195));
to.append(1, c - 64);
}
}
@ -424,11 +424,16 @@ static std::list<std::string>* g_random_names_list = nullptr;
auto Utils::GetRandomNameList() -> const std::list<std::string>& {
assert(InGameThread());
if (!g_random_names_list) {
// this will init the list with our default english names
if (g_random_names_list == nullptr) {
// This will init the list with our default english names.
SetRandomNameList(std::list<std::string>(1, "DEFAULT_NAMES"));
}
// Clion incorrectly thinks this might be null.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "NullDereferences"
return *g_random_names_list;
#pragma clang diagnostic pop
}
void Utils::SetRandomNameList(const std::list<std::string>& custom_names) {

View File

@ -606,6 +606,7 @@ void Camera::Update(millisecs_t elapsed) {
// Prevent camera "explosions" if we've been unable to update for a while.
elapsed = std::min(millisecs_t{100}, elapsed);
auto elapsedf{static_cast<float>(elapsed)};
// In normal mode we orbit; in vr mode we don't.
if (IsVRMode()) {
@ -626,36 +627,36 @@ void Camera::Update(millisecs_t elapsed) {
}
target_radius_smoothed_ +=
elapsed * (target_radius_ - target_radius_smoothed_) * zoom_speed;
elapsedf * (target_radius_ - target_radius_smoothed_) * zoom_speed;
float diff = field_of_view_x_ - field_of_view_x_smoothed_;
field_of_view_x_smoothed_ +=
elapsed * diff * (diff > 0.0f ? fov_speed_out : fov_speed_in);
elapsedf * diff * (diff > 0.0f ? fov_speed_out : fov_speed_in);
diff = field_of_view_y_ - field_of_view_y_smoothed_;
field_of_view_y_smoothed_ +=
elapsed * diff * (diff > 0.0f ? fov_speed_out : fov_speed_in);
elapsedf * diff * (diff > 0.0f ? fov_speed_out : fov_speed_in);
if (x_constrained_) {
xy_constrain_blend_ +=
elapsed * (1.0f - xy_constrain_blend_) * xy_blend_speed;
elapsedf * (1.0f - xy_constrain_blend_) * xy_blend_speed;
xy_constrain_blend_ = std::min(1.0f, xy_constrain_blend_);
} else {
xy_constrain_blend_ +=
elapsed * (0.0f - xy_constrain_blend_) * xy_blend_speed * elapsed;
elapsedf * (0.0f - xy_constrain_blend_) * xy_blend_speed * elapsedf;
xy_constrain_blend_ = std::max(0.0f, xy_constrain_blend_);
}
if (!IsVRMode()) {
smooth_speed_.x += elapsed * rand_component
smooth_speed_.x += elapsedf * rand_component
* (-0.5f
+ Utils::precalc_rand_1((real_time / rand_incr_1)
% kPrecalcRandsCount));
smooth_speed_.y += elapsed * rand_component
smooth_speed_.y += elapsedf * rand_component
* (-0.5f
+ Utils::precalc_rand_2((real_time / rand_incr_2)
% kPrecalcRandsCount));
smooth_speed_.z += elapsed * rand_component
smooth_speed_.z += elapsedf * rand_component
* (-0.5f
+ Utils::precalc_rand_3((real_time / rand_incr_3)
% kPrecalcRandsCount));
@ -663,11 +664,11 @@ void Camera::Update(millisecs_t elapsed) {
if (RandomFloat() < 0.1f && !IsVRMode()) {
smooth_speed_2_.x +=
elapsed * rand_component * 4.0f * (-0.5f + RandomFloat());
elapsedf * rand_component * 4.0f * (-0.5f + RandomFloat());
smooth_speed_2_.y +=
elapsed * rand_component * 4.0f * (-0.5f + RandomFloat());
elapsedf * rand_component * 4.0f * (-0.5f + RandomFloat());
smooth_speed_2_.z +=
elapsed * rand_component * 4.0f * (-0.5f + RandomFloat());
elapsedf * rand_component * 4.0f * (-0.5f + RandomFloat());
}
// If we have no important areas of interest, keep our camera from moving too

View File

@ -351,6 +351,10 @@ void GraphicsServer::SetScreen(bool fullscreen, int width, int height,
}
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantConditionsOC"
#pragma ide diagnostic ignored "ConstantParameter"
void GraphicsServer::HandleFullContextScreenRebuild(
bool need_full_context_rebuild, bool fullscreen, int width, int height,
GraphicsQuality graphics_quality_requested,
@ -457,6 +461,8 @@ void GraphicsServer::HandleFullContextScreenRebuild(
});
}
#pragma clang diagnostic pop
// Given physical res, calculate virtual res.
void GraphicsServer::CalcVirtualRes(float* x, float* y) {
float x_in = (*x);
@ -523,6 +529,10 @@ void GraphicsServer::HandlePushAndroidRes(const std::string& android_res) {
}
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantConditionsOC"
#pragma ide diagnostic ignored "ConstantParameter"
void GraphicsServer::HandleFullscreenToggling(bool do_set_existing_fs,
bool do_toggle_fs,
bool fullscreen) {
@ -560,6 +570,7 @@ void GraphicsServer::HandleFullscreenToggling(bool do_set_existing_fs,
#endif // macos && xcode_build
}
}
#pragma clang diagnostic pop
void GraphicsServer::SetTextureCompressionTypes(
const std::list<TextureCompressionType>& types) {
@ -645,6 +656,9 @@ void GraphicsServer::SetCamera(const Vector3f& eye, const Vector3f& target,
cam_orient_matrix_dirty_ = true;
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantConditionsOC"
void GraphicsServer::UpdateCamOrientMatrix() {
assert(InGraphicsThread());
if (cam_orient_matrix_dirty_) {
@ -672,6 +686,8 @@ void GraphicsServer::UpdateCamOrientMatrix() {
}
}
#pragma clang diagnostic pop
#pragma mark PushCalls
void GraphicsServer::PushSetScreenCall(bool fullscreen, int width, int height,

View File

@ -2205,6 +2205,10 @@ void KTXUnpackETC(const GLubyte* srcETC, const GLenum srcFormat,
if (alphaFormat != AF_NONE) setupAlphaTable();
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantConditionsOC"
#pragma ide diagnostic ignored "UnreachableCode"
// NOTE: none of the decompress functions actually use the <height> parameter
if (alphaFormat == AF_11BIT) {
throw Exception();
@ -2249,6 +2253,8 @@ void KTXUnpackETC(const GLubyte* srcETC, const GLenum srcFormat,
}
}
#pragma clang diagnostic pop
/* Ok, now write out the active pixels to the destination image.
* (But only if the active pixels differ from the total pixels)
*/

View File

@ -10,9 +10,9 @@
namespace ballistica {
KeyboardInput::KeyboardInput(KeyboardInput* parentKeyboardInputIn) {
if (parentKeyboardInputIn) {
parent_keyboard_input_ = parentKeyboardInputIn;
KeyboardInput::KeyboardInput(KeyboardInput* parent_keyboard_input_in) {
if (parent_keyboard_input_in) {
parent_keyboard_input_ = parent_keyboard_input_in;
assert(parent_keyboard_input_->child_keyboard_input_ == nullptr);
// Currently we assume only 2 keyboard inputs.
@ -115,6 +115,9 @@ auto KeyboardInput::HandleKey(const SDL_Keysym* keysym, bool repeat, bool down)
pass = true;
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantConditionsOC"
// if we're keyboard 1 we always send at least a key press event
// along..
if (!parent_keyboard_input_ && !pass) {
@ -122,6 +125,8 @@ auto KeyboardInput::HandleKey(const SDL_Keysym* keysym, bool repeat, bool down)
pass = true;
}
break;
#pragma clang diagnostic pop
}
}
if (pass) {
@ -138,6 +143,11 @@ auto KeyboardInput::HandleKey(const SDL_Keysym* keysym, bool repeat, bool down)
return true;
}
// Clion seems to think child_keyboard_input_ will never be set here (it will).
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantConditionsOC"
// At this point, if we have a child input, let it try to handle things.
if (child_keyboard_input_ && enable_child_) {
if (child_keyboard_input_->HandleKey(keysym, repeat, down)) {
@ -145,6 +155,8 @@ auto KeyboardInput::HandleKey(const SDL_Keysym* keysym, bool repeat, bool down)
}
}
#pragma clang diagnostic pop
if (!attached_to_player()) {
if (down
&& ((keysym->sym == jump_key_) || (keysym->sym == punch_key_)

View File

@ -431,13 +431,13 @@ void TouchInput::Draw(FrameDef* frame_def) {
if (movement_control_type_ == MovementControlType::kSwipe) {
c.SetTexture(g_media->GetTexture(SystemTextureID::kTouchArrows));
if (editing_) {
float val = 1.5f + sinf(real_time * 0.02f);
float val = 1.5f + sinf(static_cast<float>(real_time) * 0.02f);
c.SetColor(val, val, 1.0f, 1.0f);
}
} else {
float val;
if (editing_) {
val = 0.35f + 0.15f * sinf(real_time * 0.02f);
val = 0.35f + 0.15f * sinf(static_cast<float>(real_time) * 0.02f);
} else {
val = 0.35f;
}
@ -459,7 +459,7 @@ void TouchInput::Draw(FrameDef* frame_def) {
if (movement_control_type_ == MovementControlType::kJoystick) {
float val;
if (editing_) {
val = 0.35f + 0.15f * sinf(real_time * 0.02f);
val = 0.35f + 0.15f * sinf(static_cast<float>(real_time) * 0.02f);
} else {
val = 0.35f;
}
@ -474,11 +474,10 @@ void TouchInput::Draw(FrameDef* frame_def) {
if (!buttons_touch_ && action_control_type_ == ActionControlType::kSwipe
&& !swipe_controls_hidden_) {
float sc2 = sc_actions;
if (action_control_type_ == ActionControlType::kSwipe) sc2 *= 0.6f;
float sc2{sc_actions * 0.6f};
c.SetTexture(g_media->GetTexture(SystemTextureID::kTouchArrowsActions));
if (editing_) {
float val = 1.5f + sinf(real_time * 0.02f);
float val = 1.5f + sinf(static_cast<float>(real_time) * 0.02f);
c.SetColor(val, val, 1.0f, 1.0f);
} else {
c.SetColor(1.0f, 1.0f, 1.0f, 1.0f);
@ -496,10 +495,10 @@ void TouchInput::Draw(FrameDef* frame_def) {
c.Submit();
}
bool have_player_position = false;
bool have_player_position{false};
std::vector<float> player_position(3);
if (attached_to_player()) {
PlayerNode* player_node = nullptr;
PlayerNode* player_node{};
// Try to come up with whichever scene is in the foreground, and try
// to pull a node for the player we're attached to.
@ -523,7 +522,7 @@ void TouchInput::Draw(FrameDef* frame_def) {
SimpleComponent c(frame_def->GetOverlayFlatPass());
c.SetTransparent(true);
uint32_t residual_time = 130;
uint32_t residual_time{130};
// Draw buttons.
bool do_draw;
@ -561,7 +560,7 @@ void TouchInput::Draw(FrameDef* frame_def) {
}
}
float s = 0.5f;
float s{0.5f};
// In buttons mode we draw based on our UI size. Otherwise we draw in the
// world at a constant scale.
@ -576,10 +575,10 @@ void TouchInput::Draw(FrameDef* frame_def) {
}
}
float b_width = 50.0f * s;
float half_b_width = 0.0f;
float b_width{50.0f * s};
float half_b_width{0.0f};
float button_spread_s = 0.0f * s;
float button_spread_s{0.0f * s};
if (action_control_type_ == ActionControlType::kSwipe) {
button_spread_s *= 2.0f;
@ -587,7 +586,7 @@ void TouchInput::Draw(FrameDef* frame_def) {
bool was_held;
float pop;
float pop_time = 100.0f;
float pop_time{100.0f};
c.PushTransform();
@ -604,11 +603,12 @@ void TouchInput::Draw(FrameDef* frame_def) {
}
}
float squash = 1.3f;
float stretch = 1.3f;
float squash{1.3f};
float stretch{1.3f};
float s_extra = 1.0f;
if (editing_) s_extra = 0.7f + 0.3f * sinf(real_time * 0.02f);
float s_extra{1.0f};
if (editing_)
s_extra = 0.7f + 0.3f * sinf(static_cast<float>(real_time) * 0.02f);
// Bomb.
was_held =

View File

@ -241,11 +241,13 @@ void RemoteAppServer::HandleData(int socket, uint8_t* buffer, size_t amt,
uint32_t h_raw_last = (last_state >> 8u) & 0xFFu;
uint32_t v_raw_last = (last_state >> 16u) & 0xFFu;
float dpad_h, dpad_v;
dpad_h = -1.0f + 2.0f * (h_raw / 255.0f);
dpad_v = -1.0f + 2.0f * (v_raw / 255.0f);
dpad_h = -1.0f + 2.0f * (static_cast<float>(h_raw) / 255.0f);
dpad_v = -1.0f + 2.0f * (static_cast<float>(v_raw) / 255.0f);
float last_dpad_h, last_dpad_v;
last_dpad_h = -1.0f + 2.0f * (h_raw_last / 255.0f);
last_dpad_v = -1.0f + 2.0f * (v_raw_last / 255.0f);
last_dpad_h =
-1.0f + 2.0f * (static_cast<float>(h_raw_last) / 255.0f);
last_dpad_v =
-1.0f + 2.0f * (static_cast<float>(v_raw_last) / 255.0f);
// Process this first since it can affect how other events are
// handled.
@ -434,11 +436,12 @@ auto RemoteAppServer::GetClient(int request_id, struct sockaddr* addr,
void RemoteAppServer::HandleRemoteEvent(RemoteAppClient* client,
RemoteEventType b) {
bool send{true};
// Ok we got some data from the remote.
// All we have to do is translate it into an SDL event and feed it to our
// manual joystick we made.
SDL_Event e{};
bool send = true;
switch (b) {
case RemoteEventType::kBombPress:
e.type = SDL_JOYBUTTONDOWN;
@ -501,6 +504,9 @@ void RemoteAppServer::HandleRemoteEvent(RemoteAppClient* client,
e.jbutton.button = 64;
break;
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantConditionsOC"
default:
send = false;
break;
@ -509,6 +515,7 @@ void RemoteAppServer::HandleRemoteEvent(RemoteAppClient* client,
assert(g_game);
g_input->PushJoystickEvent(e, client->joystick_);
}
#pragma clang diagnostic pop
}
void RemoteAppServer::HandleRemoteFloatEvent(RemoteAppClient* client,
@ -526,6 +533,10 @@ void RemoteAppServer::HandleRemoteFloatEvent(RemoteAppClient* client,
e.jaxis.axis = 1;
e.jaxis.value = static_cast<int16_t>(32767 * val);
break;
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantConditionsOC"
default:
send = false;
break;
@ -534,6 +545,7 @@ void RemoteAppServer::HandleRemoteFloatEvent(RemoteAppClient* client,
assert(g_game);
g_input->PushJoystickEvent(e, client->joystick_);
}
#pragma clang diagnostic pop
}
} // namespace ballistica

View File

@ -617,6 +617,10 @@ void Media::MarkComponentForLoad(MediaComponentData* c) {
g_media_server->PushRunnable(Object::NewDeferred<PreloadRunnable>(media_ptr));
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantFunctionResult"
auto Media::GetModelPendingLoadCount() -> int {
if (!have_pending_loads_[static_cast<int>(MediaType::kModel)]) {
return 0;
@ -686,6 +690,8 @@ auto Media::GetCollideModelPendingLoadCount() -> int {
return total;
}
#pragma clang diagnostic pop
auto Media::GetGraphicalPendingLoadCount() -> int {
// Each of these calls lock the media-lists so we don't.
return GetModelPendingLoadCount() + GetTexturePendingLoadCount();

View File

@ -53,6 +53,9 @@ void TelnetServer::Resume() {
paused_cv_.notify_all();
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantFunctionResult"
auto TelnetServer::RunThread() -> int {
// Do this whole thing in a loop.
// If we get put to sleep we just start over.
@ -66,14 +69,16 @@ auto TelnetServer::RunThread() -> int {
sd_ = socket(AF_INET, SOCK_STREAM, 0);
if (sd_ < 0) {
Log("Error: Unable to open host socket; errno " + std::to_string(errno));
return 0;
return 1;
}
// Make it reusable.
int on = 1;
int status =
setsockopt(sd_, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on));
if (-1 == status) Log("Error setting SO_REUSEADDR on telnet server");
if (-1 == status) {
Log("Error setting SO_REUSEADDR on telnet server");
}
// Bind to local server port.
struct sockaddr_in serv_addr {};
@ -83,7 +88,7 @@ auto TelnetServer::RunThread() -> int {
serv_addr.sin_port = htons(port_); // NOLINT
result = ::bind(sd_, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
if (result != 0) {
return 0;
return 1;
}
char buffer[10000];
const char* prompt = "ballisticacore> ";
@ -176,6 +181,8 @@ auto TelnetServer::RunThread() -> int {
}
}
#pragma clang diagnostic pop
void TelnetServer::PushTelnetScriptCommand(const std::string& command) {
assert(g_game);
if (g_game == nullptr) {
@ -189,7 +196,7 @@ void TelnetServer::PushTelnetScriptCommand(const std::string& command) {
}
PythonCommand cmd(command, "<telnet>");
if (cmd.CanEval()) {
PyObject* obj = cmd.RunReturnObj(true);
PyObject* obj = cmd.RunReturnObj(true, nullptr);
if (obj && obj != Py_None) {
PyObject* s = PyObject_Repr(obj);
if (s) {

View File

@ -66,6 +66,11 @@ auto PythonClassCollideModel::tp_new(PyTypeObject* type, PyObject* args,
+ " objects must only be created in the game thread (current is ("
+ GetCurrentThreadName() + ").");
}
// Clion incorrectly things s_create_empty will always be false.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantConditionsOC"
if (!s_create_empty_) {
throw Exception(
"Can't instantiate CollideModels directly; use "
@ -73,6 +78,7 @@ auto PythonClassCollideModel::tp_new(PyTypeObject* type, PyObject* args,
}
self->collide_model_ = new Object::Ref<CollideModel>();
BA_PYTHON_NEW_CATCH;
#pragma clang diagnostic pop
}
return reinterpret_cast<PyObject*>(self);
}
@ -81,7 +87,7 @@ void PythonClassCollideModel::Delete(Object::Ref<CollideModel>* ref) {
assert(InGameThread());
// if we're the py-object for a collide_model, clear them out
// (FIXME - we should pass the old pointer in here to sanity-test that we
// were their ref)
// were their ref)
if (ref->exists()) {
(*ref)->ClearPyObject();
}

View File

@ -64,6 +64,11 @@ auto PythonClassData::tp_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
+ " objects must only be created in the game thread (current is ("
+ GetCurrentThreadName() + ").");
}
// Clion incorrectly things s_create_empty will always be false.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantConditionsOC"
if (!s_create_empty_) {
throw Exception(
"Can't instantiate Datas directly; use ba.getdata() to get "
@ -71,6 +76,7 @@ auto PythonClassData::tp_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
}
self->data_ = new Object::Ref<Data>();
BA_PYTHON_NEW_CATCH;
#pragma clang diagnostic pop
}
return reinterpret_cast<PyObject*>(self);
}

View File

@ -244,6 +244,10 @@ auto PythonClassInputDevice::tp_getattro(PythonClassInputDevice* self,
BA_PYTHON_CATCH;
}
// Yes Clion, we always return -1 here.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantFunctionResult"
auto PythonClassInputDevice::tp_setattro(PythonClassInputDevice* self,
PyObject* attr, PyObject* val) -> int {
BA_PYTHON_TRY;
@ -255,6 +259,8 @@ auto PythonClassInputDevice::tp_setattro(PythonClassInputDevice* self,
BA_PYTHON_INT_CATCH;
}
#pragma clang diagnostic pop
auto PythonClassInputDevice::RemoveRemotePlayerFromGame(
PythonClassInputDevice* self) -> PyObject* {
BA_PYTHON_TRY;

View File

@ -97,6 +97,11 @@ auto PythonClassMaterial::tp_new(PyTypeObject* type, PyObject* args,
PyObject* name_obj = Py_None;
std::string name;
Object::Ref<Material> m;
// Clion incorrectly things s_create_empty will always be false.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantConditionsOC"
if (!s_create_empty_) {
static const char* kwlist[] = {"label", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, keywds, "|O",
@ -119,6 +124,7 @@ auto PythonClassMaterial::tp_new(PyTypeObject* type, PyObject* args,
}
self->material_ = new Object::Ref<Material>(m);
BA_PYTHON_NEW_CATCH;
#pragma clang diagnostic pop
}
return reinterpret_cast<PyObject*>(self);
}
@ -181,6 +187,10 @@ auto PythonClassMaterial::tp_getattro(PythonClassMaterial* self, PyObject* attr)
BA_PYTHON_CATCH;
}
// Yes Clion, we always return -1 here.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantFunctionResult"
auto PythonClassMaterial::tp_setattro(PythonClassMaterial* self, PyObject* attr,
PyObject* val) -> int {
BA_PYTHON_TRY;
@ -195,6 +205,8 @@ auto PythonClassMaterial::tp_setattro(PythonClassMaterial* self, PyObject* attr,
BA_PYTHON_INT_CATCH;
}
#pragma clang diagnostic pop
auto PythonClassMaterial::Dir(PythonClassMaterial* self) -> PyObject* {
BA_PYTHON_TRY;

View File

@ -64,6 +64,10 @@ auto PythonClassModel::tp_new(PyTypeObject* type, PyObject* args,
+ " objects must only be created in the game thread (current is ("
+ GetCurrentThreadName() + ").");
}
// Clion incorrectly things s_create_empty will always be false.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantConditionsOC"
if (!s_create_empty_) {
throw Exception(
"Can't instantiate Models directly; use ba.getmodel() to get "
@ -71,6 +75,7 @@ auto PythonClassModel::tp_new(PyTypeObject* type, PyObject* args,
}
self->model_ = new Object::Ref<Model>();
BA_PYTHON_NEW_CATCH;
#pragma clang diagnostic pop
}
return reinterpret_cast<PyObject*>(self);
}

View File

@ -89,6 +89,9 @@ auto PythonClassNode::tp_new(PyTypeObject* type, PyObject* args,
+ " objects must only be created in the game thread (current is ("
+ GetCurrentThreadName() + ").");
}
// Clion incorrectly things s_create_empty will always be false.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantConditionsOC"
if (!s_create_empty_) {
if (!PyTuple_Check(args) || (PyTuple_GET_SIZE(args) != 1)
|| (keywds != nullptr) || (PyTuple_GET_ITEM(args, 0) != Py_None)) {
@ -99,6 +102,7 @@ auto PythonClassNode::tp_new(PyTypeObject* type, PyObject* args,
}
self->node_ = new Object::WeakRef<Node>();
BA_PYTHON_NEW_CATCH;
#pragma clang diagnostic pop
}
return reinterpret_cast<PyObject*>(self);
}

View File

@ -163,6 +163,10 @@ auto PythonClassSessionPlayer::tp_new(PyTypeObject* type, PyObject* args,
// If the user is creating one, make sure they passed None to get an
// invalid ref.
// Clion incorrectly things s_create_empty will always be false.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantConditionsOC"
if (!s_create_empty_) {
if (!PyTuple_Check(args) || (PyTuple_GET_SIZE(args) != 1)
|| (keywds != nullptr) || (PyTuple_GET_ITEM(args, 0) != Py_None))
@ -172,6 +176,7 @@ auto PythonClassSessionPlayer::tp_new(PyTypeObject* type, PyObject* args,
}
self->player_ = new Object::WeakRef<Player>();
BA_PYTHON_NEW_CATCH;
#pragma clang diagnostic pop
}
return reinterpret_cast<PyObject*>(self);
}

View File

@ -63,6 +63,10 @@ auto PythonClassSound::tp_new(PyTypeObject* type, PyObject* args,
+ " objects must only be created in the game thread (current is ("
+ GetCurrentThreadName() + ").");
}
// Clion incorrectly things s_create_empty will always be false.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantConditionsOC"
if (!s_create_empty_) {
throw Exception(
"Can't instantiate Sounds directly; use ba.getsound() to get "
@ -70,6 +74,7 @@ auto PythonClassSound::tp_new(PyTypeObject* type, PyObject* args,
}
self->sound_ = new Object::Ref<Sound>();
BA_PYTHON_NEW_CATCH;
#pragma clang diagnostic pop
}
return reinterpret_cast<PyObject*>(self);
}

View File

@ -605,6 +605,9 @@ auto PyQuit(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
// A few types get handled specially on android.
if (g_buildconfig.ostype_android()) {
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantConditionsOC"
if (!handled && back) {
// Back-quit simply synthesizes a back press.
// Note to self: I remember this behaved slightly differently than
@ -612,6 +615,9 @@ auto PyQuit(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
g_platform->AndroidSynthesizeBackPress();
handled = true;
}
#pragma clang diagnostic pop
if (!handled && soft) {
// Soft-quit just kills our activity but doesn't run app shutdown.
// Thus we'll be able to spin back up (reset to the main menu)
@ -735,8 +741,6 @@ auto PyEnv(PyObject* self) -> PyObject* {
is_test_build_obj = Py_False;
#endif
bool demo_mode{g_buildconfig.demo_build()};
bool arcade_mode{g_buildconfig.arcade_build()};
bool iircade_mode{g_buildconfig.arcade_build()};
const char* ui_scale;
switch (GetUIScale()) {

View File

@ -709,6 +709,9 @@ auto PyAndroidMediaScanFile(PyObject* self, PyObject* args, PyObject* keywds)
BA_PYTHON_CATCH;
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantFunctionResult"
auto PyAndroidGetExternalStoragePath(PyObject* self, PyObject* args,
PyObject* keywds) -> PyObject* {
BA_PYTHON_TRY;
@ -732,6 +735,7 @@ auto PyAndroidGetExternalStoragePath(PyObject* self, PyObject* args,
Py_RETURN_NONE;
BA_PYTHON_CATCH;
}
#pragma clang diagnostic pop
auto PyAndroidShowWifiSettings(PyObject* self, PyObject* args, PyObject* keywds)
-> PyObject* {

View File

@ -316,7 +316,8 @@ auto PyButtonWidget(PyObject* self, PyObject* args, PyObject* keywds)
#if BA_TEST_BUILD
g_python->TimeFormatCheck(TimeFormat::kSeconds, transition_delay_obj);
#endif
b->set_transition_delay(1000.0f * Python::GetPyFloat(transition_delay_obj));
b->set_transition_delay(static_cast<millisecs_t>(
1000.0f * Python::GetPyFloat(transition_delay_obj)));
}
if (text_res_scale_obj != Py_None) {
b->SetTextResScale(Python::GetPyFloat(text_res_scale_obj));

View File

@ -964,10 +964,10 @@ void Python::Reset(bool do_init) {
throw std::logic_error(
"Error in ba Python bootstrapping. See log for details.");
}
PyObject* appstate =
PythonCommand("_app_state", "<AppStateFetch>").RunReturnObj();
PyObject* appstate = PythonCommand("app_state", "<AppStateFetch>")
.RunReturnObj(false, nullptr);
if (appstate == nullptr) {
throw Exception("Unable to get value: '" + std::string("_app_state")
throw Exception("Unable to get value: '" + std::string("app_state")
+ "'.");
}
SetObj(ObjID::kApp, appstate);
@ -2375,16 +2375,18 @@ void Python::SetObjCallable(ObjID id, PyObject* pyobj, bool incref) {
BA_PRECONDITION(obj(id).CallableCheck());
}
void Python::SetObj(ObjID id, const char* expr) {
PyObject* obj = PythonCommand(expr, "<PyObj Set>").RunReturnObj();
void Python::SetObj(ObjID id, const char* expr, PyObject* context) {
PyObject* obj =
PythonCommand(expr, "<PyObj Set>").RunReturnObj(false, context);
if (obj == nullptr) {
throw Exception("Unable to get value: '" + std::string(expr) + "'.");
}
SetObj(id, obj);
}
void Python::SetObjCallable(ObjID id, const char* expr) {
PyObject* obj = PythonCommand(expr, "<PyObj Set>").RunReturnObj();
void Python::SetObjCallable(ObjID id, const char* expr, PyObject* context) {
PyObject* obj =
PythonCommand(expr, "<PyObj Set>").RunReturnObj(false, context);
if (obj == nullptr) {
throw Exception("Unable to get value: '" + std::string(expr) + "'.");
}

View File

@ -402,11 +402,12 @@ class Python {
void SetObjCallable(ObjID id, PyObject* pyobj, bool incref = false);
/// Set the value for a named object to the result of a Python expression.
void SetObj(ObjID id, const char* expression);
void SetObj(ObjID id, const char* expression, PyObject* context = nullptr);
/// Set the value for a named object to the result of a Python expression
/// and verify that it is callable.
void SetObjCallable(ObjID id, const char* expression);
void SetObjCallable(ObjID id, const char* expression,
PyObject* context = nullptr);
std::set<std::string> do_once_locations_;
PythonRef objs_[static_cast<int>(ObjID::kLast)];

View File

@ -136,10 +136,16 @@ auto PythonCommand::CanEval() -> bool {
return true;
}
auto PythonCommand::RunReturnObj(bool print_errors) -> PyObject* {
auto PythonCommand::RunReturnObj(bool print_errors, PyObject* context)
-> PyObject* {
assert(Python::HaveGIL());
assert(g_python);
assert(!dead_);
if (context == nullptr) {
context = g_python->main_dict();
}
assert(PyDict_Check(context));
if (!eval_code_obj_.get()) {
CompileForEval(print_errors);
assert(!dead_);
@ -164,8 +170,7 @@ auto PythonCommand::RunReturnObj(bool print_errors) -> PyObject* {
return nullptr;
}
PUSH_PYCOMMAND(this);
PyObject* v = PyEval_EvalCode(eval_code_obj_.get(), g_python->main_dict(),
g_python->main_dict());
PyObject* v = PyEval_EvalCode(eval_code_obj_.get(), context, context);
POP_PYCOMMAND();
assert(!dead_);
if (v == nullptr) {

View File

@ -49,7 +49,7 @@ class PythonCommand {
/// Run thecommand and return the result as a new Python reference.
/// Only works for eval-able commands.
/// Returns nullptr on errors, but Python error state will be cleared.
auto RunReturnObj(bool print_errors = false) -> PyObject*;
auto RunReturnObj(bool print_errors, PyObject* context) -> PyObject*;
void LogContext();

View File

@ -51,10 +51,10 @@ auto AnimCurveNode::GetOut() -> float {
}
for (size_t i = 0; i < num; i++) {
if (i == 0) {
input_start_ = times_[i];
input_start_ = static_cast<float>(times_[i]);
}
if (i == (num - 1)) {
input_end_ = times_[i];
input_end_ = static_cast<float>(times_[i]);
}
keyframes_.emplace_back(times_[i], values_[i]);
}
@ -73,7 +73,9 @@ auto AnimCurveNode::GetOut() -> float {
bool got;
if (loop_) {
in_val = fmodf(in_val, (input_end_ - input_start_));
if (in_val < 0) in_val += (input_end_ - input_start_);
if (in_val < 0) {
in_val += (input_end_ - input_start_);
}
got = false;
} else {
if (in_val >= input_end_) {
@ -97,7 +99,7 @@ auto AnimCurveNode::GetOut() -> float {
if (i == keyframes_.end()) {
break;
}
if (i->time < in_val) {
if (static_cast<float>(i->time) < in_val) {
i++;
i1 = i2;
i2 = i;
@ -109,7 +111,7 @@ auto AnimCurveNode::GetOut() -> float {
out_ = i1->value;
} else {
out_ = i1->value
+ ((in_val - i1->time)
+ ((in_val - static_cast<float>(i1->time))
/ static_cast<float>(i2->time - i1->time))
* (i2->value - i1->value);
}

View File

@ -53,10 +53,9 @@ void BombNode::Step() {
dVector3 fuse_tip_pos;
dGeomGetRelPointPos(body_->geom(), 0, (fuse_length_ + kFuseOffset), 0,
fuse_tip_pos);
light_translate_ = fuse_tip_pos;
light_translate_.x += body_->blend_offset().x;
light_translate_.y += body_->blend_offset().y;
light_translate_.z += body_->blend_offset().z;
light_translate_.x = fuse_tip_pos[0] + body_->blend_offset().x;
light_translate_.y = fuse_tip_pos[1] + body_->blend_offset().y;
light_translate_.z = fuse_tip_pos[2] + body_->blend_offset().z;
#if !BA_HEADLESS_BUILD
fuse_.SetTransform(Matrix44fTranslate(0, kFuseOffset * model_scale_, 0)
* body_->GetTransform());

View File

@ -351,10 +351,6 @@ auto GlobalsNode::GetCameraMode() const -> std::string {
return "rotate";
case CameraMode::kFollow:
return "follow";
default:
Log("ERROR: Globals: Unrecognized camera_mode_: "
+ std::to_string(static_cast<int>(camera_mode_)));
return "unknown";
}
}

View File

@ -93,9 +93,6 @@ auto ImageNode::GetAttach() const -> std::string {
return "bottomLeft";
case Attach::CENTER_LEFT:
return "centerLeft";
default:
throw Exception("Invalid attach val in ImageNode "
+ std::to_string(static_cast<int>(attach_)));
}
}

View File

@ -53,9 +53,6 @@ auto LocatorNode::getShape() const -> std::string {
return "circleOutline";
case Shape::kLocator:
return "locator";
default:
throw Exception("Invalid shape val: "
+ std::to_string(static_cast<int>(shape_)));
}
}
@ -125,13 +122,16 @@ void LocatorNode::Draw(FrameDef* frame_def) {
}
bool transparent = false;
if (shape_ == Shape::kCircle || shape_ == Shape::kCircleOutline)
if (shape_ == Shape::kCircle || shape_ == Shape::kCircleOutline) {
transparent = true;
}
// beauty
if (draw_beauty_) {
SimpleComponent c(frame_def->beauty_pass());
if (transparent) c.SetTransparent(true);
if (transparent) {
c.SetTransparent(true);
}
c.SetColor(color_[0], color_[1], color_[2], opacity_);
c.SetTexture(g_media->GetTexture(texture));
c.PushTransform();
@ -146,11 +146,10 @@ void LocatorNode::Draw(FrameDef* frame_def) {
// colored shadow for circle
if (shape_ == Shape::kCircle || shape_ == Shape::kCircleOutline) {
SimpleComponent c(frame_def->light_shadow_pass());
if (transparent) {
c.SetTransparent(true);
if (additive_) {
c.SetPremultiplied(true);
}
assert(transparent);
c.SetTransparent(true);
if (additive_) {
c.SetPremultiplied(true);
}
if (additive_) {
c.SetColor(color_[0] * opacity_, color_[1] * opacity_,

View File

@ -46,9 +46,6 @@ auto MathNode::GetOperation() const -> std::string {
return "divide";
case Operation::kSin:
return "sin";
default:
throw Exception("invalid operation: "
+ std::to_string(static_cast<int>(operation_)));
}
}
@ -102,10 +99,6 @@ auto MathNode::GetOutput() -> std::vector<float> {
}
break;
}
default:
BA_LOG_ONCE("Error: invalid math op in getOutput(): "
+ std::to_string(static_cast<int>(operation_)));
break;
}
return outputs;
}

View File

@ -87,7 +87,8 @@ void NodeAttributeUnbound::DisconnectIncoming(Node* node) {
Object::WeakRef<NodeAttributeConnection> test_ref(a);
#endif
assert(a && a->src_node.exists());
assert(a != nullptr);
assert(a->src_node.exists());
// Remove from src node's outgoing list.
a->src_node->attribute_connections_.erase(a->src_iterator);

View File

@ -135,16 +135,13 @@ void TextNode::SetBig(bool val) {
}
auto TextNode::GetHAlign() const -> std::string {
if (h_align_ == HAlign::kLeft) {
return "left";
} else if (h_align_ == HAlign::kRight) {
return "right";
} else if (h_align_ == HAlign::kCenter) {
return "center";
} else {
BA_LOG_ONCE("Error: Invalid h_align value in text-node: "
+ std::to_string(static_cast<int>(h_align_)));
return "<invalid>";
switch (h_align_) {
case HAlign::kLeft:
return "left";
case HAlign::kRight:
return "right";
case HAlign::kCenter:
return "center";
}
}
@ -162,18 +159,15 @@ void TextNode::SetHAlign(const std::string& val) {
}
auto TextNode::GetVAlign() const -> std::string {
if (v_align_ == VAlign::kTop) {
return "top";
} else if (v_align_ == VAlign::kBottom) {
return "bottom";
} else if (v_align_ == VAlign::kCenter) {
return "center";
} else if (v_align_ == VAlign::kNone) {
return "none";
} else {
BA_LOG_ONCE("Error: Invalid v_align value in text-node: "
+ std::to_string(static_cast<int>(v_align_)));
return "<invalid>";
switch (v_align_) {
case VAlign::kTop:
return "top";
case VAlign::kBottom:
return "bottom";
case VAlign::kCenter:
return "center";
case VAlign::kNone:
return "none";
}
}
@ -193,16 +187,13 @@ void TextNode::SetVAlign(const std::string& val) {
}
auto TextNode::GetHAttach() const -> std::string {
if (h_attach_ == HAttach::kLeft) {
return "left";
} else if (h_attach_ == HAttach::kRight) {
return "right";
} else if (h_attach_ == HAttach::kCenter) {
return "center";
} else {
BA_LOG_ONCE("Error: Invalid h_attach value in text-node: "
+ std::to_string(static_cast<int>(h_attach_)));
return "<invalid>";
switch (h_attach_) {
case HAttach::kLeft:
return "left";
case HAttach::kRight:
return "right";
case HAttach::kCenter:
return "center";
}
}
@ -220,16 +211,13 @@ void TextNode::SetHAttach(const std::string& val) {
}
auto TextNode::GetVAttach() const -> std::string {
if (v_attach_ == VAttach::kTop) {
return "top";
} else if (v_attach_ == VAttach::kBottom) {
return "bottom";
} else if (v_attach_ == VAttach::kCenter) {
return "center";
} else {
BA_LOG_ONCE("Error: Invalid v_attach value in text-node: "
+ std::to_string(static_cast<int>(v_attach_)));
return "<invalid>";
switch (v_attach_) {
case VAttach::kTop:
return "top";
case VAttach::kBottom:
return "bottom";
case VAttach::kCenter:
return "center";
}
}
@ -288,23 +276,27 @@ void TextNode::Update() {
offset_v = 0.0f;
} else {
// Screen space; apply alignment and stuff.
if (h_attach_ == HAttach::kLeft) {
offset_h = 0;
} else if (h_attach_ == HAttach::kRight) {
offset_h = g_graphics->screen_virtual_width();
} else if (h_attach_ == HAttach::kCenter) {
offset_h = g_graphics->screen_virtual_width() / 2;
} else {
throw Exception("invalid h_attach");
switch (h_attach_) {
case HAttach::kLeft:
offset_h = 0;
break;
case HAttach::kRight:
offset_h = g_graphics->screen_virtual_width();
break;
case HAttach::kCenter:
offset_h = g_graphics->screen_virtual_width() / 2;
break;
}
if (v_attach_ == VAttach::kTop) {
offset_v = g_graphics->screen_virtual_height();
} else if (v_attach_ == VAttach::kBottom) {
offset_v = 0;
} else if (v_attach_ == VAttach::kCenter) {
offset_v = g_graphics->screen_virtual_height() / 2;
} else {
throw Exception("invalid v_attach");
switch (v_attach_) {
case VAttach::kTop:
offset_v = g_graphics->screen_virtual_height();
break;
case VAttach::kBottom:
offset_v = 0;
break;
case VAttach::kCenter:
offset_v = g_graphics->screen_virtual_height() / 2;
break;
}
}
position_final_ = position_;
@ -377,8 +369,6 @@ void TextNode::Draw(FrameDef* frame_def) {
case HAlign::kCenter:
h_align = TextMesh::HAlign::kCenter;
break;
default:
throw Exception();
}
TextMesh::VAlign v_align;
@ -395,8 +385,6 @@ void TextNode::Draw(FrameDef* frame_def) {
case VAlign::kBottom:
v_align = TextMesh::VAlign::kBottom;
break;
default:
throw Exception();
}
// update if need be
@ -552,8 +540,6 @@ void TextNode::Draw(FrameDef* frame_def) {
case HAlign::kCenter:
h_align = TextMesh::HAlign::kCenter;
break;
default:
throw Exception();
}
TextMesh::VAlign v_align;
@ -570,8 +556,6 @@ void TextNode::Draw(FrameDef* frame_def) {
case VAlign::kBottom:
v_align = TextMesh::VAlign::kBottom;
break;
default:
throw Exception();
}
// Update if need be.

View File

@ -261,12 +261,17 @@ void Scene::Step() {
void Scene::DeleteNode(Node* node) {
assert(node);
// Clion incorrectly things in_step_ will always be false.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantConditionsOC"
if (in_step_) {
throw Exception(
"Cannot delete nodes within a sim step."
" Consider a deferred call or timer. Node="
+ node->GetObjectDescription());
}
#pragma clang diagnostic pop
// Copy refs to its death-actions and dependent-nodes; we'll deal with these
// after the node is dead so we're sure they don't muck with the node.
@ -341,11 +346,16 @@ auto Scene::NewNode(const std::string& type_string, const std::string& name,
PyObject* delegate) -> Node* {
assert(InGameThread());
// Clion incorrectly things in_step_ will always be false.
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantConditionsOC"
if (in_step_) {
throw Exception(
"Cannot create nodes within a sim step."
" Consider a deferred call or timer.");
}
#pragma clang diagnostic pop
// Should never change the scene while we're stepping it.
assert(!in_step_);

View File

@ -169,7 +169,7 @@ void ButtonWidget::Draw(RenderPass* pass, bool draw_transparent) {
// Simple transition.
millisecs_t transition = (birth_time_ + transition_delay_) - current_time;
if (transition > 0) {
extra_offs_x -= transition * 4.0f;
extra_offs_x -= static_cast<float>(transition) * 4.0f;
}
if (text_width_dirty_) {

View File

@ -72,7 +72,7 @@ struct RootWidget::Button {
float height{30.0f};
float scale{1.0f};
bool selectable{true};
int visibility_mask{};
uint32_t visibility_mask{};
};
// for adding text label decorations to buttons
@ -134,7 +134,7 @@ auto RootWidget::AddCover(float h_align, VAlign v_align, float x, float y,
bd.call = Python::ObjID::kEmptyCall;
bd.visibility_mask =
static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot);
static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot);
// when the user specifies no backing it means they intend to cover the screen
// with a flat-ish window texture.. however this only applies to phone-size;
// for other sizes we always draw a backing.
@ -147,6 +147,9 @@ auto RootWidget::AddCover(float h_align, VAlign v_align, float x, float y,
return b;
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "ConstantParameter"
void RootWidget::AddMeter(float h_align, float x, int type, float r, float g,
float b, bool plus, const std::string& s) {
float yoffs = (GetUIScale() == UIScale::kSmall) ? 0.0f : -7.0f;
@ -231,8 +234,12 @@ void RootWidget::AddMeter(float h_align, float x, int type, float r, float g,
bd.img = "tickets";
bd.call = Python::ObjID::kTicketIconPressCall;
break;
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
default:
break;
#pragma clang diagnostic pop
}
bd.visibility_mask =
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
@ -306,8 +313,12 @@ void RootWidget::AddMeter(float h_align, float x, int type, float r, float g,
}
}
#pragma clang diagnostic pop
void RootWidget::Setup() {
#if BA_TOOLBAR_TEST
if (!explicit_bool(BA_TOOLBAR_TEST)) {
return;
}
// back button
{
@ -324,8 +335,8 @@ void RootWidget::Setup() {
bd.img = "nub";
bd.call = Python::ObjID::kBackButtonPressCall;
bd.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kMenuMinimal)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFull));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuMinimal)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull));
Button* b = back_button_ = AddButton(bd);
// clan
@ -353,11 +364,11 @@ void RootWidget::Setup() {
// }
// if (c) {
// c->visibility_mask |=
// static_cast<int>(Widget::ToolbarVisibility::kMenuCurrency);
// static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuCurrency);
// }
// top bar backing (currency only)
if (false) {
if (explicit_bool(false)) {
ButtonDef bd;
bd.h_align = 0.5f;
bd.v_align = VAlign::kTop;
@ -392,16 +403,16 @@ void RootWidget::Setup() {
bd.call = Python::ObjID::kEmptyCall;
// bd.visibility_mask =
// static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot);
// static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot);
// bd.visibility_mask |=
// static_cast<int>(Widget::ToolbarVisibility::kMenuFull);
// static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull);
bd.visibility_mask |=
static_cast<int>(Widget::ToolbarVisibility::kMenuCurrency);
static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuCurrency);
AddButton(bd);
}
// top bar backing
if (false) {
if (explicit_bool(false)) {
ButtonDef bd;
bd.h_align = 0.5f;
bd.v_align = VAlign::kTop;
@ -413,11 +424,7 @@ void RootWidget::Setup() {
bd.x = 0.0f;
bd.y = -20.0f;
bd.img = "uiAtlas2";
if (GetUIScale() != UIScale::kSmall) {
bd.model_transparent = "toolbarBackingTop2";
} else {
bd.model_transparent = "toolbarBackingTop2";
}
bd.model_transparent = "toolbarBackingTop2";
bd.selectable = false;
bd.color_r = 0.44f;
bd.color_g = 0.41f;
@ -435,11 +442,11 @@ void RootWidget::Setup() {
// bd.call = "";
bd.call = Python::ObjID::kEmptyCall;
bd.visibility_mask =
static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot);
static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot);
bd.visibility_mask |=
static_cast<int>(Widget::ToolbarVisibility::kMenuFull);
static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull);
// bd.visibility_mask |=
// static_cast<int>(Widget::ToolbarVisibility::kMenuCurrency);
// static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuCurrency);
AddButton(bd);
}
@ -466,8 +473,8 @@ void RootWidget::Setup() {
// bd.call = "";
bd.call = Python::ObjID::kEmptyCall;
bd.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
// on desktop, stick this in the top left corner
// if (GetUIScale() == UIScale::kLarge) {
@ -527,12 +534,12 @@ void RootWidget::Setup() {
b.img = "usersButton";
b.call = Python::ObjID::kFriendsButtonPressCall;
b.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kInGame)
| static_cast<int>(Widget::ToolbarVisibility::kMenuMinimal)
| static_cast<int>(Widget::ToolbarVisibility::kMenuMinimalNoBack)
| static_cast<int>(Widget::ToolbarVisibility::kMenuCurrency)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kInGame)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuMinimal)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuMinimalNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuCurrency)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
party_button_ = AddButton(b);
}
@ -551,12 +558,12 @@ void RootWidget::Setup() {
b.color_g = 0.5f;
b.color_b = 0.2f;
b.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kInGame)
| static_cast<int>(Widget::ToolbarVisibility::kMenuMinimal)
| static_cast<int>(Widget::ToolbarVisibility::kMenuMinimalNoBack)
| static_cast<int>(Widget::ToolbarVisibility::kMenuCurrency)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kInGame)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuMinimal)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuMinimalNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuCurrency)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
menu_button_ = AddButton(b);
}
@ -578,8 +585,8 @@ void RootWidget::Setup() {
b.color_b = BOT_LEFT_COLOR_B;
b.img = "logIcon";
b.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
AddButton(b);
}
@ -598,8 +605,8 @@ void RootWidget::Setup() {
b.color_b = BOT_LEFT_COLOR_B;
b.img = "achievementsIcon";
b.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
AddButton(b);
}
@ -618,8 +625,8 @@ void RootWidget::Setup() {
b.color_b = BOT_LEFT_COLOR_B;
b.img = "leaderboardsIcon";
b.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
AddButton(b);
}
@ -638,8 +645,8 @@ void RootWidget::Setup() {
b.color_b = BOT_LEFT_COLOR_B;
b.img = "settingsIcon";
b.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
settings_button_ = AddButton(b);
}
@ -682,11 +689,7 @@ void RootWidget::Setup() {
bd.x = 0.0f;
bd.y = 41.0f;
bd.img = "uiAtlas2";
if (GetUIScale() != UIScale::kSmall) {
bd.model_transparent = "toolbarBackingBottom2";
} else {
bd.model_transparent = "toolbarBackingBottom2";
}
bd.model_transparent = "toolbarBackingBottom2";
bd.selectable = false;
bd.color_r = backingR;
bd.color_g = backingG;
@ -697,9 +700,9 @@ void RootWidget::Setup() {
// bd.call = "";
bd.call = Python::ObjID::kEmptyCall;
bd.visibility_mask =
static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot);
static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot);
bd.visibility_mask |=
static_cast<int>(Widget::ToolbarVisibility::kMenuFull);
static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull);
AddButton(bd);
}
@ -713,8 +716,8 @@ void RootWidget::Setup() {
b.img = "chestIcon";
b.depth_min = 0.3f;
b.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
float spacing = 110.0f;
b.x = -2.0f * spacing;
AddButton(b);
@ -756,7 +759,7 @@ void RootWidget::Setup() {
// b.y = b.height * 0.5f + 10;
// b.img = "settingsIcon";
// b.visibility_mask =
// (static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
// (static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
// |
// static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
// AddButton(b);
@ -772,8 +775,8 @@ void RootWidget::Setup() {
b.y = b.height * 0.5f;
b.img = "storeIcon";
b.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
AddButton(b);
}
@ -787,13 +790,11 @@ void RootWidget::Setup() {
b.y = b.height * 0.45f;
b.img = "inventoryIcon";
b.visibility_mask =
(static_cast<int>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
AddButton(b);
}
#endif // BA_TOOLBAR_TEST
UpdateForFocusedWindow(nullptr);
}
@ -802,8 +803,9 @@ void RootWidget::Draw(RenderPass* pass, bool transparent) {
// motion.
if (!transparent) {
millisecs_t current_time = pass->frame_def()->base_time();
float time_diff = std::min(millisecs_t{100}, current_time - update_time_);
StepPositions(time_diff);
millisecs_t time_diff =
std::min(millisecs_t{100}, current_time - update_time_);
StepPositions(static_cast<float>(time_diff));
update_time_ = current_time;
}
ContainerWidget::Draw(pass, transparent);
@ -1099,9 +1101,9 @@ void RootWidget::SetScreenWidget(StackWidget* w) {
void RootWidget::SetOverlayWidget(StackWidget* w) {
// this needs to happen after our buttons and things get added..
#if BA_TOOLBAR_TEST
assert(!buttons_.empty());
#endif // BA_TOOLBAR_TEST
if (explicit_bool(BA_TOOLBAR_TEST)) {
assert(!buttons_.empty());
}
AddWidget(w);
overlay_stack_widget_ = w;
}

View File

@ -141,7 +141,7 @@ def _ballistica_bootstrap() -> object:
return app
_app_state = _ballistica_bootstrap()
app_state = _ballistica_bootstrap()
# This code runs in the main namespace, so clean up after ourself.
del _ballistica_bootstrap, TYPE_CHECKING

View File

@ -80,7 +80,7 @@ def gen_binding_code(projroot: str, in_path: str, out_path: str) -> None:
# Then it grabs the function that was defined and runs it.
ccode += ('PyObject* bindvals = PythonCommand("get_binding_values()",'
' "<get_binding_values>")'
'.RunReturnObj(true);\n'
'.RunReturnObj(true, nullptr);\n'
'if (bindvals == nullptr) {\n'
' // Use a standard error to avoid a useless stack trace.\n'
' throw std::logic_error("Error binding required Python'

View File

@ -811,7 +811,7 @@ def check_clioncode(projroot: Path, full: bool, verbose: bool) -> None:
cachepath = Path('.cache/check_clioncode')
filenames = get_code_filenames(projroot)
clionroot = Path('/Applications/CLion.app')
clionbin = Path(clionroot, 'Contents/MacOS/clion')
# clionbin = Path(clionroot, 'Contents/MacOS/clion')
inspect = Path(clionroot, 'Contents/bin/inspect.sh')
# At the moment offline clion inspections seem a bit flaky.
@ -821,43 +821,59 @@ def check_clioncode(projroot: Path, full: bool, verbose: bool) -> None:
# So for now let's try blowing away caches, launching the gui
# temporarily, and then kicking off inspections after that. Sigh.
print('Clearing CLion caches...', flush=True)
subprocess.run('rm -rf ~/Library/Caches/CLion*', shell=True, check=True)
caches_root = os.environ['HOME'] + '/Library/Caches/JetBrains'
if not os.path.exists(caches_root):
raise RuntimeError(f'CLion caches root not found: {caches_root}')
subprocess.run('rm -rf ~/Library/Caches/JetBrains/CLion*',
shell=True,
check=True)
# UPDATE: seems this is unnecessary now; should double check.
# Note: I'm assuming this project needs to be open when the GUI
# comes up. Currently just have one project so can rely on auto-open
# but may need to get fancier later if that changes.
if bool(False):
if bool(True):
print('Launching GUI CLion to rebuild caches...', flush=True)
process = subprocess.Popen(str(clionbin))
# process = subprocess.Popen(str(clionbin))
subprocess.run(
['open', '-a', clionroot,
Path(projroot, 'ballisticacore-cmake')],
check=True)
# Wait a moment and ask it nicely to die.
waittime = 120
waittime = 60
while waittime > 0:
print(f'Waiting for {waittime} more seconds.')
print(f'Waiting for {waittime} more seconds.', flush=True)
time.sleep(10)
waittime -= 10
# Seems killing it via applescript is more likely to leave it
# in a working state for offline inspections than TERM signal..
subprocess.run("osascript -e 'tell application \"CLion\" to quit'",
shell=True,
check=False)
# For some reason this is giving a return-code 1 although
# it appears to be working.
print('Waiting for GUI CLion to quit...', flush=True)
subprocess.run(
[
'osascript', '-e', 'tell application "CLion" to quit\n'
'repeat until application "CLion" is not running\n'
' delay 1\n'
'end repeat'
],
check=False,
)
time.sleep(5)
# process.terminate()
print('Waiting for GUI CLion to quit...', flush=True)
process.wait(timeout=60)
# process.wait(timeout=60)
print('Launching Offline CLion to run inspections...', flush=True)
_run_idea_inspections_cached(
cachepath=cachepath,
filenames=filenames,
full=full,
projroot=Path(projroot, 'ballisticacore-cmake'),
inspectdir=Path(projroot, 'ballisticacore-cmake/src/ballistica'),
displayname='CLion',
inspect=inspect,
verbose=verbose)
_run_idea_inspections_cached(cachepath=cachepath,
filenames=filenames,
full=full,
projroot=Path(projroot,
'ballisticacore-cmake'),
inspectdir=Path(projroot, 'src/ballistica'),
displayname='CLion',
inspect=inspect,
verbose=verbose)
def check_android_studio(projroot: Path, full: bool, verbose: bool) -> None: