rnd-19990215-2
authorHolger Schemel <info@artsoft.org>
Mon, 15 Feb 1999 22:26:16 +0000 (23:26 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:33:42 +0000 (10:33 +0200)
src/buttons.c
src/buttons.h
src/events.c
src/files.c
src/misc.c
src/misc.h
src/screens.c
src/sound.c
src/sound.h
src/tools.c

index 7c1e9c9a0ee99bf9a1c84d1ffb1a2fddbdf8dad7..1e0ff787ccc7ac9c197fd6f8919de86aeb83c307 100644 (file)
@@ -669,944 +669,6 @@ void DrawCompleteVideoDisplay()
            VX,VY, VXSIZE,VYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2);
 }
 
-void DrawSoundDisplay(unsigned long state)
-{
-  int pos, cx = DOOR_GFX_PAGEX4, cy = 0;
-
-  pos = (state & BUTTON_SOUND_MUSIC ? SOUND_BUTTON_MUSIC_XPOS :
-        state & BUTTON_SOUND_LOOPS ? SOUND_BUTTON_LOOPS_XPOS :
-        SOUND_BUTTON_SIMPLE_XPOS);
-
-  if (state & BUTTON_ON)
-    cy -= SOUND_BUTTON_YSIZE;
-
-  if (state & BUTTON_PRESSED)
-    cx = DOOR_GFX_PAGEX3;
-
-  XCopyArea(display,pix[PIX_DOOR],drawto,gc,
-           cx + pos,cy + SOUND_BUTTON_ANY_YPOS,
-           SOUND_BUTTON_XSIZE,SOUND_BUTTON_YSIZE,
-           DX + pos,DY + SOUND_BUTTON_ANY_YPOS);
-
-  redraw_mask |= REDRAW_DOOR_1;
-}
-
-void DrawGameButton(unsigned long state)
-{
-  int pos, cx = DOOR_GFX_PAGEX4, cy = -GAME_BUTTON_YSIZE;
-
-  pos = (state & BUTTON_GAME_STOP ? GAME_BUTTON_STOP_XPOS :
-        state & BUTTON_GAME_PAUSE ? GAME_BUTTON_PAUSE_XPOS :
-        GAME_BUTTON_PLAY_XPOS);
-
-  if (state & BUTTON_PRESSED)
-    cx = DOOR_GFX_PAGEX3;
-
-  XCopyArea(display,pix[PIX_DOOR],drawto,gc,
-           cx + pos,cy + GAME_BUTTON_ANY_YPOS,
-           GAME_BUTTON_XSIZE,GAME_BUTTON_YSIZE,
-           DX + pos,DY + GAME_BUTTON_ANY_YPOS);
-
-  redraw_mask |= REDRAW_DOOR_1;
-}
-
-void DrawYesNoButton(unsigned long state, int mode)
-{
-  Drawable dest_drawto;
-  int dest_xoffset, dest_yoffset;
-  int xpos, cx = DOOR_GFX_PAGEX4;
-
-  if (mode == DB_INIT)
-  {
-    dest_drawto = pix[PIX_DB_DOOR];
-    dest_xoffset = DOOR_GFX_PAGEX1;
-    dest_yoffset = 0;
-  }
-  else
-  {
-    dest_drawto = drawto;
-    dest_xoffset = DX;
-    dest_yoffset = DY;
-  }
-
-  xpos = (state & BUTTON_OK ? OK_BUTTON_XPOS : NO_BUTTON_XPOS);
-
-  if (state & BUTTON_PRESSED)
-    cx = DOOR_GFX_PAGEX3;
-
-  XCopyArea(display, pix[PIX_DOOR], dest_drawto, gc,
-           cx + xpos, OK_BUTTON_GFX_YPOS,
-           OK_BUTTON_XSIZE, OK_BUTTON_YSIZE,
-           dest_xoffset + xpos, dest_yoffset + OK_BUTTON_YPOS);
-
-  redraw_mask |= REDRAW_DOOR_1;
-}
-
-void DrawConfirmButton(unsigned long state, int mode)
-{
-  Drawable dest_drawto;
-  int dest_xoffset, dest_yoffset;
-  int cx = DOOR_GFX_PAGEX4;
-
-  if (mode == DB_INIT)
-  {
-    dest_drawto = pix[PIX_DB_DOOR];
-    dest_xoffset = DOOR_GFX_PAGEX1;
-    dest_yoffset = 0;
-  }
-  else
-  {
-    dest_drawto = drawto;
-    dest_xoffset = DX;
-    dest_yoffset = DY;
-  }
-
-  if (state & BUTTON_PRESSED)
-    cx = DOOR_GFX_PAGEX3;
-
-  XCopyArea(display, pix[PIX_DOOR], dest_drawto, gc,
-           cx + CONFIRM_BUTTON_XPOS, CONFIRM_BUTTON_GFX_YPOS,
-           CONFIRM_BUTTON_XSIZE, CONFIRM_BUTTON_YSIZE,
-           dest_xoffset + CONFIRM_BUTTON_XPOS,
-           dest_yoffset + CONFIRM_BUTTON_YPOS);
-
-  redraw_mask |= REDRAW_DOOR_1;
-}
-
-void DrawPlayerButton(unsigned long state, int mode)
-{
-  Drawable dest_drawto;
-  int dest_xoffset, dest_yoffset;
-  int graphic = GFX_SPIELER1;  /* default */
-  int graphic_offset = (PLAYER_BUTTON_XSIZE - TILEX/2)/2;
-  int xpos, ypos;
-  int cx = DOOR_GFX_PAGEX4, cy = 0;
-
-  if (mode == DB_INIT)
-  {
-    dest_drawto = pix[PIX_DB_DOOR];
-    dest_xoffset = DOOR_GFX_PAGEX1;
-    dest_yoffset = 0;
-  }
-  else
-  {
-    dest_drawto = drawto;
-    dest_xoffset = DX;
-    dest_yoffset = DY;
-  }
-
-  if (state & BUTTON_PLAYER_1)
-    graphic = GFX_SPIELER1;
-  else if (state & BUTTON_PLAYER_2)
-    graphic = GFX_SPIELER2;
-  else if (state & BUTTON_PLAYER_3)
-    graphic = GFX_SPIELER3;
-  else if (state & BUTTON_PLAYER_4)
-    graphic = GFX_SPIELER4;
-
-  xpos = (state & BUTTON_PLAYER_1 || state & BUTTON_PLAYER_3 ?
-         PLAYER_BUTTON_1_XPOS : PLAYER_BUTTON_2_XPOS);
-  ypos = (state & BUTTON_PLAYER_1 || state & BUTTON_PLAYER_2 ?
-         PLAYER_BUTTON_1_YPOS : PLAYER_BUTTON_3_YPOS);
-
-  if (state & BUTTON_PRESSED)
-  {
-    cx = DOOR_GFX_PAGEX3;
-    graphic_offset += 1;
-  }
-
-  XCopyArea(display, pix[PIX_DOOR], dest_drawto, gc,
-           cx + PLAYER_BUTTON_GFX_XPOS, cy + PLAYER_BUTTON_GFX_YPOS,
-           PLAYER_BUTTON_XSIZE, PLAYER_BUTTON_YSIZE,
-           dest_xoffset + xpos, dest_yoffset + ypos);
-  DrawMiniGraphicExt(dest_drawto,gc,
-                    dest_xoffset + xpos + graphic_offset,
-                    dest_yoffset + ypos + graphic_offset,
-                    graphic);
-
-  redraw_mask |= REDRAW_DOOR_1;
-}
-
-/* several buttons in the level editor */
-
-void DrawEditButton(unsigned long state)
-{
-  int i;
-  int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
-  int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY2;
-  static int edit_pos[6][4] =
-  {
-   {ED_BUTTON_CTRL_XPOS,ED_BUTTON_CTRL_YPOS,
-    ED_BUTTON_CTRL_XSIZE,ED_BUTTON_CTRL_YSIZE},
-
-   {ED_BUTTON_FILL_XPOS,ED_BUTTON_FILL_YPOS,
-    ED_BUTTON_FILL_XSIZE,ED_BUTTON_FILL_YSIZE},
-
-   {ED_BUTTON_LEFT_XPOS,ED_BUTTON_LEFT_YPOS,
-    ED_BUTTON_LEFT_XSIZE,ED_BUTTON_LEFT_YSIZE},
-
-   {ED_BUTTON_UP_XPOS,ED_BUTTON_UP_YPOS,
-    ED_BUTTON_UP_XSIZE,ED_BUTTON_UP_YSIZE},
-
-   {ED_BUTTON_DOWN_XPOS,ED_BUTTON_DOWN_YPOS,
-    ED_BUTTON_DOWN_XSIZE,ED_BUTTON_DOWN_YSIZE},
-
-   {ED_BUTTON_RIGHT_XPOS,ED_BUTTON_RIGHT_YPOS,
-    ED_BUTTON_RIGHT_XSIZE,ED_BUTTON_RIGHT_YSIZE}
-  };
-
-  if (state & ED_BUTTON_PRESSED)
-    cx = DOOR_GFX_PAGEX5;
-
-  for(i=0;i<6;i++)
-  {
-    if (state & (1<<i))
-      XCopyArea(display,pix[PIX_DOOR],drawto,gc,
-               cx + edit_pos[i][xpos],
-               cy + edit_pos[i][ypos],
-               edit_pos[i][xsize],
-               edit_pos[i][ysize],
-               VX + edit_pos[i][xpos],
-               VY + edit_pos[i][ypos]);
-  }
-
-  redraw_mask |= REDRAW_DOOR_2;
-}
-
-void DrawCtrlButton(unsigned long state)
-{
-  int i;
-  int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
-  int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY1+80;
-  static int edit_pos[4][4] =
-  {
-   {ED_BUTTON_EDIT_XPOS,ED_BUTTON_EDIT_YPOS,
-    ED_BUTTON_EDIT_XSIZE,ED_BUTTON_EDIT_YSIZE},
-
-   {ED_BUTTON_CLEAR_XPOS,ED_BUTTON_CLEAR_YPOS,
-    ED_BUTTON_CLEAR_XSIZE,ED_BUTTON_CLEAR_YSIZE},
-
-   {ED_BUTTON_UNDO_XPOS,ED_BUTTON_UNDO_YPOS,
-    ED_BUTTON_UNDO_XSIZE,ED_BUTTON_UNDO_YSIZE},
-
-   {ED_BUTTON_EXIT_XPOS,ED_BUTTON_EXIT_YPOS,
-    ED_BUTTON_EXIT_XSIZE,ED_BUTTON_EXIT_YSIZE}
-  };
-
-  if (state & ED_BUTTON_PRESSED)
-    cx = DOOR_GFX_PAGEX3;
-
-  for(i=0;i<4;i++)
-  {
-    if (state & (1<<(i+6)))
-      XCopyArea(display,pix[PIX_DOOR],drawto,gc,
-               cx + edit_pos[i][xpos],
-               cy + edit_pos[i][ypos],
-               edit_pos[i][xsize],
-               edit_pos[i][ysize],
-               VX + edit_pos[i][xpos],
-               VY + edit_pos[i][ypos]);
-  }
-
-  redraw_mask |= REDRAW_DOOR_2;
-}
-
-void DrawElemButton(int button_nr, int button_state)
-{
-  int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
-  int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY1;
-  int from_x, from_y, to_x,to_y, size_x, size_y;
-  static int edit_pos[3][4] =
-  {
-   {ED_BUTTON_EUP_XPOS,ED_BUTTON_EUP_YPOS,
-    ED_BUTTON_EUP_XSIZE,ED_BUTTON_EUP_YSIZE},
-
-   {ED_BUTTON_EDOWN_XPOS,ED_BUTTON_EDOWN_YPOS,
-    ED_BUTTON_EDOWN_XSIZE,ED_BUTTON_EDOWN_YSIZE},
-
-   {ED_BUTTON_ELEM_XPOS,ED_BUTTON_ELEM_YPOS,
-    ED_BUTTON_ELEM_XSIZE,ED_BUTTON_ELEM_YSIZE}
-  };
-
-  if (button_nr<ED_BUTTON_ELEM)
-  {
-    int pos = button_nr;
-
-    from_x = cx + edit_pos[pos][xpos];
-    from_y = cy + edit_pos[pos][ypos];
-    size_x = edit_pos[pos][xsize];
-    size_y = edit_pos[pos][ysize];
-    to_x   = DX + edit_pos[pos][xpos];
-    to_y   = DY + edit_pos[pos][ypos];
-
-    if (button_state & ED_BUTTON_PRESSED)
-    {
-      if (button_nr==ED_BUTTON_EUP)
-       from_y = cy + ED_BUTTON_EUP_Y2POS;
-      else
-       from_y = cy + ED_BUTTON_EDOWN_Y2POS;
-    }
-
-    XCopyArea(display,pix[PIX_DOOR],drawto,gc,
-             from_x,from_y, size_x,size_y, to_x,to_y);
-  }
-  else
-  {
-    int pos = ED_BUTTON_ELEM;
-    int elem_pos = button_nr-ED_BUTTON_ELEM;
-    int x = elem_pos % MAX_ELEM_X;
-    int y = elem_pos / MAX_ELEM_X;
-    int graphic;
-    int shift = 0;
-
-    if (elem_pos+element_shift < elements_in_list)
-      graphic = el2gfx(editor_element[elem_pos+element_shift]);
-    else
-      graphic = GFX_LEERRAUM;
-
-    from_x = cx + edit_pos[pos][xpos];
-    from_y = cy + edit_pos[pos][ypos];
-    size_x = edit_pos[pos][xsize];
-    size_y = edit_pos[pos][ysize];
-    to_x   = DX + edit_pos[pos][xpos] + x * ED_BUTTON_ELEM_XSIZE;
-    to_y   = DY + edit_pos[pos][ypos] + y * ED_BUTTON_ELEM_YSIZE;
-
-    if (button_state & ED_BUTTON_PRESSED)
-    {
-      from_y = ED_BUTTON_ELEM_Y2POS;
-      shift = 1;
-    }
-
-    XCopyArea(display,pix[PIX_DOOR],drawto,gc,
-             from_x,from_y, size_x,size_y, to_x,to_y);
-
-    DrawMiniGraphicExt(drawto,gc,
-                      DX+ED_BUTTON_ELEM_XPOS+3+shift + 
-                      (elem_pos % MAX_ELEM_X)*ED_BUTTON_ELEM_XSIZE,
-                      DY+ED_BUTTON_ELEM_YPOS+3+shift +
-                      (elem_pos / MAX_ELEM_X)*ED_BUTTON_ELEM_YSIZE,
-                      graphic);
-  }
-
-  redraw_mask |= REDRAW_DOOR_1;
-}
-
-void DrawCountButton(int button_nr, int button_state)
-{
-  int from_x, from_y, to_x,to_y, size_x, size_y;
-
-  from_x =
-    DOOR_GFX_PAGEX4+(button_nr%2 ? ED_BUTTON_PLUS_XPOS : ED_BUTTON_MINUS_XPOS);
-  from_y = DOOR_GFX_PAGEY1 + ED_BUTTON_MINUS_YPOS;
-  size_x = ED_BUTTON_MINUS_XSIZE;
-  size_y = ED_BUTTON_MINUS_YSIZE;
-  to_x = (button_nr<32 ? ED_COUNT_GADGET_XPOS : ED_SIZE_GADGET_XPOS);
-  if (button_nr % 2)
-    to_x += (ED_BUTTON_PLUS_XPOS - ED_BUTTON_MINUS_XPOS);
-  to_y = (button_nr<32 ? ED_COUNT_GADGET_YPOS : ED_SIZE_GADGET_YPOS) +
-    ((button_nr<32 ? button_nr : button_nr-32)/2)*ED_COUNT_GADGET_YSIZE;
-
-  if (button_state & ED_BUTTON_PRESSED)
-    from_x -= DXSIZE;
-
-  XCopyArea(display,pix[PIX_DOOR],drawto,gc,
-           from_x,from_y, size_x,size_y, to_x,to_y);
-  XCopyArea(display,pix[PIX_DOOR],window,gc,
-           from_x,from_y, size_x,size_y, to_x,to_y);
-}
-
-/**********************************************************************/
-/********** checking buttons (and redrawing them, if needed) **********/
-/**********************************************************************/
-
-int CheckVideoButtons(int mx, int my, int button)
-{
-  int return_code = 0;
-  static int choice = -1;
-  static boolean pressed = FALSE;
-  static int video_button[5] =
-  {
-    VIDEO_PRESS_EJECT_ON,
-    VIDEO_PRESS_STOP_ON,
-    VIDEO_PRESS_PAUSE_ON,
-    VIDEO_PRESS_REC_ON,
-    VIDEO_PRESS_PLAY_ON
-  };
-
-  if (button)
-  {
-    if (!motion_status)                /* Maustaste neu gedrückt */
-    {
-      if (ON_VIDEO_BUTTON(mx,my))
-      {
-       choice = VIDEO_BUTTON(mx);
-       pressed = TRUE;
-       DrawVideoDisplay(video_button[choice],0);
-      }
-    }
-    else                       /* Mausbewegung bei gedrückter Maustaste */
-    {
-      if ((!ON_VIDEO_BUTTON(mx,my) || VIDEO_BUTTON(mx)!=choice) &&
-         choice>=0 && pressed)
-      {
-       pressed = FALSE;
-       DrawVideoDisplay(video_button[choice]<<1,0);
-      }
-      else if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && !pressed)
-      {
-       pressed = TRUE;
-       DrawVideoDisplay(video_button[choice],0);
-      }
-    }
-  }
-  else                         /* Maustaste wieder losgelassen */
-  {
-    if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && pressed)
-    {
-      DrawVideoDisplay(video_button[choice]<<1,0);
-      return_code = choice+1;
-      choice = -1;
-      pressed = FALSE;
-    }
-    else
-    {
-      choice = -1;
-      pressed = FALSE;
-    }
-  }
-
-  BackToFront();
-  return(return_code);
-}
-
-int CheckSoundButtons(int mx, int my, int button)
-{
-  int return_code = 0;
-  static int choice = -1;
-  static boolean pressed = FALSE;
-  int sound_state[3];
-
-  sound_state[0] = BUTTON_SOUND_MUSIC  | (BUTTON_ON * setup.sound_music);
-  sound_state[1] = BUTTON_SOUND_LOOPS  | (BUTTON_ON * setup.sound_loops);
-  sound_state[2] = BUTTON_SOUND_SIMPLE | (BUTTON_ON * setup.sound_simple);
-
-  if (button)
-  {
-    if (!motion_status)                /* Maustaste neu gedrückt */
-    {
-      if (ON_SOUND_BUTTON(mx,my))
-      {
-       choice = SOUND_BUTTON(mx);
-       pressed = TRUE;
-       DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
-      }
-    }
-    else                       /* Mausbewegung bei gedrückter Maustaste */
-    {
-      if ((!ON_SOUND_BUTTON(mx,my) || SOUND_BUTTON(mx)!=choice) &&
-         choice>=0 && pressed)
-      {
-       pressed = FALSE;
-       DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
-      }
-      else if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && !pressed)
-      {
-       pressed = TRUE;
-       DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
-      }
-    }
-  }
-  else                         /* Maustaste wieder losgelassen */
-  {
-    if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && pressed)
-    {
-      DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
-      return_code = 1<<choice;
-      choice = -1;
-      pressed = FALSE;
-    }
-    else
-    {
-      choice = -1;
-      pressed = FALSE;
-    }
-  }
-
-  BackToFront();
-  return(return_code);
-}
-
-int CheckGameButtons(int mx, int my, int button)
-{
-  int return_code = 0;
-  static int choice = -1;
-  static boolean pressed = FALSE;
-  int game_state[3] =
-  {
-    BUTTON_GAME_STOP,
-    BUTTON_GAME_PAUSE,
-    BUTTON_GAME_PLAY
-  };
-
-  if (button)
-  {
-    if (!motion_status)                /* Maustaste neu gedrückt */
-    {
-      if (ON_GAME_BUTTON(mx,my))
-      {
-       choice = GAME_BUTTON(mx);
-       pressed = TRUE;
-       DrawGameButton(game_state[choice] | BUTTON_PRESSED);
-      }
-    }
-    else                       /* Mausbewegung bei gedrückter Maustaste */
-    {
-      if ((!ON_GAME_BUTTON(mx,my) || GAME_BUTTON(mx)!=choice) &&
-         choice>=0 && pressed)
-      {
-       pressed = FALSE;
-       DrawGameButton(game_state[choice] | BUTTON_RELEASED);
-      }
-      else if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && !pressed)
-      {
-       pressed = TRUE;
-       DrawGameButton(game_state[choice] | BUTTON_PRESSED);
-      }
-    }
-  }
-  else                         /* Maustaste wieder losgelassen */
-  {
-    if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && pressed)
-    {
-      DrawGameButton(game_state[choice] | BUTTON_RELEASED);
-      return_code = 1<<choice;
-      choice = -1;
-      pressed = FALSE;
-    }
-    else
-    {
-      choice = -1;
-      pressed = FALSE;
-    }
-  }
-
-  BackToFront();
-  return(return_code);
-}
-
-int CheckYesNoButtons(int mx, int my, int button)
-{
-  int return_code = 0;
-  static int choice = -1;
-  static boolean pressed = FALSE;
-  static int yesno_button[5] =
-  {
-    BUTTON_OK,
-    BUTTON_NO
-  };
-
-  if (button)
-  {
-    if (!motion_status)                /* Maustaste neu gedrückt */
-    {
-      if (ON_YESNO_BUTTON(mx,my))
-      {
-       choice = YESNO_BUTTON(mx);
-       pressed = TRUE;
-       DrawYesNoButton(yesno_button[choice] | BUTTON_PRESSED, DB_NORMAL);
-      }
-    }
-    else                       /* Mausbewegung bei gedrückter Maustaste */
-    {
-      if ((!ON_YESNO_BUTTON(mx,my) || YESNO_BUTTON(mx)!=choice) &&
-         choice>=0 && pressed)
-      {
-       pressed = FALSE;
-       DrawYesNoButton(yesno_button[choice] | BUTTON_RELEASED, DB_NORMAL);
-      }
-      else if (ON_YESNO_BUTTON(mx,my) && YESNO_BUTTON(mx)==choice && !pressed)
-      {
-       pressed = TRUE;
-       DrawYesNoButton(yesno_button[choice] | BUTTON_PRESSED, DB_NORMAL);
-      }
-    }
-  }
-  else                         /* Maustaste wieder losgelassen */
-  {
-    if (ON_YESNO_BUTTON(mx,my) && YESNO_BUTTON(mx)==choice && pressed)
-    {
-      DrawYesNoButton(yesno_button[choice] | BUTTON_RELEASED, DB_NORMAL);
-      return_code = choice+1;
-      choice = -1;
-      pressed = FALSE;
-    }
-    else
-    {
-      choice = -1;
-      pressed = FALSE;
-    }
-  }
-
-  BackToFront();
-  return(return_code);
-}
-
-int CheckConfirmButton(int mx, int my, int button)
-{
-  int return_code = 0;
-  static int choice = -1;
-  static boolean pressed = FALSE;
-
-  if (button)
-  {
-    if (!motion_status)                /* Maustaste neu gedrückt */
-    {
-      if (ON_CONFIRM_BUTTON(mx,my))
-      {
-       choice = 0;
-       pressed = TRUE;
-       DrawConfirmButton(BUTTON_PRESSED, DB_NORMAL);
-      }
-    }
-    else                       /* Mausbewegung bei gedrückter Maustaste */
-    {
-      if (!ON_CONFIRM_BUTTON(mx,my) && choice>=0 && pressed)
-      {
-       pressed = FALSE;
-       DrawConfirmButton(BUTTON_RELEASED, DB_NORMAL);
-      }
-      else if (ON_CONFIRM_BUTTON(mx,my) && !pressed)
-      {
-       pressed = TRUE;
-       DrawConfirmButton(BUTTON_PRESSED, DB_NORMAL);
-      }
-    }
-  }
-  else                         /* Maustaste wieder losgelassen */
-  {
-    if (ON_CONFIRM_BUTTON(mx,my) && pressed)
-    {
-      DrawConfirmButton(BUTTON_RELEASED, DB_NORMAL);
-      return_code = BUTTON_CONFIRM;
-      choice = -1;
-      pressed = FALSE;
-    }
-    else
-    {
-      choice = -1;
-      pressed = FALSE;
-    }
-  }
-
-  BackToFront();
-  return(return_code);
-}
-
-int CheckPlayerButtons(int mx, int my, int button)
-{
-  int return_code = 0;
-  static int choice = -1;
-  static boolean pressed = FALSE;
-  int player_state[4] =
-  {
-    BUTTON_PLAYER_1,
-    BUTTON_PLAYER_2,
-    BUTTON_PLAYER_3,
-    BUTTON_PLAYER_4
-  };
-
-  if (button)
-  {
-    if (!motion_status)                /* Maustaste neu gedrückt */
-    {
-      if (ON_PLAYER_BUTTON(mx,my))
-      {
-       choice = PLAYER_BUTTON(mx,my);
-       pressed = TRUE;
-       DrawPlayerButton(player_state[choice] | BUTTON_PRESSED, DB_NORMAL);
-      }
-    }
-    else                       /* Mausbewegung bei gedrückter Maustaste */
-    {
-      if ((!ON_PLAYER_BUTTON(mx,my) || PLAYER_BUTTON(mx,my)!=choice) &&
-         choice>=0 && pressed)
-      {
-       pressed = FALSE;
-       DrawPlayerButton(player_state[choice] | BUTTON_RELEASED, DB_NORMAL);
-      }
-      else if (ON_PLAYER_BUTTON(mx,my) && PLAYER_BUTTON(mx,my)==choice && !pressed)
-      {
-       pressed = TRUE;
-       DrawPlayerButton(player_state[choice] | BUTTON_PRESSED, DB_NORMAL);
-      }
-    }
-  }
-  else                         /* Maustaste wieder losgelassen */
-  {
-    if (ON_PLAYER_BUTTON(mx,my) && PLAYER_BUTTON(mx,my)==choice && pressed)
-    {
-      DrawPlayerButton(player_state[choice] | BUTTON_RELEASED, DB_NORMAL);
-      return_code = player_state[choice];
-      choice = -1;
-      pressed = FALSE;
-    }
-    else
-    {
-      choice = -1;
-      pressed = FALSE;
-    }
-  }
-
-  BackToFront();
-  return(return_code);
-}
-
-/* several buttons in the level editor */
-
-int CheckEditButtons(int mx, int my, int button)
-{
-  int return_code = 0;
-  static int choice = -1;
-  static boolean pressed = FALSE;
-  static int edit_button[6] =
-  {
-    ED_BUTTON_CTRL,
-    ED_BUTTON_FILL,
-    ED_BUTTON_LEFT,
-    ED_BUTTON_UP,
-    ED_BUTTON_DOWN,
-    ED_BUTTON_RIGHT
-  };
-
-  if (button)
-  {
-    if (!motion_status)                /* Maustaste neu gedrückt */
-    {
-      if (ON_EDIT_BUTTON(mx,my))
-      {
-       choice = EDIT_BUTTON(mx,my);
-       pressed = TRUE;
-       DrawEditButton(edit_button[choice] | ED_BUTTON_PRESSED);
-       if (edit_button[choice]!=ED_BUTTON_CTRL &&
-           edit_button[choice]!=ED_BUTTON_FILL)
-         return_code = 1<<choice;
-      }
-    }
-    else                       /* Mausbewegung bei gedrückter Maustaste */
-    {
-      if ((!ON_EDIT_BUTTON(mx,my) || EDIT_BUTTON(mx,my)!=choice) &&
-         choice>=0 && pressed)
-      {
-       pressed = FALSE;
-       DrawEditButton(edit_button[choice] | ED_BUTTON_RELEASED);
-      }
-      else if (ON_EDIT_BUTTON(mx,my) && EDIT_BUTTON(mx,my)==choice)
-      {
-       if (!pressed)
-         DrawEditButton(edit_button[choice] | ED_BUTTON_PRESSED);
-       pressed = TRUE;
-       if (edit_button[choice]!=ED_BUTTON_CTRL &&
-           edit_button[choice]!=ED_BUTTON_FILL)
-         return_code = 1<<choice;
-      }
-    }
-  }
-  else                         /* Maustaste wieder losgelassen */
-  {
-    if (ON_EDIT_BUTTON(mx,my) && EDIT_BUTTON(mx,my)==choice && pressed)
-    {
-      DrawEditButton(edit_button[choice] | ED_BUTTON_RELEASED);
-      if (edit_button[choice]==ED_BUTTON_CTRL ||
-         edit_button[choice]==ED_BUTTON_FILL)
-       return_code = 1<<choice;
-      choice = -1;
-      pressed = FALSE;
-    }
-    else
-    {
-      choice = -1;
-      pressed = FALSE;
-    }
-  }
-
-  BackToFront();
-  return(return_code);
-}
-
-int CheckCtrlButtons(int mx, int my, int button)
-{
-  int return_code = 0;
-  static int choice = -1;
-  static boolean pressed = FALSE;
-  static int ctrl_button[4] =
-  {
-    ED_BUTTON_EDIT,
-    ED_BUTTON_CLEAR,
-    ED_BUTTON_UNDO,
-    ED_BUTTON_EXIT
-  };
-
-  if (button)
-  {
-    if (!motion_status)                /* Maustaste neu gedrückt */
-    {
-      if (ON_CTRL_BUTTON(mx,my))
-      {
-       choice = CTRL_BUTTON(mx,my);
-       pressed = TRUE;
-       DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_PRESSED);
-      }
-    }
-    else                       /* Mausbewegung bei gedrückter Maustaste */
-    {
-      if ((!ON_CTRL_BUTTON(mx,my) || CTRL_BUTTON(mx,my)!=choice) &&
-         choice>=0 && pressed)
-      {
-       pressed = FALSE;
-       DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_RELEASED);
-      }
-      else if (ON_CTRL_BUTTON(mx,my) && CTRL_BUTTON(mx,my)==choice && !pressed)
-      {
-       pressed = TRUE;
-       DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_PRESSED);
-      }
-    }
-  }
-  else                         /* Maustaste wieder losgelassen */
-  {
-    if (ON_CTRL_BUTTON(mx,my) && CTRL_BUTTON(mx,my)==choice && pressed)
-    {
-      DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_RELEASED);
-      return_code = 1<<(choice+6);
-      choice = -1;
-      pressed = FALSE;
-    }
-    else
-    {
-      choice = -1;
-      pressed = FALSE;
-    }
-  }
-
-  BackToFront();
-  return(return_code);
-}
-
-int CheckElemButtons(int mx, int my, int button)
-{
-  int return_code = -1;
-  static int choice = -1;
-  static boolean pressed = FALSE;
-
-  if (button)
-  {
-    if (!motion_status)                /* Maustaste neu gedrückt */
-    {
-      if (ON_ELEM_BUTTON(mx,my))
-      {
-       choice = ELEM_BUTTON(mx,my);
-       pressed = TRUE;
-       DrawElemButton(choice,ED_BUTTON_PRESSED);
-       if (choice==ED_BUTTON_EUP ||
-           choice==ED_BUTTON_EDOWN)
-         return_code = choice;
-      }
-    }
-    else                       /* Mausbewegung bei gedrückter Maustaste */
-    {
-      if ((!ON_ELEM_BUTTON(mx,my) || ELEM_BUTTON(mx,my)!=choice) &&
-         choice>=0 && pressed)
-      {
-       pressed = FALSE;
-       DrawElemButton(choice,ED_BUTTON_RELEASED);
-      }
-      else if (ON_ELEM_BUTTON(mx,my) && ELEM_BUTTON(mx,my)==choice)
-      {
-       if (!pressed)
-         DrawElemButton(choice,ED_BUTTON_PRESSED);
-       pressed = TRUE;
-       if (choice==ED_BUTTON_EUP ||
-           choice==ED_BUTTON_EDOWN)
-         return_code = choice;
-      }
-    }
-  }
-  else                         /* Maustaste wieder losgelassen */
-  {
-    if (ON_ELEM_BUTTON(mx,my) && ELEM_BUTTON(mx,my)==choice && pressed)
-    {
-      DrawElemButton(choice,ED_BUTTON_RELEASED);
-      if (choice!=ED_BUTTON_EUP &&
-         choice!=ED_BUTTON_EDOWN)
-       return_code = choice;
-      choice = -1;
-      pressed = FALSE;
-    }
-    else
-    {
-      choice = -1;
-      pressed = FALSE;
-    }
-  }
-
-  BackToFront();
-  return(return_code);
-}
-
-int CheckCountButtons(int mx, int my, int button)
-{
-  int return_code = -1;
-  static int choice = -1;
-  static boolean pressed = FALSE;
-
-  if (button)
-  {
-    if (!motion_status)                /* Maustaste neu gedrückt */
-    {
-      if (ON_COUNT_BUTTON(mx,my))
-      {
-       choice = COUNT_BUTTON(mx,my);
-       pressed = TRUE;
-       DrawCountButton(choice,ED_BUTTON_PRESSED);
-       return_code = choice;
-      }
-    }
-    else                       /* Mausbewegung bei gedrückter Maustaste */
-    {
-      if ((!ON_COUNT_BUTTON(mx,my) || COUNT_BUTTON(mx,my)!=choice) &&
-         choice>=0 && pressed)
-      {
-       pressed = FALSE;
-       DrawCountButton(choice,ED_BUTTON_RELEASED);
-      }
-      else if (ON_COUNT_BUTTON(mx,my) && COUNT_BUTTON(mx,my)==choice)
-      {
-       if (!pressed)
-         DrawCountButton(choice,ED_BUTTON_PRESSED);
-       pressed = TRUE;
-       return_code = choice;
-      }
-    }
-  }
-  else                         /* Maustaste wieder losgelassen */
-  {
-    if (ON_COUNT_BUTTON(mx,my) && COUNT_BUTTON(mx,my)==choice && pressed)
-    {
-      DrawCountButton(choice,ED_BUTTON_RELEASED);
-      choice = -1;
-      pressed = FALSE;
-    }
-    else
-    {
-      choice = -1;
-      pressed = FALSE;
-    }
-  }
-
-  BackToFront();
-  return(return_code);
-}
-
 
 /* NEW GADGET STUFF -------------------------------------------------------- */
 
index fcd23247594809e78f286a43a1f93032c48b4e69..b5bb5ec36078c17b582ac4f048fb211b9d9bbb97 100644 (file)
 
 void DrawVideoDisplay(unsigned long, unsigned long);
 void DrawCompleteVideoDisplay(void);
-void DrawSoundDisplay(unsigned long);
-void DrawGameButton(unsigned long);
-void DrawYesNoButton(unsigned long, int);
-void DrawConfirmButton(unsigned long, int);
-void DrawPlayerButton(unsigned long, int);
-void DrawEditButton(unsigned long state);
-void DrawCtrlButton(unsigned long state);
-void DrawElemButton(int, int);
-void DrawCountButton(int, int);
-int CheckVideoButtons(int, int, int);
-int CheckSoundButtons(int, int, int);
-int CheckGameButtons(int, int, int);
-int CheckYesNoButtons(int, int, int);
-int CheckConfirmButton(int, int, int);
-int CheckPlayerButtons(int, int, int);
-int CheckEditButtons(int, int, int);
-int CheckCtrlButtons(int, int, int);
-int CheckElemButtons(int, int, int);
-int CheckCountButtons(int, int, int);
 
 
 /* NEW GADGET STUFF -------------------------------------------------------- */
index 61d1fc8d4d7eb5665014877f794b5e4d1e7bb54d..8a03effdde53b42af0d2afe7b9f58f201859fd04 100644 (file)
@@ -334,12 +334,6 @@ void HandleButton(int mx, int my, int button)
   {
     old_mx = mx;
     old_my = my;
-
-    /*
-    HandleVideoButtons(mx,my, button);
-    HandleSoundButtons(mx,my, button);
-    HandleGameButtons(mx,my, button);
-    */
   }
 
   HandleGadgets(mx, my, button);
