Exemplo n.º 1
0
void CGame::PlayTurn() {

	int x,y;

	scare_mouse();
	DrawBoard();
	DrawPlayer();
	DrawScores();
	DrawCursor();

	blit(background, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
	unscare_mouse();

	while (!players[currplayer].Done()) {

		if (mouse_b & 1) {

			x = mouse_x;
			y = mouse_y;
			players[currplayer].HandleMouse(x,y);
			rest (200); //rest for a bit so it doesnt keep catching mouse clicks
			
			scare_mouse();
			DrawBoard();
			DrawScores(); //shouldnt have to redraw this, but i dont have time to do a decent redraw management system
			if (!players[currplayer].Done())
				DrawPlayer(); //only redraw if not at end of turn
			DrawCursor();
	
			blit(background, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
			unscare_mouse();
		}

		
	}//end while

	players[currplayer].ResetTurnComplete();
		

	//update currplayer

	int oldcurrplayer;
	oldcurrplayer = currplayer;

	do {
		if (currplayer == (numplayers-1)) {  //if currplayer is last in line
			currplayer = 0;
		}
		else {
			currplayer++;
		}

	//stop increment currplayer if the curr isnt playing AND we have gone through the whole list already
	} while (!players[currplayer].stillplaying && currplayer != oldcurrplayer);


}
Exemplo n.º 2
0
// highlight: animate the placement of the stone
void highlight(int en, int side)
{
	int i;

	scare_mouse();
	if (side == 1)
	{
		for (i = 0; i < 20; ++i)
		{
			// go from blackground color to black
			circlefill(screen, 50*file(en), 45 + 50*rank(en), 15,
				makecol(0, 200 - i*10, 0));
			rest(10);
		}
	}
	else
	{
		for (i = 0; i < 20; ++i)
		{
			// go from background color to white
			circlefill(screen, 50*file(en), 45 + 50*rank(en), 15,
				makecol(i*10, 200 + 55*i/20, i*10));
			rest(10);
		}
	}
	unscare_mouse();
}
Exemplo n.º 3
0
void updatePiece(Piece *p)
{
  BITMAP *work = (current_view == left_view) ? right_view : left_view;

  int i, j, k;
  int lo_i = (p->x >  0) ? p->x - 1 :  0;
  int hi_i = (p->x < 15) ? p->x + 1 : 15;
  int lo_j = (p->y >  0) ? p->y - 1 :  0;
  int hi_j = (p->y <  8) ? p->y + 1 :  8;

  int x = p->x * FACE_WIDTH  - p->z * EDGE_WIDTH  + BOARD_XOFF;
  int y = p->y * FACE_HEIGHT - p->z * EDGE_HEIGHT + BOARD_YOFF;

  rectfill(work, x, y, x + (SPRITE_WIDTH - 1), y + (SPRITE_HEIGHT - 1),
      BACKGROUND_COLOR);

  for(k =    0; k <	3; k++)
  for(j = lo_j; j <= hi_j; j++)
  for(i = lo_i; i <= hi_i; i++)
    if(board[i][j][k].value < EMPTY || editing)
      drawPiece(work, &board[i][j][k]);

  scare_mouse();
  blit(work, current_view, x, y, x, y, SPRITE_WIDTH, SPRITE_HEIGHT);
  if(editing) textprintf(current_view, font, 200, 12, SELECTED,
			 "%3i pieces left", n_pieces_left);
  unscare_mouse();
}
Exemplo n.º 4
0
/* fs_elist_proc:
  *  Dialog procedure for the file selector disk list.
  */
static int fs_elist_proc(int msg, DIALOG *d, int c)
{
    int ret;
    int sel = d->d1;
    char *s, *tok;
    char tmp[80], ext[80];
    static char ext_tokens[] = " ,;";
    
    s = (char *) file_selector[FS_EDIT].dp;
    
    if(msg == MSG_START)
    {
        d->d2 = 0;
    }
    
    ret = jwin_droplist_proc(msg, d, c);
    
    if((sel != d->d1) || (ret & D_CLOSE))
    {
        // change the extension(s)
        fext = fext_list[d->d1].ext;
//    if (fext)// && ugetc(fext))
        {
            parse_extension_string(fext);
        }
        
        // check whether the extension on the current file name is still valid
        if((fext) && (strlen(get_filename(s))))
        {
            strcpy(tmp, fext);
            strcpy(ext, get_extension(s));
            tok = strtok(tmp, ext_tokens);
            
            while(tok)
            {
                if(stricmp(ext, tok) == 0)
                    break;
                    
                tok = strtok(NULL, ext_tokens);
            }
            
            // not valid, replace file name
            if(!tok)
                replace_filename(s, flist->dir, "", 256);
        }
        
        scare_mouse();
        SEND_MESSAGE(file_selector+FS_FILES, MSG_START, 0);
        SEND_MESSAGE(file_selector+FS_FILES, MSG_DRAW, 0);
        SEND_MESSAGE(file_selector+FS_EDIT, MSG_START, 0);
        SEND_MESSAGE(file_selector+FS_EDIT, MSG_DRAW, 0);
        unscare_mouse();
        
        if(ret & D_CLOSE)
            return (ret | SEND_MESSAGE(file_selector+FS_EDIT, MSG_KEY, 0)) & ~D_CLOSE;
    }
    
    return ret;
}
Exemplo n.º 5
0
void DrawList(List thelist)
{
 // traverse the list from last to first.. drawing each object
 NodeLink currnode;
 int color;
 thelist->cursor = thelist->last;

 scare_mouse();

 while (thelist->cursor != NULL) {

       currnode = thelist->cursor;

       if (currnode->Object == LINE) {
          linebres(currnode->obj_data.line.p1.x,
                   currnode->obj_data.line.p1.y,
                   currnode->obj_data.line.p2.x,
                   currnode->obj_data.line.p2.y,
                   currnode->obj_data.line.color);
       }
       else {
            if (currnode->Object == CIRCLE) {
               circlebres(screen,
                          currnode->obj_data.circle.p1.x,
                          currnode->obj_data.circle.p1.y,
                          currnode->obj_data.circle.radius,
                          currnode->obj_data.circle.color);
            }
            else {
                if (currnode->Object == POLYGON) {
                   color = currnode->obj_data.polygon.color;
                   drawpoly(currnode,color);
                }
                else {
                     if (currnode->Object == TEXT) {

                        textout(screen,font,currnode->obj_data.text.data,
                                         currnode->obj_data.text.p1.x,
                                         currnode->obj_data.text.p1.y,
                                         currnode->obj_data.text.color);
                     }
                }

            }
            

       }

       thelist->cursor = thelist->cursor->prev; //mode cursor back a node

 }

 unscare_mouse(); 

}
Exemplo n.º 6
0
static int d_agup_slider_pro2(int msg, DIALOG * d, int c)
{
    char s[100];
    int v;
    v = d_agup_slider_proc(msg, d, c);
    switch (msg) {
        case MSG_DRAW:
            sprintf(s, "%3d", d->d2);
            text_mode(agup_bg_color);
            gui_textout(screen, s, d->x + d->w, d->y + 4, d->fg, 0);
            break;
        case MSG_CLICK:
        case MSG_CHAR:
            if (d == &sol_dialog[D_STRENGTH])
            {
                if (d->d2 > 40) d->d2 = 40;
                if (d->d2 < 25) d->d2 = 25;
            }
            else
            {
                if (d->d2 > 80) d->d2 = 80;
                if (d->d2 < 50) d->d2 = 50;
            }

            points = sol_dialog[D_TIME].d2 +
                     sol_dialog[D_HEALTH].d2 +
                     sol_dialog[D_FIRE_ACCUR].d2 +
                     sol_dialog[D_THRU_ACCUR].d2 +
                     sol_dialog[D_STAMINA].d2 +
                     (sol_dialog[D_STRENGTH].d2 * 2) +
                     sol_dialog[D_REACTION].d2;

            if (points > MAXPOINTS && d == &sol_dialog[D_STRENGTH]) {
                points -= d->d2 * 2;
                d->d2 = (MAXPOINTS - points) / 2;
                points += d->d2 * 2;
            } else if (points > MAXPOINTS) {
                points -= d->d2;
                d->d2 = MAXPOINTS - points;
                points += d->d2;
            }

            scare_mouse();

            SEND_MESSAGE(d, MSG_DRAW, 0);
            sprintf(points_str, _("Points remain: %2d "), MAXPOINTS - points);
            SEND_MESSAGE(&sol_dialog[D_POINTS], MSG_DRAW, 0);

            unscare_mouse();
            break;
        default:
            break;
    }
    return v;
}
void BarCounter::paint() {
	if(loader->needsDisplay())
		return;
	scare_mouse();
	for(int i = 0; i < 4; i++) {
		int c = (bars==i)?COLOR_BAR_PASSED:COLOR_BAR_DUE;
		circlefill(screen, x + 23 * i, y, 10, c);
		circle(screen, x + 23 * i, y, 10, 0);
	}
	unscare_mouse();
}
Exemplo n.º 8
0
void rubbercircle(List thelist, int color)
{
    int x1, x2, y1, y2;
    int radius;
    int x3, y3;

    Circle_Type circledata;

    while (!(mouse_b & 2)) {

    if (mouse_b & 1) {
       x3 = x1 = mouse_x;
       y3 = y1 = mouse_y;
       scare_mouse();

	    /* draw circle while waiting for mouse release */
	    while (mouse_b & 1) {
		x2 = mouse_x;
		y2 = mouse_y;

		if (x2 != x3 || y2 != y3) {

		    rrestore(screen);//first time through ii=0
		    radius = calc_radius(x1, y1, x2, y2);
		    /* save/draw/wait/restore */
		    do_circle(screen, x1, y1, radius, color, rsave);
		    x3 = x2;
		    y3 = y2;
		}
	    }


	    rrestore(screen);
	    x2 = mouse_x;
	    y2 = mouse_y;
	    radius = calc_radius(x1, y1, x2, y2);
	    circlebres(screen, x1, y1, radius, color);

            circledata.p1.x = x1;
            circledata.p1.y = y1;
            circledata.radius = radius;
            circledata.color = color;
            circledata.filled = FALSE;
            circledata.fill_color = 0;
            circledata.width = 1;

            AddCircle(thelist, circledata);
            
	    unscare_mouse();
	}

    } //end while

}
Exemplo n.º 9
0
void Slider::paint(){
	scare_mouse();
	Box::paint();
	textprintf_centre_ex(screen, font, x + w / 2 + 4, y + 3, COLOR_DEFAULT_BUTTONTEXT_SHADOW, -1, "%s", text);
	textprintf_centre_ex(screen, font, x + w / 2 + 2, y + 1, COLOR_DEFAULT_BUTTONTEXT, -1, "%s", text);
	rectfill(screen, x + 2, y + 86 - (int)(72 * value), x + 26, y + 86, COLOR_SLIDER);
	if(recording)
		line(screen, x + 2, y + 86 - (int)(72 * sval), x + 26, y + 86 - (int)(72 * sval), 0);

	rect(screen, x + 2, y + 14, x + 26, y + 86, 0);
	unscare_mouse();
}
Exemplo n.º 10
0
void rubberline(List thelist, int color)
{
    int x1, x2, y1, y2;
    int x3, y3;

    Line_Type linedata;

    while (!(mouse_b & 2)) {  //quick addin

    if (mouse_b & 1) {

       x3 = x1 = mouse_x;
       y3 = y1 = mouse_y;
       scare_mouse();

       /* draw circle while waiting for mouse release */
       while (mouse_b & 1) {
             x2 = mouse_x;
             y2 = mouse_y;

             if (x2 != x3 || y2 != y3) {

                rrestore(screen);//first time through ii=0
                do_line(screen,x1,y1,x2,y2, color, rsave);
                x3 = x2;
                y3 = y2;
             }

       }

       rrestore(screen);
       x2 = mouse_x;
       y2 = mouse_y;
       linebres(x1,y1,x2,y2,color);

       linedata.p1.x = x1;
       linedata.p1.y = y1;
       linedata.p2.x = x2;
       linedata.p2.y = y2;
       linedata.color = color;
       linedata.width = 1;

       AddLine(thelist,linedata);

       unscare_mouse();

    }
    }// end whileaddin

}
Exemplo n.º 11
0
void movemissile()
{     
     samExplosion2 = load_sample("C:\\Sanchit\\Game Pack\\Sprites\\explosion2.wav");
 
     int x = points[curpoint].x ;
     int y = points[curpoint].y ;
 
     scare_mouse();

     rectfill(buffer,x-6,y-3,x+6,y+1,BLACK);

     if (getpixel(screen,x,y) == GREEN)
     {  
            destroyed++;
            updatescore();
            rectfill(buffer, 2, 14, 636, 352, BLACK);
     }
     else
     {
          putpixel(buffer,x,y-3,SMOKE);
          circlefill(buffer,x,y,2,BLUE);
     }
         
     unscare_mouse();
     
     curpoint++;
     if (curpoint >= totalpoints)
     {        
          play_sample(samExplosion2, 128, 128, 1000, 0);
          destroyed++;

          explosion2(screen, x, y, BLACK);

          textout_ex( screen, font, "Game Over", 300, 230, makecol( 255, 0, 0), makecol( 0, 0, 0));       
          rest(2000);
          textprintf(screen,font,300,245,makecol(255,255,255), "Final Score=%d", score);
          rest(2000);
          
          stop_sample(samSong);
          stop_sample(samExplosion2);
          
          score=-1;
          
          openscreen();
     }
}
Exemplo n.º 12
0
static void
draw_image(BITMAP *bmp, int x, int y)
{
	scare_mouse();
	if (bmp) {
		blit(bmp, screen, x, y, 0, 0, bmp->w, bmp->h);
		x = bmp->w - x;
		y = bmp->h - y;
		if (x < SCREEN_W)
			rectfill(screen, x, 0, SCREEN_W, SCREEN_H, gui_mg_color);
		if (y < SCREEN_H)
			rectfill(screen, 0, y, x, SCREEN_H, gui_mg_color);
	}
	else
		clear_to_color(screen, gui_mg_color);
	unscare_mouse();
}
Exemplo n.º 13
0
int
d_abitmap_push_proc (int msg, DIALOG *d, int c)
{
	int ret = D_O_K;

	d->flags |= D_EXIT;
	ret |= d_abitmap_button_proc (msg, d, c);
	if (ret & D_CLOSE) {
		ret &= ~D_CLOSE;

		scare_mouse_area (d->x, d->y, d->x + d->w, d->y + d->h);
		object_message (d, MSG_DRAW, 0);
		unscare_mouse ();

		if (d->dp3)
			ret |= ((int (*)(DIALOG *)) d->dp3) (d);
	}
	return ret;
}
Exemplo n.º 14
0
Arquivo: bgui.c Projeto: rofl0r/GfxRip
int shutdown_moveable(DIALOG *dialog)
{
 BILLWIN_INFO_STRUCTURE *infostruct = dialog->dp3;
 if (infostruct)
 {
  if(infostruct->backbuffer)
  {
   scare_mouse();
   blit(infostruct->backbuffer, screen, 0, 0, dialog->x, dialog->y, dialog->w+1, dialog->h+1);
   destroy_bitmap(infostruct->backbuffer);
   unscare_mouse();
  }
  free(infostruct);
  dialog->dp3 = NULL;
 }
 return 0;

 return 0;
}
Exemplo n.º 15
0
Arquivo: bgui.c Projeto: rofl0r/GfxRip
/*
  ==============================
  =  Stuff that didn't fit in  =
  ==============================
*/
int init_moveable(DIALOG *dialog)
{
 BITMAP *backbuffer = create_bitmap(dialog->w+1, dialog->h+1);
 BILLWIN_INFO_STRUCTURE *infostruct = malloc(sizeof(BILLWIN_INFO_STRUCTURE));

 /* We do NOT need to memverify the above, if they aren't there, the window will
    notice, and disable the moving routine */

 if (backbuffer) {
  scare_mouse();
  blit(screen, backbuffer, dialog->x, dialog->y, 0, 0, dialog->w+1, dialog->h+1);
  unscare_mouse();
 }

 if(infostruct)
  infostruct->backbuffer = backbuffer;
 dialog->dp3 = infostruct;

 return 0;
}
Exemplo n.º 16
0
int my_list_proc( int msg, DIALOG* d, int c )
{
    STACKTRACE;
    int old_d1 = d->d1;
    Fleet *fleet = (Fleet*)d->dp3;
    int ret = d_list_proc2( msg, d, c );
    if ( d->d1 != old_d1 || msg == MSG_START ) {
        ShipType* type = fleet->getShipType(d->d1);

        ASSERT(type != NULL);

        selectDialog[SELECT_DIALOG_TITLE].flags |= D_DIRTY;
        sprintf(selectTitleString, "%s\n%s\n%d of %d points",
                selectShipPrompt,
                (type != NULL) ? type->name : 0,
                (type != NULL) ? type->cost : 0,
                fleet->getCost());

        BITMAP* panel = NULL;
        TW_DATAFILE* data = tw_load_datafile_object( type->data->file, "SHIP_P00_PCX" );

        if ( data ) {
            BITMAP* bmp = (BITMAP*)data->dat;
            panel = create_bitmap_ex( bitmap_color_depth(screen), bmp->w, bmp->h );
            blit( bmp, panel, 0, 0, 0, 0, bmp->w, bmp->h );
            tw_unload_datafile_object( data );
            data = tw_load_datafile_object( type->data->file, "SHIP_P01_PCX" );
            bmp = (BITMAP*)data->dat;
            blit( bmp, panel, 0, 0, 4, 65, bmp->w, bmp->h );
            tw_unload_datafile_object( data );
            color_correct_bitmap( panel, 0 );
        }

        if ( selectDialog[SELECT_DIALOG_PIC].dp ) destroy_bitmap( (BITMAP*)selectDialog[SELECT_DIALOG_PIC].dp );
        selectDialog[SELECT_DIALOG_PIC].dp = panel;
        scare_mouse();
        SEND_MESSAGE( &selectDialog[SELECT_DIALOG_PIC], MSG_DRAW, 0 );
        unscare_mouse();
    }
    return ret;
}
Exemplo n.º 17
0
Arquivo: bgui.c Projeto: rofl0r/GfxRip
void bill_fade_bmp(BITMAP *bmp, int clr) {
/* This makes a checkerboard pattern of pixels of a specified color,
   it can be used to achieve a Windows "shudown" like effect */
 int yoff;
 int ysub;
 int xoff;
 int xadd;
 scare_mouse();
 acquire_screen();
 for(yoff=0; yoff<=SCREEN_H; yoff +=2) {
  for(ysub=0; ((yoff-ysub)>=0);ysub++)
   putpixel(bmp, ysub, yoff-ysub, clr);
 }

 for(xoff=0; xoff<=SCREEN_W; xoff +=2) {
  for(xadd=0; ((xoff+xadd)<=SCREEN_W); xadd++)
   putpixel(bmp, xoff+xadd, SCREEN_H-xadd, clr);
 }
 release_screen();
 unscare_mouse();
}
Exemplo n.º 18
0
/* fs_dlist_proc:
 *  Dialog procedure for the file selector disk list.
 */
static int fs_dlist_proc(int msg, DIALOG *d, int c)
{
   char *s = file_selector[FS_EDIT].dp;
   int ret, i, temp;

   if (msg == MSG_START) {
      d->d1 = d->d2 = 0;
      temp = utoupper(ugetc(s));
      if (((temp >= 'A') && (temp <= 'Z')) && (ugetat(s, 1) == DEVICE_SEPARATOR)) {
	 temp -= 'A';
	 for (i=0; i<temp; i++)
	    if (drive_exists(i))
	       d->d1++;
      }
   }

   ret = d_text_list_proc(msg, d, c);

   if (ret == D_CLOSE) {
      temp = 'A' + get_x_drive(d->d1+1);
      if ((temp < 'A') || (temp > 'Z'))
	 temp = 'C';

      s += usetc(s, temp);
      s += usetc(s, DEVICE_SEPARATOR);
      s += usetc(s, OTHER_PATH_SEPARATOR);
      usetc(s, 0);

      scare_mouse();
      SEND_MESSAGE(file_selector+FS_FILES, MSG_START, 0);
      SEND_MESSAGE(file_selector+FS_FILES, MSG_DRAW, 0);
      SEND_MESSAGE(file_selector+FS_EDIT, MSG_START, 0);
      SEND_MESSAGE(file_selector+FS_EDIT, MSG_DRAW, 0);
      unscare_mouse();

      return D_O_K;
   }

   return ret;
}
Exemplo n.º 19
0
void
render_info(BITMAP *bmp)
{
	char buf[256];

	scare_mouse();

	rectfill(bmp, 0, bmp->h - 16, bmp->w/2, bmp->h, bgc);
	rectfill(bmp, bmp->w/3, 0, (int)bmp->w*.66, 10, bgc);

	if (selected_node)
	{
		snprintf(buf, sizeof(buf), "%s: %s (ID: %d   coord: %d,%d)",
		         (selected_node->area?selected_node->area:"(unknown area)"),
		         (selected_node->title?selected_node->title:"(unknown title)"),
		         selected_node->id, selected_node->x, selected_node->y);

		textprintf_centre_ex(bmp, font, bmp->w/2, 2, 0, -1, "%s",
		                     buf);
		hline(bmp, bmp->w/2 - text_length(font, buf)/2, 10,
		      bmp->w/2 + text_length(font, buf)/2, 0);

		highlight_node(selected_node, highlight_color);
	}

	textprintf_ex(bmp, font, 2, (bmp->h - 8) - 2 - text_height(font), 0, -1,
		              "Center: %d,%d", (int)(bmp->w/2.0+xoffset), (int)(bmp->h/2.0+yoffset));
	textprintf_ex(bmp, font, 2, bmp->h - 8, 0, -1,
		              "Mouse: %d,%d", mouse_x+xoffset, mouse_y+yoffset);

	if (last_file)
	{
		snprintf(buf, sizeof(buf), "Most recent file: \"%s\"   (%d nodes total)", last_file, vector_len((vector_t *)nodelist));
		rectfill(bmp, text_length(font, buf), bmp->h - text_height(font), bmp->w, bmp->h, bgc);

		textprintf_right_ex(bmp, font, bmp->w, bmp->h-10, 0, -1, "%s", buf);
	}

	unscare_mouse();
}
Exemplo n.º 20
0
// print board
void printbd(int *board)
{
	int i;

	scare_mouse();

	line(screen, 20, 20, 420, 20, makecol(0, 0, 0));
	line(screen, 20, 20, 20, 420, makecol(0, 0, 0));
	line(screen, 420, 20, 420, 420, makecol(0, 0, 0));
	line(screen, 20, 420, 420, 420, makecol(0, 0, 0));

	// vertical lines
	for (i = 0; i < 8; ++i)
		line(screen, 70 + 50*i, 20, 70 + 50*i, 420, makecol(0, 0, 0));
	
	// horizontal lines
	for (i = 0; i < 8; ++i)
		line(screen, 20, 70 + 50*i, 420, 70 + 50*i, makecol(0, 0, 0));
	
	// pieces
	for (i = 0; i < 100; ++i)
	{
		if (board[i] == 1)
		{
			circlefill(screen, 50*file(i), 45 + 50*rank(i), 15, 
						makecol(0, 0, 0));
		}
		if (board[i] == -1)
		{
			circlefill(screen, 50*file(i), 45 + 50*rank(i), 15, 
						makecol(255, 255, 255));
		}
	}
	
	unscare_mouse();
}
Exemplo n.º 21
0
// print status line beneath board
void printst(int *board, int flag)
{
	int iblack = 0, iwhite = 0;
	int i;

	for (i = 0; i < 100; ++i)
	{
		if (board[i] == 1) ++iblack;
		if (board[i] == -1) ++iwhite;
	}

	scare_mouse();

	if (!flag)
		textprintf_centre_ex(screen, font, SCREEN_W/2, 440, 
							makecol(0, 0, 0), makecol(0, 200, 0),
							"Black: %i | White: %i", iblack, iwhite);
	else
		textprintf_centre_ex(screen, font, SCREEN_W/2, 440,
							makecol(0, 0, 0), makecol(0, 200, 0),
							"Black: %i [GAME OVER] White: %i", iblack, iwhite);

	unscare_mouse();
}
Exemplo n.º 22
0
void display::Blit(Surface source, WORD sourcex, WORD sourcey, WORD destx, WORD desty, WORD _width, WORD _height)
{
    scare_mouse();
    this->_screen->Blit(source, sourcex, sourcey, destx, desty, _width, _height);
    unscare_mouse();
}
Exemplo n.º 23
0
/* d_editbox_proc:
  *  A text box object. The dp field points to a char * which is the text
  *  to be displayed in the text box. If the text is long, there will be
  *  a vertical scrollbar on the right hand side of the object which can
  *  be used to scroll through the text. The default is to print the text
  *  with word wrapping, but if the D_SELECTED flag is set, the text will
  *  be printed with character wrapping. The d1 field is used internally
  *  to store the number of lines of text, and d2 is used to store how far
  *  it has scrolled through the text.
  */
int d_editbox_proc(int msg, DIALOG *d, int c)
{
	EditboxModel *model= (EditboxModel *)d->dp;
	int ret = D_O_K;
  
	static clock_t ticks;
	bool dontredraw=false;
	switch(msg)
	{
	case MSG_START:
		{
			model->getSelection().clearSelection();
			model->getView()->initialize(model);
			break;
		}
	case MSG_IDLE:
		{
			if ((d->flags & D_GOTFOCUS)&&(clock()>ticks))
			{
				d->flags |= D_DIRTY;
				ticks=clock()+(CLOCKS_PER_SEC/2);
				model->getCursor().invertVisibility();
			}
			break;
		}
	case MSG_DRAW:
		{
			model->getView()->draw();
			break;
		}
	case MSG_WANTFOCUS:
		{
			ret = D_WANTFOCUS;
			break;
		}
	case MSG_CHAR:
		{
			//handle selecting (bah)
			
			switch(c>>8)
			{
			case KEY_LEFT:
			case KEY_RIGHT:
			case KEY_UP:
			case KEY_DOWN:
			case KEY_HOME:
			case KEY_END:
			case KEY_PGUP:
			case KEY_PGDN:
				if (key[KEY_LSHIFT]||key[KEY_RSHIFT])
				{
					model->getSelection().ensureSelecting(model->getCursor());
				}
				else
				{
					model->getSelection().clearSelection();
				}
			}
			
			//normal event handling
			switch(c>>8)
			{
			case KEY_LEFT:
				model->getCursor()--;
				ret = D_USED_CHAR;
				break;
			case KEY_RIGHT:
				model->getCursor()++;
				ret = D_USED_CHAR;
				break;
			case KEY_UP:
				model->getView()->lineUp();
				ret = D_USED_CHAR;
				break;
			case KEY_DOWN:
				model->getView()->lineDown();
				ret = D_USED_CHAR;
				break;
			case KEY_HOME:
				model->getView()->lineHome();
				ret = D_USED_CHAR;
				break;
			case KEY_END:
				model->getView()->lineEnd();
				ret = D_USED_CHAR;
				break;
			case KEY_PGDN:
				model->getView()->pageDown();
				ret = D_USED_CHAR;
				break;
			case KEY_PGUP:
				model->getView()->pageUp();
				ret = D_USED_CHAR;
				break;
			case KEY_ENTER:
			case KEY_ENTER_PAD:
				model->clear();
				model->getCursor().insertNewline();
				ret = D_USED_CHAR;
				break;
			case KEY_TAB:
				{
					model->clear();
					int ch = Unicode::getCharAtOffset(uconvert_ascii("\t",NULL),0);
					model->getCursor().insertChar(ch);
					ret = D_USED_CHAR;
					break;
				}
			case KEY_DEL:
			case KEY_DEL_PAD:
				if(model->getSelection().hasSelection())
					model->clear();
				else
					model->getCursor().deleteChar();
				ret = D_USED_CHAR;
				break;
			case KEY_BACKSPACE:
				if(model->getSelection().hasSelection())
					model->clear();
				else if(model->getCursor().getPosition() != 0)
				{
					model->getCursor()--;
					model->getCursor().deleteChar();
				}
				ret = D_USED_CHAR;
				break;
			case KEY_C:
				if (key[KEY_LCONTROL]||key[KEY_RCONTROL])
				{
					model->copy();
					ret = D_USED_CHAR;
					break;
				}
				ret = D_O_K;
				break;
			case KEY_X:
				if (key[KEY_LCONTROL]||key[KEY_RCONTROL])
				{
					model->cut();
					ret = D_USED_CHAR;
					break;
				}
				ret = D_O_K;
				break;
			case KEY_V:
				if(key[KEY_LCONTROL]||key[KEY_RCONTROL])
				{
					model->clear();
					model->paste();
					ret = D_USED_CHAR;
					break;
				}
				ret = D_O_K;
				break;
			case KEY_ESC:
				return D_EXIT;
			case KEY_F1:
				model->doHelp();
				ret = D_USED_CHAR;
				dontredraw=true;
				break;
			}
			//selection post-processing
			if (key[KEY_LSHIFT]||key[KEY_RSHIFT])
			{
				switch(c>>8)
				{
				case KEY_LEFT:
				case KEY_RIGHT:
				case KEY_UP:
				case KEY_DOWN:
				case KEY_HOME:
				case KEY_END:
				case KEY_PGUP:
				case KEY_PGDN:
					model->getSelection().adjustSelection(model->getCursor());
				}
			}
			break;
		}
	case MSG_UCHAR:
		{
			ret = D_USED_CHAR;
			if ((c >= ' ') && (uisok(c)))
			{
				model->clear();
				model->getCursor().insertChar(c);
			}
		}
		break;
	case MSG_CLICK:
		{
			bool redraw = model->getView()->mouseClick(gui_mouse_x(), gui_mouse_y());
			if(model->getCursor().isVisible())
					model->getCursor().invertVisibility();
			if(redraw)
			{
				object_message(d, MSG_DRAW, 0);
			}
			while(gui_mouse_b())
			{
				
				if(model->getView()->mouseDrag(gui_mouse_x(), gui_mouse_y()))
				{
					scare_mouse();
					object_message(d, MSG_DRAW, 0);
					unscare_mouse();
				}
			}
			model->getView()->mouseRelease(gui_mouse_x(), gui_mouse_y());
			if(!model->getCursor().isVisible())
					model->getCursor().invertVisibility();
			d->flags |= D_DIRTY;
			break;
		}
	case MSG_WHEEL:
		{
			if(c>0)
				model->getView()->scrollUp();
			else
				model->getView()->scrollDown();
			d->flags |= D_DIRTY;
			break;
		}
    
	}
	if(ret == D_USED_CHAR && !dontredraw)
	{
		//redraw
		if(!model->getCursor().isVisible())
			model->getCursor().invertVisibility();
		ticks=clock()+(CLOCKS_PER_SEC/2);
		model->getView()->ensureCursorOnScreen();
		d->flags |= D_DIRTY;
	}
	return ret;
} 
Exemplo n.º 24
0
int rubberpolygon(List thelist, int color)
{
 int x1, x2, y1, y2;
 int x3, y3;

 bool firstrun = TRUE;

 PList polylist;
 Poly_Type polydata;

 polylist = PCreateList(); //make a point list

 while (!(mouse_b & 2)) {

       if (mouse_b & 1) {
          if (firstrun){
             x3 = x1 = mouse_x;
             y3 = y1 = mouse_y;
             PAddNode(polylist,x1,y1);
             scare_mouse();
          }
          else {
               x3 = x1 = x2;
               y3 = y1 = y2;
          }

          /* draw line while waiting for mouse release */
          while (mouse_b & 1) {
                x2 = mouse_x;
                y2 = mouse_y;

                if (x2 != x3 || y2 != y3) {
                   rrestore(screen);//first time through ii=0
                   do_line(screen,x1,y1,x2,y2,color, rsave);
                   x3 = x2;
                   y3 = y2;
                }
          }
          /* on m1 release */
          rrestore(screen);
          x2 = mouse_x; // get current xy
          y2 = mouse_y;
          linebres(x1,y1,x2,y2,color);

          PAddNode(polylist,x2,y2); //add second point

          firstrun = FALSE;

       }
 
 }//while !mouse 2
 linebres(polylist->last->ppoint.x,polylist->last->ppoint.y,
          polylist->first->ppoint.x,polylist->first->ppoint.y,color);
 //textprintf(screen,font,1,1,color,"%d",polylist->length);

 polydata.theplist = polylist;
 polydata.color = color;
 polydata.filled = FALSE;
 polydata.fill_color = 0;
 polydata.width = 1;
 
 AddPolygon(thelist, polydata);

 //DisposePList(polylist);//oops ;)
 unscare_mouse();
 return 0;
}
Exemplo n.º 25
0
void rubberrectangle(List thelist, int color)
{
    int x1, x2, y1, y2;
    int x3, y3;

    Poly_Type polydata;
    PList polylist;

    polylist = PCreateList();

    while (!(mouse_b & 2)) {  //quick addin

    if (mouse_b & 1) {

       x3 = x1 = mouse_x;
       y3 = y1 = mouse_y;
       scare_mouse();

       /* draw box while waiting for mouse release */
       while (mouse_b & 1) {
             x2 = mouse_x;
             y2 = mouse_y;
             
             if (x2 != x3 || y2 != y3) {

                rrestore(screen);//first time through ii=0
                if (x1 < x2) {
                   do_line(screen,x1+1,y1,x2-1,y1, color, rsave);
                   do_line(screen,x2,y1+1,x2,y2-1, color, rsave);
                   do_line(screen,x2-1,y2,x1+1,y2, color, rsave);
                   do_line(screen,x1,y2-1,x1,y1+1, color, rsave);
                }
                if (x2 < x1) {
                   do_line(screen,x1-1,y1,x2+1,y1, color, rsave);
                   do_line(screen,x2,y1-1,x2,y2+1, color, rsave);
                   do_line(screen,x2+1,y2,x1-1,y2, color, rsave);
                   do_line(screen,x1,y2+1,x1,y1-1, color, rsave);
                }
                x3 = x2;
                y3 = y2;
             }
       }/* end while */
        rrestore(screen);
        x2 = mouse_x;
        y2 = mouse_y;
        //draw final points
        linebres(x1,y1,x2,y1,color);
        linebres(x2,y1,x2,y2,color);
        linebres(x2,y2,x1,y2,color);
        linebres(x1,y2,x1,y1,color);

        //add points to plist
        PAddNode(polylist,x1,y1);
        PAddNode(polylist,x2,y1);
        PAddNode(polylist,x2,y2);
        PAddNode(polylist,x1,y2);

        polydata.theplist = polylist;
        polydata.color = color;
        polydata.filled = FALSE;
        polydata.fill_color = 0;
        polydata.width = 1;
 
        AddPolygon(thelist, polydata);

        polylist = PCreateList(); //leak?

        unscare_mouse();
      }
    }// end whileaddin
}
Exemplo n.º 26
0
int save_options_proc(int msg, DIALOG *d, int c)
{
   int ret;
   int old_baud_rate;
   BITMAP *bmp;
   FILE *file;

   ret = d_button_proc(msg, d, c);

   if (ret == D_CLOSE)
   {
      old_baud_rate = comport.baud_rate;
      broadcast_dialog_message(MSG_SAVE_OPTIONS, 0);
      
      if (comport.baud_rate != old_baud_rate)
      {
         if (alert("WARNING!", "This operation may cause scan tool to stop responding.", "Are you sure you want to change the baud rate?", "Yes", "No", 0, 0) != 1)
         {
            comport.baud_rate = old_baud_rate;
            broadcast_dialog_message(MSG_REFRESH, 0);
            return D_O_K;
         }
      }

      close_comport(); // close current comport
      open_comport(); // try reinitializing comport (comport.status will be set)
      
      if ((!(display_mode & WINDOWED_MODE) && (display_mode & WINDOWED_MODE_SET)) || ((display_mode & WINDOWED_MODE) && !(display_mode & WINDOWED_MODE_SET)))
      {
         bmp = create_bitmap(SCREEN_W, SCREEN_H);
         if (bmp)
         {
            scare_mouse();
            blit(screen, bmp, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
            unscare_mouse();

            if (display_mode & WINDOWED_MODE)
            {
               if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0) == 0)
                  display_mode |= WINDOWED_MODE_SET;
               else
                  display_mode &= ~WINDOWED_MODE_SUPPORTED;
            }
            else
            {
               if (set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 640, 480, 0, 0) == 0)
                  display_mode &= ~WINDOWED_MODE_SET;
               else
                  display_mode &= ~FULLSCREEN_MODE_SUPPORTED;
            }

            set_pallete(datafile[MAIN_PALETTE].dat);
            gui_fg_color = C_BLACK;  // set the foreground color
            gui_bg_color = C_WHITE;  // set the background color
            gui_mg_color = C_GRAY;   // set the disabled color
            set_mouse_sprite(NULL); // make mouse use current palette
            blit(bmp, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
            show_mouse(screen);
            destroy_bitmap(bmp);
         }
         else
            alert("Error switching display modes.", "Not enough memory to save screen.", NULL, "OK", NULL, 0, 0);
      }

      file = fopen(options_file_name, "a");

      if (file == NULL)
         alert("Options could not be saved, because file", options_file_name, "could not be open for writing", "OK", NULL, 0, 0);
      else
      {
         fclose(file);
         save_program_options();
      }
   }

   return ret;
}
Exemplo n.º 27
0
int main(int argc, char **argv) {
	int ret;
	char strbuf[256];
	
	allegro_init();
	
	set_color_depth(24);
	if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0)) {
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
		allegro_message("Allegro says: %s\n", allegro_error);
		return 1;
	}

	install_timer();
	install_keyboard();
	install_mouse();
	if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL)==-1) printf("No sounds avaible.\n");
	graph_init();

	srand(time(0));

	set_keyboard_rate(100, 150);
	gui_bg_color = colors[gray];
	gui_fg_color = colors[black];

	LOCK_VARIABLE(counter);
	LOCK_FUNCTION(game_timer);
	install_int_ex(game_timer, BPS_TO_TIMER(6));
	
	if (argv[0][0]!='\0') {
		char *path;

		for (path=argv[0]; *path; path++) /* nothing */;
		if (path!=argv[0]) {
			for (;*path!='/' && path>=argv[0]; path--);
			path++;
			*path = '\0';
			chdir(argv[0]);
		}
	}
	
	if ((datafile = load_datafile("data.dat"))==NULL) {
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
		allegro_message("Datafile data.dat not found\n");
		return 1;
	}
	
	font = datafile[DATA_FONT].dat;
	gui_font_baseline = 1;

	main_dialog[0].bg = colors[darkgray];
	main_dialog[1].dp = datafile[DATA_SCREEN].dat;
	main_dialog[2].dp = datafile[DATA_LOGO].dat;

	for (ret=1; main_dialog[ret].proc; ret++) {
		main_dialog[ret].fg = colors[black];
		main_dialog[ret].bg = colors[gray];
	}
	
	while(1) {
		text_mode(-1);

		switch (do_dialog(main_dialog, -1)) {
		case DMAIN_START:
			ret = start_game();
		
			if (ret==GAME_ABORT) break;

			if (ret==GAME_END) {
				int i;
				ret=0;
				for (i=1; i<8; i++) if (players[i].points > players[ret].points) ret = i;
			}
			scare_mouse();
			clear_to_color(screen, colors[darkgray]);
			unscare_mouse();

			sprintf(strbuf, "The winner is %s!!!", players[ret].name);
			alert("GAME OVER", strbuf, NULL, "OK", NULL, 0, 0);

			report();
			break;
		case DMAIN_EDIT:
			start_editor();
			break;
		case DMAIN_EXIT:
			remove_sound();
			return 0;
		}
	}
	return 0;
}
Exemplo n.º 28
0
int main(int argc, char *argv[]) {
	
	struct sched_param scp;

	scp.sched_priority = 60;

	sched_setscheduler(0, SCHED_FIFO, &scp);
	mlockall(MCL_FUTURE);

	allegro_init();
	set_color_depth(24);
	set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 1024, 768, 0, 0);
	install_keyboard();
	install_mouse();

	font = load_font("font.fnt", NULL, NULL);
	
	BITMAP *wsbuffer = create_bitmap(1024, 768);

	Box workspace(0, 0, 1024, 768, COLOR_PLAYER, Box::TYPE_FLAT);

	BarCounter bc(902, 16); 

	workspace.addChild(new Image(0, 0, 32, 768, "left.bmp"));
	workspace.addChild(new Image(992, 0, 32, 768, "right.bmp"));

	workspace.addChild(&bc);
	workspace.addChild(new PeakMeter(907, 50));

	BITMAP *splash = load_bitmap("splash.bmp", 0);
	blit(splash, screen, 0, 0, 0, 0, 1024, 768);
	destroy_bitmap(splash);
	sound->init(162, &bc); // FIXME changing tempo.

	loader = new Loader();

	for(int i = 0; i < NUMBER_PLAYERS; i++){
		workspace.addChild(new Player(96 * i, COLOR_PLAYER));
		sound->update();
	}

	workspace.paint();

	show_mouse(screen);

	bool mbdown = false;
	bool wsneedsredraw = false;

	int dragstart_x = 0;
	int dragstart_y = 0;

	int mickey_x = 0;
	int mickey_y = 0;

	bool taking_screenshot = false;

	while(!(key[KEY_LSHIFT] && key[KEY_LCONTROL] && key[KEY_ESC])){
		sound->update();
	
		bc.paintIfNeeded();
		// Screenshot
		if(key[KEY_F12] && !taking_screenshot){
			taking_screenshot = true;
			save_bitmap("shot.bmp", screen, 0);
		} else if(taking_screenshot){
			taking_screenshot = false;
		}
	

		if(loader->needsDisplay()){
			if(!wsneedsredraw){
				scare_mouse();
				blit(screen, wsbuffer, 0, 0, 0, 0, 1024, 768);
				unscare_mouse();
				loader->paint();
				wsneedsredraw = true;
			}
			if(key[KEY_ESC])
				loader->cancelDisplay();
		} else if(wsneedsredraw) {
			scare_mouse();
			blit(wsbuffer, screen, 0, 0, 0, 0, 1024, 768);
			bc.paint();
			workspace.paintIfNeeded();
			unscare_mouse();
			wsneedsredraw = false;
		} else {
			workspace.paintIfNeeded();
		}
		
		if((mouse_b) && !mbdown) {
			if(loader->needsDisplay()) {
				loader->mouseEvent(mouse_x, mouse_y, mouse_b);
			} else {
				workspace.mouseEvent(mouse_x, mouse_y, mouse_b);
			}
			mbdown = true;
			dragstart_x = mouse_x;
			dragstart_y = mouse_y;
			show_mouse(0);
			get_mouse_mickeys(&mickey_x, &mickey_y);
		} else if (!mouse_b && mbdown) {
			mbdown = false;
			position_mouse(dragstart_x, dragstart_y);
			show_mouse(screen);
		} else if (mbdown) {
			// Trigger drag events
			get_mouse_mickeys(&mickey_x, &mickey_y);
			if(!loader->needsDisplay()){
				if(mickey_x != 0 || mickey_y != 0)
					workspace.dragEvent(dragstart_x, dragstart_y, mickey_x, mickey_y);
			}
		}

		usleep(100);
	}
	// sound->system->release();
	delete logg;
	set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
	return 0;
}
Exemplo n.º 29
0
/* fs_flist_proc:
 *  Dialog procedure for the file selector list.
 */
