1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the AUTHORS
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25  *
26  */
27 
28 #ifndef ICB_SPEECH_H
29 #define ICB_SPEECH_H
30 
31 #include "engines/icb/common/px_array.h"
32 #include "engines/icb/common/px_string.h"
33 #include "engines/icb/common/px_common.h"
34 #include "engines/icb/string_vest.h"
35 
36 namespace ICB {
37 
38 // this sits in the _mega structure for conversation_uid - means no current conversation
39 #define NO_SPEECH_REQUEST 424242
40 
41 // goes in conversation_owners when a conversation is removed and its slot freed
42 #define DEAD_CONVERSATION 424242
43 
44 enum __speech_state {
45 	__PENDING, // conversation is being set up
46 	__PROCESS, // ready for next speech instruction
47 	__WAITING_TO_SAY, // specific to psx really, this means the disc is spinning towards its destination, just keep going until it's finished!
48 	__SAYING // text is up on screen
49 };
50 
51 enum __coms { __FACE_OBJECT, __PLAY_GENERIC_ANIM, __PLAY_CUSTOM_ANIM, __REVERSE_CUSTOM_ANIM };
52 
53 class __conv_command {
54 public:
55 
56 	uint32 id; // object id
57 
58 	uint32 param1;
59 	//	pxString str_param1;
60 	char str_param1[ENGINE_STRING_LEN];
61 
62 	__coms command;
63 
64 	bool8 active;
65 	uint8 padding1;
66 	uint8 padding2;
67 	uint8 padding3;
68 };
69 
70 #define MAX_people_talking 3
71 #define MAX_coms 3
72 
73 class __conversation {
74 public:
__conversation()75 	__conversation() {
76 		for (int32 i = 0; i < MAX_people_talking; i++)
77 			subscribers_requested[i] = 0;
78 
79 		total_subscribers = 0;
80 		current_subscribers = 0;
81 
82 		current_talker = (int32)-1;
83 		count = 0;
84 	}
85 
86 	uint32 subscribers_requested[MAX_people_talking];
87 	uint32 total_subscribers; // the number of people in the conversation
88 	uint32 current_subscribers; // number of people still in at the end of the logic cycle - we can therefore tell if any have dropped out
89 
90 	__conv_command coms[MAX_coms];
91 
92 	char *script_pc;
93 
94 	int32 current_talker; // id of person talking
95 	uint32 count; // used to count down current text
96 	__speech_state state; // conversation state
97 };
98 
99 // Works out how int32 some text should be displayed to allow adequate time for it to be read.  We might need to
100 // tinker with the formula in here 'till we get it right.
101 extern uint32 Get_reading_time(const char *pcString);
102 
103 // Moved these from speech_psx.h, because the PC needs to be able to alter text colours now for the
104 // Remora's text.
105 void SetTextColour(uint8 r, uint8 g, uint8 b);
106 
107 // This colour is used to display voice over text (normally player's speech colour).
108 extern uint8 voice_over_red;
109 extern uint8 voice_over_green;
110 extern uint8 voice_over_blue;
111 
112 // These defaults are set to the player's text colour.
113 #define VOICE_OVER_DEFAULT_RED 255
114 #define VOICE_OVER_DEFAULT_GREEN 245
115 #define VOICE_OVER_DEFAULT_BLUE 100
116 
117 } // End of namespace ICB
118 
119 #endif
120