index 2ef526ddc5a4c943ebe62e668f83c08ce43c3ec6..e48a0991454ac44c69d30eca4fb4d957a91222db 100644 (file)
@@ -275,27 +275,6 @@ static void InitUserLevelDirectory(char *level_subdir)
   }
 }
 
-static void getFileChunk(FILE *file, char *chunk_buffer, int *chunk_length)
-{
-  fgets(chunk_buffer, CHUNK_ID_LEN + 1, file);
-
-  *chunk_length =
-    (fgetc(file) << 24) |
-    (fgetc(file) << 16) |
-    (fgetc(file) <<  8)  |
-    (fgetc(file) <<  0);
-}
-
-static void putFileChunk(FILE *file, char *chunk_name, int chunk_length)
-{
-  fputs(chunk_name, file);
-
-  fputc((chunk_length >> 24) & 0xff, file);
-  fputc((chunk_length >> 16) & 0xff, file);
-  fputc((chunk_length >>  8) & 0xff, file);
-  fputc((chunk_length >>  0) & 0xff, file);
-}
-
 static void setLevelInfoToDefaults()
 {
   int i, x, y;
@@ -406,7 +385,7 @@ void LoadLevel(int level_nr)
   /* read chunk "HEAD" */
   if (file_version >= FILE_VERSION_1_2)
   {
-    getFileChunk(file, chunk, &chunk_length);
+    getFileChunk(file, chunk, &chunk_length, BYTE_ORDER_BIG_ENDIAN);
     if (strcmp(chunk, "HEAD") || chunk_length != LEVEL_HEADER_SIZE)
     {
       Error(ERR_WARN, "wrong 'HEAD' chunk of level file '%s'", filename);
@@ -456,7 +435,7 @@ void LoadLevel(int level_nr)
   /* read chunk "BODY" */
   if (file_version >= FILE_VERSION_1_2)
   {
-    getFileChunk(file, chunk, &chunk_length);
+    getFileChunk(file, chunk, &chunk_length, BYTE_ORDER_BIG_ENDIAN);
 
     /* look for optional author chunk */
     if (strcmp(chunk, "AUTH") == 0 && chunk_length == MAX_LEVEL_AUTHOR_LEN)
@@ -465,7 +444,7 @@ void LoadLevel(int level_nr)
        level.author[i] = fgetc(file);
       level.author[MAX_LEVEL_NAME_LEN] = 0;
 
-      getFileChunk(file, chunk, &chunk_length);
+      getFileChunk(file, chunk, &chunk_length, BYTE_ORDER_BIG_ENDIAN);
     }
 
     /* look for optional content chunk */
@@ -481,7 +460,7 @@ void LoadLevel(int level_nr)
          for(x=0; x<3; x++)
            level.mampfer_inhalt[i][x][y] = fgetc(file);
 
-      getFileChunk(file, chunk, &chunk_length);
+      getFileChunk(file, chunk, &chunk_length, BYTE_ORDER_BIG_ENDIAN);
     }
 
     /* next check body chunk identifier and chunk length */
@@ -530,7 +509,7 @@ void SaveLevel(int level_nr)
   fputs(LEVEL_COOKIE, file);           /* file identifier */
   fputc('\n', file);
 
-  putFileChunk(file, "HEAD", LEVEL_HEADER_SIZE);
+  putFileChunk(file, "HEAD", LEVEL_HEADER_SIZE, BYTE_ORDER_BIG_ENDIAN);
 
   fputc(level.fieldx, file);
   fputc(level.fieldy, file);
@@ -557,12 +536,12 @@ void SaveLevel(int level_nr)
   for(i=0; i<LEVEL_HEADER_UNUSED; i++) /* set unused header bytes to zero */
     fputc(0, file);
 
-  putFileChunk(file, "AUTH", MAX_LEVEL_AUTHOR_LEN);
+  putFileChunk(file, "AUTH", MAX_LEVEL_AUTHOR_LEN, BYTE_ORDER_BIG_ENDIAN);
 
   for(i=0; i<MAX_LEVEL_AUTHOR_LEN; i++)
     fputc(level.author[i], file);
 
-  putFileChunk(file, "CONT", 4 + 8 * 3 * 3);
+  putFileChunk(file, "CONT", 4 + 8 * 3 * 3, BYTE_ORDER_BIG_ENDIAN);
 
   fputc(EL_MAMPFER, file);
   fputc(MampferMax, file);
@@ -574,7 +553,7 @@ void SaveLevel(int level_nr)
       for(x=0; x<3; x++)
        fputc(level.mampfer_inhalt[i][x][y], file);
 
-  putFileChunk(file, "BODY", lev_fieldx * lev_fieldy);
+  putFileChunk(file, "BODY", lev_fieldx * lev_fieldy, BYTE_ORDER_BIG_ENDIAN);
 
   for(y=0; y<lev_fieldy; y++) 
     for(x=0; x<lev_fieldx; x++) 
index fd85aeddac9e433635bff3586077c11e6fa5ad2f..efa04a14c314d92d55bc416e0390898e61b60f7c 100644 (file)
@@ -579,6 +579,46 @@ void *checked_calloc(unsigned long size)
   return ptr;
 }
 
+void getFileChunk(FILE *file, char *chunk_buffer, int *chunk_length,
+                 int byte_order)
+{
+  const int chunk_identifier_length = 4;
+
+  fgets(chunk_buffer, chunk_identifier_length + 1, file);
+
+  if (byte_order == BYTE_ORDER_BIG_ENDIAN)
+    *chunk_length = ((fgetc(file) << 24) |
+                    (fgetc(file) << 16) |
+                    (fgetc(file) <<  8)  |
+                    (fgetc(file) <<  0));
+  else          /* BYTE_ORDER_LITTLE_ENDIAN */
+    *chunk_length = ((fgetc(file) <<  0) |
+                    (fgetc(file) <<  8) |
+                    (fgetc(file) << 16)  |
+                    (fgetc(file) << 24));
+}
+
+void putFileChunk(FILE *file, char *chunk_name, int chunk_length,
+                 int byte_order)
+{
+  fputs(chunk_name, file);
+
+  if (byte_order == BYTE_ORDER_BIG_ENDIAN)
+  {
+    fputc((chunk_length >> 24) & 0xff, file);
+    fputc((chunk_length >> 16) & 0xff, file);
+    fputc((chunk_length >>  8) & 0xff, file);
+    fputc((chunk_length >>  0) & 0xff, file);
+  }
+  else          /* BYTE_ORDER_LITTLE_ENDIAN */
+  {
+    fputc((chunk_length >>  0) & 0xff, file);
+    fputc((chunk_length >>  8) & 0xff, file);
+    fputc((chunk_length >> 16) & 0xff, file);
+    fputc((chunk_length >> 24) & 0xff, file);
+  }
+}
+
 #define TRANSLATE_KEYSYM_TO_KEYNAME    0
 #define TRANSLATE_KEYSYM_TO_X11KEYNAME 1
 #define TRANSLATE_X11KEYNAME_TO_KEYSYM 2
index 9793cb733f54b697dc884747d15074e6cfccca5e..004b7e438ddc0a10662ad223b59f395aa27f0796 100644 (file)
 
 #include "main.h"
 
-#define INIT_COUNTER           0
-#define READ_COUNTER           1
+/* values for InitCounter() and Counter() */
+#define INIT_COUNTER                   0
+#define READ_COUNTER                   1
 
-#define NEW_RANDOMIZE          -1
+/* values for InitRND() */
+#define NEW_RANDOMIZE                  -1
 
-#define ERR_RETURN             0
-#define ERR_WARN               (1 << 0)
-#define ERR_EXIT               (1 << 1)
-#define ERR_HELP               (1 << 2)
-#define ERR_SOUND_SERVER       (1 << 3)
-#define ERR_NETWORK_SERVER     (1 << 4)
-#define ERR_NETWORK_CLIENT     (1 << 5)
-#define ERR_FROM_SERVER                (ERR_SOUND_SERVER | ERR_NETWORK_SERVER)
-#define ERR_EXIT_HELP          (ERR_EXIT | ERR_HELP)
-#define ERR_EXIT_SOUND_SERVER  (ERR_EXIT | ERR_SOUND_SERVER)
-#define ERR_EXIT_NETWORK_SERVER        (ERR_EXIT | ERR_NETWORK_SERVER)
-#define ERR_EXIT_NETWORK_CLIENT        (ERR_EXIT | ERR_NETWORK_CLIENT)
+/* values for Error() */
+#define ERR_RETURN                     0
+#define ERR_WARN                       (1 << 0)
+#define ERR_EXIT                       (1 << 1)
+#define ERR_HELP                       (1 << 2)
+#define ERR_SOUND_SERVER               (1 << 3)
+#define ERR_NETWORK_SERVER             (1 << 4)
+#define ERR_NETWORK_CLIENT             (1 << 5)
+#define ERR_FROM_SERVER                        (ERR_SOUND_SERVER | ERR_NETWORK_SERVER)
+#define ERR_EXIT_HELP                  (ERR_EXIT | ERR_HELP)
+#define ERR_EXIT_SOUND_SERVER          (ERR_EXIT | ERR_SOUND_SERVER)
+#define ERR_EXIT_NETWORK_SERVER                (ERR_EXIT | ERR_NETWORK_SERVER)
+#define ERR_EXIT_NETWORK_CLIENT                (ERR_EXIT | ERR_NETWORK_CLIENT)
+
+/* values for getFileChunk() and putFileChunk() */
+#define BYTE_ORDER_BIG_ENDIAN          0
+#define BYTE_ORDER_LITTLE_ENDIAN       1
 
 void InitCounter(void);
 unsigned long Counter(void);
@@ -57,6 +64,8 @@ void GetOptions(char **);
 void Error(int, char *, ...);
 void *checked_malloc(unsigned long);
 void *checked_calloc(unsigned long);
+void getFileChunk(FILE *, char *, int *, int);
+void putFileChunk(FILE *, char *, int, int);
 char *getKeyNameFromKeySym(KeySym);
 char *getX11KeyNameFromKeySym(KeySym);
 KeySym getKeySymFromX11KeyName(char *);
index a27dcba819af1910a6d8a9afc81a167fb7d6059b..3bf0c3005ca5fafb315e44c6fff9449a67c52fe9 100644 (file)
@@ -1928,186 +1928,6 @@ void CalibrateJoystick(int player_nr)
   DrawSetupInputScreen();
 }
 
