summaryrefslogtreecommitdiff
path: root/doc/devel/dialogs
blob: 91ca306ad0a919a5822c6aaa11fc1649dc67106d (plain)
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
This file describes how the conversation system works.

Functions:

DoResponsePhrase(RESPONSE_REF R, RESPONSE_FUNC response_func,
		UNICODE *ConstructStr)
	Adds a line to the list of remarks the player may choose from.
	R - The index for the line in the .txt dialog file.
    response_func - the function where to continue the dialog if this
			remark was chosen.
	ConstructStr - A user-constructed string to display. If it is 0,
			the string from R is used; if it is 0, the string identified
			by R is not displayed, but R is still used to report what choice
			a player made.
			In practice ConstructStr is always the result of a call
			to construct_response() and R is set to the first part of
			the constructed phrase.
	Note: ConstructStr must still be valid after the function calling
			DoResponsePhrase() returns, so it can't be on the stack.
			Also, if there are multiple constructed responses at one
			point in the dialog, they will need separate buffers.
			In practice, a global buffer shared_phrase_buf is used when
			only one buffer is required.
	Note: In practice, when R is 0, the call is always made through the
			macro Response()

Response(RESPONSE_REF R, RESPONSE_FUNC response_func)
	Macro that calls DoResponsePhrase() with 0 for ConstructStr.

construct_response(UNICODE *buf, int R, ...)
	Concatenates strings from a dialog .txt file with strings from
	the source. The arguments after *buf are alternatingly an int R,
	and a UNICODE * str, until either R is -1, or str is NULL.
	buf - the destination
	R   - The index for the line in the .txt dialog file.
	str - A UNICODE * string.

NPCPhrase_cb(int index, TFB_TrackCB cb)
	Display the NPC speech with identifier 'index' (and play the
	associated sample). The callback function 'cb' is called when
	the displaying is done (usually when the sample ends).
	index - The index for the line in the .txt dialog file.
	cb - the callback function to called when the line is over.
			NULL indicates no callback function.

NPCPhrase(int index)
	Display the NPC speech with identifier 'index'.
	This is a macro to NPCPrhase_cb().
	index - The index for the line in the .txt dialog file, or
			GLOBAL_PLAYER_NAME for the name of the captain,
			GLOBAL_SHIP_NAME for the name of the flagship,
			GLOBAL_PLAYER_LOCATION, for the player's hyperspace coordinates,
			GLOBAL_ALLIANCE_NAME, for the name of the new alliance, or
			a negative number for the absolute number as speech

DISABLE_PHRASE(int index)
	Mark a player line as not to be offered as a choice anymore. Not in
	this conversion, nor in any future conversations.
	index - The index for the line in the .txt dialog file.

PHRASE_ENABLED(int index)
	Check if a player phrase was formerly marked as not to be offered anymore
	(by call to DISABLE_PHRASE).
	index - The index for the line in the .txt dialog file.
	
PLAYER_SAID(RESPONSE_REF said, RESPONSE_REF test)
	Test whether a player the player reply 'said' is equal to the reply
	'test'.
	said - the response that the player selected
	test - a response to test 'said' against


Initial version by Serge van den Boom, 2005-01-10