• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ sp_ftoc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sp_ftoc函数的典型用法代码示例。如果您正苦于以下问题:C++ sp_ftoc函数的具体用法?C++ sp_ftoc怎么用?C++ sp_ftoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sp_ftoc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetAbsAngles

static 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,代码来源:smn_player.cpp


示例2: GetPlayerMaxs

static 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,代码来源:smn_player.cpp


示例3: GameRules_GetPropVector

static 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,代码来源:gamerulesnatives.cpp


示例4: smn_BfReadAngles

static 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,代码来源:smn_bitbuffer.cpp


示例5: GetClientEyePosition

static 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,代码来源:vnatives.cpp


示例6: smn_BfReadVecNormal

static 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,代码来源:smn_bitbuffer.cpp


示例7: smn_PbReadVector2D

static 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,代码来源:smn_protobuf.cpp


示例8: smn_TEReadVector

static 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,代码来源:tenatives.cpp


示例9: GetClientEyeAngles

static 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,代码来源:vnatives.cpp


示例10: sp_ftoc

void 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();
#else
void 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,代码来源:vsound.cpp


示例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,代码来源:natives.cpp


示例12: GetVectorLength

static 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,代码来源:smn_vector.cpp


示例13: sm_FloatAbs

static 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,代码来源:smn_float.cpp


示例14: sm_ArcTangent

static 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,代码来源:smn_float.cpp


示例15: sm_ArcCosine

static 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,代码来源:smn_float.cpp


示例16: sm_FloatFraction

static 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,代码来源:smn_float.cpp


示例17: sm_Pow

static 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,代码来源:smn_float.cpp


示例18: GetProfilerTime

static 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,代码来源:smn_profiler.cpp


示例19: smn_PbReadFloat

static 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,代码来源:smn_protobuf.cpp


示例20: smn_GetDistGainFromSoundLevel

static 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,代码来源:vsound.cpp



注:本文中的sp_ftoc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sp_getobject函数代码示例发布时间:2022-05-30
下一篇:
C++ sp_error_message函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap