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.

CommandSound.cpp 881B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*!
  2. * \file src/commands/CommandSound.cpp
  3. * \brief Sound command
  4. *
  5. * \author xythobuz
  6. */
  7. #include "global.h"
  8. #include "Game.h"
  9. #include "Log.h"
  10. #include "RunTime.h"
  11. #include "Sound.h"
  12. #include "commands/CommandSound.h"
  13. std::string CommandSound::name() {
  14. return "sound";
  15. }
  16. std::string CommandSound::brief() {
  17. return "INT - Test play sound";
  18. }
  19. void CommandSound::printHelp() {
  20. getLog() << "sound-Command Usage:" << Log::endl;
  21. getLog() << "sound-Command Usage:" << Log::endl;
  22. getLog() << " sound INT" << Log::endl;
  23. getLog() << "Where INT is a valid sound ID integer" << Log::endl;
  24. }
  25. int CommandSound::execute(std::istream& args) {
  26. if (!getGame().isLoaded()) {
  27. getLog() << "Use sound command interactively!" << Log::endl;
  28. return -1;
  29. }
  30. std::string s;
  31. args >> s;
  32. getSound().play(atoi(s.c_str()));
  33. return 0;
  34. }