79. Brief: //dnl ch79

- Fix random item problems, add automatic maps conversion, fix some exceptions.
Details:
- Random items are now converted to proper real item if added through mapeditor as world or merc item. However random item will be permanently deleted after map is loaded if randomitemcoolnessmodificator not met expected game progress conditions rather then remain as random item.
- Add command line option -DOMAPSCNV to mapeditor which will automatically create radarmaps and convert all maps to the latest map version, all maps will be written to profile MAPS directory so be sure this folder is empty as any existing maps will be overwritten.
- Fix some exceptions for missing GAP files and strange CTD when we pass command line arguments through VS2010.
- Fix not opening items selection from merc inventory if we first do left and then right click for item choosing.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6668 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-11-29 22:49:48 +00:00
parent 72246a8a9a
commit 56b2260ff1
9 changed files with 47 additions and 17 deletions
+3
View File
@@ -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;
}
+2 -2
View File
@@ -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
+12
View File
@@ -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
{
+2 -1
View File
@@ -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<argc && ( argv[i+1][0] != L'-' && argv[i+1][0] != L'/' ) ) ) {
if ( (param == NULL || param[0] == 0) && ( i+1<argc && argv[i+1] && ( argv[i+1][0] != L'-' && argv[i+1][0] != L'/' ) ) )//dnl ch79 291113
{
param = argv[++i];
argv[i] = NULL;
}
+3
View File
@@ -87,6 +87,9 @@ void AudioGapListInit( CHAR8 *zSoundFile, AudioGapList *pGapList )
pDestFileName[counter+3]='p';
pDestFileName[counter+4]='\0';
if(!FileExists(pDestFileName))//dnl ch79 291113
return;
pFile = FileOpen(pDestFileName, FILE_ACCESS_READ, FALSE );
if( pFile )
{
+2 -2
View File
@@ -7789,10 +7789,10 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj )
#else //non-editor version
if (usItem == 0)
if(usItem == 0 || Item[usItem].randomitem > 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
+5 -1
View File
@@ -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();
+5 -1
View File
@@ -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)
+13 -10
View File
@@ -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