diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp index 80136a2f..c490fe64 100644 --- a/Editor/EditorMercs.cpp +++ b/Editor/EditorMercs.cpp @@ -3001,7 +3001,10 @@ void HandleMercInventoryPanel( INT16 sX, INT16 sY, INT8 bEvent ) SpecifyItemToEdit( gpMercSlotItem[ x ], -1 ); } if( bEvent == GUI_RCLICK_EVENT ) //user r-clicked, so enable item choosing + { + gfRenderMercInfo = TRUE;//dnl ch79 271113 gfMercGetItem = TRUE; + } gbCurrSelect = x; return; } diff --git a/Init.cpp b/Init.cpp index 2e46feb1..d62a81a3 100644 --- a/Init.cpp +++ b/Init.cpp @@ -1524,10 +1524,10 @@ UINT32 InitializeJA2(void) #ifdef JA2BETAVERSION #ifdef JA2EDITOR // CHECK COMMANDLINE FOR SPECIAL UTILITY - if ( strcmp( gzCommandLine, "-DOMAPS" ) == 0 ) + if(strcmp(gzCommandLine, "-DOMAPS") == 0 || strcmp(gzCommandLine, "-DOMAPSCNV") == 0)//dnl ch79 291113 { GenerateAllMapsInit();//dnl ch49 061009 - return( MAPUTILITY_SCREEN ); + return(MAPUTILITY_SCREEN); } #endif #endif diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 85897ebc..ac90fe39 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -2954,6 +2954,18 @@ BOOLEAN OBJECTTYPE::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorM } } } +#ifndef JA2EDITOR//dnl ch79 281113 + if(Item[this->usItem].randomitem > 0) + { + if(CreateItem(this->usItem, (*this)[0]->data.gun.bGunStatus, &gTempObject)) + *this = gTempObject; + else + { + this->usItem = 0; + this->ubNumberOfObjects = 0; + } + } +#endif } else { diff --git a/Standard Gaming Platform/sgp.cpp b/Standard Gaming Platform/sgp.cpp index 350f20d7..d03d3cfe 100644 --- a/Standard Gaming Platform/sgp.cpp +++ b/Standard Gaming Platform/sgp.cpp @@ -1873,7 +1873,8 @@ static void PopulateSectionFromCommandLine(vfs::PropertyContainer &oProps, vfs:: wchar_t *psep = wcspbrk(arg, L":="); wchar_t *param = (psep ? psep+1 : NULL); if (psep) *psep = 0; - if ( (param == NULL || param[0] == 0) && ( i+1 0)//dnl ch79 291113 don't recreate random item from game as GetItemFromRandomItem obviously fail to create real item { DebugBreakpoint(); - return( FALSE ); + return(FALSE); } #endif diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index 93982d47..80b988ae 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -899,11 +899,15 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart // Black color for the background! //ColorFillVideoSurfaceArea( FRAME_BUFFER, sStartPointX_S, sStartPointY_S, sEndXS, sEndYS, 0 ); - +#if 0//dnl ch79 291113 if(gfTacticalPlacementGUIActive)//dnl ch45 021009 Skip overwrite buttons area which is not refresh during scroll //dnl ch77 211113 ColorFillVideoSurfaceArea(uiBigMap, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-160, 0); else ColorFillVideoSurfaceArea(uiBigMap, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-120, 0); +#else + if(!fFromMapUtility) + ColorFillVideoSurfaceArea(uiBigMap, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-(gfTacticalPlacementGUIActive?160:120), 0); +#endif fInterfacePanelDirty = DIRTYLEVEL2; InvalidateScreen(); diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index a93ec261..adac13d8 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -2901,7 +2901,11 @@ BOOLEAN LoadWorld(const STR8 puiFilename, FLOAT* pMajorMapVersion, UINT8* pMinor // Read JA2 Version ID LOADDATA(&dMajorMapVersion, pBuffer, sizeof(FLOAT)); LOADDATA(&ubMinorMapVersion, pBuffer, sizeof(UINT8)); - + if(pMajorMapVersion && pMinorMapVersion)//dnl ch79 291113 + { + *pMajorMapVersion = dMajorMapVersion; + *pMinorMapVersion = ubMinorMapVersion; + } INT32 iRowSize = OLD_WORLD_ROWS; INT32 iColSize = OLD_WORLD_COLS; if(dMajorMapVersion >= 7.00) diff --git a/Utils/MapUtility.cpp b/Utils/MapUtility.cpp index 00e5d181..ab0c3e52 100644 --- a/Utils/MapUtility.cpp +++ b/Utils/MapUtility.cpp @@ -99,7 +99,7 @@ UINT32 MapUtilScreenInit(void) } // Create big map buffer which contains whole map for radar map generation vs_desc.usWidth = (640 * WORLD_COLS / OLD_WORLD_COLS); - vs_desc.usHeight = (320 * WORLD_ROWS / OLD_WORLD_ROWS) + 10;// +10, without this additional lines editor will crash as renderer go beyond them + vs_desc.usHeight = (320 * WORLD_ROWS / OLD_WORLD_ROWS) + 50;//!!! without this additional lines editor will crash as renderer go beyond them vs_desc.ubBitDepth = ubBitDepth; if(!GetVideoSurface(&ghVSurface, guiBigMap)) { @@ -108,7 +108,7 @@ UINT32 MapUtilScreenInit(void) } else if(!(ghVSurface->usWidth == vs_desc.usWidth && ghVSurface->usHeight == vs_desc.usHeight)) { - DeleteVideoSurfaceFromIndex( guiBigMap ); + DeleteVideoSurfaceFromIndex(guiBigMap); if(AddVideoSurface(&vs_desc, (UINT32*)&guiBigMap) == FALSE) return(ERROR_SCREEN); } @@ -122,14 +122,14 @@ UINT32 MapUtilScreenHandle(void) InputAtom InputEvent; SGPPaletteEntry pPalette[256]; CHAR8 zFilename[260], zFilename2[260]; - UINT8 *pDataPtr; + UINT8 *pDataPtr, ubMinorMapVersion; UINT16 *pDestBuf, *pSrcBuf; UINT32 uiDestPitchBYTES, uiSrcPitchBYTES, uiRGBColor, bR, bG, bB, bAvR, bAvG, bAvB; INT16 s16BPPSrc, sDest16BPPColor, sX1, sX2, sY1, sY2, sTop, sBottom, sLeft, sRight; INT32 cnt, iX, iY, iSubX1, iSubY1, iSubX2, iSubY2, iWindowX, iWindowY, iCount; - FLOAT dX, dY, dStartX, dStartY; + FLOAT dX, dY, dStartX, dStartY, dMajorMapVersion; - while(DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT) == TRUE || ((_LeftButtonDown|_RightButtonDown|_MiddleButtonDown) ? InputEvent.usParam = ESC : 0))//dnl ch78 271113 + while(DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT) == TRUE || (_RightButtonDown ? InputEvent.usParam = ESC : 0))//dnl ch78 291113 { if(InputEvent.usParam == ESC) { @@ -152,7 +152,6 @@ UINT32 MapUtilScreenHandle(void) } if(gfMapUtilityWindowActive) { - GetVideoSurface(&ghVSurface, gui8BitMiniMap); SetCurrentCursorFromDatabase(VIDEO_NO_CURSOR);//dnl ch78 271113 return(MAPUTILITY_SCREEN); } @@ -160,7 +159,6 @@ UINT32 MapUtilScreenHandle(void) { DisableEditorTaskbar(); DisableAllTextFields(); - MapUtilScreenInit(); } sDest16BPPColor = -1; bAvR = bAvG = bAvB = 0; @@ -177,15 +175,20 @@ UINT32 MapUtilScreenHandle(void) return(MAPUTILITY_SCREEN); } sprintf(zFilename, "%s", FListNode->FileInfo.zFileName); - // OK, load maps and do overhead shrinkage of them... - if(!LoadWorld(zFilename)) + // OK, load maps and do overhead shrinkage of them... //dnl ch79 291113 + if(!LoadWorld(zFilename, &dMajorMapVersion, &ubMinorMapVersion)) return(ERROR_SCREEN); + if(strcmp(gzCommandLine, "-DOMAPSCNV") == 0) + if(!(dMajorMapVersion == MAJOR_MAP_VERSION && ubMinorMapVersion == MINOR_MAP_VERSION && gMapInformation.ubMapVersion == MINOR_MAP_VERSION)) + if(!SaveWorld(zFilename)) + return(ERROR_SCREEN); } // Render small map //iOffsetHorizontal = (SCREEN_WIDTH / 2) - (640 / 2);// Horizontal start postion of the overview map //iOffsetVertical = (SCREEN_HEIGHT - 160) / 2 - 160;// Vertical start position of the overview map iOffsetHorizontal = iOffsetVertical = 0; - ColorFillVideoSurfaceArea(guiBigMap, 0, 0, (INT16)(SCREEN_WIDTH), (INT16)(SCREEN_HEIGHT), Get16BPPColor(FROMRGB(0, 0, 0))); + MapUtilScreenInit();//dnl ch79 291113 + //ColorFillVideoSurfaceArea(guiBigMap, 0, 0, (INT16)(640 * WORLD_COLS / OLD_WORLD_COLS), (INT16)(320 * WORLD_ROWS / OLD_WORLD_ROWS), Get16BPPColor(FROMRGB(0, 0, 0))); InitNewOverheadDB((UINT8)giCurrentTilesetID); gfOverheadMapDirty = TRUE; //Buggler: interim code for radar map sti creation <= 360x360 based on DBrot bigger overview code