-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSystem_MessageWindow.c
102 lines (91 loc) · 2.32 KB
/
System_MessageWindow.c
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
#include "xinaga.h"
#include <peekpoke.h>
#include <stdio.h>
//#include "Lists.h"
#include "System_MessageWindow.h"
byte PosX = 24;
byte PosY = 1;
#define Height 10
#define Width 15
char MessageLines[Width][Height];
#define MessageCount 4
#define MessageLength 20
char Messages[MessageCount][MessageLength] = {
"Hello there!@",
"This is a sign@",
"Wizard's Forest@"};
void DrawMessageWindow()
{
byte x, y;
for (y = 0; y < Height; ++y)
for (x = 0; x < Width; ++x)
SetChar(MessageLines[x][y], PosX + x, PosY + y);
}
void BlankMessageWindow()
{
DrawBorder("Console@",PosX - 1, PosY - 1, Width + 2, Height + 2, true);
memset(&MessageLines[0][0], ' ', Width * Height);
DrawMessageWindow();
}
void ScrollMessageWindowUp()
{
byte x, y;
for (y = 0; y < Height - 1; ++y)
for (x = 0; x < Width; ++x)
MessageLines[x][y] = MessageLines[x][y + 1];
for (x =0; x < Width; ++x)
MessageLines[x][Height - 1] = ' ';
DrawMessageWindow();
}
void WriteLineMessageWindow(char message[16], byte delay)
{
byte x;
ScrollMessageWindowUp();
for(x = 0; x < Width; ++x)
{
if (message[x] == '@')
{
while (x < Width)
{
MessageLines[x][Height - 1] = ' ';
++x;
}
break;
}
else
{
MessageLines[x][Height - 1] = message[x];
SetChar(MessageLines[x][Height - 1], PosX + x, PosY + Height - 1);
}
if (delay > 0)
{
byte d, z;
for (z = 0; z < delay * 8; ++z)
for(d = 0; d < 255; ++d)
{}
}
}
DrawMessageWindow();
}
/*
void DrawCharStatus(byte characterIndex)
{
byte statX = PosX;
byte statY = 2 + characterIndex * 3;
struct playerChar *PlayerChar = getPartyMember(characterIndex);
DrawBorder(statX - 1, statY - 1, COLS - statX + 1, 4, true);
sprintf(str, "%s@", RaceDescription[PlayerChar->RACE].NAME);
PrintString(str, statX, statY, true, false);
sprintf(str, "HP:%d/%d@", PlayerChar->HP, PlayerChar->HPMAX);
PrintString(str, statX + 9, statY, true, false);
sprintf(str, "%s@", ClassDescription[PlayerChar->CLASS].NAME);
PrintString(str, statX, statY + 1, true, false);
ReverseBufferArea(statX - 1, statY - 1, COLS - statX + 1, 5);
CopyDoubleBufferArea(statX - 1, statY - 1, COLS - statX + 1, 5);
}
void DrawCharStats()
{
byte i;
for (i = 0; i < CountParty(); ++i)
DrawCharStatus(i);
}*/