/* * S_HandleActivateCmd */ static unsigned S_HandleActivateCmd( const sndActivateCmd_t *cmd ) { //Com_Printf("S_HandleActivateCmd\n"); S_Clear(); S_Activate( cmd->active ? qtrue : qfalse ); return sizeof( *cmd ); }
/* * S_StopAllSounds */ static void S_StopAllSounds( bool clear, bool stopMusic ) { // clear all the playsounds and channels S_ClearPlaysounds(); if( stopMusic ) S_StopBackgroundTrack(); if ( clear ) S_Clear( ); }
/* * S_HandleClearCmd */ static unsigned S_HandleClearCmd( const sndCmdClear_t *cmd ) { //Com_Printf("S_HandleClearCmd\n"); S_Clear(); return sizeof( *cmd ); }
Word MiniLoop(void(*start)(void),void(*stop)(void), Word(*ticker)(void),void(*drawer)(void)) { Word exit; Word buttons; /* Setup (cache graphics,etc) */ DoWipe = TRUE; start(); /* Prepare the background task (Load data etc.) */ exit = 0; /* I am running */ gameaction = ga_nothing; /* Game is not in progress */ TotalGameTicks = 0; /* No vbls processed during game */ ElapsedTime = 0; /* No time has elapsed yet */ /* Init the joypad states */ JoyPadButtons = PrevJoyPadButtons = NewJoyPadButtons = 0; do { /* Run the tic immediately */ TotalGameTicks += ElapsedTime; /* Add to the VBL count */ exit = ticker(); /* Process the keypad commands */ /* adaptive timing based on previous frame */ if (DemoPlayback || DemoRecording) { ElapsedTime = 4; /* Force 15 FPS */ } else { ElapsedTime = (Word)LastTics; /* Get the true time count */ if (ElapsedTime >= 9) { /* Too slow? */ ElapsedTime = 8; /* Make 7.5 fps as my mark */ } } /* Get buttons for next tic */ PrevJoyPadButtons = JoyPadButtons; /* Pass through the latest keypad info */ buttons = ReadJoyButtons(0); /* Read the controller */ JoyPadButtons = buttons; /* Save it */ if (DemoPlayback) { /* Playing back a demo? */ if (buttons & (PadA|PadB|PadC|PadD) ) { /* Abort? */ exit = ga_exitdemo; /* Exit the demo */ break; } /* Get a joypad from demo data */ JoyPadButtons = buttons = GetDemoCmd(); } NewJoyPadButtons = (buttons^PrevJoyPadButtons)&buttons; /* Get the joypad downs... */ if (DemoRecording) { /* Am I recording a demo? */ DemoDataPtr[0] = LocalToNet(buttons); /* Save the current joypad data */ ++DemoDataPtr; } /* Am I recording a demo? */ if ((DemoRecording || DemoPlayback) && (buttons & PadStart) ) { exit = ga_completed; /* End the game right now! */ } if (gameaction == ga_warped) { /* Did I end the level? */ exit = ga_warped; /* Exit after drawing */ break; /* Exit */ } /* sync up with the refresh */ drawer(); /* Draw the screen */ } while (!exit); /* Is the loop finished? */ stop(); /* Release resources */ S_Clear(); /* Kill sounds */ players.mo = 0; /* For net consistancy checks */ return exit; /* Return the abort code from ticker */ }