Ejemplo n.º 1
0
static void SavePanickedReplay()
{
    if (!IsInGame())
        return;
    // Add some frames (1 should be enough) to make crash surely reproductable
    bw::replay_header->replay_end_frame = *bw::frame_count + 50;
    SaveReplay("crash", 1);
}
Ejemplo n.º 2
0
//実行
int CSystem::Run()
{
	switch(state) {
	case SYSTEM_NORMAL://通常
		count++;
		if( GetInputPause() && (g_pBoss==NULL||g_pBoss->pTalk==NULL) ) {
			sndPause.Play(0);
			state = SYSTEM_PAUSE;
			g_pGame->Stop();
		}
		if( fullpower_count > 0 )
			fullpower_count--;
		if( spellbonus_count > 0 )
			spellbonus_count--;
		//リプレイ動作
		SunReplay.Run();
		break;
	case SYSTEM_PAUSE://ポーズ中
		{
			int old = pause_select;
			int maxpause = ( g_pTitle->title_select == 3 ) ? 2 : 3;
			pause_select += GetInputUD();
			pause_select = mod(pause_select,maxpause);
			if( pause_select != old )
				g_pTitle->sndSelect.Play(0);
			if(GetInputDecide()) {
				g_pTitle->sndDecide.Play(0);
				switch(pause_select) {
				case 0://ゲームを再開する
					ResumeGame();
					break;
				case 1://タイトルに戻る
					ReturnTitle();
					return 0;
				case 2://はじめからやり直す
					Restart();
					break;
				}
			}
		}
		if( GetInputPause() ) {
			ResumeGame();
		}
		break;
	case SYSTEM_GAMEOVER://ゲームオーバー
		{
			int old = gameover_select;
			gameover_select += GetInputUD();
			gameover_select = mod(gameover_select,2);
			if( gameover_select != old )
				g_pTitle->sndSelect.Play(0);
			if(GetInputDecide()) {
				g_pTitle->sndDecide.Play(0);
				switch(gameover_select) {
				case 0://コインいっこいれる
					life = 2;
					bomb = 3;
					continue_dirty = 1;
					continue_rest--;
					score = 0;
					graze = 0;
					//ゲーム再開
					this->ResumeGame();
					//弾をすべてアイテムに
					TamaToItem();
					//エフェクト
					g_lEffect2.Add( new CEffectDamage( g_pPlayer->GetX(),g_pPlayer->GetY() ));
					//位置初期化
					g_pPlayer->ResetPosition();
					break;
				case 1://人生をあきらめる
					if( g_pGame->mode == 0 || g_pGame->mode == 2 ) {
						g_pSystem->SaveReplay();
					}
					else {
						g_pTitle->Resume();
						return 0;
					}
					break;
				}
			}
		}
		break;
	case SYSTEM_REPLAY://リプレイ保存
		if( continue_dirty == 0 ) {
			int old = replay_select;
			replay_select += GetInputUD();
			replay_select = mod(replay_select,2);
			if( replay_select != old )
				g_pTitle->sndSelect.Play(0);
			if(GetInputDecide()) {
				g_pTitle->sndDecide.Play(0);
				switch(replay_select) {
				case 0://もちろん!
					SunReplay.Save();
					break;
				case 1://抹消
					break;
				}
				SunReplay.Exit();
				ReturnTitle();
				return 0;
			}
		}
		else if(GetInputDecide()) {
			g_pTitle->sndDecide.Play(0);
			SunReplay.Exit();
			ReturnTitle();
		}
		break;
	case SYSTEM_RESULT://ステージリザルト
		count++;
		switch( result_mode ) {
		case 0:
			result_count ++;
			//リプレイ動作
			SunReplay.Run();
			if( result_count == RESULT_COUNT ) {
				result_count = 0;
				result_mode ++;
				g_pGame->Stop();
			}
			break;
		case 1:
			result_count ++;
			if( GetInputDecide() || (g_pGame->mode == 3 && result_count > 180)) {
				result_count = 0;
				result_mode ++;
				g_pTitle->sndDecide.Play(0);

				g_lShot.DeleteAll();
				g_lLaser.DeleteAll();
				g_lTama.DeleteAll();
				g_lItem.DeleteAll();
				g_lEnemy.DeleteAll();
				g_lEffect.DeleteAll();
				g_lEffect2.DeleteAll();
				g_lEffect3.DeleteAll();
				SAFE_DELETE( g_pStage );
				g_pPlayer->ResetState();
				g_pGame->stop = 0;
				AddScore( (1+life*4+bomb)*g_pGame->stage*(1+GetDifficult())*10000 );
				if( (g_pGame->mode == 0 || (g_pGame->mode == 3&&SunReplay.m_header.mode==0)) && g_pGame->stage <= STAGE_NUM ) {
					g_pGame->CreateStage();
				}
				else if( g_pGame->mode == 2 || (g_pGame->mode==0&&g_pGame->stage > STAGE_NUM) ) {
					SaveReplay();
				}
				else{
					g_pTitle->Resume();
					return 0;
				}
			}
			break;
		case 2:
			result_count ++;
			//リプレイ動作
			SunReplay.Run();
			if( result_count == RESULT_COUNT ) {
				result_count = 0;
				result_mode = 0;
				state = SYSTEM_NORMAL;
				g_pGame->Resume();
			}
			break;
		}
		break;
	case SYSTEM_RESUME: //ゲームに復帰中
		resume_count--;
		if( resume_count == 0 ) {
			g_pGame->Resume();
		}
		break;
	}
	return 1;
}