some patches and fixes

origin
stpohle 19 years ago
parent 58beeca25a
commit b40f928476

@ -1,5 +1,15 @@
$Id: ChangeLog,v 1.106 2006/02/06 21:17:59 stpohle Exp $ $Id: ChangeLog,v 1.107 2006/07/30 11:44:57 stpohle Exp $
Version 0.11.7 (still in progress) Version 0.11.7 (still in progress)
- Fixed: Security Problem found by Stefan Cornelius.
For more information look here:
https://lists.uni-koeln.de/pipermail/sec-info/Week-of-Mon-20060313/006561.html
- Added: "more random" by Patrik Nilsson:
This map type is just a hacked version of "autogenerated",
and is as the name tells more random. Since both block,
rock and nothing are placed randomly inside the border.
- Fixed: High CPU usage in menus. - Fixed: High CPU usage in menus.
This fix was made by Chris E.. This fix was made by Chris E..

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.33 2005/07/06 13:11:55 stpohle Exp $ */ /* $Id: basic.h,v 1.34 2006/07/30 11:44:57 stpohle Exp $ */
/* basic types which we need everywhere */ /* basic types which we need everywhere */
#ifndef _BC_BASIC_H_ #ifndef _BC_BASIC_H_
@ -164,7 +164,8 @@ enum _direction { // to handle directions better
enum _mapselection { enum _mapselection {
MAPS_select = 0, MAPS_select = 0,
MAPS_randmap, MAPS_randmap,
MAPS_randgen MAPS_randgen,
MAPS_morerand
}; };
enum _mstatus { enum _mstatus {

@ -1,4 +1,4 @@
/* $Id: map.h,v 1.15 2004/02/08 01:34:46 stpohle Exp $ */ /* $Id: map.h,v 1.16 2006/07/30 11:44:57 stpohle Exp $ */
/* map.h */ /* map.h */
#ifndef _MAP_H_ #ifndef _MAP_H_
@ -83,6 +83,7 @@ extern void mapgamesetting ();
// map.c // map.c
extern void map_random (); extern void map_random ();
extern void map_genrandom (); extern void map_genrandom ();
extern void map_genmorerandom ();
extern void init_map_tileset(); extern void init_map_tileset();
extern void map_new (char *filename); extern void map_new (char *filename);
extern void map_load (FILE * fmap); extern void map_load (FILE * fmap);

@ -1,4 +1,4 @@
/* $Id: map.c,v 1.26 2004/04/03 14:48:43 stpohle Exp $ */ /* $Id: map.c,v 1.27 2006/07/30 11:44:57 stpohle Exp $ */
/* map handling, like generate and load maps. */ /* map handling, like generate and load maps. */
#include "bomberclone.h" #include "bomberclone.h"
@ -60,8 +60,12 @@ map_new (char *filename)
// Clean and create the field // // Clean and create the field //
if (fmap == NULL) if (fmap == NULL)
map_genrandom (); map_genrandom ();
/* Generate a More random map if requested */
if (map.map_selection == MAPS_morerand)
map_genmorerandom();
if (map.type == -1) if (map.type == -1)
map.type = s_random (MAPT_max); map.type = s_random (MAPT_max);
@ -197,6 +201,54 @@ map_genrandom ()
// map_ensure_corner_start_points(); // map_ensure_corner_start_points();
} }
void
map_genmorerandom ()
{
int x,
y,
d,
ra;
/* This is an enhanced version of genrandom() used by "more random" */
d_printf("genmorerandom: *** init ***\n");
/* if we can't load the map check first the fieldsize settings */
if (map.size.x < MIN_FIELDSIZE_X)
map.size.x = MIN_FIELDSIZE_X;
if (map.size.x > MAX_FIELDSIZE_X)
map.size.x = MAX_FIELDSIZE_X;
for (x = 0; x < map.size.x; x++)
for (y = 0; y < map.size.y; y++) {
if ((y == 0) || (y == map.size.y - 1))
map.field[x][y].type = FT_block;
else if ((x == 0) || (x == map.size.x - 1))
map.field[x][y].type = FT_block;
else {
// create random field
ra = s_random (256) & 3;
d_printf("genmorerandom: ra = %i\n", ra);
if (ra == 0)
map.field[x][y].type = FT_nothing;
else if (ra == 1)
map.field[x][y].type = FT_block;
else
map.field[x][y].type = FT_stone;
}
for (d = 0; d < 4; d++)
map.field[x][y].ex[d].frame = map.field[x][y].ex[d].count = 0;
map.field[x][y].ex_nr = -1;
map.field[x][y].frame = 0.0f;
map.field[x][y].special = FT_nothing;
}
d_printf("genmorerandom: *** exit ***\n");
/* set the corners of the map to be valid start points */
// map_ensure_corner_start_points();
}
/* will set the playerposition but in a way that we won't start on a block */ /* will set the playerposition but in a way that we won't start on a block */
/* i am just too lazy to write this all again and again */ /* i am just too lazy to write this all again and again */
@ -265,6 +317,8 @@ init_map_tileset ()
break; break;
case (2): case (2):
map_new (NULL); map_new (NULL);
case (3):
map_new (NULL); /* for more random */
break; break;
} }
if (map.random_tileset) if (map.random_tileset)

