Пример #1
0
/* 
 * GraphicsAreaRedraw:  Called whenever we get an expose event.
 *   hdc should be the DC from the PAINTSTRUCT structure of the expose event.
 */
void GraphicsAreaRedraw(HDC hdc)
{
	// If in GAME_INVALID, leave background color; if in game, copy drawn room
	if (GameGetState() != GAME_INVALID)
	{
		RecopyRoom3D( hdc, view.x, view.y, view.cx, view.cy, FALSE );
		RecopyRoom3D( hdc, areaMiniMap.x, areaMiniMap.y, areaMiniMap.cx, areaMiniMap.cy, TRUE );
	}
}
Пример #2
0
void DrawRoom3D(room_type *room, Draw3DParams *params)
{
   long t1,t2,t3,t4,t5;
   static int count = 0;
   
   /* write stuff in static variables */
   stretchfactor = params->stretchfactor;
   p = params;
   
   /* Size of offscreen bitmap */
   area.x = area.y = 0;
   area.cx = min(params->width  / stretchfactor, MAXX);
   area.cy = min(params->height / stretchfactor, MAXY);

   // Force size to be even
   area.cy = area.cy & ~1;  
   area.cx = area.cx & ~1;

   /* some precalculations */
   horizon = area.cy/2 + PlayerGetHeightOffset();
   num_visible_objects = 0;

   t1=timeGetTime();
   DrawBSP(room, params, area.cx, True);
   t2=timeGetTime();
   DrawPreOverlayEffects(room, params);
   if (!player.viewID)
      DrawPlayerOverlays();
   DrawPostOverlayEffects(room, params);
   t3=timeGetTime();
   StretchImage();   
   t4=timeGetTime();
   //	Draw corner treatment.
   DrawViewTreatment();
   //	Copy offscreen buffer to screen.
   if (!D3DRenderIsEnabled())
   {
		RecopyRoom3D( params->hdc, params->x, params->y, params->width, params->height, FALSE );
		GdiFlush();
   }
   t5=timeGetTime();
   
   count++;
   if (count > 500)
   {
      debug(("BSP draw %ldms, overlays %dms, stretch %ldms, treatment and copy %ldms\n", t2-t1, t3-t2, t4-t3, t5-t4));
      count = 0;
   }
}
Пример #3
0
/*
 * DrawMap: Draw map in area described by params.
 */
void DrawMap( room_type *room, Draw3DParams *params, Bool bMiniMap )
{
   AREA area;
   HDC gDC;
   BYTE *bits;
   int width;
   long t1, t2, t3, t4, t5;
   static int count = 0;
   
   int num_visible_object_SavedForMiniMapHack;

   stretchfactor = params->stretchfactor;

   area.x = area.y = 0;
   area.cx = params->width & ~1;
   area.cy = params->height & ~1;

   if( !bMiniMap )
   {
	   if (stretchfactor == 1)
	   {
		  gDC = gBitsDC;
		  bits = gBits;
		  width = MAXX;
	   }
	   else 
	   {
		  gDC = gBufferDC;
		  bits = gBufferBits;
		  width = 2 * MAXX;
	   }
   }
   else
   {
		//	It seems num_visible_objects needs to be zero initially, and as a result of processing, is left at some
		//	actual value for number of objects in the room. Running this proc for the MiniMap is resulting in this
		//	var being left zero at the end. Unsure why. For now preserve the old value of num_visible_objects to restore
		//	after processing. ajw
		num_visible_object_SavedForMiniMapHack = num_visible_objects;
		gDC		= gMiniMapDC;
		bits	= gMiniMapBits;
		width	= MINIMAP_MAX_WIDTH;
   }

   num_visible_objects = 0;

   t1 = timeGetTime();
   // Trace BSP tree to see if more walls are visible
   DrawBSP(room, params, MAXX, False);

   t2 = timeGetTime();

   t3 = timeGetTime();
   MapDraw( gDC, bits, &area, room, width, bMiniMap );
   DrawPostOverlayEffects(room, params);
   t4 = timeGetTime();
   RecopyRoom3D( params->hdc, params->x, params->y, params->width, params->height, bMiniMap );
   t5 = timeGetTime();

   if( bMiniMap )
	   num_visible_objects = num_visible_object_SavedForMiniMapHack;

   if (count++ % 50 == 0)
      debug(("Map trace %ld, clear %ld, draw %ld, copy %ld\n", t2-t1, t3-t2, t4-t3, t5-t4));
}