void asw_room_info_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if ( pPlayer && pPlayer->GetMarine() && missionchooser && missionchooser->RandomMissions() ) { IASW_Room_Details *pRoom = missionchooser->RandomMissions()->GetRoomDetails( pPlayer->GetMarine()->GetAbsOrigin() ); if ( !pRoom ) { Msg(" Couldn't find room\n" ); } else { char buf[MAX_PATH]; pRoom->GetFullRoomName( buf, MAX_PATH ); Msg( " Room name: %s\n", buf ); Msg( " Room tags: " ); int nNumTags = pRoom->GetNumTags(); for ( int i = 0; i < nNumTags; ++ i ) { Msg( "%s ", pRoom->GetTag( i ) ); } Msg( "\n" ); } } }
void asw_test_turret_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer && pPlayer->GetMarine()) { CASW_Marine *pMarine = pPlayer->GetMarine(); if (pMarine->m_hRemoteTurret.Get()) { pMarine->m_hRemoteTurret->StopUsingTurret();//m_hUser = NULL; pMarine->m_hRemoteTurret = NULL; return; } CBaseEntity* pEntity = NULL; while ((pEntity = gEntList.FindEntityByClassname( pEntity, "asw_remote_turret" )) != NULL) { CASW_Remote_Turret* pTurret = dynamic_cast<CASW_Remote_Turret*>(pEntity); if (pTurret) { pTurret->StartedUsingTurret(pMarine); pMarine->m_hRemoteTurret = pTurret; Msg("Set turret\n"); return; } } } Msg("Failed to find a turret\n"); }
void asw_path_end_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if ( !pPlayer || !ASWPathUtils() ) return; if ( !pPlayer->GetMarine() ) return; Vector vecPathEnd = pPlayer->GetMarine()->GetAbsOrigin(); debugoverlay->AddBoxOverlay( g_vecPathStart, Vector(-10, -10, -10 ), Vector(10, 10, 10) , vec3_angle, 255, 0, 0, 255, 30.0f ); debugoverlay->AddBoxOverlay( vecPathEnd, Vector(-10, -10, -10 ), Vector(10, 10, 10) , vec3_angle, 255, 255, 0, 255, 30.0f ); AI_Waypoint_t *pWaypoint = ASWPathUtils()->BuildRoute( g_vecPathStart, vecPathEnd, NULL, 100, NAV_NONE, bits_BUILD_GET_CLOSE ); if ( !pWaypoint ) { Msg( "Failed to find route\n" ); return; } if ( UTIL_ASW_DoorBlockingRoute( pWaypoint, true ) ) { Msg(" Route blocked by sealed/locked door\n" ); } ASWPathUtils()->DebugDrawRoute( g_vecPathStart, pWaypoint ); }
void asw_suicide_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer && pPlayer->GetMarine() && pPlayer->GetMarine()->GetHealth() > 0) { pPlayer->GetMarine()->Suicide(); } }
void asw_stop_burning_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer && pPlayer->GetMarine()) { CASW_Marine *pMarine = pPlayer->GetMarine(); pMarine->Extinguish(); } }
void asw_build_speech_durations_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer || !MarineProfileList() || !pPlayer->GetMarine()) return; Msg("Saving speech durations..."); MarineProfileList()->SaveSpeechDurations(pPlayer->GetMarine()); Msg("Done!\n"); }
void ShootMe() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if ( pPlayer->GetMarine() ) { CTakeDamageInfo dmgInfo( pPlayer, pPlayer, 3, DMG_BULLET ); Vector vecDir = RandomVector(-1, 1); trace_t tr; pPlayer->GetMarine()->DispatchTraceAttack( dmgInfo, vecDir, &tr ); } }
void asw_path_start_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if ( !pPlayer || !ASWPathUtils() ) return; if ( !pPlayer->GetMarine() ) return; g_vecPathStart = pPlayer->GetMarine()->GetAbsOrigin(); }
void ASW_PhysicsShove_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer && pPlayer->GetMarine()) { if (pPlayer->GetMarine()->GetFlags() & FL_FROZEN) // don't allow this if the marine is frozen return; pPlayer->GetMarine()->PhysicsShove(); } }
void cc_asw_inventory() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if ( pPlayer->GetMarine() ) { for (int i=0;i<pPlayer->GetMarine()->WeaponCount();i++) { CBaseEntity *pWeapon = pPlayer->GetMarine()->GetWeapon(i); if ( pWeapon ) { Msg(" Inventory[%d] = %s (%d)\n", i, pWeapon->GetClassname(), pWeapon->entindex() ); } } } }
void asw_ragdoll_marine_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); static CRagdollProp * s_pRagdoll = NULL; if (pPlayer && pPlayer->GetMarine()) { CASW_Marine* pMarine = pPlayer->GetMarine(); pMarine->SetKnockedOut(!pMarine->m_bKnockedOut); return; if (pMarine->IsEffectActive(EF_NODRAW) && s_pRagdoll) { //Calcs the diff between ragdoll worldspace center and victim worldspace center, moves the victim by this diff. //Sets the victim's angles to 0, ragdoll yaw, 0 QAngle newAngles( 0, s_pRagdoll->GetAbsAngles()[YAW], 0 ); Vector centerDelta = s_pRagdoll->WorldSpaceCenter() - pMarine->WorldSpaceCenter(); centerDelta.z = 0; // don't put us in the floor Vector newOrigin = pMarine->GetAbsOrigin() + centerDelta; pMarine->SetAbsOrigin( newOrigin ); pMarine->SetAbsAngles( newAngles ); //DetachAttachedRagdoll( s_pRagdoll ); // unnecessary since we remove it next? UTIL_Remove( s_pRagdoll ); pMarine->RemoveEffects( EF_NODRAW ); pMarine->RemoveSolidFlags( FSOLID_NOT_SOLID ); } else { pMarine->InvalidateBoneCache(); pMarine->AddSolidFlags( FSOLID_NOT_SOLID ); CTakeDamageInfo info; info.SetDamageType( DMG_GENERIC ); info.SetDamageForce( vec3_origin ); info.SetDamagePosition( pMarine->WorldSpaceCenter() ); s_pRagdoll = (CRagdollProp*) CreateServerRagdoll( pMarine, 0, info, COLLISION_GROUP_NONE ); if ( s_pRagdoll ) { s_pRagdoll->DisableAutoFade(); s_pRagdoll->SetThink( NULL ); s_pRagdoll->SetUnragdoll( pMarine ); } pMarine->AddEffects( EF_NODRAW ); //pMarine->SetupBones( m_pRagdollBones, BONE_USED_BY_ANYTHING ); } } }
void asw_drop_ammo_f(const CCommand &args) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pMarine) return; int iBagSlot = atoi(args[1]); CASW_Weapon_Ammo_Bag *pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(0)); if (pBag) { if (pBag->DropAmmoPickup(iBagSlot)) { return; } } pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(1)); if (pBag) { if (pBag->DropAmmoPickup(iBagSlot)) { return; } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CASW_Prediction::SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move ) { // Call the default SetupMove code. BaseClass::SetupMove( player, ucmd, pHelper, move ); CASW_Player *pASWPlayer = static_cast<CASW_Player*>( player ); if ( !asw_allow_detach.GetBool() ) { if ( pASWPlayer && pASWPlayer->GetMarine() ) { // this forces horizontal movement move->m_vecAngles.x = 0; move->m_vecViewAngles.x = 0; } } CBaseEntity *pMoveParent = player->GetMoveParent(); if (!pMoveParent) { move->m_vecAbsViewAngles = move->m_vecViewAngles; } else { matrix3x4_t viewToParent, viewToWorld; AngleMatrix( move->m_vecViewAngles, viewToParent ); ConcatTransforms( pMoveParent->EntityToWorldTransform(), viewToParent, viewToWorld ); MatrixAngles( viewToWorld, move->m_vecAbsViewAngles ); } CASW_MoveData *pASWMove = static_cast<CASW_MoveData*>( move ); pASWMove->m_iForcedAction = ucmd->forced_action; // setup trace optimization g_pGameMovement->SetupMovementBounds( move ); }
// creates a batch of aliens at the mouse cursor void asw_alien_batch_f( const CCommand& args ) { MDLCACHE_CRITICAL_SECTION(); bool allowPrecache = CBaseEntity::IsPrecacheAllowed(); CBaseEntity::SetAllowPrecache( true ); // find spawn point CASW_Player* pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pMarine) return; trace_t tr; Vector forward; AngleVectors( pMarine->EyeAngles(), &forward ); UTIL_TraceLine(pMarine->EyePosition(), pMarine->EyePosition() + forward * 300.0f,MASK_SOLID, pMarine, COLLISION_GROUP_NONE, &tr ); if ( tr.fraction != 0.0 ) { // trace to the floor from this spot Vector vecSrc = tr.endpos; tr.endpos.z += 12; UTIL_TraceLine( vecSrc + Vector(0, 0, 12), vecSrc - Vector( 0, 0, 512 ) ,MASK_SOLID, pMarine, COLLISION_GROUP_NONE, &tr ); ASWSpawnManager()->SpawnAlienBatch( "asw_parasite", 25, tr.endpos, vec3_angle ); } CBaseEntity::SetAllowPrecache( allowPrecache ); }
void asw_test_marinenearby_f(const CCommand &args) { Msg("0.5 as float = %f\n", 0.5f); Msg("0.5f as int = %d\n", (int) 0.5f); Msg("0.51f as int = %d\n", (int) 0.51f); Msg("0.52f as int = %d\n", (int) 0.52f); Msg("0.6f as int = %d\n", (int) 0.6f); Msg("0.56f as int = %d\n", (int) 0.56f); Msg("0.49f as int = %d\n", (int) 0.49f); Msg("1.99f as int = %d\n", (int) 1.99f); Msg("2.01f as int = %d\n", (int) 2.01f); CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!ASWGameRules()) return; if (!pPlayer || !pPlayer->GetMarine()) return; if ( args.ArgC() < 4 ) { Msg("Usage: asw_test_marinenearby [0|1] [grid step] [grid count]\n"); } int iWide = atoi(args[1]); float fGridStep = atof(args[2]); int iGridCount = atoi(args[3]); //Msg("Wide = %d, step = %f, count = %d\n", iWide, fGridStep, iGridCount); Vector asw_default_camera_dir_2; QAngle test_angle(asw_marine_nearby_angle.GetFloat(), 90, 0); AngleVectors(test_angle, &asw_default_camera_dir_2); Vector asw_default_camera_offset_2 = asw_default_camera_dir_2 * -405.0f; for (int x=-iGridCount;x<iGridCount;x++) { for (int y=-iGridCount;y<iGridCount*3;y++) { Vector pos = pPlayer->GetMarine()->GetAbsOrigin() + Vector(x * fGridStep, y*fGridStep, 10); //Msg("Testing pos %f, %f, %f\n", pos.x, pos.y, pos.z); bool bCorpseCanSee = false; UTIL_ASW_AnyMarineCanSee(pos, iWide, bCorpseCanSee); } } Vector pos = (pPlayer->GetMarine()->GetAbsOrigin() + asw_default_camera_offset_2); //NDebugOverlay::Line(pos, pos + asw_default_camera_dir_2 * 410, 0,0,255,true, 30); }
void asw_LeaveMarinef() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());; if (pPlayer && pPlayer->GetMarine()) { pPlayer->LeaveMarines(); } }
void HurtMyMarinef() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer && pPlayer->GetMarine()) { CASW_Marine *marine = pPlayer->GetMarine(); CTakeDamageInfo damageinfo( marine, marine, Vector(1,1,1), marine->GetAbsOrigin(), 10, DMG_BULLET ); /*vDamagePosition, m_iDamage, DMG_SLASH ); CTakeDamageInfo( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, int iKillType = 0 ); CTakeDamageInfo( CBaseEntity *pInflictor, CBaseEntity *pAttacker, const Vector &damageForce, const Vector &damagePosition, float flDamage, int bitsDamageType, int iKillType = 0, Vector *reportedPosition = NULL );*/ pPlayer->GetMarine()->TakeDamage(damageinfo); } }
void asw_corpse_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!ASWGameRules()) return; if (!pPlayer || !pPlayer->GetMarine()) return; CASW_Game_Resource* pGameResource = ASWGameResource(); if (!pGameResource) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pPlayer->GetMarine()->GetMarineProfile()) return; QAngle facing = pMarine->GetAbsAngles(); Vector forward; AngleVectors(facing, &forward); Vector pos = pMarine->GetAbsOrigin() + forward * 100.0f; //CBaseEntity *pGib = CreateRagGib( "models/swarm/colonist/male/malecolonist.mdl", pos, facing, Vector(0,0,0) ); }
void ASW_DropTest_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());; if (pPlayer && pPlayer->GetMarine()) { CASW_Marine *pMarine = pPlayer->GetMarine(); if (pMarine->GetFlags() & FL_FROZEN) // don't allow this if the marine is frozen return; if (pPlayer->GetFlags() & FL_FROZEN) return; int c = pMarine->WeaponCount(); int current = -1; //int target = 0; for (int i=0;i<c;i++) { CBaseCombatWeapon *pWeapon = pMarine->GetWeapon(i); if (pWeapon == pMarine->GetActiveWeapon()) { current = i; break; } } if (current == -1) return; pMarine->DropWeapon(current); IGameEvent * event = gameeventmanager->CreateEvent( "player_dropped_weapon" ); if ( event ) { event->SetInt( "userid", pPlayer->GetUserID() ); gameeventmanager->FireEvent( event ); } } }
void asw_conv_f(const CCommand &args) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!ASWGameRules()) return; if (!pPlayer || !pPlayer->GetMarine()) return; CASW_Game_Resource* pGameResource = ASWGameResource(); if (!pGameResource) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pPlayer->GetMarine()->GetMarineProfile()) return; if ( args.ArgC() < 2 ) { Msg("Usage: asw_conv [conv num] "); return; } CASW_MarineSpeech::StartConversation(atoi(args[1]), pMarine); }
void cc_stuck( const CCommand &args ) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pMarine) return; if ( !pMarine->TeleportStuckMarine() ) { Msg("Error, couldn't find a valid free info_node to teleport to!\n"); } }
void asw_conversation_f(const CCommand &args) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pMarine) return; if (args.ArgC() < 2) { Msg("Usage: asw_conversation [conversation number]\n"); } int iConv = atoi(args[1]); CASW_MarineSpeech::StartConversation(iConv, pMarine); }
void CASW_Weapon_Pistol::ItemPostFrame( void ) { BaseClass::ItemPostFrame(); if ( m_bInReload ) return; CASW_Player *pOwner = GetCommander(); if ( pOwner == NULL || pOwner->GetMarine() != GetOwner() ) return; //Allow a refire as fast as the player can click if ( ( ( pOwner->m_nButtons & IN_ATTACK ) == false ) && ( m_flSoonestPrimaryAttack < gpGlobals->curtime ) ) { m_flNextPrimaryAttack = gpGlobals->curtime - 0.1f; } }
void asw_set_solid_f( const CCommand &args ) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer == NULL) { Msg("Couldn't find local player."); return; } if (args.ArgC() != 2) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pMarine) return; pMarine->SetSolid((SolidType_t) atoi(args[1])); }
void CASW_Weapon::LowAmmoSound() { CASW_Player *pPlayer = GetCommander(); if ( GetOwner() && pPlayer && pPlayer->GetMarine() == GetOwner() ) { CSingleUserRecipientFilter filter( pPlayer ); if ( IsPredicted() && CBaseEntity::GetPredictionPlayer() ) { filter.UsePredictionRules(); } CSoundParameters params; if ( !GetParametersForSound( "ASW_Weapon.LowAmmoClick", params, NULL ) ) return; EmitSound_t playparams(params); EmitSound( filter, GetOwner()->entindex(), playparams ); } }
void asw_hide_marine_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer && pPlayer->GetMarine()) { if (pPlayer->GetMarine()->IsEffectActive(EF_NODRAW)) { pPlayer->GetMarine()->RemoveEffects( EF_NODRAW ); if (pPlayer->GetMarine()->GetActiveWeapon()) pPlayer->GetMarine()->GetActiveWeapon()->RemoveEffects( EF_NODRAW ); } else { pPlayer->GetMarine()->AddEffects( EF_NODRAW ); if (pPlayer->GetMarine()->GetActiveWeapon()) pPlayer->GetMarine()->GetActiveWeapon()->AddEffects( EF_NODRAW ); } } }
void asw_solid_info_f(void) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer == NULL) { Msg("Couldn't find local player."); return; } CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pMarine) return; int solid0 = pMarine->GetSolid(); int nSolidFlags0 = pMarine->GetSolidFlags(); int movetype0 = pMarine->GetMoveType(); Msg("Marine(%d} solid=%d solidflags=%d movetype=%d\n", pMarine->entindex(), solid0, nSolidFlags0, movetype0); }
//----------------------------------------------------------------------------- // Purpose: Only send to local player if this weapon is the active weapon and this marine is the active marine // Input : *pStruct - // *pVarData - // *pRecipients - // objectID - // Output : void* //----------------------------------------------------------------------------- void* SendProxy_SendASWActiveLocalWeaponDataTable( const SendProp *pProp, const void *pStruct, const void *pVarData, CSendProxyRecipients *pRecipients, int objectID ) { // Get the weapon entity CASW_Weapon *pWeapon = (CASW_Weapon*)pVarData; if ( pWeapon ) { // Only send this chunk of data to the commander of the marine carrying this weapon CASW_Player *pPlayer = pWeapon->GetCommander(); if ( pPlayer && pPlayer->GetMarine() == pWeapon->GetOwner() ) { pRecipients->SetOnly( pPlayer->GetClientIndex() ); } else { pRecipients->ClearAllRecipients(); } } return (void*)pVarData; }
void CMOD_Player_Performance::WriteToHUD(const char* messagename, int rating) { #if 0 for ( int i=0;i<ASWGameResource()->GetMaxMarineResources();i++ ) { CASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource(i); if ( !pMR ) continue; CASW_Player *pPlayer = pMR->GetCommander(); if ( pPlayer && pPlayer->GetMarine() ) { CSingleUserRecipientFilter user( pPlayer ); UserMessageBegin( user, messagename ); WRITE_SHORT( rating ); MessageEnd(); } } #endif }
void asw_medal_info_f(const CCommand &args) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!ASWGameRules()) return; if (!pPlayer || !pPlayer->GetMarine()) return; CASW_Game_Resource* pGameResource = ASWGameResource(); if (!pGameResource) return; if ( args.ArgC() < 2 ) { Msg("Usage: asw_medal_info [marine info num from 0-3]"); return; } int i = atoi(args[1]); if (pGameResource->GetMarineResource(i)) pGameResource->GetMarineResource(i)->DebugMedalStats(); }