Draws the mine, starting at a the specified room The rendering surface must be set up, and g3_StartFrame() must have been called Parameters: viewer_roomnum - what room the viewer is in flag_automap - if true, flag segments as visited when rendered called_from_terrain - set if calling this routine from the terrain renderer
| 3419 | // flag_automap - if true, flag segments as visited when rendered |
| 3420 | // called_from_terrain - set if calling this routine from the terrain renderer |
| 3421 | void RenderMine(int viewer_roomnum, int flag_automap, int called_from_terrain) { |
| 3422 | #ifdef EDITOR |
| 3423 | In_editor_mode = (GetFunctionMode() == EDITOR_MODE); |
| 3424 | #endif |
| 3425 | // check to see if we should render windows |
| 3426 | if (No_render_windows_hack == -1) { |
| 3427 | if (FindArg("-NoRenderWindows")) |
| 3428 | No_render_windows_hack = 1; |
| 3429 | else |
| 3430 | No_render_windows_hack = 0; |
| 3431 | } |
| 3432 | // Get the viewer eye so functions down the line can look at it |
| 3433 | g3_GetViewPosition(&Viewer_eye); |
| 3434 | g3_GetUnscaledMatrix(&Viewer_orient); |
| 3435 | // set these globals so functions down the line can look at them |
| 3436 | Viewer_roomnum = viewer_roomnum; |
| 3437 | Flag_automap = flag_automap; |
| 3438 | Called_from_terrain = called_from_terrain; |
| 3439 | // Assume no terrain |
| 3440 | Must_render_terrain = 0; |
| 3441 | |
| 3442 | // Get the width & height of the render window |
| 3443 | rend_GetProjectionParameters(&Render_width, &Render_height); |
| 3444 | if (!Called_from_terrain) { |
| 3445 | Terrain_portal_top = Render_height; |
| 3446 | Terrain_portal_bottom = 0; |
| 3447 | Terrain_portal_right = 0; |
| 3448 | Terrain_portal_left = Render_width; |
| 3449 | } |
| 3450 | // Build the list of visible rooms |
| 3451 | BuildRoomList(viewer_roomnum); // fills in Render_list & N_render_segs |
| 3452 | |
| 3453 | // If we determined that the terrain is visible, render it |
| 3454 | if (Must_render_terrain && !Called_from_terrain && !(In_editor_mode && Render_inside_only)) { |
| 3455 | RenderTerrain(1, Terrain_portal_left, Terrain_portal_top, Terrain_portal_right, Terrain_portal_bottom); |
| 3456 | // Mark all room points to be rerotated due to terrain trashing our point list |
| 3457 | for (int i = 0; i <= Highest_room_index; i++) { |
| 3458 | Rooms[i].wpb_index = -1; |
| 3459 | Global_buffer_index = 0; |
| 3460 | } |
| 3461 | // Setup fog if needed |
| 3462 | g3_SetFarClipZ(VisibleTerrainZ); |
| 3463 | |
| 3464 | if ((Terrain_sky.flags & TF_FOG) && (UseHardware || (!UseHardware && Lighting_on))) { |
| 3465 | rend_SetZValues(0, VisibleTerrainZ); |
| 3466 | rend_SetFogState(1); |
| 3467 | rend_SetFogBorders(VisibleTerrainZ * .85, VisibleTerrainZ); |
| 3468 | rend_SetFogColor(Terrain_sky.fog_color); |
| 3469 | } else |
| 3470 | rend_SetZValues(0, 5000); |
| 3471 | } |
| 3472 | |
| 3473 | // First render mirrored rooms |
| 3474 | RenderMirrorRooms(); |
| 3475 | |
| 3476 | Num_mirror_rooms = 0; |
| 3477 | |
| 3478 | // Render the list of rooms |
no test coverage detected