当前位置: 首页>>代码示例>>C++>>正文


C++ ALLOC_STRING函数代码示例

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


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

示例1: ButtonSound

void CBaseButton::Spawn(void)
{
	char *pszSound = ButtonSound(m_sounds);
	PRECACHE_SOUND(pszSound);
	pev->noise = ALLOC_STRING(pszSound);
	Precache();

	if (FBitSet(pev->spawnflags, SF_BUTTON_SPARK_IF_OFF))
	{
		SetThink(&CBaseButton::ButtonSpark);
		pev->nextthink = gpGlobals->time + 0.5;
	}

	SetMovedir(pev);
	pev->movetype = MOVETYPE_PUSH;
	pev->solid = SOLID_BSP;
	SET_MODEL(ENT(pev), STRING(pev->model));

	if (!pev->speed)
		pev->speed = 40;

	if (pev->health > 0)
		pev->takedamage = DAMAGE_YES;

	if (!m_flWait)
		m_flWait = 1;

	if (!m_flLip)
		m_flLip = 4;

	m_toggle_state = TS_AT_BOTTOM;
	m_vecPosition1 = pev->origin;
	m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs(pev->movedir.x * (pev->size.x - 2)) + fabs(pev->movedir.y * (pev->size.y - 2)) + fabs(pev->movedir.z * (pev->size.z - 2)) - m_flLip));

	if (((m_vecPosition2 - m_vecPosition1).Length() < 1) || (pev->spawnflags & SF_BUTTON_DONTMOVE))
		m_vecPosition2 = m_vecPosition1;

	m_fStayPushed = m_flWait == -1 ? TRUE : FALSE;
	m_fRotating = FALSE;

	if (FBitSet(pev->spawnflags, SF_BUTTON_TOUCH_ONLY))
	{
		SetTouch(&CBaseButton::ButtonTouch);
	}
	else
	{
		SetTouch(NULL);
		SetUse(&CBaseButton::ButtonUse);
	}
}
开发者ID:AlexCSilva,项目名称:cs16-client,代码行数:50,代码来源:buttons.cpp

示例2: ALLOC_STRING

void CEnvGlobal::KeyValue( KeyValueData *pkvd )
{
	//TODO: what if the keyvalue isn't handled? - Solokiller
	pkvd->fHandled = true;

	if( FStrEq( pkvd->szKeyName, "globalstate" ) )		// State name
		m_globalstate = ALLOC_STRING( pkvd->szValue );
	else if( FStrEq( pkvd->szKeyName, "triggermode" ) )
		m_triggermode = static_cast<TriggerMode>( atoi( pkvd->szValue ) );
	else if( FStrEq( pkvd->szKeyName, "initialstate" ) )
		m_initialstate = atoi( pkvd->szValue );
	else
		CPointEntity::KeyValue( pkvd );
}
开发者ID:swmpdg,项目名称:HLEnhanced,代码行数:14,代码来源:CEnvGlobal.cpp

示例3: if

void CMultiSource::KeyValue(KeyValueData *pkvd)
{
	if (FStrEq(pkvd->szKeyName, "style") || FStrEq(pkvd->szKeyName, "height") || FStrEq(pkvd->szKeyName, "killtarget") || FStrEq(pkvd->szKeyName, "value1") || FStrEq(pkvd->szKeyName, "value2") || FStrEq(pkvd->szKeyName, "value3"))
	{
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "globalstate"))
	{
		m_globalstate = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else
		CPointEntity::KeyValue(pkvd);
}
开发者ID:AlexCSilva,项目名称:cs16-client,代码行数:14,代码来源:buttons.cpp

示例4: RCsprintf

/*
 * RCsprintf - do sprintf with a format string from a resource
 */
int RCsprintf( char *buf, msg_id fmtid, ... )
{
    va_list     al;
    char        *fmtstr;
    int         ret;

    va_start( al, fmtid );
    fmtstr = ALLOC_STRING( fmtid );
    ret = vsprintf( buf, fmtstr, al );
    FREE_STRING( fmtstr );
    va_end( al );
    return( ret );

} /* RCsprintf */
开发者ID:Graham-stott,项目名称:open-watcom-v2,代码行数:17,代码来源:ldstr.c

示例5: KeyValue

