| 268 | // ---------------------------------------------------------------------------- |
| 269 | |
| 270 | void 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 | |
| 313 | void grFont::free() { |
| 314 | if (m_FontHandle == -1) |
no outgoing calls
no test coverage detected