Exemple #1
0
void InitSetup(void)
{
   int i;
   //RegisterShutdownFunction( ShutDown );

   //StartWindows();
   //initkeys();
   //CONFIG_GetSetupFilename();
   //InitializeKeyDefList();
   //CONFIG_ReadSetup();
   if (CONTROL_Startup( 1, &GetTime, /*120*/ 140 ))
       exit(1);
   SetupGameButtons();
   CONFIG_SetupMouse();
   CONFIG_SetupJoystick();

   CONTROL_JoystickEnabled = (UseJoystick && CONTROL_JoyPresent);
   CONTROL_MouseEnabled = (UseMouse && CONTROL_MousePresent);

   for (i=0;i<joynumaxes;i++)
        setjoydeadzone(i,JoystickAnalogueDead[i],JoystickAnalogueSaturate[i]);
   /*{
   int i;
   CONTROL_PrintKeyMap();
   for(i=0;i<NUMGAMEFUNCTIONS;i++) CONTROL_PrintControlFlag(i);
   CONTROL_PrintAxes();
   }*/

   if (RTSCustom[0] != 0)
       RTS_Init(RTSCustom);
   else
       RTS_Init(RTSName);
}
Exemple #2
0
void InitSetup(void)
{
    int i;
    //RegisterShutdownFunction( ShutDown );

    //StartWindows();
    //initkeys();
    //CONFIG_GetSetupFilename();
    //InitializeKeyDefList();
    //CONFIG_ReadSetup();
    if (CONTROL_Startup(1, &GetTime, /*120*/ 140)) exit(1);
    SetupGameButtons();
    CONFIG_SetupMouse();
    CONFIG_SetupJoystick();

    CONTROL_JoystickEnabled = (UseJoystick && CONTROL_JoyPresent);
    CONTROL_MouseEnabled = (UseMouse && CONTROL_MousePresent);

    /*{
    int i;
    CONTROL_PrintKeyMap();
    for(i=0;i<NUMGAMEFUNCTIONS;i++) CONTROL_PrintControlFlag(i);
    CONTROL_PrintAxes();
    }*/

    RTS_Init(RTSName);
}
Exemple #3
0
void main()
{
    char * song;
    char * voc;
    volatile int32 lasttime;

    RegisterShutdownFunction( ShutDown );
    KB_Startup();
    timerhandle = TIME_AddTimer( 40, &timer );
    //CONFIG_GetSetupFilename();
    CONFIG_ReadSetup();
    CONTROL_Startup( 1, &GetTime, 1500 );
    SetupGameButtons();

    MusicStartup();
    SoundStartup();
    RTS_Init(RTSName);

    // load in some test data

    LoadFile("test.mid",&song);
    LoadFile("test.voc",&voc);

    // start playing a song

    MUSIC_PlaySong( song, MUSIC_LoopSong );


    lasttime = timer;
    while (1)
    {
       int32 i;
       ControlInfo info;

       while (lasttime==timer)
       {
           ServiceEvents();
       }
       lasttime = timer;
//       printf("timer=%ld\n",timer);
       CONTROL_GetInput( &info );

       if  (
           info.dx!=0 ||
           info.dy!=0 ||
           info.dz!=0 ||
           info.dpitch!=0 ||
           info.dyaw!=0 ||
           info.droll!=0
           )
           printf("x=%6ld y=%6ld z=%6ld yaw=%6ld pitch=%6ld roll=%6ld\n",
                  info.dx,info.dy,info.dz,info.dyaw,info.dpitch,info.droll);
       // Get Keyboard input and set appropiate game function states
       for (i=0;i<NUMGAMEFUNCTIONS;i++)
       {
          if (BUTTON(i) && !BUTTONHELD(i))
          {
              printf("%s\n",gamefunctions[i]);
          }
       }
       for (i=0;i<10;i++)
       {
          if (KB_KeyPressed(sc_F1+i))
          {
              byte * ptr;
              KB_ClearKeyDown(sc_F1+i);
              ptr = RTS_GetSound(i);
              FX_PlayVOC( ptr, 0, 255, 255, 255, 255, 0);
          }
       }
       // Check to see if fire is being pressed so we can play a sound
       if (BUTTON(gamefunc_Fire) && !BUTTONHELD(gamefunc_Fire))
       {
           FX_PlayVOC( voc, 0, 255, 255, 255, 255, 0);
       }

       // Check to see if we want to exit
       if ( KB_KeyPressed(sc_Escape) )
       {
           break;
       }
    }
    ShutDown();
}