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

Function RenderSmallWindow

Descent3/SmallViews.cpp:270–368  ·  view source on GitHub ↗

Render into one of the small windows

Source from the content-addressed store, hash-verified

268
269// Render into one of the small windows
270void RenderSmallWindow(int left, int top, int right, int bot, object *viewer, vector *viewer_eye, int viewer_roomnum,
271 matrix *viewer_orient, int flags, float zoom, ddgr_color outline_color, char *label,
272 float timer) {
273 int width = right - left, height = bot - top;
274
275 // Set up for rendering
276 StartFrame(left, top, right, bot);
277
278 // scale font according to screen size
279 float font_aspect_x = (float)Game_window_w / Max_window_w;
280
281 if (font_aspect_x <= 0.60f) {
282 grtext_SetFontScale(0.60f);
283 } else if (font_aspect_x <= 0.80f) {
284 grtext_SetFontScale(0.80f);
285 } else {
286 grtext_SetFontScale(1.0f);
287 }
288
289 // Draw either static or 3D
290 if (flags & SVF_STATIC) {
291 // draw static
292 static int handle = -1;
293 if (handle == -1)
294 handle = FindTextureName("Static");
295
296 ASSERT(handle != -1); // DAJ -1FIX
297
298 PageInVClip(GameTextures[handle].bm_handle);
299 vclip *vc = &GameVClips[GameTextures[handle].bm_handle];
300
301 int frame = vc->num_frames * (STATIC_TIME - timer) / STATIC_TIME;
302 if (frame == vc->num_frames)
303 frame--;
304 int bm_handle = vc->frames[frame];
305
306 rend_SetAlphaType(AT_CONSTANT_TEXTURE);
307 rend_SetAlphaValue(255);
308 rend_SetLighting(LS_NONE);
309 rend_SetColorModel(CM_MONO);
310 rend_SetOverlayType(OT_NONE);
311 rend_SetWrapType(WT_CLAMP);
312 rend_SetFiltering(0);
313
314 rend_DrawScaledBitmap(0, 0, width - 1, height - 1, bm_handle, 0.0, 0.0, 1.0, 1.0);
315 } else {
316 // draw 3D view
317 ASSERT(viewer != NULL);
318 ASSERT(viewer_eye != NULL);
319 object *save_viewer_object = Viewer_object;
320 bool rear_view = ((flags & SVF_REARVIEW) != 0);
321
322 // Reset facings for mine stuff
323 ResetFacings();
324
325 // Set the viewer for this render
326 Viewer_object = viewer;
327

Callers 1

DrawSmallViewsFunction · 0.85

Calls 15

StartFrameFunction · 0.85
grtext_SetFontScaleFunction · 0.85
FindTextureNameFunction · 0.85
PageInVClipFunction · 0.85
ResetFacingsFunction · 0.85
GameRenderWorldFunction · 0.85
grtext_SetFontFunction · 0.85
grtext_SetColorFunction · 0.85
grtext_SetAlphaFunction · 0.85
grtext_SetFlagsFunction · 0.85
grtext_PutsFunction · 0.85
grtext_FlushFunction · 0.85

Tested by

no test coverage detected