File: OTUTOR.h

package info (click to toggle)
7kaa 2.15.6%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 131,312 kB
  • sloc: cpp: 134,790; asm: 3,523; ansic: 1,949; perl: 1,665; makefile: 1,181; sh: 126; pascal: 27
file content (130 lines) | stat: -rw-r--r-- 2,775 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
 * Seven Kingdoms: Ancient Adversaries
 *
 * Copyright 1997,1998 Enlight Software Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

//Filename    : OTUTOR.H
//Description : Header file of object RaceRes

#ifndef __OH
#define __OH

#ifndef __ORESX_H
#include <ORESX.h>
#endif

//------------ Define constant -----------//

#define 	MAX_TUTOR_TEXT_BLOCK	100

//------------ Define struct TutorRec ---------------//

struct TutorRec
{
	enum { CODE_LEN=8, DES_LEN=40 };

	char  code[CODE_LEN];
	char  des[DES_LEN];
};

//------------- Define struct TutorInfo --------------//

struct TutorInfo
{
	enum { CODE_LEN=8, DES_LEN=40 };

	char  code[CODE_LEN+1];
	char  des[DES_LEN+1];
};

//---------- Define struct TutorTextBlock ------------//

struct TutorTextBlock
{
	enum { BUTTON_CODE_LEN=8 };

	const char* text_ptr;          // offset of the help text in the text buffer
	size_t text_len;               // length of the help text

	char	button_code[BUTTON_CODE_LEN+1];
};

//----------- Define class Tutor ---------------//

class Tutor
{
public:
	char        init_flag;

	short       tutor_count;
	TutorInfo*  tutor_info_array;

	ResourceIdx res_tutor_text, res_tutor_intro;

	//-------------------------------//

	short				cur_tutor_id;
	short				cur_text_block_id;
	short				last_text_block_id;
	int				cur_speech_wav_id;

	char        	*tutor_text_buf;
	int				tutor_text_buf_size;
	char        	*tutor_intro_buf;
	int				tutor_intro_buf_size;

	TutorTextBlock *text_block_array;
	int				text_block_count;

public:
	Tutor();
	~Tutor();

	void        init();
	void        deinit();

	int			select_tutor(int);
	void			select_run_tutor(int inGameCall);
	void 			run(int tutorId, int inGameCall);
	void			load(int tutorId);

	char* 		get_intro(int tutorId);

	void			disp();
	int			detect();

	void 			prev_text_block();
	void 			next_text_block();

	void			play_speech();
	void			stop_speech();

	int         write_file(File*);
	int         read_file(File*);

	TutorInfo*  operator[](int tutorId);      // pass tutorId  as recno

private:
	void        load_tutor_info();
};

extern Tutor tutor;

//----------------------------------------------------//

#endif