From a14d8b5396c3c62998ae1b5a6f200ec82617cb55 Mon Sep 17 00:00:00 2001 From: Wanne Date: Wed, 2 Jan 2013 22:16:01 +0000 Subject: [PATCH] - Big Maps Radarmap creation (interim fix) (by Buggler) o interim fix for radar map sti creation based on DBrot bigger overview code; only works when map editor resolution >= 1680x1050 & map size <= 360x360 o will revert to old radarmap generation (top left 160x160) if condition not satisfied due to current method uses video buffer of overhead map git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5755 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Utils/MapUtility.cpp | 60 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/Utils/MapUtility.cpp b/Utils/MapUtility.cpp index 5a6ced332..545f79054 100644 --- a/Utils/MapUtility.cpp +++ b/Utils/MapUtility.cpp @@ -143,11 +143,27 @@ UINT32 MapUtilScreenHandle(void) iOffsetVertical = (SCREEN_HEIGHT - 160) / 2 - 160;// Vertical start position of the overview map InitNewOverheadDB((UINT8)giCurrentTilesetID); gfOverheadMapDirty = TRUE; - RenderOverheadMap(0, (WORLD_COLS/2), iOffsetHorizontal, iOffsetVertical, iOffsetHorizontal+640, iOffsetVertical+320, TRUE); + + //Buggler: interim code for radar map sti creation <= 360x360 based on DBrot bigger overview code + if(iResolution >= _1680x1050 && WORLD_COLS <= 360) + RenderOverheadMap(0, (WORLD_COLS/2), iOffsetHorizontal, iOffsetVertical, iOffsetHorizontal + (640 * WORLD_COLS / OLD_WORLD_COLS), iOffsetVertical + (320 * WORLD_ROWS / OLD_WORLD_ROWS), TRUE); + else + RenderOverheadMap(0, (WORLD_COLS/2), iOffsetHorizontal, iOffsetVertical, iOffsetHorizontal+640, iOffsetVertical+320, TRUE); + TrashOverheadMap(); - // OK, NOW PROCESS OVERHEAD MAP ( SHOUIDL BE ON THE FRAMEBUFFER ) - gdXStep = (FLOAT)640 / (FLOAT)MINIMAP_X_SIZE; - gdYStep = (FLOAT)320 / (FLOAT)MINIMAP_Y_SIZE; + // OK, NOW PROCESS OVERHEAD MAP ( SHOULD BE ON THE FRAMEBUFFER ) + //Buggler: interim code for radar map sti creation <= 360x360 based on DBrot bigger overview code + if(iResolution >= _1680x1050 && WORLD_COLS <= 360) + { + gdXStep = (FLOAT)(640 * WORLD_COLS / OLD_WORLD_COLS) / (FLOAT)MINIMAP_X_SIZE; + gdYStep = (FLOAT)(320 * WORLD_ROWS / OLD_WORLD_ROWS) / (FLOAT)MINIMAP_Y_SIZE; + } + else + { + gdXStep = (FLOAT)640 / (FLOAT)MINIMAP_X_SIZE; + gdYStep = (FLOAT)320 / (FLOAT)MINIMAP_Y_SIZE; + } + dStartX = iOffsetHorizontal; dStartY = iOffsetVertical; // Adjust if we are using a restricted map... @@ -190,18 +206,38 @@ UINT32 MapUtilScreenHandle(void) { for ( iWindowY = iSubY1; iWindowY < iSubY2; iWindowY++ ) { - if ( iWindowX >= iOffsetHorizontal && iWindowX < (iOffsetHorizontal+640) && iWindowY >= iOffsetVertical && iWindowY < (iOffsetVertical+320) ) + //Buggler: interim code for radar map sti creation <= 360x360 based on DBrot bigger overview code + if(iResolution >= _1680x1050 && WORLD_COLS <= 360) { - s16BPPSrc = pSrcBuf[ ( iWindowY * (uiSrcPitchBYTES/2) ) + iWindowX ]; + if ( iWindowX >= iOffsetHorizontal && iWindowX < (iOffsetHorizontal + (640 * WORLD_COLS / OLD_WORLD_COLS)) && iWindowY >= iOffsetVertical && iWindowY < (iOffsetVertical + (320 * WORLD_ROWS / OLD_WORLD_ROWS)) ) + { + s16BPPSrc = pSrcBuf[ ( iWindowY * (uiSrcPitchBYTES/2) ) + iWindowX ]; - uiRGBColor = GetRGBColor( s16BPPSrc ); + uiRGBColor = GetRGBColor( s16BPPSrc ); - bR += SGPGetRValue( uiRGBColor ); - bG += SGPGetGValue( uiRGBColor ); - bB += SGPGetBValue( uiRGBColor ); + bR += SGPGetRValue( uiRGBColor ); + bG += SGPGetGValue( uiRGBColor ); + bB += SGPGetBValue( uiRGBColor ); - // Average! - iCount++; + // Average! + iCount++; + } + } + else + { + if ( iWindowX >= iOffsetHorizontal && iWindowX < (iOffsetHorizontal + 640) && iWindowY >= iOffsetVertical && iWindowY < (iOffsetVertical + 320) ) + { + s16BPPSrc = pSrcBuf[ ( iWindowY * (uiSrcPitchBYTES/2) ) + iWindowX ]; + + uiRGBColor = GetRGBColor( s16BPPSrc ); + + bR += SGPGetRValue( uiRGBColor ); + bG += SGPGetGValue( uiRGBColor ); + bB += SGPGetBValue( uiRGBColor ); + + // Average! + iCount++; + } } } }