|
@@ -0,0 +1,165 @@
|
|
1
|
+/*!
|
|
2
|
+ * \file include/FontTRLE.h
|
|
3
|
+ * \brief Tomb Raider Level Editor Font loader
|
|
4
|
+ *
|
|
5
|
+ * \author xythobuz
|
|
6
|
+ */
|
|
7
|
+
|
|
8
|
+#ifndef _FONT_TRLE_H_
|
|
9
|
+#define _FONT_TRLE_H_
|
|
10
|
+
|
|
11
|
+#include "math/math.h"
|
|
12
|
+#include "Font.h"
|
|
13
|
+
|
|
14
|
+/*!
|
|
15
|
+ * \brief Tomb Raider Level Editor Font loader
|
|
16
|
+ */
|
|
17
|
+class FontTRLE : public Font {
|
|
18
|
+public:
|
|
19
|
+
|
|
20
|
+ /*!
|
|
21
|
+ * \brief Constructs an object of FontTRLE
|
|
22
|
+ */
|
|
23
|
+ FontTRLE();
|
|
24
|
+
|
|
25
|
+ /*!
|
|
26
|
+ * \brief Deconstructs an object of FontTRLE
|
|
27
|
+ */
|
|
28
|
+ virtual ~FontTRLE();
|
|
29
|
+
|
|
30
|
+ virtual int initialize();
|
|
31
|
+
|
|
32
|
+ virtual void writeString(FontString &s);
|
|
33
|
+
|
|
34
|
+ virtual void drawText(unsigned int x, unsigned int y, float scale, const float color[4], const char *s, ...)
|
|
35
|
+ __attribute__((format(printf, 6, 0)));
|
|
36
|
+
|
|
37
|
+private:
|
|
38
|
+
|
|
39
|
+ void loadLPS(const char *file);
|
|
40
|
+ void writeChar(unsigned int index, unsigned int xDraw, FontString &s);
|
|
41
|
+
|
|
42
|
+ unsigned int mFontTexture;
|
|
43
|
+ FontString tempText;
|
|
44
|
+
|
|
45
|
+ unsigned int resolution1;
|
|
46
|
+ unsigned int resolution2;
|
|
47
|
+ int ruler1;
|
|
48
|
+ int ruler2;
|
|
49
|
+ int baselineAbs; // always zero?
|
|
50
|
+ vec_t spacing;
|
|
51
|
+ vec_t squashedTextFactor;
|
|
52
|
+
|
|
53
|
+ // 106 entries: (x, y, w, h, offset)
|
|
54
|
+ int offsets[106][5] = {
|
|
55
|
+ { 174, 52, 3, 12, -11 },
|
|
56
|
+ { 98, 58, 6, 4, -10 },
|
|
57
|
+ { 82, 26, 13, 11, -10 },
|
|
58
|
+ { 78, 38, 9, 13, -10 },
|
|
59
|
+ { 214, 13, 14, 11, -9 },
|
|
60
|
+ { 40, 26, 13, 11, -10 },
|
|
61
|
+ { 157, 57, 5, 6, -11 },
|
|
62
|
+ { 204, 39, 5, 15, -12 },
|
|
63
|
+ { 34, 40, 5, 15, -12 },
|
|
64
|
+ { 184, 59, 4, 4, -11 },
|
|
65
|
+ { 22, 40, 10, 10, -9 },
|
|
66
|
+ { 178, 59, 4, 4, -2 },
|
|
67
|
+ { 106, 60, 7, 2, -4 },
|
|
68
|
+ { 114, 60, 4, 3, -2 },
|
|
69
|
+ { 212, 38, 8, 14, -12 },
|
|
70
|
+ { 88, 49, 9, 9, -8 },
|
|
71
|
+ { 200, 55, 5, 9, -8 },
|
|
72
|
+ { 46, 52, 8, 9, -8 },
|
|
73
|
+ { 88, 38, 7, 10, -8 },
|
|
74
|
+ { 62, 40, 10, 10, -8 },
|
|
75
|
+ { 142, 48, 8, 11, -9 },
|
|
76
|
+ { 232, 50, 8, 10, -9 },
|
|
77
|
+ { 120, 47, 8, 11, -9 },
|
|
78
|
+ { 22, 51, 8, 10, -9 },
|
|
79
|
+ { 110, 49, 8, 10, -8 },
|
|
80
|
+ { 152, 57, 4, 7, -7 },
|
|
81
|
+ { 136, 57, 4, 9, -7 },
|
|
82
|
+ { 178, 40, 11, 9, -8 },
|
|
83
|
+ { 210, 53, 10, 6, -7 },
|
|
84
|
+ { 240, 40, 11, 9, -7 },
|
|
85
|
+ { 12, 39, 9, 12, -11 },
|
|
86
|
+ { 66, 13, 15, 13, -10 },
|
|
87
|
+ { 130, 13, 13, 12, -11 },
|
|
88
|
+ { 214, 25, 12, 12, -11 },
|
|
89
|
+ { 132, 35, 10, 12, -11 },
|
|
90
|
+ { 0, 26, 12, 12, -11 },
|
|
91
|
+ { 14, 26, 12, 12, -11 },
|
|
92
|
+ { 66, 27, 11, 12, -11 },
|
|
93
|
+ { 182, 27, 11, 12, -11 },
|
|
94
|
+ { 200, 13, 13, 12, -11 },
|
|
95
|
+ { 222, 54, 4, 12, -11 },
|
|
96
|
+ { 56, 52, 4, 15, -11 },
|
|
97
|
+ { 230, 15, 12, 12, -11 },
|
|
98
|
+ { 144, 35, 10, 12, -11 },
|
|
99
|
+ { 48, 13, 17, 12, -11 },
|
|
100
|
+ { 144, 13, 13, 12, -11 },
|
|
101
|
+ { 54, 26, 11, 12, -11 },
|
|
102
|
+ { 200, 26, 11, 12, -11 },
|
|
103
|
+ { 240, 0, 13, 14, -11 },
|
|
104
|
+ { 158, 13, 13, 12, -11 },
|
|
105
|
+ { 156, 35, 10, 12, -11 },
|
|
106
|
+ { 172, 13, 13, 12, -11 },
|
|
107
|
+ { 98, 13, 14, 12, -11 },
|
|
108
|
+ { 82, 13, 14, 12, -11 },
|
|
109
|
+ { 24, 13, 22, 12, -11 },
|
|
110
|
+ { 186, 13, 12, 13, -11 },
|
|
111
|
+ { 114, 13, 14, 12, -11 },
|
|
112
|
+ { 228, 28, 11, 12, -11 },
|
|
113
|
+ { 62, 60, 5, 3, -4 },
|
|
114
|
+ { 248, 59, 5, 3, -4 },
|
|
115
|
+ { 88, 59, 7, 3, -4 },
|
|
116
|
+ { 142, 60, 6, 2, -3 },
|
|
117
|
+ { 120, 59, 7, 3, -4 },
|
|
118
|
+ { 242, 59, 4, 4, -11 },
|
|
119
|
+ { 98, 49, 10, 8, -7 },
|
|
120
|
+ { 96, 35, 10, 13, -12 },
|
|
121
|
+ { 72, 52, 8, 8, -7 },
|
|
122
|
+ { 0, 39, 10, 11, -10 },
|
|
123
|
+ { 164, 52, 8, 8, -7 },
|
|
124
|
+ { 168, 38, 9, 13, -12 },
|
|
125
|
+ { 120, 35, 11, 11, -7 },
|
|
126
|
+ { 108, 35, 10, 13, -12 },
|
|
127
|
+ { 194, 27, 5, 11, -10 },
|
|
128
|
+ { 40, 51, 5, 15, -10 },
|
|
129
|
+ { 28, 26, 11, 13, -12 },
|
|
130
|
+ { 82, 52, 5, 12, -11 },
|
|
131
|
+ { 96, 26, 17, 8, -7 },
|
|
132
|
+ { 152, 48, 11, 8, -7 },
|
|
133
|
+ { 62, 51, 9, 8, -7 },
|
|
134
|
+ { 244, 15, 0, 12, -7 },
|
|
135
|
+ { 52, 39, 9, 12, -7 },
|
|
136
|
+ { 10, 52, 9, 8, -7 },
|
|
137
|
+ { 190, 52, 8, 8, -7 },
|
|
138
|
+ { 0, 51, 8, 10, -9 },
|
|
139
|
+ { 178, 50, 10, 8, -7 },
|
|
140
|
+ { 130, 48, 11, 8, -7 },
|
|
141
|
+ { 132, 26, 17, 8, -7 },
|
|
142
|
+ { 242, 50, 10, 8, -7 },
|
|
143
|
+ { 40, 38, 10, 12, -7 },
|
|
144
|
+ { 232, 41, 7, 8, -7 },
|
|
145
|
+ { 222, 41, 8, 12, -7 },
|
|
146
|
+ { 130, 57, 5, 8, -7 },
|
|
147
|
+ { 194, 39, 9, 12, -10 },
|
|
148
|
+ { 32, 56, 4, 11, -10 },
|
|
149
|
+ { 1, 14, 22, 11, -10 },
|
|
150
|
+ { 192, 0, 23, 13, -10 },
|
|
151
|
+ { 168, 0, 23, 12, -10 },
|
|
152
|
+ { 216, 0, 23, 12, -10 },
|
|
153
|
+ { 150, 26, 17, 8, -8 },
|
|
154
|
+ { 168, 26, 11, 11, -9 },
|
|
155
|
+ { 114, 26, 17, 8, -8 },
|
|
156
|
+ { 240, 28, 12, 11, -9 },
|
|
157
|
+ { 0, 0, 40, 12, -10 },
|
|
158
|
+ { 84, 0, 39, 11, -10 },
|
|
159
|
+ { 42, 0, 39, 11, -10 },
|
|
160
|
+ { 126, 0, 39, 11, -10 },
|
|
161
|
+ };
|
|
162
|
+};
|
|
163
|
+
|
|
164
|
+#endif
|
|
165
|
+
|