New level compiler: code changes

This commit is contained in:
Pasi Kallinen
2015-02-18 20:14:40 +02:00
parent 7912a566e5
commit 47bb9abace
14 changed files with 7189 additions and 3776 deletions

View File

@@ -17,7 +17,6 @@ STATIC_DCL void FDECL(mkgrave,(struct mkroom *));
STATIC_DCL void NDECL(makevtele);
STATIC_DCL void NDECL(clear_level_structures);
STATIC_DCL void NDECL(makelevel);
STATIC_DCL void NDECL(mineralize);
STATIC_DCL boolean FDECL(bydoor,(XCHAR_P,XCHAR_P));
STATIC_DCL struct mkroom *FDECL(find_branch_room, (coord *));
STATIC_DCL struct mkroom *FDECL(pos_to_room, (XCHAR_P, XCHAR_P));
@@ -814,43 +813,50 @@ skip0:
* Place deposits of minerals (gold and misc gems) in the stone
* surrounding the rooms on the map.
* Also place kelp in water.
* mineralize(-1, -1, -1, -1, FALSE); => "default" behaviour
*/
STATIC_OVL void
mineralize()
void
mineralize(kelp_pool, kelp_moat, goldprob, gemprob, skip_lvl_checks)
int kelp_pool, kelp_moat, goldprob, gemprob;
boolean skip_lvl_checks;
{
s_level *sp;
struct obj *otmp;
int goldprob, gemprob, x, y, cnt;
int x, y, cnt;
if (kelp_pool < 0) kelp_pool = 10;
if (kelp_moat < 0) kelp_moat = 30;
/* Place kelp, except on the plane of water */
if (In_endgame(&u.uz)) return;
if (!skip_lvl_checks && In_endgame(&u.uz)) return;
for (x = 2; x < (COLNO - 2); x++)
for (y = 1; y < (ROWNO - 1); y++)
if ((levl[x][y].typ == POOL && !rn2(10)) ||
(levl[x][y].typ == MOAT && !rn2(30)))
if ((kelp_pool && levl[x][y].typ == POOL && !rn2(kelp_pool)) ||
(kelp_moat && levl[x][y].typ == MOAT && !rn2(kelp_moat)))
(void) mksobj_at(KELP_FROND, x, y, TRUE, FALSE);
/* determine if it is even allowed;
almost all special levels are excluded */
if (In_hell(&u.uz) || In_V_tower(&u.uz) ||
if (!skip_lvl_checks && (In_hell(&u.uz) || In_V_tower(&u.uz) ||
Is_rogue_level(&u.uz) ||
level.flags.arboreal ||
((sp = Is_special(&u.uz)) != 0 && !Is_oracle_level(&u.uz)
&& (!In_mines(&u.uz) || sp->flags.town)
)) return;
))) return;
/* basic level-related probabilities */
goldprob = 20 + depth(&u.uz) / 3;
gemprob = goldprob / 4;
if (goldprob < 0) goldprob = 20 + depth(&u.uz) / 3;
if (gemprob < 0) gemprob = goldprob / 4;
/* mines have ***MORE*** goodies - otherwise why mine? */
if (In_mines(&u.uz)) {
goldprob *= 2;
gemprob *= 3;
} else if (In_quest(&u.uz)) {
goldprob /= 4;
gemprob /= 6;
if (!skip_lvl_checks) {
if (In_mines(&u.uz)) {
goldprob *= 2;
gemprob *= 3;
} else if (In_quest(&u.uz)) {
goldprob /= 4;
gemprob /= 6;
}
}
/*
@@ -905,7 +911,7 @@ mklev()
in_mklev = TRUE;
makelevel();
bound_digging();
mineralize();
mineralize(-1, -1, -1, -1, FALSE);
in_mklev = FALSE;
/* has_morgue gets cleared once morgue is entered; graveyard stays
set (graveyard might already be set even when has_morgue is clear