1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00

Implement some cheats and cheat activated message

This commit is contained in:
NFS_MONSTR 2018-06-18 22:15:31 +03:00
parent 7f249ecf89
commit f5f1fb3247
3 changed files with 56 additions and 50 deletions

View File

@ -217,3 +217,8 @@ bool GameState::isFading() const {
void GameState::setFadeColour(glm::i32vec3 colour) { void GameState::setFadeColour(glm::i32vec3 colour) {
fadeColour = colour; fadeColour = colour;
} }
void GameState::showHelpMessage(const GameStringKey& id) {
text.addText<ScreenTextType::Help>(
ScreenTextEntry::makeHelp(id, world->data->texts.text(id)));
}

View File

@ -450,6 +450,11 @@ public:
void swapInputState() { void swapInputState() {
input[1] = input[0]; input[1] = input[0];
} }
/**
* Adds help message
*/
void showHelpMessage(const GameStringKey& id);
}; };
#endif #endif

View File

@ -195,8 +195,7 @@ void RWGame::handleCheatInput(char symbol) {
#endif #endif
checkForCheat(health_cheat, [&] { checkForCheat(health_cheat, [&] {
player->getCurrentState().health = 100.f; player->getCurrentState().health = 100.f;
// @todo ShowHelpMessage("CHEAT3"); // III / VC: Inputting health state.showHelpMessage("CHEAT3"); // III / VC: Inputting health cheat.
// cheat.
}); });
#if RW_GAME_VERSION >= 1100 // Changed cheat name in version 1.1 #if RW_GAME_VERSION >= 1100 // Changed cheat name in version 1.1
@ -206,31 +205,40 @@ void RWGame::handleCheatInput(char symbol) {
#endif #endif
checkForCheat(armor_cheat, [&] { checkForCheat(armor_cheat, [&] {
player->getCurrentState().armour = 100.f; player->getCurrentState().armour = 100.f;
// @todo ShowHelpMessage("CHEAT4"); // III / VC: Inputting armor state.showHelpMessage("CHEAT4"); // III / VC: Inputting armor cheat.
// cheat.
}); });
checkForCheat("GUNSGUNSGUNS", [&] { checkForCheat("GUNSGUNSGUNS", [&] {
// @todo give player weapons constexpr std::array<int, 11> ammo = {1, //baseball bat
// @todo ShowHelpMessage("CHEAT2"); // III / VC: Inputting weapon 100,//pistol
// cheats. 100,//uzi
20, //shotgun
5, //grenade
5, //molotov
5, //rocket launcher
20, //flamethrower
200,//ak47
200,//m16
5 //sniper rifle
};
for (std::array<int, 11>::size_type i = 0; i < ammo.size(); i++)
player->addToInventory(i+1,ammo[i]);
state.showHelpMessage("CHEAT2"); // III / VC: Inputting weapon cheats.
}); });
checkForCheat("IFIWEREARICHMAN", [&] { checkForCheat("IFIWEREARICHMAN", [&] {
state.playerInfo.money += 250000; state.playerInfo.money += 250000;
// @todo ShowHelpMessage("CHEAT6"); // III: Inputting money cheat. state.showHelpMessage("CHEAT6"); // III: Inputting money cheat.
}); });
checkForCheat("MOREPOLICEPLEASE", [&] { checkForCheat("MOREPOLICEPLEASE", [&] {
// @todo raise to next wanted level // @todo raise to next wanted level
// @todo ShowHelpMessage("CHEAT5"); // III / VC: Inputting wanted state.showHelpMessage("CHEAT5"); // III / VC: Inputting wanted level cheats.
// level cheats.
}); });
checkForCheat("NOPOLICEPLEASE", [&] { checkForCheat("NOPOLICEPLEASE", [&] {
// @todo lower to next lower wanted level // @todo lower to next lower wanted level
// @todo ShowHelpMessage("CHEAT5"); // III / VC: Inputting wanted state.showHelpMessage("CHEAT5"); // III / VC: Inputting wanted level cheats.
// level cheats.
}); });
} }
@ -239,51 +247,49 @@ void RWGame::handleCheatInput(char symbol) {
checkForCheat("BANGBANGBANG", [&] { checkForCheat("BANGBANGBANG", [&] {
// @todo Explode nearby vehicles // @todo Explode nearby vehicles
// @todo What radius? // @todo What radius?
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
checkForCheat("GIVEUSATANK", [&] { checkForCheat("GIVEUSATANK", [&] {
// The iPod / Android version of the game (10th year anniversary) spawns random // The iPod / Android version of the game (10th year anniversary) spawns random
// (?) vehicles instead of always rhino // (?) vehicles instead of always rhino
#ifdef RW_GAME_GTA3_ANNIVERSARY #if RW_GAME_GTA3_ANNIVERSARY != 0
// uint16_t vehicleModel = 110; // @todo Which cars are spawned?! uint16_t vehicleModel = 110; // @todo Which cars are spawned?!
#else #else
// uint16_t vehicleModel = 122; uint16_t vehicleModel = 122;
#endif #endif
// @todo Spawn rhino const auto ch = getWorld()->getPlayer()->getCharacter();// @todo Change spawn place to be more like in original game
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most const auto playerRot = ch->getRotation();
// cheats. const auto spawnPos = ch->getPosition() + playerRot * glm::vec3(0.f, 3.f, 0.f);
const auto spawnRot = glm::quat(
glm::vec3(0.f, 0.f, glm::roll(playerRot) + glm::half_pi<float>()));
getWorld()->createVehicle(vehicleModel, spawnPos, spawnRot);
state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
}); });
checkForCheat("CORNERSLIKEMAD", [&] { checkForCheat("CORNERSLIKEMAD", [&] {
// @todo Weird car handling // @todo Weird car handling
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
checkForCheat("ANICESETOFWHEELS", [&] { checkForCheat("ANICESETOFWHEELS", [&] {
// @todo Hide car bodies // @todo Hide car bodies
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
checkForCheat("CHITTYCHITTYBB", [&] { checkForCheat("CHITTYCHITTYBB", [&] {
// @todo Cars can fly // @todo Cars can fly
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
checkForCheat("NASTYLIMBCHEAT", [&] { checkForCheat("NASTYLIMBCHEAT", [&] {
// @todo Makes it possible to shoot limbs off, iirc? // @todo Makes it possible to shoot limbs off, iirc?
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
checkForCheat("ILIKEDRESSINGUP", [&] { checkForCheat("ILIKEDRESSINGUP", [&] {
// @todo Which skins will be chosen? // @todo Which skins will be chosen?
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
} }
@ -293,36 +299,31 @@ void RWGame::handleCheatInput(char symbol) {
// @todo Give all pedestrians weapons.. this is also saved in the // @todo Give all pedestrians weapons.. this is also saved in the
// savegame?! // savegame?!
// @todo Which weapons do they get? // @todo Which weapons do they get?
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
checkForCheat("NOBODYLIKESME", [&] { checkForCheat("NOBODYLIKESME", [&] {
// @todo Set all pedestrians hostile towards player.. this is also // @todo Set all pedestrians hostile towards player.. this is also
// saved in the savegame?! // saved in the savegame?!
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
checkForCheat("ITSALLGOINGMAAAD", [&] { checkForCheat("ITSALLGOINGMAAAD", [&] {
// @todo Set all pedestrians to fighting each other.. this is also // @todo Set all pedestrians to fighting each other.. this is also
// saved in the savegame?! // saved in the savegame?!
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
// Game speed cheats // Game speed cheats
checkForCheat("TIMEFLIESWHENYOU", [&] { checkForCheat("TIMEFLIESWHENYOU", [&] {
// @todo Set fast gamespeed // @todo Set fast gamespeed
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
checkForCheat("BOOOOORING", [&] { checkForCheat("BOOOOORING", [&] {
// @todo Set slow gamespeed // @todo Set slow gamespeed
// @todo ShowHelpMessage("CHEAT1"); // III / VC: Inputting most state.showHelpMessage("CHEAT1"); // III / VC: Inputting most cheats.
// cheats.
}); });
} }
@ -330,32 +331,27 @@ void RWGame::handleCheatInput(char symbol) {
{ {
checkForCheat("ILIKESCOTLAND", [&] { checkForCheat("ILIKESCOTLAND", [&] {
// @todo Set weather to cloudy // @todo Set weather to cloudy
// @todo ShowHelpMessage("CHEAT7"); // III / VC: Inputting weather state.showHelpMessage("CHEAT7"); // III / VC: Inputting weather cheats.
// cheats.
}); });
checkForCheat("SKINCANCERFORME", [&] { checkForCheat("SKINCANCERFORME", [&] {
// @todo Set sunny / normal weather // @todo Set sunny / normal weather
// @todo ShowHelpMessage("CHEAT7"); // III / VC: Inputting weather state.showHelpMessage("CHEAT7"); // III / VC: Inputting weather cheats.
// cheats.
}); });
checkForCheat("MADWEATHER", [&] { checkForCheat("MADWEATHER", [&] {
// @todo Set bad weather // @todo Set bad weather
// @todo ShowHelpMessage("CHEAT7"); // III / VC: Inputting weather state.showHelpMessage("CHEAT7"); // III / VC: Inputting weather cheats.
// cheats.
}); });
checkForCheat("ILOVESCOTLAND", [&] { checkForCheat("ILOVESCOTLAND", [&] {
// @todo Set weather to rainy // @todo Set weather to rainy
// @todo ShowHelpMessage("CHEAT7"); // III / VC: Inputting weather state.showHelpMessage("CHEAT7"); // III / VC: Inputting weather cheats.
// cheats.
}); });
checkForCheat("PEASOUP", [&] { checkForCheat("PEASOUP", [&] {
// @todo Set weather to foggy // @todo Set weather to foggy
// @todo ShowHelpMessage("CHEAT7"); // III / VC: Inputting weather state.showHelpMessage("CHEAT7"); // III / VC: Inputting weather cheats.
// cheats.
}); });
} }
} }