static int fs_flist_proc(int msg, DIALOG *d, int c)
{
   static int recurse_flag = 0;
   char *s = file_selector[FS_EDIT].dp;
   char tmp[32];
   int sel = d->d1;
   int i, ret;
   int ch, count;

   if (msg == MSG_START) {
      if (!flist) {
	 flist = malloc(sizeof(FLIST));

	 if (!flist) {
	    *allegro_errno = ENOMEM;
	    return D_CLOSE;
	 }
      }
      else {
	 for (i=0; i<flist->size; i++)
	    if (flist->name[i])
	       free(flist->name[i]);
      }

      flist->size = 0;

      replace_filename(flist->dir, s, uconvert_ascii("*.*", tmp), sizeof(flist->dir));

      for_each_file(flist->dir, FA_RDONLY | FA_DIREC | FA_ARCH | FA_HIDDEN | FA_SYSTEM, fs_flist_putter, 0);

      if (*allegro_errno)
	 raine_alert("", "Disk error", NULL, NULL,  "OK", NULL, 13, 0);

      usetc(get_filename(flist->dir), 0);
      d->d1 = d->d2 = 0;
      sel = 0;
   }

   if (msg == MSG_END) {
      if (flist) {
	 for (i=0; i<flist->size; i++)
	    if (flist->name[i])
	       free(flist->name[i]);
	 free(flist);
	 flist = NULL;
      }
   }

   recurse_flag++;
   ret = d_text_list_proc(msg, d, c);     /* call the parent procedure */
   recurse_flag--;

   if (((sel != d->d1) || (ret == D_CLOSE)) && (recurse_flag == 0)) {
      replace_filename(s, flist->dir, flist->name[d->d1], 512);
      /* check if we want to `cd ..' */
      if ((!ustrncmp(flist->name[d->d1], "..", 2)) && (ret == D_CLOSE)) {
	 /* let's remember the previous directory */
	 ustrcpy(updir, empty_string);
	 i = ustrlen(flist->dir);
	 count = 0;
	 while (i>0) {
	    ch = ugetat(flist->dir, i);
	    if ((ch == '/') || (ch == OTHER_PATH_SEPARATOR)) {
	       if (++count == 2)
		  break;
	    }
	    uinsert(updir, 0, ch);
	    i--;
	 }
	 /* ok, we have the dirname in updir */
      }
      else {
	 ustrcpy(updir, empty_string);
      }
      scare_mouse();
      SEND_MESSAGE(file_selector+FS_EDIT, MSG_START, 0);
      SEND_MESSAGE(file_selector+FS_EDIT, MSG_DRAW, 0);
      unscare_mouse();

      if (ret == D_CLOSE)
	 return SEND_MESSAGE(file_selector+FS_EDIT, MSG_KEY, 0);
   }

   return ret;
}
Exemplo n.º 30
0
/* fs_edit_proc:
 *  Dialog procedure for the file selector editable string.
 */
