mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-24 07:53:30 +08:00
Added guards against invalid precalc rand access
This commit is contained in:
parent
443814fefd
commit
8abed4d461
@ -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/71/4a/57093a4dcd015962a1a6b5b5445c",
|
||||
"build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b3/ca/afc9114024f9eace77d92a4f58d3",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/29/35/5e6c98d1082f21df1f8464304f2e",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/21/fc/91edc2dd43b5590475e89126b0ef",
|
||||
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c8/02/91db6909ac1ae066863f736e0e4f",
|
||||
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/ac/37/0fecba7ab0879a97a6db0f25397e",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6e/45/ad8007e0409154f1d86222aa7cf3",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4c/3e/ec9440531bcb7740dcb0f619aaf4",
|
||||
"build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/57/75/945a9b017f520a31717b33c08756",
|
||||
"build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b2/4a/a728e62c4b4b917dd50ed7fe6b3d",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/55/df/1b594e5da2cbbf9af5baaf8e1c2e",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9c/44/e337b62e35664ba68c5280113563",
|
||||
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f7/4a/0913e44a567b3382e83cf3cc974b",
|
||||
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/4b/6c/099af5c8a20dd5ff6f705aeffe56",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/33/f4/29f5c9f40cc459a1ff9b2f590831",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cd/f5/b18f0af9516828418d1a6b52cfed",
|
||||
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/c1/22/f0e4b6ca115b54caeb3db91cebba",
|
||||
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/9f/ee/7ca526bc4b5c5bb6f3a11225b93c",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/b0/bc/1b3edecc7f84e968c6e4f37d684f",
|
||||
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/9c/77/8b85643ae7e78b60953b3a6d4a05",
|
||||
"build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3e/ed/4bfd68ab3ff6a6fbcb45118506a2",
|
||||
"build/prefab/full/linux_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b0/d7/24342e98d034071f2b7e758f6ad3",
|
||||
"build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/15/b9/283697524fd145a82d07896cb103",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/28/55/bf5c45962c2546e3ee3ab29699a5",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2e/55/9d88c3f8b2f81dadd71556a5f5a9",
|
||||
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c0/58/8c56ef4020936c0b038a3e97989c",
|
||||
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/76/c3/dc3b86bb4808f62b5cb1b52869ca",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cf/95/f90763272edcfdeff466869b7b1b",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b3/c9/8142691865cbadfe9aa5f877ab0d",
|
||||
"build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b5/c0/950b9a835cfe61e57ce3e75151e4",
|
||||
"build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/93/56/582749266831fb8c4e1d2350ae39",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/72/5d/bcab78126983ce1effc042961f3a",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/22/05/369c8aeb1df2840d4196ad721d23",
|
||||
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/41/1e/dcc3596268cccfadbf3bdde83f96",
|
||||
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c4/ca/4aaa4497be67887dae3299f99bf7",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/89/e1/5767f709124f71b2ba54f5ba120f",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3c/87/19a4d5ccc73507a54911b5e0a44c",
|
||||
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/44/b2/129b5e75753e1a3e540d5ec6147b",
|
||||
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/5d/71/0e16a0cbbe894122b34a7ea90547",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/25/4b/ff892aed0e05ef23f2d63b4356ba",
|
||||
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/f3/de/5d8129e6c294ec8390067688f401",
|
||||
"build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8c/39/85f77a12d141db9af737df376913",
|
||||
"build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a1/a1/3b82daf3a84bfaf3d64d166cac3a",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/92/ee/9b3a93adf75e2e540a5b2a7be1da",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7a/fc/38e48816e9d9cd64baebbb30deb6",
|
||||
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b7/2d/82d4dc9c175bbf68a88944ac2c78",
|
||||
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/99/ce/1661bd6ec468f937ef451bfac3af",
|
||||
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a7/f5/c1e90eff3b8f02fa812f89bf66fe",
|
||||
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/02/49/3b28ad61d548c23e6780c4f88bed",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ba/80/5a4776dcadf74874fd2ba2937207",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/07/99/9f5c09f44372348c267fb39ddd05",
|
||||
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/63/83/0ffe340483547e20baa8fd1293b9",
|
||||
"build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1e/cd/d10a7156e2b2b79f26e41a002f99",
|
||||
"build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a0/21/804895588f97a69efdc86742fca7",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d9/50/a416353a80b1bae135e5cbd76a92",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/05/c3/cdc1a7c27ed0fe4c036ce629a33b",
|
||||
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/57/b8/3adfff8172e1d3c8785d83fca55f",
|
||||
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/75/f8/ec9fbd64c72c9da0cbab206f1ed6",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4e/f1/76d9bb8017b9ada36cd065698c4a",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e2/b8/8bf21c62f2b5f620f26662f6d966"
|
||||
"build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a5/a1/ca42c662cac3c6285cbcc2c7885b",
|
||||
"build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e6/b3/91da761495aa2303d1b0e5b02094",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1b/f2/b4eb460cee9f2e75c94c61dd0e24",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/52/ff/637bbb859b4ccc73f34f7a77903f",
|
||||
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/78/c981aaec70ca0072587506509c62",
|
||||
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/33/96/d1755c352b6cbf7921e145f651e7",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/64/0f/b4560263bce797949caa824d11cd",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/50/16/62b4e23c92d31a053913f450a302"
|
||||
}
|
||||
4
.idea/dictionaries/ericf.xml
generated
4
.idea/dictionaries/ericf.xml
generated
@ -711,6 +711,7 @@
|
||||
<w>feedparser</w>
|
||||
<w>ffaeff</w>
|
||||
<w>ffap</w>
|
||||
<w>fflush</w>
|
||||
<w>fhash</w>
|
||||
<w>fhashes</w>
|
||||
<w>fhdr</w>
|
||||
@ -1334,6 +1335,7 @@
|
||||
<w>modutils</w>
|
||||
<w>moola</w>
|
||||
<w>mopaque</w>
|
||||
<w>moreso</w>
|
||||
<w>mpath</w>
|
||||
<w>mrmaxmeier</w>
|
||||
<w>msbuild</w>
|
||||
@ -2194,6 +2196,7 @@
|
||||
<w>timemin</w>
|
||||
<w>timeremaining</w>
|
||||
<w>timestep</w>
|
||||
<w>timesteps</w>
|
||||
<w>timestring</w>
|
||||
<w>timestrval</w>
|
||||
<w>timetype</w>
|
||||
@ -2279,6 +2282,7 @@
|
||||
<w>uname</w>
|
||||
<w>unbounds</w>
|
||||
<w>uncollectible</w>
|
||||
<w>underruns</w>
|
||||
<w>unforunate</w>
|
||||
<w>unimported</w>
|
||||
<w>uninferrable</w>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.6.0 (20308)
|
||||
### 1.6.0 (20326)
|
||||
- Revamped netcode significantly. We still don't have client-prediction, but things should (hopefully) feel much lower latency now.
|
||||
- Added network debug graphs accessible by hitting F8.
|
||||
- Added private parties functionality (cloud hosted parties with associated codes making it easier to play with friends)
|
||||
@ -15,6 +15,7 @@
|
||||
- Binary -cfgdir option now properly allows any path, not just './ba_root'.
|
||||
- Additional server-wrapper options such as disabling auto-restart and automatic restarts on config file changes.
|
||||
- Running a `_ba.connect_to_party` command via the -exec arg should now do the right thing.
|
||||
- Fixed possible crash due to buffer under/overruns in `Utils::precalc_rands_*`.
|
||||
|
||||
### 1.5.29 (20246)
|
||||
- Exposed ba method/class initing in public C++ layer.
|
||||
|
||||
@ -313,6 +313,7 @@
|
||||
<w>ffffff</w>
|
||||
<w>fffffff</w>
|
||||
<w>fffffffffifff</w>
|
||||
<w>fflush</w>
|
||||
<w>fgets</w>
|
||||
<w>fieldname</w>
|
||||
<w>fieldpath</w>
|
||||
@ -567,6 +568,7 @@
|
||||
<w>modelview</w>
|
||||
<w>moduletype</w>
|
||||
<w>momemtary</w>
|
||||
<w>moreso</w>
|
||||
<w>mqrspec</w>
|
||||
<w>msaa</w>
|
||||
<w>mult</w>
|
||||
@ -671,6 +673,7 @@
|
||||
<w>ostype</w>
|
||||
<w>ourself</w>
|
||||
<w>ourstanding</w>
|
||||
<w>outpath</w>
|
||||
<w>outputter</w>
|
||||
<w>outval</w>
|
||||
<w>outvalue</w>
|
||||
@ -930,6 +933,7 @@
|
||||
<w>timeformat</w>
|
||||
<w>timerlist</w>
|
||||
<w>timestep</w>
|
||||
<w>timesteps</w>
|
||||
<w>timetype</w>
|
||||
<w>timetypes</w>
|
||||
<w>tmpmat</w>
|
||||
@ -966,6 +970,7 @@
|
||||
<w>uncas</w>
|
||||
<w>unchecking</w>
|
||||
<w>underrun</w>
|
||||
<w>underruns</w>
|
||||
<w>unformatted</w>
|
||||
<w>unichar</w>
|
||||
<w>unichars</w>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
namespace ballistica {
|
||||
|
||||
// These are set automatically via script; don't change here.
|
||||
const int kAppBuildNumber = 20326;
|
||||
const int kAppBuildNumber = 20327;
|
||||
const char* kAppVersion = "1.6.0";
|
||||
|
||||
// Our standalone globals.
|
||||
|
||||
@ -31,7 +31,7 @@ namespace ballistica {
|
||||
#endif
|
||||
|
||||
#if USE_BAKED_RANDS
|
||||
float Utils::precalc_rands_1[kPrecalcRandsCount] = {
|
||||
float Utils::precalc_rands_1_[kPrecalcRandsCount] = {
|
||||
0.00424972f, 0.0470216f, 0.545227f, 0.538243f, 0.214183f, 0.627205f,
|
||||
0.194698f, 0.917583f, 0.468622f, 0.0779965f, 0.304211f, 0.773231f,
|
||||
0.522742f, 0.378898f, 0.404598f, 0.468434f, 0.081512f, 0.408348f,
|
||||
@ -54,7 +54,7 @@ float Utils::precalc_rands_1[kPrecalcRandsCount] = {
|
||||
0.0674501f, 0.000782927f, 0.607129f, 0.116035f, 0.67095f, 0.692934f,
|
||||
0.276618f, 0.137535f, 0.771033f, 0.278625f, 0.686023f, 0.873823f,
|
||||
0.254666f, 0.75378f};
|
||||
float Utils::precalc_rands_2[kPrecalcRandsCount] = {
|
||||
float Utils::precalc_rands_2_[kPrecalcRandsCount] = {
|
||||
0.425019f, 0.29261f, 0.623541f, 0.241628f, 0.772656f, 0.434116f,
|
||||
0.295335f, 0.814317f, 0.122326f, 0.887651f, 0.873536f, 0.692463f,
|
||||
0.730894f, 0.142115f, 0.0722184f, 0.977652f, 0.971393f, 0.111517f,
|
||||
@ -77,7 +77,7 @@ float Utils::precalc_rands_2[kPrecalcRandsCount] = {
|
||||
0.634341f, 0.158655f, 0.0157559f, 0.195268f, 0.663882f, 0.148622f,
|
||||
0.118159f, 0.552174f, 0.757064f, 0.854851f, 0.991449f, 0.349681f,
|
||||
0.17858f, 0.774876f};
|
||||
float Utils::precalc_rands_3[kPrecalcRandsCount] = {
|
||||
float Utils::precalc_rands_3_[kPrecalcRandsCount] = {
|
||||
0.29369f, 0.894838f, 0.857948f, 0.04309f, 0.0296678f, 0.180115f,
|
||||
0.694884f, 0.227017f, 0.936936f, 0.746493f, 0.511976f, 0.231185f,
|
||||
0.1333f, 0.524805f, 0.774586f, 0.395971f, 0.206664f, 0.274414f,
|
||||
@ -101,9 +101,9 @@ float Utils::precalc_rands_3[kPrecalcRandsCount] = {
|
||||
0.895885f, 0.391311f, 0.976098f, 0.473118f, 0.286659f, 0.0946781f,
|
||||
0.402437f, 0.347471f};
|
||||
#else // USE_BAKED_RANDS
|
||||
float Utils::precalc_rands_1[kPrecalcRandsCount];
|
||||
float Utils::precalc_rands_2[kPrecalcRandsCount];
|
||||
float Utils::precalc_rands_3[kPrecalcRandsCount];
|
||||
float Utils::precalc_rands_1_[kPrecalcRandsCount];
|
||||
float Utils::precalc_rands_2_[kPrecalcRandsCount];
|
||||
float Utils::precalc_rands_3_[kPrecalcRandsCount];
|
||||
#endif // USE_BAKED_RANDS
|
||||
|
||||
Utils::Utils() {
|
||||
@ -149,9 +149,9 @@ Utils::Utils() {
|
||||
#else
|
||||
// set up our precalculated rand vals
|
||||
for (int i = 0; i < kPrecalcRandsCount; i++) {
|
||||
precalc_rands_1[i] = static_cast<float>(rand()) / RAND_MAX; // NOLINT
|
||||
precalc_rands_2[i] = static_cast<float>(rand()) / RAND_MAX; // NOLINT
|
||||
precalc_rands_3[i] = static_cast<float>(rand()) / RAND_MAX; // NOLINT
|
||||
precalc_rands_1_[i] = static_cast<float>(rand()) / RAND_MAX; // NOLINT
|
||||
precalc_rands_2_[i] = static_cast<float>(rand()) / RAND_MAX; // NOLINT
|
||||
precalc_rands_3_[i] = static_cast<float>(rand()) / RAND_MAX; // NOLINT
|
||||
}
|
||||
#endif
|
||||
huffman_ = std::make_unique<Huffman>();
|
||||
|
||||
@ -337,11 +337,23 @@ class Utils {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Simple lists of pre-calculated random values between 0 and 1
|
||||
/// (with no particular distribution)
|
||||
static float precalc_rands_1[];
|
||||
static float precalc_rands_2[];
|
||||
static float precalc_rands_3[];
|
||||
// Simple lists of pre-calculated random values between 0 and 1
|
||||
// (with no particular distribution)
|
||||
static float precalc_rand_1(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < kPrecalcRandsCount);
|
||||
return precalc_rands_1_[index];
|
||||
}
|
||||
static float precalc_rand_2(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < kPrecalcRandsCount);
|
||||
return precalc_rands_2_[index];
|
||||
}
|
||||
static float precalc_rand_3(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < kPrecalcRandsCount);
|
||||
return precalc_rands_3_[index];
|
||||
}
|
||||
auto huffman() -> Huffman* { return huffman_.get(); }
|
||||
|
||||
// FIXME - move to a nice math-y place
|
||||
@ -358,6 +370,9 @@ class Utils {
|
||||
}
|
||||
|
||||
private:
|
||||
static float precalc_rands_1_[];
|
||||
static float precalc_rands_2_[];
|
||||
static float precalc_rands_3_[];
|
||||
std::unique_ptr<Huffman> huffman_;
|
||||
};
|
||||
|
||||
|
||||
@ -650,16 +650,16 @@ void Camera::Update(millisecs_t elapsed) {
|
||||
if (!IsVRMode()) {
|
||||
smooth_speed_.x += elapsed * rand_component
|
||||
* (-0.5f
|
||||
+ Utils::precalc_rands_1[(real_time / rand_incr_1)
|
||||
% kPrecalcRandsCount]);
|
||||
+ Utils::precalc_rand_1((real_time / rand_incr_1)
|
||||
% kPrecalcRandsCount));
|
||||
smooth_speed_.y += elapsed * rand_component
|
||||
* (-0.5f
|
||||
+ Utils::precalc_rands_2[(real_time / rand_incr_2)
|
||||
% kPrecalcRandsCount]);
|
||||
+ Utils::precalc_rand_2((real_time / rand_incr_2)
|
||||
% kPrecalcRandsCount));
|
||||
smooth_speed_.z += elapsed * rand_component
|
||||
* (-0.5f
|
||||
+ Utils::precalc_rands_3[(real_time / rand_incr_3)
|
||||
% kPrecalcRandsCount]);
|
||||
+ Utils::precalc_rand_3((real_time / rand_incr_3)
|
||||
% kPrecalcRandsCount));
|
||||
}
|
||||
|
||||
if (RandomFloat() < 0.1f && !IsVRMode()) {
|
||||
@ -706,18 +706,18 @@ void Camera::Update(millisecs_t elapsed) {
|
||||
// Jostle the camera occasionally if we're shaking.
|
||||
if (i % iterations == 0 && shake_amount_ > 0.0001f) {
|
||||
shake_amount_ *= 0.97f;
|
||||
shake_vel_.x += 0.05f * shake_amount_
|
||||
* (0.5f
|
||||
- Utils::precalc_rands_1[real_time % 122 * i
|
||||
% kPrecalcRandsCount]);
|
||||
shake_vel_.y += 0.05f * shake_amount_
|
||||
* (0.5f
|
||||
- Utils::precalc_rands_2[real_time % 323 * i
|
||||
% kPrecalcRandsCount]);
|
||||
shake_vel_.x +=
|
||||
0.05f * shake_amount_
|
||||
* (0.5f
|
||||
- Utils::precalc_rand_1(real_time % 122 * i % kPrecalcRandsCount));
|
||||
shake_vel_.y +=
|
||||
0.05f * shake_amount_
|
||||
* (0.5f
|
||||
- Utils::precalc_rand_2(real_time % 323 * i % kPrecalcRandsCount));
|
||||
shake_vel_.z +=
|
||||
0.05f * shake_amount_
|
||||
* (0.5f
|
||||
- Utils::precalc_rands_3[real_time % 76 * i % kPrecalcRandsCount]);
|
||||
- Utils::precalc_rand_3(real_time % 76 * i % kPrecalcRandsCount));
|
||||
}
|
||||
|
||||
for (int j = 0; j < iterations; j++) {
|
||||
|
||||
@ -96,9 +96,9 @@ void NetGraph::Draw(RenderPass* pass, double time, double x, double y, double w,
|
||||
VertexSimpleFull* v = vertex_buffer->elements.data();
|
||||
for (auto&& s : impl_->samples) {
|
||||
double t = s.first;
|
||||
double val = s.second;
|
||||
double sval = s.second;
|
||||
double vx = x + w * ((t - t_left) / t_width);
|
||||
double vy = y + h * ((val - v_bottom) / v_height);
|
||||
double vy = y + h * ((sval - v_bottom) / v_height);
|
||||
v->position[0] = static_cast<float>(vx);
|
||||
v->position[1] = static_cast<float>(y);
|
||||
v->position[2] = 0.0f;
|
||||
|
||||
@ -616,13 +616,13 @@ void FlagNode::UpdateFlagMesh() {
|
||||
if (explicit_bool(do_wind)) {
|
||||
flag_velocities_[top_right].x +=
|
||||
wind_vec.x * kWindStrength
|
||||
* (Utils::precalc_rands_1[wind_rand_ % kPrecalcRandsCount] - 0.3f);
|
||||
* (Utils::precalc_rand_1(wind_rand_ % kPrecalcRandsCount) - 0.3f);
|
||||
flag_velocities_[top_right].y +=
|
||||
wind_vec.y * kWindStrength
|
||||
* (Utils::precalc_rands_2[wind_rand_ % kPrecalcRandsCount] - 0.3f);
|
||||
* (Utils::precalc_rand_2(wind_rand_ % kPrecalcRandsCount) - 0.3f);
|
||||
flag_velocities_[top_right].z +=
|
||||
wind_vec.z * kWindStrength
|
||||
* (Utils::precalc_rands_3[wind_rand_ % kPrecalcRandsCount] - 0.3f);
|
||||
* (Utils::precalc_rand_3(wind_rand_ % kPrecalcRandsCount) - 0.3f);
|
||||
}
|
||||
UpdateSpringPoint(top_left, top_right, kFlagCanvasScaleX);
|
||||
UpdateSpringPoint(bot_left, bot_right, kFlagCanvasScaleX);
|
||||
|
||||
@ -314,8 +314,8 @@ void PropNode::SetBody(const std::string& val) {
|
||||
int64_t gti = scene()->stepnum();
|
||||
dQFromAxisAndAngle(
|
||||
iq, 0.05f, 1, 0,
|
||||
Utils::precalc_rands_1[(stream_id() + gti) % kPrecalcRandsCount]
|
||||
* 360.0f * (kPi / 180.0f));
|
||||
Utils::precalc_rand_1((stream_id() + gti) % kPrecalcRandsCount) * 360.0f
|
||||
* (kPi / 180.0f));
|
||||
dBodySetQuaternion(body_->body(), iq);
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ void ScorchNode::Draw(FrameDef* frame_def) {
|
||||
c.Translate(position_[0], position_[1], position_[2]);
|
||||
c.Scale(o * size_ * rand_size_[0], o * size_ * rand_size_[1],
|
||||
o * size_ * rand_size_[2]);
|
||||
c.Rotate(Utils::precalc_rands_1[id() % kPrecalcRandsCount] * 360.0f, 0, 1, 0);
|
||||
c.Rotate(Utils::precalc_rand_1(id() % kPrecalcRandsCount) * 360.0f, 0, 1, 0);
|
||||
c.DrawModel(g_media->GetModel(SystemModelID::kScorch));
|
||||
c.PopTransform();
|
||||
c.Submit();
|
||||
|
||||
@ -243,12 +243,12 @@ void ShieldNode::Draw(FrameDef* frame_def) {
|
||||
c.MultMatrix((om * m).m);
|
||||
float s = radius_ * 0.53f;
|
||||
c.Scale(s, s, s);
|
||||
c.Rotate(Utils::precalc_rands_1[rot_count_ % kPrecalcRandsCount] * 360, 0,
|
||||
1, 0);
|
||||
c.Rotate(Utils::precalc_rand_1(rot_count_ % kPrecalcRandsCount) * 360, 0, 1,
|
||||
0);
|
||||
float r2 =
|
||||
r_scale_
|
||||
* (0.97f
|
||||
+ 0.05f * Utils::precalc_rands_2[rot_count_ % kPrecalcRandsCount]);
|
||||
+ 0.05f * Utils::precalc_rand_2(rot_count_ % kPrecalcRandsCount));
|
||||
c.Scale(r2, r2, r2);
|
||||
c.DrawModel(g_media->GetModel(SystemModelID::kShield),
|
||||
kModelDrawFlagNoReflection);
|
||||
@ -261,8 +261,8 @@ void ShieldNode::Draw(FrameDef* frame_def) {
|
||||
c2.PushTransform();
|
||||
c2.MultMatrix((om * m).m);
|
||||
c2.Scale(s, s, s);
|
||||
c2.Rotate(Utils::precalc_rands_1[rot_count_ % kPrecalcRandsCount] * 360,
|
||||
0, 1, 0);
|
||||
c2.Rotate(Utils::precalc_rand_1(rot_count_ % kPrecalcRandsCount) * 360, 0,
|
||||
1, 0);
|
||||
c2.Scale(r2, r2, r2);
|
||||
c2.DrawModel(g_media->GetModel(SystemModelID::kShield));
|
||||
c2.PopTransform();
|
||||
@ -274,8 +274,8 @@ void ShieldNode::Draw(FrameDef* frame_def) {
|
||||
c2.PushTransform();
|
||||
c2.MultMatrix((om * m).m);
|
||||
c2.Scale(s, s, s);
|
||||
c2.Rotate(Utils::precalc_rands_1[rot_count_ % kPrecalcRandsCount] * 360,
|
||||
0, 1, 0);
|
||||
c2.Rotate(Utils::precalc_rand_1(rot_count_ % kPrecalcRandsCount) * 360, 0,
|
||||
1, 0);
|
||||
float sc = r2 * 1.1f;
|
||||
c2.Scale(sc, sc, sc);
|
||||
c2.DrawModel(g_media->GetModel(SystemModelID::kShield));
|
||||
|
||||
@ -3057,8 +3057,8 @@ void SpazNode::Step() {
|
||||
// 0,1,0,
|
||||
// std::max(-0.5f,std::min(0.5f,a_vel_y_smoothed_more_*-0.07f)));
|
||||
} else if (gti % 30 == 0
|
||||
&& Utils::precalc_rands_1[(gti + stream_id() * 3 + 143)
|
||||
% kPrecalcRandsCount]
|
||||
&& Utils::precalc_rand_1((gti + stream_id() * 3 + 143)
|
||||
% kPrecalcRandsCount)
|
||||
> 0.9f) {
|
||||
// otherwise, look around occasionally..
|
||||
// else if (getScene()->stepnum()%30 == 0 and
|
||||
@ -3069,17 +3069,17 @@ void SpazNode::Step() {
|
||||
head_turning = true;
|
||||
dQFromAxisAndAngle(
|
||||
neck_joint_->qrel,
|
||||
Utils::precalc_rands_1[(stream_id() - gti)
|
||||
% (kPrecalcRandsCount - 3)]
|
||||
Utils::precalc_rand_1((stream_id() + gti)
|
||||
% (kPrecalcRandsCount - 3))
|
||||
* 0.05f,
|
||||
Utils::precalc_rands_2[(stream_id() + 42 * gti)
|
||||
% kPrecalcRandsCount],
|
||||
Utils::precalc_rands_3[(stream_id() + 3 * gti)
|
||||
% (kPrecalcRandsCount - 1)]
|
||||
Utils::precalc_rand_2((stream_id() + 42 * gti)
|
||||
% kPrecalcRandsCount),
|
||||
Utils::precalc_rand_3((stream_id() + 3 * gti)
|
||||
% (kPrecalcRandsCount - 1))
|
||||
* 0.05f,
|
||||
1.5f
|
||||
* (Utils::precalc_rands_2[(stream_id() + gti)
|
||||
% kPrecalcRandsCount]
|
||||
* (Utils::precalc_rand_2((stream_id() + gti)
|
||||
% kPrecalcRandsCount)
|
||||
- 0.5f));
|
||||
// dQFromAxisAndAngle(neck_joint_->qrel,
|
||||
// RandomFloat()*0.05f,
|
||||
@ -6190,7 +6190,7 @@ void SpazNode::SetShattered(int val) {
|
||||
shatter_lower = 0.6f;
|
||||
} else if (last_hit_was_punch_) {
|
||||
// Punches mostly take heads off or break torsos in half.
|
||||
if (Utils::precalc_rands_2[(stream_id() * 31 + 112) % kPrecalcRandsCount]
|
||||
if (Utils::precalc_rand_2((stream_id() * 31 + 112) % kPrecalcRandsCount)
|
||||
> 0.3f) {
|
||||
shatter_neck = 0.9f;
|
||||
shatter_pelvis = 0.1f;
|
||||
@ -6210,24 +6210,24 @@ void SpazNode::SetShattered(int val) {
|
||||
// in kid-friendly mode, don't shatter anything..
|
||||
if (explicit_bool(true)) {
|
||||
float rand1 =
|
||||
Utils::precalc_rands_1[(stream_id() * 3 + 1) % kPrecalcRandsCount];
|
||||
Utils::precalc_rand_1((stream_id() * 3 + 1) % kPrecalcRandsCount);
|
||||
float rand2 =
|
||||
Utils::precalc_rands_2[(stream_id() * 2 + 111) % kPrecalcRandsCount];
|
||||
Utils::precalc_rand_2((stream_id() * 2 + 111) % kPrecalcRandsCount);
|
||||
float rand3 =
|
||||
Utils::precalc_rands_3[(stream_id() * 4 + 7) % kPrecalcRandsCount];
|
||||
Utils::precalc_rand_3((stream_id() * 4 + 7) % kPrecalcRandsCount);
|
||||
float rand4 =
|
||||
Utils::precalc_rands_1[(stream_id() * 7 + 78) % kPrecalcRandsCount];
|
||||
float rand5 = Utils::precalc_rands_3[(stream_id()) % kPrecalcRandsCount];
|
||||
Utils::precalc_rand_1((stream_id() * 7 + 78) % kPrecalcRandsCount);
|
||||
float rand5 = Utils::precalc_rand_3((stream_id()) % kPrecalcRandsCount);
|
||||
float rand6 =
|
||||
Utils::precalc_rands_2[(stream_id() / 2 + 17) % kPrecalcRandsCount];
|
||||
Utils::precalc_rand_2((stream_id() / 2 + 17) % kPrecalcRandsCount);
|
||||
float rand7 =
|
||||
Utils::precalc_rands_1[(stream_id() * 10) % kPrecalcRandsCount];
|
||||
Utils::precalc_rand_1((stream_id() * 10) % kPrecalcRandsCount);
|
||||
float rand8 =
|
||||
Utils::precalc_rands_3[(stream_id() * 17 + 2) % kPrecalcRandsCount];
|
||||
Utils::precalc_rand_3((stream_id() * 17 + 2) % kPrecalcRandsCount);
|
||||
float rand9 =
|
||||
Utils::precalc_rands_2[(stream_id() * 13 + 22) % kPrecalcRandsCount];
|
||||
Utils::precalc_rand_2((stream_id() * 13 + 22) % kPrecalcRandsCount);
|
||||
float rand10 =
|
||||
Utils::precalc_rands_2[(stream_id() + 19) % kPrecalcRandsCount];
|
||||
Utils::precalc_rand_2((stream_id() + 19) % kPrecalcRandsCount);
|
||||
|
||||
// Head/mid-torso are most common losses.
|
||||
if (rand1 < shatter_neck) shatter_damage_ |= kNeckJointBroken;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user