ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/treasure.C
(Generate patch)

Comparing deliantra/server/random_maps/treasure.C (file contents):
Revision 1.10 by root, Wed Dec 20 09:14:22 2006 UTC vs.
Revision 1.11 by root, Sat Dec 30 18:45:28 2006 UTC

67treasure style (may be empty or NULL, or "none" to cause no treasure.) 67treasure style (may be empty or NULL, or "none" to cause no treasure.)
68treasureoptions (may be 0 for random choices or positive) 68treasureoptions (may be 0 for random choices or positive)
69*/ 69*/
70 70
71void 71void
72place_treasure (maptile *map, char **layout, char *treasure_style, int treasureoptions, RMParms * RP) 72place_treasure (maptile *map, char **layout, char *treasure_style, int treasureoptions, random_map_params * RP)
73{ 73{
74 char styledirname[256]; 74 char styledirname[256];
75 char stylefilepath[256]; 75 char stylefilepath[256];
76 maptile *style_map = 0; 76 maptile *style_map = 0;
77 int num_treasures; 77 int num_treasures;
113 { 113 {
114 114
115 /* map_layout_style global, and is previously set */ 115 /* map_layout_style global, and is previously set */
116 switch (RP->map_layout_style) 116 switch (RP->map_layout_style)
117 { 117 {
118 case ONION_LAYOUT: 118 case LAYOUT_ONION:
119 case SPIRAL_LAYOUT: 119 case LAYOUT_SPIRAL:
120 case SQUARE_SPIRAL_LAYOUT: 120 case LAYOUT_SQUARE_SPIRAL:
121 { 121 {
122 int i, j; 122 int i, j;
123 123
124 /* search the onion for C's or '>', and put treasure there. */ 124 /* search the onion for C's or '>', and put treasure there. */
125 for (i = 0; i < RP->Xsize; i++) 125 for (i = 0; i < RP->Xsize; i++)
198/* put a chest into the map, near x and y, with the treasure style 198/* put a chest into the map, near x and y, with the treasure style
199 determined (may be null, or may be a treasure list from lib/treasures, 199 determined (may be null, or may be a treasure list from lib/treasures,
200 if the global variable "treasurestyle" is set to that treasure list's name */ 200 if the global variable "treasurestyle" is set to that treasure list's name */
201 201
202object * 202object *
203place_chest (int treasureoptions, int x, int y, maptile *map, maptile *style_map, int n_treasures, RMParms * RP) 203place_chest (int treasureoptions, int x, int y, maptile *map, maptile *style_map, int n_treasures, random_map_params * RP)
204{ 204{
205 object *the_chest; 205 object *the_chest;
206 int i, xl, yl; 206 int i, xl, yl;
207 207
208 the_chest = get_archetype ("chest"); /* was "chest_2" */ 208 the_chest = get_archetype ("chest"); /* was "chest_2" */
297 297
298 298
299/* finds the closest monster and returns him, regardless of doors 299/* finds the closest monster and returns him, regardless of doors
300 or walls */ 300 or walls */
301object * 301object *
302find_closest_monster (maptile *map, int x, int y, RMParms * RP) 302find_closest_monster (maptile *map, int x, int y, random_map_params * RP)
303{ 303{
304 int i; 304 int i;
305 305
306 for (i = 0; i < SIZEOFFREE; i++) 306 for (i = 0; i < SIZEOFFREE; i++)
307 { 307 {
336 The idea is that you call keyplace on x,y where a door is, and it'll make 336 The idea is that you call keyplace on x,y where a door is, and it'll make
337 sure a key is placed on both sides of the door. 337 sure a key is placed on both sides of the door.
338*/ 338*/
339 339
340int 340int
341keyplace (maptile *map, int x, int y, char *keycode, int door_flag, int n_keys, RMParms * RP) 341keyplace (maptile *map, int x, int y, char *keycode, int door_flag, int n_keys, random_map_params * RP)
342{ 342{
343 int i, j; 343 int i, j;
344 int kx, ky; 344 int kx, ky;
345 object *the_keymaster; /* the monster that gets the key. */ 345 object *the_keymaster; /* the monster that gets the key. */
346 object *the_key; 346 object *the_key;
432 432
433/* a recursive routine which will return a monster, eventually,if there is one. 433/* a recursive routine which will return a monster, eventually,if there is one.
434 it does a check-off on the layout, converting 0's to 1's */ 434 it does a check-off on the layout, converting 0's to 1's */
435 435
436object * 436object *
437find_monster_in_room_recursive (char **layout, maptile *map, int x, int y, RMParms * RP) 437find_monster_in_room_recursive (char **layout, maptile *map, int x, int y, random_map_params * RP)
438{ 438{
439 int i, j; 439 int i, j;
440 440
441 /* if we've found a monster already, leave */ 441 /* if we've found a monster already, leave */
442 if (theMonsterToFind != NULL) 442 if (theMonsterToFind != NULL)
479 479
480/* sets up some data structures: the _recursive form does the 480/* sets up some data structures: the _recursive form does the
481 real work. */ 481 real work. */
482 482
483object * 483object *
484find_monster_in_room (maptile *map, int x, int y, RMParms * RP) 484find_monster_in_room (maptile *map, int x, int y, random_map_params * RP)
485{ 485{
486 char **layout2; 486 char **layout2;
487 int i, j; 487 int i, j;
488 488
489 theMonsterToFind = 0; 489 theMonsterToFind = 0;
521/* the workhorse routine, which finds the free spots in a room: 521/* the workhorse routine, which finds the free spots in a room:
522a datastructure of free points is set up, and a position chosen from 522a datastructure of free points is set up, and a position chosen from
523that datastructure. */ 523that datastructure. */
524 524
525void 525void
526find_spot_in_room_recursive (char **layout, int x, int y, RMParms * RP) 526find_spot_in_room_recursive (char **layout, int x, int y, random_map_params * RP)
527{ 527{
528 int i, j; 528 int i, j;
529 529
530 /* bounds check x and y */ 530 /* bounds check x and y */
531 if (!(x >= 0 && y >= 0 && x < RP->Xsize && y < RP->Ysize)) 531 if (!(x >= 0 && y >= 0 && x < RP->Xsize && y < RP->Ysize))
550 550
551} 551}
552 552
553/* find a random non-blocked spot in this room to drop a key. */ 553/* find a random non-blocked spot in this room to drop a key. */
554void 554void
555find_spot_in_room (maptile *map, int x, int y, int *kx, int *ky, RMParms * RP) 555find_spot_in_room (maptile *map, int x, int y, int *kx, int *ky, random_map_params * RP)
556{ 556{
557 char **layout2; 557 char **layout2;
558 int i, j; 558 int i, j;
559 559
560 number_of_free_spots_in_room = 0; 560 number_of_free_spots_in_room = 0;
597/* searches the map for a spot with walls around it. The more 597/* searches the map for a spot with walls around it. The more
598 walls the better, but it'll settle for 1 wall, or even 0, but 598 walls the better, but it'll settle for 1 wall, or even 0, but
599 it'll return 0 if no FREE spots are found.*/ 599 it'll return 0 if no FREE spots are found.*/
600 600
601void 601void
602find_enclosed_spot (maptile *map, int *cx, int *cy, RMParms * RP) 602find_enclosed_spot (maptile *map, int *cx, int *cy, random_map_params * RP)
603{ 603{
604 int x, y; 604 int x, y;
605 int i; 605 int i;
606 606
607 x = *cx; 607 x = *cx;
748} 748}
749 749
750 750
751/* the workhorse routine, which finds the doors in a room */ 751/* the workhorse routine, which finds the doors in a room */
752void 752void
753find_doors_in_room_recursive (char **layout, maptile *map, int x, int y, object **doorlist, int *ndoors, RMParms * RP) 753find_doors_in_room_recursive (char **layout, maptile *map, int x, int y, object **doorlist, int *ndoors, random_map_params * RP)
754{ 754{
755 int i, j; 755 int i, j;
756 object *door; 756 object *door;
757 757
758 /* bounds check x and y */ 758 /* bounds check x and y */
790 } 790 }
791} 791}
792 792
793/* find a random non-blocked spot in this room to drop a key. */ 793/* find a random non-blocked spot in this room to drop a key. */
794object ** 794object **
795find_doors_in_room (maptile *map, int x, int y, RMParms * RP) 795find_doors_in_room (maptile *map, int x, int y, random_map_params * RP)
796{ 796{
797 char **layout2; 797 char **layout2;
798 object **doorlist; 798 object **doorlist;
799 int i, j; 799 int i, j;
800 int ndoors = 0; 800 int ndoors = 0;
830 830
831/* locks and/or hides all the doors in doorlist, or does nothing if 831/* locks and/or hides all the doors in doorlist, or does nothing if
832 opts doesn't say to lock/hide doors. */ 832 opts doesn't say to lock/hide doors. */
833 833
834void 834void
835lock_and_hide_doors (object **doorlist, maptile *map, int opts, RMParms * RP) 835lock_and_hide_doors (object **doorlist, maptile *map, int opts, random_map_params * RP)
836{ 836{
837 object *door; 837 object *door;
838 int i; 838 int i;
839 839
840 /* lock the doors and hide the keys. */ 840 /* lock the doors and hide the keys. */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines