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

Function Cinematic_DrawText

Descent3/gamecinematics.cpp:1228–1411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1226}
1227
1228void Cinematic_DrawText(void) {
1229 int font_height = grfont_GetHeight(BIG_BRIEFING_FONT) + 2;
1230 int old_font = grtext_GetFont();
1231 grtext_SetFont(BIG_BRIEFING_FONT);
1232 grtext_SetColor(GR_RGB(255, 255, 255));
1233
1234 int start_y;
1235 int end_y;
1236
1237 // determine y positions
1238 switch (GameCinema.flags & GCF_LAYOUT_MASK) {
1239 case GCF_LAYOUT_LOW: {
1240 end_y = 0.6667f * (float)(Max_window_h);
1241 start_y = end_y - (GameCinema.num_lines * font_height);
1242
1243 ASSERT(start_y >= 0); // too many lines of text!
1244
1245 } break;
1246 case GCF_LAYOUT_BOTTOM: {
1247 end_y = Max_window_h;
1248 start_y = end_y - (GameCinema.num_lines * font_height);
1249
1250 ASSERT(start_y >= 0); // too many lines of text!
1251 } break;
1252 case GCF_LAYOUT_TOP: {
1253 start_y = 2;
1254 end_y = (GameCinema.num_lines * font_height) + start_y;
1255
1256 ASSERT(end_y < Max_window_h); // too many lines of text!
1257 } break;
1258 case GCF_LAYOUT_MIDDLE: {
1259 int total_height = GameCinema.num_lines * font_height;
1260 start_y = (Max_window_h / 2) - (total_height / 2);
1261 end_y = start_y + total_height;
1262
1263 ASSERT(start_y >= 0 && end_y < Max_window_h); // too many lines of text
1264
1265 } break;
1266 }
1267
1268 if ((GameCinema.flags & GCF_TEXT_MASK) == GCF_TEXT_WIPEIN) {
1269 // see if this mode is allowed (only if letterbox and not in middle layout)
1270 if ((GameCinema.flags & GCF_SCREENFORMAT) != GCF_LETTERBOX) {
1271 GameCinema.flags &= ~GCF_TEXT_WIPEIN;
1272 GameCinema.flags |= GCF_TEXT_FADEINOUT;
1273 } else {
1274 // it's letter box, make sure it's not middle
1275 if ((GameCinema.flags & GCF_LAYOUT_MASK) == GCF_LAYOUT_MIDDLE) {
1276 GameCinema.flags &= ~GCF_TEXT_WIPEIN;
1277 GameCinema.flags |= GCF_TEXT_FADEINOUT;
1278 }
1279 if ((GameCinema.flags & GCF_LAYOUT_MASK) == GCF_LAYOUT_LOW) {
1280 GameCinema.flags &= ~GCF_TEXT_WIPEIN;
1281 GameCinema.flags |= GCF_TEXT_FADEINOUT;
1282 }
1283 }
1284 }
1285

Callers 1

Cinematic_RenderFrameFunction · 0.85

Calls 15

grfont_GetHeightFunction · 0.85
grtext_GetFontFunction · 0.85
grtext_SetFontFunction · 0.85
grtext_SetColorFunction · 0.85
grtext_SetAlphaFunction · 0.85
grtext_CenteredPrintfFunction · 0.85
grtext_FlushFunction · 0.85
grtext_GetParametersFunction · 0.85
GR_RGBFunction · 0.50
rend_SetAlphaTypeFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetColorModelFunction · 0.50

Tested by

no test coverage detected