void LoomWidget::Repaint( const WidgetPainter &painter ) { BridgeWidget::Repaint( painter ); Timer now; double delta_time = now - _loom_time; _loom_time = now; double d_stage = delta_time /_loom_duration; //if (_one_more_dirty) { Widget::SetDirty(); _one_more_dirty=false; } // Workaround if ( _loom_mode && _stage<1 && _running ) { _stage += d_stage; if (_stage>1) { _stage=1; _running=false; _one_more_dirty=true; OnLoomStop.Send(); } UpdateStage(); } else if ( !_loom_mode && 0<_stage && _running ) { _stage -= d_stage; if (_stage<0) { _stage=0; _running=false; _one_more_dirty=true; OnVanishStop.Send(); } UpdateStage(); } }
/* ================ idMoveable::Think ================ */ void idMoveable::Think( void ) { if ( thinkFlags & TH_THINK ) { // Move to the next stage? UpdateStage ( ); if ( !FollowInitialSplinePath() && stage == -1 ) { BecomeInactive( TH_THINK ); } } // RAVEN BEGIN // abahr: changed parent scope idDamagable::Think(); }
void CurtainRollScr::Process() { //描画 mpScrollBackground->SetScrollP(mpMap->GetScrollP()); mpScrollBackground->Draw(); GetMap()->Process(); GAMECONTROL->GetMobManager()->Process(); GAMECONTROL->GetMaku()->Draw(); UpdateStage(); }
void UpdateVersus(){ if(!pause){ UpdateStage(stage); if((f2.state!=DEAD)&&(f1.state!=DEAD)){ if(f1.state!=HIT&&f1.state!=DEAD) UpdateFrame(&f1); if(f2.state!=HIT&&f2.state!=DEAD) UpdateFrame(&f2); UpdateInputs(&f1,p1input); UpdateInputs(&f2,p2input); ProcessInputs(&f1); ProcessInputs(&f2); FighterThink(&f2); FighterThink(&f1); FighterUpdate(&f1); FighterUpdate(&f2); } if(nexttimer>0){ if(f2.state==DEAD && f1.state==DEAD) DrawSprite(drawvic,screen,0,0,0); else if(f2.state==DEAD) DrawSprite(p1vic,screen,0,0,0); else DrawSprite(p2vic,screen,0,0,0); nexttimer--; }if(nexttimer==0){ nexttimer--; if(stage==ST_PLATFORM) stage = ST_FIELD; else stage = ST_PLATFORM; ClearFighter(&f1); ClearFighter(&f2); InitVersus(); } } else DrawPause(pausescr); }
/* ================ idMoveable::Event_Activate ================ */ void idMoveable::Event_Activate( idEntity *activator ) { float delay; idVec3 init_velocity, init_avelocity; Show(); if ( !spawnArgs.GetInt( "notPushable" ) ) { physicsObj.EnableImpact(); } physicsObj.Activate(); spawnArgs.GetVector( "init_velocity", "0 0 0", init_velocity ); spawnArgs.GetVector( "init_avelocity", "0 0 0", init_avelocity ); delay = spawnArgs.GetFloat( "init_velocityDelay", "0" ); if ( delay == 0.0f ) { physicsObj.SetLinearVelocity( init_velocity ); } else { PostEventSec( &EV_SetLinearVelocity, delay, init_velocity ); } delay = spawnArgs.GetFloat( "init_avelocityDelay", "0" ); if ( delay == 0.0f ) { physicsObj.SetAngularVelocity( init_avelocity ); } else { PostEventSec( &EV_SetAngularVelocity, delay, init_avelocity ); } InitInitialSpline( gameLocal.time ); // RAVEN BEGIN // jshepard: we should update it's stage on activation, specifically for falling blocks. UpdateStage(); // RAVEN END }
void LoomWidget::UpdateSize() { Resize( GetAttached()->GetWidth(), GetAttached()->GetHeight() ); UpdateStage(); }
void LoomWidget::SetMinVisible( int min_visible_pixels ) { _min_visible_pixels = min_visible_pixels; UpdateStage(); }
/* ================ idBarrel::BarrelThink ================ */ void idBarrel::BarrelThink( void ) { bool wasAtRest, onGround; float movedDistance, rotatedDistance, angle; idVec3 curOrigin, gravityNormal, dir; idMat3 curAxis, axis; wasAtRest = IsAtRest(); // Progress to the next stage? UpdateStage ( ); // run physics RunPhysics(); // only need to give the visual model an additional rotation if the physics were run if ( !wasAtRest ) { // current physics state onGround = GetPhysics()->HasGroundContacts(); curOrigin = GetPhysics()->GetOrigin(); curAxis = GetPhysics()->GetAxis(); // if the barrel is on the ground if ( onGround ) { gravityNormal = GetPhysics()->GetGravityNormal(); dir = curOrigin - lastOrigin; dir -= gravityNormal * dir * gravityNormal; movedDistance = dir.LengthSqr(); // if the barrel moved and the barrel is not aligned with the gravity direction if ( movedDistance > 0.0f && idMath::Fabs( gravityNormal * curAxis[barrelAxis] ) < 0.7f ) { // barrel movement since last think frame orthogonal to the barrel axis movedDistance = idMath::Sqrt( movedDistance ); dir *= 1.0f / movedDistance; movedDistance = ( 1.0f - idMath::Fabs( dir * curAxis[barrelAxis] ) ) * movedDistance; // get rotation about barrel axis since last think frame angle = lastAxis[(barrelAxis+1)%3] * curAxis[(barrelAxis+1)%3]; angle = idMath::ACos( angle ); // distance along cylinder hull rotatedDistance = angle * radius; // if the barrel moved further than it rotated about it's axis if ( movedDistance > rotatedDistance ) { // additional rotation of the visual model to make it look // like the barrel rolls instead of slides angle = 180.0f * (movedDistance - rotatedDistance) / (radius * idMath::PI); if ( gravityNormal.Cross( curAxis[barrelAxis] ) * dir < 0.0f ) { additionalRotation += angle; } else { additionalRotation -= angle; } dir = vec3_origin; dir[barrelAxis] = 1.0f; additionalAxis = idRotation( vec3_origin, dir, additionalRotation ).ToMat3(); } } } // save state for next think lastOrigin = curOrigin; lastAxis = curAxis; } Present(); }