@ -1,4 +1,4 @@
/* $Id: mapmenu.c,v 1.26 2005/08/07 17:46:21 stpohle Exp $ */ /* $Id: mapmenu.c,v 1.27 2006/07/30 11:44:58 stpohle Exp $ */
/* map/tileset selection menu */ /* map/tileset selection menu */
#include "bomberclone.h" #include "bomberclone.h"
@ -14,7 +14,8 @@ mapmenu ()
_charlist maptypes[] = { _charlist maptypes[] = {
{"selected file", NULL}, {"selected file", NULL},
{"random file", NULL}, {"random file", NULL},
{"autogenerated", NULL} {"autogenerated", NULL},
{"more random", NULL}
}, tiletypes[] = { }, tiletypes[] = {
{ {
"random"}, { "random"}, {
@ -27,7 +28,7 @@ mapmenu ()
char mname[100]; char mname[100];
_menu *menu; _menu *menu;
charlist_fillarraypointer (maptypes, 3); charlist_fillarraypointer (maptypes, 4);
charlist_fillarraypointer (tiletypes, 2); charlist_fillarraypointer (tiletypes, 2);
charlist_fillarraypointer (tunneltypes, 3); charlist_fillarraypointer (tunneltypes, 3);
@ -52,6 +53,12 @@ mapmenu ()
menu_create_entry (menu, "X Size:", 20, 160, 120, &map.size.x, MAX_FIELDSIZE_X, MENU_entryint16, 2); menu_create_entry (menu, "X Size:", 20, 160, 120, &map.size.x, MAX_FIELDSIZE_X, MENU_entryint16, 2);
menu_create_entry (menu, "Y Size:", 20, 180, 120, &map.size.y, MAX_FIELDSIZE_Y, MENU_entryint16, 3); menu_create_entry (menu, "Y Size:", 20, 180, 120, &map.size.y, MAX_FIELDSIZE_Y, MENU_entryint16, 3);
break; break;
case (MAPS_morerand): // More Random
selmt = charlist_findtext (maptypes, "more random");
d_printf ("more random\n");
menu_create_entry (menu, "X Size:", 20, 160, 120, &map.size.x, MAX_FIELDSIZE_X, MENU_entryint16, 2);
menu_create_entry (menu, "Y Size:", 20, 180, 120, &map.size.y, MAX_FIELDSIZE_Y, MENU_entryint16, 3);
break;
} }
if (map.random_tileset) if (map.random_tileset)
selts = &tiletypes[0]; selts = &tiletypes[0];

Loading…
Cancel
Save