这篇教程C++ sp_ftoc函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sp_ftoc函数的典型用法代码示例。如果您正苦于以下问题:C++ sp_ftoc函数的具体用法?C++ sp_ftoc怎么用?C++ sp_ftoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sp_ftoc函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetAbsAnglesstatic cell_t GetAbsAngles(IPluginContext *pContext, const cell_t *params){ int client = params[1]; CPlayer *pPlayer = g_Players.GetPlayerByIndex(client); if (!pPlayer) { return pContext->ThrowNativeError("Client index %d is invalid", client); } else if (!pPlayer->IsInGame()) { return pContext->ThrowNativeError("Client %d is not in game", client); } IPlayerInfo *pInfo = pPlayer->GetPlayerInfo(); if (!pInfo) { return pContext->ThrowNativeError("IPlayerInfo not supported by game"); } cell_t *pAng; pContext->LocalToPhysAddr(params[2], &pAng); QAngle ang = pInfo->GetAbsAngles(); pAng[0] = sp_ftoc(ang.x); pAng[1] = sp_ftoc(ang.y); pAng[2] = sp_ftoc(ang.z); return 1;}
开发者ID:pmrowla,项目名称:sourcemod-1.5,代码行数:28,
示例2: GetPlayerMaxsstatic cell_t GetPlayerMaxs(IPluginContext *pContext, const cell_t *params){ int client = params[1]; CPlayer *pPlayer = g_Players.GetPlayerByIndex(client); if (!pPlayer) { return pContext->ThrowNativeError("Client index %d is invalid", client); } else if (!pPlayer->IsInGame()) { return pContext->ThrowNativeError("Client %d is not in game", client); } IPlayerInfo *pInfo = pPlayer->GetPlayerInfo(); if (!pInfo) { return pContext->ThrowNativeError("IPlayerInfo not supported by game"); } cell_t *pVec; pContext->LocalToPhysAddr(params[2], &pVec); Vector vec = pInfo->GetPlayerMaxs(); pVec[0] = sp_ftoc(vec.x); pVec[1] = sp_ftoc(vec.y); pVec[2] = sp_ftoc(vec.z); return 1;}
开发者ID:pmrowla,项目名称:sourcemod-1.5,代码行数:28,
示例3: GameRules_GetPropVectorstatic cell_t GameRules_GetPropVector(IPluginContext *pContext, const cell_t *params){ char *prop; int element = params[3]; int offset; int bit_count; void *pGameRules = GameRules(); if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, "")) return pContext->ThrowNativeError("Gamerules lookup failed."); pContext->LocalToString(params[1], &prop); FIND_PROP_SEND(DPT_Vector, "vector"); Vector *v = (Vector *)((intptr_t)pGameRules + offset); cell_t *vec; pContext->LocalToPhysAddr(params[2], &vec); vec[0] = sp_ftoc(v->x); vec[1] = sp_ftoc(v->y); vec[2] = sp_ftoc(v->z); return 1;
开发者ID:DJLaca,项目名称:sourcemod,代码行数:26,
示例4: smn_BfReadAnglesstatic cell_t smn_BfReadAngles(IPluginContext *pCtx, const cell_t *params){ Handle_t hndl = static_cast<Handle_t>(params[1]); HandleError herr; HandleSecurity sec; bf_read *pBitBuf; sec.pOwner = NULL; sec.pIdentity = g_pCoreIdent; if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf)) != HandleError_None) { return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr); } cell_t *pAng; pCtx->LocalToPhysAddr(params[2], &pAng); QAngle ang; pBitBuf->ReadBitAngles(ang); pAng[0] = sp_ftoc(ang.x); pAng[1] = sp_ftoc(ang.y); pAng[2] = sp_ftoc(ang.z); return 1;}
开发者ID:Doldol,项目名称:sourcemod,代码行数:28,
示例5: GetClientEyePositionstatic cell_t GetClientEyePosition(IPluginContext *pContext, const cell_t *params){ IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]); if (player == NULL) { return pContext->ThrowNativeError("Invalid client index %d", params[1]); } if (!player->IsInGame()) { return pContext->ThrowNativeError("Client %d is not in game", params[1]); } Vector pos;#if SOURCE_ENGINE == SE_DOTA serverClients->ClientEarPosition(params[1], &pos);#else serverClients->ClientEarPosition(player->GetEdict(), &pos);#endif cell_t *addr; pContext->LocalToPhysAddr(params[2], &addr); addr[0] = sp_ftoc(pos.x); addr[1] = sp_ftoc(pos.y); addr[2] = sp_ftoc(pos.z); return 1;}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:27,
示例6: smn_BfReadVecNormalstatic cell_t smn_BfReadVecNormal(IPluginContext *pCtx, const cell_t *params){ Handle_t hndl = static_cast<Handle_t>(params[1]); HandleError herr; HandleSecurity sec; bf_read *pBitBuf; sec.pOwner = NULL; sec.pIdentity = g_pCoreIdent; if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf)) != HandleError_None) { return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr); } cell_t *pVec; pCtx->LocalToPhysAddr(params[2], &pVec); Vector vec; pBitBuf->ReadBitVec3Normal(vec); pVec[0] = sp_ftoc(vec.x); pVec[1] = sp_ftoc(vec.y); pVec[2] = sp_ftoc(vec.z); return 1;}
开发者ID:asceth,项目名称:synapi,代码行数:28,
示例7: smn_PbReadVector2Dstatic cell_t smn_PbReadVector2D(IPluginContext *pCtx, const cell_t *params){ GET_MSG_FROM_HANDLE_OR_ERR(); GET_FIELD_NAME_OR_ERR(); cell_t *out; pCtx->LocalToPhysAddr(params[3], &out); Vector2D vec; int index = params[0] >= 4 ? params[4] : -1; if (index < 0) { if (!msg->GetVector2D(strField, &vec)) { return pCtx->ThrowNativeError("Invalid field /"%s/" for message /"%s/"", strField, msg->GetProtobufMessage()->GetTypeName().c_str()); } } else { if (!msg->GetRepeatedVector2D(strField, index, &vec)) { return pCtx->ThrowNativeError("Invalid field /"%s/"[%d] for message /"%s/"", strField, index, msg->GetProtobufMessage()->GetTypeName().c_str()); } } out[0] = sp_ftoc(vec.x); out[1] = sp_ftoc(vec.y); return 1;}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:30,
示例8: smn_TEReadVectorstatic cell_t smn_TEReadVector(IPluginContext *pContext, const cell_t *params){ if (!g_TEManager.IsAvailable()) { return pContext->ThrowNativeError("TempEntity System unsupported or not available, file a bug report"); } if (!g_CurrentTE) { return pContext->ThrowNativeError("No TempEntity call is in progress"); } char *prop; pContext->LocalToString(params[1], &prop); cell_t *addr; float vec[3]; pContext->LocalToPhysAddr(params[2], &addr); if (!g_CurrentTE->TE_GetEntDataVector(prop, vec)) { return pContext->ThrowNativeError("Temp entity property /"%s/" not found", prop); } addr[0] = sp_ftoc(vec[0]); addr[1] = sp_ftoc(vec[1]); addr[2] = sp_ftoc(vec[2]); return 1;}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:29,
示例9: GetClientEyeAnglesstatic cell_t GetClientEyeAngles(IPluginContext *pContext, const cell_t *params){ IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(params[1]); if (!pPlayer) { return pContext->ThrowNativeError("Invalid client index %d", params[1]); } else if (!pPlayer->IsInGame()) { return pContext->ThrowNativeError("Client %d is not in game", params[1]); } edict_t *pEdict = pPlayer->GetEdict(); CBaseEntity *pEntity = pEdict->GetUnknown() ? pEdict->GetUnknown()->GetBaseEntity() : NULL; /* We always set the angles for backwards compatibility -- * The original function had no return value. */ QAngle angles; bool got_angles = false; if (pEntity != NULL) { got_angles = GetEyeAngles(pEntity, &angles); } cell_t *addr; pContext->LocalToPhysAddr(params[2], &addr); addr[0] = sp_ftoc(angles.x); addr[1] = sp_ftoc(angles.y); addr[2] = sp_ftoc(angles.z); return got_angles ? 1 : 0;}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:35,
示例10: sp_ftocvoid SoundHooks::OnEmitAmbientSound(CEntityIndex index, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay){ int entindex = index.Get();#elsevoid SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay){#endif SoundHookIter iter; IPluginFunction *pFunc; cell_t vec[3] = {sp_ftoc(pos.x), sp_ftoc(pos.y), sp_ftoc(pos.z)}; cell_t res = static_cast<ResultType>(Pl_Continue); char buffer[PLATFORM_MAX_PATH]; strcpy(buffer, samp); for (iter=m_AmbientFuncs.begin(); iter!=m_AmbientFuncs.end(); iter++) { pFunc = (*iter); pFunc->PushStringEx(buffer, sizeof(buffer), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); pFunc->PushCellByRef(&entindex); pFunc->PushFloatByRef(&vol); pFunc->PushCellByRef(reinterpret_cast<cell_t *>(&soundlevel)); pFunc->PushCellByRef(&pitch); pFunc->PushArray(vec, 3, SM_PARAM_COPYBACK); pFunc->PushCellByRef(&fFlags); pFunc->PushFloatByRef(&delay); g_InSoundHook = true; pFunc->Execute(&res); g_InSoundHook = false; switch (res) { case Pl_Handled: case Pl_Stop: { RETURN_META(MRES_SUPERCEDE); } case Pl_Changed: { Vector vec2; vec2.x = sp_ctof(vec[0]); vec2.y = sp_ctof(vec[1]); vec2.z = sp_ctof(vec[2]);#if SOURCE_ENGINE == SE_DOTA RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound, (CEntityIndex(entindex), vec2, buffer, vol, soundlevel, fFlags, pitch, delay));#else RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound, (entindex, vec2, buffer, vol, soundlevel, fFlags, pitch, delay));#endif } } }}
开发者ID:LivingInPortal,项目名称:sourcemod,代码行数:55,
示例11: Navigation_GetNextHidingSpot/*============================================================= Navigation_GetNextHidingSpot Increment the list-counter and return the position.=============================================================*/cell_t Navigation_GetNextHidingSpot(IPluginContext *pContext, const cell_t *params){ cell_t *pos; pContext->LocalToPhysAddr(params[1], &pos); Navigation::INavMeshHidingSpot *hidingSpot = Navigation::GetNextHidingSpot(); pos[0] = sp_ftoc(hidingSpot->GetX()); pos[1] = sp_ftoc(hidingSpot->GetY()); pos[2] = sp_ftoc(hidingSpot->GetZ()); return (true);}
开发者ID:LeGone,项目名称:Entcontrol-Extension,代码行数:19,
示例12: GetVectorLengthstatic cell_t GetVectorLength(IPluginContext *pContext, const cell_t *params){ cell_t *addr; pContext->LocalToPhysAddr(params[1], &addr); Vector source(sp_ctof(addr[0]), sp_ctof(addr[1]), sp_ctof(addr[2])); if (!params[2]) { return sp_ftoc(source.Length()); } else { return sp_ftoc(source.LengthSqr()); }}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:15,
示例13: sm_FloatAbsstatic cell_t sm_FloatAbs(IPluginContext *pCtx, const cell_t *params){ float val = sp_ctof(params[1]); val = (val >= 0.0f) ? val : -val; return sp_ftoc(val);}
开发者ID:Doldol,项目名称:sourcemod,代码行数:7,
示例14: sm_ArcTangentstatic cell_t sm_ArcTangent(IPluginContext *pCtx, const cell_t *params){ float val = sp_ctof(params[1]); val = atan(val); return sp_ftoc(val);}
开发者ID:Doldol,项目名称:sourcemod,代码行数:7,
示例15: sm_ArcCosinestatic cell_t sm_ArcCosine(IPluginContext *pCtx, const cell_t *params){ float val = sp_ctof(params[1]); val = acos(val); return sp_ftoc(val);}
开发者ID:Doldol,项目名称:sourcemod,代码行数:7,
示例16: sm_FloatFractionstatic cell_t sm_FloatFraction(IPluginContext *pCtx, const cell_t *params){ float val = sp_ctof(params[1]); val = val - floor(val); return sp_ftoc(val);}
开发者ID:Doldol,项目名称:sourcemod,代码行数:7,
示例17: sm_Powstatic cell_t sm_Pow(IPluginContext *pCtx, const cell_t *params){ float base = sp_ctof(params[1]); float exponent = sp_ctof(params[2]); return sp_ftoc(pow(base, exponent));}
开发者ID:Doldol,项目名称:sourcemod,代码行数:7,
示例18: GetProfilerTimestatic cell_t GetProfilerTime(IPluginContext *pContext, const cell_t *params){ Handle_t hndl = params[1]; HandleSecurity sec = HandleSecurity(pContext->GetIdentity(), g_pCoreIdent); HandleError err; Profiler *prof; if ((err = g_HandleSys.ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof)) != HandleError_None) { return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err); } if (!prof->stopped) { return pContext->ThrowNativeError("Profiler was never stopped"); } float fTime;#if defined PLATFORM_WINDOWS LONGLONG diff = prof->end.QuadPart - prof->start.QuadPart; double seconds = diff * prof->freq; fTime = (float)seconds;#endif return sp_ftoc(fTime);}
开发者ID:asceth,项目名称:synapi,代码行数:28,
示例19: smn_PbReadFloatstatic cell_t smn_PbReadFloat(IPluginContext *pCtx, const cell_t *params){ GET_MSG_FROM_HANDLE_OR_ERR(); GET_FIELD_NAME_OR_ERR(); float ret; int index = params[0] >= 3 ? params[3] : -1; if (index < 0) { if (!msg->GetFloatOrDouble(strField, &ret)) { return pCtx->ThrowNativeError("Invalid field /"%s/" for message /"%s/"", strField, msg->GetProtobufMessage()->GetTypeName().c_str()); } } else { if (!msg->GetRepeatedFloatOrDouble(strField, index, &ret)) { return pCtx->ThrowNativeError("Invalid field /"%s/"[%d] for message /"%s/"", strField, index, msg->GetProtobufMessage()->GetTypeName().c_str()); } } return sp_ftoc(ret);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:25,
示例20: smn_GetDistGainFromSoundLevelstatic cell_t smn_GetDistGainFromSoundLevel(IPluginContext *pContext, const cell_t *params){ int decibel = params[1]; float distance = sp_ctof(params[2]); return sp_ftoc(engsound->GetDistGainFromSoundLevel((soundlevel_t)decibel, distance));}
开发者ID:LivingInPortal,项目名称:sourcemod,代码行数:7,
示例21: GetSoundDurationstatic cell_t GetSoundDuration(IPluginContext *pContext, const cell_t *params){ char *name; pContext->LocalToString(params[1], &name); return sp_ftoc(engsound->GetSoundDuration(name));}
开发者ID:LivingInPortal,项目名称:sourcemod,代码行数:7,
示例22: smn_GetGameSoundParams// native bool:GetGameSoundParams(const String:gameSound[], &channel, &soundLevel, &Float:volume, &pitch, String:sample[], maxlength, entity=SOUND_FROM_WORLD)static cell_t smn_GetGameSoundParams(IPluginContext *pContext, const cell_t *params){ char *soundname; pContext->LocalToString(params[1], &soundname); CSoundParameters soundParams; if (!GetSoundParams(&soundParams, soundname, params[8])) return false; cell_t *channel; cell_t *fakeVolume; cell_t *pitch; cell_t *soundLevel; pContext->LocalToPhysAddr(params[2], &channel); pContext->LocalToPhysAddr(params[3], &soundLevel); pContext->LocalToPhysAddr(params[4], &fakeVolume); pContext->LocalToPhysAddr(params[5], &pitch); *channel = soundParams.channel; *pitch = soundParams.pitch; *soundLevel = (cell_t)soundParams.soundlevel; *fakeVolume = sp_ftoc(soundParams.volume); pContext->StringToLocal(params[6], params[7], soundParams.soundname); // Precache the sound we're returning if (!engsound->IsSoundPrecached(soundParams.soundname)) { InternalPrecacheScriptSound(soundname); } return true;}
开发者ID:LivingInPortal,项目名称:sourcemod,代码行数:36,
示例23: sm_GetConVarBoundsstatic cell_t sm_GetConVarBounds(IPluginContext *pContext, const cell_t *params){ Handle_t hndl = static_cast<Handle_t>(params[1]); HandleError err; ConVar *pConVar; if ((err=g_ConVarManager.ReadConVarHandle(hndl, &pConVar)) != HandleError_None) { return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err); } cell_t *addr; bool hasBound; float bound; switch (params[2]) { case ConVarBound_Upper: hasBound = pConVar->GetMax(bound); break; case ConVarBound_Lower: hasBound = pConVar->GetMin(bound); break; default: return pContext->ThrowNativeError("Invalid ConVarBounds value %d"); } pContext->LocalToPhysAddr(params[3], &addr); *addr = sp_ftoc(bound); return hasBound;}
开发者ID:pmrowla,项目名称:sourcemod-1.5,代码行数:33,
示例24: sm_GetStatFloatstatic cell_t sm_GetStatFloat(IPluginContext *pContext, const cell_t *params){ ISteamGameServerStats *pStats = GetServerStatsPointer(); if (pStats == NULL) { return 0; } int client = gamehelpers->ReferenceToIndex(params[1]); IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client); /* Man, including GameHelpers and PlayerHelpers for this native :(. */ if (pPlayer == NULL || pPlayer->IsConnected() == false) { return pContext->ThrowNativeError("Client index %d is invalid", params[1]); } char *pName; pContext->LocalToString(params[2], &pName); cell_t *pValue; pContext->LocalToPhysAddr(params[3], &pValue); CSteamID checkid = CreateCommonCSteamID(pPlayer, params, 4, 5); float fValue; bool bResult = pStats->GetUserStat(checkid, pName, &fValue); *pValue = sp_ftoc(fValue); return bResult ? 1 : 0;}
开发者ID:KyleSanderson,项目名称:SteamWorks,代码行数:30,
示例25: GetVectorDistancestatic cell_t GetVectorDistance(IPluginContext *pContext, const cell_t *params){ cell_t *addr1, *addr2; pContext->LocalToPhysAddr(params[1], &addr1); pContext->LocalToPhysAddr(params[2], &addr2); Vector source(sp_ctof(addr1[0]), sp_ctof(addr1[1]), sp_ctof(addr1[2])); Vector dest(sp_ctof(addr2[0]), sp_ctof(addr2[1]), sp_ctof(addr2[2])); if (!params[3]) { return sp_ftoc(source.DistTo(dest)); } else { return sp_ftoc(source.DistToSqr(dest)); }}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:17,
示例26: sm_ArcTangent2static cell_t sm_ArcTangent2(IPluginContext *pCtx, const cell_t *params){ float val1 = sp_ctof(params[1]); float val2 = sp_ctof(params[2]); val1 = atan2(val1, val2); return sp_ftoc(val1);}
开发者ID:Doldol,项目名称:sourcemod,代码行数:8,
示例27: GetRandomFloatstatic cell_t GetRandomFloat(IPluginContext *pContext, const cell_t *params){ float fMin = sp_ctof(params[1]); float fMax = sp_ctof(params[2]); float fRandom = engrandom->RandomFloat(fMin, fMax); return sp_ftoc(fRandom);}
开发者ID:pmrowla,项目名称:sourcemod-central,代码行数:9,
示例28: GetEngineTimestatic cell_t GetEngineTime(IPluginContext *pContext, const cell_t *params){#if SOURCE_ENGINE >= SE_NUCLEARDAWN float fTime = Plat_FloatTime();#else float fTime = engine->Time();#endif return sp_ftoc(fTime);}
开发者ID:pmrowla,项目名称:sourcemod-central,代码行数:10,
示例29: GetServerNetStatsstatic cell_t GetServerNetStats(IPluginContext *pContext, const cell_t *params){ if (iserver == NULL) { return pContext->ThrowNativeError("IServer interface not supported, file a bug report."); } float in, out; cell_t *pIn, *pOut; pContext->LocalToPhysAddr(params[1], &pIn); pContext->LocalToPhysAddr(params[2], &pOut); iserver->GetNetStats(in, out); *pIn = sp_ftoc(in); *pOut = sp_ftoc(out); return 1;}
开发者ID:asceth,项目名称:synapi,代码行数:19,
示例30: sm_SquareRootstatic cell_t sm_SquareRoot(IPluginContext *pCtx, const cell_t *params){ float val = sp_ctof(params[1]); if (val < 0.0f) { return pCtx->ThrowNativeError("Cannot evaluate the square root of a negative number (val:%f)", val); } return sp_ftoc(sqrt(val));}
开发者ID:Doldol,项目名称:sourcemod,代码行数:11,
注:本文中的sp_ftoc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ sp_getobject函数代码示例 C++ sp_error_message函数代码示例 |