version 1.4 | | version 1.5 |
---|
| | |
/* | | /* |
* static char *rcsid_decor_ = | | * static char *rcsid_decor_ = |
* "$Id: decor.c,v 1.4 2000/06/19 01:34:31 cvs Exp $"; | | * "$Id: decor.c,v 1.5 2000/12/15 03:09:19 peterm Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
#include <global.h> | | #include <global.h> |
#include <random_map.h> | | #include <random_map.h> |
| | #include <rproto.h> |
| | |
#define NR_DECOR_OPTIONS 1 | | #define NR_DECOR_OPTIONS 1 |
| | |
| | |
} | | } |
/* put the decor into the map. Right now, it's very primitive. */ | | /* put the decor into the map. Right now, it's very primitive. */ |
| | |
void put_decor(mapstruct *map,char **maze,char *decorstyle,int decor_option) { | | void put_decor(mapstruct *map,char **maze,char *decorstyle,int decor_option,RMParms *RP) { |
mapstruct *decor_map; | | mapstruct *decor_map; |
char style_name[256]; | | char style_name[256]; |
| | |
| | |
case 0: break; | | case 0: break; |
case 1: /* random placement of decor objects. */ | | case 1: /* random placement of decor objects. */ |
{ | | { |
int number_to_place = RANDOM() % ( (Xsize *Ysize) / 5); | | int number_to_place = RANDOM() % ( (RP->Xsize *RP->Ysize) / 5); |
int failures=0; | | int failures=0; |
object *new_decor_object; | | object *new_decor_object; |
while(failures < 100 && number_to_place > 0) { | | while(failures < 100 && number_to_place > 0) { |
int x,y; | | int x,y; |
x = RANDOM() % (Xsize-2) +1; | | x = RANDOM() % (RP->Xsize-2) +1; |
y = RANDOM() % (Ysize-2) +1; | | y = RANDOM() % (RP->Ysize-2) +1; |
if(maze[x][y]==0 && obj_count_in_map(map,x,y)<2) /* empty */ | | if(maze[x][y]==0 && obj_count_in_map(map,x,y)<2) /* empty */ |
{ | | { |
object *this_object; | | object *this_object; |
| | |
default: /* place decor objects everywhere: tile the map. */ | | default: /* place decor objects everywhere: tile the map. */ |
{ | | { |
int i,j; | | int i,j; |
for(i=1;i<Xsize-1;i++) for(j=1;j<Ysize-1;j++) { | | for(i=1;i<RP->Xsize-1;i++) for(j=1;j<RP->Ysize-1;j++) { |
if(maze[i][j]==0) { | | if(maze[i][j]==0) { |
object *new_decor_object, *this_object; | | object *new_decor_object, *this_object; |
| | |