1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-26 04:12:41 +01:00

Add car spawner to debug menu

This commit is contained in:
Jannik Vogel 2016-05-26 22:10:57 +02:00
parent b23a81063d
commit 2e002013bd

View File

@ -5,6 +5,7 @@
#include <objects/VehicleObject.hpp> #include <objects/VehicleObject.hpp>
#include <engine/GameState.hpp> #include <engine/GameState.hpp>
#include <sstream> #include <sstream>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/string_cast.hpp> #include <glm/gtx/string_cast.hpp>
void jumpCharacter(RWGame* game, CharacterObject* player, const glm::vec3& target) void jumpCharacter(RWGame* game, CharacterObject* player, const glm::vec3& target)
@ -71,6 +72,13 @@ DebugState::DebugState(RWGame* game, const glm::vec3& vp, const glm::quat& vd)
}, entryHeight)); }, entryHeight));
} }
#endif #endif
m->addEntry(Menu::lambda("Add car", [=] {
auto playerRot = game->getPlayer()->getCharacter()->getRotation();
auto spawnPos = game->getPlayer()->getCharacter()->getPosition();
spawnPos += playerRot * glm::vec3(0.f, 3.f, 0.f);
auto spawnRot = glm::quat(glm::vec3(0.f, 0.f, glm::roll(playerRot) + glm::half_pi<float>()));
auto car = game->getWorld()->createVehicle(136, spawnPos, spawnRot);
}, entryHeight));
m->addEntry(Menu::lambda("Quicksave", [=] { m->addEntry(Menu::lambda("Quicksave", [=] {
game->saveGame("quicksave"); game->saveGame("quicksave");
}, entryHeight)); }, entryHeight));