//=========================================================
//=========================================================
void CWeaponBox :: KeyValue( KeyValueData *pkvd )
{
	if ( m_cAmmoTypes < MAX_AMMO_SLOTS )
	{
		PackAmmo( ALLOC_STRING(pkvd->szKeyName), atoi(pkvd->szValue) );
		m_cAmmoTypes++;// count this new ammo type.

		pkvd->fHandled = TRUE;
	}
	else
	{
		ALERT ( at_debug, "WeaponBox too full! only %d ammotypes allowed\n", MAX_AMMO_SLOTS );
	}
}
开发者ID:fmoraw,项目名称:SpiritOfHalfLife,代码行数:16,代码来源:weapons.cpp

示例6: Use

//
// CyclerUse - starts a rotation trend
//
void CCycler :: Use ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	if ( FClassnameIs ( pev, "info_commentary" ) )
	{
		pev->skin = 1;

		//stop previous sound
		if (pev->message)
		EMIT_SOUND(ENT(pev), CHAN_ITEM, "common/null.wav", 0.1, ATTN_NORM );
			
		//stop previous message (BUGBUG: This doesn't clear the message)
		UTIL_ShowMessageAll( STRING(ALLOC_STRING("BLANK")));
		
		//play it everywhere
		if (pev->message)				
		EMIT_SOUND(ENT(pev), CHAN_ITEM, STRING(pev->message), 1, ATTN_NORM );

		//send message
		UTIL_ShowMessageAll( STRING(pev->message) );	//strings code

		/*
		if(!bIsPlaying)
		{
			pev->skin = 1;
			bIsPlaying = TRUE;
					
			//play it everywhere
			if (pev->message)				
			EMIT_SOUND(ENT(pev), CHAN_ITEM, STRING(pev->message), 1, ATTN_NORM );

			UTIL_ShowMessageAll( STRING(pev->message) );	//strings code
		}
		else
		{
			pev->skin = 0;
			bIsPlaying = FALSE;
						
		}
		*/
	}
	else
	{
		m_animate = !m_animate;
		if (m_animate)
			pev->framerate = 1.0;
		else
			pev->framerate = 0.0;
	}
}
开发者ID:JoelTroch,项目名称:am_src_rebirth,代码行数:52,代码来源:h_cycler.cpp

示例7: atoi

