Ejemplo n.º 1
0
void makedoor(int x, int y)
{
    if (random_range(20) <= Level->depth/10) {
        Level->site[x][y].locchar = FLOOR;
        lset(x,y,SECRET);
    }
    else if (random_range(20)<=Level->depth/2) {
        Level->site[x][y].locchar = CLOSED_DOOR;
        if (random_range(20) <= Level->depth/10)
            lset(x,y,SECRET);
        if (random_range(40) <= Level->depth)
            Level->site[x][y].aux = LOCKED;
        else Level->site[x][y].aux = UNLOCKED;
    }
    else {
        Level->site[x][y].locchar = OPEN_DOOR;
        Level->site[x][y].aux = UNLOCKED;
    }
    if (! loc_statusp(x,y,SECRET)) {
        lset(x,y+1,STOPS);
        lset(x+1,y,STOPS);
        lset(x-1,y,STOPS);
        lset(x,y-1,STOPS);
        lset(x,y,STOPS);
    }
    Level->site[x][y].p_locf = L_NO_OP;
    /* prevents water corridors from being instant death in sewers */
}
Ejemplo n.º 2
0
/* search once particular spot */
void searchat(int x, int y)
{
    int i;
    if (inbounds(x,y) && (random_range(3) || Player.status[ALERT])) {
        if (loc_statusp(x,y,SECRET)) {
            lreset(x,y,SECRET);
            lset(x, y, CHANGED);
            if ((Level->site[x][y].locchar==OPEN_DOOR) ||
                    (Level->site[x][y].locchar==CLOSED_DOOR)) {
                mprint("You find a secret door!");
                for(i=0; i<=8; i++) { /* FIXED! 12/25/98 */
                    lset(x+Dirs[0][i],y+Dirs[1][i],STOPS);
                    lset(x+Dirs[0][i], y+Dirs[1][i], CHANGED);
                }
            }
            else mprint("You find a secret passage!");
            drawvision(Player.x,Player.y);
        }
        if ((Level->site[x][y].p_locf >= TRAP_BASE) &&
                (Level->site[x][y].locchar != TRAP) &&
                (Level->site[x][y].p_locf <= TRAP_BASE+NUMTRAPS)) {
            Level->site[x][y].locchar = TRAP;
            lset(x, y, CHANGED);
            mprint("You find a trap!");
            drawvision(Player.x,Player.y);
            State.setFastMove(false);
        }
    }
}
Ejemplo n.º 3
0
Archivo: scr.c Proyecto: anylonen/omega
/* for displaying activity specifically at some point */
void plotspot(int x, int y, int showmonster)
{
  if (loc_statusp(x,y,SEEN))
    putspot(x,y,getspot(x,y,showmonster));
  else 
    putspot(x,y,SPACE);
}
Ejemplo n.º 4
0
Archivo: scr.c Proyecto: anylonen/omega
static void show_screen_level (int top, int left, int bottom, int right)
{
  int j;
  int last_attr = 0;

  for (j = top; j < bottom; ++j)
    {
      int i;

      wmove(Levelw, screenmody(j), 0);

      for (i = left; i < right; ++i)
        {
          int c;

          if (loc_statusp(i, j, SEEN))
            c = getspot(i, j, FALSE);
          else
            c = SPACE;

          if (optionp(SHOW_COLOUR) && CHARATTR(c) != last_attr)
            {
              last_attr = CHARATTR(c);
              wattrset(Levelw, last_attr);
            }

          waddch(Levelw, c & 0xff);
        }
    }
}
Ejemplo n.º 5
0
/* use a magic key*/
void i_key(pob o)
{
    int dir;
    int ox,oy;
    o->used = FALSE;
    mprint("Unlock door: ");
    dir = getdir();
    if (dir == ABORT)
        resetgamestatus(SKIP_MONSTERS);
    else {
        ox = Player.x + Dirs[0][dir];
        oy = Player.y + Dirs[1][dir];
        if ((Level->site[ox][oy].locchar != CLOSED_DOOR) ||
                loc_statusp(ox,oy,SECRET)) {
            mprint("You can't unlock that!");
            resetgamestatus(SKIP_MONSTERS);
        }
        else if (Level->site[ox][oy].aux == LOCKED) {
            mprint("The lock clicks open!");
            Level->site[ox][oy].aux = UNLOCKED;
            lset(ox, oy, CHANGED);
            o->blessing--;
            if ((o->blessing<0)||(Level->depth == MaxDungeonLevels-1)) {
                mprint("The key disintegrates!");
                conform_lost_objects(1,o);
            }
            else
                mprint("Your key glows faintly.");
        }
        else mprint("That door is already unlocked!");
    }
}
Ejemplo n.º 6
0
Archivo: scr.c Proyecto: anylonen/omega
/* find apt char to display at some location */
Symbol getspot(int x, int y, int showmonster)
{
#ifdef CENTER_ON_PLAYER
  /* funny scrolling may cause this. PGM */
  if (!inbounds(x,y ) )
    {
      return SPACE;
    }
#endif

  if (loc_statusp(x,y,SECRET))
    {
      if ( Level->site[x][y].roomnumber == RS_DRUID )
        return(HEDGE);  /* secret doors in druid temple are brambles -DAG */
      else
        return(WALL);
    }
  else switch (Level->site[x][y].locchar) {
  case WATER:
    if (Level->site[x][y].creature == NULL) 
      return(WATER);
    else if (m_statusp(Level->site[x][y].creature,SWIMMING))
      return(WATER);
    else if (showmonster)
      return(Level->site[x][y].creature->monchar);
    else return(WATER);
    /* these sites never show anything but their location char's */
  case CLOSED_DOOR:
  case LAVA:
  case FIRE:
  case ABYSS:
    return(Level->site[x][y].locchar);
    /* rubble and hedge don't show items on their location */
  case RUBBLE:
  case HEDGE:
    if (showmonster && (Level->site[x][y].creature != NULL)) {
      if ((m_statusp(Level->site[x][y].creature,M_INVISIBLE)) &&
          (! Player.status[TRUESIGHT]))
        return(getspot(x,y,FALSE));
      else return (Level->site[x][y].creature->monchar);
    }
    else return(Level->site[x][y].locchar);
    /* everywhere else, first try to show monster, next show items, next show
       location char */
  default:
    if (showmonster && (Level->site[x][y].creature != NULL)) {
      if ((m_statusp(Level->site[x][y].creature,M_INVISIBLE)) &&
          (! Player.status[TRUESIGHT]))
        return(getspot(x,y,FALSE));
      else return (Level->site[x][y].creature->monchar);
    }
    else if (Level->site[x][y].things != NULL) {
      if (Level->site[x][y].things->next != NULL)
        return(PILE);
      else return(Level->site[x][y].things->thing->objchar);
    }
    else return(Level->site[x][y].locchar);
  }
}
Ejemplo n.º 7
0
Archivo: scr.c Proyecto: anylonen/omega
void spreadroomdark(int x, int y, int roomno)
{
  if (inbounds(x,y))
    if (loc_statusp(x,y,LIT) && (Level->site[x][y].roomnumber == roomno)) {
      blankoutspot(x,y);
      spreadroomdark(x+1,y,roomno);
      spreadroomdark(x,y+1,roomno);
      spreadroomdark(x-1,y,roomno);
      spreadroomdark(x,y-1,roomno);
    }
}
Ejemplo n.º 8
0
Archivo: scr.c Proyecto: anylonen/omega
void spreadroomlight(int x, int y, int roomno)
{
  if (inbounds(x,y) && !loc_statusp(x,y,LIT) &&
      Level->site[x][y].roomnumber == roomno) {
    lightspot(x,y);
    spreadroomlight(x+1,y,roomno);
    spreadroomlight(x,y+1,roomno);
    spreadroomlight(x-1,y,roomno);
    spreadroomlight(x,y-1,roomno);
  }
}
Ejemplo n.º 9
0
/* see whether room should be illuminated */
void roomcheck(void)
{
    static int oldroomno = -1;
#if defined(WIN32)
    static int oldlevel = -1;
#else
    static plv oldlevel = NULL;
#endif
    int roomno = Level->site[Player.x][Player.y].roomnumber;

    if ((roomno == RS_CAVERN) ||
            (roomno == RS_SEWER_DUCT) ||
            (roomno == RS_KITCHEN) ||
            (roomno == RS_BATHROOM) ||
            (roomno == RS_BEDROOM) ||
            (roomno == RS_DININGROOM) ||
            (roomno == RS_CLOSET) ||
            (roomno > ROOMBASE))
        if ((! loc_statusp(Player.x,Player.y,LIT)) &&
                (! Player.status[BLINDED]) &&
                (Player.status[ILLUMINATION] || (difficulty() < 6))) {
            showroom(Level->site[Player.x][Player.y].roomnumber);
            spreadroomlight(Player.x,Player.y,roomno);
            levelrefresh();
        }
    if ((oldroomno != roomno) ||
#if defined(WIN32)
            (oldlevel != Level->depth)) {
#else
            (oldlevel != Level)) {
#endif
        showroom(roomno);
        oldroomno = roomno;
#if defined(WIN32)
        oldlevel = Level->depth;
#else
        oldlevel = Level;
#endif
    }
}
Ejemplo n.º 10
0
/* use a thieves pick */
void i_pick(pob o)
{
    int dir;
    int ox,oy;
    o->used = FALSE;
    if ((! o->known) && (! Player.rank[THIEVES]))
        mprint("You have no idea what do with a piece of twisted metal.");
    else {
        if (o->known < 1) o->known = 1;
        Objects[o->id].known = 1;
        mprint("Pick lock:");
        dir = getdir();
        if (dir == ABORT)
            resetgamestatus(SKIP_MONSTERS);
        else {
            ox = Player.x + Dirs[0][dir];
            oy = Player.y + Dirs[1][dir];
            if ((Level->site[ox][oy].locchar != CLOSED_DOOR) ||
                    loc_statusp(ox,oy,SECRET)) {
                mprint("You can't unlock that!");
                resetgamestatus(SKIP_MONSTERS);
            }
            else if (Level->site[ox][oy].aux == LOCKED) {
                if (Level->depth == MaxDungeonLevels-1)
                    mprint("The lock is too complicated for you!!!");
                else if (Level->depth*2 + random_range(50) <
                         Player.dex+Player.level+Player.rank[THIEVES]*10) {
                    mprint("You picked the lock!");
                    Level->site[ox][oy].aux = UNLOCKED;
                    lset(ox, oy, CHANGED);
                    gain_experience(max(3,Level->depth));
                }
                else mprint("You failed to pick the lock.");
            }
            else mprint("That door is already unlocked!");
        }
    }
}
Ejemplo n.º 11
0
/* loads the city level */
void load_city(int populate)
{
    int i,j;
    pml ml;
    char site;
    map *city;
    map *maze;

    initrand(E_CITY, 0);

    /* Get the hedge maze (which is in the city). */
    maze = map_open(MAP_hedges);
    /* Choose a random level from it. */
    map_setLevel(maze, random_range(map_getDepth(maze)));

    /* Get the city. */
    city = map_open(MAP_city);
    map_setLevel(city,0);

    TempLevel = Level;
    if (ok_to_free(TempLevel)) {
#ifndef SAVE_LEVELS
        free_level(TempLevel);
#endif
        TempLevel = NULL;
    }
#ifndef SAVE_LEVELS
    Level = ((plv) checkmalloc(sizeof(levtype)));
#else
    msdos_changelevel(TempLevel,0,-1);
    Level = &TheLevel;
#endif
    clear_level(Level);
    Level->depth = 0;
    Level->environment = E_CITY;

    /* WDT: Rampart, as a special case, has its width stored in a
    * global variable. */
    WIDTH = Level->level_width = map_getWidth(city);
    LENGTH = Level->level_length = map_getLength(city);

    for(j=0; j<Level->level_length; j++) {
        for(i=0; i<Level->level_width; i++) {
            lset(i,j,SEEN);
            site = map_getSiteChar(city,i,j);
            switch(site) {
                /*
                case '@':
                Player.x = i; Player.y = j;
                Level->site[i][j].locchar = FLOOR;
                break;
                */
            case 'g':
                Level->site[i][j].locchar = FLOOR;
                Level->site[i][j].p_locf = L_GARDEN;
                break;
            case 'y':
                Level->site[i][j].locchar = FLOOR;
                Level->site[i][j].p_locf = L_CEMETARY;
                break;
            case 'p': /* WDT: each of these places needs to be assigned
					  * a function (or replaced with an 'x' in the map)
					  */
            case '!':
            case 'I':
            case 'E':
            case 'e':
            case 'x':
                assign_city_function(i,j);
                break;
            case 't':
                Level->site[i][j].locchar = FLOOR;
                Level->site[i][j].p_locf = L_TEMPLE;
                CitySiteList[L_TEMPLE-CITYSITEBASE][0] = TRUE;
                CitySiteList[L_TEMPLE-CITYSITEBASE][1] = i;
                CitySiteList[L_TEMPLE-CITYSITEBASE][2] = j;
                break;
#if 0 /* WDT: HACK!  The new city doesn't use portcullis traps, but has other
                * uses for 'T'.  Um...  I'd rather have a use for them (that's what
                * the jail is supposed to be), so this will stay only for now; with
                    * any luck we'll have things fixed up before the next release. */
                    case 'T':
                    Level->site[i][j].locchar = FLOOR;
                    Level->site[i][j].p_locf = L_PORTCULLIS_TRAP;
                    Level->site[i][j].aux = NOCITYMOVE;
                    break;
#endif /* end of hack */
                    case 'R':
                    Level->site[i][j].locchar = FLOOR;
                    Level->site[i][j].p_locf = L_RAISE_PORTCULLIS;
                    Level->site[i][j].aux = NOCITYMOVE;
                    break;
                    case '7':
                    Level->site[i][j].locchar = FLOOR;
                    Level->site[i][j].p_locf = L_PORTCULLIS;
                    Level->site[i][j].aux = NOCITYMOVE;
                    break;
                    case 'C':
                    Level->site[i][j].locchar = OPEN_DOOR;
                    Level->site[i][j].p_locf = L_COLLEGE;
                    CitySiteList[L_COLLEGE-CITYSITEBASE][0] = TRUE;
                    CitySiteList[L_COLLEGE-CITYSITEBASE][1] = i;
                    CitySiteList[L_COLLEGE-CITYSITEBASE][2] = j;
                    break;
                    case 's':
                    Level->site[i][j].locchar = OPEN_DOOR;
                    Level->site[i][j].p_locf = L_SORCERORS;
                    CitySiteList[L_SORCERORS-CITYSITEBASE][0] = TRUE;
                    CitySiteList[L_SORCERORS-CITYSITEBASE][1] = i;
                    CitySiteList[L_SORCERORS-CITYSITEBASE][2] = j;
                    break;
                    case 'M':
                    Level->site[i][j].locchar = OPEN_DOOR;
                    Level->site[i][j].p_locf = L_MERC_GUILD;
                    CitySiteList[L_MERC_GUILD-CITYSITEBASE][0] = TRUE;
                    CitySiteList[L_MERC_GUILD-CITYSITEBASE][1] = i;
                    CitySiteList[L_MERC_GUILD-CITYSITEBASE][2] = j;
                    break;
                    case 'K':
                    Level->site[i][j].locchar = OPEN_DOOR;
                    Level->site[i][j].p_locf = L_MONASTERY;
                    CitySiteList[L_MONASTERY-CITYSITEBASE][0] = TRUE;
                    CitySiteList[L_MONASTERY-CITYSITEBASE][1] = i;
                    CitySiteList[L_MONASTERY-CITYSITEBASE][2] = j;
                    break;
                    case 'c':
                    Level->site[i][j].locchar = OPEN_DOOR;
                    Level->site[i][j].p_locf = L_CASTLE;
                    CitySiteList[L_CASTLE-CITYSITEBASE][0] = TRUE;
                    CitySiteList[L_CASTLE-CITYSITEBASE][1] = i;
                    CitySiteList[L_CASTLE-CITYSITEBASE][2] = j;
                    break;
                    case '?':
            {
                static int myI = -1, myJ;
                char site;
                if ( myI == -1 )
            {
                /* If this is the first time we've seen the hedge maze,
                * set this as its corner. */
                myI = i;
                myJ = j;
            }
    site = map_getSiteChar(maze, i - myI, j - myJ);
        mazesite(site,i,j,populate);
    }
    break;
    case 'P':
        Level->site[i][j].locchar = OPEN_DOOR;
        Level->site[i][j].p_locf = L_ORDER;
        CitySiteList[L_ORDER-CITYSITEBASE][0] = TRUE;
        CitySiteList[L_ORDER-CITYSITEBASE][1] = i;
        CitySiteList[L_ORDER-CITYSITEBASE][2] = j;
        break;
    case 'H':
        Level->site[i][j].locchar = OPEN_DOOR;
        Level->site[i][j].p_locf = L_CHARITY;
        CitySiteList[L_CHARITY-CITYSITEBASE][0] = TRUE;
        CitySiteList[L_CHARITY-CITYSITEBASE][1] = i;
        CitySiteList[L_CHARITY-CITYSITEBASE][2] = j;
        break;
    case 'h':
        Level->site[i][j].locchar = FLOOR;
        if (populate)
            make_horse(i,j); /* from village.c */
        break;
    case 'j':
        Level->site[i][j].locchar = FLOOR;
        if (populate)
            make_justiciar(i,j);
        break;
    case 'J':
        Level->site[i][j].locchar = CLOSED_DOOR;
        Level->site[i][j].p_locf = L_JAIL;
        break;
    case 'A':
        Level->site[i][j].locchar = OPEN_DOOR;
        Level->site[i][j].p_locf = L_ARENA;
        CitySiteList[L_ARENA-CITYSITEBASE][0] = TRUE;
        CitySiteList[L_ARENA-CITYSITEBASE][1] = i;
        CitySiteList[L_ARENA-CITYSITEBASE][2] = j;
        break;
    case 'B':
        Level->site[i][j].locchar = OPEN_DOOR;
        Level->site[i][j].p_locf = L_BANK;
        CitySiteList[L_BANK-CITYSITEBASE][0] = TRUE;
        CitySiteList[L_BANK-CITYSITEBASE][1] = i;
        CitySiteList[L_BANK-CITYSITEBASE][2] = j;
        lset(i,j,STOPS);
        lset(i,j+1,STOPS);
        lset(i+1,j,STOPS);
        lset(i-1,j,STOPS);
        lset(i,j-1,STOPS);
        break;
    case 'i':
        Level->site[i][j].locchar = OPEN_DOOR;
        Level->site[i][j].p_locf = L_TOURIST;
        CitySiteList[L_TOURIST-CITYSITEBASE][1] = i;
        CitySiteList[L_TOURIST-CITYSITEBASE][2] = j;
        lset(i,j,STOPS);
        lset(i,j+1,STOPS);
        lset(i+1,j,STOPS);
        lset(i-1,j,STOPS);
        lset(i,j-1,STOPS);
        break;
    case 'X':
        Level->site[i][j].locchar = FLOOR;
        Level->site[i][j].p_locf = L_COUNTRYSIDE;
        CitySiteList[L_COUNTRYSIDE-CITYSITEBASE][0] = TRUE;
        CitySiteList[L_COUNTRYSIDE-CITYSITEBASE][1] = i;
        CitySiteList[L_COUNTRYSIDE-CITYSITEBASE][2] = j;
        break;
    case 'v':
        Level->site[i][j].locchar = FLOOR;
        Level->site[i][j].p_locf = L_VAULT;
        Level->site[i][j].aux = NOCITYMOVE;
        lset(i,j,SECRET);
        break;
    case 'S':
        Level->site[i][j].locchar = FLOOR;
        Level->site[i][j].aux = NOCITYMOVE;
        lset(i,j,SECRET);
        break;
    case 'G':
        Level->site[i][j].locchar = FLOOR;
        if (populate) {
            make_site_monster(i,j,GUARD);
            Level->site[i][j].creature->aux1 = i;
            Level->site[i][j].creature->aux2 = j;
        }
        break;
    case 'u':
        Level->site[i][j].locchar = FLOOR;
        if (populate)
            make_minor_undead(i,j);
        break;
    case 'U':
        Level->site[i][j].locchar = FLOOR;
        if (populate)
            make_major_undead(i,j);
        break;
    case 'V':
        Level->site[i][j].showchar = WALL;
        Level->site[i][j].locchar = FLOOR;
        Level->site[i][j].p_locf = L_VAULT;
        if (populate)
            make_site_treasure(i,j,5);
        Level->site[i][j].aux = NOCITYMOVE;
        lset(i,j,SECRET);
        break;
    case '%':
        Level->site[i][j].showchar = WALL;
        Level->site[i][j].locchar = FLOOR;
        Level->site[i][j].p_locf = L_TRAP_SIREN;
        if (populate)
            make_site_treasure(i,j,5);
        Level->site[i][j].aux = NOCITYMOVE;
        lset(i,j,SECRET);
        break;
    case '$':
        Level->site[i][j].locchar = FLOOR;
        if (populate)
            make_site_treasure(i,j,5);
        break;
    case '2':
        Level->site[i][j].locchar = ALTAR;
        Level->site[i][j].p_locf = L_ALTAR;
        Level->site[i][j].aux = ODIN;
        break;
    case '3':
        Level->site[i][j].locchar = ALTAR;
        Level->site[i][j].p_locf = L_ALTAR;
        Level->site[i][j].aux = SET;
        break;
    case '4':
        Level->site[i][j].locchar = ALTAR;
        Level->site[i][j].p_locf = L_ALTAR;
        Level->site[i][j].aux = ATHENA;
        break;
    case '5':
        Level->site[i][j].locchar = ALTAR;
        Level->site[i][j].p_locf = L_ALTAR;
        Level->site[i][j].aux = HECATE;
        break;
    case '6':
        Level->site[i][j].locchar = ALTAR;
        Level->site[i][j].p_locf = L_ALTAR;
        Level->site[i][j].aux = DESTINY;
        break;
    case '^':
        Level->site[i][j].showchar = WALL;
        Level->site[i][j].locchar = FLOOR;
        Level->site[i][j].p_locf = TRAP_BASE+random_range(NUMTRAPS);
        lset(i,j,SECRET);
        break;
    case '"':
        Level->site[i][j].locchar = HEDGE;
        break;
    case '~':
        Level->site[i][j].locchar = WATER;
        Level->site[i][j].p_locf = L_WATER;
        break;
    case '=':
        Level->site[i][j].locchar = WATER;
        Level->site[i][j].p_locf = L_MAGIC_POOL;
        break;
    case '*':
        Level->site[i][j].locchar = WALL;
        Level->site[i][j].aux = 10;
        break;
    case '#':
        Level->site[i][j].locchar = WALL;
        Level->site[i][j].aux = 500;
        break;
    case 'T':/* currently meaningless in large city map. */
    case '>':  /* currently meaningless outside of maze.*/
    case '.':
        Level->site[i][j].locchar = FLOOR;
        break;
    case ',':
        Level->site[i][j].showchar = WALL;
        Level->site[i][j].locchar = FLOOR;
        Level->site[i][j].aux = NOCITYMOVE;
        lset(i,j,SECRET);
        break;
    case '-':
    case 'D': /* WDT: should all Ds be changed to -, or should D be given
					  * special treatment? */
        Level->site[i][j].locchar = CLOSED_DOOR;
        break;
    case '1':
        Level->site[i][j].locchar = STATUE;
        break;
    default:
        printf("\nOops... missed a case [%d,%d]: '%c' (%d)\n", i,j,site,site);
        morewait();
    }

    if (loc_statusp(i,j,SEEN)) {
        if (loc_statusp(i,j,SECRET))
            Level->site[i][j].showchar = WALL;
        else Level->site[i][j].showchar = Level->site[i][j].locchar;
    }
}
}
map_close(maze);
map_close(city);
City = Level;

       /* make all city monsters asleep, and shorten their wakeup range to 2 */
       /* to prevent players from being molested by vicious monsters on */
       /* the streets */
for(ml=Level->mlist; ml!=NULL; ml=ml->next) {
    m_status_reset(ml->m,AWAKE);
    ml->m->wakeup = 2;
}
initrand(E_RESTORE, 0);
}
Ejemplo n.º 12
0
/* x y is the proposed place to move to */
int p_moveable(int x, int y)
{
    State.setSkipMonsters();
    if (! inbounds(x,y)) return (false);
    else if (Player.status[SHADOWFORM]) {
        switch(Level->site[x][y].p_locf) {
        case L_CHAOS:
        case L_ABYSS:
        case L_VOID:
            return cinema_confirm("That looks dangerous.") == 'y';
        default:
            State.setSkipMonsters(false);
            return(true);
        }
    }
    else if (loc_statusp(x,y,SECRET)) {
        if (State.getFastMove() == false) print3("Ouch!");
        return(false);
    }
    else if (Level->site[x][y].creature != NULL) {
        if (State.getFastMove() == false) {
            Level->site[x][y].creature->fight_monster();
            State.setSkipMonsters(false);
            return(false);
        }
        else return(false);
    }
    else if (Level->site[x][y].locchar == CLOSED_DOOR) // Zop: move into door -> opens doors
    {
        if (Level->site[x][y].aux == LOCKED) {
            print3("That door seems to be locked.");
            return(false);
        }
        else {
            Level->site[x][y].locchar = OPEN_DOOR;
            lset(x, y, CHANGED);
            State.setSkipMonsters(false);
            return(false);
        }
    }
    else if ((Level->site[x][y].locchar == WALL) ||
             (Level->site[x][y].locchar == STATUE) ||
             (Level->site[x][y].locchar == PORTCULLIS) ||
             (State.getFastMove() &&
              ((Level->site[x][y].locchar == HEDGE) ||
               (Level->site[x][y].locchar == LAVA) ||
               (Level->site[x][y].locchar == ABYSS) ||
               (Level->site[x][y].locchar == VOID_CHAR) ||
               (Level->site[x][y].locchar == FIRE) ||
               (Level->site[x][y].locchar == WHIRLWIND) ||
               (Level->site[x][y].locchar == WATER) ||
               (Level->site[x][y].locchar == LIFT) ||
               (Level->site[x][y].locchar == TRAP)))) {
        if (State.getFastMove() == false) print3("Ouch!");
        return(false);
    }
    else if (optionp(CONFIRM)) {
        if ((Level->site[x][y].locchar == HEDGE) ||
                (Level->site[x][y].locchar == LAVA) ||
                (Level->site[x][y].locchar == FIRE) ||
                (Level->site[x][y].locchar == WHIRLWIND) ||
                (Level->site[x][y].locchar == ABYSS) ||
                (Level->site[x][y].locchar == VOID_CHAR) ||
                (Level->site[x][y].locchar == WATER) ||
                (Level->site[x][y].locchar == RUBBLE) ||
                (Level->site[x][y].locchar == LIFT) ||
                (Level->site[x][y].locchar == TRAP)) {
            /* horses WILL go into water... */
            if (State.getMounted()) {
                if (Level->site[x][y].locchar != WATER ||
                        Level->site[x][y].p_locf != L_WATER) {
                    print1("You can't convince your steed to continue.");
                    State.setSkipMonsters();
                    return(false);
                }
                else return(true);
            }
            else if (cinema_confirm("Look where you're about to step!") == 'y') State.setSkipMonsters(false);
            else State.setSkipMonsters();
            return(State.getSkipMonsters() == false);
        }
        else {
            State.setSkipMonsters(false);
            return(true);
        }
    }
    else {
        State.setSkipMonsters(false);
        return(true);
    }
}
Ejemplo n.º 13
0
Archivo: scr.c Proyecto: anylonen/omega
int litroom(int x, int y)
{
  if (Level->site[x][y].roomnumber < ROOMBASE) return(FALSE);
  else return(loc_statusp(x,y,LIT) ||
              Player.status[ILLUMINATION]);
}
Ejemplo n.º 14
0
Archivo: scr.c Proyecto: anylonen/omega
/* replace monster with what would be displayed if monster weren't there */
void erase_monster(pmt m)
{
  if (loc_statusp(m->x,m->y,SEEN))
    putspot(m->x,m->y,getspot(m->x,m->y,FALSE));
  else blotspot(m->x,m->y);
}
Ejemplo n.º 15
0
void l_castle(void)
{
    Object* o;
    int x, y;

    if (Player.level < 3) {
        print1("You can't possibly enter the castle, you nobody!");
        print2("Come back when you are famous.");
    }
    else {
        print1("You are ushered into the castle.");
        if (Player.rank[NOBILITY]<DUKE) {
            print2("His Grace, ");
            nprint2(Duke);
            nprint2("-- Duke of Rampart! <fanfare>");
            morewait();
            clearmsg();
        }
        if (Player.rank[NOBILITY]==0) {
            print1("Well, sirrah, wouldst embark on a quest? [yn] ");
            if (ynq1() == 'y') {
                print2("Splendid. Bring me the head of the Goblin King.");
                Player.rank[NOBILITY]=COMMONER;
            }
            else {
                print1("You scoundrel! Guards! Take this blackguard away!");
                morewait();
                p_damage(Player.maxhp / 2, UNSTOPPABLE, "castle guards for lese majeste");
                send_to_jail();
            }
        }
        else if (Player.rank[NOBILITY]==COMMONER) {
            if (find_and_remove_item(CORPSEID,GOBLIN_KING)) {
                print1("Good job, sirrah! I promote you to the rank of esquire.");
                Player.rank[NOBILITY]=ESQUIRE;
                gain_experience(100);
                print2("Now that you have proved yourself true, another quest!");
                morewait();
                print1("Bring to me a Holy Defender!");
                print2("One is said to be in the possession of the Great Wyrm");
                morewait();
                clearmsg();
                print1("in the depths of the sewers below the city.");
            }
            else print2("Do not return until you achieve the quest, caitiff!");
        }
        else if (Player.rank[NOBILITY]==ESQUIRE) {
            if (find_and_remove_item(OB_DEFENDER,-1)) {
                print1("My thanks, squire. In return, I dub thee knight!");
                Player.rank[NOBILITY]=KNIGHT;
                gain_experience(1000);
                print2("If thou wouldst please me further...");
                morewait();
                print1("Bring me a suit of dragonscale armor.");
                print2("You might have to kill a dragon to get one....");
            }
            else print2("Greetings, squire. My sword? What, you don't have it?");
        }
        else if (Player.rank[NOBILITY]==KNIGHT) {
            if (find_and_remove_item(OB_DRAGONSCALE,-1)) {
                print1("Thanks, good sir knight.");
                print2("Here are letters patent to a peerage!");
                Player.rank[NOBILITY]=LORD;
                gain_experience(10000);
                morewait();
                print1("If you would do me a final service...");
                print2("I require the Orb of Mastery. If you would be so kind...");
                morewait();
                print1("By the way, you might find the Orb in the possession");
                print2("Of the Elemental Master on the Astral Plane");
            }
            else print2("Your quest is not yet complete, sir knight.");
        }
        else if (Player.rank[NOBILITY]==LORD) {
            if (find_item(&o,OB_ORB_MASTERY,-1)) {
                print1("My sincerest thanks, my lord.");
                print2("You have proved yourself a true paragon of chivalry");
                morewait();
                print1("I abdicate the Duchy in your favor....");
                print2("Oh, you can keep the Orb, by the way....");
                Player.rank[NOBILITY]=DUKE;
                gain_experience(10000);
                strcpy(Duke,Player.name);
                morewait();
                Dukebehavior = fixnpc(4);
                save_hiscore_npc(12);
                for (y = 52; y < 63; y++)
                    for (x = 2; x < 52; x++) {
                        if (Level->site[x][y].p_locf == L_TRAP_SIREN) {
                            Level->site[x][y].p_locf = L_NO_OP;
                            lset(x, y, CHANGED);
                        }
                        if (x >= 12 && loc_statusp(x, y, SECRET)) {
                            lreset(x, y, SECRET);
                            lset(x, y, CHANGED);
                        }
                        if (x >= 20 && x <= 23 && y == 56) {
                            Level->site[x][y].locchar = FLOOR;
                            lset(x, y, CHANGED);
                        }
                    }

            }
            else print2("I didn't really think you were up to the task....");
        }
    }
}