static int fs_edit_proc(int msg, DIALOG *d, int c)
{
   char *s = d->dp;
   int list_size;
   int found = 0;
   char b[512];
   int ch, attr;
   int i;

   if (msg == MSG_START) {
      fix_filename_path(b, s, sizeof(b));
      ustrcpy(s, b);
   }

   if (msg == MSG_KEY) {
      if ((!ugetc(s)) || (ugetat(s, -1) == DEVICE_SEPARATOR))
	 ustrcat(s, uconvert_ascii("./", NULL));

      fix_filename_path(b, s, sizeof(b));
      ustrcpy(s, b);

      ch = ugetat(s, -1);
      if ((ch != '/') && (ch != OTHER_PATH_SEPARATOR)) {
	 if (file_exists(s, FA_RDONLY | FA_HIDDEN | FA_DIREC, &attr)) {
	    if (attr & FA_DIREC)
	       put_backslash(s);
	    else
	       return D_CLOSE;
	 }
	 else
	    return D_CLOSE;
      }

      scare_mouse();
      SEND_MESSAGE(file_selector+FS_FILES, MSG_START, 0);
      /* did we `cd ..' ? */
      if (ustrlen(updir)) {
	 /* now we have to find a directory name equal to updir */
	 for (i = 0; i<flist->size; i++) {
	    if (!ustrcmp(updir, flist->name[i])) {  /* we got it ! */
	       file_selector[FS_FILES].d1 = i;
	       /* we have to know the number of visible lines in the filelist */
	       /* -1 to avoid an off-by-one problem */
               list_size = (file_selector[FS_FILES].h-4) / text_height(font) - 1;
               if (i>list_size)
		  file_selector[FS_FILES].d2 = i-list_size;
	       else
		  file_selector[FS_FILES].d2 = 0;
               found = 1;
	       break;  /* ok, our work is done... */
	    }
	 }
	 /* by some strange reason, we didn't find the old directory... */
         if (!found) {
            file_selector[FS_FILES].d1 = 0;
            file_selector[FS_FILES].d2 = 0;
         }
      }
      /* and continue... */
      SEND_MESSAGE(file_selector+FS_FILES, MSG_DRAW, 0);
      SEND_MESSAGE(d, MSG_START, 0);
      SEND_MESSAGE(d, MSG_DRAW, 0);
      unscare_mouse();

      return D_O_K;
   }

   if (msg == MSG_UCHAR) {
      if ((c >= 'a') && (c <= 'z')) {
	 if (!ALLEGRO_LFN)
	    c = utoupper(c);
      }
      else if (c == '/') {
	 c = OTHER_PATH_SEPARATOR;
      }
      else if (ALLEGRO_LFN) {
	 if ((c > 127) || (c < 32))
	    return D_O_K;
      }
      else {
	 if ((c != OTHER_PATH_SEPARATOR) && (c != '_') &&
	     (c != DEVICE_SEPARATOR) && (c != '.') &&
	     ((c < 'A') || (c > 'Z')) && ((c < '0') || (c > '9')))
	    return D_O_K;
      }
   }

   return x_edit_proc(msg, d, c);
}