这篇教程C++ ALERT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ALERT函数的典型用法代码示例。如果您正苦于以下问题:C++ ALERT函数的具体用法?C++ ALERT怎么用?C++ ALERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ALERT函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SERVER_COMMANDCGameRules *InstallGameRules( void ){ SERVER_COMMAND( "exec game.rc/n" ); g_engfuncs.pfnServerExecute(); ALERT( at_aiconsole, "InstallGameRules/n" ); if ( !gpGlobals->deathmatch ) { // generic half-life g_teamplay = 0; return new CHalfLifeRules; } else { if( CVAR_GET_FLOAT( "mp_teamplay" ) > 0 ) { // teamplay g_teamplay = 1; return new CHalfLifeTeamplay; } if ((int)gpGlobals->deathmatch == 1) { // vanilla deathmatch g_teamplay = 0; return new CHalfLifeMultiplay; } else { // vanilla deathmatch?? g_teamplay = 0; return new CHalfLifeMultiplay; } }}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:36,
示例2: ALERT// sets the round state// ben notes : bSkipAutoRoundThink will avoid calling the round think function// ben notes : after updating the statusvoid CBaseRoundRules::SetRoundState(ROUND_STATE iRoundState, bool bSkipAutoRoundThink){ // check validity of what we have been sent if((iRoundState < ROUND_NOTSTARTED) || (iRoundState > ROUND_NOPLAYERS)) { // - report the error ALERT(at_console, "Bad Round State being set - (%i)/n", (int)iRoundState); UTIL_LogPrintf(ROUND_LOGGING, "World triggered /"Bad Round State/" (round_state /"%i/") (old_round_state /"%i/")/n", (int)iRoundState, (int)m_iRoundState); // - give the round state a dummy value to keep it going iRoundState = ROUND_WAITING_FOR_PLAYERS; } // - log the change UTIL_LogPrintf(ALL_LOGGING, "World triggered /"Round State Change/" (round_state /"%i/") (old_round_state /"%i/")/n", (int)iRoundState, (int)m_iRoundState); // - set the round state m_iRoundState = iRoundState; // - call round think to update the round progress. // ben notes : after set round state is called we should leave the round think // ben notes : function or wierd bugs could creep in if(GetRoundState() != ROUND_NOPLAYERS && bSkipAutoRoundThink == false) this->RoundThink();}
开发者ID:BackupTheBerlios,项目名称:battlegrounds-svn,代码行数:27,
示例3: Spawn//=========================================================// ********** DeadGenericMonster SPAWN **********//=========================================================void CDeadGenericMonster :: Spawn( void ){ Precache(); SET_MODEL(ENT(pev), STRING(pev->model)); pev->effects = 0; pev->yaw_speed = 8; //LRC -- what? pev->sequence = 0; if (pev->netname) { pev->sequence = LookupSequence( STRING(pev->netname) ); if (pev->sequence == -1) { ALERT ( at_debug, "Invalid sequence name /"%s/" in monster_generic_dead/n", STRING(pev->netname) ); } } else { pev->sequence = LookupActivity( pev->frags );// if (pev->sequence == -1)// {// ALERT ( at_error, "monster_generic_dead - specify a sequence name or choose a different death type: model /"%s/" has no available death sequences./n", STRING(pev->model) );// } //...and if that doesn't work, forget it. } // Corpses have less health pev->health = 8; MonsterInitDead(); ResetSequenceInfo( ); pev->frame = 255; // pose at the _end_ of its death sequence.}
开发者ID:mittorn,项目名称:SoHL-1.2,代码行数:39,
示例4: ALERTvoid CGrappleHook::Killed(entvars_t *pev, int gib){ ALERT( at_console, "^2HLU -> ^3weapon_grapple ^2-> Tongue was killed./n"); // Fograin92: Clear player myowner->pev->movetype = MOVETYPE_WALK; //Re-apply gravity myowner->m_afPhysicsFlags &= ~PFLAG_ON_GRAPPLE; //Remove "on grapple" flag myowner->m_iGrappleExists = 0; myowner->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0; // Fograin92: Clear monster if( (m_iHitMonster == 2) && (myHitMonster->IsAlive()) ) myHitMonster->pev->movetype = MOVETYPE_STEP; // Re-apply gravity to the pulled monster, if it's alive // Fograin92: Clear tongue leftovers bPullBack = false; UTIL_Remove( m_pTongue ); m_pTongue = NULL; m_iHitMonster = 0; SetThink(NULL); SetTouch(NULL); SUB_Remove( ); }
开发者ID:Fograin,项目名称:hl-subsmod-ex,代码行数:24,
示例5: R_AllocateCinematicTextureint R_AllocateCinematicTexture( unsigned int txFlags ){ int i = tr.num_cin_used; if( i >= MAX_MOVIE_TEXTURES ) { ALERT( at_error, "R_AllocateCinematicTexture: cine textures limit exceeded!/n" ); return 0; // disable } tr.num_cin_used++; if( !tr.cinTextures[i] ) { char txName[16]; Q_snprintf( txName, sizeof( txName ), "*cinematic%i", i ); // create new cinematic texture // NOTE: dimension of texture is no matter because CIN_UPLOAD_FRAME will be rescale texture tr.cinTextures[i] = CREATE_TEXTURE( txName, 256, 256, NULL, txFlags ); } return (i+1);}
开发者ID:FWGS,项目名称:XashXT,代码行数:24,
示例6: eeReadAllvoid eeReadAll(){ fill_file_index() ; if (!eeLoadGeneral() ) { generalDefault(); modelDefault(0); ALERT(STR_EEPROMWARN, STR_BADEEPROMDATA, AU_BAD_EEPROM); MESSAGE(STR_EEPROMWARN, STR_EEPROMFORMATTING, NULL, AU_EEPROM_FORMATTING); /* we remove all models */ for (uint32_t i=0; i<MAX_MODELS; i++) eeDeleteModel(i); eeDirty(EE_GENERAL); eeDirty(EE_MODEL); } else { eeLoadModelHeaders() ; } // TODO common! stickMode = g_eeGeneral.stickMode;#if defined(CPUARM) for (uint8_t i=0; languagePacks[i]!=NULL; i++) { if (!strncmp(g_eeGeneral.ttsLanguage, languagePacks[i]->id, 2)) { currentLanguagePackIdx = i; currentLanguagePack = languagePacks[i]; } }#endif}
开发者ID:CoyotteDundee,项目名称:opentx,代码行数:36,
示例7: DispatchSavevoid DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData ){ CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); if( pEntity && pSaveData ) { // ALERT( at_console, "DispatchSave( %s, %i )/n", STRING( pent->v.classname ), pent->serialnumber ); ENTITYTABLE *pTable = &pSaveData->pTable[ pSaveData->currentIndex ]; if( pTable->pent != pent ) ALERT( at_error, "ENTITY TABLE OR INDEX IS WRONG!!!!/n" ); if( pEntity->ObjectCaps() & FCAP_DONT_SAVE ) return; // These don't use ltime & nextthink as times really, but we'll fudge around it. if( pEntity->pev->movetype == MOVETYPE_PUSH ) { float delta = gpGlobals->time - pEntity->pev->ltime; pEntity->pev->ltime += delta; pEntity->pev->nextthink += delta; pEntity->m_fPevNextThink = pEntity->pev->nextthink; pEntity->m_fNextThink += delta; } if( gpGlobals->changelevel ) pEntity->ClearPointers(); pTable->location = pSaveData->size; // Remember entity position for file I/O pTable->classname = pEntity->pev->classname; // Remember entity class for respawn CSave saveHelper( pSaveData ); pEntity->Save( saveHelper ); pTable->size = pSaveData->size - pTable->location;// Size of entity block is data size written to block }}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:36,
示例8: ioctl_unload_vmmstatic longioctl_unload_vmm(void){ int i; int64_t ret; long status = BF_IOCTL_SUCCESS; ret = common_unload_vmm(); if (ret != BF_SUCCESS) { ALERT("IOCTL_UNLOAD_VMM: failed to unload vmm: %lld/n", ret); status = BF_IOCTL_FAILURE; } for (i = 0; i < g_num_files; i++) platform_free(files[i], files_sizes[i]); g_num_files = 0; if (status == BF_IOCTL_SUCCESS) DEBUG("IOCTL_UNLOAD_VMM: succeeded/n"); return status;}
开发者ID:kallolpar,项目名称:hypervisor,代码行数:24,
示例9: FIND_ENTITY_BY_TARGETNAMEvoid CBigMomma::NodeStart( int iszNextNode ){ pev->netname = iszNextNode; CBaseEntity *pTarget = NULL; if ( pev->netname ) { edict_t *pentTarget = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(pev->netname) ); if ( !FNullEnt(pentTarget) ) pTarget = Instance( pentTarget ); } if ( !pTarget ) { ALERT( at_aiconsole, "BM: Finished the path!!/n" ); Remember( bits_MEMORY_PATH_FINISHED ); return; } Remember( bits_MEMORY_ON_PATH ); m_hTargetEnt = pTarget;}
开发者ID:FaucetDC,项目名称:HLDC_SDK,代码行数:24,
示例10: CallForHelpvoid CISlave :: CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ){ ALERT( at_aiconsole, "help " ); // skip ones not on my netname if ( FStringNull( pev->netname )) return; CBaseEntity *pEntity = NULL; while ((pEntity = UTIL_FindEntityByString( pEntity, "netname", STRING( pev->netname ))) != NULL) { float d = (pev->origin - pEntity->pev->origin).Length(); if (d < flDist) { CBaseMonster *pMonster = pEntity->MyMonsterPointer( ); if (pMonster) { pMonster->m_afMemory |= bits_MEMORY_PROVOKED; pMonster->PushEnemy( hEnemy, vecLocation ); } } }}
开发者ID:JoelTroch,项目名称:am_src_30jan2011,代码行数:24,
示例11: IAllocSound//=========================================================// IAllocSound - moves a sound from the Free list to the // Active list returns the index of the alloc'd sound//=========================================================int CSoundEnt :: IAllocSound( void ){ int iNewSound; if ( m_iFreeSound == SOUNDLIST_EMPTY ) { // no free sound! ALERT ( at_console, "Free Sound List is full!/n" ); return SOUNDLIST_EMPTY; } // there is at least one sound available, so move it to the // Active sound list, and return its SoundPool index. iNewSound = m_iFreeSound;// copy the index of the next free sound m_iFreeSound = m_SoundPool[ m_iFreeSound ].m_iNext;// move the index down into the free list. m_SoundPool[ iNewSound ].m_iNext = m_iActiveSound;// point the new sound at the top of the active list. m_iActiveSound = iNewSound;// now make the new sound the top of the active list. You're done. return iNewSound;}
开发者ID:HoLyCoWzOrZ,项目名称:sing-engine,代码行数:28,
示例12: Nearest// Assumes this is ALWAYS enabledCPathTrack *CPathTrack :: Nearest( Vector origin ){ int deadCount; float minDist, dist; Vector delta; CPathTrack *ppath, *pnearest; delta = origin - pev->origin; delta.z = 0; minDist = delta.Length(); pnearest = this; ppath = GetNext(); // Hey, I could use the old 2 racing pointers solution to this, but I'm lazy :) deadCount = 0; while ( ppath && ppath != this ) { deadCount++; if ( deadCount > 9999 ) { ALERT( at_error, "Bad sequence of path_tracks from %s", STRING(pev->targetname) ); return NULL; } delta = origin - ppath->pev->origin; delta.z = 0; dist = delta.Length(); if ( dist < minDist ) { minDist = dist; pnearest = ppath; } ppath = ppath->GetNext(); } return pnearest;}
开发者ID:6779660,项目名称:halflife,代码行数:37,
示例13: snd_initint snd_init(void){ char info_buf[256]; PaError p_err; if((p_err = Pa_Initialize()) != paNoError) { snprintf(info_buf, sizeof(info_buf), _("PortAudio init failed:/n%s/n"), Pa_GetErrorText(p_err)); ALERT(info_buf); return 1; } srconv_stream.data_in = (float*)malloc(pa_frames*2 * sizeof(float)); srconv_stream.data_out = (float*)malloc(pa_frames*2 * 10 * sizeof(float)); srconv_record.data_in = (float*)malloc(pa_frames*2 * sizeof(float)); srconv_record.data_out = (float*)malloc(pa_frames*2 * 10 * sizeof(float)); reconnect = 0; buf_index = 0; return 0;}
开发者ID:melchor629,项目名称:butt,代码行数:24,
示例14: CHalfLifeMultiplayCHalfLifeMultiplay :: CHalfLifeMultiplay(){ g_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients); RefreshSkillData(); m_flIntermissionEndTime = 0; g_flIntermissionStartTime = 0; // 11/8/98 // Modified by YWB: Server .cfg file is now a cvar, so that // server ops can run multiple game servers, with different server .cfg files, // from a single installed directory. // Mapcyclefile is already a cvar. // 3/31/99 // Added lservercfg file cvar, since listen and dedicated servers should not // share a single config file. (sjb) if ( IS_DEDICATED_SERVER() ) { // this code has been moved into engine, to only run server.cfg once } else { // listen server char *lservercfgfile = (char *)CVAR_GET_STRING( "lservercfgfile" ); if ( lservercfgfile && lservercfgfile[0] ) { char szCommand[256]; ALERT( at_console, "Executing listen server config file/n" ); sprintf( szCommand, "exec %s/n", lservercfgfile ); SERVER_COMMAND( szCommand ); } }}
开发者ID:Hammermaps-DEV,项目名称:SOHL-V1.0-Refresh,代码行数:36,
示例15: TakeDamageint CFuncCollideWall :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ){ ALERT ( at_notice, "TakeDamage()/n"); TraceResult trace = UTIL_GetGlobalTrace( );//== 1) //metal//== 5) //wood//== 5) //water//== -1/0) //not defined (default concrete) float flVolume = RANDOM_FLOAT ( 0.7 , 1.0 );//random volume range BOOL b_CanMakeParticles = TRUE; if ( CVAR_GET_FLOAT( "r_paintball" ) == 0 ) if ( CVAR_GET_FLOAT( "cl_wallpuff" ) >= 1 ) { if (pev->frags == 1) //metal { UTIL_Ricochet( trace.vecEndPos, 0.5 ); switch ( RANDOM_LONG(0,2) ) { case 0: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/metal1.wav", flVolume, ATTN_NORM, 0, 100); break; case 1: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/metal2.wav", flVolume, ATTN_NORM, 0, 100); break; case 2: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/metal3.wav", flVolume, ATTN_NORM, 0, 100); break; } if (RANDOM_LONG( 0, 99 ) < 40) UTIL_WhiteSparks( trace.vecEndPos, trace.vecPlaneNormal, 0, 5, 500, 500 );//chispas UTIL_WhiteSparks( trace.vecEndPos, trace.vecPlaneNormal, 9, 5, 5, 100 );//puntos UTIL_WhiteSparks( trace.vecEndPos, trace.vecPlaneNormal, 0, 5, 500, 20 );//chispas b_CanMakeParticles = FALSE; } if (pev->frags == 5) //wood { switch ( RANDOM_LONG(0,2) ) { case 0: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/wood1.wav", flVolume, ATTN_NORM, 0, 100); break; case 1: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/wood2.wav", flVolume, ATTN_NORM, 0, 100); break; case 2: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/wood3.wav", flVolume, ATTN_NORM, 0, 100); break; } } else if (pev->frags == 6) //water { switch ( RANDOM_LONG(0,2) ) { case 0: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/water1.wav", flVolume, ATTN_NORM, 0, 100); break; case 1: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/water2.wav", flVolume, ATTN_NORM, 0, 100); break; case 2: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/water3.wav", flVolume, ATTN_NORM, 0, 100); break; } } else if (pev->frags == 7) //gas canister { switch ( RANDOM_LONG(0,1) ) { case 0: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/gascan1.wav", flVolume, ATTN_NORM, 0, 100); break; case 1: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/gascan2.wav", flVolume, ATTN_NORM, 0, 100); break; } } else { switch ( RANDOM_LONG(0,2) ) { case 0: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/concrete1.wav", flVolume, ATTN_NORM, 0, 100); break; case 1: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/concrete2.wav", flVolume, ATTN_NORM, 0, 100); break; case 2: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/concrete3.wav", flVolume, ATTN_NORM, 0, 100); break; } } if (b_CanMakeParticles) { if ( CVAR_GET_FLOAT("r_particles" ) != 0 ) { MESSAGE_BEGIN(MSG_ALL, gmsgParticles); WRITE_SHORT(0); WRITE_BYTE(0); WRITE_COORD( trace.vecEndPos.x ); WRITE_COORD( trace.vecEndPos.y ); WRITE_COORD( trace.vecEndPos.z ); WRITE_COORD( 0 ); WRITE_COORD( 0 ); WRITE_COORD( 0 ); if (pev->frags == 5) //wood WRITE_SHORT(iDefaultHitWood1); else if (pev->frags == 6) //water WRITE_SHORT(iDefaultWaterSplash); else if (pev->frags == 7) //gas canister WRITE_SHORT(iDefaultGasCanister); else WRITE_SHORT(iDefaultWallSmoke); MESSAGE_END(); } } }//eo cvar check return 1;}
开发者ID:JoelTroch,项目名称:am_src_rebirth,代码行数:100,
示例16: ALERTvoid CCyclerSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ){ m_animate = !m_animate; ALERT( at_console, "Sprite: %s/n", STRING(pev->model) );}
开发者ID:Hammermaps-DEV,项目名称:SOHL-V1.0-Refresh,代码行数:5,
示例17: ChangeLevel/*==============ChangeLevelServer is changing to a new level, check mapcycle.txt for map name and setup info==============*/void CHalfLifeMultiplay :: ChangeLevel( void ){ static char szPreviousMapCycleFile[ 256 ]; static mapcycle_t mapcycle; char szNextMap[32]; char szFirstMapInList[32]; char szCommands[ 1500 ]; char szRules[ 1500 ]; int minplayers = 0, maxplayers = 0; strcpy( szFirstMapInList, "hldm1" ); // the absolute default level is hldm1 int curplayers; BOOL do_cycle = TRUE; // find the map to change to char *mapcfile = (char*)CVAR_GET_STRING( "mapcyclefile" ); ASSERT( mapcfile != NULL ); szCommands[ 0 ] = '/0'; szRules[ 0 ] = '/0'; curplayers = CountPlayers(); // Has the map cycle filename changed? if ( stricmp( mapcfile, szPreviousMapCycleFile ) ) { strcpy( szPreviousMapCycleFile, mapcfile ); DestroyMapCycle( &mapcycle ); if ( !ReloadMapCycleFile( mapcfile, &mapcycle ) || ( !mapcycle.items ) ) { ALERT( at_console, "Unable to load map cycle file %s/n", mapcfile ); do_cycle = FALSE; } } if ( do_cycle && mapcycle.items ) { BOOL keeplooking = FALSE; BOOL found = FALSE; mapcycle_item_s *item; // Assume current map strcpy( szNextMap, STRING(gpGlobals->mapname) ); strcpy( szFirstMapInList, STRING(gpGlobals->mapname) ); // Traverse list for ( item = mapcycle.next_item; item->next != mapcycle.next_item; item = item->next ) { keeplooking = FALSE; ASSERT( item != NULL ); if ( item->minplayers != 0 ) { if ( curplayers >= item->minplayers ) { found = TRUE; minplayers = item->minplayers; } else { keeplooking = TRUE; } } if ( item->maxplayers != 0 ) { if ( curplayers <= item->maxplayers ) { found = TRUE; maxplayers = item->maxplayers; } else { keeplooking = TRUE; } } if ( keeplooking ) continue; found = TRUE; break; } if ( !found ) { item = mapcycle.next_item; } //.........这里部分代码省略.........
开发者ID:Skumek,项目名称:hlsdk,代码行数:101,
示例18: ReloadMapCycleFile/*==============ReloadMapCycleFileParses mapcycle.txt file into mapcycle_t structure==============*/int ReloadMapCycleFile( char *filename, mapcycle_t *cycle ){ char szBuffer[ MAX_RULE_BUFFER ]; char szMap[ 32 ]; int length; char *pFileList; char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( filename, &length ); int hasbuffer; mapcycle_item_s *item, *newlist = NULL, *next; if ( pFileList && length ) { // the first map name in the file becomes the default while ( 1 ) { hasbuffer = 0; memset( szBuffer, 0, MAX_RULE_BUFFER ); pFileList = COM_Parse( pFileList ); if ( strlen( com_token ) <= 0 ) break; strcpy( szMap, com_token ); // Any more tokens on this line? if ( COM_TokenWaiting( pFileList ) ) { pFileList = COM_Parse( pFileList ); if ( strlen( com_token ) > 0 ) { hasbuffer = 1; strcpy( szBuffer, com_token ); } } // Check map if ( IS_MAP_VALID( szMap ) ) { // Create entry char *s; item = new mapcycle_item_s; strcpy( item->mapname, szMap ); item->minplayers = 0; item->maxplayers = 0; memset( item->rulebuffer, 0, MAX_RULE_BUFFER ); if ( hasbuffer ) { s = g_engfuncs.pfnInfoKeyValue( szBuffer, "minplayers" ); if ( s && s[0] ) { item->minplayers = atoi( s ); item->minplayers = max( item->minplayers, 0 ); item->minplayers = min( item->minplayers, gpGlobals->maxClients ); } s = g_engfuncs.pfnInfoKeyValue( szBuffer, "maxplayers" ); if ( s && s[0] ) { item->maxplayers = atoi( s ); item->maxplayers = max( item->maxplayers, 0 ); item->maxplayers = min( item->maxplayers, gpGlobals->maxClients ); } // Remove keys // g_engfuncs.pfnInfo_RemoveKey( szBuffer, "minplayers" ); g_engfuncs.pfnInfo_RemoveKey( szBuffer, "maxplayers" ); strcpy( item->rulebuffer, szBuffer ); } item->next = cycle->items; cycle->items = item; } else { ALERT( at_console, "Skipping %s from mapcycle, not a valid map/n", szMap ); } } FREE_FILE( aFileList ); } // Fixup circular list pointer item = cycle->items;//.........这里部分代码省略.........
开发者ID:Skumek,项目名称:hlsdk,代码行数:101,
示例19: ALERT// make the entity carry out the scripted sequence instructions, but without// destroying the monster's state.void CCineAI::PossessEntity(void){ Schedule_t *pNewSchedule; CBaseEntity * pEntity = m_hTargetEnt; CBaseMonster *pTarget = NULL; if(pEntity) pTarget = pEntity->MyMonsterPointer(); if(pTarget) { if(!pTarget->CanPlaySequence(FCanOverrideState(), SS_INTERRUPT_AI)) { ALERT(at_aiconsole, "(AI)Can't possess entity %s/n", STRING(pTarget->pev->classname)); return; } pTarget->m_pGoalEnt = this; pTarget->m_pCine = this; pTarget->m_hTargetEnt = this; m_saved_movetype = pTarget->pev->movetype; m_saved_solid = pTarget->pev->solid; m_saved_effects = pTarget->pev->effects; pTarget->pev->effects |= pev->effects; switch(m_fMoveTo) { case 0: case 5: pTarget->m_scriptState = SCRIPT_WAIT; break; case 1: pTarget->m_scriptState = SCRIPT_WALK_TO_MARK; break; case 2: pTarget->m_scriptState = SCRIPT_RUN_TO_MARK; break; case 4: // zap the monster instantly to the site of the script entity. UTIL_SetOrigin(pTarget->pev, pev->origin); pTarget->pev->ideal_yaw = pev->angles.y; pTarget->pev->avelocity = Vector(0, 0, 0); pTarget->pev->velocity = Vector(0, 0, 0); pTarget->pev->effects |= EF_NOINTERP; pTarget->pev->angles.y = pev->angles.y; pTarget->m_scriptState = SCRIPT_WAIT; m_startTime = gpGlobals->time + 1E6; // UNDONE: Add a flag to do this so people can fixup physics after teleporting monsters pTarget->pev->flags &= ~FL_ONGROUND; break; default: ALERT(at_aiconsole, "aiscript: invalid Move To Position value!"); break; } ALERT(at_aiconsole, "/"%s/" found and used/n", STRING(pTarget->pev->targetname)); pTarget->m_IdealMonsterState = MONSTERSTATE_SCRIPT; /* if (m_iszIdle) { StartSequence( pTarget, m_iszIdle, FALSE ); if (FStrEq( STRING(m_iszIdle), STRING(m_iszPlay))) { pTarget->pev->framerate = 0; } }*/ // Already in a scripted state? if(pTarget->m_MonsterState == MONSTERSTATE_SCRIPT) { pNewSchedule = pTarget->GetScheduleOfType(SCHED_AISCRIPT); pTarget->ChangeSchedule(pNewSchedule); } }}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:83,
示例20: AvHGetDefaultOrderType// Used for context sensitive mouse and for processing right-click// Must be shared, uses prediction code// Fill in target index or target point, depending on type of order decided uponAvHOrderType AvHGetDefaultOrderType(AvHTeamNumber inTeam, const vec3_t& inOrigin, const vec3_t& inNormRay, int& outTargetIndex, vec3_t& outTargetPoint, AvHUser3& outUser3, AvHOrderTargetType& outTargetType){ vec3_t theTraceStart; vec3_t theTraceEnd; AvHOrderType theOrderType = ORDERTYPE_UNDEFINED;// // Look for a player order// if(!AvHOrderTracePlayers(inTeam, inOrigin, inNormRay, theOrderType, outTargetIndex))// {// // If couldn't find one, create a non-player order if possible// //AvHOrderTraceNonPlayers(inTeam, inOrigin, inNormRay, theOrderType, outTargetIndex, outTargetPoint);// } // Offset a little so we don't hit the commander VectorMA(inOrigin, kSelectionStartRange, inNormRay, theTraceStart); VectorMA(inOrigin, kSelectionEndRange, inNormRay, theTraceEnd); int theFoundIndex = -1; vec3_t theFoundLocation; AvHTeamNumber theTeamOfThingHit; bool thePlayerHit = false; int theUserThree = 0; int theUserFour = 0; if(AvHSHUTraceTangible(theTraceStart, theTraceEnd, theFoundIndex, theFoundLocation, theTeamOfThingHit, thePlayerHit, theUserThree, theUserFour)) { float theHealthPercentage=100.0f; float theArmorPercentage=100.0f; bool theSighted=false;#ifdef AVH_SERVER CBaseEntity *theEntity=AvHSUGetEntityFromIndex(theFoundIndex); if ( theEntity ) { theHealthPercentage=theEntity->pev->health/theEntity->pev->max_health; } else { ALERT(at_console, "Not a buildable/n"); } theArmorPercentage = theEntity->pev->armorvalue/AvHPlayerUpgrade::GetMaxArmorLevel(theEntity->pev->iuser4, (AvHUser3)theEntity->pev->iuser3); theSighted=GetHasUpgrade(theEntity->pev->iuser4, MASK_VIS_SIGHTED);#endif // Did we hit an enemy? If so, issue an attack order on him, then we're done, it's highest priority if(thePlayerHit ) { // Did we hit a player on our team? If so check for welding, if not guard if((theTeamOfThingHit == inTeam ) && (theTeamOfThingHit != TEAM_IND) ) { theOrderType = ORDERTYPET_GUARD; if ( theArmorPercentage < 0.90f ) { theOrderType = ORDERTYPET_WELD; outTargetType = ORDERTARGETTYPE_TARGET; } outTargetIndex = theFoundIndex; outUser3 = (AvHUser3)theUserThree; } } // Something to pick up? if(!thePlayerHit ) {// if ( ( theTeamOfThingHit ) != inTeam && (theTeamOfThingHit != TEAM_IND) && theSighted )// {// // Use it's center for the height// VectorCopy(theFoundLocation, outTargetPoint);// theOrderType = ORDERTYPET_ATTACK;// outTargetIndex = theFoundIndex;// outUser3 = (AvHUser3)theUserThree;// outTargetType = ORDERTARGETTYPE_LOCATION;// }// else if ( theUserThree == AVH_USER3_MARINEITEM) { // Use it's center for the height VectorCopy(theFoundLocation, outTargetPoint); outTargetIndex = theFoundIndex; outUser3 = (AvHUser3)theUserThree; // We're done theOrderType = ORDERTYPET_GET; } // Buildable? else if(GetHasUpgrade(theUserFour, MASK_BUILDABLE) && (theTeamOfThingHit == inTeam) && (theTeamOfThingHit != TEAM_IND)) { // Use it's center for the height VectorCopy(theFoundLocation, outTargetPoint); outTargetIndex = theFoundIndex; outUser3 = (AvHUser3)theUserThree; // We're done theOrderType = ORDERTYPET_BUILD; } // Weldable? else if(theUserThree == AVH_USER3_WELD ) { // Use it's center for the height//.........这里部分代码省略.........
开发者ID:Arkshine,项目名称:NS,代码行数:101,
示例21: Precachevoid CWorld :: Precache( void ){ g_pLastSpawn = NULL; CVAR_SET_STRING("sv_gravity", "800"); // 67ft/sec CVAR_SET_STRING("sv_stepsize", "18"); CVAR_SET_STRING("room_type", "0"); // clear DSP // Create all the arenas for (int i = 0; i < MAX_ARENAS; i++) { g_pArenaList[i] = GetClassPtr( ( CDiscArena *)NULL ); g_pArenaList[i]->Spawn(); } // Set up game rules if (g_pGameRules) { delete g_pGameRules; } g_pGameRules = InstallGameRules( ); //!!!UNDONE why is there so much Spawn code in the Precache function? I'll just keep it here ///!!!LATER - do we want a sound ent in deathmatch? (sjb) //pSoundEnt = CBaseEntity::Create( "soundent", g_vecZero, g_vecZero, edict() ); pSoundEnt = GetClassPtr( ( CSoundEnt *)NULL ); pSoundEnt->Spawn(); if ( !pSoundEnt ) { ALERT ( at_console, "**COULD NOT CREATE SOUNDENT**/n" ); } InitBodyQue(); // init sentence group playback stuff from sentences.txt.// ok to call this multiple times, calls after first are ignored. SENTENCEG_Init();// init texture type array from materials.txt TEXTURETYPE_Init();// the area based ambient sounds MUST be the first precache_sounds// player precaches W_Precache (); // get weapon precaches ClientPrecache();// sounds used from C physics code PRECACHE_SOUND("common/null.wav"); // clears sound channels PRECACHE_SOUND( "items/suitchargeok1.wav" );//!!! temporary sound for respawning weapons. PRECACHE_SOUND( "items/gunpickup2.wav" );// player picks up a gun. PRECACHE_SOUND( "common/bodydrop3.wav" );// dead bodies hitting the ground (animation events) PRECACHE_SOUND( "common/bodydrop4.wav" ); PRECACHE_SOUND( "r_tele1.wav" ); // respawn sound PRECACHE_SOUND( "scream1.wav" ); // falling scream sound PRECACHE_SOUND( "scream2.wav" ); // falling scream sound PRECACHE_SOUND( "scream3.wav" ); // falling scream sound PRECACHE_SOUND( "decap.wav" ); // decapitation sound PRECACHE_SOUND( "shatter.wav" ); // freeze decapitation sound PRECACHE_MODEL( "models/head.mdl" ); // head g_Language = (int)CVAR_GET_FLOAT( "sv_language" ); if ( g_Language == LANGUAGE_GERMAN ) { PRECACHE_MODEL( "models/germangibs.mdl" ); } else { PRECACHE_MODEL( "models/hgibs.mdl" ); PRECACHE_MODEL( "models/agibs.mdl" ); } PRECACHE_SOUND ("weapons/ric1.wav"); PRECACHE_SOUND ("weapons/ric2.wav"); PRECACHE_SOUND ("weapons/ric3.wav"); PRECACHE_SOUND ("weapons/ric4.wav"); PRECACHE_SOUND ("weapons/ric5.wav");//// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.// // 0 normal LIGHT_STYLE(0, "m"); // 1 FLICKER (first variety) LIGHT_STYLE(1, "mmnmmommommnonmmonqnmmo"); // 2 SLOW STRONG PULSE LIGHT_STYLE(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); //.........这里部分代码省略.........
开发者ID:ET-NiK,项目名称:amxxgroup,代码行数:101,
示例22: GiveFnptrsToDll//.........这里部分代码省略......... } } else if( !strcmpi( szGameDir , "ns") ) { mod_id = NS_DLL;#ifndef __linux__ szLibraryPath = "ns/dlls/ns.dll";#else szLibraryPath = "ns/dlls/ns_i386.so";#endif if( !g_bIsMMPlugin ) {#ifndef __linux__ h_Library = LoadLibrary( szLibraryPath );#else h_Library = dlopen( szLibraryPath, RTLD_NOW );#endif } } else if( strcmpi( szGameDir, "ship" ) ) { mod_id = SHIP_DLL;#ifndef __linux__ szLibraryPath = "ship/dlls/ship.dll";#else szLibraryPath = "ship/dlls/ship_i386.so";#endif if( !g_bIsMMPlugin ) {#ifndef __linux__ h_Library = LoadLibrary( szLibraryPath );#else h_Library = dlopen( szLibraryPath, RTLD_NOW );#endif } } strncpy( g_szLibraryPath, szLibraryPath, strlen( szLibraryPath ) ); if( !g_bIsMMPlugin && h_Library == nullptr ) { ALERT( at_error, "Library not found or not supported!/n" ); } extern bot_player_t g_valveBots[]; extern bot_player_t g_gearboxBots[]; extern bot_player_t g_dodBots[]; extern bot_player_t g_gunmanBots[]; extern bot_player_t g_nsBots[]; extern bot_player_t g_hungerBots[]; extern bot_player_t g_shipBots[]; if( mod_id == VALVE_DLL || mod_id == TFC_DLL ) { pBotData = g_valveBots; } else if( mod_id == GEARBOX_DLL ) { pBotData = g_gearboxBots; } else if( mod_id == DOD_DLL ) { pBotData = g_dodBots; } else if( mod_id == REWOLF_DLL ) { pBotData = g_gunmanBots; } else if( mod_id == NS_DLL ) { pBotData = g_nsBots; } else if( mod_id == HUNGER_DLL ) { pBotData = g_hungerBots; } else if( mod_id == SHIP_DLL ) { pBotData = g_shipBots; } LoadExtraExports(); if( g_bIsMMPlugin ) { return; } GetEngineFunctions( pengfuncsFromEngine, nullptr ); // give the engine functions to the other DLL... (*(GIVEFNPTRSTODLL)GetProcAddress( h_Library, "GiveFnptrsToDll" ))(pengfuncsFromEngine, pGlobals); // finished, interfacing from gamedll to engine complete return;}
开发者ID:tschumann,项目名称:sandbot,代码行数:101,
示例23: Movevoid CController :: Move ( float flInterval ) { float flWaypointDist; float flCheckDist; float flDist;// how far the lookahead check got before hitting an object. float flMoveDist; Vector vecDir; Vector vecApex; CBaseEntity *pTargetEnt; // Don't move if no valid route if ( FRouteClear() ) { ALERT( at_aiconsole, "Tried to move with no route!/n" ); TaskFail(); return; } if ( m_flMoveWaitFinished > gpGlobals->time ) return;// Debug, test movement code#if 0// if ( CVAR_GET_FLOAT("stopmove" ) != 0 ) { if ( m_movementGoal == MOVEGOAL_ENEMY ) RouteSimplify( m_hEnemy ); else RouteSimplify( m_hTargetEnt ); FRefreshRoute(); return; }#else// Debug, draw the route// DrawRoute( pev, m_Route, m_iRouteIndex, 0, 0, 255 );#endif // if the monster is moving directly towards an entity (enemy for instance), we'll set this pointer // to that entity for the CheckLocalMove and Triangulate functions. pTargetEnt = NULL; if (m_flGroundSpeed == 0) { m_flGroundSpeed = 100; // TaskFail( ); // return; } flMoveDist = m_flGroundSpeed * flInterval; do { // local move to waypoint. vecDir = ( m_Route[ m_iRouteIndex ].vecLocation - pev->origin ).Normalize(); flWaypointDist = ( m_Route[ m_iRouteIndex ].vecLocation - pev->origin ).Length(); // MakeIdealYaw ( m_Route[ m_iRouteIndex ].vecLocation ); // ChangeYaw ( pev->yaw_speed ); // if the waypoint is closer than CheckDist, CheckDist is the dist to waypoint if ( flWaypointDist < DIST_TO_CHECK ) { flCheckDist = flWaypointDist; } else { flCheckDist = DIST_TO_CHECK; } if ( (m_Route[ m_iRouteIndex ].iType & (~bits_MF_NOT_TO_MASK)) == bits_MF_TO_ENEMY ) { // only on a PURE move to enemy ( i.e., ONLY MF_TO_ENEMY set, not MF_TO_ENEMY and DETOUR ) pTargetEnt = m_hEnemy; } else if ( (m_Route[ m_iRouteIndex ].iType & ~bits_MF_NOT_TO_MASK) == bits_MF_TO_TARGETENT ) { pTargetEnt = m_hTargetEnt; } // !!!BUGBUG - CheckDist should be derived from ground speed. // If this fails, it should be because of some dynamic entity blocking this guy. // We've already checked this path, so we should wait and time out if the entity doesn't move flDist = 0; if ( CheckLocalMove ( pev->origin, pev->origin + vecDir * flCheckDist, pTargetEnt, &flDist ) != LOCALMOVE_VALID ) { CBaseEntity *pBlocker; // Can't move, stop Stop(); // Blocking entity is in global trace_ent pBlocker = CBaseEntity::Instance( gpGlobals->trace_ent ); if (pBlocker) { DispatchBlocked( edict(), pBlocker->edict() ); } if ( pBlocker && m_moveWaitTime > 0 && pBlocker->IsMoving() && !pBlocker->IsPlayer() && (gpGlobals->time-m_flMoveWaitFinished) > 3.0 ) { // Can we still move toward our target? if ( flDist < m_flGroundSpeed ) {//.........这里部分代码省略.........
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:101,
示例24: StartTask//.........这里部分代码省略......... SetTurnActivity(); break; } case TASK_FACE_LASTPOSITION: MakeIdealYaw ( m_vecLastPosition ); SetTurnActivity(); break; case TASK_FACE_TARGET: if ( m_hTargetEnt != NULL ) { MakeIdealYaw ( m_hTargetEnt->pev->origin ); SetTurnActivity(); } else TaskFail(); break; case TASK_FACE_ENEMY: { MakeIdealYaw ( m_vecEnemyLKP ); SetTurnActivity(); break; } case TASK_FACE_IDEAL: { SetTurnActivity(); break; } case TASK_FACE_ROUTE: { if (FRouteClear()) { ALERT(at_aiconsole, "No route to face!/n"); TaskFail(); } else { MakeIdealYaw(m_Route[m_iRouteIndex].vecLocation); SetTurnActivity(); } break; } case TASK_WAIT_PVS: case TASK_WAIT_INDEFINITE: { // don't do anything. break; } case TASK_WAIT: case TASK_WAIT_FACE_ENEMY: {// set a future time that tells us when the wait is over. m_flWaitFinished = gpGlobals->time + pTask->flData; break; } case TASK_WAIT_RANDOM: {// set a future time that tells us when the wait is over. m_flWaitFinished = gpGlobals->time + RANDOM_FLOAT( 0.1, pTask->flData ); break; } case TASK_MOVE_TO_TARGET_RANGE: { if ( (m_hTargetEnt->pev->origin - pev->origin).Length() < 1 ) TaskComplete(); else {
开发者ID:mittorn,项目名称:SoHL-1.2,代码行数:67,
示例25: DispatchRestoreint DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity){ CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); if(pEntity && pSaveData) { entvars_t tmpVars; Vector oldOffset; CRestore restoreHelper(pSaveData); if(globalEntity) { CRestore tmpRestore(pSaveData); tmpRestore.PrecacheMode(0); tmpRestore.ReadEntVars("ENTVARS", &tmpVars); // HACKHACK - reset the save pointers, we're going to restore for real this time pSaveData->size = pSaveData->pTable[pSaveData->currentIndex].location; pSaveData->pCurrentData = pSaveData->pBaseData + pSaveData->size; // ------------------- const globalentity_t *pGlobal = gGlobalState.EntityFromTable(tmpVars.globalname); // Don't overlay any instance of the global that isn't the latest // pSaveData->szCurrentMapName is the level this entity is coming from // pGlobla->levelName is the last level the global entity was active in. // If they aren't the same, then this global update is out of date. if(!FStrEq(pSaveData->szCurrentMapName, pGlobal->levelName)) return 0; // Compute the new global offset oldOffset = pSaveData->vecLandmarkOffset; CBaseEntity *pNewEntity = FindGlobalEntity(tmpVars.classname, tmpVars.globalname); if(pNewEntity) { // ALERT( at_console, "Overlay %s with %s/n", STRING(pNewEntity->pev->classname), STRING(tmpVars.classname) ); // Tell the restore code we're overlaying a global entity from another level restoreHelper.SetGlobalMode(1); // Don't overwrite global fields pSaveData->vecLandmarkOffset = (pSaveData->vecLandmarkOffset - pNewEntity->pev->mins) + tmpVars.mins; pEntity = pNewEntity; // we're going to restore this data OVER the old entity pent = ENT(pEntity->pev); // Update the global table to say that the global definition of this entity should come from this level gGlobalState.EntityUpdate(pEntity->pev->globalname, gpGlobals->mapname); } else { // This entity will be freed automatically by the engine. If we don't do a restore on a matching entity (below) // or call EntityUpdate() to move it to this level, we haven't changed global state at all. return 0; } } if(pEntity->ObjectCaps() & FCAP_MUST_SPAWN) { pEntity->Restore(restoreHelper); pEntity->Spawn(); } else { pEntity->Restore(restoreHelper); pEntity->Precache(); } // Again, could be deleted, get the pointer again. pEntity = (CBaseEntity *)GET_PRIVATE(pent);#if 0 if ( pEntity && pEntity->pev->globalname && globalEntity ) { ALERT( at_console, "Global %s is %s/n", STRING(pEntity->pev->globalname), STRING(pEntity->pev->model) ); }#endif // Is this an overriding global entity (coming over the transition), or one restoring in a level if(globalEntity) { // ALERT( at_console, "After: %f %f %f %s/n", pEntity->pev->origin.x, pEntity->pev->origin.y, pEntity->pev->origin.z, STRING(pEntity->pev->model) ); pSaveData->vecLandmarkOffset = oldOffset; if(pEntity) { UTIL_SetOrigin(pEntity->pev, pEntity->pev->origin); pEntity->OverrideReset(); } } else if(pEntity && pEntity->pev->globalname) { const globalentity_t *pGlobal = gGlobalState.EntityFromTable(pEntity->pev->globalname); if(pGlobal) { // Already dead? delete if(pGlobal->state == GLOBAL_DEAD) return -1; else if(!FStrEq(STRING(gpGlobals->mapname), pGlobal->levelName)) { pEntity->MakeDormant(); // Hasn't been moved to this level yet, wait but stay alive } // In this level & not dead, continue on as normal } else {//.........这里部分代码省略.........
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:101,
示例26: switchvoid CBigMomma::StartTask( Task_t *pTask ){ switch ( pTask->iTask ) { case TASK_FIND_NODE: { CBaseEntity *pTarget = m_hTargetEnt; if ( !HasMemory( bits_MEMORY_ADVANCE_NODE ) ) { if ( pTarget ) pev->netname = m_hTargetEnt->pev->target; } NodeStart( pev->netname ); TaskComplete(); ALERT( at_aiconsole, "BM: Found node %s/n", STRING(pev->netname) ); } break; case TASK_NODE_DELAY: m_nodeTime = gpGlobals->time + pTask->flData; TaskComplete(); ALERT( at_aiconsole, "BM: FAIL! Delay %.2f/n", pTask->flData ); break; case TASK_PROCESS_NODE: ALERT( at_aiconsole, "BM: Reached node %s/n", STRING(pev->netname) ); NodeReach(); TaskComplete(); break; case TASK_PLAY_NODE_PRESEQUENCE: case TASK_PLAY_NODE_SEQUENCE: { int sequence; if ( pTask->iTask == TASK_PLAY_NODE_SEQUENCE ) sequence = GetNodeSequence(); else sequence = GetNodePresequence(); ALERT( at_aiconsole, "BM: Playing node sequence %s/n", STRING(sequence) ); if ( sequence ) { sequence = LookupSequence( STRING( sequence ) ); if ( sequence != -1 ) { pev->sequence = sequence; pev->frame = 0; ResetSequenceInfo( ); ALERT( at_aiconsole, "BM: Sequence %s/n", STRING(GetNodeSequence()) ); return; } } TaskComplete(); } break; case TASK_NODE_YAW: pev->ideal_yaw = GetNodeYaw(); TaskComplete(); break; case TASK_WAIT_NODE: m_flWait = gpGlobals->time + GetNodeDelay(); if ( m_hTargetEnt->pev->spawnflags & SF_INFOBM_WAIT ) ALERT( at_aiconsole, "BM: Wait at node %s forever/n", STRING(pev->netname) ); else ALERT( at_aiconsole, "BM: Wait at node %s for %.2f/n", STRING(pev->netname), GetNodeDelay() ); break; case TASK_MOVE_TO_NODE_RANGE: { CBaseEntity *pTarget = m_hTargetEnt; if ( !pTarget ) TaskFail(); else { if ( (pTarget->pev->origin - pev->origin).Length() < GetNodeRange() ) TaskComplete(); else { Activity act = ACT_WALK; if ( pTarget->pev->spawnflags & SF_INFOBM_RUN ) act = ACT_RUN; m_vecMoveGoal = pTarget->pev->origin; if ( !MoveToTarget( act, 2 ) ) { TaskFail(); } } } } ALERT( at_aiconsole, "BM: Moving to node %s/n", STRING(pev->netname) ); break; case TASK_MELEE_ATTACK1: // Play an attack sound here EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pAttackSounds), 1.0, ATTN_NORM, 0, PITCH_NORM );//.........这里部分代码省略.........
开发者ID:FaucetDC,项目名称:HLDC_SDK,代码行数:101,
示例27: FindTransitionint FindTransition( void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir ){ studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) return iGoalAnim; mstudioseqdesc_t *pseqdesc; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex); // bail if we're going to or from a node 0 if (pseqdesc[iEndingAnim].entrynode == 0 || pseqdesc[iGoalAnim].entrynode == 0) { return iGoalAnim; } int iEndNode; // ALERT( at_console, "from %d to %d: ", pEndNode->iEndNode, pGoalNode->iStartNode ); if (*piDir > 0) { iEndNode = pseqdesc[iEndingAnim].exitnode; } else { iEndNode = pseqdesc[iEndingAnim].entrynode; } if (iEndNode == pseqdesc[iGoalAnim].entrynode) { *piDir = 1; return iGoalAnim; } byte *pTransition = ((byte *)pstudiohdr + pstudiohdr->transitionindex); int iInternNode = pTransition[(iEndNode-1)*pstudiohdr->numtransitions + (pseqdesc[iGoalAnim].entrynode-1)]; if (iInternNode == 0) return iGoalAnim; int i; // look for someone going for (i = 0; i < pstudiohdr->numseq; i++) { if (pseqdesc[i].entrynode == iEndNode && pseqdesc[i].exitnode == iInternNode) { *piDir = 1; return i; } if (pseqdesc[i].nodeflags) { if (pseqdesc[i].exitnode == iEndNode && pseqdesc[i].entrynode == iInternNode) { *piDir = -1; return i; } } } ALERT( at_console, "error in transition graph" ); return iGoalAnim;}
开发者ID:Skumek,项目名称:hlsdk,代码行数:66,
示例28: UTIL_TraceLine//=========================================================// MakeMonster- this is the code that drops the monster//=========================================================void CMonsterMaker::MakeMonster( void ){ edict_t *pent; entvars_t *pevCreate; if ( m_iMaxLiveChildren > 0 && m_cLiveChildren >= m_iMaxLiveChildren ) {// not allowed to make a new one yet. Too many live ones out right now. return; } if ( !m_flGround ) { // set altitude. Now that I'm activated, any breakables, etc should be out from under me. TraceResult tr; UTIL_TraceLine ( pev->origin, pev->origin - Vector ( 0, 0, 2048 ), ignore_monsters, ENT(pev), &tr ); m_flGround = tr.vecEndPos.z; } Vector mins = pev->origin - Vector( 34, 34, 0 ); Vector maxs = pev->origin + Vector( 34, 34, 0 ); maxs.z = pev->origin.z; mins.z = m_flGround; CBaseEntity *pList[2]; int count = UTIL_EntitiesInBox( pList, 2, mins, maxs, FL_CLIENT|FL_MONSTER ); if ( count ) { // don't build a stack of monsters! return; } pent = CREATE_NAMED_ENTITY( m_iszMonsterClassname ); if ( FNullEnt( pent ) ) { ALERT ( at_console, "NULL Ent in MonsterMaker!/n" ); return; } // If I have a target, fire! if ( !FStringNull ( pev->target ) ) { // delay already overloaded for this entity, so can't call SUB_UseTargets() FireTargets( STRING(pev->target), this, this, USE_TOGGLE, 0 ); } pevCreate = VARS( pent ); pevCreate->origin = pev->origin; pevCreate->angles = pev->angles; SetBits( pevCreate->spawnflags, SF_MONSTER_FALL_TO_GROUND ); // Children hit monsterclip brushes if ( pev->spawnflags & SF_MONSTERMAKER_MONSTERCLIP ) SetBits( pevCreate->spawnflags, SF_MONSTER_HITMONSTERCLIP ); DispatchSpawn( ENT( pevCreate ) ); pevCreate->owner = edict(); if ( !FStringNull( pev->netname ) ) { // if I have a netname (overloaded), give the child monster that name as a targetname pevCreate->targetname = pev->netname; } m_cLiveChildren++;// count this monster m_cNumMonsters--; if ( m_cNumMonsters == 0 ) { // Disable this forever. Don't kill it because it still gets death notices SetThink( NULL ); SetUse( NULL ); }}
开发者ID:CryoKeen,项目名称:HLEnhanced,代码行数:78,
注:本文中的ALERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ALIGN函数代码示例 C++ ALEMBIC_ABC_SAFE_CALL_END函数代码示例 |