Fix Pipboy screensaver on non-Windows platforms

Closes #115
This commit is contained in:
Alexander Batalov 2022-08-06 22:46:13 +03:00
parent 25e07fb597
commit a47918a83c
1 changed files with 5 additions and 4 deletions

View File

@ -60,6 +60,7 @@
#define PIPBOY_WINDOW_CONTENT_VIEW_HEIGHT (410)
#define PIPBOY_IDLE_TIMEOUT (120000)
#define PIPBOY_RAND_MAX (32767)
#define PIPBOY_BOMB_COUNT (16)
@ -2227,10 +2228,10 @@ static int pipboyRenderScreensaver()
break;
}
double random = randomBetween(0, RAND_MAX);
double random = randomBetween(0, PIPBOY_RAND_MAX);
// TODO: Figure out what this constant means. Probably somehow related
// to RAND_MAX.
// to PIPBOY_RAND_MAX.
if (random < 3047.3311) {
int index = 0;
for (; index < PIPBOY_BOMB_COUNT; index += 1) {
@ -2242,7 +2243,7 @@ static int pipboyRenderScreensaver()
if (index < PIPBOY_BOMB_COUNT) {
PipboyBomb* bomb = &(bombs[index]);
int v27 = (350 - gPipboyFrmSizes[PIPBOY_FRM_BOMB].width / 4) + (406 - gPipboyFrmSizes[PIPBOY_FRM_BOMB].height / 4);
int v5 = (int)((double)randomBetween(0, RAND_MAX) / (double)RAND_MAX * (double)v27);
int v5 = (int)((double)randomBetween(0, PIPBOY_RAND_MAX) / (double)PIPBOY_RAND_MAX * (double)v27);
int v6 = gPipboyFrmSizes[PIPBOY_FRM_BOMB].height / 4;
if (PIPBOY_WINDOW_CONTENT_VIEW_HEIGHT - v6 >= v5) {
bomb->x = 602;
@ -2253,7 +2254,7 @@ static int pipboyRenderScreensaver()
}
bomb->field_10 = 1;
bomb->field_8 = (float)((double)randomBetween(0, RAND_MAX) * (2.75 / RAND_MAX) + 0.15);
bomb->field_8 = (float)((double)randomBetween(0, PIPBOY_RAND_MAX) * (2.75 / PIPBOY_RAND_MAX) + 0.15);
bomb->field_C = 0;
}
}