Пример #1
0
void PlaySoundRTS(int rts_num)
{
    char *rtsptr;
    int voice=-1;

    if (RTS_NumSounds() <= 0 || !gs.FxOn)
        return;

    rtsptr = (char *)RTS_GetSound(rts_num - 1);

    ASSERT(rtsptr);

    voice = FX_PlayAuto3D(rtsptr, RTS_SoundLength(rts_num - 1), FX_ONESHOT, 0, 0, 0, 255, -rts_num);

    if (voice <= FX_Ok)
    {
        lumplockbyte[rts_num]--;
    }
}
Пример #2
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();
}