Пример #1
0
void fear() {
  char mflag;
  char key;
  int  x,y;
  int  xdir,ydir;
  int  mon;
  int  i;
  key = get_dir(&xdir,&ydir);
  x = player.x;
  y = player.y;
  mflag = ' ';
  while (mflag == ' ') {
    x += xdir;
    y += ydir;
    if (player.map[x][y] == 3) mflag = '*';
    if (player.map[x][y] == 38) mflag = '*';
    if (player.map[x][y] == 39) mflag = '*';
    if (player.map[x][y] == 21) mflag = '*';
    if (player.map[x][y] < 0) mflag = '*';
    if (player.map[x][y]>400 && player.map[x][y]<500) mflag = '*';
    if (in_sight(x,y) == '*') {
      show_sprite(x-player.map_x,y-player.map_y,80);
      delay(100);
      show_spot(x,y);
      }
    }
  if (player.map[x][y] < 0 || (player.map[x][y]>400 && player.map[x][y]<500)) {
    if (in_arena == 'Y') mon = player.map[x][y] - 400;
      else mon = player.map[x][y];
    if (in_arena == 'Y') i=50+5*(player.level-player.monster[mon][a_mon].level);
      else i=50+5*(player.level-player.monster[1][mon].level);
    if (in_arena == 'Y' && player.monster[mon][a_mon].special == 1) i=0;
    if (in_arena != 'Y' && player.monster[1][mon].special == 1) i=0;
    if (u_random(100) < i) {
      clear_prompt();
      prompt("SCARED !!!");
      if (in_sight(x,y) == '*') {
        show_sprite(x-player.map_x,y-player.map_y,80);
        delay(250);
        show_spot(x,y);
        }
      if (in_arena != 'Y')
        player.monster[1][mon].fear=u_random(5*(player.level-player.monster[1][mon].level));
      if (in_arena == 'Y')
        player.monster[mon][a_mon].fear=u_random(5*(player.level-player.monster[mon][a_mon].level));
      }
    else {
      clear_prompt();
      prompt("Fizzle. . . ");
      }
    }
  }
Пример #2
0
void show_map() {
  int x,y;
  setfillstyle(1,12);
  bar(0,0,420,10); bar(0,443,420,453);
  bar(0,0,10,453); bar(410,0,420,453);
  bar(419,230,630,240); bar(419,443,630,453); bar(621,230,630,453);
  setfillstyle(1,0);
  bar(10,10,409,442);
  for (x=player.map_x; x<=player.map_x+15; x++)
    for (y=player.map_y; y<=player.map_y+15; y++)
      if (player.known[x][y] != 0) show_spot(x,y);
  show_headings();
  }
Пример #3
0
void area25(int damage) {
  int  x,y;
  int  x1,y1;
  int  mon;
  int  i;
  x1 = player.x; y1 = player.y;
  if (x1<2) x1=2; else if (x1>98) x1 = 98;
  if (y1<2) y1=2; else if (y1>98) y1 = 98;
  for (x=x1-2; x<=x1+2; x++)
    for (y=y1-2; y<=y1+2; y++)
      if (player.map[x][y] < 0 || (player.map[x][y]>400 && player.map[x][y]<500)) {
        if (in_arena == 'Y') mon = player.map[x][y] - 400;
          else mon = player.map[x][y];
        i = 90;
        if (in_arena == 'Y' && player.monster[mon][a_mon].special == 1) i = 0;
        if (in_arena != 'Y' && player.monster[1][mon].special == 1) i = 0;
        if (u_random(100) < i) {
          clear_prompt();
          noise(1000,100);
          prompt("HIT !!!");
          if (in_arena != 'Y' && player.monster[1][mon].special > 9) {
            player.align -= 20;
            player.monster[1][mon].special -= 10;
            if (player.align < 0) player.align = 0;
            }
          if (in_arena == 'Y' && player.monster[mon][a_mon].special > 9) {
            player.align -= 20;
            player.monster[mon][a_mon].special -= 10;
            if (player.align < 0) player.align = 0;
            }
          if (in_sight(x,y) == '*') {
            show_sprite(x-player.map_x,y-player.map_y,80);
            delay(250);
            show_spot(x,y);
            }
          i = u_random(damage) + 1;
          if (in_arena == 'Y') player.monster[mon][a_mon].hp -= i;
            else player.monster[1][mon].hp -= i;
          if (in_arena == 'Y') i=player.monster[mon][a_mon].hp;
            else i=player.monster[1][mon].hp;
          if (i <= 0) {
            clear_prompt();
            if (in_arena != 'Y') {
              gain_exp(player.monster[1][mon].exp);
              player.map[x][y] = player.monster[1][mon].prev;
              }
            if (in_arena == 'Y') {
              gain_exp(player.monster[mon][a_mon].exp);
              player.map[x][y] = player.monster[mon][a_mon].prev;
              }
            show_spot(x,y);
            if (in_arena != 'Y' && player.monster[1][mon].special > 9) {
              player.align -= 20;
              if (player.align < 0) player.align = 0;
              }
            if (in_arena == 'Y' && player.monster[mon][a_mon].special > 9) {
              player.align -= 20;
              if (player.align < 0) player.align = 0;
              }
            show_side();
            }
    
          }
        else {
          clear_prompt();
          prompt("Fizzle. . .");
          }
        }
  }
Пример #4
0
void drain(int damage) {
  char key;
  char buffer[32];
  int  x,y;
  int  xdir,ydir;
  int  mon;
  int  i;
  key = get_dir(&xdir,&ydir);
  x = player.x + xdir;
  y = player.y + ydir;
  if (player.map[x][y] < 0 || (player.map[x][y]>400 && player.map[x][y]<500)) {
    if (in_arena == 'Y') mon = player.map[x][y] - 400;
      else mon = player.map[x][y];
    i = 90;
    if (in_arena == 'Y' && player.monster[mon][a_mon].special == 1) i = 0;
    if (in_arena != 'Y' && player.monster[1][mon].special == 1) i = 0;
    if (u_random(100) < i) {
      clear_prompt();
      noise(1000,100);
      prompt("HIT !!!");
      if (in_arena != 'Y' && player.monster[1][mon].special > 9) {
        player.align -= 20;
        player.monster[1][mon].special -= 10;
        if (player.align < 0) player.align = 0;
        }
      if (in_arena == 'Y' && player.monster[mon][a_mon].special > 9) {
        player.align -= 20;
        player.monster[mon][a_mon].special -= 10;
        if (player.align < 0) player.align = 0;
        }
      if (in_sight(x,y) == '*') {
        show_sprite(x-player.map_x,y-player.map_y,80);
        delay(250);
        show_spot(x,y);
        }
      i = u_random(damage) + 1;
      player.chp += i;
      if (player.chp > player.mhp) player.chp = player.mhp;
      if (in_arena == 'Y') player.monster[mon][a_mon].hp -= i;
        else player.monster[1][mon].hp -= i;
      if (in_arena == 'Y') i=player.monster[mon][a_mon].hp;
        else i=player.monster[1][mon].hp;
      if (i <= 0) {
        clear_prompt();
        if (in_arena != 'Y') {
          sprintf(buffer,"Exp=%.0f",player.monster[1][mon].exp);
          prompt(buffer);
          player.exp += player.monster[1][mon].exp;
          player.map[x][y] = player.monster[1][mon].prev;
          }
        if (in_arena == 'Y') {
          sprintf(buffer,"Exp=%.0f",player.monster[mon][a_mon].exp);
          prompt(buffer);
          player.exp += player.monster[mon][a_mon].exp;
          player.map[x][y] = player.monster[mon][a_mon].prev;
          }
        show_spot(x,y);
        if (in_arena != 'Y' && player.monster[1][mon].special > 9) {
          player.align -= 20;
          if (player.align < 0) player.align = 0;
          }
        if (in_arena == 'Y' && player.monster[mon][a_mon].special > 9) {
          player.align -= 20;
          if (player.align < 0) player.align = 0;
          }
        show_side();
        }

      }
    else {
      clear_prompt();
      prompt("Fizzle. . .");
      }
    }
  }
