Fixed a Windows compatibility.

drand48 isn't available on Windows, so I replaced it with a custom
"DRAND" definition.
This commit is contained in:
onpon4 2017-02-01 09:19:12 -05:00
parent 22e59a80db
commit fd6949120e
2 changed files with 4 additions and 3 deletions

View File

@ -403,8 +403,8 @@ void cutscene_init(int scene)
{ {
explosion_addEngine(&aliens[i]); explosion_addEngine(&aliens[i]);
if (scene == 0 && i > 0 && (timer % 15) == i) { if (scene == 0 && i > 0 && (timer % 15) == i) {
aliens[i].dx += (drand48() - 0.5) * 0.1; aliens[i].dx += (DRAND - 0.5) * 0.1;
aliens[i].dy += (drand48() - 0.5) * 0.1; aliens[i].dy += (DRAND - 0.5) * 0.1;
if (aliens[i].x > 500 - timer) if (aliens[i].x > 500 - timer)
aliens[i].dx -= 0.2; aliens[i].dx -= 0.2;
if (aliens[i].x < 0) if (aliens[i].x < 0)

View File

@ -1,7 +1,7 @@
/* /*
Copyright (C) 2003 Parallel Realities Copyright (C) 2003 Parallel Realities
Copyright (C) 2011, 2012 Guus Sliepen Copyright (C) 2011, 2012 Guus Sliepen
Copyright (C) 2012, 2015, 2016 Julie Marchant <onpon4@riseup.net> Copyright (C) 2012, 2015-2017 Julie Marchant <onpon4@riseup.net>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
((x) + (y) > (b) ? ((a) - (b)) : 0)) ((x) + (y) > (b) ? ((a) - (b)) : 0))
#define CHANCE(x) ((rand() % RAND_MAX) < ((x) * RAND_MAX)) #define CHANCE(x) ((rand() % RAND_MAX) < ((x) * RAND_MAX))
#define RANDRANGE(x, y) (((x) < (y)) ? ((x) + (rand() % (long)(1 + (y) - (x)))) : (x)) #define RANDRANGE(x, y) (((x) < (y)) ? ((x) + (rand() % (long)(1 + (y) - (x)))) : (x))
#define DRAND ((double)rand() / RAND_MAX)
// Compile-time options // Compile-time options