variables.d 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. // quantumde1 developed software, licensed under MIT license.
  2. module variables;
  3. import std.typecons;
  4. import raylib;
  5. import bindbc.lua;
  6. import system.abstraction;
  7. extern (C) char* get_file_data_from_archive(const char *input_file, const char *file_name, uint *file_size_out);
  8. void resetAllScriptValues() {
  9. debugWriteln("Resetting all values!");
  10. selectedChoice = 0;
  11. foreach (i; 0..characterTextures.length)
  12. {
  13. characterTextures[i].drawTexture = false;
  14. UnloadTexture(characterTextures[i].texture);
  15. }
  16. foreach (i; 0..backgroundTextures.length)
  17. {
  18. backgroundTextures[i].drawTexture = false;
  19. UnloadTexture(backgroundTextures[i].texture);
  20. }
  21. characterTextures = [];
  22. backgroundTextures = [];
  23. }
  24. /* system */
  25. struct FadeEffect {
  26. float alpha = 0.0f;
  27. float targetAlpha = 0.0f;
  28. float fadeSpeed = 9.0f;
  29. bool isFading = false;
  30. }
  31. struct SystemSettings {
  32. int sound_state;
  33. char right_button;
  34. char left_button;
  35. char back_button;
  36. char forward_button;
  37. char dialog_button;
  38. char opmenu_button;
  39. string script_path;
  40. }
  41. struct TextureEngine {
  42. bool drawTexture;
  43. bool justDrawn;
  44. float width;
  45. float height;
  46. float x;
  47. float y;
  48. Texture2D texture;
  49. float scale;
  50. }
  51. enum GameState {
  52. MainMenu = 1,
  53. InGame = 2,
  54. Exit = 3
  55. }
  56. enum EngineExitCodes {
  57. EXIT_FILE_NOT_FOUND = 2,
  58. EXIT_SCRIPT_ERROR = 3,
  59. EXIT_OK = 0,
  60. }
  61. Camera2D camera;
  62. Camera2D oldCamera;
  63. TextureEngine[] characterTextures;
  64. TextureEngine[] backgroundTextures;
  65. SystemSettings systemSettings;
  66. int currentGameState = 1;
  67. Font textFont;
  68. Music music;
  69. FadeEffect[] characterFades;
  70. FadeEffect[] backgroundFades;
  71. FadeEffect dialogFade;
  72. Color characterColor = Color(255, 255, 255);
  73. /* booleans */
  74. bool playAnimation = false;
  75. bool audioEnabled = false;
  76. bool sfxEnabled = false;
  77. bool fullscreenEnabled = true;
  78. bool luaReload = true;
  79. bool videoFinished = false;
  80. bool neededDraw2D = false;
  81. bool isCameraMoving = false;
  82. bool neededCharacterDrawing = false;
  83. bool showDialog = false;
  84. bool isTextFullyDisplayed = false;
  85. /* strings */
  86. string ver = "1.1.8";
  87. string[] messageGlobal;
  88. string[] choices;
  89. string[] backlogText;
  90. string luaExec;
  91. string usedLang = "english";
  92. char* musicPath;
  93. /* floats */
  94. float cameraTargetX = 0;
  95. float cameraTargetY = 0;
  96. float cameraTargetZoom = 1.0f;
  97. float cameraMoveSpeed = 5.0f;
  98. float frameDuration = 0.016f;
  99. float typingSpeed = 0.6f;
  100. /* textures */
  101. Texture2D[] framesUI;
  102. Texture2D dialogBackgroundTex;
  103. Texture2D choiceWindowTex;
  104. Texture2D circle;
  105. /* integer values */
  106. int button;
  107. int selectedChoice = 0;
  108. int choicePage = -1;
  109. int currentFrame = 0;
  110. int currentChoiceCharIndex = 0;
  111. /* lua */
  112. lua_State* L;