static void InitBodyQue(void) { string_t istrClassname = MAKE_STRING("bodyque"); g_pBodyQueueHead = CREATE_NAMED_ENTITY( istrClassname ); entvars_t *pev = VARS(g_pBodyQueueHead); // Reserve 3 more slots for dead bodies for ( int i = 0; i < 3; i++ ) { pev->owner = CREATE_NAMED_ENTITY( istrClassname ); pev = VARS(pev->owner); } pev->owner = g_pBodyQueueHead; }
void AvHKnife::Spawn() { AvHMarineWeapon::Spawn(); Precache(); this->m_iId = AVH_WEAPON_KNIFE; //this->m_iDefaultAmmo = kKNMaxClip; // Set our class name this->pev->classname = MAKE_STRING(kwsKnife); SET_MODEL(ENT(this->pev), kNullModel); FallInit();// get ready to fall down. }
static void httpapp_send_all_usage( tcp_sock sock ) { str_t content = { 0, 0 }; str_t content_type = MAKE_STRING( "application/x-json" ); user_t * u = 0; while( (u = get_next_user(u)) != 0 ) { str_t usage = httpapp_user_usage(u, get_next_user(u) != 0); append_string( &content, &usage ); free( usage.str ); } httpserv_send_content(sock, content_type, content, 1, 0 ); log_printf( "200 OK %d bytes\n", content.len ); }
static void httpapp_send_stat_counts( tcp_sock sock ) { str_t content = { 0, 0 }; str_t content_type = MAKE_STRING( "application/x-json" ); void * c = 0; while( 0 != (c = stats_get_next_counter(c) )) { str_t counter = httpapp_make_counter_json(c, stats_get_next_counter(c) != 0); append_string( &content, &counter ); free( counter.str ); } httpserv_send_content(sock, content_type, content, 1, 0); log_printf( "200 OK %d bytes\n", content.len ); }
void CAWP::Spawn( ) { pev->classname = MAKE_STRING( "weapon_awp" ); Precache( ); SET_MODEL( ENT(pev), "models/weapons/awp/w_awp.mdl" ); m_iId = WEAPON_AWP; m_iDefaultAmmo = 120; FallInit(); wepspread_s.MaxSpreadX = 5; wepspread_s.MaxSpreadY = 5; wepspread_s.SpreadX = 5; wepspread_s.SpreadY = 5; scope = false; }
void CM249::Spawn(void) { BINTRACE pev->classname = MAKE_STRING("weapon_m249"); Precache(); m_iId = WEAPON_M249; SET_MODEL(ENT(pev), "models/w_m249.mdl"); m_iDefaultAmmo = M249_DEFAULT_GIVE; m_flAccuracy = 0.2; m_iShotsFired = 0; FallInit(); }
void CBaseDelay::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value) { if (FStringNull(pev->target) && !m_iszKillTarget) return; if (m_flDelay != 0) { CBaseDelay *pTemp = GetClassPtr((CBaseDelay *)NULL); if (pTemp->pev->classname) RemoveEntityHashValue(pTemp->pev, STRING(pTemp->pev->classname), CLASSNAME); pTemp->pev->classname = MAKE_STRING("DelayedUse"); AddEntityHashValue(pTemp->pev, STRING(pTemp->pev->classname), CLASSNAME); pTemp->pev->nextthink = gpGlobals->time + m_flDelay; pTemp->SetThink(&CBaseDelay::DelayThink); pTemp->pev->button = (int)useType; pTemp->m_iszKillTarget = m_iszKillTarget; pTemp->m_flDelay = 0; pTemp->pev->target = pev->target; if (pActivator && pActivator->IsPlayer()) pTemp->pev->owner = pActivator->edict(); else pTemp->pev->owner = NULL; return; } if (m_iszKillTarget) { ALERT(at_aiconsole, "KillTarget: %s\n", STRING(m_iszKillTarget)); edict_t *pentKillTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_iszKillTarget)); while (!FNullEnt(pentKillTarget)) { UTIL_Remove(CBaseEntity::Instance(pentKillTarget)); ALERT(at_aiconsole, "killing %s\n", STRING(pentKillTarget->v.classname)); pentKillTarget = FIND_ENTITY_BY_TARGETNAME(pentKillTarget, STRING(m_iszKillTarget)); } } if (!FStringNull(pev->target)) FireTargets(STRING(pev->target), pActivator, this, useType, value); }
static void httpapp_send_user_bindings( tcp_sock sock ) { str_t content = { 0, 0 }; str_t content_type = MAKE_STRING( "application/x-json" ); user_t * u = 0; while( 0 != (u = get_next_user(u) )) { str_t binding = httpapp_user_binding(u, get_next_user(u) != 0); append_string( &content, &binding ); free( binding.str ); } httpserv_send_content(sock, content_type, content, 1, 0); log_printf( "200 OK %d bytes\n", content.len ); }
CXenHull *CXenHull :: CreateHull( CBaseEntity *source, const Vector &mins, const Vector &maxs, const Vector &offset ) { CXenHull *pHull = GetClassPtr( (CXenHull *)NULL ); UTIL_SetOrigin( pHull->pev, source->pev->origin + offset ); SET_MODEL( pHull->edict(), STRING(source->pev->model) ); pHull->pev->solid = SOLID_BBOX; pHull->pev->classname = MAKE_STRING("xen_hull"); pHull->pev->movetype = MOVETYPE_NONE; pHull->pev->owner = source->edict(); UTIL_SetSize( pHull->pev, mins, maxs ); pHull->pev->renderamt = 0; pHull->pev->rendermode = kRenderTransTexture; // pHull->pev->effects = EF_NODRAW; return pHull; }
void CTeamSpawn::Spawn( void ) { pev->solid = SOLID_NOT; if( !stricmp( STRING( pev->classname ), "info_player_start" ) ) { pev->team = TEAM_EARTH; } else if( !stricmp( STRING( pev->classname ), "info_player_deathmatch" ) ) { pev->team = TEAM_SPACE; } pev->classname = MAKE_STRING( "info_team_spawn" ); // ALERT( at_console, "SPAWNS %i\n", pev->team ); }
void CSquidSpit:: Spawn( void ) { pev->movetype = MOVETYPE_FLY; pev->classname = MAKE_STRING( "squidspit" ); pev->solid = SOLID_BBOX; pev->rendermode = kRenderTransAlpha; pev->renderamt = 255; SET_MODEL(ENT(pev), "sprites/bigspit.spr"); pev->frame = 0; pev->scale = 0.5; UTIL_SetSize( pev, Vector( 0, 0, 0), Vector(0, 0, 0) ); m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1; }
void AvHFlameGun::Spawn() { AvHMarineWeapon::Spawn(); Precache(); //this->m_iId = AVH_WEAPON_FLAMER; ASSERT(false); this->m_iDefaultAmmo = kFGMaxClip; // Set our class name this->pev->classname = MAKE_STRING(kwsFlameGun); SET_MODEL(ENT(this->pev), kFGWModel); FallInit();// get ready to fall down. }
void CHostage::Precache(void) { BINTRACE m_whichModel = 0; if (FStringNull(pev->model)) pev->model = MAKE_STRING("models/scientist.mdl"); PRECACHE_MODEL((char *)STRING(pev->model)); PRECACHE_SOUND("hostage/hos1.wav"); PRECACHE_SOUND("hostage/hos2.wav"); PRECACHE_SOUND("hostage/hos3.wav"); PRECACHE_SOUND("hostage/hos4.wav"); PRECACHE_SOUND("hostage/hos5.wav"); PRECACHE_MODEL("sprites/smoke.spr"); }
void Save( ISave *pSave ) { pSave->StartBlock( "Squads" ); short nSquads = (short)g_AI_SquadManager.NumSquads(); pSave->WriteShort( &nSquads ); AISquadsIter_t iter; string_t squadName; CAI_Squad* pSquad = g_AI_SquadManager.GetFirstSquad( &iter ); while (pSquad) { squadName = MAKE_STRING( pSquad->GetName() ); pSave->WriteString( "", &squadName ); // Strings require a header to be read properly pSave->WriteAll( pSquad ); pSquad = g_AI_SquadManager.GetNextSquad( &iter ); } pSave->EndBlock(); //--------------------------------- pSave->StartBlock( "Enemies" ); short nMemories = 0; CAI_BaseNPC **ppAIs = g_AI_Manager.AccessAIs(); int i; for ( i = 0; i < g_AI_Manager.NumAIs(); i++ ) { if ( ppAIs[i]->GetEnemies() ) nMemories++; } pSave->WriteShort( &nMemories ); for ( i = 0; i < g_AI_Manager.NumAIs(); i++ ) { if ( ppAIs[i]->GetEnemies() ) { CBaseEntity *p = ppAIs[i]; pSave->WriteEntityPtr( &p ); pSave->WriteAll( ppAIs[i]->GetEnemies() ); } } pSave->EndBlock(); }
void CCycler :: GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax) { if (!szModel || !*szModel) { ALERT(at_error, "cycler at %.0f %.0f %0.f missing modelname", pev->origin.x, pev->origin.y, pev->origin.z ); REMOVE_ENTITY(ENT(pev)); return; } pev->classname = MAKE_STRING("cycler"); PRECACHE_MODEL( szModel ); SET_MODEL(ENT(pev), szModel); CCycler::Spawn( ); UTIL_SetSize(pev, vecMin, vecMax); }
// UNDONE: right now this is pretty much a copy of the squid spit with minor changes to the way it does damage void CBMortar:: Spawn( void ) { pev->movetype = MOVETYPE_TOSS; pev->classname = MAKE_STRING( "bmortar" ); pev->solid = SOLID_BBOX; pev->rendermode = kRenderTransAlpha; pev->renderamt = 255; SET_MODEL(ENT(pev), "sprites/mommaspit.spr"); pev->frame = 0; pev->scale = 0.5; UTIL_SetSize( pev, Vector( 0, 0, 0), Vector(0, 0, 0) ); m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1; pev->dmgtime = gpGlobals->time + 0.4; }
// NOTE: szName must be a pointer to constant memory, e.g. "monster_class" because the entity // will keep a pointer to it after this call. CBaseEntity *CBaseEntity::Create(char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner) { edict_t * pent; CBaseEntity *pEntity; pent = CREATE_NAMED_ENTITY(MAKE_STRING(szName)); if(FNullEnt(pent)) { ALERT(at_console, "NULL Ent in Create!\n"); return NULL; } pEntity = Instance(pent); pEntity->pev->owner = pentOwner; pEntity->pev->origin = vecOrigin; pEntity->pev->angles = vecAngles; DispatchSpawn(pEntity->edict()); return pEntity; }
//========================================================= //========================================================= void CFlockingFlyer :: SpawnCommonCode( ) { pev->deadflag = DEAD_NO; pev->classname = MAKE_STRING("monster_flyer"); pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_FLY; pev->takedamage = DAMAGE_NO; pev->health = 1; m_fPathBlocked = FALSE;// obstacles will be detected m_flFieldOfView = 0.2; //SET_MODEL(ENT(pev), "models/aflock.mdl"); SET_MODEL(ENT(pev), "models/boid.mdl"); // UTIL_SetSize(pev, Vector(0,0,0), Vector(0,0,0)); UTIL_SetSize(pev, Vector(-5,-5,0), Vector(5,5,2)); }
void CBaseTrigger :: Spawn( void ) { pev->solid = SOLID_TRIGGER; pev->movetype = MOVETYPE_NONE; pev->takedamage = DAMAGE_NO; UTIL_SetModel( ENT( pev ), pev->model ); // set size and link into world SetObjectClass( ED_TRIGGER ); // create a null-terminator for the registry m_pRegister = GetClassPtr(( CInOutRegister *)NULL ); m_pRegister->m_hValue = NULL; m_pRegister->m_pNext = NULL; m_pRegister->m_pField = this; m_pRegister->pev->classname = MAKE_STRING("zoneent"); m_pRegister->SetObjectClass( ED_STATIC ); SetThink( Update ); }
void CSmokeGrenade::Spawn( void ) { pev->classname = MAKE_STRING( "weapon_smokegrenade" ); Precache(); m_iId = WEAPON_SMOKEGRENADE; SET_MODEL( edict(), "models/w_smokegrenade.mdl" ); pev->dmg = 4; ClearBits( m_iWeaponState, WPNSTATE_SHIELD_DRAWN ); m_iDefaultAmmo = SMOKEGRENADE_DEFAULT_GIVE; m_flStartThrow = 0; m_flReleaseThrow = -1; FallInit(); }
SCM_EXPORT ScmObj scm_p_number2string(ScmObj num, ScmObj args) { char *str; intmax_t n; int r; ScmValueFormat vfmt; DECLARE_FUNCTION("number->string", procedure_variadic_1); ENSURE_INT(num); n = (intmax_t)SCM_INT_VALUE(num); r = prepare_radix(SCM_MANGLE(name), args); SCM_VALUE_FORMAT_INIT(vfmt); str = scm_int2string(vfmt, (uintmax_t)n, r); return MAKE_STRING(str, SCM_STRLEN_UNKNOWN); }
//========================================================= CQuakeRocket *CQuakeRocket::CreateGrenade( Vector vecOrigin, Vector vecVelocity, CBaseEntity *pOwner ) { CQuakeRocket *pRocket = GetClassPtr( (CQuakeRocket *)NULL ); UTIL_SetOrigin( pRocket->pev, vecOrigin ); SET_MODEL(ENT(pRocket->pev), "models/grenade.mdl"); pRocket->Spawn(); pRocket->pev->classname = MAKE_STRING("grenade"); pRocket->pev->owner = pOwner->edict(); // Setup pRocket->pev->movetype = MOVETYPE_BOUNCE; pRocket->pev->solid = SOLID_BBOX; pRocket->pev->avelocity = Vector(300,300,300); // Velocity pRocket->pev->velocity = vecVelocity; pRocket->pev->angles = UTIL_VecToAngles(vecVelocity); pRocket->pev->friction = 0.5; // Touch pRocket->SetTouch( CQuakeRocket::GrenadeTouch ); // set newmis duration if ( gpGlobals->deathmatch == 4 ) { pRocket->m_flAttackFinished = gpGlobals->time + 1.1; // What's this used for? if (pOwner) pOwner->TakeDamage( pOwner->pev, pOwner->pev, 10, DMG_GENERIC ); } pRocket->pev->nextthink = gpGlobals->time + 2.5; pRocket->SetThink( CQuakeRocket::GrenadeExplode ); PLAYBACK_EVENT_FULL (FEV_GLOBAL, pRocket->edict(), g_sTrail, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.7, 0.0, pRocket->entindex(), GRENADE_TRAIL, 0, 0); return pRocket; }
void CGrenade::Spawn(void) { m_iBounceCount = 0; pev->movetype = MOVETYPE_BOUNCE; if (pev->classname) RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME); pev->classname = MAKE_STRING("grenade"); AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME); m_bIsC4 = false; pev->solid = SOLID_BBOX; SET_MODEL(ENT(pev), "models/grenade.mdl"); UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0)); pev->dmg = 30; m_fRegisteredSound = FALSE; }
void CTankCam :: Spawn( void ) { Precache(); SET_MODEL(ENT(pev), "models/tank_cam.mdl"); UTIL_SetSize(pev, Vector(0,0,0),Vector(0,0,0) ); UTIL_SetOrigin( pev, pev->origin ); pev->movetype = MOVETYPE_NOCLIP; pev->solid = SOLID_NOT; pev->classname = MAKE_STRING("info_tank_camera"); //necessaire pour le passage a la sauvegarde : getclassptr ne cree pas de pev->classname et donc l entite n est pas prise en compte pev->takedamage = DAMAGE_NO; SetThink ( CamThink ); pev->nextthink = gpGlobals->time + 1.5; }
void CTriggerAreaCapture::InputSetControlPoint( inputdata_t &inputdata ) { BreakCapture( false ); // clear the capping for the previous point, forces us to recalc on the new one char parseString[255]; Q_strncpy(parseString, inputdata.value.String(), sizeof(parseString)); m_iszCapPointName = MAKE_STRING( parseString ); m_hPoint = NULL; // force a reset of this InputRoundSpawn( inputdata ); // force everyone touching to re-touch so the hud gets set up properly for ( int i = 0; i < m_hTouchingEntities.Count(); i++ ) { CBaseEntity *ent = m_hTouchingEntities[i]; if ( ent && ent->IsPlayer() ) { EndTouch( ent ); StartTouch( ent ); } } }
void CMomentaryDoor :: Precache( void ) { int m_sound = UTIL_LoadSoundPreset( m_iMoveSnd ); // set the door's "in-motion" sound switch( m_sound ) { case 1: pev->noise = UTIL_PrecacheSound( "doors/doormove1.wav" ); break; case 2: pev->noise = UTIL_PrecacheSound( "doors/doormove2.wav" ); break; case 3: pev->noise = UTIL_PrecacheSound( "doors/doormove3.wav" ); break; case 4: pev->noise = UTIL_PrecacheSound( "doors/doormove4.wav" ); break; case 5: pev->noise = UTIL_PrecacheSound( "doors/doormove5.wav" ); break; case 6: pev->noise = UTIL_PrecacheSound( "doors/doormove6.wav" ); break; case 7: pev->noise = UTIL_PrecacheSound( "doors/doormove7.wav" ); break; case 8: pev->noise = UTIL_PrecacheSound( "doors/doormove8.wav" ); break; case 0: pev->noise = MAKE_STRING( "common/null.wav" ); break; default: pev->noise = UTIL_PrecacheSound( m_sound ); break; } }
// SidLuke static cell AMX_NATIVE_CALL strip_user_weapons(AMX *amx, cell *params) // index { CHECK_PLAYER(params[1]); edict_t* pPlayer = MF_GetPlayerEdict(params[1]); string_t item = MAKE_STRING("player_weaponstrip"); edict_t *pent = CREATE_NAMED_ENTITY(item); if (FNullEnt(pent)) { return 0; } MDLL_Spawn(pent); MDLL_Use(pent, pPlayer); REMOVE_ENTITY(pent); *reinterpret_cast<int *>(MF_PlayerPropAddr(params[1], Player_CurrentWeapon)) = 0; return 1; }
//========================================================= //========================================================= void CDirectorBatterySpawn::Make() { // Desactivado. if ( Disabled ) return; if ( !MaySpawn() ) return; // Creamos la bateria. CItem *pItem = (CItem *)CreateEntityByName("item_battery"); // Hubo un problema al crear el objeto. if ( !pItem ) { DevWarning("[DIRECTOR BATTERY MAKER] Ha ocurrido un problema al crear la bateria."); return; } Vector origin; if ( !CanSpawn(pItem, &origin) ) return; QAngle angles = GetAbsAngles(); // Lugar de creación. pItem->SetAbsOrigin(origin); // Nombre de la entidad. pItem->SetName(MAKE_STRING(ITEM_NAME)); pItem->SetAbsAngles(angles); // Creamos la bateria, le decimos quien es su dios (creador) y lo activamos. DispatchSpawn(pItem); pItem->SetOwnerEntity(this); pItem->Activate(); }
// Precaches the weapon and queues the weapon info for sending to clients void UTIL_PrecacheOtherWeapon( const char *szClassname ) { edict_t *pent; pent = CREATE_NAMED_ENTITY( MAKE_STRING( szClassname ) ); if ( FNullEnt( pent ) ) { ALERT ( at_console, "NULL Ent in UTIL_PrecacheOtherWeapon\n" ); return; } CBaseEntity *pEntity = CBaseEntity::Instance (VARS( pent )); if (pEntity) { ItemInfo II; pEntity->Precache( ); memset( &II, 0, sizeof II ); if ( ((CBasePlayerItem*)pEntity)->GetItemInfo( &II ) ) { CBasePlayerItem::ItemInfoArray[II.iId] = II; if ( II.pszAmmo1 && *II.pszAmmo1 ) { AddAmmoNameToAmmoRegistry( II.pszAmmo1 ); } if ( II.pszAmmo2 && *II.pszAmmo2 ) { AddAmmoNameToAmmoRegistry( II.pszAmmo2 ); } memset( &II, 0, sizeof II ); } } REMOVE_ENTITY(pent); }
void CCharleville::SetAllVars() { pData->p_model = "models/p_charleville.mdl"; pData->v_model = "models/v_charleville.mdl"; pData->w_model = "models/w_charleville.mdl"; pData->player_anim = "charleville"; pData->snd_prim_fire = "weapons/charleville/fire1.wav"; pData->snd_second_fire = "weapons/charleville/fire2.wav"; pData->snd_reload = "weapons/charleville/reload.wav"; pData->snd_draw = "weapons/charleville/draw.wav"; pData->snd_holster = "weapons/charleville/holster.wav"; pData->snd_hit = "weapons/charleville/hit.wav"; pData->snd_hitwall = "weapons/charleville/hitwall.wav"; pData->event_second = "events/melee.sc"; pData->iId = WEAPON_CHARLE; pData->flPrimaryDmgModifier = CHARLE_FIRE_DAMAGE; pData->flSecondaryDmgModifier = CHARLE_BAYONET_DAMAGE; pData->iWeight = CHARLE_WEIGHT; pData->flSpeedModifier = CHARLE_SPEED; pData->flStandMoving = 11.5; pData->flStandStill = 3.5; pData->flCrouchMoving = 11.5; pData->flCrouchStill = 3.5; pData->iDefaultGive = CHARLE_DEFAULT_GIVE; pData->iMaxAmmo = CHARLE_MAX_CARRY; pData->classname = MAKE_STRING("weapon_Charleville"); pData->flBladeLength = 77.0; pData->bBayonet = true; pData->flDeployDelay = 0.0; }