Repository navigation
Expand file tree
/
Copy pathRecording.h
More file actions
137 lines (122 loc) · 2.53 KB
/
Copy pathRecording.h
File metadata and controls
137 lines (122 loc) · 2.53 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
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
131
132
133
134
135
136
137
#ifdef CPP_LIST
#include <list>
#include <string>
#else
struct LQENTRY
{
LQENTRY *m_pNext{};
std::string m_line;
};
struct LINE_QUEUE
{
LQENTRY *GetHeadPosition() { return m_pFirst; }
const char *GetNext(LQENTRY *&pos)
{
LQENTRY *curr = pos;
pos = curr->m_pNext;
return curr->m_line.c_str();
}
void clear()
{
while(m_pFirst != NULL)
{
LQENTRY *first = m_pFirst;
m_pFirst = m_pFirst->m_pNext;
delete first;
}
}
void push_back(const char *line)
{
LQENTRY *newEnt, *last;
newEnt = new LQENTRY();
newEnt->m_line = line;
last = m_pFirst;
if(last == NULL)
m_pFirst = newEnt;
else
{
while(last->m_pNext != NULL)
last = last->m_pNext;
last->m_pNext = newEnt;
}
}
private:
LQENTRY *m_pFirst{};
};
#endif
#define MAXLINEQUEUE 10
class RECORDFILE
{
private:
i16 m_fileNum;
bool m_isQueueingLines;
#ifdef MSVC_QUEUE
std::list<std::string> m_lineQueue;
#else
LINE_QUEUE m_lineQueue;
#endif
bool m_graphicSignature;
bool m_CSBgraphicSignature;
bool m_dungeonSignature;
bool m_versionSignature;
public:
RECORDFILE()
{
m_fileNum = -1;
m_isQueueingLines = false;
m_lineQueue.clear();
m_graphicSignature = false;
m_dungeonSignature = false;
m_versionSignature = false;
};
~RECORDFILE()
{
if(m_fileNum >= 0)
CLOSE(m_fileNum);
};
bool IsOpen() { return m_fileNum >= 0; };
bool IsRecording()
{
return (m_fileNum >= 0) || m_isQueueingLines;
};
void Open();
void PreOpen();
void Close();
void Record(MouseQueueEnt *happening);
void Record(i32 x, i32 y, i32 func);
void Record(const char *line);
void Comment(const char *comment);
void CycleRandom(i32 n);
void Signature(ui32 sig, ui32 type);
};
// extern RECORDFILE RecordFile;
class PLAYFILE
{
private:
i32 m_time, m_x, m_y, m_num, m_oldTime, m_oldCallCount;
ui32 m_ran;
bool m_eofEncountered, m_forceClose;
i16 m_file;
public:
PLAYFILE()
{
m_file = -1;
m_time = -1;
m_eofEncountered = false;
m_forceClose = false;
};
~PLAYFILE()
{
if(m_file >= 0)
CLOSE(m_file);
};
bool IsOpen();
void Open();
void Close();
bool Play(MouseQueueEnt *);
void Backspace(MouseQueueEnt *);
void ReadEOF(); // Force file close at EOF without
// advancing d.Time.
bool IsEOF() { return m_eofEncountered; };
};
// extern PLAYFILE PlayFile;