bool C_ASW_PropJeep_Clientside::Initialize() { SetModelName( VEHICLE_MODEL ); PrecacheModel(VEHICLE_MODEL); SetModel(VEHICLE_MODEL); if ( InitializeAsClientEntity( STRING(GetModelName()), false ) == false ) { return false; } const model_t *mod = GetModel(); if ( mod ) { Vector mins, maxs; modelinfo->GetModelBounds( mod, mins, maxs ); SetCollisionBounds( mins, maxs ); } solid_t tmpSolid; // Create the object in the physics system if ( !PhysModelParseSolid( tmpSolid, this, GetModelIndex() ) ) { DevMsg("C_ASW_PropJeep_Clientside::Initialize: PhysModelParseSolid failed for entity %i.\n", GetModelIndex() ); return false; } else { m_pPhysicsObject = VPhysicsInitNormal( SOLID_VPHYSICS, 0, false, &tmpSolid ); if ( !m_pPhysicsObject ) { // failed to create a physics object DevMsg(" C_ASW_PropJeep_Clientside::Initialize: VPhysicsInitNormal() failed for %s.\n", STRING(GetModelName()) ); return false; } } Spawn(); if ( engine->IsInEditMode() ) { // don't spawn in map edit mode return false; } // player can push it away SetCollisionGroup( COLLISION_GROUP_VEHICLE ); UpdatePartitionListEntry(); CollisionProp()->UpdatePartition(); //SetBlocksLOS( false ); // this should be a small object // Set up shadows; do it here so that objects can change shadowcasting state CreateShadow(); UpdateVisibility(); SetNextClientThink( gpGlobals->curtime + 0.4f ); return true; }
void Spawn( void ) { Precache( ); SetModel( "models/items/ar2_grenade.mdl"); BaseClass::Spawn( ); }
void Spawn( void ) { Precache( ); SetModel( "models/items/combine_rifle_ammo01.mdl"); BaseClass::Spawn( ); }
void EditorUI::menuFileNew() { delete model; SetModel (new Model); }
void Spawn( void ) { Precache( ); SetModel( "models/items/flare.mdl"); BaseClass::Spawn( ); }
void CWeaponDrainGrenade::Spawn() { SetModel(GRENADE_DRAIN_MODEL); BaseClass::Spawn(); }
void StaticModel::HandleModelReloadFinished(StringHash eventType, VariantMap& eventData) { Model* currentModel = model_; model_.reset(); // Set null to allow to be re-set SetModel(currentModel); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Combine_Cannon::Spawn( void ) { Precache(); /// HACK: SetModel( "models/combine_soldier.mdl" ); // Setup our ancillary beams but keep them hidden for now CreateLaser(); CreateAncillaryBeams(); m_iAmmoType = GetAmmoDef()->Index( "CombineHeavyCannon" ); SetHullType( HULL_HUMAN ); SetHullSizeNormal(); UTIL_SetSize( this, Vector( -16, -16 , 0 ), Vector( 16, 16, 64 ) ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_FLY ); m_bloodColor = DONT_BLEED; m_iHealth = 10; m_flFieldOfView = DOT_45DEGREE; m_NPCState = NPC_STATE_NONE; if( HasSpawnFlags( SF_STARTDISABLED ) ) { m_fEnabled = false; } else { m_fEnabled = true; } CapabilitiesClear(); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_SIMPLE_RADIUS_DAMAGE ); m_HackedGunPos = Vector ( 0, 0, 0 ); AddSpawnFlags( SF_NPC_LONG_RANGE | SF_NPC_ALWAYSTHINK ); NPCInit(); // Limit our look distance SetDistLook( m_flSightDist ); AddEffects( EF_NODRAW ); AddSolidFlags( FSOLID_NOT_SOLID ); // Point the cursor straight ahead so that the sniper's // first sweep of the laser doesn't look weird. Vector vecForward; AngleVectors( GetLocalAngles(), &vecForward ); m_vecPaintCursor = GetBulletOrigin() + vecForward * 1024; // none! GetEnemies()->SetFreeKnowledgeDuration( 0.0f ); GetEnemies()->SetEnemyDiscardTime( 2.0f ); m_flTimeLastAttackedPlayer = 0.0f; }
void CWeaponHL2MPBase::FallInit( void ) { #ifndef CLIENT_DLL SetModel( GetWorldModel() ); VPhysicsDestroyObject(); if ( HasSpawnFlags( SF_NORESPAWN ) == false ) { SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_TRIGGER ); UTIL_DropToFloor( this, MASK_SOLID ); } else { if ( !VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, false ) ) { SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_TRIGGER ); } else { #if !defined( CLIENT_DLL ) // Constrained start? if ( HasSpawnFlags( SF_WEAPON_START_CONSTRAINED ) ) { //Constrain the weapon in place IPhysicsObject *pReferenceObject, *pAttachedObject; pReferenceObject = g_PhysWorldObject; pAttachedObject = VPhysicsGetObject(); if ( pReferenceObject && pAttachedObject ) { constraint_fixedparams_t fixed; fixed.Defaults(); fixed.InitWithCurrentObjectState( pReferenceObject, pAttachedObject ); fixed.constraint.forceLimit = lbs2kg( 10000 ); fixed.constraint.torqueLimit = lbs2kg( 10000 ); IPhysicsConstraint *pConstraint = GetConstraint(); pConstraint = physenv->CreateFixedConstraint( pReferenceObject, pAttachedObject, NULL, fixed ); pConstraint->SetGameData( (void *) this ); } } #endif //CLIENT_DLL } } SetPickupTouch(); SetThink( &CBaseCombatWeapon::FallThink ); SetNextThink( gpGlobals->curtime + 0.1f ); #endif }
void CHL2MP_Player::SetPlayerModel( void ) { const char *szModelName = NULL; const char *pszCurrentModelName = modelinfo->GetModelName( GetModel()); szModelName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_playermodel" ); if ( ValidatePlayerModel( szModelName ) == false ) { char szReturnString[512]; if ( ValidatePlayerModel( pszCurrentModelName ) == false ) { pszCurrentModelName = "models/Combine_Soldier.mdl"; } Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", pszCurrentModelName ); engine->ClientCommand ( edict(), szReturnString ); szModelName = pszCurrentModelName; } if ( GetTeamNumber() == TEAM_COMBINE ) { int nHeads = ARRAYSIZE( g_ppszRandomCombineModels ); g_iLastCombineModel = ( g_iLastCombineModel + 1 ) % nHeads; szModelName = g_ppszRandomCombineModels[g_iLastCombineModel]; m_iModelType = TEAM_COMBINE; } else if ( GetTeamNumber() == TEAM_REBELS ) { int nHeads = ARRAYSIZE( g_ppszRandomCitizenModels ); g_iLastCitizenModel = ( g_iLastCitizenModel + 1 ) % nHeads; szModelName = g_ppszRandomCitizenModels[g_iLastCitizenModel]; m_iModelType = TEAM_REBELS; } else { if ( Q_strlen( szModelName ) == 0 ) { szModelName = g_ppszRandomCitizenModels[0]; } if ( Q_stristr( szModelName, "models/human") ) { m_iModelType = TEAM_REBELS; } else { m_iModelType = TEAM_COMBINE; } } int modelIndex = modelinfo->GetModelIndex( szModelName ); if ( modelIndex == -1 ) { szModelName = "models/Combine_Soldier.mdl"; m_iModelType = TEAM_COMBINE; char szReturnString[512]; Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", szModelName ); engine->ClientCommand ( edict(), szReturnString ); } SetModel( szModelName ); SetupPlayerSoundsByModel( szModelName ); m_flNextModelChangeTime = gpGlobals->curtime + MODEL_CHANGE_INTERVAL; }
void CASW_Sentry_Top::SetTopModel() { SetModel(SENTRY_TOP_MODEL); }
void CHL2MP_Player::SetPlayerModel( void ) { const char *szModelName = NULL; const char *pszCurrentModelName = modelinfo->GetModelName( GetModel()); szModelName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_playermodel" ); if ( ValidatePlayerModel( szModelName ) == false ) { char szReturnString[512]; if ( ValidatePlayerModel( pszCurrentModelName ) == false ) pszCurrentModelName = "models/player/carebear.mdl"; Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", pszCurrentModelName ); engine->ClientCommand ( edict(), szReturnString ); szModelName = pszCurrentModelName; } if ( GetTeamNumber() == TEAM_PINK ) { m_nSkin = 0; m_iModelType = TEAM_PINK; szModelName = g_ppszRandomCitizenModels[0]; } else if ( GetTeamNumber() == TEAM_GREEN ) { m_nSkin = 2; m_iModelType = TEAM_GREEN; szModelName = g_ppszRandomCitizenModels[0]; } else { if ( Q_strlen( szModelName ) == 0 ) szModelName = g_ppszRandomCitizenModels[0]; if ( m_nSkin == 2 ) m_iModelType = TEAM_GREEN; else m_iModelType = TEAM_PINK; } int modelIndex = modelinfo->GetModelIndex( szModelName ); if ( modelIndex == -1 ) { szModelName = "models/player/carebear.mdl"; m_iModelType = TEAM_PINK; m_nSkin = 0; char szReturnString[512]; Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", szModelName ); engine->ClientCommand ( edict(), szReturnString ); } SetModel( szModelName ); SetupPlayerSoundsByModel( szModelName ); m_flNextModelChangeTime = gpGlobals->curtime + MODEL_CHANGE_INTERVAL; }
//----------------------------------------------------------------------------- // Place the canister in the world //----------------------------------------------------------------------------- CSkyCamera *CEnvHeadcrabCanister::PlaceCanisterInWorld() { CSkyCamera *pCamera = NULL; // Are we launching from a point? If so, use that point. if ( m_iszLaunchPositionName != NULL_STRING ) { // Get the launch position entity CBaseEntity *pLaunchPos = gEntList.FindEntityByName( NULL, m_iszLaunchPositionName ); if ( !pLaunchPos ) { Warning("%s (%s) could not find an entity matching LaunchPositionName of '%s'\n", GetEntityName().ToCStr(), GetDebugName(), STRING(m_iszLaunchPositionName) ); SUB_Remove(); } else { SetupWorldModel(); Vector vecForward, vecImpactDirection; GetVectors( &vecForward, NULL, NULL ); VectorMultiply( vecForward, -1.0f, vecImpactDirection ); m_Shared.InitInWorld( gpGlobals->curtime, pLaunchPos->GetAbsOrigin(), GetAbsAngles(), vecImpactDirection, m_vecImpactPosition, true ); SetThink( &CEnvHeadcrabCanister::HeadcrabCanisterWorldThink ); SetNextThink( gpGlobals->curtime ); } } else if ( DetectInSkybox() ) { pCamera = GetEntitySkybox(); SetModel( ENV_HEADCRABCANISTER_SKYBOX_MODEL ); SetSolid( SOLID_NONE ); Vector vecForward; GetVectors( &vecForward, NULL, NULL ); vecForward *= -1.0f; m_Shared.InitInSkybox( gpGlobals->curtime, m_vecImpactPosition, GetAbsAngles(), vecForward, m_vecImpactPosition, pCamera->m_skyboxData.origin, pCamera->m_skyboxData.scale ); AddEFlags( EFL_IN_SKYBOX ); SetThink( &CEnvHeadcrabCanister::HeadcrabCanisterSkyboxOnlyThink ); SetNextThink( gpGlobals->curtime + m_Shared.GetEnterWorldTime() + TICK_INTERVAL ); } else { Vector vecStartPosition, vecDirection; QAngle vecStartAngles; ComputeWorldEntryPoint( &vecStartPosition, &vecStartAngles, &vecDirection ); // Figure out which skybox to place the entity in. pCamera = GetCurrentSkyCamera(); if ( pCamera ) { m_Shared.InitInSkybox( gpGlobals->curtime, vecStartPosition, vecStartAngles, vecDirection, m_vecImpactPosition, pCamera->m_skyboxData.origin, pCamera->m_skyboxData.scale ); if ( m_Shared.IsInSkybox() ) { SetModel( ENV_HEADCRABCANISTER_SKYBOX_MODEL ); SetSolid( SOLID_NONE ); AddEFlags( EFL_IN_SKYBOX ); SetThink( &CEnvHeadcrabCanister::HeadcrabCanisterSkyboxThink ); SetNextThink( gpGlobals->curtime + m_Shared.GetEnterWorldTime() ); } else { SetThink( &CEnvHeadcrabCanister::HeadcrabCanisterWorldThink ); SetNextThink( gpGlobals->curtime ); } } else { m_Shared.InitInWorld( gpGlobals->curtime, vecStartPosition, vecStartAngles, vecDirection, m_vecImpactPosition ); SetThink( &CEnvHeadcrabCanister::HeadcrabCanisterWorldThink ); SetNextThink( gpGlobals->curtime ); } } Vector vecEndPosition; QAngle vecEndAngles; m_Shared.GetPositionAtTime( gpGlobals->curtime, vecEndPosition, vecEndAngles ); SetAbsOrigin( vecEndPosition ); SetAbsAngles( vecEndAngles ); return pCamera; }
void CItemMoney::Spawn( void ) { Precache( ); SetModel( MONEY_MODEL ); BaseClass::Spawn( ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CSprite::Spawn( void ) { SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NONE ); m_flFrame = 0; Precache(); SetModel( STRING( GetModelName() ) ); CollisionProp()->SetSurroundingBoundsType( USE_GAME_CODE ); m_flMaxFrame = (float)modelinfo->GetModelFrameCount( GetModel() ) - 1; AddEffects( EF_NOSHADOW | EF_NORECEIVESHADOW ); #if defined( CLIENT_DLL ) SetNextClientThink( CLIENT_THINK_ALWAYS ); #endif #if !defined( CLIENT_DLL ) if ( GetEntityName() != NULL_STRING && !(m_spawnflags & SF_SPRITE_STARTON) ) { TurnOff(); } else #endif { TurnOn(); } // Worldcraft only sets y rotation, copy to Z if ( GetLocalAngles().y != 0 && GetLocalAngles().z == 0 ) { QAngle angles = GetLocalAngles(); angles.z = angles.y; angles.y = 0; SetLocalAngles( angles ); } // Clamp our scale if necessary float scale = m_flSpriteScale; if ( scale < 0 || scale > MAX_SPRITE_SCALE ) { #if !defined( CLIENT_DLL ) #ifndef _LINUX DevMsg( "LEVEL DESIGN ERROR: Sprite %s with bad scale %f [0..%f]\n", GetDebugName(), m_flSpriteScale, MAX_SPRITE_SCALE ); #endif #endif scale = clamp( m_flSpriteScale, 0, MAX_SPRITE_SCALE ); } //Set our state SetBrightness( m_clrRender->a ); SetScale( scale ); #if defined( CLIENT_DLL ) m_flStartScale = m_flDestScale = m_flSpriteScale; m_nStartBrightness = m_nDestBrightness = m_nBrightness; #endif }
void CASW_Pickup_Weapon_Tesla_Trap::Spawn( void ) { Precache( ); SetModel( "models/items/Mine/mine.mdl"); BaseClass::Spawn( ); }
void Spawn( void ) { Precache( ); SetModel( "models/w_antidote.mdl" ); BaseClass::Spawn( ); }
void CASW_Pickup_Weapon_Medkit::Spawn( void ) { Precache( ); SetModel( "models/items/personalMedkit/personalMedkit.mdl"); BaseClass::Spawn( ); }
void StaticModel::SetModelAttr(const ResourceRef& value) { auto* cache = GetSubsystem<ResourceCache>(); SetModel(cache->GetResource<Model>(value.name_)); }
void CASW_Pickup_Weapon_Buff_Grenade::Spawn( void ) { Precache( ); SetModel( "models/items/Mine/mine.mdl"); BaseClass::Spawn( ); }
void EditorUI::Initialize () { optimizeOnLoad=true; archives.Load (); ilInit (); ilutInit(); ilutRenderer(ILUT_OPENGL); callback.ui = this; esTemp.Allocate (100 * 1024); objectViewer = new ObjectView (this, objectTree); uiIK = new IK_UI (&callback); uiTimeline = new TimelineUI (&callback); uiAnimTrackEditor = new AnimTrackEditorUI (&callback, uiTimeline); uiRotator = new RotatorUI; uiRotator->CreateUI(&callback); tools.SetEditor (&callback); tools.camera->button = selectCameraTool; tools.move->button = selectMoveTool; tools.rotate->button = selectRotateTool; tools.scale->button = selectScaleTool; tools.texmap->button = selectTextureTool; tools.color->button = selectColorTool; tools.flip->button = selectFlipTool; tools.LoadImages(); currentTool = tools.GetDefaultTool (); modelDrawer = new ModelDrawer; SetModel (new Model); UpdateTitle(); textureHandler = new TextureHandler (); for (set<string>::iterator arch=archives.archives.begin(); arch!=archives.archives.end(); ++arch) textureHandler->Load (arch->c_str()); textureGroupHandler = new TextureGroupHandler (textureHandler); textureGroupHandler->Load ((applicationPath + TextureGroupConfig).c_str()); UpdateTextureGroups(); InitTexBrowser(); uiMapping = new MappingUI (&callback); uiTexBuilder = new TexBuilderUI (0,0); LoadSettings(); // create 4 views if no views were specified in the config (ie: there was no config) if (!viewsGroup->children()) { viewsGroup->begin(); EditorViewWindow *views[4]; int vw = viewsGroup->w (); int vh = viewsGroup->h (); for (int a=0; a<4; a++) { int Xofs=(a&1)*vw/2; int Yofs=(a&2)*vh/4; int W=vw/2; int H=vh/2; if (Xofs) W = vw-Xofs; if (Yofs) H = vh-Yofs; views[a]=new EditorViewWindow (Xofs, Yofs, W,H, &callback); views[a]->SetMode(a); views[a]->bDrawRadius = false; } views[3]->rendermode = M3D_TEX; viewsGroup->end(); } }
void CASW_Pickup_Hornet_Barrage::Spawn( void ) { Precache( ); SetModel( "models/items/Mine/mine.mdl"); BaseClass::Spawn( ); }
void Spawn( void ) { Precache( ); SetModel( "models/items/357ammobox.mdl"); BaseClass::Spawn( ); }
void CASW_Pickup_Weapon_Flashlight::Spawn( void ) { Precache( ); SetModel( "models/swarm/flashlight/flashlightpickup.mdl"); BaseClass::Spawn( ); }
void Spawn( void ) { Precache( ); SetModel( "models/weapons/w_missile_closed.mdl"); BaseClass::Spawn( ); }
void CASW_Pickup_Weapon_Welder::Spawn( void ) { Precache( ); SetModel( "models/swarm/Welder/Welder.mdl"); BaseClass::Spawn( ); }
void Spawn( void ) { Precache( ); SetModel( "models/items/boxbuckshot.mdl"); BaseClass::Spawn( ); }
void CRuleBrushEntity::Spawn( void ) { SetModel( STRING( GetModelName() ) ); BaseClass::Spawn(); }
void Spawn( void ) { Precache( ); SetModel( "models/items/boxsrounds.mdl" ); BaseClass::Spawn( ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Ichthyosaur::Spawn( void ) { Precache(); SetModel( ICHTHYOSAUR_MODEL ); SetHullType(HULL_LARGE_CENTERED); SetHullSizeNormal(); SetDefaultEyeOffset(); SetNavType( NAV_FLY ); m_NPCState = NPC_STATE_NONE; SetBloodColor( BLOOD_COLOR_RED ); m_iHealth = sk_ichthyosaur_health.GetFloat(); m_iMaxHealth = m_iHealth; m_flFieldOfView = -0.707; // 270 degrees SetDistLook( 1024 ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); AddFlag( FL_FLY | FL_STEPMOVEMENT ); m_flGroundSpeed = ICH_SWIM_SPEED_RUN; m_bIgnoreSurface = false; m_flSwimSpeed = 0.0f; m_flTailYaw = 0.0f; m_flTailPitch = 0.0f; m_flNextBiteTime = gpGlobals->curtime; m_flHoldTime = gpGlobals->curtime; m_flNextPingTime = gpGlobals->curtime; m_flNextGrowlTime = gpGlobals->curtime; #if FEELER_COLLISION Vector forward; GetVectors( &forward, NULL, NULL ); m_vecCurrentVelocity = forward * m_flGroundSpeed; #endif //SetTouch( IchTouch ); CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_FLY | bits_CAP_INNATE_MELEE_ATTACK1 ); NPCInit(); //m_pSwimSound = ENVELOPE_CONTROLLER.SoundCreate( edict(), CHAN_BODY, "xxxCONVERTTOGAMESOUNDS!!!npc/ichthyosaur/ich_amb1wav", ATTN_NORM ); //m_pVoiceSound = ENVELOPE_CONTROLLER.SoundCreate( edict(), CHAN_VOICE, "xxxCONVERTTOGAMESOUNDS!!!npc/ichthyosaur/water_breathwav", ATTN_IDLE ); //ENVELOPE_CONTROLLER.Play( m_pSwimSound, 1.0f, 100 ); //ENVELOPE_CONTROLLER.Play( m_pVoiceSound,1.0f, 100 ); BaseClass::Spawn(); }