X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_bd%2Fbd_caveobject.c;h=57bc963c320a58d1e9dd1ff145e4482007ccd6d5;hb=dec4d0bad52cff4f2fab1385d01b9f65347bd552;hp=568d2b3a793c966d9d67e04317a664851221b9c6;hpb=45b6628e4a1d3bf3bea5fdca794af788ceabd053;p=rocksndiamonds.git diff --git a/src/game_bd/bd_caveobject.c b/src/game_bd/bd_caveobject.c index 568d2b3a..57bc963c 100644 --- a/src/game_bd/bd_caveobject.c +++ b/src/game_bd/bd_caveobject.c @@ -14,9 +14,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include -#include - #include "main_bd.h" @@ -163,7 +160,7 @@ GdObject *gd_object_new_floodfill_replace(GdObjectLevels levels, int x1, int y1, GdObject *gd_object_new_maze(GdObjectLevels levels, int x1, int y1, int x2, int y2, int wall_w, int path_w, GdElement wall_e, GdElement path_e, - int horiz_percent, const gint32 seed[5]) + int horiz_percent, const int seed[5]) { int i; GdObject *newobj = checked_calloc(sizeof(GdObject)); @@ -188,7 +185,7 @@ GdObject *gd_object_new_maze(GdObjectLevels levels, int x1, int y1, int x2, int GdObject *gd_object_new_maze_unicursal(GdObjectLevels levels, int x1, int y1, int x2, int y2, int wall_w, int path_w, GdElement wall_e, GdElement path_e, - int horiz_percent, const gint32 seed[5]) + int horiz_percent, const int seed[5]) { int i; GdObject *newobj = checked_calloc(sizeof(GdObject)); @@ -213,7 +210,7 @@ GdObject *gd_object_new_maze_unicursal(GdObjectLevels levels, int x1, int y1, in GdObject *gd_object_new_maze_braid(GdObjectLevels levels, int x1, int y1, int x2, int y2, int wall_w, int path_w, GdElement wall_e, GdElement path_e, - int horiz_percent, const gint32 seed[5]) + int horiz_percent, const int seed[5]) { int i; GdObject *newobj = checked_calloc(sizeof(GdObject)); @@ -237,8 +234,8 @@ GdObject *gd_object_new_maze_braid(GdObjectLevels levels, int x1, int y1, int x2 } GdObject *gd_object_new_random_fill(GdObjectLevels levels, int x1, int y1, int x2, int y2, - const gint32 seed[5], GdElement initial, - const GdElement random[4], const gint32 prob[4], + const int seed[5], GdElement initial, + const GdElement random[4], const int prob[4], GdElement replace_only, boolean c64) { int i; @@ -823,7 +820,7 @@ static void draw_join(GdCave *cave, const GdObject *object) /* create a maze in a boolean **maze. */ /* recursive algorithm. */ -static void mazegen(GRand *rand, boolean **maze, int width, int height, int x, int y, int horiz) +static void mazegen(GdRand *rand, boolean **maze, int width, int height, int x, int y, int horiz) { int dirmask = 15; @@ -833,7 +830,7 @@ static void mazegen(GRand *rand, boolean **maze, int width, int height, int x, i int dir; /* horiz or vert */ - dir = g_rand_int_range(rand, 0, 100) y2; int w, h, path, wall; int xk, yk; - GRand *rand; + GdRand *rand; int i,j; /* change coordinates if not in correct order */ @@ -1023,8 +1020,8 @@ static void draw_maze(GdCave *cave, const GdObject *object, int level) /* start generation, if map is big enough. otherwise the application would crash, as the editor places maze objects during mouse click & drag that have no sense */ - rand = g_rand_new_with_seed(object->seed[level] == -1 ? - g_rand_int(cave->random) : object->seed[level]); + rand = gd_rand_new_with_seed(object->seed[level] == -1 ? + gd_rand_int(cave->random) : object->seed[level]); if (w >= 1 && h >= 1) mazegen(rand, map, w, h, 0, 0, object->horiz); @@ -1032,7 +1029,7 @@ static void draw_maze(GdCave *cave, const GdObject *object, int level) if (object->type == GD_MAZE_BRAID) braidmaze(rand, map, w, h); - g_rand_free(rand); + gd_rand_free(rand); if (w >= 1 && h >= 1 && object->type == GD_MAZE_UNICURSAL) { @@ -1137,17 +1134,17 @@ static void draw_random_fill(GdCave *cave, const GdObject *object, int level) int y1 = object->y1; int x2 = object->x2; int y2 = object->y2; - GRand *rand; + GdRand *rand; GdC64RandomGenerator c64_rand; - guint32 seed; + unsigned int seed; /* -1 means that it should be different every time played. */ if (object->seed[level] == -1) - seed = g_rand_int(cave->random); + seed = gd_rand_int(cave->random); else seed = object->seed[level]; - rand = g_rand_new_with_seed(seed); + rand = gd_rand_new_with_seed(seed); /* for c64 random, use the 2*8 lsb. */ gd_c64_random_set_seed(&c64_rand, seed / 256 % 256, seed % 256); @@ -1178,7 +1175,7 @@ static void draw_random_fill(GdCave *cave, const GdObject *object, int level) randm = gd_c64_random(&c64_rand); else /* use the much better glib random generator */ - randm = g_rand_int_range(rand, 0, 256); + randm = gd_rand_int_range(rand, 0, 256); element = object->fill_element; if (randm < object->random_fill_probability[0]) @@ -1196,7 +1193,7 @@ static void draw_random_fill(GdCave *cave, const GdObject *object, int level) } } - g_rand_free(rand); + gd_rand_free(rand); } @@ -1316,7 +1313,7 @@ void gd_cave_draw_object(GdCave *cave, const GdObject *object, int level) } /* load cave to play... also can be called rendering the cave elements */ -GdCave *gd_cave_new_rendered(const GdCave *data, const int level, const guint32 seed) +GdCave *gd_cave_new_rendered(const GdCave *data, const int level, const unsigned int seed) { GdCave *cave; GdElement element; @@ -1328,10 +1325,10 @@ GdCave *gd_cave_new_rendered(const GdCave *data, const int level, const guint32 cave->rendered = level + 1; cave->render_seed = seed; - cave->random = g_rand_new_with_seed(cave->render_seed); + cave->random = gd_rand_new_with_seed(cave->render_seed); /* maps needed during drawing and gameplay */ - cave->objects_order = gd_cave_map_new(cave, gpointer); + cave->objects_order = gd_cave_map_new(cave, void *); cave->time = data->level_time[level]; cave->timevalue = data->level_timevalue[level]; @@ -1356,8 +1353,8 @@ GdCave *gd_cave_new_rendered(const GdCave *data, const int level, const guint32 /* IF CAVE HAS NO MAP, USE THE RANDOM NUMBER GENERATOR */ /* init c64 randomgenerator */ if (data->level_rand[level] < 0) - gd_cave_c64_random_set_seed(cave, g_rand_int_range(cave->random, 0, 256), - g_rand_int_range(cave->random, 0, 256)); + gd_cave_c64_random_set_seed(cave, gd_rand_int_range(cave->random, 0, 256), + gd_rand_int_range(cave->random, 0, 256)); else gd_cave_c64_random_set_seed(cave, 0, data->level_rand[level]); @@ -1374,7 +1371,7 @@ GdCave *gd_cave_new_rendered(const GdCave *data, const int level, const guint32 if (data->level_rand[level] < 0) /* use the much better glib random generator */ - randm = g_rand_int_range(cave->random, 0, 256); + randm = gd_rand_int_range(cave->random, 0, 256); else /* use c64 */ randm = gd_cave_c64_random(cave);