/* SRSendNewDatabase - send a change-database request to server * * psz name of new database. This name is rootpath'd as the * server may be operating on a different directory/drive */ void SRSendNewDatabase (PSZ psz) { char szFile[MAX_PATH]; { char szTmp[MAX_PATH]; rootpath (psz, szTmp); GetGlobalName (szTmp, szFile); } { HANDLE hServer; char sz[CBMSG]; sprintf (sz, "%s %s", CMD_SET_DATABASE, szFile); hServer = OpenDatabase (FALSE); SendSz (hServer, sz); CloseDatabase (hServer); } }
/* SRSendAddDirectory - send an index-file request to server * * psz name of file to be indexed. This name is rootpath'd as the * server may be operating on a different directory/drive */ void SRSendAddDirectory (PSZ psz) { char szFile[MAX_PATH]; { char szTmp[MAX_PATH]; rootpath (psz, szTmp); GetGlobalName (szTmp, szFile); } { HANDLE hServer; char sz[CBMSG]; sprintf (sz, "%s %s", CMD_ADD_DIRECTORY, szFile); printf ("%s", szFile); hServer = OpenDatabase (TRUE); SendSz (hServer, sz); CloseDatabase (hServer); printf ("\n"); } }
CMHandlerAddr CM_FIXEDARGS CMGetOperation(CMType targetType, CMconst_CMGlobalName operationType) { TOCObjectPtr theObject; TOCValuePtr theValue; ContainerPtr container; CM_CHAR *typeName; MetaHandlerPtr metaHandler; GetOpComArea getOpComArea; ExitIfBadType(targetType, NULL); /* validate targetType */ theObject = (TOCObjectPtr)targetType; container = theObject->container; /* Walk the entire object and look at all the values to find the value for a global */ /* name. The object can have other properties and values, but there better be only */ /* one global name. The object is walked with cmWalkObject(). The "refCon" we pass */ /* is a pointer to a communication area which will hold the count of the global name */ /* values and the pointer to it. As just mentioned, if the count comes back other */ /* than 1, we have an error. */ getOpComArea.theValue = NULL; /* init value ptr to no value yet */ getOpComArea.nbrOfGlobalNames = 0; /* there are no global names yet too*/ cmWalkObject(container, theObject, &getOpComArea, NULL, NULL, NULL, checkValue); /* Get the global name for this type. The type must have only one property, one value,*/ /* and that value must be for a global name. */ if (getOpComArea.nbrOfGlobalNames > 1) { /* must have exactly 1 global name */ ERROR2(CM_err_AmbiguousType, "CMGetOperation", CONTAINERNAME); return (NULL); } if (getOpComArea.nbrOfGlobalNames == 0) { ERROR2(CM_err_TypeNotGlobal, "CMGetOperation", CONTAINERNAME); return (NULL); } /* Set the typeName to point at the global name now that we're happy there is one... */ theValue = getOpComArea.theValue; if (theValue == NULL) return (NULL); /* safety */ typeName = GetGlobalName(theValue->value.globalName.globalNameSymbol); /* Use the global name to look up the metahandler in the meta handler symbol table. */ /* A few things can go wrong here, but if we successfully found a metahandler symbol */ /* table entry we use the resulting metahandler proc pointer to get the routine */ /* address for the input operationType. That's what we return. */ if ((metaHandler = cmLookupMetaHandler((CM_UCHAR *)typeName, SESSION)) == NULL) { ERROR1(CM_err_UndefMetaHandler, typeName); return (NULL); } if (!SessionSuccess) { /* if allocation error... */ ERROR1(CM_err_HandlerError, typeName); /* ...yell */ return (NULL); } return ((CMHandlerAddr)(*metaHandler->metaHandler)(NULL, operationType)); }
//========================================================= //========================================================= void CBasePlayer::CheatImpulseCommands( int iImpulse ) { if( !UTIL_CheatsAllowed() ) { return; } switch( iImpulse ) { case 76: { if( !g_bPrecacheGrunt ) { g_bPrecacheGrunt = true; ALERT( at_console, "You must now restart to use Grunt-o-matic.\n" ); } else { UTIL_MakeVectors( Vector( 0, GetViewAngle().y, 0 ) ); Create( "monster_human_grunt", GetAbsOrigin() + gpGlobals->v_forward * 128, GetAbsAngles() ); } break; } case 101: { gEvilImpulse101 = true; GiveNamedItem( "item_suit" ); GiveNamedItem( "item_battery" ); GiveNamedItem( "weapon_crowbar" ); GiveNamedItem( "weapon_9mmhandgun" ); GiveNamedItem( "ammo_9mmclip" ); GiveNamedItem( "weapon_shotgun" ); GiveNamedItem( "ammo_buckshot" ); GiveNamedItem( "weapon_9mmAR" ); GiveNamedItem( "ammo_9mmAR" ); GiveNamedItem( "ammo_ARgrenades" ); GiveNamedItem( "weapon_handgrenade" ); GiveNamedItem( "weapon_tripmine" ); GiveNamedItem( "weapon_357" ); GiveNamedItem( "ammo_357" ); GiveNamedItem( "weapon_crossbow" ); GiveNamedItem( "ammo_crossbow" ); GiveNamedItem( "weapon_egon" ); GiveNamedItem( "weapon_gauss" ); GiveNamedItem( "ammo_gaussclip" ); GiveNamedItem( "weapon_rpg" ); GiveNamedItem( "ammo_rpgclip" ); GiveNamedItem( "weapon_satchel" ); GiveNamedItem( "weapon_snark" ); GiveNamedItem( "weapon_hornetgun" ); #if USE_OPFOR GiveNamedItem( "weapon_knife" ); GiveNamedItem( "weapon_pipewrench" ); GiveNamedItem( "weapon_grapple" ); GiveNamedItem( "weapon_eagle" ); GiveNamedItem( "weapon_m249" ); GiveNamedItem( "weapon_displacer" ); GiveNamedItem( "weapon_sniperrifle" ); GiveNamedItem( "weapon_sporelauncher" ); GiveNamedItem( "weapon_shockrifle" ); GiveNamedItem( "ammo_556" ); GiveNamedItem( "ammo_762" ); #endif gEvilImpulse101 = false; break; } case 102: { // Gibbage!!! CGib::SpawnRandomGibs( this, 1, 1 ); break; } case 103: { // What the hell are you doing? auto pEntity = UTIL_FindEntityForward( this ); if( pEntity ) { CBaseMonster *pMonster = pEntity->MyMonsterPointer(); if( pMonster ) pMonster->ReportAIState(); } break; } case 104: { // Dump all of the global state varaibles (and global entity names) gGlobalState.DumpGlobals(); break; } case 105:// player makes no sound for monsters to hear. { if( m_fNoPlayerSound ) { ALERT( at_console, "Player is audible\n" ); m_fNoPlayerSound = false; } else { ALERT( at_console, "Player is silent\n" ); m_fNoPlayerSound = true; } break; } case 106: { // Give me the classname and targetname of this entity. auto pEntity = UTIL_FindEntityForward( this ); if( pEntity ) { ALERT( at_console, "Classname: %s", pEntity->GetClassname() ); if( pEntity->HasTargetname() ) { ALERT( at_console, " - Targetname: %s\n", pEntity->GetTargetname() ); } else { ALERT( at_console, " - TargetName: No Targetname\n" ); } ALERT( at_console, "Model: %s\n", pEntity->GetModelName() ); if( HasGlobalName() ) ALERT( at_console, "Globalname: %s\n", pEntity->GetGlobalName() ); } break; } case 107: { TraceResult tr; CBaseEntity* pWorld = CWorld::GetInstance(); Vector start = GetAbsOrigin() + GetViewOffset(); Vector end = start + gpGlobals->v_forward * 1024; UTIL_TraceLine( start, end, ignore_monsters, edict(), &tr ); if( tr.pHit ) pWorld = CBaseEntity::Instance( tr.pHit ); const texture_t* pTexture = UTIL_TraceTexture( pWorld, start, end ); if( pTexture ) ALERT( at_console, "Texture: %s\n", pTexture->name ); break; } case 195:// show shortest paths for entire level to nearest node { Create( "node_viewer_fly", GetAbsOrigin(), GetAbsAngles() ); break; } case 196:// show shortest paths for entire level to nearest node { Create( "node_viewer_large", GetAbsOrigin(), GetAbsAngles() ); break; } case 197:// show shortest paths for entire level to nearest node { Create( "node_viewer_human", GetAbsOrigin(), GetAbsAngles() ); break; } case 199:// show nearest node and all connections { ALERT( at_console, "%d\n", WorldGraph.FindNearestNode( GetAbsOrigin(), bits_NODE_GROUP_REALM ) ); WorldGraph.ShowNodeConnections( WorldGraph.FindNearestNode( GetAbsOrigin(), bits_NODE_GROUP_REALM ) ); break; } case 202:// Random blood splatter { UTIL_MakeVectors( GetViewAngle() ); TraceResult tr; UTIL_TraceLine( GetAbsOrigin() + GetViewOffset(), GetAbsOrigin() + GetViewOffset() + gpGlobals->v_forward * 128, ignore_monsters, ENT( pev ), &tr ); if( tr.flFraction != 1.0 ) {// line hit something, so paint a decal auto pBlood = static_cast< CBloodSplat* >( UTIL_CreateNamedEntity( "blood_splat" ) ); pBlood->CreateSplat( this ); } break; } case 203:// remove creature. { auto pEntity = UTIL_FindEntityForward( this ); if( pEntity ) { if( pEntity->GetTakeDamageMode() != DAMAGE_NO ) pEntity->SetThink( &CBaseEntity::SUB_Remove ); } break; } } }