bool Game_Interpreter_Map::CommandPlayMovie(RPG::EventCommand const& com) { // code 11560 const std::string& filename = com.string; int pos_x = ValueOrVariable(com.parameters[0], com.parameters[1]); int pos_y = ValueOrVariable(com.parameters[0], com.parameters[2]); int res_x = com.parameters[3]; int res_y = com.parameters[4]; Output::Warning("Couldn't play movie: %s. Movie playback is not implemented (yet).", filename.c_str()); Main_Data::game_screen->PlayMovie(filename, pos_x, pos_y, res_x, res_y); return true; }
bool Game_Interpreter::CommandChangeHP(RPG::EventCommand const& com) { // Code 10460 std::vector<Game_Actor*> actors = GetActors(com.parameters[0], com.parameters[1]); bool remove = com.parameters[2] != 0; int amount = ValueOrVariable(com.parameters[3], com.parameters[4]); bool lethal = com.parameters[5] != 0; if (remove) amount = -amount; for (std::vector<Game_Actor*>::iterator i = actors.begin(); i != actors.end(); ++i) { Game_Actor* actor = *i; int hp = actor->GetHp() + amount; if (!lethal && hp <= 0) { amount += hp * (-1) + 1; } actor->ChangeHp(amount); } if (lethal) { CheckGameOver(); } return true; }
bool Game_Interpreter::CommandChangeSkills(RPG::EventCommand const& com) { // Code 10440 std::vector<Game_Actor*> actors = GetActors(com.parameters[0], com.parameters[1]); bool remove = com.parameters[2] != 0; int skill_id = ValueOrVariable(com.parameters[3], com.parameters[4]); for (std::vector<Game_Actor*>::iterator i = actors.begin(); i != actors.end(); i++) { Game_Actor* actor = *i; if (remove) actor->UnlearnSkill(skill_id); else actor->LearnSkill(skill_id); } return true; }
bool Game_Interpreter_Map::CommandEnemyEncounter(RPG::EventCommand const& com) { // code 10710 if (Game_Message::visible) { return false; } Game_Temp::battle_troop_id = ValueOrVariable(com.parameters[0], com.parameters[1]); Game_Character *player = Main_Data::game_player.get(); Game_Battle::SetTerrainId(Game_Map::GetTerrainTag(player->GetX(), player->GetY())); switch (com.parameters[2]) { case 0: Game_Map::SetupBattle(); break; case 1: Game_Temp::battle_background = com.string; if (Player::IsRPG2k()) Game_Temp::battle_formation = 0; else Game_Temp::battle_formation = com.parameters[7]; break; case 2: Game_Battle::SetTerrainId(com.parameters[8]); break; default: return false; } Game_Temp::battle_escape_mode = com.parameters[3]; // 0 disallow, 1 end event processing, 2 victory/escape custom handler Game_Temp::battle_defeat_mode = com.parameters[4]; // 0 game over, 1 victory/defeat custom handler Game_Temp::battle_first_strike = com.parameters[5] != 0; if (Player::IsRPG2k()) Game_Battle::SetBattleMode(0); else Game_Battle::SetBattleMode(com.parameters[6]); // 0 normal, 1 initiative, 2 surround, 3 back attack, 4 pincer Game_Temp::battle_result = Game_Temp::BattleVictory; scene_call = Scene::Battle; SetContinuation(static_cast<ContinuationFunction>(&Game_Interpreter_Map::ContinuationEnemyEncounter)); return false; }
bool Game_Interpreter::CommandChangeEquipment(RPG::EventCommand const& com) { // Code 10450 std::vector<Game_Actor*> actors = GetActors(com.parameters[0], com.parameters[1]); int item_id; int type; int slot; switch (com.parameters[2]) { case 0: item_id = ValueOrVariable(com.parameters[3], com.parameters[4]); type = Data::items[item_id - 1].type; switch (type) { case RPG::Item::Type_weapon: case RPG::Item::Type_shield: case RPG::Item::Type_armor: case RPG::Item::Type_helmet: case RPG::Item::Type_accessory: slot = type - 1; default: return true; } break; case 1: item_id = 0; slot = com.parameters[3]; break; default: return false; } for (std::vector<Game_Actor*>::iterator i = actors.begin(); i != actors.end(); i++) { Game_Actor* actor = *i; actor->ChangeEquipment(slot, item_id); } return true; }
bool Game_Interpreter::CommandChangeSP(RPG::EventCommand const& com) { // Code 10470 std::vector<Game_Actor*> actors = GetActors(com.parameters[0], com.parameters[1]); bool remove = com.parameters[2] != 0; int amount = ValueOrVariable(com.parameters[3], com.parameters[4]); if (remove) amount = -amount; for (std::vector<Game_Actor*>::iterator i = actors.begin(); i != actors.end(); i++) { Game_Actor* actor = *i; int sp = actor->GetSp() + amount; if (sp < 0) sp = 0; actor->SetSp(sp); } return true; }