void CGenericMonster::KeyValue( KeyValueData *pkvd )
{
	if (FStrEq(pkvd->szKeyName, "m_bloodColor"))
	{
		m_bloodColor = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iszGibModel"))
	{
		m_iszGibModel = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else
		CBaseMonster::KeyValue( pkvd );
}
开发者ID:mittorn,项目名称:SoHL-1.2,代码行数:15,代码来源:genericmonster.cpp

示例8: Q_atof

/* <18356f> ../cstrike/dlls/subs.cpp:149 */
void CBaseDelay::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
	if (FStrEq(pkvd->szKeyName, "delay"))
	{
		m_flDelay = Q_atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "killtarget"))
	{
		m_iszKillTarget = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else
		CBaseEntity::KeyValue(pkvd);
}
开发者ID:omertelli,项目名称:ReGameDLL_CS,代码行数:16,代码来源:subs.cpp

示例9: copy_enum_values_to_allocated_buffer

static void copy_enum_values_to_allocated_buffer(struct trace_type_definition *type_definition, struct trace_enum_value **enum_values,
                                                 char **string_table)
{
    struct trace_enum_value *enum_value = type_definition->enum_values;
    while (enum_value->name != NULL) {
        memcpy(*enum_values, enum_value, sizeof(*enum_value));
        ALLOC_STRING((*enum_values)->name, enum_value->name);
        (*enum_values)++;
        enum_value++;
    }

    // Copy the sentinel enum value
    memcpy(*enum_values, enum_value, sizeof(*enum_value));
    (*enum_values)++;
}
开发者ID:Zex,项目名称:traces,代码行数:15,代码来源:trace_user.c

示例10: entity_set_model

static cell AMX_NATIVE_CALL entity_set_model(AMX *amx, cell *params)
{
	int iEnt = params[1];

	CHECK_ENTITY_SIMPLE(iEnt);
	
	edict_t *pEnt = INDEXENT2(iEnt);
	int iLen;
	char *szModel = MF_GetAmxString(amx, params[2], 0, &iLen);
	const char *szStatic = STRING(ALLOC_STRING(szModel));

	SET_MODEL(pEnt, szStatic);

	return 1;
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:15,代码来源:entity.cpp

示例11: Call_Void_Str_Bool

cell Call_Void_Str_Bool(AMX *amx, cell *params)
{
	SETUP(2);

	const char *sz3=STRING(ALLOC_STRING(MF_GetAmxString(amx, params[3], 0, NULL)));
	bool b4=*MF_GetAmxAddr(amx, params[4]) ? true : false;

#if defined(_WIN32)
	reinterpret_cast<void (__fastcall *)(void*, int, const char *, bool)>(__func)(pv, 0, sz3, b4);
#elif defined(__linux__) || defined(__APPLE__)
	reinterpret_cast<void (*)(void *, const char *, bool)>(__func)(pv, sz3, b4);
#endif

	return 1;
}
开发者ID:reuben,项目名称:amxmodx,代码行数:15,代码来源:call_funcs.cpp

示例12: KeyValue

void CBaseDelay :: KeyValue( KeyValueData *pkvd )
{
	if (FStrEq(pkvd->szKeyName, "delay"))
	{
		m_flDelay = atof( pkvd->szValue );
		pkvd->fHandled = true;
	}
	else if (FStrEq(pkvd->szKeyName, "killtarget"))
	{
		m_iszKillTarget = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = true;
	}
	else
	{
		CBaseEntity::KeyValue( pkvd );
	}
}
开发者ID:BackupTheBerlios,项目名称:battlegrounds-svn,代码行数:17,代码来源:subs.cpp

示例13: dod_set_model

static cell AMX_NATIVE_CALL dod_set_model(AMX *amx, cell *params) // player,model
{
	int index = params[1];
	CHECK_PLAYER(index);

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if(!pPlayer->ingame)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Player, Not on Server");
		return 0;
	}

	int length;
	pPlayer->initModel((char*)STRING(ALLOC_STRING(MF_GetAmxString(amx, params[2], 1, &length))));

	return true;
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:17,代码来源:NBase.cpp

示例14: EntvarsKeyvalue

void EntvarsKeyvalue( entvars_t *pev, KeyValueData *pkvd )
{
	const TYPEDESCRIPTION* pField;

	for ( size_t i = 0; i < gEntvarsCount; i++ )
	{
		pField = &gEntvarsDescription[i];

		if ( !stricmp( pField->fieldName, pkvd->szKeyName ) )
		{
			switch( pField->fieldType )
			{
			case FIELD_MODELNAME:
			case FIELD_SOUNDNAME:
			case FIELD_STRING:
				(*(int *)((char *)pev + pField->fieldOffset)) = ALLOC_STRING( pkvd->szValue );
				break;

			case FIELD_TIME:
			case FIELD_FLOAT:
				(*(float *)((char *)pev + pField->fieldOffset)) = atof( pkvd->szValue );
				break;

			case FIELD_INTEGER:
				(*(int *)((char *)pev + pField->fieldOffset)) = atoi( pkvd->szValue );
				break;

			case FIELD_POSITION_VECTOR:
			case FIELD_VECTOR:
				UTIL_StringToVector( (float *)((char *)pev + pField->fieldOffset), pkvd->szValue );
				break;

			default:
			case FIELD_EVARS:
			case FIELD_CLASSPTR:
			case FIELD_EDICT:
			case FIELD_ENTITY:
			case FIELD_POINTER:
				ALERT( at_error, "Bad field in entity!!\n" );
				break;
			}
			pkvd->fHandled = true;
			return;
		}
	}
}
开发者ID:CryoKeen,项目名称:HLEnhanced,代码行数:46,代码来源:util.cpp

示例15: KeyValue

//
// Cache user-entity-field values until spawn is called.
//
void CLight :: KeyValue( KeyValueData* pkvd)
{
	if (FStrEq(pkvd->szKeyName, "m_iOnStyle"))
	{
		m_iOnStyle = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iOffStyle"))
	{
		m_iOffStyle = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iTurnOnStyle"))
	{
		m_iTurnOnStyle = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iTurnOffStyle"))
	{
		m_iTurnOffStyle = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iTurnOnTime"))
	{
		m_iTurnOnTime = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iTurnOffTime"))
	{
		m_iTurnOffTime = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "pitch"))
	{
		pev->angles.x = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "pattern"))
	{
		m_iszPattern = ALLOC_STRING( pkvd->szValue );
		pkvd->fHandled = TRUE;
	}
	else	CBaseEntity::KeyValue( pkvd );
}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:47,代码来源:lights.cpp


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