MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / init

Method init

2dlib/font.cpp:270–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268// ----------------------------------------------------------------------------
269
270void grFont::init(const char *fontname) {
271 int i, slot = -1;
272
273 // Look for this font in the list, check if it has any references, and load it if
274 // there are none.
275 if (fontname == NULL) {
276 slot = 0;
277 } else {
278 for (i = 0; i < MAX_FONTS; i++) {
279 if (stricmp(grFont::m_FontList[i].name, fontname) == 0) {
280 slot = i;
281
282 if (grFont::m_FontList[i].references == 0) {
283 break;
284 } else {
285 m_FontHandle = slot;
286 return;
287 }
288 }
289 }
290
291 ASSERT(slot != -1);
292
293 // clear up surface and bitmap lists
294 grFont::m_FontList[slot].ch_w = NULL;
295 grFont::m_FontList[slot].ch_h = NULL;
296 grFont::m_FontList[slot].ch_u = NULL;
297 grFont::m_FontList[slot].ch_v = NULL;
298
299 for (i = 0; i < MAX_FONT_BITMAPS; i++) {
300 grFont::m_FontList[slot].bmps[i] = -1;
301 grFont::m_FontList[slot].surfs[i] = NULL;
302 }
303
304 // We must load this font from the 'hogfile'
305 grFont::load(m_FontList[slot].filename, slot);
306
307 grFont::m_FontList[slot].references++;
308 }
309
310 m_FontHandle = slot;
311}
312
313void grFont::free() {
314 if (m_FontHandle == -1)

Callers 6

EditorToGameFunction · 0.45
mainFunction · 0.45
set_fontMethod · 0.45
init_systemMethod · 0.45
translate_to_surfacesMethod · 0.45
grViewportMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected