當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。