Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.  * OpenTyrian: A modern cross-platform port of Tyrian
  3.  * Copyright (C) 2007-2009  The OpenTyrian Development Team
  4.  *
  5.  * This program is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU General Public License
  7.  * as published by the Free Software Foundation; either version 2
  8.  * of the License, or (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  18.  */
  19. #include "setup.h"
  20.  
  21. #include "joystick.h"
  22. #include "keyboard.h"
  23. #include "network.h"
  24. #include "nortvars.h"
  25. #include "opentyr.h"
  26. #include "mainint.h"
  27. #include "mouse.h"
  28. #include "video.h"
  29.  
  30. #include "SDL.h"
  31.  
  32. void JE_textMenuWait( JE_word *waitTime, JE_boolean doGamma )
  33. {
  34.         set_mouse_position(160, 100);
  35.        
  36.         do
  37.         {
  38.                 JE_showVGA();
  39.                
  40.                 push_joysticks_as_keyboard();
  41.                 service_SDL_events(true);
  42.                
  43.                 if (doGamma)
  44.                         JE_gammaCheck();
  45.                
  46.                 inputDetected = newkey | mousedown;
  47.                
  48.                 if (lastkey_sym == SDLK_SPACE)
  49.                 {
  50.                         lastkey_sym = SDLK_RETURN;
  51.                 }
  52.                
  53.                 if (mousedown)
  54.                 {
  55.                         newkey = true;
  56.                         lastkey_sym = SDLK_RETURN;
  57.                 }
  58.                
  59.                 if (has_mouse && input_grab_enabled)
  60.                 {
  61.                         if (abs(mouse_y - 100) > 10)
  62.                         {
  63.                                 inputDetected = true;
  64.                                 if (mouse_y - 100 < 0)
  65.                                 {
  66.                                         lastkey_sym = SDLK_UP;
  67.                                 } else {
  68.                                         lastkey_sym = SDLK_DOWN;
  69.                                 }
  70.                                 newkey = true;
  71.                         }
  72.                         if (abs(mouse_x - 160) > 10)
  73.                         {
  74.                                 inputDetected = true;
  75.                                 if (mouse_x - 160 < 0)
  76.                                 {
  77.                                         lastkey_sym = SDLK_LEFT;
  78.                                 } else {
  79.                                         lastkey_sym = SDLK_RIGHT;
  80.                                 }
  81.                                 newkey = true;
  82.                         }
  83.                 }
  84.                
  85.                 NETWORK_KEEP_ALIVE();
  86.                
  87.                 uSDL_Delay(16);
  88.                
  89.                 if (*waitTime > 0)
  90.                 {
  91.                         (*waitTime)--;
  92.                 }
  93.         } while (!(inputDetected || *waitTime == 1 || haltGame));
  94. }
  95.  
  96.