本文整理汇总了C++中S32函数的典型用法代码示例。如果您正苦于以下问题:C++ S32函数的具体用法?C++ S32怎么用?C++ S32使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了S32函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: S32
//-----------------------------------------------------------------------------
// Initialize particle
//-----------------------------------------------------------------------------
void ParticleData::initializeParticle(Particle* init, const Point3F& inheritVelocity)
{
init->dataBlock = this;
// Calculate the constant accleration...
init->vel += inheritVelocity * inheritedVelFactor;
init->acc = init->vel * constantAcceleration;
// Calculate this instance's lifetime...
init->totalLifetime = lifetimeMS;
if (lifetimeVarianceMS != 0)
init->totalLifetime += S32(gRandGen.randI() % (2 * lifetimeVarianceMS + 1)) - S32(lifetimeVarianceMS);
// assign spin amount
init->spinSpeed = spinSpeed * gRandGen.randF( spinRandomMin, spinRandomMax );
}
示例2: Crc64
//-----------------------------------------------------------------------------
UINT64 Crc64( UINT64 start_crc , UINT8 *addr ,UINT32 size)
{
UINT8 * limit;
UINT32 u32tmp ;
PAGED_CODE ();
start_crc = ~start_crc;
if (size > 4)
{
while ((uintptr_t)(addr) & 3)
{
start_crc = crc64_table[0][*addr++ ^ A1(start_crc)] ^ S8(start_crc);
--size;
}
limit = addr + (size & ~(size_t)(3));
size &= (size_t)(3);
while (addr < limit)
{
u32tmp = (UINT32)start_crc ^ (*(UINT32*)(addr));
addr += 4;
start_crc = crc64_table[3][A(u32tmp)] ^ crc64_table[2][B(u32tmp)] ^ S32(start_crc)^ crc64_table[1][C(u32tmp)] ^ crc64_table[0][D(u32tmp)];
}
}
while (size-- != 0)
start_crc = crc64_table[0][*addr++ ^ A1(start_crc)] ^ S8(start_crc);
return ~start_crc;
}
示例3: llfloor
bool LLAlertDialog::setCheckBox( const std::string& check_title, const std::string& check_control )
{
const LLFontGL* font = LLResMgr::getInstance()->getRes( FONT_NAME );
const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
// Extend dialog for "check next time"
S32 max_msg_width = getRect().getWidth() - 2 * HPAD;
S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16;
max_msg_width = llmax(max_msg_width, check_width);
S32 dialog_width = max_msg_width + 2 * HPAD;
S32 dialog_height = getRect().getHeight();
dialog_height += LINE_HEIGHT;
dialog_height += LINE_HEIGHT / 2;
reshape( dialog_width, dialog_height, FALSE );
S32 msg_x = (getRect().getWidth() - max_msg_width) / 2;
LLRect check_rect;
check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2,
max_msg_width, LINE_HEIGHT);
mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font, onClickIgnore, this);
addChild(mCheck);
return true;
}
示例4: llfloor
bool LLAlertDialog::setCheckBox( const LLString& check_title, const LLString& check_control )
{
const LLFontGL* font = gResMgr->getRes( font_name );
const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
// Extend dialog for "check next time"
S32 max_msg_width = mRect.getWidth() - 2 * HPAD;
S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16;
max_msg_width = llmax(max_msg_width, check_width);
S32 dialog_width = max_msg_width + 2 * HPAD;
S32 dialog_height = mRect.getHeight();
dialog_height += LINE_HEIGHT;
dialog_height += LINE_HEIGHT / 2;
reshape( dialog_width, dialog_height, FALSE );
S32 msg_x = (mRect.getWidth() - max_msg_width) / 2;
LLRect check_rect;
check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2,
max_msg_width, LINE_HEIGHT);
mCheck = new LLCheckboxCtrl("check", check_rect, check_title, font);
addChild(mCheck);
// mCheck is sometimes "show again" and sometimes "hide" :-(
// If it's "Show Again", and we showed it, it must be checked. JC
if (mIgnorable == IGNORE_SHOW_AGAIN)
{
mCheck->setValue(TRUE);
}
return true;
}
示例5: set_promiscuous_mode
static void set_promiscuous_mode(struct net_device *dev)
{
struct fs_enet_private *fep = netdev_priv(dev);
fcc_t *fccp = fep->fcc.fccp;
S32(fccp, fcc_fpsmr, FCC_PSMR_PRO);
}
示例6: globalToLocalCoord
F32 GuiSliderCtrl::_getThumbValue( const GuiEvent& event )
{
Point2I curMousePos = globalToLocalCoord( event.mousePoint );
F32 value;
if( getWidth() >= getHeight() )
value = F32( curMousePos.x - mShiftPoint ) / F32( getWidth() - mShiftExtent ) * ( mRange.y - mRange.x ) + mRange.x;
else
value = F32( curMousePos.y ) / F32( getHeight() ) * ( mRange.y - mRange.x ) + mRange.x;
if(value > mRange.y )
value = mRange.y;
else if( value < mRange.x )
value = mRange.x;
if( mSnap || ( event.modifier & SI_SHIFT && mTicks >= 1 ) )
{
// If the shift key is held, snap to the nearest tick, if any are being drawn
F32 tickStep = ( mRange.y - mRange.x ) / F32( mTicks + 1 );
F32 tickSteps = (value - mRange.x ) / tickStep;
S32 actualTick = S32( tickSteps + 0.5 );
value = actualTick * tickStep + mRange.x;
AssertFatal( value <= mRange.y && value >= mRange.x, "Error, out of bounds value generated from shift-snap of slider" );
}
return value;
}
示例7: F32
void GuiSliderCtrl::_updateThumb( F32 _value, bool snap, bool onWake, bool doCallback )
{
if( snap && mTicks > 0 )
{
// If the shift key is held, snap to the nearest tick, if any are being drawn
F32 tickStep = (mRange.y - mRange.x) / F32(mTicks + 1);
F32 tickSteps = (_value - mRange.x) / tickStep;
S32 actualTick = S32(tickSteps + 0.5);
_value = actualTick * tickStep + mRange.x;
}
// Clamp the thumb to legal values.
if( _value < mRange.x )
_value = mRange.x;
if( _value > mRange.y )
_value = mRange.y;
// If value hasn't changed and this isn't the initial update on
// waking, do nothing.
if( mValue == _value && !onWake )
return;
mValue = _value;
Point2I ext = getExtent();
ext.x -= ( mShiftExtent + mThumbSize.x ) / 2;
// update the bounding thumb rect
if (getWidth() >= getHeight())
{ // HORZ thumb
S32 mx = (S32)((F32(ext.x) * (mValue-mRange.x) / (mRange.y-mRange.x)));
S32 my = ext.y/2;
if(mDisplayValue)
my = mThumbSize.y/2;
mThumb.point.x = mx - (mThumbSize.x/2);
mThumb.point.y = my - (mThumbSize.y/2);
mThumb.extent = mThumbSize;
}
else
{ // VERT thumb
S32 mx = ext.x/2;
S32 my = (S32)((F32(ext.y) * (mValue-mRange.x) / (mRange.y-mRange.x)));
mThumb.point.x = mx - (mThumbSize.y/2);
mThumb.point.y = my - (mThumbSize.x/2);
mThumb.extent.x = mThumbSize.y;
mThumb.extent.y = mThumbSize.x;
}
setFloatVariable(mValue);
setUpdate();
// Use the alt console command if you want to continually update:
if ( !onWake && doCallback )
execAltConsoleCallback();
}
示例8: i
//
// Moving State
//
void SquadMoveTogether::StateMoving()
{
SquadObj::UnitList::Iterator i(&subject->GetList());
for (!i; *i; i++)
{
if ((*i)->Alive() && (*i)->data <= S32(points.GetCount()))
{
// Someone hasn't made it
return;
}
}
// LOG_DIAG(("Entire squad has made it to the destination!"))
// Were we spawned by a task ?
if (task)
{
task->ProcessEvent(Event(0xF14439C5)); // "SquadMove::Completed"
}
else
{
subject->NotifyPlayer(0x763C5781); // "Squad::TaskCompleted"
}
Quit();
}
示例9: AssertFatal
void SFXXAudioVoice::_flush()
{
AssertFatal( mXAudioVoice != NULL,
"SFXXAudioVoice::_flush() - invalid voice" );
EnterCriticalSection( &mLock );
mXAudioVoice->Stop( 0 );
mXAudioVoice->FlushSourceBuffers();
mNonStreamBufferLoaded = false;
#ifdef DEBUG_SPEW
Platform::outputDebugString( "[SFXXAudioVoice] Flushed state" );
#endif
mIsPlaying = false;
mHasStarted = false;
mHasStopped = true;
//WORKAROUND: According to the docs, SamplesPlayed reported by the
// voice should get reset as soon as we submit a new buffer to the voice.
// Alas it won't. So, save the current value here and offset our future
// play cursors.
XAUDIO2_VOICE_STATE state;
mXAudioVoice->GetState( &state );
mSamplesPlayedOffset = - S32( state.SamplesPlayed );
LeaveCriticalSection( &mLock );
}
示例10: tx_kickstart
static void tx_kickstart(struct net_device *dev)
{
struct fs_enet_private *fep = netdev_priv(dev);
fcc_t *fccp = fep->fcc.fccp;
S32(fccp, fcc_ftodr, 0x80);
}
示例11: AssertFatal
void AtlasOldMesher::writeVertex(Stream *s, Vert *vert, const S8 level)
{
S16 x, y, z;
const Point2I &vertPos = vert->pos;
Point3F center;
mBounds.getCenter(¢er);
if (vert->special)
z = vert->z;
else
z = mHeight->sampleRead(vertPos);
S32 xTmp, yTmp;
xTmp = (S32)mFloor(((vertPos.x * mHeight->mSampleSpacing - center.x) * mCompressionFactor.x) + 0.5);
yTmp = (S32)mFloor(((vertPos.y * mHeight->mSampleSpacing - center.y) * mCompressionFactor.y) + 0.5);
AssertFatal(S16(xTmp) == xTmp,
"AtlasOldMesher::writeVertex - Overflow writing x-coordinate!");
AssertFatal(S16(yTmp) == yTmp,
"AtlasOldMesher::writeVertex - Overflow writing y-coordinate!");
x = xTmp;
y = yTmp;
s->write(x);
s->write(y);
s->write(z);
// Morph info. Calculate the difference between the
// vert height, and the height of the same spot in the
// next lower-LOD mesh.
S16 morphHeight;
if (vert->special)
morphHeight = z; // special verts don't morph.
else
{
morphHeight = mHeight->getHeightAtLOD(vertPos, level + 1);
}
S32 morphDelta = (S32(morphHeight) - S32(z));
s->write(S16(morphDelta));
if(morphDelta != S16(morphDelta))
Con::warnf("AtlasOldMesher::writeVertex - overflow in lerpedHeight!");
}
示例12: handleNameTagOptionChanged
void handleNameTagOptionChanged(const LLSD& newvalue)
{
S32 name_tag_option = S32(newvalue);
if(name_tag_option==2)
{
gSavedSettings.setBOOL("SmallAvatarNames", TRUE);
}
}
示例13: llclamp
void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event)
{
// exit if not there
if(!mValue.has(name)) {
return;
}
value = llclamp( value, mMinValue, mMaxValue );
// Round to nearest increment (bias towards rounding down)
value -= mMinValue;
value += mIncrement/2.0001f;
value -= fmod(value, mIncrement);
F32 newValue = mMinValue + value;
// now, make sure no overlap
// if we want that
if(!mAllowOverlap) {
bool hit = false;
// look at the current spot
// and see if anything is there
LLSD::map_iterator mIt = mValue.beginMap();
for(;mIt != mValue.endMap(); mIt++) {
F32 testVal = (F32)mIt->second.asReal() - newValue;
if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD &&
mIt->first != name) {
hit = true;
break;
}
}
// if none found, stop
if(hit) {
return;
}
}
// now set it in the map
mValue[name] = newValue;
// set the control if it's the current slider and not from an event
if (!from_event && name == mCurSlider)
{
setControlValue(mValue);
}
F32 t = (newValue - mMinValue) / (mMaxValue - mMinValue);
S32 left_edge = mThumbWidth/2;
S32 right_edge = getRect().getWidth() - (mThumbWidth/2);
S32 x = left_edge + S32( t * (right_edge - left_edge) );
mThumbRects[name].mLeft = x - (mThumbWidth/2);
mThumbRects[name].mRight = x + (mThumbWidth/2);
}
示例14: S32
void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
{
LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
if (!sim_info)
{
LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE;
LLWorldMap::getInstance()->mInvalidLocation = FALSE;
LLWorldMap::getInstance()->mUnknownLocation = pos_global;
LLTracker::stopTracking(NULL);
S32 world_x = S32(pos_global.mdV[0] / 256);
S32 world_y = S32(pos_global.mdV[1] / 256);
LLWorldMap::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
setDefaultBtn("");
return;
}
if (sim_info->mAccess == SIM_ACCESS_DOWN)
{
// Down sim. Show the blue circle of death!
LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE;
LLWorldMap::getInstance()->mUnknownLocation = pos_global;
LLWorldMap::getInstance()->mInvalidLocation = TRUE;
LLTracker::stopTracking(NULL);
setDefaultBtn("");
return;
}
std::string sim_name;
LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name );
F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
std::string full_name = llformat("%s (%d, %d, %d)",
sim_name.c_str(),
llround(region_x),
llround(region_y),
llround((F32)pos_global.mdV[VZ]));
std::string tooltip("");
mTrackedStatus = LLTracker::TRACKING_LOCATION;
LLTracker::trackLocation(pos_global, full_name, tooltip);
LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE;
LLWorldMap::getInstance()->mIsTrackingDoubleClick = FALSE;
LLWorldMap::getInstance()->mIsTrackingCommit = FALSE;
setDefaultBtn("Teleport");
}
示例15: S32
void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
{
LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
if (!sim_info)
{
// We haven't found a region for that point yet, leave the tracking to the world map
LLWorldMap::getInstance()->setTracking(pos_global);
LLTracker::stopTracking(NULL);
S32 world_x = S32(pos_global.mdV[0] / 256);
S32 world_y = S32(pos_global.mdV[1] / 256);
LLWorldMapMessage::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
setDefaultBtn("");
return;
}
if (sim_info->isDown())
{
// Down region. Show the blue circle of death!
// i.e. let the world map that this and tell it it's invalid
LLWorldMap::getInstance()->setTracking(pos_global);
LLWorldMap::getInstance()->setTrackingInvalid();
LLTracker::stopTracking(NULL);
setDefaultBtn("");
return;
}
std::string sim_name = sim_info->getName();
F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
std::string full_name = llformat("%s (%d, %d, %d)",
// sim_name.c_str(),
// [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2009-07-04 (RLVa-1.0.0a)
(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? sim_name.c_str() : RlvStrings::getString(RLV_STRING_HIDDEN_REGION).c_str(),
// [/RLVa:KB]
llround(region_x),
llround(region_y),
llround((F32)pos_global.mdV[VZ]));
std::string tooltip("");
mTrackedStatus = LLTracker::TRACKING_LOCATION;
LLTracker::trackLocation(pos_global, full_name, tooltip);
LLWorldMap::getInstance()->cancelTracking(); // The floater is taking over the tracking
setDefaultBtn("Teleport");
}