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.

Script.h 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*!
  2. * \file include/Script.h
  3. * \brief Game script loader
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _SCRIPT_H_
  8. #define _SCRIPT_H_
  9. #include "utils/binary.h"
  10. #include <cstdint>
  11. #include <string>
  12. #include <vector>
  13. /*!
  14. * \brief Game script loader
  15. */
  16. class Script {
  17. public:
  18. typedef enum {
  19. S_English = 0,
  20. S_French = 1,
  21. S_German = 2,
  22. S_American = 3,
  23. S_Japanese = 4
  24. } ScriptLanguage;
  25. Script();
  26. ~Script();
  27. int load(const char *file);
  28. unsigned int levelCount();
  29. std::string getLevelName(unsigned int i);
  30. std::string getLevelFilename(unsigned int i);
  31. unsigned int cutsceneCount();
  32. std::string getCutsceneFilename(unsigned int i);
  33. unsigned int titleCount();
  34. std::string getTitleFilename(unsigned int i);
  35. unsigned int videoCount();
  36. std::string getVideoFilename(unsigned int i);
  37. unsigned int gameStringCount();
  38. std::string getGameString(unsigned int i);
  39. unsigned int pcStringCount();
  40. std::string getPCString(unsigned int i);
  41. private:
  42. void readStringPackage(BinaryFile &f, std::vector<std::string> &v, unsigned int n);
  43. enum ScriptFlags {
  44. S_DemoVersion = (1 << 0), //!< Don't load a MAIN.SFX
  45. S_TitleDisabled = (1 << 1), //!< If set, game has no title screen
  46. S_CheatModeCheckDisabled = (1 << 2), //!< Disable flare/step/rotate/jump sequence
  47. S_NoInputTimeout = (1 << 3), //!< If set don't timeout input to start demo
  48. S_LoadSaveDisabled = (1 << 4), //!< Don't allow load/save
  49. S_ScreenSizingDisabled = (1 << 5), //!< Don't change screen resolution
  50. S_LockOutOptionRing = (1 << 6), //!< No option ring while in level
  51. S_DOZYCheatEnabled = (1 << 7), //!< DOZY flying cheat
  52. S_UseSecurityTag = (1 << 8), //!< Strings XORed with cypherCode
  53. S_Unknown = (1 << 9), //!< Usually set, no known effect
  54. S_SelectAnyLevel = (1 << 10), //!< Level selectable in Title
  55. S_EnableCheatCode = (1 << 11) //!< No known effect
  56. };
  57. // Header
  58. uint32_t version;
  59. std::string description;
  60. // Gameflow data
  61. uint32_t firstOption;
  62. int32_t titleReplace;
  63. uint32_t onDeathDemoMode;
  64. uint32_t onDeathInGame;
  65. uint32_t noInputTime;
  66. uint32_t onDemoInterrupt;
  67. uint32_t onDemoEnd;
  68. uint16_t numLevels;
  69. uint16_t numPictures;
  70. uint16_t numTitles;
  71. uint16_t numFMVs;
  72. uint16_t numCutscenes;
  73. uint16_t numDemos;
  74. uint16_t titleTrack;
  75. int16_t singleLevel;
  76. uint16_t flags;
  77. uint8_t cypherCode;
  78. uint8_t language;
  79. uint16_t secretTrack;
  80. uint16_t numGameStrings;
  81. // Strings
  82. std::vector<std::string> levelNames; // numLevels
  83. std::vector<std::string> pictureFilenames; // numPictures
  84. std::vector<std::string> titleFilenames; // numTitles
  85. std::vector<std::string> fmvFilenames; // numFMVs
  86. std::vector<std::string> levelFilenames; // numLevels
  87. std::vector<std::string> cutsceneFilenames; // numCutscenes
  88. std::vector<std::string> script; // numLevels + 1
  89. std::vector<std::string> gameStrings; // numGameStrings, 89
  90. std::vector<std::string> pcStrings; // 41
  91. std::vector<std::vector<std::string>> puzzles; // 4 * numLevels
  92. std::vector<std::vector<std::string>> pickups; // 2 * numLevels
  93. std::vector<std::vector<std::string>> keys; // 4 * numLevels
  94. };
  95. #endif