int _PlayerSound(char *file, int line, int num, int *x, int *y, int *z, Voc3D_Flags flags, PLAYERp pp) //PlayerSound(int num, int *x, int *y, int *z, Voc3D_Flags flags, PLAYERp pp) { int handle; VOC_INFOp vp; if (Prediction) return 0; if (pp < Player || pp >= Player + MAX_SW_PLAYERS) { TerminateGame(); printf("Player Sound invalid player: file %s, line %d\n",file,line); exit(0); } PRODUCTION_ASSERT(pp >= Player && pp < Player+MAX_SW_PLAYERS); PRODUCTION_ASSERT(num >= 0 && num < DIGI_MAX); if (TEST(pp->Flags, PF_DEAD)) return 0; // You're dead, no talking! // If this is a player voice and he's already yacking, forget it. vp = &voc[num]; if (vp == NULL) { TerminateGame(); printf("vp == NULL in PlayerSound, num = %d\n",num); exit(0); } // Not a player voice, bail. if (vp->priority != PRI_PLAYERVOICE && vp->priority != PRI_PLAYERDEATH) return 0; // He wasn't talking, but he will be now. if (!pp->PlayerTalking) { pp->PlayerTalking = TRUE; pp->TalkVocnum = num; // Set the voc number pp->TalkVocHandle = PlaySound(num, x, y, z, flags); // Play the sound if (pp->TalkVocHandle < 0) { pp->PlayerTalking = FALSE; pp->TalkVocnum = -1; pp->TalkVocHandle = -1; } } return 0; }
int ReadSound(int handle, VOC_INFOp vp, int length) { if (kread(handle, vp->data, length) != length) { TerminateGame(); printf("Error reading file '%s'.\n", vp->name); exit(0); } vp->datalen = length; kclose(handle); return 0; }
// // Initialize the console command list with the pre_command startup array // void CON_InitConsole( void ) { CON_COMMANDp i; for (i = &pre_commands[0]; i->command != NULL; i++) { if(!CON_AddCommand(i->command, i->function)) { printf("CON_InitConsole: Failed to add command contained in pre_commands list.\n"); TerminateGame(); exit(0); } } //printf("CON_InitConsole: Command list initialized.\n"); }
int _tmain(int argc, _TCHAR* argv[]) { Game game; InitGame(game); while (!IsGameFinished(game)) { // Get game time game.t = timeGetTime(); GetUserInput(game); PerformAI(game); DrawGame(game); } DisplayResults(game); TerminateGame(game); return 0; }
void LockSound(int num) { VOC_INFOp vp = &voc[num]; // if data is not locked if (vp->lock <= CACHE_UNLOCK_MAX) { vp->lock = CACHE_LOCK_START; } else // if data is already locked { vp->lock++; if (vp->lock >= CACHE_LOCK_MAX || vp->lock == 0) { DumpSounds(); TerminateGame(); printf("lock > MAX, num = %d",num); exit(0); } //ASSERT(vp->lock < CACHE_LOCK_MAX); //ASSERT(vp->lock != 0); } }