OTUTOR.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Seven Kingdoms: Ancient Adversaries
  3. *
  4. * Copyright 1997,1998 Enlight Software Ltd.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. //Filename : OTUTOR.H
  21. //Description : Header file of object RaceRes
  22. #ifndef __OH
  23. #define __OH
  24. #ifndef __ORESX_H
  25. #include <ORESX.h>
  26. #endif
  27. //------------ Define constant -----------//
  28. #define MAX_TUTOR_TEXT_BLOCK 100
  29. //------------ Define struct TutorRec ---------------//
  30. struct TutorRec
  31. {
  32. enum { CODE_LEN=8, DES_LEN=40 };
  33. char code[CODE_LEN];
  34. char des[DES_LEN];
  35. };
  36. //------------- Define struct TutorInfo --------------//
  37. struct TutorInfo
  38. {
  39. enum { CODE_LEN=8, DES_LEN=40 };
  40. char code[CODE_LEN+1];
  41. char des[DES_LEN+1];
  42. };
  43. //---------- Define struct TutorTextBlock ------------//
  44. struct TutorTextBlock
  45. {
  46. enum { BUTTON_CODE_LEN=8 };
  47. char* text_ptr; // offset of the help text in the text buffer
  48. short text_len; // length of the help text
  49. char button_code[BUTTON_CODE_LEN+1];
  50. };
  51. //----------- Define class Tutor ---------------//
  52. class Tutor
  53. {
  54. public:
  55. char init_flag;
  56. short tutor_count;
  57. TutorInfo* tutor_info_array;
  58. ResourceIdx res_tutor_text, res_tutor_intro;
  59. //-------------------------------//
  60. short cur_tutor_id;
  61. short cur_text_block_id;
  62. short last_text_block_id;
  63. int cur_speech_wav_id;
  64. char *tutor_text_buf;
  65. int tutor_text_buf_size;
  66. char *tutor_intro_buf;
  67. int tutor_intro_buf_size;
  68. TutorTextBlock *text_block_array;
  69. int text_block_count;
  70. public:
  71. Tutor();
  72. ~Tutor();
  73. void init();
  74. void deinit();
  75. int select_tutor(int);
  76. void select_run_tutor(int inGameCall);
  77. void run(int tutorId, int inGameCall);
  78. void load(int tutorId);
  79. char* get_intro(int tutorId);
  80. void disp();
  81. int detect();
  82. void prev_text_block();
  83. void next_text_block();
  84. void play_speech();
  85. void stop_speech();
  86. int write_file(File*);
  87. int read_file(File*);
  88. TutorInfo* operator[](int tutorId); // pass tutorId as recno
  89. private:
  90. void load_tutor_info();
  91. };
  92. extern Tutor tutor;
  93. //----------------------------------------------------//
  94. #endif