123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- /*!
- * \file src/commands/CommandGame.cpp
- * \brief Game meta-commands
- *
- * \author xythobuz
- */
-
- #include "global.h"
- #include "Console.h"
- #include "Game.h"
- #include "OpenRaider.h"
- #include "World.h"
- #include "commands/CommandGame.h"
-
- std::string CommandPos::name() {
- return "pos";
- }
-
- std::string CommandPos::brief() {
- return "Print position info";
- }
-
- int CommandPos::execute(std::istream& args) {
- if ((!getOpenRaider().mRunning) || (!getGame().isLoaded())) {
- getConsole() << "Use pos command interactively!" << Console::endl;
- return -1;
- }
-
- getGame().getLara().print();
- return 0;
- }
-
- // --------------------------------------
-
- std::string CommandViewmodel::name() {
- return "viewmodel";
- }
-
- std::string CommandViewmodel::brief() {
- return "INT - Change Laras model";
- }
-
- int CommandViewmodel::execute(std::istream& args) {
- if ((!getOpenRaider().mRunning) || (!getGame().isLoaded())) {
- getConsole() << "Use viewmodel command interactively!" << Console::endl;
- return -1;
- }
-
- //! \fixme Validate input
-
- std::string s;
- args >> s;
- unsigned int n = atoi(s.c_str());
-
- if (n < getWorld().sizeSkeletalModel()) {
- getGame().getLara().setSkeletalModel(n);
- return 0;
- } else {
- getConsole() << "Invalid SkeletalModel index!" << Console::endl;
- return -2;
- }
- }
-
- // --------------------------------------
-
- std::string CommandPigtail::name() {
- return "pigtail";
- }
-
- std::string CommandPigtail::brief() {
- return "BOOL";
- }
-
- int CommandPigtail::execute(std::istream& args) {
- if ((!getOpenRaider().mRunning) || (!getGame().isLoaded())) {
- getConsole() << "Use pigtail command interactively!" << Console::endl;
- return -1;
- }
-
- bool b;
- args >> b;
- if (!args) {
- getConsole() << "Pass BOOL to pigtail command!" << Console::endl;
- return -2;
- }
-
- getGame().getLara().getModel().setPigTail(b);
- getConsole() << "Pigtail is now " << (b ? "on" : "off") << Console::endl;
- return 0;
- }
-
- // --------------------------------------
-
- std::string CommandPonypos::name() {
- return "ponypos";
- }
-
- std::string CommandPonypos::brief() {
- return "FLOAT FLOAT FLOAT FLOAT - x y z angle";
- }
-
- int CommandPonypos::execute(std::istream& args) {
- if ((!getOpenRaider().mRunning) || (!getGame().isLoaded())) {
- getConsole() << "Use ponypos command interactively!" << Console::endl;
- return -1;
- }
-
- float a, b, c, d;
- args >> a >> b >> c >> d;
- if (!args) {
- getConsole() << "Pass four FLOATs to ponypos command!" << Console::endl;
- return -2;
- }
-
- getGame().getLara().getModel().setPonyPos(a, b, c, d);
- return 0;
- }
|