这篇教程C++ trap_Milliseconds函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中trap_Milliseconds函数的典型用法代码示例。如果您正苦于以下问题:C++ trap_Milliseconds函数的具体用法?C++ trap_Milliseconds怎么用?C++ trap_Milliseconds使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了trap_Milliseconds函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: S_OpenMusicTrack/** S_OpenBackgroundTrackProc*/static void *S_OpenBackgroundTrackProc( void *ptrack ){ bgTrack_t *track = ptrack; unsigned start; bool buffering; S_OpenMusicTrack( track, &buffering ); s_bgTrackBuffering = buffering; start = trap_Milliseconds(); while( s_bgTrackBuffering ) { if( trap_Milliseconds() > start + BACKGROUND_TRACK_BUFFERING_TIMEOUT ) { } else if( trap_FS_Eof( track->file ) ) { } else { if( trap_FS_Seek( track->file, BACKGROUND_TRACK_BUFFERING_SIZE, FS_SEEK_SET ) < 0 ) continue; trap_FS_Seek( track->file, 0, FS_SEEK_SET ); } // in case we delayed openening to let the stream cache for a while, // start actually reading from it now if( !track->open( track, NULL ) ) { track->ignore = true; } s_bgTrackBuffering = false; } s_bgTrack = track; s_bgTrackLoading = false; return NULL;}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:38,
示例2: CG_DrawInformation/*====================CG_DrawInformationDraw all the status / pacifier stuff during level loading====================*/void CG_DrawInformation(qboolean forcerefresh) { static int lastcalled = 0; if (lastcalled && (trap_Milliseconds() - lastcalled < 500)) { return; } lastcalled = trap_Milliseconds(); if (cg.snap) { return; // we are in the world, no need to draw information } CG_DrawConnectScreen(qfalse, forcerefresh);}
开发者ID:boutetnico,项目名称:ETrun,代码行数:21,
示例3: buffer_evict// Remove the least recently used sound effect from memorystatic bool buffer_evict(){ int i; int candinate = -1; int candinate_value = trap_Milliseconds(); for( i = 0; i < MAX_SFX; i++ ) { if( knownSfx[i].filename[0] == '/0' || !knownSfx[i].inMemory || knownSfx[i].isLocked ) continue; if( knownSfx[i].used < candinate_value ) { candinate = i; candinate_value = knownSfx[i].used; } } if( candinate != -1 ) { return S_UnloadBuffer( &knownSfx[candinate] ); } return false;}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:26,
示例4: CG_windowFree// Free up a window reservationvoid CG_windowFree(cg_window_t *w){ int i, j; cg_windowHandler_t *wh = &cg.winHandler; if(w == NULL) return; if(w->effects >= WFX_FADEIN && w->state != WSTATE_OFF && w->inuse == qtrue) { w->state = WSTATE_SHUTDOWN; w->time = trap_Milliseconds(); return; } for(i=0; i<wh->numActiveWindows; i++) { if(w == &wh->window[wh->activeWindows[i]]) { for(j=i; j<wh->numActiveWindows; j++) { if(j+1 < wh->numActiveWindows) { wh->activeWindows[j] = wh->activeWindows[j+1]; } } w->id = WID_NONE; w->inuse = qfalse; w->state = WSTATE_OFF; CG_removeStrings(w); wh->numActiveWindows--; break; } }}
开发者ID:GenaSG,项目名称:ET,代码行数:34,
示例5: source_setup/** source_setup*/static void source_setup( src_t *src, sfx_t *sfx, int priority, int entNum, int channel, float fvol, float attenuation ){ ALuint buffer; // Mark the SFX as used, and grab the raw AL buffer S_UseBuffer( sfx ); buffer = S_GetALBuffer( sfx ); clamp_low( attenuation, 0.0f ); src->lastUse = trap_Milliseconds(); src->sfx = sfx; src->priority = priority; src->entNum = entNum; src->channel = channel; src->fvol = fvol; src->attenuation = attenuation; src->isActive = qtrue; src->isLocked = qfalse; src->isLooping = qfalse; src->isTracking = qfalse; VectorClear( src->origin ); VectorClear( src->velocity ); qalSourcefv( src->source, AL_POSITION, vec3_origin ); qalSourcefv( src->source, AL_VELOCITY, vec3_origin ); qalSourcef( src->source, AL_GAIN, fvol * s_volume->value ); qalSourcei( src->source, AL_SOURCE_RELATIVE, AL_FALSE ); qalSourcei( src->source, AL_LOOPING, AL_FALSE ); qalSourcei( src->source, AL_BUFFER, buffer ); qalSourcef( src->source, AL_REFERENCE_DISTANCE, s_attenuation_refdistance ); qalSourcef( src->source, AL_MAX_DISTANCE, s_attenuation_maxdistance ); qalSourcef( src->source, AL_ROLLOFF_FACTOR, attenuation );}
开发者ID:Kaperstone,项目名称:warsow,代码行数:38,
示例6: G_ExplodefragnadevoidG_Explodefragnade(gentity_t *ent, vec3_t origin){ vec3_t pos, dir; long i; //int damage; float mag; trace_t tr; gentity_t *target; srand(trap_Milliseconds()); for(i = 0;i < GRENADE_SHRAPNEL_COUNT;i++) { gentity_t *shrapnel; dir[0] = (int) (((double) rand() / ((double) (RAND_MAX) + (double) (1))) * GRENADE_SHRAPNEL_MAG) - (GRENADE_SHRAPNEL_MAG / 2); dir[1] = (int) (((double) rand() / ((double) (RAND_MAX) + (double) (1))) * GRENADE_SHRAPNEL_MAG) - (GRENADE_SHRAPNEL_MAG / 2); dir[2] = (int) (((double) rand() / ((double) (RAND_MAX) + (double) (1))) * GRENADE_SHRAPNEL_MAG) - (GRENADE_SHRAPNEL_MAG / 2); //VectorNormalize( dir ); mag = abs(dir[0]) + abs(dir[1]) + abs(dir[2]); dir[0] = dir[0] / mag; dir[1] = dir[1] / mag; dir[2] = dir[2] / mag; VectorMA(origin, GRENADE_SHRAPNEL_RANGE, dir, pos); //trap_Trace( &tr, origin, NULL, NULL, pos, ent->r.ownerNum, MASK_SHOT ); target = &g_entities[tr.entityNum]; //damage = Distance(tr.endpos,origin) / GRENADE_SHRAPNEL_RANGE * GRENADE_SHRAPNEL_DAMAGE; shrapnel = fire_shrapnel(ent, origin, dir); //if(target->health > 0 && target->takedamage) //{ // G_Damage( target, ent, ent, dir, tr.endpos, damage, 0, MOD_GRENADE ); //} }}
开发者ID:AlienHoboken,项目名称:Tremulous-Z-Server,代码行数:32,
示例7: sys_millisecondsstatic JSBool sys_milliseconds(JSContext *cx, unsigned argc, jsval *vp){ jsval rval; JS_NewNumberValue(cx, trap_Milliseconds(), &rval); JS_SET_RVAL(cx, vp, rval); return JS_TRUE;}
开发者ID:donald-hanson,项目名称:battle-of-the-sexes,代码行数:7,
示例8: G_StoreClientPositionvoid G_StoreClientPosition(gentity_t *ent) { int top, currentTime; if (!IS_ACTIVE(ent)) { return; } top = ent->client->topMarker; // new frame, mark the old marker's time as the end of the last frame if (ent->client->clientMarkers[top].time < level.time) { ent->client->clientMarkers[top].time = level.previousTime; top = ent->client->topMarker = ent->client->topMarker == MAX_CLIENT_MARKERS - 1 ? 0 : ent->client->topMarker + 1; } currentTime = level.previousTime + trap_Milliseconds() - level.frameTime; if (currentTime > level.time) { // owwie, we just went into the next frame... let's push them back currentTime = level.time; } VectorCopy(ent->r.mins, ent->client->clientMarkers[top].mins); VectorCopy(ent->r.maxs, ent->client->clientMarkers[top].maxs); VectorCopy(ent->r.currentOrigin, ent->client->clientMarkers[top].origin); // OSP - these timers appear to be questionable ent->client->clientMarkers[top].servertime = level.time; ent->client->clientMarkers[top].time = currentTime;}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:28,
示例9: srand/*===============G_GenerateNewConnectionGenerates a new connection===============*/connectionRecord_t *G_GenerateNewConnection( gclient_t *client ){ int code = 0; int i; // this should be really random srand( trap_Milliseconds( ) ); // there is a very very small possibility that this // will loop infinitely do { code = rand( ); } while( !G_CheckForUniquePTRC( code ) ); for( i = 0; i < MAX_CLIENTS; i++ ) { //found an unused slot if( !connections[ i ].ptrCode ) { connections[ i ].ptrCode = code; connections[ i ].clientNum = client->ps.clientNum; client->pers.connection = &connections[ i ]; G_UpdatePTRConnection( client ); return &connections[ i ]; } } return NULL;}
开发者ID:redrumrobot,项目名称:korx,代码行数:38,
示例10: G_StoreClientPositionvoid G_StoreClientPosition( gentity_t* ent ) { int top, currentTime; if (!( ent->inuse && (ent->client->sess.sessionTeam == TEAM_AXIS || ent->client->sess.sessionTeam == TEAM_ALLIES) && ent->r.linked && (ent->health > 0) && !(ent->client->ps.pm_flags & PMF_LIMBO) && (ent->client->ps.pm_type == PM_NORMAL) )) { return; } top = ent->client->topMarker; // new frame, mark the old marker's time as the end of the last frame if( ent->client->clientMarkers[top].time < level.time) { ent->client->clientMarkers[top].time = level.previousTime; top = ent->client->topMarker = ent->client->topMarker == MAX_CLIENT_MARKERS - 1 ? 0 : ent->client->topMarker + 1; } currentTime = level.previousTime + trap_Milliseconds() - level.frameTime; if(currentTime > level.time) { // owwie, we just went into the next frame... let's push them back currentTime = level.time; } VectorCopy( ent->r.mins, ent->client->clientMarkers[top].mins ); VectorCopy( ent->r.maxs, ent->client->clientMarkers[top].maxs ); VectorCopy( ent->r.currentOrigin, ent->client->clientMarkers[top].origin ); ent->client->clientMarkers[top].servertime = level.time; ent->client->clientMarkers[top].time = currentTime;}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:34,
示例11: G_SetRaceTime// from ASvoid G_SetRaceTime( edict_t *ent, int sector, unsigned int time ){ gclient_t *cl; raceRun_t *rr; cl = ent->r.client; if( ! ent->r.inuse || cl == NULL ) return; rr = &cl->level.stats.currentRun; if( sector < -1 || sector >= rr->numSectors ) return; // normal sector if( sector >= 0 ) rr->times[sector] = time; else if (rr->numSectors > 0) { raceRun_t *nrr; // new global racerun rr->times[rr->numSectors] = time; rr->timestamp = trap_Milliseconds(); // validate the client // no bots for race, at all if( ent->r.svflags & SVF_FAKECLIENT /* && mm_debug_reportbots->value == 0 */ ) { G_Printf("G_SetRaceTime: not reporting fakeclients/n"); return; } if( cl->mm_session <= 0 ) { G_Printf("G_SetRaceTime: not reporting non-registered clients/n"); return; } if( !game.raceruns ) game.raceruns = LinearAllocator( sizeof( raceRun_t ), 0, _G_LevelMalloc, _G_LevelFree ); // push new run nrr = ( raceRun_t * )LA_Alloc( game.raceruns ); memcpy( nrr, rr, sizeof( raceRun_t ) ); // reuse this one in nrr rr->times = 0; // see if we have to push intermediate result if( LA_Size( game.raceruns ) >= RACERUN_BATCH_SIZE ) { G_Match_SendReport(); // double-check this for memory-leaks if( game.raceruns != 0 ) LinearAllocator_Free( game.raceruns ); game.raceruns = 0; } }}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:59,
示例12: G_ClearSnap/** G_ClearSnap* We just run G_SnapFrame, the server just sent the snap to the clients,* it's now time to clean up snap specific data to start the next snap from clean.*/void G_ClearSnap( void ){ edict_t *ent; game.realtime = trap_Milliseconds(); // level.time etc. might not be real time // clear gametype's clock override gs.gameState.longstats[GAMELONG_CLOCKOVERRIDE] = 0; // clear all events in the snap for( ent = &game.edicts[0]; ENTNUM( ent ) < game.numentities; ent++ ) { if( ISEVENTENTITY( &ent->s ) ) // events do not persist after a snapshot { G_FreeEdict( ent ); continue; } // events only last for a single message ent->s.events[0] = ent->s.events[1] = 0; ent->s.eventParms[0] = ent->s.eventParms[1] = 0; ent->numEvents = 0; ent->eventPriority[0] = ent->eventPriority[1] = false; ent->s.teleported = qfalse; // remove teleported bit. // remove effect bits that are (most likely) added from gametypes ent->s.effects = ( ent->s.effects & (EF_TAKEDAMAGE|EF_CARRIER|EF_FLAG_TRAIL|EF_ROTATE_AND_BOB|EF_STRONG_WEAPON|EF_GHOST) ); } // recover some info, let players respawn and finally clear the snap structures for( ent = &game.edicts[0]; ENTNUM( ent ) < game.numentities; ent++ ) { if( !GS_MatchPaused() ) { // copy origin to old origin ( this old_origin is for snaps ) if( !( ent->r.svflags & SVF_TRANSMITORIGIN2 ) ) VectorCopy( ent->s.origin, ent->s.old_origin ); G_CheckClientRespawnClick( ent ); } if( GS_MatchPaused() ) ent->s.sound = entity_sound_backup[ENTNUM( ent )]; // clear the snap temp info memset( &ent->snap, 0, sizeof( ent->snap ) ); if( ent->r.client && trap_GetClientState( PLAYERNUM( ent ) ) >= CS_SPAWNED ) { memset( &ent->r.client->resp.snap, 0, sizeof( ent->r.client->resp.snap ) ); // set race stats to invisible RS_clearHUDStats( ent->r.client ); // racesow - clear with our function } } g_snapStarted = false;}
开发者ID:futurepneu,项目名称:racesow,代码行数:62,
示例13: CG_DrawInformation/*====================CG_DrawInformationDraw all the status / pacifier stuff during level loading====================*/void CG_DrawInformation(qboolean forcerefresh){ static int lastcalled = 0; if (lastcalled && (trap_Milliseconds() - lastcalled < 500)) { return; } lastcalled = trap_Milliseconds(); if (cg.snap) { return; // we are in the world, no need to draw information } // loadpanel: erase the screen now, because otherwise the "awaiting challenge"-UI-screen is still visible behind the client-version of it (the one with the progressbar),.. // ..and we do not want a flickering screen (on widescreens). // debriefing screen: no need to erase the screen.. if (!cgs.dbShowing) { if (!cgs.media.backTileShader) { cgs.media.backTileShader = trap_R_RegisterShaderNoMip("gfx/2d/backtile"); } if (cgs.glconfig.windowAspect != RATIO43) { float xoffset = Ccg_WideXoffset() * cgs.screenXScale; trap_R_DrawStretchPic(0, 0, xoffset, cgs.glconfig.vidHeight, 0, 0, 1, 1, cgs.media.backTileShader); // left side trap_R_DrawStretchPic(cgs.glconfig.vidWidth - xoffset, 0, xoffset, cgs.glconfig.vidHeight, 0, 0, 1, 1, cgs.media.backTileShader); // right side } } CG_DrawConnectScreen(qfalse, forcerefresh); // TODO: dynamic game server MOTD window /* if(cg.motdWindow == NULL) { CG_createMOTDWindow(); } if(cg.motdWindow != NULL) { CG_windowDraw(); } */}
开发者ID:BulldogDrummond,项目名称:etlegacy-mysql,代码行数:51,
示例14: qasExecuteint qasExecute( int contextHandle ){ contexthandle_t *ch = qasGetContextHandle( contextHandle ); if( !ch ) return QASINVALIDHANDLE; ch->timeOut = trap_Milliseconds() + 500; ch->timeOut = 0; return ch->ctx->Execute();}
开发者ID:Racenet,项目名称:racesow,代码行数:10,
示例15: CG_mvFree///////////////////////////// Delete a view window//void CG_mvFree( int pID ) { cg_window_t *w = CG_mvClientLocate( pID ); if ( w != NULL ) { // Free it in mvDraw() w->targetTime = 100; w->time = trap_Milliseconds(); w->state = WSTATE_SHUTDOWN; }}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:13,
示例16: S_UseBuffervoid S_UseBuffer( sfx_t *sfx ){ if( sfx->filename[0] == '/0' ) return; if( !sfx->inMemory ) S_LoadBuffer( sfx ); sfx->used = trap_Milliseconds();}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:10,
示例17: BG_LoadWeaponsqboolean BG_LoadWeapons ( weaponData_t *weaponDataTable, unsigned int *numLoadedWeapons, unsigned int *numWeapons ){ int i; char weaponFiles[8192]; int numFiles = strap_FS_GetFileList ("ext_data/weapons", ".wpn", weaponFiles, sizeof (weaponFiles)); const char *weaponFile = weaponFiles; int successful = 0; int failed = 0; int t = trap_Milliseconds(); Com_Printf ("------- Weapon Initialization -------/n"); //if ( !LoadWeaponCacheFile (weaponDataTable, numLoadedWeapons, numWeapons) ) { for ( i = 0; i < numFiles; i++ ) { if ( BG_ParseWeaponFile (va ("ext_data/weapons/%s", weaponFile)) ) { successful++; } else { failed++; } weaponFile += strlen (weaponFile) + 1; } //WriteWeaponCacheFile (weaponDataTable, numLoadedWeapons); } /*else { successful = *numLoadedWeapons; }*/ Com_Printf ("Successfully loaded %d weapons, failed to load %d weapons./n", successful, failed); Com_Printf ("Took %d milliseconds./n", trap_Milliseconds() - t); Com_Printf ("-------------------------------------/n"); return (qboolean)(successful > 0);}
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:42,
示例18: CG_DrawFPSstatic void CG_DrawFPS( float x, float y, float w, float h, int font, float textScale ) { char *s; static unsigned short previousTimes[FPS_FRAMES]; static unsigned short index; static int previous, lastupdate; int t, i, fps, total; unsigned short frameTime;#ifdef _XBOX const int xOffset = -40;#else //const int xOffset = 0;#endif vec4_t fpscolor; // don't use serverTime, because that will be drifting to // correct for internet lag changes, timescales, timedemos, etc t = trap_Milliseconds(); frameTime = t - previous; previous = t; if (t - lastupdate > 50) //don't sample faster than this { lastupdate = t; previousTimes[index % FPS_FRAMES] = frameTime; index++; } // average multiple frames together to smooth changes out a bit total = 0; for ( i = 0 ; i < FPS_FRAMES ; i++ ) { total += previousTimes[i]; } if ( !total ) { total = 1; } fps = 1000 * FPS_FRAMES / total; s = va( "%i fps", fps ); if (cg_drawFPS.integer == 2) { Q_strcat (s, 64, va ("/n%.3f mspf", (float)total / (float)FPS_FRAMES)); } if (fps < 10) { VectorSet(fpscolor, 1, 0, 0); } else if (fps > 50) { VectorSet(fpscolor, 0, 1, 0); } else { int hue = (fps - 10) * 3; //(0 to 120) HSL2RGB((float)hue/360, 1, 0.5f, &fpscolor[0], &fpscolor[1], &fpscolor[2]); } fpscolor[3] = 1; //w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; trap_R_Font_DrawString(x, y, s, fpscolor, font | STYLE_DROPSHADOW, -1, textScale); //CG_DrawBigString( 635 - w + xOffset, y + 2, s, 1.0F);}
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:54,
示例19: CG_ShowHelp_Onvoid CG_ShowHelp_On(int *status) { int milli = trap_Milliseconds(); if (*status == SHOW_SHUTDOWN && milli < cg.fadeTime) { cg.fadeTime = 2 * milli + STATS_FADE_TIME - cg.fadeTime; } else if (*status != SHOW_ON) { cg.fadeTime = milli + STATS_FADE_TIME; } *status = SHOW_ON;}
开发者ID:boutetnico,项目名称:ETrun,代码行数:11,
示例20: assert/** SF_RegisterSound*/sfx_t *SF_RegisterSound( const char *name ){ sfx_t *sfx; assert( name ); sfx = S_FindBuffer( name ); S_IssueLoadSfxCmd( s_cmdPipe, sfx->id ); sfx->used = trap_Milliseconds(); sfx->registration_sequence = s_registration_sequence; return sfx;}
开发者ID:MGXRace,项目名称:racesow,代码行数:15,
示例21: qasGenericLineCallbackstatic void qasGenericLineCallback( asIScriptContext *ctx, asDWORD *timeOut ){ // If the time out is reached we abort the script asDWORD curTicks = trap_Milliseconds(); if( *timeOut && ( *timeOut < curTicks ) ) ctx->Abort(); // It would also be possible to only suspend the script, // instead of aborting it. That would allow the application // to resume the execution where it left of at a later // time, by simply calling Execute() again.}
开发者ID:hettoo,项目名称:racesow,代码行数:13,
示例22: CG_DrawInformation/*====================CG_DrawInformationDraw all the status / pacifier stuff during level loading====================*/void CG_DrawInformation( qboolean forcerefresh ) { static int lastcalled = 0; if( lastcalled && (trap_Milliseconds() - lastcalled < 500) ) { return; } lastcalled = trap_Milliseconds(); if( cg.snap ) { return; // we are in the world, no need to draw information } CG_DrawConnectScreen( qfalse, forcerefresh ); // OSP - Server MOTD window/* if(cg.motdWindow == NULL) { CG_createMOTDWindow(); } if(cg.motdWindow != NULL) { CG_windowDraw(); }*/ // OSP*/}
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:30,
示例23: trap_Milliseconds/** S_AllocSource*/src_t *S_AllocSource( int priority, int entNum, int channel ){ int i; int empty = -1; int weakest = -1; int weakest_time = trap_Milliseconds(); int weakest_priority = priority; for( i = 0; i < src_count; i++ ) { if( srclist[i].isLocked ) continue; if( !srclist[i].isActive && ( empty == -1 ) ) empty = i; if( srclist[i].priority < weakest_priority || ( srclist[i].priority == weakest_priority && srclist[i].lastUse < weakest_time ) ) { weakest_priority = srclist[i].priority; weakest_time = srclist[i].lastUse; weakest = i; } // Is it an exact match, and not on channel 0? if( ( srclist[i].entNum == entNum ) && ( srclist[i].channel == channel ) && ( channel != 0 ) ) { source_kill( &srclist[i] ); return &srclist[i]; } } if( empty != -1 ) { return &srclist[empty]; } if( weakest != -1 ) { source_kill( &srclist[weakest] ); return &srclist[weakest]; } return NULL;}
开发者ID:Kaperstone,项目名称:warsow,代码行数:48,
示例24: CG_windowReset// Window stuct "constructor" with some common defaultsvoid CG_windowReset( cg_window_t *w, int fx, int startupLength ) { vec4_t colorGeneralBorder = { 0.5f, 0.35f, 0.25f, 0.5f }; vec4_t colorGeneralFill = { 0.3f, 0.45f, 0.3f, 0.5f }; w->effects = fx; w->fontScaleX = 0.25; w->fontScaleY = 0.25; w->flashPeriod = 1000; w->flashMidpoint = w->flashPeriod / 2; w->id = WID_NONE; w->inuse = qtrue; w->lineCount = 0; w->state = ( fx >= WFX_FADEIN ) ? WSTATE_START : WSTATE_COMPLETE; w->targetTime = ( startupLength > 0 ) ? startupLength : 0; w->time = trap_Milliseconds(); w->x = 0; w->y = 0; memcpy( &w->colorBorder, &colorGeneralBorder, sizeof( vec4_t ) ); memcpy( &w->colorBackground, &colorGeneralFill, sizeof( vec4_t ) );}
开发者ID:GgyuB3,项目名称:Enemy-Territory,代码行数:22,
示例25: CG_windowFree// Free up a window reservationvoid CG_windowFree(cg_window_t *w) { int i, j; cg_windowHandler_t *wh = &cg.winHandler; if (w == NULL) { return; } if (w->effects >= WFX_FADEIN && w->state != WSTATE_OFF && w->inuse == qtrue) { w->state = WSTATE_SHUTDOWN; w->time = trap_Milliseconds(); return; } for (i = 0; i < wh->numActiveWindows; ++i) { if (w == &wh->window[wh->activeWindows[i]]) { for (j = i; j < wh->numActiveWindows; ++j) { if (j + 1 < wh->numActiveWindows) { // Nico, #fixme: GCC 4.8.2 with optimization says // warning: array subscript is above array bounds wh->activeWindows[j] = wh->activeWindows[j + 1]; } } w->id = WID_NONE; w->inuse = qfalse; w->state = WSTATE_OFF; CG_removeStrings(w); wh->numActiveWindows--; break; } }}
开发者ID:ETrun,项目名称:ETrun,代码行数:37,
示例26: CG_windowDraw// Main window-drawing handlervoid CG_windowDraw(void){ int h, x, y, i, j, milli, t_offset, tmp; cg_window_t *w; qboolean fCleanup = qfalse; // Gordon: FIXME, the limbomenu var no longer exists qboolean fAllowMV = (cg.snap != NULL && cg.snap->ps.pm_type != PM_INTERMISSION /*&& !cg.limboMenu*/); vec4_t *bg; vec4_t textColor, borderColor, bgColor; if(cg.winHandler.numActiveWindows == 0) { // Draw these for demoplayback no matter what CG_demoAviFPSDraw(); CG_demoTimescaleDraw(); return; } milli = trap_Milliseconds(); memcpy(textColor, colorWhite, sizeof(vec4_t)); // Mouse cursor position for MV highlighting (offset for cursor pointer position) // Also allow for swingcam toggling if(cg.mvTotalClients > 0 && fAllowMV) { CG_cursorUpdate(); } for(i=0; i<cg.winHandler.numActiveWindows; i++) { w = &cg.winHandler.window[cg.winHandler.activeWindows[i]]; if(!w->inuse || w->state == WSTATE_OFF) { fCleanup = qtrue; continue; } // Multiview rendering has its own handling if(w->effects & WFX_MULTIVIEW) { if(w != cg.mvCurrentMainview && fAllowMV) CG_mvDraw(w); continue; } if(w->effects & WFX_TEXTSIZING) { CG_windowNormalizeOnText(w); w->effects &= ~WFX_TEXTSIZING; } bg = ((w->effects & WFX_FLASH) && (milli % w->flashPeriod) > w->flashMidpoint) ? &w->colorBackground2 : &w->colorBackground; h = w->h; x = w->x; y = w->y; t_offset = milli - w->time; textColor[3] = 1.0f; memcpy(&borderColor, w->colorBorder, sizeof(vec4_t)); memcpy(&bgColor, bg, sizeof(vec4_t)); // TODO: Add in support for ALL scrolling effects if(w->state == WSTATE_START) { tmp = w->targetTime - t_offset; if(w->effects & WFX_SCROLLUP) { if(tmp > 0) { y += (480 - y) * tmp / w->targetTime;//(100 * tmp / w->targetTime) / 100; } else { w->state = WSTATE_COMPLETE; } w->curY = y; } if(w->effects & WFX_FADEIN) { if(tmp > 0) textColor[3] = (float)((float)t_offset / (float)w->targetTime); else w->state = WSTATE_COMPLETE; } } else if(w->state == WSTATE_SHUTDOWN) { tmp = w->targetTime - t_offset; if(w->effects & WFX_SCROLLUP) { if(tmp > 0) y = w->curY + (480 - w->y) * t_offset / w->targetTime;//(100 * t_offset / w->targetTime) / 100; if(tmp < 0 || y >= 480) { w->state = WSTATE_OFF; fCleanup = qtrue; continue; } } if(w->effects & WFX_FADEIN) { if(tmp > 0) { textColor[3] -= (float)((float)t_offset / (float)w->targetTime); } else { textColor[3] = 0.0f; w->state = WSTATE_OFF; } } } borderColor[3] *= textColor[3]; bgColor[3] *= textColor[3]; CG_FillRect(x, y, w->w, h, bgColor); CG_DrawRect(x, y, w->w, h, 1, borderColor); x += 5;//.........这里部分代码省略.........
开发者ID:GenaSG,项目名称:ET,代码行数:101,
示例27: CG_DemoClick// Demo playback key catcher supportvoid CG_DemoClick(int key, qboolean down) { int milli = trap_Milliseconds(); // Avoid active console keypress issues if (!down && !cgs.fKeyPressed[key]) { return; } cgs.fKeyPressed[key] = down; switch (key) { case K_ESCAPE: CG_ShowHelp_Off(&cg.demohelpWindow); CG_keyOff_f(); return; case K_TAB: if (down) { CG_ScoresDown_f(); } else { CG_ScoresUp_f(); } return; // Help info case K_BACKSPACE: if (!down) { if (cg.demohelpWindow != SHOW_ON) { CG_ShowHelp_On(&cg.demohelpWindow); } else { CG_ShowHelp_Off(&cg.demohelpWindow); } } return; // Screenshot keys case K_F11: if (!down) { trap_SendConsoleCommand(va("screenshot%s/n", ((cg_useScreenshotJPEG.integer) ? "JPEG" : ""))); } return; case K_F12: if (!down) { CG_autoScreenShot_f(); } return; // Window controls case K_SHIFT: case K_CTRL: case K_MOUSE4: cgs.fResize = down; return; case K_MOUSE1: cgs.fSelect = down; return; case K_MOUSE2: case K_INS: case K_KP_PGUP: case K_DEL: case K_KP_PGDN: case K_MOUSE3: return; // Third-person controls case K_ENTER: if (!down) { trap_Cvar_Set("cg_thirdperson", ((cg_thirdPerson.integer == 0) ? "1" : "0")); } return; case K_UPARROW: if (milli > cgs.thirdpersonUpdate) { float range = cg_thirdPersonRange.value; cgs.thirdpersonUpdate = milli + DEMO_THIRDPERSONUPDATE; range -= ((range >= 4 * DEMO_RANGEDELTA) ? DEMO_RANGEDELTA : (range - DEMO_RANGEDELTA)); trap_Cvar_Set("cg_thirdPersonRange", va("%f", range)); } return; case K_DOWNARROW: if (milli > cgs.thirdpersonUpdate) { float range = cg_thirdPersonRange.value; cgs.thirdpersonUpdate = milli + DEMO_THIRDPERSONUPDATE; range += ((range >= 120 * DEMO_RANGEDELTA) ? 0 : DEMO_RANGEDELTA); trap_Cvar_Set("cg_thirdPersonRange", va("%f", range)); } return; case K_RIGHTARROW: if (milli > cgs.thirdpersonUpdate) { float angle = cg_thirdPersonAngle.value - DEMO_ANGLEDELTA; cgs.thirdpersonUpdate = milli + DEMO_THIRDPERSONUPDATE; if (angle < 0) { angle += 360.0f; } trap_Cvar_Set("cg_thirdPersonAngle", va("%f", angle)); } return;//.........这里部分代码省略.........
开发者ID:boutetnico,项目名称:ETrun,代码行数:101,
示例28: G_RunFrame/*================G_RunFrameAdvances the non-player objects in the world================*/void G_RunFrame( int levelTime ) { int i; gentity_t *ent; int msec;int start, end; // if we are waiting for the level to restart, do nothing if ( level.restarted ) { return; } level.framenum++; level.previousTime = level.time; level.time = levelTime; msec = level.time - level.previousTime; // get any cvar changes G_UpdateCvars(); // // go through all allocated objects // start = trap_Milliseconds(); ent = &g_entities[0]; for (i=0 ; i<level.num_entities ; i++, ent++) { if ( !ent->inuse ) { continue; } // clear events that are too old if ( level.time - ent->eventTime > EVENT_VALID_MSEC ) { if ( ent->s.event ) { ent->s.event = 0; // &= EV_EVENT_BITS; if ( ent->client ) { ent->client->ps.externalEvent = 0; // predicted events should never be set to zero //ent->client->ps.events[0] = 0; //ent->client->ps.events[1] = 0; } } if ( ent->freeAfterEvent ) { // tempEntities or dropped items completely go away after their event G_FreeEntity( ent ); continue; } else if ( ent->unlinkAfterEvent ) { // items that will respawn will hide themselves after their pickup event ent->unlinkAfterEvent = qfalse; trap_UnlinkEntity( ent ); } } // temporary entities don't think if ( ent->freeAfterEvent ) { continue; } if ( !ent->r.linked && ent->neverFree ) { continue; } if ( ent->s.eType == ET_MISSILE ) { G_RunMissile( ent ); continue; } if ( ent->s.eType == ET_ITEM || ent->physicsObject ) { G_RunItem( ent ); continue; } if ( ent->s.eType == ET_MOVER ) { G_RunMover( ent ); continue; } if ( i < MAX_CLIENTS ) { G_RunClient( ent ); continue; } G_RunThink( ent ); }end = trap_Milliseconds();start = trap_Milliseconds(); // perform final fixups on the players ent = &g_entities[0]; for (i=0 ; i < level.maxclients ; i++, ent++ ) { if ( ent->inuse ) { ClientEndFrame( ent ); } }end = trap_Milliseconds();//.........这里部分代码省略.........
开发者ID:he110world,项目名称:quake3-ios,代码行数:101,
示例29: CG_DemoHelpDrawvoid CG_DemoHelpDraw() { const char *help[] = { "^nTAB ^mscores", "^nF1-F5 ^mavidemo record", "^nF11-F12 ^mscreenshot", NULL, "^nKP_DOWN ^mslow down (--)", "^nKP_LEFT ^mslow down (-)", "^nKP_UP ^mspeed up (++)", "^nKP_RIGHT ^mspeed up (+)", "^nSPACE ^mnormal speed", NULL, "^nENTER ^mExternal view", "^nLFT/RGHT ^mChange angle", "^nUP/DOWN ^mMove in/out" }; int i, x, y = 480, w, h; vec4_t bgColor = COLOR_BG; // window vec4_t borderColor = COLOR_BORDER; // window vec4_t bgColorTitle = COLOR_BG_TITLE; // titlebar vec4_t borderColorTitle = COLOR_BORDER_TITLE; // titlebar // Main header int hStyle = ITEM_TEXTSTYLE_SHADOWED; float hScale = 0.16f; float hScaleY = 0.21f; fontInfo_t *hFont = FONT_HEADER; vec4_t hdrColor2 = COLOR_HDR2; // text // Text settings int tStyle = ITEM_TEXTSTYLE_SHADOWED; int tSpacing = 9; // Should derive from CG_Text_Height_Ext float tScale = 0.19f; fontInfo_t *tFont = FONT_TEXT; vec4_t tColor = COLOR_TEXT; // text float diff = cg.fadeTime - trap_Milliseconds(); if (cg.demohelpWindow == SHOW_OFF) { return; } // FIXME: Should compute this beforehand w = DH_W; x = 640 + DH_X - w; h = 2 + tSpacing + 2 + // Header 2 + 1 + tSpacing * (2 + (sizeof (help)) / sizeof (char *)) + 2; // Fade-in effects if (diff > 0.0f) { float scale = diff / STATS_FADE_TIME; if (cg.demohelpWindow == SHOW_ON) { scale = 1.0f - scale; } bgColor[3] *= scale; bgColorTitle[3] *= scale; borderColor[3] *= scale; borderColorTitle[3] *= scale; hdrColor2[3] *= scale; tColor[3] *= scale; y += (DH_Y - h) * scale; } else if (cg.demohelpWindow == SHOW_SHUTDOWN) { cg.demohelpWindow = SHOW_OFF; return; } else { y += DH_Y - h; } CG_DrawRect(x, y, w, h, 1, borderColor); CG_FillRect(x, y, w, h, bgColor); // Header CG_FillRect(x, y, w, tSpacing + 4, bgColorTitle); CG_DrawRect(x, y, w, tSpacing + 4, 1, borderColorTitle); x += 4; y += 1; y += tSpacing; CG_Text_Paint_Ext(x, y, hScale, hScaleY, hdrColor2, "DEMO CONTROLS", 0.0f, 0, hStyle, hFont); y += 3; // Control info for (i = 0; i < (int)(sizeof (help) / sizeof (char *)); ++i) { y += tSpacing; if (help[i] != NULL) { CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, (char *)help[i], 0.0f, 0, tStyle, tFont); } } y += tSpacing * 2; CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, "^nBACKSPACE ^mhelp on/off", 0.0f, 0, tStyle, tFont);//.........这里部分代码省略.........
开发者ID:boutetnico,项目名称:ETrun,代码行数:101,
注:本文中的trap_Milliseconds函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ trap_PointContents函数代码示例 C++ trap_LinkEntity函数代码示例 |