Example #1
0
void print(Short x, Short y, Short ch) // Equivalent of "atl"
{
  if (OUT_OF_BOUNDS(x, y)) return;
  if (get_cell_seen(floor_info[x][y]) && floor_symbol[x][y] == ch)
    return; // so that we don't set NEW_CELL.  it already looks like that.
  floor_symbol[x][y] = ch;
  floor_info[x][y] |= NEW_CELL;  
  // I could set lines_dirty.  nah.
  on_scr(x,y);
}
Example #2
0
static Boolean teleok(Short x, Short y)
{	/* might throw him into a POOL */
  return( !OUT_OF_BOUNDS(x,y) &&
	  !IS_ROCK(get_cell_type(floor_info[x][y])) &&
	  !mon_at(x,y) &&
	  !sobj_at(ENORMOUS_ROCK,x,y) &&
	  !trap_at(x,y)
	  );
  /* Note: gold is permitted (because of vaults) */
}
Example #3
0
Char loc_symbol(Short x, Short y) // Equivalent of "news0"
{
  obj_t *otmp;
  trap_t *ttmp;
  UChar cell_type;
  Char c;
  Boolean blind = Blind;

  if (OUT_OF_BOUNDS(x,y)) return ' ';
  cell_type = get_cell_type(floor_info[x][y]);
  if (!get_cell_seen(floor_info[x][y]))
    c = ' ';
  else if (cell_type == POOL)
    c = POOL_SYM;
  else if (!blind && (otmp = obj_at(x,y)))
    c = otmp->olet;
  else if (!blind && gold_at(x,y))
    c = GOLD_SYM;
  else if (x == xupstair && y == yupstair)
    c = UPSTAIR_SYM;
  else if (x == xdnstair && y == ydnstair)
    c = DOWNSTAIR_SYM;
  else if ((ttmp = trap_at(x,y)) && get_trap_seen(ttmp->trap_info))
    c = TRAP_SYM;
  else switch(cell_type) {
  case HWALL: c = HWALL_SYM;  break;
  case VWALL: c = VWALL_SYM;  break;
  case CORR:  c = CORR_SYM;   break;
  case SCORR: case SDOOR:
    c = floor_symbol[x][y];	/* %% wrong after killing mimic ! */
    break;
  case LDOOR: case DOOR:
    c = DOOR_SYM;
    break;
  case ROOM:
    // the 'blind' here seems strange to me:
    if (get_cell_lit(floor_info[x][y]) || cansee(x,y) || blind) c = ROOM_SYM;
    else c = ' ';
    break;
  default:
    c = ERRCHAR;
  }
  return c;
}
Example #4
0
static int compute_seq_len(unsigned char *buf, int bufsize, struct offset_info *decode_cache, int offset)
{
	int outcome_offset;
	struct offset_info *outcome;
	int bytes;

	outcome_offset = decode_cache[offset].resolved_at;

	if (OUT_OF_BOUNDS(outcome_offset, bufsize)) {
		// sequence reached end of buffer
		return bufsize - offset;
	}

	outcome = &decode_cache[outcome_offset];

	bytes = outcome_offset - offset;

	if (outcome->is_branchcc == 0) { // leaf
		switch (outcome->outcome) {
		case 'm':
		case 'j':
		case 's':
			return INF_LEN;
			break;
		case 'p':
		case 'e':
		case 'i':
			return bytes;
			break;
		default:
			abort();
		}
        } else {
		return INF_LEN;
	}
}