-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdialogue.c
More file actions
60 lines (52 loc) · 1.66 KB
/
dialogue.c
File metadata and controls
60 lines (52 loc) · 1.66 KB
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
int dialogueID; // ID of current dialogue to display
int curLine = 0;
bool dialogueUp = FALSE;
dialogue dialogues[3];
void loadDialogues()
{
dialogues[0].numLines = 5;
strcpy(dialogues[0].dialogueText[0], "YOUR AUTHORITY IS NOT RECOGNIZED IN FORT KICKASS! 0");
strcpy(dialogues[0].dialogueText[1], "YOUR AUTHORITY IS NOT RECOGNIZED IN FORT KICKASS! 1");
strcpy(dialogues[0].dialogueText[2], "YOUR AUTHORITY IS NOT RECOGNIZED IN FORT KICKASS! 2");
strcpy(dialogues[0].dialogueText[3], "YOUR AUTHORITY IS NOT RECOGNIZED IN FORT KICKASS! 3");
strcpy(dialogues[0].dialogueText[4], "YOUR AUTHORITY IS NOT RECOGNIZED IN FORT KICKASS! 4");
dialogues[1].numLines = 1;
strcpy(dialogues[1].dialogueText[0], "Look, Scully! Aliens!");
dialogues[2].numLines = 1;
strcpy(dialogues[2].dialogueText[0], "Goddammit Mulder...");
}
void setDialogue(int dID)
{
dialogueID = dID;
dialogueUp = TRUE;
curLine = 0;
}
void updateDialogue(int key)
{
switch(key)
{
case 'z':
if(curLine < dialogues[dialogueID].numLines - 3) curLine++;
else dialogueUp = FALSE;
break;
case 'x':
if(curLine > 0) curLine--;
break;
}
}
void renderDialogue()
{
mvprintw(20, 0, "O------------------------------------------------------------------------------O");
int i;
for(i = 0; i < 3; i++)
{
mvprintw(21 + i, 0, "|");
mvprintw(21 + i, 1, " ");
if((i + curLine) < dialogues[dialogueID].numLines)
{
mvprintw(21 + i, 1, dialogues[dialogueID].dialogueText[curLine + i]);
}
mvprintw(21 + i, 79, "|");
}
mvprintw(24, 0, "O------------------------------------------------------------------------------O");
}