/* * Code to fill the dungeon with objects. */ #include "obj.h" #include "vars.h" #include "dice.h" #include "structs.h" #include "objtypes.h" #include "digdungeon.h" #include "filldungeon.h" /* * Place an object of a given type, given type and level number. */ static void place_thing(int type, int lvno) { add_obj_to_inv(obj_make(type),&randomloc(&levels[lvno],&ckroutine,-1)->objs); } /* * Fill the dungeon with objects. This means: * * - Blank maps. We create one per level of the main dungeon. With * the maps created in the player's inventory, this is enough to map * the whole dungeon. * * - The Crown of Yendor. * * - Scarabs of the elemental planes, on the bottom four levels of the * dungeon. * * - Weapons and armour on various levels; see the code. */ void filldungeon(void) { int ln; LOC *lc; int scarabs[4]; int i; int j; int t; for (ln=DUNGEON_LEVELS-1;ln>=0;ln--) { add_obj_to_inv(obj_make(OBJ_MAP),&randomloc(&levels[ln],&ckroutine,-1)->objs); } avoidloc = gate_hell; lc = randomloc(&levels[L_HELL],&ckavoid,-1); add_obj_to_inv(obj_make(OBJ_CROWN),&lc->objs); scarabs[0] = OBJ_SCARAB_OF_EARTH; scarabs[1] = OBJ_SCARAB_OF_AIR; scarabs[2] = OBJ_SCARAB_OF_FIRE; scarabs[3] = OBJ_SCARAB_OF_WATER; for (i=4-1;i>=0;i--) { j = rnd(4); t = scarabs[i]; scarabs[i] = scarabs[j]; scarabs[j] = t; } for (i=4-1;i>=0;i--) { add_obj_to_inv(obj_make(scarabs[i]),&randomloc(&levels[DUNGEON_LEVELS-1-i],&ckroutine,-1)->objs); } // OBJ_DAGGER in player's intial inventory place_thing(OBJ_CLUB,2); place_thing(OBJ_MACE,5); place_thing(OBJ_FLAIL,8); place_thing(OBJ_MORNINGSTAR,11); place_thing(OBJ_SHORT_SWORD,14); place_thing(OBJ_LONG_SWORD,17); place_thing(OBJ_TWO_HANDED_SWORD,20); // OBJ_LEATHER_ARMOUR in player's initial inventory place_thing(OBJ_STUDDED_LEATHER_ARMOUR,4); place_thing(OBJ_RING_MAIL,7); place_thing(OBJ_SCALE_MAIL,10); place_thing(OBJ_CHAIN_MAIL,13); place_thing(OBJ_BANDED_MAIL,16); place_thing(OBJ_SPLINT_MAIL,17); place_thing(OBJ_PLATE_MAIL,20); }