Example #1
0
void Scene_Battle::Start() {
	if (Player::battle_test_flag) {
		Game_Temp::battle_troop_id = Player::battle_test_troop_id;
	}

	if (Game_Temp::battle_troop_id <= 0 ||
		Game_Temp::battle_troop_id > (int)Data::troops.size()) {
		char* error_msg = "Invalid Monster Party Id %d";
		if (Player::battle_test_flag) {
			Output::Error(error_msg, Game_Temp::battle_troop_id);
		}
		else {
			Output::Warning(error_msg, Game_Temp::battle_troop_id);
		}
		Game_Temp::battle_result = Game_Temp::BattleVictory;
		Scene::Pop();
		return;
	}

	Output::Debug("Starting battle %d (%s)", Game_Temp::battle_troop_id, Data::troops[Game_Temp::battle_troop_id-1].name.c_str());

	if (Player::battle_test_flag) {
		InitBattleTest();
	} else {
		Main_Data::game_enemyparty.reset(new Game_EnemyParty());
		Main_Data::game_enemyparty->Setup(Game_Temp::battle_troop_id);
	}

	Game_Battle::Init();

	cycle = 0;
	auto_battle = false;
	enemy_action = NULL;

	CreateUi();

	screen.reset(new Screen());

	Game_Temp::map_bgm = NULL; // Play map BGM on Scene_Map return
	Game_System::BgmPlay(Game_System::GetSystemBGM(Game_System::BGM_Battle));

	if (!Game_Temp::battle_background.empty())
		background.reset(new Background(Game_Temp::battle_background));
	else
		background.reset(new Background(Game_Battle::GetTerrainId()));

	SetState(State_Start);
}
Example #2
0
void Scene_Battle::Start() {
	if (Player::battle_test_flag) {
		Game_Temp::battle_troop_id = Player::battle_test_troop_id;
	}

	const RPG::Troop* troop = ReaderUtil::GetElement(Data::troops, Game_Temp::battle_troop_id);

	if (!troop) {
		const char* error_msg = "Invalid Monster Party ID %d";
		if (Player::battle_test_flag) {
			Output::Error(error_msg, Game_Temp::battle_troop_id);
		}
		else {
			Output::Warning(error_msg, Game_Temp::battle_troop_id);
		}
		Game_Temp::battle_result = Game_Temp::BattleVictory;
		Scene::Pop();
		return;
	}

	// Game_Temp::battle_troop_id is valid during the whole battle
	Output::Debug("Starting battle %d (%s)", Game_Temp::battle_troop_id, troop->name.c_str());

	if (Player::battle_test_flag) {
		InitBattleTest();
	} else {
		Main_Data::game_enemyparty.reset(new Game_EnemyParty());
		Main_Data::game_enemyparty->Setup(Game_Temp::battle_troop_id);
	}

	Game_Battle::Init();

	cycle = 0;
	auto_battle = false;
	enemy_action = NULL;

	CreateUi();

	Game_System::BgmPlay(Game_System::GetSystemBGM(Game_System::BGM_Battle));

	SetState(State_Start);
}
Example #3
0
//--------------------------------------------------------
bool TsceneStageSelect::Execute( double ElapsedTime)
{
	
	WORD inputBuff = Input().InputBuff;
	WORD DowninputBuff = Input().DownInputBuff;
	WORD UpInputBuff = Input().UpInputBuff;

	// [↓]
	if( inputBuff & KEY_DOWN && !FbButtonFlg ){
		ButtonDownSelect();
		FbButtonFlg = TRUE;

		if( !FbCursorFlg ){
			// カーソルの作成
			CreateUi(UI_CUR,Vector2D(-20,-20),Vector2D(0,0));
			FbCursorFlg = TRUE;
		}
	}
	// [↑]
	if( inputBuff & KEY_UP && !FbButtonFlg ){
		ButtonUpSelect();
		FbButtonFlg = TRUE;

		if( !FbCursorFlg ){
			// カーソルの作成
			CreateUi(UI_CUR,Vector2D(-20,-20),Vector2D(0,0));
			FbCursorFlg = TRUE;
		}

	}
	// キーの連続入力の防止
	if( UpInputBuff && FbButtonFlg ){
		FbButtonFlg = FALSE;
	}

	{	// ボタン
		std::vector< TBaseMovingObject * >::iterator it;

		for( it=FpButtons.begin(); it!=FpButtons.end(); it++ ) {
			(*it)->Update(ElapsedTime);
		}
	}

	{	// UI
		std::vector< TBaseMovingObject * >::iterator it;
		for( it=FpUis.begin(); it!=FpUis.end(); it++ ) {
			(*it)->Update(ElapsedTime);
		}
	}
	// シーンエンド条件:Zキーで決定する
	if( inputBuff & KEY_Z && !FbSceneEndFlg ){
		FbSceneEndFlg = TRUE;
	}
	// シーンエンド処理
	if(FbSceneEndFlg){
		FiTimer -= ElapsedTime;
		if(FiTimer <= 0){
			if(FbFadeFlg == FALSE){
				new TsceneFade();
				FbFadeFlg = TRUE;
				::OutputDebugString(TEXT("new fade\n"));
			}
		}
		if(FiTimer <= -2.0){
			TobjUi *ui = NULL;
			ui = (TobjUi*)GetSelectingBtn();
			new TsceneGame( PL_GRANDVISOR, ui->StgId );
			return false;
		}
	}
	return true;
}