Merge branch 'master' into derek-farming
Reverse merge before final reintegration. * master: (40 commits) Fix magic mapped dark room symbols Disclose extinct species alongside genocided ones ... Conflicts: doc/fixes35.0 src/do.c src/files.c src/invent.c src/objnam.c sys/share/pcmain.c
This commit is contained in:
336
src/sp_lev.c
336
src/sp_lev.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 sp_lev.c $NHDT-Date: 1426465441 2015/03/16 00:24:01 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.25 $ */
|
||||
/* NetHack 3.5 sp_lev.c $NHDT-Date: 1427934549 2015/04/02 00:29:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */
|
||||
/* NetHack 3.5 sp_lev.c $Date: 2011/01/05 01:28:36 $ $Revision: 1.23 $ */
|
||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "sp_lev.h"
|
||||
|
||||
typedef void (*select_iter_func)(int, int, genericptr_t);
|
||||
|
||||
extern void FDECL(mkmap, (lev_init *));
|
||||
|
||||
STATIC_DCL void FDECL(get_room_loc, (schar *, schar *, struct mkroom *));
|
||||
@@ -35,6 +37,94 @@ STATIC_DCL boolean FDECL(create_subroom, (struct mkroom *, XCHAR_P, XCHAR_P,
|
||||
XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P));
|
||||
|
||||
long FDECL(opvar_array_length, (struct sp_coder *));
|
||||
STATIC_DCL void NDECL(solidify_map);
|
||||
STATIC_DCL void FDECL(splev_stack_init, (struct splevstack *));
|
||||
STATIC_DCL void FDECL(splev_stack_done, (struct splevstack *));
|
||||
STATIC_DCL void FDECL(splev_stack_push, (struct splevstack *, struct opvar *));
|
||||
STATIC_DCL struct opvar * FDECL(splev_stack_pop, (struct splevstack *));
|
||||
STATIC_DCL struct splevstack * FDECL(splev_stack_reverse, (struct splevstack *));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_new_str, (char *));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_new_int, (long));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_new_coord, (int, int));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_new_region, (int,int, int,int));
|
||||
STATIC_DCL void FDECL(opvar_free_x, (struct opvar *));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_clone, (struct opvar *));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_var_conversion, (struct sp_coder *, struct opvar *));
|
||||
STATIC_DCL struct splev_var * FDECL(opvar_var_defined, (struct sp_coder *, char *));
|
||||
STATIC_DCL struct opvar * FDECL(splev_stack_getdat, (struct sp_coder *, XCHAR_P));
|
||||
STATIC_DCL struct opvar * FDECL(splev_stack_getdat_any, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(variable_list_del, (struct splev_var *));
|
||||
STATIC_DCL void FDECL(lvlfill_maze_grid, (int,int, int,int, SCHAR_P));
|
||||
STATIC_DCL void FDECL(lvlfill_solid, (SCHAR_P, SCHAR_P));
|
||||
STATIC_DCL void NDECL(remove_boundary_syms);
|
||||
STATIC_DCL void FDECL(maybe_add_door, (int,int, struct mkroom *));
|
||||
STATIC_DCL void NDECL(link_doors_rooms);
|
||||
STATIC_DCL void NDECL(fill_rooms);
|
||||
STATIC_DCL unpacked_coord FDECL(get_unpacked_coord, (long, int));
|
||||
STATIC_DCL void FDECL(replace_terrain, (replaceterrain *, struct mkroom *));
|
||||
STATIC_DCL void FDECL(wallify_map, (int,int, int,int));
|
||||
STATIC_DCL void FDECL(splev_initlev, (lev_init *));
|
||||
STATIC_DCL struct sp_frame * FDECL(frame_new, (long));
|
||||
STATIC_DCL void FDECL(frame_del, (struct sp_frame *));
|
||||
STATIC_DCL void FDECL(spo_frame_push, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_frame_pop, (struct sp_coder *));
|
||||
STATIC_DCL long FDECL(sp_code_jmpaddr, (long, long));
|
||||
STATIC_DCL void FDECL(spo_call, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_return, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_end_moninvent, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_pop_container, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_message, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_monster, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_object, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_level_flags, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_initlevel, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_engraving, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_mineralize, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_room, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_endroom, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_stair, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_ladder, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_grave, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_altar, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_trap, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_gold, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_corridor, (struct sp_coder *));
|
||||
STATIC_DCL struct opvar * FDECL(selection_opvar, (char *));
|
||||
STATIC_DCL xchar FDECL(selection_getpoint, (int,int, struct opvar *));
|
||||
STATIC_DCL void FDECL(selection_setpoint, (int,int, struct opvar *, XCHAR_P));
|
||||
STATIC_DCL struct opvar * FDECL(selection_not, (struct opvar *));
|
||||
STATIC_DCL struct opvar * FDECL(selection_logical_oper, (struct opvar *, struct opvar *, CHAR_P));
|
||||
STATIC_DCL struct opvar * FDECL(selection_filter_mapchar, (struct opvar *, struct opvar *));
|
||||
STATIC_DCL void FDECL(selection_filter_percent, (struct opvar *, int));
|
||||
STATIC_DCL int FDECL(selection_rndcoord, (struct opvar *, schar *, schar *));
|
||||
STATIC_DCL void FDECL(selection_do_grow, (struct opvar *, int));
|
||||
STATIC_DCL void FDECL(selection_floodfill, (struct opvar *, int,int));
|
||||
STATIC_DCL void FDECL(selection_do_ellipse, (struct opvar *, int,int, int,int, int));
|
||||
STATIC_DCL long FDECL(line_dist_coord, (long,long, long,long, long,long));
|
||||
STATIC_DCL void FDECL(selection_do_gradient, (struct opvar *, long,long, long,long, long,long,long,long));
|
||||
STATIC_DCL void FDECL(selection_do_line, (SCHAR_P,SCHAR_P, SCHAR_P,SCHAR_P, struct opvar *));
|
||||
STATIC_DCL void FDECL(selection_do_randline, (SCHAR_P,SCHAR_P, SCHAR_P,SCHAR_P, SCHAR_P,SCHAR_P, struct opvar *));
|
||||
STATIC_DCL void FDECL(selection_iterate, (struct opvar *, select_iter_func, genericptr_t));
|
||||
STATIC_DCL void FDECL(sel_set_ter, (int,int, genericptr_t));
|
||||
STATIC_DCL void FDECL(sel_set_feature, (int,int, genericptr_t));
|
||||
STATIC_DCL void FDECL(sel_set_door, (int,int, genericptr_t));
|
||||
STATIC_DCL void FDECL(spo_door, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_feature, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_terrain, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_replace_terrain, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_levregion, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_region, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_drawbridge, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_mazewalk, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_wall_property, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_room_door, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(sel_set_wallify, (int,int, genericptr_t));
|
||||
STATIC_DCL void FDECL(spo_wallify, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_map, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_jmp, (struct sp_coder *, sp_lev *));
|
||||
STATIC_DCL void FDECL(spo_conditional_jump, (struct sp_coder *, sp_lev *));
|
||||
STATIC_DCL void FDECL(spo_var_init, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_shuffle_array, (struct sp_coder *));
|
||||
|
||||
#define LEFT 1
|
||||
#define H_LEFT 2
|
||||
@@ -430,12 +520,11 @@ schar filling;
|
||||
|
||||
for (x = x1; x <= x2; x++)
|
||||
for (y = y1; y <= y2; y++) {
|
||||
#ifndef WALLIFIED_MAZE
|
||||
levl[x][y].typ = STONE;
|
||||
#else
|
||||
levl[x][y].typ =
|
||||
(y < 2 || ((x % 2) && (y % 2))) ? STONE : filling;
|
||||
#endif
|
||||
if (level.flags.corrmaze)
|
||||
levl[x][y].typ = STONE;
|
||||
else
|
||||
levl[x][y].typ =
|
||||
(y < 2 || ((x % 2) && (y % 2))) ? STONE : filling;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,10 +612,9 @@ remove_boundary_syms()
|
||||
|
||||
|
||||
void
|
||||
maybe_add_door(x,y, droom, i,s)
|
||||
maybe_add_door(x,y, droom)
|
||||
int x,y;
|
||||
struct mkroom *droom;
|
||||
int i,s;
|
||||
{
|
||||
if (droom->hx >= 0 && doorindex < DOORMAX && inside_room(droom, x,y))
|
||||
add_door(x, y, droom);
|
||||
@@ -541,9 +629,9 @@ link_doors_rooms()
|
||||
for (x = 0; x < COLNO; x++)
|
||||
if (IS_DOOR(levl[x][y].typ) || levl[x][y].typ == SDOOR) {
|
||||
for (tmpi = 0; tmpi < nroom; tmpi++) {
|
||||
maybe_add_door(x,y, &rooms[tmpi], tmpi,-1);
|
||||
maybe_add_door(x,y, &rooms[tmpi]);
|
||||
for (m = 0; m < rooms[tmpi].nsubrooms; m++) {
|
||||
maybe_add_door(x,y, rooms[tmpi].sbrooms[m], tmpi,m);
|
||||
maybe_add_door(x,y, rooms[tmpi].sbrooms[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1581,24 +1669,28 @@ struct mkroom *croom;
|
||||
if (!container_idx) {
|
||||
if (!invent_carrying_monster) {
|
||||
/*impossible("create_object: no container");*/
|
||||
/* don't complain, the monster may be gone legally (eg. unique demon already generated)
|
||||
TODO: In the case of unique demon lords, they should get their inventories even when
|
||||
they get generated outside the des-file. Maybe another data file that determines what
|
||||
inventories monsters get by default?
|
||||
/* don't complain, the monster may be gone legally
|
||||
(eg. unique demon already generated)
|
||||
TODO: In the case of unique demon lords, they should
|
||||
get their inventories even when they get generated
|
||||
outside the des-file. Maybe another data file that
|
||||
determines what inventories monsters get by default?
|
||||
*/
|
||||
} else {
|
||||
int c;
|
||||
int ci;
|
||||
struct obj *objcheck = otmp;
|
||||
int inuse = -1;
|
||||
for (c = 0; c < container_idx; c++)
|
||||
if (container_obj[c] == objcheck)
|
||||
inuse = c;
|
||||
|
||||
for (ci = 0; ci < container_idx; ci++)
|
||||
if (container_obj[ci] == objcheck)
|
||||
inuse = ci;
|
||||
remove_object(otmp);
|
||||
if (mpickobj(invent_carrying_monster, otmp)) {
|
||||
if (inuse > -1) {
|
||||
impossible("container given to monster was merged or deallocated.");
|
||||
for (c = inuse; c < container_idx-1; c++)
|
||||
container_obj[c] = container_obj[c+1];
|
||||
impossible(
|
||||
"container given to monster was merged or deallocated.");
|
||||
for (ci = inuse; ci < container_idx - 1; ci++)
|
||||
container_obj[ci] = container_obj[ci + 1];
|
||||
container_obj[container_idx] = NULL;
|
||||
container_idx--;
|
||||
}
|
||||
@@ -2490,6 +2582,7 @@ spo_return(coder)
|
||||
opvar_free(params);
|
||||
}
|
||||
|
||||
/*ARGUSED*/
|
||||
void
|
||||
spo_end_moninvent(coder)
|
||||
struct sp_coder *coder;
|
||||
@@ -2499,6 +2592,7 @@ spo_end_moninvent(coder)
|
||||
invent_carrying_monster = NULL;
|
||||
}
|
||||
|
||||
/*ARGUSED*/
|
||||
void
|
||||
spo_pop_container(coder)
|
||||
struct sp_coder *coder;
|
||||
@@ -2543,7 +2637,7 @@ spo_monster(coder)
|
||||
int nparams = 0;
|
||||
|
||||
struct opvar *varparam;
|
||||
struct opvar *id, *coord, *has_inv;
|
||||
struct opvar *id, *mcoord, *has_inv;
|
||||
monster tmpmons;
|
||||
|
||||
tmpmons.peaceful = -1;
|
||||
@@ -2660,13 +2754,13 @@ spo_monster(coder)
|
||||
}
|
||||
}
|
||||
|
||||
if (!OV_pop_c(coord)) panic("no monster coord?");
|
||||
if (!OV_pop_c(mcoord)) panic("no monster coord?");
|
||||
|
||||
if (!OV_pop_typ(id, SPOVAR_MONST)) panic("no mon type");
|
||||
|
||||
tmpmons.id = SP_MONST_PM(OV_i(id));
|
||||
tmpmons.class = SP_MONST_CLASS(OV_i(id));
|
||||
tmpmons.coord = OV_i(coord);
|
||||
tmpmons.coord = OV_i(mcoord);
|
||||
tmpmons.has_invent = OV_i(has_inv);
|
||||
|
||||
create_monster(&tmpmons, coder->croom);
|
||||
@@ -2675,7 +2769,7 @@ spo_monster(coder)
|
||||
Free(tmpmons.appear_as.str);
|
||||
|
||||
opvar_free(id);
|
||||
opvar_free(coord);
|
||||
opvar_free(mcoord);
|
||||
opvar_free(has_inv);
|
||||
opvar_free(varparam);
|
||||
}
|
||||
@@ -2837,22 +2931,23 @@ spo_level_flags(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *flagdata;
|
||||
long flags;
|
||||
long lflags;
|
||||
|
||||
if (!OV_pop_i(flagdata)) return;
|
||||
flags = OV_i(flagdata);
|
||||
lflags = OV_i(flagdata);
|
||||
|
||||
if (flags & NOTELEPORT) level.flags.noteleport = 1;
|
||||
if (flags & HARDFLOOR) level.flags.hardfloor = 1;
|
||||
if (flags & NOMMAP) level.flags.nommap = 1;
|
||||
if (flags & SHORTSIGHTED) level.flags.shortsighted = 1;
|
||||
if (flags & ARBOREAL) level.flags.arboreal = 1;
|
||||
if (flags & MAZELEVEL) level.flags.is_maze_lev = 1;
|
||||
if (flags & PREMAPPED) coder->premapped = TRUE;
|
||||
if (flags & SHROUD) level.flags.hero_memory = 0;
|
||||
if (flags & GRAVEYARD) level.flags.graveyard = 1;
|
||||
if (flags & ICEDPOOLS) icedpools = TRUE;
|
||||
if (flags & SOLIDIFY) coder->solidify = TRUE;
|
||||
if (lflags & NOTELEPORT) level.flags.noteleport = 1;
|
||||
if (lflags & HARDFLOOR) level.flags.hardfloor = 1;
|
||||
if (lflags & NOMMAP) level.flags.nommap = 1;
|
||||
if (lflags & SHORTSIGHTED) level.flags.shortsighted = 1;
|
||||
if (lflags & ARBOREAL) level.flags.arboreal = 1;
|
||||
if (lflags & MAZELEVEL) level.flags.is_maze_lev = 1;
|
||||
if (lflags & PREMAPPED) coder->premapped = TRUE;
|
||||
if (lflags & SHROUD) level.flags.hero_memory = 0;
|
||||
if (lflags & GRAVEYARD) level.flags.graveyard = 1;
|
||||
if (lflags & ICEDPOOLS) icedpools = TRUE;
|
||||
if (lflags & SOLIDIFY) coder->solidify = TRUE;
|
||||
if (lflags & CORRMAZE) level.flags.corrmaze = TRUE;
|
||||
|
||||
opvar_free(flagdata);
|
||||
}
|
||||
@@ -2902,19 +2997,19 @@ void
|
||||
spo_engraving(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *etyp, *txt, *coord;
|
||||
struct opvar *etyp, *txt, *ecoord;
|
||||
xchar x,y;
|
||||
|
||||
if (!OV_pop_i(etyp) ||
|
||||
!OV_pop_s(txt) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(ecoord)) return;
|
||||
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(ecoord));
|
||||
make_engr_at(x, y, OV_s(txt), 0L, OV_i(etyp));
|
||||
|
||||
opvar_free(etyp);
|
||||
opvar_free(txt);
|
||||
opvar_free(coord);
|
||||
opvar_free(ecoord);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2940,10 +3035,10 @@ void
|
||||
spo_room(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
if (coder->n_subroom > MAX_NESTED_ROOMS)
|
||||
if (coder->n_subroom > MAX_NESTED_ROOMS) {
|
||||
panic("Too deeply nested rooms?!");
|
||||
else {
|
||||
struct opvar *flags, *h, *w, *yalign, *xalign,
|
||||
} else {
|
||||
struct opvar *rflags, *h, *w, *yalign, *xalign,
|
||||
*y, *x, *rlit, *chance, *rtype;
|
||||
|
||||
room tmproom;
|
||||
@@ -2955,7 +3050,7 @@ spo_room(coder)
|
||||
!OV_pop_i(x) ||
|
||||
!OV_pop_i(yalign) ||
|
||||
!OV_pop_i(xalign) ||
|
||||
!OV_pop_i(flags) ||
|
||||
!OV_pop_i(rflags) ||
|
||||
!OV_pop_i(rlit) ||
|
||||
!OV_pop_i(chance) ||
|
||||
!OV_pop_i(rtype)) return;
|
||||
@@ -2970,9 +3065,9 @@ spo_room(coder)
|
||||
tmproom.rtype = OV_i(rtype);
|
||||
tmproom.chance = OV_i(chance);
|
||||
tmproom.rlit = OV_i(rlit);
|
||||
tmproom.filled = (OV_i(flags) & (1 << 0));
|
||||
/*tmproom.irregular = (OV_i(flags) & (1 << 1));*/
|
||||
tmproom.joined = !(OV_i(flags) & (1 << 2));
|
||||
tmproom.filled = (OV_i(rflags) & (1 << 0));
|
||||
/*tmproom.irregular = (OV_i(rflags) & (1 << 1));*/
|
||||
tmproom.joined = !(OV_i(rflags) & (1 << 2));
|
||||
|
||||
opvar_free(x);
|
||||
opvar_free(y);
|
||||
@@ -2983,7 +3078,7 @@ spo_room(coder)
|
||||
opvar_free(rtype);
|
||||
opvar_free(chance);
|
||||
opvar_free(rlit);
|
||||
opvar_free(flags);
|
||||
opvar_free(rflags);
|
||||
|
||||
if (!coder->failed_room[coder->n_subroom-1]) {
|
||||
tmpcr = build_room(&tmproom, coder->croom);
|
||||
@@ -3028,18 +3123,18 @@ spo_stair(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
xchar x,y;
|
||||
struct opvar *up, *coord;
|
||||
struct opvar *up, *scoord;
|
||||
struct trap *badtrap;
|
||||
|
||||
if (!OV_pop_i(up) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(scoord)) return;
|
||||
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(scoord));
|
||||
if ((badtrap = t_at(x,y)) != 0) deltrap(badtrap);
|
||||
mkstairs(x, y, (char)OV_i(up), coder->croom);
|
||||
SpLev_Map[x][y] = 1;
|
||||
|
||||
opvar_free(coord);
|
||||
opvar_free(scoord);
|
||||
opvar_free(up);
|
||||
}
|
||||
|
||||
@@ -3048,12 +3143,12 @@ spo_ladder(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
xchar x,y;
|
||||
struct opvar *up, *coord;
|
||||
struct opvar *up, *lcoord;
|
||||
|
||||
if (!OV_pop_i(up) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(lcoord)) return;
|
||||
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(lcoord));
|
||||
|
||||
levl[x][y].typ = LADDER;
|
||||
SpLev_Map[x][y] = 1;
|
||||
@@ -3064,7 +3159,7 @@ spo_ladder(coder)
|
||||
xdnladder = x; ydnladder = y;
|
||||
levl[x][y].ladder = LA_DOWN;
|
||||
}
|
||||
opvar_free(coord);
|
||||
opvar_free(lcoord);
|
||||
opvar_free(up);
|
||||
}
|
||||
|
||||
@@ -3072,13 +3167,13 @@ void
|
||||
spo_grave(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *coord, *typ, *txt;
|
||||
struct opvar *gcoord, *typ, *txt;
|
||||
schar x,y;
|
||||
if (!OV_pop_i(typ) ||
|
||||
!OV_pop_s(txt) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(gcoord)) return;
|
||||
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(gcoord));
|
||||
|
||||
if (isok(x, y) && !t_at(x, y)) {
|
||||
levl[x][y].typ = GRAVE;
|
||||
@@ -3089,7 +3184,7 @@ spo_grave(coder)
|
||||
}
|
||||
}
|
||||
|
||||
opvar_free(coord);
|
||||
opvar_free(gcoord);
|
||||
opvar_free(typ);
|
||||
opvar_free(txt);
|
||||
}
|
||||
@@ -3098,20 +3193,20 @@ void
|
||||
spo_altar(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *al, *shrine, *coord;
|
||||
struct opvar *al, *shrine, *acoord;
|
||||
altar tmpaltar;
|
||||
|
||||
if (!OV_pop_i(al) ||
|
||||
!OV_pop_i(shrine) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(acoord)) return;
|
||||
|
||||
tmpaltar.coord = OV_i(coord);
|
||||
tmpaltar.coord = OV_i(acoord);
|
||||
tmpaltar.align = OV_i(al);
|
||||
tmpaltar.shrine = OV_i(shrine);
|
||||
|
||||
create_altar(&tmpaltar, coder->croom);
|
||||
|
||||
opvar_free(coord);
|
||||
opvar_free(acoord);
|
||||
opvar_free(shrine);
|
||||
opvar_free(al);
|
||||
}
|
||||
@@ -3121,17 +3216,17 @@ spo_trap(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *type;
|
||||
struct opvar *coord;
|
||||
struct opvar *tcoord;
|
||||
trap tmptrap;
|
||||
|
||||
if (!OV_pop_i(type) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(tcoord)) return;
|
||||
|
||||
tmptrap.coord = OV_i(coord);
|
||||
tmptrap.coord = OV_i(tcoord);
|
||||
tmptrap.type = OV_i(type);
|
||||
|
||||
create_trap(&tmptrap, coder->croom);
|
||||
opvar_free(coord);
|
||||
opvar_free(tcoord);
|
||||
opvar_free(type);
|
||||
}
|
||||
|
||||
@@ -3139,15 +3234,16 @@ void
|
||||
spo_gold(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *coord, *amt;
|
||||
struct opvar *gcoord, *amt;
|
||||
schar x,y;
|
||||
long amount;
|
||||
if (!OV_pop_c(coord) || !OV_pop_i(amt)) return;
|
||||
|
||||
if (!OV_pop_c(gcoord) || !OV_pop_i(amt)) return;
|
||||
amount = OV_i(amt);
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(gcoord));
|
||||
if (amount == -1) amount = rnd(200);
|
||||
mkgold(amount, x,y);
|
||||
opvar_free(coord);
|
||||
opvar_free(gcoord);
|
||||
opvar_free(amt);
|
||||
}
|
||||
|
||||
@@ -3202,7 +3298,7 @@ selection_opvar(nbuf)
|
||||
return ov;
|
||||
}
|
||||
|
||||
char
|
||||
xchar
|
||||
selection_getpoint(x,y,ov)
|
||||
int x,y;
|
||||
struct opvar *ov;
|
||||
@@ -3217,12 +3313,12 @@ void
|
||||
selection_setpoint(x,y,ov, c)
|
||||
int x,y;
|
||||
struct opvar *ov;
|
||||
char c;
|
||||
xchar c;
|
||||
{
|
||||
if (!ov || ov->spovartyp != SPOVAR_SEL) return;
|
||||
if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) return;
|
||||
|
||||
ov->vardata.str[COLNO*y + x] = (c + 1);
|
||||
ov->vardata.str[COLNO*y + x] = (char)(c + 1);
|
||||
}
|
||||
|
||||
struct opvar *
|
||||
@@ -3476,16 +3572,16 @@ line_dist_coord(x1,y1, x2,y2, x3,y3)
|
||||
long py = y2-y1;
|
||||
long s = px*px + py*py;
|
||||
long x, y, dx, dy, dist = 0;
|
||||
float u = 0;
|
||||
float lu = 0;
|
||||
|
||||
if (x1 == x2 && y1 == y2) return isqrt(dist2(x1,y1, x3,y3));
|
||||
|
||||
u = ((x3 - x1) * px + (y3 - y1) * py) / (float)s;
|
||||
if (u > 1) u = 1;
|
||||
else if (u < 0) u = 0;
|
||||
lu = ((x3 - x1) * px + (y3 - y1) * py) / (float)s;
|
||||
if (lu > 1) lu = 1;
|
||||
else if (lu < 0) lu = 0;
|
||||
|
||||
x = x1 + u * px;
|
||||
y = y1 + u * py;
|
||||
x = x1 + lu * px;
|
||||
y = y1 + lu * py;
|
||||
dx = x - x3;
|
||||
dy = y - y3;
|
||||
dist = isqrt(dx*dx + dy*dy);
|
||||
@@ -3642,7 +3738,7 @@ selection_do_randline(x1,y1,x2,y2,rough, rec, ov)
|
||||
void
|
||||
selection_iterate(ov, func, arg)
|
||||
struct opvar *ov;
|
||||
void FDECL((*func), (int,int,genericptr_t));
|
||||
select_iter_func func;
|
||||
genericptr_t arg;
|
||||
{
|
||||
int x,y;
|
||||
@@ -3878,19 +3974,19 @@ void
|
||||
spo_region(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *rtype, *rlit, *flags, *area;
|
||||
struct opvar *rtype, *rlit, *rflags, *area;
|
||||
xchar dx1,dy1,dx2,dy2;
|
||||
register struct mkroom *troom;
|
||||
boolean prefilled, room_not_needed, irregular, joined;
|
||||
|
||||
if (!OV_pop_i(flags) ||
|
||||
if (!OV_pop_i(rflags) ||
|
||||
!OV_pop_i(rtype) ||
|
||||
!OV_pop_i(rlit) ||
|
||||
!OV_pop_r(area)) return;
|
||||
|
||||
prefilled = !(OV_i(flags) & (1 << 0));
|
||||
irregular = (OV_i(flags) & (1 << 1));
|
||||
joined = !(OV_i(flags) & (1 << 2));
|
||||
prefilled = !(OV_i(rflags) & (1 << 0));
|
||||
irregular = (OV_i(rflags) & (1 << 1));
|
||||
joined = !(OV_i(rflags) & (1 << 2));
|
||||
|
||||
if(OV_i(rtype) > MAXRTYPE) {
|
||||
OV_i(rtype) -= MAXRTYPE+1;
|
||||
@@ -3927,7 +4023,7 @@ spo_region(coder)
|
||||
light_region(&tmpregion);
|
||||
|
||||
opvar_free(area);
|
||||
opvar_free(flags);
|
||||
opvar_free(rflags);
|
||||
opvar_free(rlit);
|
||||
opvar_free(rtype);
|
||||
|
||||
@@ -3973,7 +4069,7 @@ spo_region(coder)
|
||||
}
|
||||
|
||||
opvar_free(area);
|
||||
opvar_free(flags);
|
||||
opvar_free(rflags);
|
||||
opvar_free(rlit);
|
||||
opvar_free(rtype);
|
||||
}
|
||||
@@ -3983,18 +4079,18 @@ spo_drawbridge(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
xchar x,y;
|
||||
struct opvar *dir, *db_open, *coord;
|
||||
struct opvar *dir, *db_open, *dcoord;
|
||||
|
||||
if (!OV_pop_i(dir) ||
|
||||
!OV_pop_i(db_open) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(dcoord)) return;
|
||||
|
||||
get_location_coord(&x, &y, DRY|WET|HOT, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY|WET|HOT, coder->croom, OV_i(dcoord));
|
||||
if (!create_drawbridge(x, y, OV_i(dir), OV_i(db_open)))
|
||||
impossible("Cannot create drawbridge.");
|
||||
SpLev_Map[x][y] = 1;
|
||||
|
||||
opvar_free(coord);
|
||||
opvar_free(dcoord);
|
||||
opvar_free(db_open);
|
||||
opvar_free(dir);
|
||||
}
|
||||
@@ -4004,25 +4100,21 @@ spo_mazewalk(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
xchar x,y;
|
||||
struct opvar *ftyp, *fstocked,*fdir, *coord;
|
||||
struct opvar *ftyp, *fstocked,*fdir, *mcoord;
|
||||
int dir;
|
||||
|
||||
if (!OV_pop_i(ftyp) ||
|
||||
!OV_pop_i(fstocked) ||
|
||||
!OV_pop_i(fdir) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(mcoord)) return;
|
||||
|
||||
dir = OV_i(fdir);
|
||||
|
||||
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(mcoord));
|
||||
if (!isok(x,y)) return;
|
||||
|
||||
if (OV_i(ftyp) < 1) {
|
||||
#ifndef WALLIFIED_MAZE
|
||||
OV_i(ftyp) = CORR;
|
||||
#else
|
||||
OV_i(ftyp) = ROOM;
|
||||
#endif
|
||||
OV_i(ftyp) = level.flags.corrmaze ? CORR : ROOM;
|
||||
}
|
||||
|
||||
/* don't use move() - it doesn't use W_NORTH, etc. */
|
||||
@@ -4066,7 +4158,7 @@ spo_mazewalk(coder)
|
||||
walkfrom(x, y, OV_i(ftyp));
|
||||
if (OV_i(fstocked)) fill_empty_maze();
|
||||
|
||||
opvar_free(coord);
|
||||
opvar_free(mcoord);
|
||||
opvar_free(fdir);
|
||||
opvar_free(fstocked);
|
||||
opvar_free(ftyp);
|
||||
@@ -4121,6 +4213,7 @@ spo_room_door(coder)
|
||||
opvar_free(pos);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
sel_set_wallify(x,y,arg)
|
||||
int x, y;
|
||||
@@ -4833,7 +4926,7 @@ sp_lev *lvl;
|
||||
{
|
||||
struct opvar *sel1, *sel2, *pt;
|
||||
if (!OV_pop_typ(sel1, SPOVAR_SEL)) panic("no sel1 for add");
|
||||
if (!OV_pop_typ(sel2, SPOVAR_SEL)) panic("no sel1 for add");
|
||||
if (!OV_pop_typ(sel2, SPOVAR_SEL)) panic("no sel2 for add");
|
||||
pt = selection_logical_oper(sel1, sel2, '|');
|
||||
opvar_free(sel1);
|
||||
opvar_free(sel2);
|
||||
@@ -4941,7 +5034,8 @@ sp_lev *lvl;
|
||||
{
|
||||
struct opvar *tmp = NULL, *tmp2 = NULL, *pt = selection_opvar(NULL);
|
||||
schar x1,y1,x2,y2;
|
||||
if (!OV_pop_c(tmp) || !OV_pop_c(tmp2)) panic("no ter sel linecoord");
|
||||
if (!OV_pop_c(tmp)) panic("no ter sel linecoord1");
|
||||
if (!OV_pop_c(tmp2)) panic("no ter sel linecoord2");
|
||||
get_location_coord(&x1, &y1, ANY_LOC, coder->croom, OV_i(tmp));
|
||||
get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(tmp2));
|
||||
x1 = (x1 < 0) ? 0 : x1;
|
||||
@@ -4958,7 +5052,9 @@ sp_lev *lvl;
|
||||
{
|
||||
struct opvar *tmp = NULL, *tmp2 = NULL, *tmp3, *pt = selection_opvar(NULL);
|
||||
schar x1,y1,x2,y2;
|
||||
if (!OV_pop_i(tmp3) || !OV_pop_c(tmp) || !OV_pop_c(tmp2)) panic("no ter sel randline");
|
||||
if (!OV_pop_i(tmp3)) panic("no ter sel randline1");
|
||||
if (!OV_pop_c(tmp)) panic("no ter sel randline2");
|
||||
if (!OV_pop_c(tmp2)) panic("no ter sel randline3");
|
||||
get_location_coord(&x1, &y1, ANY_LOC, coder->croom, OV_i(tmp));
|
||||
get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(tmp2));
|
||||
x1 = (x1 < 0) ? 0 : x1;
|
||||
@@ -5029,25 +5125,28 @@ sp_lev *lvl;
|
||||
break;
|
||||
case SPO_SEL_GRADIENT:
|
||||
{
|
||||
struct opvar *gtyp, *glim, *mind, *maxd, *coord, *coord2;
|
||||
struct opvar *gtyp, *glim, *mind, *maxd, *gcoord, *coord2;
|
||||
struct opvar *sel;
|
||||
schar x,y, x2,y2;
|
||||
if (!OV_pop_i(gtyp)) panic("no gtyp for grad");
|
||||
if (!OV_pop_i(glim)) panic("no glim for grad");
|
||||
if (!OV_pop_c(coord2)) panic("no coord2 for grad");
|
||||
if (!OV_pop_c(coord)) panic("no coord for grad");
|
||||
if (!OV_pop_c(gcoord)) panic("no coord for grad");
|
||||
if (!OV_pop_i(maxd)) panic("no maxd for grad");
|
||||
if (!OV_pop_i(mind)) panic("no mind for grad");
|
||||
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(coord2));
|
||||
get_location_coord(&x, &y, ANY_LOC, coder->croom,
|
||||
OV_i(gcoord));
|
||||
get_location_coord(&x2, &y2, ANY_LOC, coder->croom,
|
||||
OV_i(coord2));
|
||||
|
||||
sel = selection_opvar(NULL);
|
||||
selection_do_gradient(sel, x,y, x2,y2, OV_i(gtyp), OV_i(mind), OV_i(maxd), OV_i(glim));
|
||||
selection_do_gradient(sel, x,y, x2,y2, OV_i(gtyp),
|
||||
OV_i(mind), OV_i(maxd), OV_i(glim));
|
||||
splev_stack_push(coder->stack, sel);
|
||||
|
||||
opvar_free(gtyp);
|
||||
opvar_free(glim);
|
||||
opvar_free(coord);
|
||||
opvar_free(gcoord);
|
||||
opvar_free(coord2);
|
||||
opvar_free(maxd);
|
||||
opvar_free(mind);
|
||||
@@ -5064,7 +5163,14 @@ next_opcode:
|
||||
link_doors_rooms();
|
||||
fill_rooms();
|
||||
remove_boundary_syms();
|
||||
wallification(1, 0, COLNO-1, ROWNO-1);
|
||||
/* FIXME: Ideally, we want this call to only cover areas of the map
|
||||
* which were not inserted directly by the special level file (see
|
||||
* the insect legs on Baalzebub's level, for instance). Since that
|
||||
* is currently not possible, we overload the corrmaze flag for this
|
||||
* purpose.
|
||||
*/
|
||||
if (!level.flags.corrmaze)
|
||||
wallification(1, 0, COLNO-1, ROWNO-1);
|
||||
|
||||
count_features();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user