Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

CommandGame.cpp 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*!
  2. * \file src/commands/CommandGame.cpp
  3. * \brief Game meta-commands
  4. *
  5. * \author xythobuz
  6. */
  7. #include "global.h"
  8. #include "Game.h"
  9. #include "Log.h"
  10. #include "RunTime.h"
  11. #include "World.h"
  12. #include "commands/CommandGame.h"
  13. std::string CommandPos::name() {
  14. return "pos";
  15. }
  16. std::string CommandPos::brief() {
  17. return "Print position info";
  18. }
  19. int CommandPos::execute(std::istream& args) {
  20. if ((!getRunTime().isRunning()) || (!getGame().isLoaded())) {
  21. getLog() << "Use pos command interactively!" << Log::endl;
  22. return -1;
  23. }
  24. getGame().getLara().print();
  25. return 0;
  26. }
  27. // --------------------------------------
  28. std::string CommandViewmodel::name() {
  29. return "viewmodel";
  30. }
  31. std::string CommandViewmodel::brief() {
  32. return "INT - Change Laras model";
  33. }
  34. int CommandViewmodel::execute(std::istream& args) {
  35. if ((!getRunTime().isRunning()) || (!getGame().isLoaded())) {
  36. getLog() << "Use viewmodel command interactively!" << Log::endl;
  37. return -1;
  38. }
  39. //! \fixme Validate input
  40. std::string s;
  41. args >> s;
  42. unsigned int n = atoi(s.c_str());
  43. if (n < getWorld().sizeSkeletalModel()) {
  44. getGame().getLara().setSkeletalModel(n);
  45. return 0;
  46. } else {
  47. getLog() << "Invalid SkeletalModel index!" << Log::endl;
  48. return -2;
  49. }
  50. }