Пример #5
0
void bandmap_show() {
/*
 * display depending on filter state
 * - all bands on/off
 * - all mode  on/off
 * - dupes     on/off
 *
 * If more entries to show than room in window, show around current frequency
 *
 * mark entries according to age, source and worked state. Mark new multis
 * - new 	brigth blue
 * - normal	blue
 * - aged	black
 * - worked	small caps
 * - new multi	underlined
 * - self announced stations
 *   		small preceeding letter for reporting station
 *
 * maybe show own frequency as dashline in other color
 * (maybee green highlighted)
 * - highligth actual spot if near its frequency
 *
 * Allow selection of one of the spots (switches to S&P)
 * - Ctrl-G as known
 * - '.' and cursor plus 'Enter' \Todo
 * - Test mouseclick..           \Todo
 *
 * '.' goes into map, shows help line above and supports
 * - cursormovement
 * - 'ESC' leaves mode
 * - 'Enter' selects spot
 * - 'B', 'D', 'M' switches filtering for band, dupes and mode on or off.
 */

    GList *list;
    spot *data;
    int curx, cury;
    int bm_x, bm_y;
    int i,j;
    short dupe;
    float centerfrequency;

    if (!bm_initialized) {
	bm_init();
	bm_initialized = 1;
    }

    /* acquire mutex
     * do not add new spots to allspots during
     * - aging and
     * - filtering
     * furthermore do not allow call lookup as long as
     * filtered spot array is build anew */

    pthread_mutex_lock( &bm_mutex );

    /* make array of spots to display
     * filter spotlist according to settings */

    if (spots)
	g_ptr_array_free( spots, TRUE);		/* free array */

    spots = g_ptr_array_sized_new( 128 );	/* allocate new one */

    list = allspots;

    while (list) {
	data = list->data;

	/* if spot is allband or allmode is set or band or mode matches
	 * actual one than add it to the filtered 'spot' array
	 * drop spots on WARC bands if in contest mode
	 */

	dupe = bm_isdupe(data->call, data->band);
	if (    (!contest || !IsWarcIndex(data->band))         &&
		(bm_config.allband || (data->band == bandinx)) &&
		(bm_config.allmode || (data->mode == trxmode)) &&
		(bm_config.showdupes || !dupe)) {

	    data -> dupe = dupe;
	    g_ptr_array_add( spots, data );
	}

	list = list->next;
    }

    pthread_mutex_unlock( &bm_mutex );


    /* afterwards display filtered list around own QRG +/- some offest
     * (offset gets reset if we change frequency */

    getyx( stdscr, cury, curx);		/* remember cursor */

    /* start in line 14, column 0 */
    bm_y = 14;
    bm_x = 0;

    /* clear space for bandmap */
    attrset(COLOR_PAIR(CB_DUPE)|A_BOLD);

    move(bm_y,0);			/* do not overwrite # frequency */
    for (j = 0; j < 67; j++)
	addch(' ');

    for (i = bm_y + 1; i < bm_y + 10; i++) {
	move (i,0);
	for (j = 0; j < 80; j++)
	    addch (' ');
    }

    /* show info text */
    bm_show_info();

    /* split bandmap into two parts below and above current QRG.
     * Give both both parts equal size.
     * If there are less spots then reserved in the half
     * give the remaining room to the other half.
     *
     * These results in maximized usage of the bandmap display while
     * trying to keep the actual frequency in the center.
     */
    unsigned int below_qrg = 0;
    unsigned int on_qrg = 0;
    unsigned int startindex, stopindex;

    centerfrequency = bm_get_center(bandinx, trxmode);

    /* calc number of spots below your current QRG */
    for (i = 0; i < spots->len; i++) {
	data = g_ptr_array_index( spots, i );

	if (data->freq <= (centerfrequency*1000 - TOLERANCE))
	    below_qrg++;
	else
	    break;
    }

    /* check if current QRG is on a spot */
    if (below_qrg < spots->len) {
	data = g_ptr_array_index( spots, below_qrg );

	if (!(data->freq > centerfrequency*1000 + TOLERANCE))
	    on_qrg = 1;
    }

    /* calc the index into the spot array of the first spot to show */
    {
	unsigned int max_below;
	unsigned int above_qrg = spots->len - below_qrg - on_qrg;

	if (above_qrg < 14) {
	    max_below = 30 - above_qrg - 1;
	}
	else
	    max_below = 15;

	startindex = (below_qrg < max_below)? 0 : (below_qrg - max_below);
    }

    /* calculate the index+1 of the last spot to show */
    stopindex  = (spots->len < startindex + 30 - (1 - on_qrg))
	? spots->len
	: (startindex + 30 - (1 - on_qrg));

    /* correct calculations if we have no rig frequency to show */
    if (trx_control == 0) {
	if (on_qrg) {
	    on_qrg = 0;
	} else {
	    stopindex += 1;
	}
	if (spots->len < stopindex)
	    stopindex = spots->len;
    }

    /* show spots below QRG */
    for (i = startindex; i < below_qrg; i++)
    {
	move (bm_y, bm_x);
	show_spot(g_ptr_array_index( spots, i ));
	next_spot_position(&bm_y, &bm_x);
    }

    /* show highlighted frequency marker or spot on QRG if rig control
     * is active */
    if (trx_control != 0) {
	move (bm_y, bm_x);
	attrset(COLOR_PAIR(C_HEADER) | A_STANDOUT);
	if (!on_qrg) {
	    printw ("%7.1f   %s", centerfrequency,  "============");
	}
	else {
	    show_spot_on_qrg(g_ptr_array_index( spots, below_qrg ));
	}
	next_spot_position(&bm_y, &bm_x);
    }

    /* show spots above QRG */
    for (i = below_qrg + on_qrg; i < stopindex; i++)
    {
	move (bm_y, bm_x);
	show_spot(g_ptr_array_index( spots, i ));
	next_spot_position(&bm_y, &bm_x);
    }

    attroff (A_BOLD);
    move(cury, curx);			/* reset cursor */

    refreshp();
}