本文整理匯總了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);
}
}
示例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 );
}
示例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);
}
示例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 */
示例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 );
}
}
示例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;
}
}
示例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 );
}
示例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);
}
示例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)++;
}
示例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;
}
示例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;
}
示例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 );
}
}
示例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;
}
示例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;
}
}
}
示例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 );
}