void dfParticleSystem::Update() { dfComponent::Init(); if(active) { timer += dfDeltaTime; if(timer > nextParticleTime && numParticles < maxActiveParticles) { CreateParticle(); nextParticleTime = minSecondsBetweenParticles + (dfRand() * (maxSecondsBetweenParticles - minSecondsBetweenParticles)); } } for(int i = 0; i < numParticles; i++) { if(particles[i].color.x == 1 && particles[i].color.y == 1 && particles[i].color.z == 1) int fut = 4; if(!particles[i].dead) { UpdateParticle(particles[i], i); } } }
void UpdateParticleEmitter(ParticleEmitter *pE, Vector2 newPosition) { pE->position = Vector2Add(newPosition, pE->offset); pE->source.position = pE->position; if (pE->framesCounter>=pE->spawnFrequency) { for (int i=0; i<MAX_PARTICLES; i++) { if (!pE->particles[i].isActive) { SetParticleActive(&pE->particles[i], TRUE); InitPlayerParticle(&pE->particles[i]); i = MAX_PARTICLES; pE->framesCounter = 0; } } } pE->framesCounter++; for (int i=0; i<MAX_PARTICLES; i++) { if (pE->particles[i].isActive) { UpdateParticle(&pE->particles[i], GetGravityForce(pE->gravity)); } } }
void Emitter::Update(float dt) { if(emittedParticles.empty()) return; ParticlePtrList::iterator pit = emittedParticles.begin(); for(; pit != emittedParticles.end(); pit++) { ParticlePtr & particle = *pit; particle->DecrementTTL(); if(!affectors.empty()) { AffectorPtrList::iterator ait = affectors.begin(); for(; ait != affectors.end(); ait++) { Affector & affector = **ait; affector.Update(particle, dt); } } if(particle->IsAlive()) { UpdateParticle(particle, dt); } else { pit = emittedParticles.erase(pit); } } }
void ParticleEngine( double t, float dt ) { int i; float dt2; // Update particles (iterated several times per frame if dt is too // large) while( dt > 0.0f ) { // Calculate delta time for this iteration dt2 = dt < MIN_DELTA_T ? dt : MIN_DELTA_T; // Update particles for( i = 0; i < MAX_PARTICLES; i ++ ) { UpdateParticle( &particles[ i ], dt2 ); } // Increase minimum age min_age += dt2; // Should we create any new particle(s)? while( min_age >= BIRTH_INTERVAL ) { min_age -= BIRTH_INTERVAL; // Find a dead particle to replace with a new one for( i = 0; i < MAX_PARTICLES; i ++ ) { if( !particles[ i ].active ) { InitParticle( &particles[ i ], t + min_age ); UpdateParticle( &particles[ i ], min_age ); break; } } } // Decrease frame delta time dt -= dt2; } }
void Scene::DrawParticle(Emitter* emitter, float dt) { // Simulate all particles glBlendFunc(GL_SRC_ALPHA, GL_ONE); // Get info from emitter and send them to shader //vec3 centreColor = emitter->GetColor(); //vec3 edgeColor = emitter->GetEdgeColor(); //vec3 direction = emitter->GetDirection(); glUniform1i(m_GSM->GetGLManager()->GetUnifrom(TYPE), emitter->GetType()); //glUniform3f(m_GSM->GetGLManager()->GetUnifrom(EMITTER_COLOR), centreColor.x, centreColor.y, centreColor.z); //glUniform3f(m_GSM->GetGLManager()->GetUnifrom(EMITTER_EDGE), edgeColor.x, edgeColor.y, edgeColor.z); //glUniform3f(m_GSM->GetGLManager()->GetUnifrom(EMITTER_DIR), direction.x, direction.y, direction.z); //glUniform1d(m_GSM->GetGLManager()->GetUnifrom(EMITTER_RNDSCL), emitter->GetRandomScaleToggle()); //glUniform1d(m_GSM->GetGLManager()->GetUnifrom(EMITTER_EXPLO), emitter->GetExplosionToggle()); //glUniform1f(m_GSM->GetGLManager()->GetUnifrom(EMITTER_BOUND), emitter->GetBoundary()); //glUniform1i(m_GSM->GetGLManager()->GetUnifrom(EMITTER_TYPE), emitter->GetMode()); for (auto it = emitter->GetParticleContainer().begin(); it != emitter->GetParticleContainer().end(); ++it) { // Update pipeline Pipeline(*it, dt); vec3 centreColor = emitter->GetColor(); glUniform4f(m_GSM->GetGLManager()->GetUnifrom(COLOR), centreColor.x, centreColor.y, centreColor.z, (*it)->m_life); glUniformMatrix4fv(m_GSM->GetGLManager()->GetUnifrom(UV), 1, GL_FALSE, &m_animation.m_member[0][0]); UpdateParticle((*it)); //Refresh the buffer data glBufferData(GL_ARRAY_BUFFER, sizeof(m_vertex_buffer_data), m_vertex_buffer_data, GL_STATIC_DRAW); // Bind our texture in Texture Unit 0 glBindTexture(GL_TEXTURE_2D, emitter->GetTexture()->GetTexId()); // Draw the quad glDrawArrays(GL_QUADS, 0, 4); } }
void ParticleSystem::Update( float dt, Vec3 pos ) { camPos = pos; numDead = 0; if (particles.size() && running) { for (std::list<Particle>::iterator i = particles.begin(); i != particles.end(); i++) { if (initLife <= 0.0 || i->lifespan > 0.0f) UpdateParticle(dt, &*i); else if (initRespawn <= 0.0f || i->numlives > 0) SpawnParticle(&*i); else { numDead++; } } } }
void ParticleSystem::Update(float timeDelta) { colours.clear(); vertices.clear(); sizes.clear(); std::list<Particle>::iterator it = particles.begin(); while (it != particles.end()) { if (it->alive) { UpdateParticle(timeDelta, * it); if (it->alive) { colours.push_back(it->diffuse); vertices.push_back(it->position); sizes.push_back(it->size); } } it ++; } }
void ParticleEmitterInstance::UpdateEmitter(float aDeltaTime, const CU::Matrix44f& aWorldMatrix) { myEmissionTime -= aDeltaTime; myEmitterLife -= aDeltaTime; UpdateParticle(aDeltaTime); if (myEmissionTime <= 0.f && (myEmitterLife > 0.f || myParticleEmitterData->myUseEmitterLifeTime == false) && myShouldLive == true) { EmitParticle(aWorldMatrix); myEmissionTime = myParticleEmitterData->myEmissionRate * 8.f; if (myIsCloseToPlayer == false) myEmissionTime = myParticleEmitterData->myEmissionRate; } if (myEmitterLife <= 0.f && myDeadParticleCount == myLogicalParticles.Size()) { myIsActive = false; } }
bool ParticleSystem::UpdateSystem( float frametime ) { // the entity emitting this system cl_entity_t *source = UTIL_GetClientEntityWithServerIndex( m_iEntIndex ); if(!source) { // gEngfuncs.Con_Printf("ent not found\n" ); return false; } // Don't update if the system is outside the player's PVS. if (source->curstate.msg_time < gEngfuncs.GetClientTime()) { //remove particles enable = 0; } else enable = (source->curstate.renderfx == kRenderFxAurora); //check for contents to remove if(m_iKillCondition == gEngfuncs.PM_PointContents(source->curstate.origin, NULL)) { enable = 0; } if (m_pMainParticle == NULL) { if (enable) { ParticleType *pType = m_pMainType; if (pType) { m_pMainParticle = pType->CreateParticle(this);//m_pMainParticle); if (m_pMainParticle) { m_pMainParticle->m_iEntIndex = m_iEntIndex; m_pMainParticle->age_death = -1; // never die } } } } else if (!enable) { m_pMainParticle->age_death = 0; // die now m_pMainParticle = NULL; } particle* pParticle = m_pActiveParticle; particle* pLast = NULL; while( pParticle ) { if( UpdateParticle( pParticle, frametime ) ) { pLast = pParticle; pParticle = pParticle->nextpart; } else // deactivate it { if (pLast) { pLast->nextpart = pParticle->nextpart; pParticle->nextpart = m_pFreeParticle; m_pFreeParticle = pParticle; pParticle = pLast->nextpart; } else // deactivate the first particle in the list { m_pActiveParticle = pParticle->nextpart; pParticle->nextpart = m_pFreeParticle; m_pFreeParticle = pParticle; pParticle = m_pActiveParticle; } } } return true; }
/** *@brief メインウインドウのコンストラクタ *@param argc コマンドライン引数の数 *@param argv コマンドライン引数 *@param parent 親ウィジェット */ MainWindow::MainWindow(int argc, char** argv, QWidget *parent) : QMainWindow(parent) { tc = QTextCodec::codecForLocale(); QHBoxLayout *layout = new QHBoxLayout; mOgreWidget = new OgreWidget() ; layout->addWidget(mOgreWidget); tabWidget = new QTabWidget; mBodySetWidget = new BodySetWidget(); tabWidget->addTab(mBodySetWidget, tc->toUnicode("ボディ")); mBornSetWidget = new BornSetWidget(); tabWidget->addTab(mBornSetWidget, tc->toUnicode("ボーン")); mCameraSetWidget = new CameraSetWidget(); tabWidget->addTab(mCameraSetWidget, tc->toUnicode("カメラ")); mGUISetWidget = new GUISetWidget(); tabWidget->addTab(mGUISetWidget, tc->toUnicode("CEGUI")); mGUITextSetWidget = new GUITextSetWidget(); tabWidget->addTab(mGUITextSetWidget, tc->toUnicode("CEGUIのテキスト")); mImageSetWidget = new ImageSetWidget(); tabWidget->addTab(mImageSetWidget, tc->toUnicode("CEGUIの画像")); mParticleSetWidget = new ParticleSetWidget(); tabWidget->addTab(mParticleSetWidget, tc->toUnicode("パーティクル")); mSubWindowSetWidget = new SubWindowSetWidget(); tabWidget->addTab(mSubWindowSetWidget, tc->toUnicode("画面分割")); mAnimationSetWidget = new AnimationSetWidget(); tabWidget->addTab(mAnimationSetWidget, tc->toUnicode("アニメーション")); mLightSetWidget = new LightSetWidget(); tabWidget->addTab(mLightSetWidget, tc->toUnicode("光源")); mNodeSetWidget = new NodeSetWidget(); tabWidget->addTab(mNodeSetWidget, tc->toUnicode("ノード")); mSimulationSetWidget = new SimulationSetWidget(); tabWidget->addTab(mSimulationSetWidget, tc->toUnicode("物理シミュレーション(設定)")); mSimBodySetWidget = new SimBodySetWidget(); tabWidget->addTab(mSimBodySetWidget, tc->toUnicode("物理シミュレーション(ボディ)")); mSimJointSetWidget = new SimJointSetWidget(); tabWidget->addTab(mSimJointSetWidget, tc->toUnicode("物理シミュレーション(ジョイント)")); mOtherSetWidget = new OtherSetWidget(); tabWidget->addTab(mOtherSetWidget, tc->toUnicode("その他")); connect(mBodySetWidget, SIGNAL(UpdateBody()), mBornSetWidget, SLOT(UpdateBody())); connect(mGUISetWidget, SIGNAL(UpdateGUI()), mGUITextSetWidget, SLOT(UpdateGUI())); connect(mGUISetWidget, SIGNAL(UpdateGUI()), mImageSetWidget, SLOT(UpdateGUI())); connect(this, SIGNAL(UpdateList()), mBodySetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mCameraSetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mGUISetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mGUITextSetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mImageSetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mParticleSetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mSubWindowSetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mAnimationSetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mLightSetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mNodeSetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mSimulationSetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mSimBodySetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mSimJointSetWidget, SLOT(UpdateList())); connect(this, SIGNAL(UpdateList()), mOtherSetWidget, SLOT(UpdateList())); connect(mBodySetWidget, SIGNAL(UpdateBody()), mNodeSetWidget, SLOT(UpdateList())); connect(mParticleSetWidget, SIGNAL(UpdateParticle()), mNodeSetWidget, SLOT(UpdateList())); connect(mAnimationSetWidget, SIGNAL(UpdateAnimation()), mNodeSetWidget, SLOT(UpdateList())); connect(mLightSetWidget, SIGNAL(UpdateLight()), mNodeSetWidget, SLOT(UpdateList())); connect(mSimBodySetWidget, SIGNAL(UpdateODEBody()), mNodeSetWidget, SLOT(UpdateList())); connect(mSimJointSetWidget, SIGNAL(UpdateODEJoint()), mNodeSetWidget, SLOT(UpdateList())); connect(mSimBodySetWidget, SIGNAL(UpdateODEBody()), mSimJointSetWidget, SLOT(UpdateList())); connect(mOgreWidget, SIGNAL(mouseMoveSignal(QMouseEvent*, int, int)), mCameraSetWidget, SLOT(mouseMoveSlot(QMouseEvent*, int, int))); connect(mOgreWidget, SIGNAL(mousePressSignal(QMouseEvent*)), mCameraSetWidget, SLOT(mousePressSlot(QMouseEvent*))); connect(mOgreWidget, SIGNAL(mouseReleaseSignal(QMouseEvent*)), mCameraSetWidget, SLOT(mouseReleaseSlot(QMouseEvent*))); connect(mOgreWidget, SIGNAL(mouseMoveSignal(QMouseEvent*, int, int)), mBodySetWidget, SLOT(mouseMoveSlot(QMouseEvent*, int, int))); connect(mOgreWidget, SIGNAL(mousePressSignal(QMouseEvent*)), mBodySetWidget, SLOT(mousePressSlot(QMouseEvent*))); connect(mOgreWidget, SIGNAL(mouseReleaseSignal(QMouseEvent*)), mBodySetWidget, SLOT(mouseReleaseSlot(QMouseEvent*))); QVBoxLayout *alayout = new QVBoxLayout; alayout->addWidget(tabWidget); QWidget *awidget = new QWidget; awidget->setLayout(alayout); tabWidget->setMinimumSize(250, 768); tabWidget->setMaximumWidth(250); QScrollArea *area = new QScrollArea(); area->setWidget(awidget); area->setMaximumSize(300, 708); area->setMinimumSize(300, 708); layout->addWidget(area); QWidget *widget = new QWidget; widget->setLayout(layout); widget->setMinimumSize(1244, 708); setCentralWidget(widget); setWindowTitle(tr("OgreRTC")); setUnifiedTitleAndToolBarOnMac(true); mOgreWidget->initOgre(); EC = mOgreWidget->mOgreRTCApplication; mBodySetWidget->EC = mOgreWidget->mOgreRTCApplication; mBornSetWidget->EC = mOgreWidget->mOgreRTCApplication; mCameraSetWidget->EC = mOgreWidget->mOgreRTCApplication; mGUISetWidget->EC = mOgreWidget->mOgreRTCApplication; mGUITextSetWidget->EC = mOgreWidget->mOgreRTCApplication; mImageSetWidget->EC = mOgreWidget->mOgreRTCApplication; mParticleSetWidget->EC = mOgreWidget->mOgreRTCApplication; mSubWindowSetWidget->EC = mOgreWidget->mOgreRTCApplication; mAnimationSetWidget->EC = mOgreWidget->mOgreRTCApplication; mLightSetWidget->EC = mOgreWidget->mOgreRTCApplication; mNodeSetWidget->EC = mOgreWidget->mOgreRTCApplication; mSimulationSetWidget->EC = mOgreWidget->mOgreRTCApplication; mSimBodySetWidget->EC = mOgreWidget->mOgreRTCApplication; mSimJointSetWidget->EC = mOgreWidget->mOgreRTCApplication; mOtherSetWidget->EC = mOgreWidget->mOgreRTCApplication; createAction(); createMenus(); if(EC && argc > 1) { EC->reset(); EC->OpenFile(argv[1]); } }
/* ==================== Update ==================== */ void CParticleEngine::Update( void ) { if(m_pCvarParticleDebug->value) { gEngfuncs.Con_Printf("Created Particles: %i, Freed Particles %i, Active Particles: %i\nCreated Systems: %i, Freed Systems: %i, Active Systems: %i\n\n", m_iNumCreatedParticles, m_iNumFreedParticles,m_iNumCreatedParticles-m_iNumFreedParticles, m_iNumCreatedSystems, m_iNumFreedSystems, m_iNumCreatedSystems-m_iNumFreedSystems); } if(m_pCvarDrawParticles->value < 1) return; m_flFrameTime = gEngfuncs.GetClientTime() - m_flLastDraw; m_flLastDraw = gEngfuncs.GetClientTime(); if (m_flFrameTime > 1) m_flFrameTime = 1; if (m_flFrameTime <= 0) return; // No systems to check on if(!m_pSystemHeader) return; UpdateSystems(); // Update all particles particle_system_t *psystem = m_pSystemHeader; while(psystem) { cl_particle_t *pparticle = psystem->particleheader; while(pparticle) { if(!UpdateParticle(pparticle)) { cl_particle_t *pfree = pparticle; pparticle = pfree->next; if(!pfree->prev) { psystem->particleheader = pparticle; if(pparticle) pparticle->prev = NULL; } else { pfree->prev->next = pparticle; if(pparticle) pparticle->prev = pfree->prev; } m_iNumFreedParticles++; delete [] pfree; continue; } cl_particle_t *pnext = pparticle->next; pparticle = pnext; } particle_system_t *pnext = psystem->next; psystem = pnext; } }
HRESULT KG3DSFXParticleContainer::RenderParticle(const KG3DSFX* pSfx, float fCurrentFrame) { ASSERT(pSfx); if (!m_spVertexBuffer || !pSfx) return E_FAIL; KG3DTexture *pTexture = NULL; KG3DRenderState R; m_dwActiveNumber = 0; /* * update all acitve particle */ UpdateParticle(fCurrentFrame); /* * render, order by texture, blend mode */ g_pd3dDevice->SetStreamSource(0, m_spVertexBuffer, 0, sizeof(VFormat::_Faces_Diffuse_Texture1)); g_pd3dDevice->SetFVF(D3DFVF_Faces_Diffuse_Texture1); for (size_t i = 0; i < m_uSfxTextNum; ++i) { pSfx->GetTexture((UINT)i, &pTexture); if (pTexture && pTexture->IsResourceReady()) { pTexture->SetTexture(g_pd3dDevice,0); for (UINT j = 0; j < SFX_BM_NUM; ++j) { size_t uRectNum = 0; SetRenderState(R, j); PrepareVertexBuffer(m_vecSortedRectParticle[i]->m_vecRectParticle[j], m_vecSortedRectParticle[i]->m_NextFreeIndex[j], &uRectNum); if (m_uPrimitiveNum == 0) { R.Restore(); continue; } ASSERT(m_uPrimitiveNum == uRectNum* 2); ASSERT(m_uPrimitiveNum < 65535); g_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, m_uPrimitiveNum); m_dwActiveNumber += m_uPrimitiveNum; m_uPrimitiveNum = 0; R.Restore(); } } } g_pd3dDevice->SetStreamSource(0, 0, 0, 0); return S_OK; }
bool ParticleSystem::UpdateSystem( float frametime ) { // the entity emitting this system edict_t *source = GetEntityByIndex( m_iEntIndex ); if( !source ) return false; // Don't update if the system is outside the player's PVS. enable = (source->v.renderfx == kRenderFxAurora); // check for contents to remove if( POINT_CONTENTS( source->v.origin ) == m_iKillCondition ) { enable = 0; } if( m_pMainParticle == NULL ) { if ( enable ) { ParticleType *pType = m_pMainType; if ( pType ) { m_pMainParticle = pType->CreateParticle( this ); if ( m_pMainParticle ) { m_pMainParticle->m_iEntIndex = m_iEntIndex; m_pMainParticle->age_death = -1; // never die } } } } else if ( !enable ) { m_pMainParticle->age_death = 0; // die now m_pMainParticle = NULL; } particle* pParticle = m_pActiveParticle; particle* pLast = NULL; while( pParticle ) { if ( UpdateParticle( pParticle, frametime )) { pLast = pParticle; pParticle = pParticle->nextpart; } else // deactivate it { if ( pLast ) { pLast->nextpart = pParticle->nextpart; pParticle->nextpart = m_pFreeParticle; m_pFreeParticle = pParticle; pParticle = pLast->nextpart; } else // deactivate the first particle in the list { m_pActiveParticle = pParticle->nextpart; pParticle->nextpart = m_pFreeParticle; m_pFreeParticle = pParticle; pParticle = m_pActiveParticle; } } } return true; }
AURSTATE CParticleSystem :: UpdateSystem( float frametime ) { if( m_pEntity != NULL ) { // don't update if the system is outside the player's PVS. if( m_pEntity->curstate.messagenum != r_currentMessageNum ) { // but always update rocket particles if( !FBitSet( m_pEntity->curstate.effects, EF_NUKE_ROCKET )) return AURORA_INVISIBLE; } // time-based particle system if( m_fLifeTime != 0.0f ) { enable = (m_fLifeTime >= RI.refdef.time) ? true : false; } else { enable = (m_pEntity->curstate.renderfx == kRenderFxAurora) ? true : false; } // check for contents to remove if( m_iKillCondition == POINT_CONTENTS( m_pEntity->origin )) { m_pEntity = NULL; enable = false; } } else { enable = false; } if( m_pEntity != NULL ) { Vector angles = m_pEntity->angles; // get the system entity matrix if( m_iEntAttachment && m_pEntity->model->type == mod_studio ) entityMatrix.FromVector( R_StudioAttachmentDir( m_pEntity, m_iEntAttachment - 1 )); else entityMatrix = matrix3x3( angles ); } if( m_pMainParticle == NULL ) { if( enable ) { CParticleType *pType = m_pMainType; if( pType ) { m_pMainParticle = pType->CreateParticle( this ); if( m_pMainParticle ) { // first origin initialize if( m_iEntAttachment && m_pEntity->model->type == mod_studio ) m_pMainParticle->origin = R_StudioAttachmentPos( m_pEntity, m_iEntAttachment - 1 ); else m_pMainParticle->origin = m_pEntity->origin; m_pMainParticle->m_pEntity = m_pEntity; m_pMainParticle->age_death = -1.0f; // never die } } } } else if( !enable ) { MarkForDeletion(); } // last particle is died, allow to remove partsystem if( !m_pEntity && !m_pActiveParticle ) return AURORA_REMOVE; CParticle *pParticle = m_pActiveParticle; CParticle *pLast = NULL; while( pParticle ) { if( UpdateParticle( pParticle, frametime )) { pLast = pParticle; pParticle = pParticle->nextpart; } else { // deactivate it if( pLast ) { pLast->nextpart = pParticle->nextpart; pParticle->nextpart = m_pFreeParticle; m_pFreeParticle = pParticle; pParticle = pLast->nextpart; } else { // deactivate the first CParticle in the list m_pActiveParticle = pParticle->nextpart; pParticle->nextpart = m_pFreeParticle; m_pFreeParticle = pParticle; pParticle = m_pActiveParticle; } } } return AURORA_DRAW; }
/******************************************************************************* 関数名: void UpdateGame(void) 引数: なし 戻り値: なし 説明: ゲームの更新関数 *******************************************************************************/ void UpdateGame(void) { //初期値 g_fTimeSpeed = 0.01f; GAME_STEP stepNow = GetGameStep(); switch(stepNow) { case STEP_PLAY: UpdatePlayer(); UpdateCamera(); UpdateGun(); UpdatePlayerBullet(g_fTimeSpeed); UpdateEnemy( g_fTimeSpeed); UpdateEnemyBullet( g_fTimeSpeed); //UpdateBillBoard(); UpdateParticle( g_fTimeSpeed); UpdateStageManager( g_fTimeSpeed); //UpdateModel(); UpdateGunSight(); UpdateItemBullet(); UpdateClock( g_fTimeSpeed); UpdateTime( g_fTimeSpeed); if(GetKeyboardTrigger(DIK_P) ) { SetGameStep(STEP_PAUSE); SetMessage(MSG_PAUSE); } break; case STEP_SHOOT: ChangeTimeSpeed( 1.0f); UpdateEnemy( g_fTimeSpeed); //UpdatePlayer(); UpdatePlayerBullet( g_fTimeSpeed); //UpdateEnemyBullet( g_fTimeSpeed); UpdateClock( g_fTimeSpeed); UpdateTime( g_fTimeSpeed); g_nCounterShoot++; if( g_nCounterShoot > 15) { g_nCounterShoot = 0; SetGameStep(STEP_PLAY); } break; case STEP_PAUSE: StopSound(); if(GetKeyboardTrigger(DIK_P) ) { SetGameStep(STEP_PLAY); ClearMessage(MSG_PAUSE); } break; case STEP_DIE: ChangeTimeSpeed( 1.0f); UpdateEnemy( g_fTimeSpeed); UpdateEnemyBullet( g_fTimeSpeed); UpdatePlayerBullet( g_fTimeSpeed); UpdateParticle( g_fTimeSpeed); g_nCounterFrame++; if( g_nCounterFrame > 90) { g_nCounterFrame = 0; if( GetPlayer()->nLife <= 0) { FadeOutToNext(MODE_RESULT); } else { FadeOutToNext(STEP_RESET); SetGameStep(STEP_NOTHING); } } break; case STEP_RESET: InitStageManager( false, GetPlayer()->nLife); SetGameStep(STEP_PLAY); break; case STEP_CLEAR: StopSound(SOUND_LABEL_SE_RUN); SetMessage(MSG_STAGECLEAR); g_nCounterFrame++; if( g_nCounterFrame > 90) { g_nCounterFrame = 0; switch(GetStageMode()) { case STAGE0: FadeOutToNext(STAGE1); break; case STAGE1: FadeOutToNext(STAGE2); break; case STAGE2: FadeOutToNext(STAGE3); break; case STAGE3: FadeOutToNext(MODE_RESULT); g_bGameClear = true; break; } SetGameStep(STEP_NOTHING); } break; case STEP_NOTHING: //just let time go, and do nothing break; } //UI update UpdateNumBullet(); //Debug update UpdateMeshDome(); if(GetKeyboardTrigger(DIK_RETURN) ) { FadeOutToNext(MODE_RESULT); } if(GetKeyboardTrigger(DIK_F3)) { PlaySound( SOUND_LABEL_SE_CLEAR); SetGameStep(STEP_CLEAR); } if(GetKeyboardTrigger(DIK_F2)) { PlaySound(SOUND_LABEL_SE_SWITCH); SwitchDebug(); } }