diff --git a/animations/config.in b/animations/config.in index 2369f48..d873666 100644 --- a/animations/config.in +++ b/animations/config.in @@ -8,7 +8,7 @@ comment "Animations" dep_bool "Feuer" ANIMATION_FEUER $RANDOM_SUPPORT dep_bool "Matrix" ANIMATION_MATRIX $RANDOM_SUPPORT dep_bool "Random Bright" ANIMATION_RANDOM_BRIGHT $RANDOM_SUPPORT - dep_bool "Stonefly" ANIMATION_STONEFLY $RANDOM_SUPPORT $GAME_TETRIS_CORE + dep_bool "Stonefly" ANIMATION_STONEFLY $GAME_TETRIS_CORE dep_bool "Flying Dots" ANIMATION_FLYINGDOTS $RANDOM_SUPPORT dep_bool "Game of Life" ANIMATION_GAMEOFLIFE $RANDOM_SUPPORT dep_bool "Breakout Demo" ANIMATION_BREAKOUT $GAME_BREAKOUT diff --git a/animations/stonefly.c b/animations/stonefly.c index a9154dc..4a6e898 100644 --- a/animations/stonefly.c +++ b/animations/stonefly.c @@ -7,6 +7,14 @@ #include "../games/tetris/piece.h" #include "../util.h" + +#ifdef RANDOM_SUPPORT + #define RANDOM8() random8() +#else + #define RANDOM8() rand() +#endif + + #define MAX_STONES 8 #define YSCALE 2 //y axis is scaled up, this allows for YSCALE different falling speeds @@ -46,17 +54,17 @@ static void create_stone(stone_t *stone) //random x //4 is piece width - stone->x = random8() % (NUM_COLS - 4); + stone->x = RANDOM8() % (NUM_COLS - 4); //random shape at random angle (untyped enums rock! yay!) - stone->piece.shape = random8() % 7; - stone->piece.angle = random8() % 4; + stone->piece.shape = RANDOM8() % 7; + stone->piece.angle = RANDOM8() % 4; //chose a random speed from 1-2 - stone->speed = (random8() % YSCALE) + 1; + stone->speed = (RANDOM8() % YSCALE) + 1; //chose a random color - stone->color = (random8() % NUMPLANE) + 1; + stone->color = (RANDOM8() % NUMPLANE) + 1; } @@ -196,16 +204,16 @@ void stonefly(void) //if there are less than max_stones flying, there's a chance to spawn one if((stoneCount < MAX_STONES) && (counter > 0)) { - if(random8() < 48) + if((RANDOM8() % (UINT8_MAX + 1)) < 48) { create_stone(&stones[stoneCount++]); } //invasion time!!! - if((random8() < 8) && (invasion == 0)) + if((RANDOM8() < 8) && (invasion == 0)) { //9 is invader width - invax = random8() % (NUM_COLS - 9); + invax = RANDOM8() % (NUM_COLS - 9); invay = 0; invasion = 1; } diff --git a/games/config.in b/games/config.in index 72d2a84..731004d 100644 --- a/games/config.in +++ b/games/config.in @@ -1,6 +1,6 @@ mainmenu_option next_comment comment "Games" - dep_bool_menu "Tetris" GAME_TETRIS_CORE y $JOYSTICK_SUPPORT $RANDOM_SUPPORT + dep_bool_menu "Tetris" GAME_TETRIS_CORE y $JOYSTICK_SUPPORT dep_bool "Standard Tetris" GAME_TETRIS $GAME_TETRIS_CORE dep_bool "Bastard Tetris" GAME_BASTET $GAME_TETRIS_CORE dep_bool "First Person Tetris" GAME_TETRIS_FP $GAME_TETRIS_CORE