-
-
-#if 0
-
-void CalibrateJoystick_OLD()
-{
-#ifdef __FreeBSD__
-  struct joystick joy_ctrl;
-#else
-  struct joystick_control
-  {
-    int buttons;
-    int x;
-    int y;
-  } joy_ctrl;
-#endif
-
-#ifdef MSDOS
-  char joy_nr[4];
-#endif
-
-  int joystick_nr = setup.input[0].joystick_nr;
-  int new_joystick_xleft, new_joystick_xright, new_joystick_xmiddle;
-  int new_joystick_yupper, new_joystick_ylower, new_joystick_ymiddle;
-
-  if (joystick_status == JOYSTICK_OFF)
-    goto error_out;
-
-#ifndef MSDOS
-  ClearWindow();
-  DrawText(SX+16, SY+7*32, "MOVE JOYSTICK TO",FS_BIG,FC_YELLOW);
-  DrawText(SX+16, SY+8*32, " THE UPPER LEFT ",FS_BIG,FC_YELLOW);
-  DrawText(SX+16, SY+9*32, "AND PRESS BUTTON",FS_BIG,FC_YELLOW);
-  BackToFront();
-
-#ifdef __FreeBSD__
-  joy_ctrl.b1 = joy_ctrl.b2 = 0;
-#else
-  joy_ctrl.buttons = 0;
-#endif
-  while(Joystick() & JOY_BUTTON);
-#ifdef __FreeBSD__
-  while(!(joy_ctrl.b1 || joy_ctrl.b2))
-#else
-  while(!joy_ctrl.buttons)
-#endif
-  {
-    if (read(joystick_device, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
-    {
-      joystick_status=JOYSTICK_OFF;
-      goto error_out;
-    }
-    Delay(10);
-  }
-
-  new_joystick_xleft = joy_ctrl.x;
-  new_joystick_yupper = joy_ctrl.y;
-
-  ClearWindow();
-  DrawText(SX+16, SY+7*32, "MOVE JOYSTICK TO",FS_BIG,FC_YELLOW);
-  DrawText(SX+32, SY+8*32, "THE LOWER RIGHT",FS_BIG,FC_YELLOW);
-  DrawText(SX+16, SY+9*32, "AND PRESS BUTTON",FS_BIG,FC_YELLOW);
-  BackToFront();
-
-#ifdef __FreeBSD__
-  joy_ctrl.b1 = joy_ctrl.b2 = 0;
-#else
-  joy_ctrl.buttons = 0;
-#endif
-  while(Joystick() & JOY_BUTTON);
-#ifdef __FreeBSD__
-  while(!(joy_ctrl.b1 || joy_ctrl.b2))
-#else
-  while(!joy_ctrl.buttons)
-#endif
-  {
-    if (read(joystick_device, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
-    {
-      joystick_status=JOYSTICK_OFF;
-      goto error_out;
-    }
-    Delay(10);
-  }
-
-  new_joystick_xright = joy_ctrl.x;
-  new_joystick_ylower = joy_ctrl.y;
-
-  ClearWindow();
-  DrawText(SX+32, SY+16+7*32, "CENTER JOYSTICK",FS_BIG,FC_YELLOW);
-  DrawText(SX+16, SY+16+8*32, "AND PRESS BUTTON",FS_BIG,FC_YELLOW);
-  BackToFront();
-
-#ifdef __FreeBSD__
-  joy_ctrl.b1 = joy_ctrl.b2 = 0;
-#else
-  joy_ctrl.buttons = 0;
-#endif
-  while(Joystick() & JOY_BUTTON);
-#ifdef __FreeBSD__
-  while(!(joy_ctrl.b1 || joy_ctrl.b2))
-#else
-  while(!joy_ctrl.buttons)
-#endif
-  {
-    if (read(joystick_device, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
-    {
-      joystick_status=JOYSTICK_OFF;
-      goto error_out;
-    }
-    Delay(10);
-  }
-
-  new_joystick_xmiddle = joy_ctrl.x;
-  new_joystick_ymiddle = joy_ctrl.y;
-
-  setup.input[player_nr].joy.xleft = new_joystick_xleft;
-  setup.input[player_nr].joy.yupper = new_joystick_yupper;
-  setup.input[player_nr].joy.xright = new_joystick_xright;
-  setup.input[player_nr].joy.ylower = new_joystick_ylower;
-  setup.input[player_nr].joy.xmiddle = new_joystick_xmiddle;
-  setup.input[player_nr].joy.ymiddle = new_joystick_ymiddle;
-
-  CheckJoystickData();
-
-  DrawSetupScreen();
-  while(Joystick() & JOY_BUTTON);
-  return;
-
-#endif
-  error_out:
-
-#ifdef MSDOS
-  joy_nr[0] = '#';
-  joy_nr[1] = SETUP_2ND_JOYSTICK_ON(local_player->setup)+49;
-  joy_nr[2] = '\0';
-
-  remove_joystick();
-  ClearWindow();
-  DrawText(SX+32, SY+7*32, "CENTER JOYSTICK",FS_BIG,FC_YELLOW);
-  DrawText(SX+16+7*32, SY+8*32, joy_nr, FS_BIG,FC_YELLOW);
-  DrawText(SX+32, SY+9*32, "AND PRESS A KEY",FS_BIG,FC_YELLOW);
-  BackToFront();
-
-  for(clear_keybuf();!keypressed(););
-  install_joystick(JOY_TYPE_2PADS);
-
-  ClearWindow();
-  DrawText(SX+16, SY+7*32, "MOVE JOYSTICK TO",FS_BIG,FC_YELLOW);
-  DrawText(SX+16, SY+8*32, " THE UPPER LEFT ",FS_BIG,FC_YELLOW);
-  DrawText(SX+32, SY+9*32, "AND PRESS A KEY",FS_BIG,FC_YELLOW);
-  BackToFront();
-
-  for(clear_keybuf();!keypressed(););
-  calibrate_joystick(SETUP_2ND_JOYSTICK_ON(local_player->setup));
-
-  ClearWindow();
-  DrawText(SX+16, SY+7*32, "MOVE JOYSTICK TO",FS_BIG,FC_YELLOW);
-  DrawText(SX+32, SY+8*32, "THE LOWER RIGHT",FS_BIG,FC_YELLOW);
-  DrawText(SX+32, SY+9*32, "AND PRESS A KEY",FS_BIG,FC_YELLOW);
-  BackToFront();
-
-  for(clear_keybuf();!keypressed(););
-  calibrate_joystick(SETUP_2ND_JOYSTICK_ON(local_player->setup));
-
-  DrawSetupScreen();
-  return;
-#endif
-
-  ClearWindow();
-  DrawText(SX+16, SY+16, "NO JOYSTICK",FS_BIG,FC_YELLOW);
-  DrawText(SX+16, SY+48, " AVAILABLE ",FS_BIG,FC_YELLOW);
-  BackToFront();
-  Delay(3000);
-  DrawSetupScreen();
-}
-
-#endif
-
-
-
 void HandleGameActions()
 {
   if (game_status != PLAYING)
@@ -2123,256 +1943,3 @@ void HandleGameActions()
 
   BackToFront();
 }
-
-void HandleVideoButtons(int mx, int my, int button)
-{
-  return;
-
-
-
-
-  if (game_status != MAINMENU && game_status != PLAYING)
-    return;
-
-  switch(CheckVideoButtons(mx,my,button))
-  {
-    case BUTTON_VIDEO_EJECT:
-      TapeStop();
-      if (TAPE_IS_EMPTY(tape))
-      {
-       LoadTape(level_nr);
-       if (TAPE_IS_EMPTY(tape))
-         Request("No tape for this level !",REQ_CONFIRM);
-      }
-      else
-      {
-       if (tape.changed)
-         SaveTape(tape.level_nr);
-       TapeErase();
-      }
-      DrawCompleteVideoDisplay();
-      break;
-
-    case BUTTON_VIDEO_STOP:
-      TapeStop();
-      break;
-
-    case BUTTON_VIDEO_PAUSE:
-      TapeTogglePause();
-      break;
-
-    case BUTTON_VIDEO_REC:
-      if (TAPE_IS_STOPPED(tape))
-      {
-       TapeStartRecording();
-
-#ifndef MSDOS
-       if (options.network)
-         SendToServer_StartPlaying();
-       else
-#endif
-       {
-         game_status = PLAYING;
-         InitGame();
-       }
-      }
-      else if (tape.pausing)
-      {
-       if (tape.playing)       /* PLAYING -> PAUSING -> RECORDING */
-       {
-         tape.pos[tape.counter].delay = tape.delay_played;
-         tape.playing = FALSE;
-         tape.recording = TRUE;
-         tape.changed = TRUE;
-
-         DrawVideoDisplay(VIDEO_STATE_PLAY_OFF | VIDEO_STATE_REC_ON,0);
-       }
-       else
-         TapeTogglePause();
-      }
-      break;
-
-    case BUTTON_VIDEO_PLAY:
-      if (TAPE_IS_EMPTY(tape))
-       break;
-
-      if (TAPE_IS_STOPPED(tape))
-      {
-       TapeStartPlaying();
-
-       game_status = PLAYING;
-       InitGame();
-      }
-      else if (tape.playing)
-      {
-       if (tape.pausing)                       /* PAUSE -> PLAY */
-         TapeTogglePause();
-       else if (!tape.fast_forward)            /* PLAY -> FAST FORWARD PLAY */
-       {
-         tape.fast_forward = TRUE;
-         DrawVideoDisplay(VIDEO_STATE_FFWD_ON, 0);
-       }
-       else if (!tape.pause_before_death)      /* FFWD PLAY -> + AUTO PAUSE */
-       {
-         tape.pause_before_death = TRUE;
-         DrawVideoDisplay(VIDEO_STATE_PBEND_ON, VIDEO_DISPLAY_LABEL_ONLY);
-       }
-       else                                    /* -> NORMAL PLAY */
-       {
-         tape.fast_forward = FALSE;
-         tape.pause_before_death = FALSE;
-         DrawVideoDisplay(VIDEO_STATE_FFWD_OFF | VIDEO_STATE_PBEND_OFF, 0);
-       }
-      }
-      break;
-
-    default:
-      break;
-  }
-
-  BackToFront();
-}
-
-void HandleSoundButtons(int mx, int my, int button)
-{
-
-
-
-  return;
-
-
-
-  if (game_status != PLAYING)
-    return;
-
-  switch(CheckSoundButtons(mx,my,button))
-  {
-    case BUTTON_SOUND_MUSIC:
-      if (setup.sound_music)
-      { 
-       setup.sound_music = FALSE;
-       FadeSound(background_loop[level_nr % num_bg_loops]);
-       DrawSoundDisplay(BUTTON_SOUND_MUSIC_OFF);
-      }
-      else if (sound_loops_allowed)
-      { 
-       setup.sound = setup.sound_music = TRUE;
-       PlaySoundLoop(background_loop[level_nr % num_bg_loops]);
-       DrawSoundDisplay(BUTTON_SOUND_MUSIC_ON);
-      }
-      else
-       DrawSoundDisplay(BUTTON_SOUND_MUSIC_OFF);
-      break;
-
-    case BUTTON_SOUND_LOOPS:
-      if (setup.sound_loops)
-      { 
-       setup.sound_loops = FALSE;
-       DrawSoundDisplay(BUTTON_SOUND_LOOPS_OFF);
-      }
-      else if (sound_loops_allowed)
-      { 
-       setup.sound = setup.sound_loops = TRUE;
-       DrawSoundDisplay(BUTTON_SOUND_LOOPS_ON);
-      }
-      else
-       DrawSoundDisplay(BUTTON_SOUND_LOOPS_OFF);
-      break;
-
-    case BUTTON_SOUND_SIMPLE:
-      if (setup.sound_simple)
-      { 
-       setup.sound_simple = FALSE;
-       DrawSoundDisplay(BUTTON_SOUND_SIMPLE_OFF);
-      }
-      else if (sound_status==SOUND_AVAILABLE)
-      { 
-       setup.sound = setup.sound_simple = TRUE;
-       DrawSoundDisplay(BUTTON_SOUND_SIMPLE_ON);
-      }
-      else
-       DrawSoundDisplay(BUTTON_SOUND_SIMPLE_OFF);
-      break;
-
-    default:
-      break;
-  }
-
-  BackToFront();
-}
-
-void HandleGameButtons(int mx, int my, int button)
-{
-
-
-
-  return;
-
-
-
-  if (game_status != PLAYING)
-    return;
-
-  switch(CheckGameButtons(mx,my,button))
-  {
-    case BUTTON_GAME_STOP:
-      if (AllPlayersGone)
-      {
-       CloseDoor(DOOR_CLOSE_1);
-       game_status = MAINMENU;
-       DrawMainMenu();
-       break;
-      }
-
-      if (Request("Do you really want to quit the game ?",
-                 REQ_ASK | REQ_STAY_CLOSED))
-      { 
-#ifndef MSDOS
-       if (options.network)
-         SendToServer_StopPlaying();
-       else
-#endif
-       {
-         game_status = MAINMENU;
-         DrawMainMenu();
-       }
-      }
-      else
-       OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK);
-      break;
-
-    case BUTTON_GAME_PAUSE:
-      if (options.network)
-      {
-#ifndef MSDOS
-       if (tape.pausing)
-         SendToServer_ContinuePlaying();
-       else
-         SendToServer_PausePlaying();
-#endif
-      }
-      else
-       TapeTogglePause();
-      break;
-
-    case BUTTON_GAME_PLAY:
-      if (tape.pausing)
-      {
-#ifndef MSDOS
-       if (options.network)
-         SendToServer_ContinuePlaying();
-       else
-#endif
-       {
-         tape.pausing = FALSE;
-         DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF,0);
-       }
-      }
-      break;
-
-    default:
-      break;
-  }
-
-  BackToFront();
-}
index 51a75c88dbe5e6a9d7d5f9d1d63e462cd7cc4ff7..928a955c61dfdaadfb52de3cbac2fecd145e271a 100644 (file)
@@ -708,28 +708,17 @@ static int ulaw_to_linear(unsigned char ulawbyte)
 
 /*** THE STUFF BELOW IS ONLY USED BY THE MAIN PROCESS ***/
 
-#ifndef MSDOS
-static unsigned long be2long(unsigned long *be)        /* big-endian -> longword */
-{
-  unsigned char *ptr = (unsigned char *)be;
-
-  return(ptr[0]<<24 | ptr[1]<<16 | ptr[2]<<8 | ptr[3]);
-}
-
-static unsigned long le2long(unsigned long *be)        /* little-endian -> longword */
-{
-  unsigned char *ptr = (unsigned char *)be;
-
-  return(ptr[3]<<24 | ptr[2]<<16 | ptr[1]<<8 | ptr[0]);
-}
-#endif /* !MSDOS */
+#define CHUNK_ID_LEN            4       /* IFF style chunk id length */
+#define WAV_HEADER_SIZE                20      /* size of WAV file header */
 
 boolean LoadSound(struct SoundInfo *snd_info)
 {
   char filename[256];
   char *sound_ext = "wav";
 #ifndef MSDOS
-  struct SoundHeader_WAV *sound_header;
+  byte sound_header_buffer[WAV_HEADER_SIZE];
+  char chunk[CHUNK_ID_LEN + 1];
+  int chunk_length, dummy;
   FILE *file;
   int i;
 #endif
@@ -742,166 +731,69 @@ boolean LoadSound(struct SoundInfo *snd_info)
   if ((file = fopen(filename, "r")) == NULL)
   {
     Error(ERR_WARN, "cannot open sound file '%s' - no sounds", filename);
-    return(FALSE);
+    return FALSE;
   }
 
-  if (fseek(file, 0, SEEK_END) < 0)
+  /* read chunk "RIFF" */
+  getFileChunk(file, chunk, &chunk_length, BYTE_ORDER_LITTLE_ENDIAN);
+  if (strcmp(chunk, "RIFF") != 0)
   {
-    Error(ERR_WARN, "cannot read sound file '%s' - no sounds", filename);
+    Error(ERR_WARN, "missing 'RIFF' chunk of sound file '%s'", filename);
     fclose(file);
-    return(FALSE);
+    return FALSE;
   }
 
-  snd_info->file_len = ftell(file);
-  rewind(file);
-
-  snd_info->file_ptr = checked_malloc(snd_info->file_len);
-
-  if (fread(snd_info->file_ptr, 1, snd_info->file_len, file) !=
-      snd_info->file_len)
+  /* read chunk "WAVE" */
+  getFileChunk(file, chunk, &dummy, BYTE_ORDER_LITTLE_ENDIAN);
+  if (strcmp(chunk, "WAVE") != 0)
   {
-    Error(ERR_WARN, "cannot read sound file '%s' - no sounds", filename);
+    Error(ERR_WARN, "missing 'WAVE' chunk of sound file '%s'", filename);
     fclose(file);
-    return(FALSE);
-  }
-
-  fclose(file);
-
-  sound_header = (struct SoundHeader_WAV *)snd_info->file_ptr;
-
-  if (strncmp(sound_header->magic_RIFF, "RIFF", 4) ||
-      snd_info->file_len != le2long(&sound_header->header_size) + 8 ||
-      strncmp(sound_header->magic_WAVE, "WAVE", 4) ||
-      strncmp(sound_header->magic_DATA, "data", 4) ||
-      snd_info->file_len != le2long(&sound_header->data_size) + 44)
-  {
-    Error(ERR_WARN, "'%s' is not a RIFF/WAVE file or broken - no sounds",
-         filename);
-    return(FALSE);
+    return FALSE;
   }
 
-  snd_info->data_ptr = snd_info->file_ptr + 44;
-  snd_info->data_len = le2long(&sound_header->data_size);
-
-  for (i=0; i<snd_info->data_len; i++)
-    snd_info->data_ptr[i] = snd_info->data_ptr[i]^0x80;
-
-#else /* MSDOS */
-
-  snd_info->sample_ptr = load_sample(filename);
-  if (!snd_info->sample_ptr)
-  {
-    Error(ERR_WARN, "cannot read sound file '%s' - no sounds", filename);
-    return(FALSE);
-  }
-
-#endif /* MSDOS */
-
-  return(TRUE);
-}
-
-boolean LoadSound_8SVX(struct SoundInfo *snd_info)
-{
-  char filename[256];
-#ifndef MSDOS
-  struct SoundHeader_8SVX *sound_header;
-  FILE *file;
-  char *ptr;
-  char *sound_ext = "8svx";
-#else
-  char *sound_ext = "wav";
-#endif
-
-  sprintf(filename, "%s/%s/%s.%s",
-         options.base_directory, SOUNDS_DIRECTORY, snd_info->name, sound_ext);
-
-#ifndef MSDOS
-  if (!(file=fopen(filename,"r")))
-  {
-    Error(ERR_WARN, "cannot open sound file '%s' - no sounds", filename);
-    return(FALSE);
-  }
+  /* read header information */
+  for (i=0; i<WAV_HEADER_SIZE; i++)
+    sound_header_buffer[i] = fgetc(file);
 
-  if (fseek(file,0,SEEK_END)<0)
+  /* read chunk "data" */
+  getFileChunk(file, chunk, &chunk_length, BYTE_ORDER_LITTLE_ENDIAN);
+  if (strcmp(chunk, "data") != 0)
   {
-    Error(ERR_WARN, "cannot read sound file '%s' - no sounds", filename);
+    Error(ERR_WARN, "missing 'data' chunk of sound file '%s'", filename);
     fclose(file);
-    return(FALSE);
+    return FALSE;
   }
 
-  snd_info->file_len = ftell(file);
-  rewind(file);
-
-  if (!(snd_info->file_ptr=malloc(snd_info->file_len)))
-  {
-    Error(ERR_WARN, "out of memory (this shouldn't happen :) - no sounds");
-    fclose(file);
-    return(FALSE);
-  }
+  snd_info->data_len = chunk_length;
+  snd_info->data_ptr = checked_malloc(snd_info->data_len);
 
-  if (fread(snd_info->file_ptr,1,snd_info->file_len,file)!=snd_info->file_len)
+  /* read sound data */
+  if (fread(snd_info->data_ptr, 1, snd_info->data_len, file) !=
+      snd_info->data_len)
   {
     Error(ERR_WARN, "cannot read sound file '%s' - no sounds", filename);
     fclose(file);
-    return(FALSE);
+    return FALSE;
   }
 
   fclose(file);
 
-  sound_header = (struct SoundHeader_8SVX *)snd_info->file_ptr;
-
-  if (strncmp(sound_header->magic_FORM,"FORM",4) ||
-      snd_info->file_len != be2long(&sound_header->chunk_size)+8 ||
-      strncmp(sound_header->magic_8SVX,"8SVX",4))
-  {
-    Error(ERR_WARN, "'%s' is not an IFF/8SVX file or broken - no sounds",
-         filename);
-    return(FALSE);
-  }
-
-  ptr = (char *)snd_info->file_ptr + 12;
-
-  while(ptr < (char *)(snd_info->file_ptr + snd_info->file_len))
-  {
-    if (!strncmp(ptr,"VHDR",4))
-    {
-      ptr += be2long((unsigned long *)(ptr + 4)) + 8;
-      continue;
-    }
-    else if (!strncmp(ptr,"ANNO",4))
-    {
-      ptr += be2long((unsigned long *)(ptr + 4)) + 8;
-      continue;
-    }
-    else if (!strncmp(ptr,"CHAN",4))
-    {
-      ptr += be2long((unsigned long *)(ptr + 4)) + 8;
-      continue;
-    }
-    else if (!strncmp(ptr,"BODY",4))
-    {
-      snd_info->data_ptr = (byte *)ptr + 8;
-      snd_info->data_len = be2long((unsigned long *)(ptr + 4));
-      return(TRUE);
-    }
-    else
-    {
-      /* other chunk not recognized here */
-      ptr += be2long((unsigned long *)(ptr + 4)) + 8;
-      continue;
-    }
-  }
+  for (i=0; i<snd_info->data_len; i++)
+    snd_info->data_ptr[i] = snd_info->data_ptr[i] ^ 0x80;
 
-  return(FALSE);
 #else /* MSDOS */
+
   snd_info->sample_ptr = load_sample(filename);
-  if(!snd_info->sample_ptr)
+  if (!snd_info->sample_ptr)
   {
     Error(ERR_WARN, "cannot read sound file '%s' - no sounds", filename);
     return(FALSE);
   }
-  return(TRUE);
+
 #endif /* MSDOS */
+
+  return(TRUE);
 }
 
 void PlaySound(int nr)
@@ -1006,16 +898,16 @@ void StopSoundExt(int nr, int method)
 #endif
 }
 
-void FreeSounds(int max)
+void FreeSounds(int num_sounds)
 {
   int i;
 
-  if (sound_status==SOUND_OFF)
+  if (sound_status == SOUND_OFF)
     return;
 
-  for(i=0;i<max;i++)
+  for(i=0; i<num_sounds; i++)
 #ifndef MSDOS
-    free(Sound[i].file_ptr);
+    free(Sound[i].data_ptr);
 #else
     destroy_sample(Sound[i].sample_ptr);
 #endif
index 0811e5a21bb2c00f50f9149bea01400f1897be5c..2e934709e2ee041ebb0be6cc40c9aada059d4b84 100644 (file)
@@ -125,22 +125,11 @@ struct SoundHeader_8SVX
   char magic_8SVX[4];
 };
 
-struct SoundHeader_WAV
-{
-  char magic_RIFF[4];
-  unsigned long header_size;
-  char magic_WAVE[4];
-  char some_stuff[24];
-  char magic_DATA[4];
-  unsigned long data_size;
-};
-
 struct SoundInfo
 { 
   char *name;
-  byte *file_ptr;
   byte *data_ptr;
-  long file_len, data_len;
+  long data_len;
 #ifdef MSDOS
   SAMPLE *sample_ptr;
 #endif
index 20a129bc77f66c4195cadd85a6ba9563e517b73f..258c99a6517a72c65b3c205214920884a8483bcf 100644 (file)
@@ -1862,12 +1862,7 @@ boolean Request(char *text, unsigned int req_state)
            DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1);
 
   /* clear door drawing field */
-#if 0
-  XFillRectangle(display, pix[PIX_DB_DOOR], gc,
-                DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE);
-#else
   XFillRectangle(display, drawto, gc, DX, DY, DXSIZE, DYSIZE);
-#endif
 
   /* write text for request */
   for(ty=0; ty<13; ty++)
@@ -1892,37 +1887,12 @@ boolean Request(char *text, unsigned int req_state)
     }
     sprintf(txt, text); 
     txt[tl] = 0;
-#if 0
-    DrawTextExt(pix[PIX_DB_DOOR], gc,
-               DOOR_GFX_PAGEX1 + 51 - (tl * 14)/2, SY + ty * 16,
-               txt, FS_SMALL, FC_YELLOW);
-#else
     DrawTextExt(drawto, gc,
                DX + 51 - (tl * 14)/2, DY + 8 + ty * 16,
                txt, FS_SMALL, FC_YELLOW);
-#endif
     text += tl + (tc == 32 ? 1 : 0);
   }
 
-#if 0
-  if (req_state & REQ_ASK)
-  {
-    DrawYesNoButton(BUTTON_OK, DB_INIT);
-    DrawYesNoButton(BUTTON_NO, DB_INIT);
-  }
-  else if (req_state & REQ_CONFIRM)
-  {
-    DrawConfirmButton(BUTTON_CONFIRM, DB_INIT);
-  }
-  else if (req_state & REQ_PLAYER)
-  {
-    DrawPlayerButton(BUTTON_PLAYER_1, DB_INIT);
-    DrawPlayerButton(BUTTON_PLAYER_2, DB_INIT);
-    DrawPlayerButton(BUTTON_PLAYER_3, DB_INIT);
-    DrawPlayerButton(BUTTON_PLAYER_4, DB_INIT);
-  }
-#else
-
   if (req_state & REQ_ASK)
   {
     MapGadget(tool_gadget[TOOL_CTRL_ID_YES]);
@@ -1945,8 +1915,6 @@ boolean Request(char *text, unsigned int req_state)
            DX, DY, DXSIZE, DYSIZE,
            DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
 
-#endif
-
   OpenDoor(DOOR_OPEN_1);
   ClearEventQueue();
 
@@ -1974,11 +1942,6 @@ boolean Request(char *text, unsigned int req_state)
        case ButtonRelease:
        case MotionNotify:
        {
-
-#if 0
-         int choice;
-#endif
-
          if (event.type == MotionNotify)
          {
            Window root, child;
@@ -2008,46 +1971,6 @@ boolean Request(char *text, unsigned int req_state)
              button_status = MB_RELEASED;
          }
 
-
-
-#if 0
-         if (req_state & REQ_ASK)
-           choice = CheckYesNoButtons(mx,my,button_status);
-         else if (req_state & REQ_CONFIRM)
-           choice = CheckConfirmButton(mx,my,button_status);
-         else
-           choice = CheckPlayerButtons(mx,my,button_status);
-
-         switch(choice)
-         {
-           case BUTTON_OK:
-             result = TRUE;
-             break;
-           case BUTTON_NO:
-             result = FALSE;
-             break;
-           case BUTTON_CONFIRM:
-             result = TRUE | FALSE;
-             break;
-
-           case BUTTON_PLAYER_1:
-             result = 1;
-             break;
-           case BUTTON_PLAYER_2:
-             result = 2;
-             break;
-           case BUTTON_PLAYER_3:
-             result = 3;
-             break;
-           case BUTTON_PLAYER_4:
-             result = 4;
-             break;
-
-           default:
-             break;
-         }
-#else
-
          /* this sets 'request_gadget_id' */
          HandleGadgets(mx, my, button_status);
 
@@ -2079,7 +2002,6 @@ boolean Request(char *text, unsigned int req_state)
            default:
              break;
          }
-#endif
 
          break;
        }