From 26201b3816c0ba9966dc4499252cd84fa6ef96be Mon Sep 17 00:00:00 2001 From: ChrisL Date: Mon, 13 Oct 2008 21:05:28 +0000 Subject: [PATCH] Updated build number --Editor fixes from Kriplo Implementation for mouse wheel support Implementation for mouse middle button support Fix for adding on roof tiles Fix assertion when leave editor mode On saving map check of entry points are add Fix for to many ToolTip messages in place walls Fix assertion on loading map without entry points Fix assertion in Sector Summary if DevInfo directory not exist Fix for problem of losing map edgepoints Fix problem with losing stuff from LBE Fix crash in meanwhile --Fixes from Headrock Fixed a typo in the Health experience calcuation for strategic movement Added "Draw" cost to weapons help data git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2375 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Editor/Editor Taskbar Creation.cpp | 8 +---- Editor/Sector Summary.cpp | 10 ++++-- Editor/edit_sys.cpp | 5 ++- Editor/editscreen.cpp | 4 +++ GameVersion.cpp | 8 ++--- Standard Gaming Platform/input.cpp | 58 ++++++++++++++++++++++++++++++ Standard Gaming Platform/input.h | 6 ++++ Standard Gaming Platform/sgp.cpp | 4 +-- Strategic/Strategic Movement.cpp | 2 +- Tactical/Interface Items.cpp | 4 ++- Tactical/Item Types.cpp | 4 ++- Tactical/Overhead.cpp | 3 ++ Tactical/PATHAI.cpp | 1 + TileEngine/worlddef.cpp | 11 +++++- Utils/Text Input.cpp | 7 ++-- ja2_2005Express.vcproj | 8 ++--- 16 files changed, 117 insertions(+), 26 deletions(-) diff --git a/Editor/Editor Taskbar Creation.cpp b/Editor/Editor Taskbar Creation.cpp index 9e034e68..6caac874 100644 --- a/Editor/Editor Taskbar Creation.cpp +++ b/Editor/Editor Taskbar Creation.cpp @@ -462,13 +462,7 @@ void InitEditorBuildingsToolbar() //Selection method buttons iEditorButton[BUILDING_PLACE_WALLS] = CreateEasyToggleButton( iScreenWidthOffset + 180,2 * iScreenHeightOffset + 370,"EDITOR//wall.sti", BuildingWallCallback); - //SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WALLS],L"Place walls using selection method"); - - - SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WALLS], - L"Place walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\n"); - - + SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WALLS],L"Place walls using selection method");//dnl fix for to many tooltip message in place walls iEditorButton[BUILDING_PLACE_DOORS] = CreateEasyToggleButton( iScreenWidthOffset + 210,2 * iScreenHeightOffset + 370,"EDITOR//door.sti", BuildingDoorCallback); SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_DOORS],L"Place doors using selection method"); diff --git a/Editor/Sector Summary.cpp b/Editor/Sector Summary.cpp index 6d331346..42907b25 100644 --- a/Editor/Sector Summary.cpp +++ b/Editor/Sector Summary.cpp @@ -2480,8 +2480,14 @@ void WriteSectorSummaryUpdate( STR8 puiFilename, UINT8 ubLevel, SUMMARYFILE *pSu GetExecutableDirectory( ExecDir ); sprintf( Dir, "%s\\DevInfo", ExecDir ); if( !SetFileManCurrentDirectory( Dir ) ) - AssertMsg( 0, "JA2\\DevInfo folder not found and should exist!"); - + //AssertMsg( 0, "JA2\\DevInfo folder not found and should exist!");//dnl lead to assertion if you don't have Dir and never create summary info + {//dnl + //Directory doesn't exist, so create it, and continue. + if( !MakeFileManDirectory( Dir ) ) + AssertMsg( 0, "Can't create new directory, JA2\\DevInfo for summary information update." ); + if( !SetFileManCurrentDirectory( Dir ) ) + AssertMsg( 0, "JA2\\DevInfo folder not found and should exist!"); + } ptr = strstr( (CHAR8 *)puiFilename, ".dat" ); if( !ptr ) AssertMsg( 0, "Illegal sector summary filename."); diff --git a/Editor/edit_sys.cpp b/Editor/edit_sys.cpp index a269cf55..4091f769 100644 --- a/Editor/edit_sys.cpp +++ b/Editor/edit_sys.cpp @@ -361,6 +361,9 @@ void PasteSingleWallCommon( UINT32 iMapIndex ) // TEMP STUFF FOR ONROOF THINGS! if ( (usUseObjIndex >= FIRSTONROOF) && (usUseObjIndex <= SECONDONROOF ) ) { + //dnl Remove all onroof things before placing new one to avoid stacking problems of same element + RemoveAllOnRoofsOfTypeRange( iMapIndex, FIRSTONROOF, SECONDONROOF ); + // Add to onroof section! AddOnRoofToTail( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); @@ -577,7 +580,7 @@ void PasteStructureCommon( UINT32 iMapIndex ) fOkayToAdd = OkayToAddStructureToWorld( (INT16)iMapIndex, 0, gTileDatabase[ (gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ].pDBStructureRef, INVALID_STRUCTURE_ID ); if ( fOkayToAdd || (gTileDatabase[ (gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ].pDBStructureRef == NULL) ) { - //dnl Remove existing structure before adding the same, seems to solve problem with stacking but possibly dangerous and completly untested + //dnl Remove existing structure before adding the same, seems to solve problem with stacking but still need test to be sure that is not removed something what should stay RemoveStruct( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) );//dnl // Actual structure info is added by the functions below AddStructToHead( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 2561717f..74221779 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -73,6 +73,7 @@ #include "Soldier Profile.h" #include "GameSettings.h" #include "Summary Info.h" + #include "connect.h"//dnl #endif //forward declarations of common classes to eliminate includes @@ -286,6 +287,9 @@ BOOLEAN EditModeInit( void ) OutputDebugString( "Entering editor mode...\n" ); + //dnl after multiplayer stuff was implemeted, editor goes to assertion when you leave editor mode, because InitGameOption() is not called anymore from InitializeGame() + is_networked = FALSE; + InitGameOptions(); gfRealGunNut = gGameOptions.fGunNut; gGameOptions.fGunNut = TRUE; diff --git a/GameVersion.cpp b/GameVersion.cpp index 70c28c5f..245161fd 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -13,12 +13,12 @@ #ifdef JA2EDITOR //MAP EDITOR BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2350" }; +CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2375" }; #elif defined JA2BETAVERSION //BETA/TEST BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Debug v1.13.2350" }; +CHAR16 zVersionLabel[256] = { L"Debug v1.13.2375" }; #elif defined CRIPPLED_VERSION @@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - CHAR16 zVersionLabel[256] = { L"Release v1.13.2350" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.2375" }; #endif -CHAR8 czVersionNumber[16] = { "Build 08.09.15" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 08.10.13" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; diff --git a/Standard Gaming Platform/input.cpp b/Standard Gaming Platform/input.cpp index 83e2e7cb..1b9790c3 100644 --- a/Standard Gaming Platform/input.cpp +++ b/Standard Gaming Platform/input.cpp @@ -1,3 +1,4 @@ +#define _WIN32_WINNT WINVER//dnl this should be defined globaly on project #ifdef JA2_PRECOMPILED_HEADERS #include "JA2 SGP ALL.H" #elif defined( WIZ8_PRECOMPILED_HEADERS ) @@ -5,6 +6,7 @@ #else #include "types.h" #include + #include //dnl #include #include #include "debug.h" @@ -67,6 +69,8 @@ UINT32 guiRightButtonRepeatTimer; BOOLEAN gfTrackMousePos; // TRUE = queue mouse movement events, FALSE = don't BOOLEAN gfLeftButtonState; // TRUE = Pressed, FALSE = Not Pressed BOOLEAN gfRightButtonState; // TRUE = Pressed, FALSE = Not Pressed +BOOLEAN gfMiddleButtonState;//dnl TRUE = Pressed, FALSE = Not Pressed +INT16 gsMouseWheelDeltaValue;//dnl positive value indicates that the wheel was rotated forward, negative value indicates that the wheel was rotated backward, and user handler procedure for mouse wheel should restore after usege this value to zero! INT16 gusMouseXPos; // X position of the mouse on screen INT16 gusMouseYPos; // y position of the mouse on screen @@ -208,6 +212,60 @@ LRESULT CALLBACK MouseHandler(int Code, WPARAM wParam, LPARAM lParam) // Trigger an input event QueueEvent(RIGHT_BUTTON_UP, 0, uiParam); break; + +//dnl begin part for additional mouse events + case WM_MBUTTONDOWN: + // Update the current mouse position + mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; + ScreenToClient(ghWindow, &mpos); + gusMouseXPos = (INT16)mpos.x; + gusMouseYPos = (INT16)mpos.y; + uiParam = gusMouseYPos; + uiParam = uiParam << 16; + uiParam = uiParam | gusMouseXPos; + // Update the button state + gfMiddleButtonState = TRUE; + //Set that we have input + gfSGPInputReceived = TRUE; + // Trigger an input event + QueueEvent(MIDDLE_BUTTON_DOWN, 0, uiParam); + break; + case WM_MBUTTONUP: + // Update the current mouse position + mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; + ScreenToClient(ghWindow, &mpos); + gusMouseXPos = (INT16)mpos.x; + gusMouseYPos = (INT16)mpos.y; + uiParam = gusMouseYPos; + uiParam = uiParam << 16; + uiParam = uiParam | gusMouseXPos; + // Update the button state + gfMiddleButtonState = FALSE; + //Set that we have input + gfSGPInputReceived = TRUE; + // Trigger an input event + QueueEvent(MIDDLE_BUTTON_UP, 0, uiParam); + break; + //case WM_MBUTTONDBLCLK: + // break; + case WM_MOUSEWHEEL: + // Update the current mouse position + mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; + ScreenToClient(ghWindow, &mpos); + gusMouseXPos = (INT16)mpos.x; + gusMouseYPos = (INT16)mpos.y; + uiParam = gusMouseYPos; + uiParam = uiParam << 16; + uiParam = uiParam | gusMouseXPos; + // Update mouse wheel delta value + gsMouseWheelDeltaValue = GetMouseWheelDeltaValue(((MOUSEHOOKSTRUCTEX *)lParam)->mouseData); + //Set that we have input + gfSGPInputReceived = TRUE; + // Trigger an input event + QueueEvent(MOUSE_WHEEL, 0, uiParam); + break; +//dnl end part for additional mouse events + case WM_MOUSEMOVE : // Update the current mouse position mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; diff --git a/Standard Gaming Platform/input.h b/Standard Gaming Platform/input.h index 5ff5b5b4..36b6f0f0 100644 --- a/Standard Gaming Platform/input.h +++ b/Standard Gaming Platform/input.h @@ -19,6 +19,8 @@ #define RIGHT_BUTTON_REPEAT 0x0200 #define MOUSE_POS 0x0400 #define MOUSE_WHEEL 0x0800 +#define MIDDLE_BUTTON_UP 0x1000//dnl +#define MIDDLE_BUTTON_DOWN 0x2000//dnl #define SHIFT_DOWN 0x01 #define CTRL_DOWN 0x02 @@ -109,8 +111,10 @@ extern BOOLEAN gfKeyState[256]; // TRUE = Pressed, FALSE = Not Pressed extern INT16 gusMouseXPos; // X position of the mouse on screen extern INT16 gusMouseYPos; // y position of the mouse on screen +extern INT16 gsMouseWheelDeltaValue;//dnl extern BOOLEAN gfLeftButtonState; // TRUE = Pressed, FALSE = Not Pressed extern BOOLEAN gfRightButtonState; // TRUE = Pressed, FALSE = Not Pressed +extern BOOLEAN gfMiddleButtonState;//dnl TRUE = Pressed, FALSE = Not Pressed extern BOOLEAN gfSGPInputReceived; @@ -118,6 +122,8 @@ extern BOOLEAN gfSGPInputReceived; #define _KeyDown(a) gfKeyState[(a)] #define _LeftButtonDown gfLeftButtonState #define _RightButtonDown gfRightButtonState +#define _MiddleButtonDown gfMiddleButtonState//dnl +#define _WheelValue gsMouseWheelDeltaValue//dnl #define _MouseXPos gusMouseXPos #define _MouseYPos gusMouseYPos diff --git a/Standard Gaming Platform/sgp.cpp b/Standard Gaming Platform/sgp.cpp index d634d05c..7fa31f28 100644 --- a/Standard Gaming Platform/sgp.cpp +++ b/Standard Gaming Platform/sgp.cpp @@ -150,13 +150,13 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP case WM_CLOSE: PostQuitMessage(0); break; - +/*dnl kick this out, because in input.sgp MouseHandler() hook has priority so it will process same event twice, someone force MouseHandler() hook to always return unhandled events status so what ever mouse event you process in WindowProcedure() be aware that this event is already occur in MouseHandler() (mouse clicks, move etc.) Probably this is done because when you lost focus even if you click back on window region this will not restore them, so need condition in MouseHandler to restore window focus case WM_MOUSEWHEEL: { QueueEvent(MOUSE_WHEEL, wParam, lParam); break; } - +*/ #ifdef JA2 case WM_MOVE: // if( 1==iScreenMode ) diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 1298cd3a..a39f8742 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -1510,7 +1510,7 @@ void AwardExperienceForTravelling( GROUP * pGroup ) // award exp... // amount was originally based on getting 100-bLifeMax points for 12 hours of travel (720) // but changed to flat rate since StatChange makes roll vs 100-lifemax as well! - uiPoints = pGroup->uiTraverseTime / (450 / 100 - pSoldier->stats.bLifeMax ); + uiPoints = pGroup->uiTraverseTime / (450 / (100 - pSoldier->stats.bLifeMax ) ); if ( uiPoints > 0 ) { StatChange( pSoldier, HEALTHAMT, (UINT8) uiPoints, FALSE ); diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index c056de47..1e2e5a88 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -8699,7 +8699,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier } //Info for weapons - swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s %s\n%s %1.1f %s", + //swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s %s\n%s %1.1f %s", + swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", ItemNames[ usItem ], AmmoCaliber[ Weapon[ usItem ].ubCalibre ], sValue, @@ -8711,6 +8712,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject )/10 : GunRange( pObject ), //Modified Range gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? Weapon[ usItem ].usRange/10 : Weapon[ usItem ].usRange, //Gun Range gWeaponStatsDesc[ 5 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's apStr, //AP's gWeaponStatsDesc[ 12 ], //Weight String fWeight, //Weight diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index 73602dcf..db1a9cc1 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -142,6 +142,9 @@ void MoveItemsInSlotsToLBE( SOLDIERTYPE *pSoldier, std::vector& LBESlots, // No item in this LBENODE pocket, is pocket active? if(LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketIndex[j] == NONE) // Pocket is inactive continue; + //dnl Pocket is active, so check if there is restriction of type for default item + if(LBEPocketType[LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketIndex[j]].pRestriction != 0 && LBEPocketType[LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketIndex[j]].pRestriction != Item[pSoldier->inv[LBESlots[i]].usItem].ubClassIndex) + continue; // Pocket is active, can default item fit in this pocket? if(LBEPocketType[LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketIndex[j]].ItemCapacityPerSize[dSize] == NONE) // Pocket can't hold this item size continue; @@ -218,7 +221,6 @@ BOOLEAN MoveItemsToActivePockets( SOLDIERTYPE *pSoldier, std::vector& LBES } } - // now drop everything that wouldn't fit anywhere else for(unsigned int i=0; iubID; DebugAttackBusy( String( "Ending action for %d\n", ubID ) ); diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 1ea332f3..85e07330 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -3936,6 +3936,7 @@ void GlobalReachableTest( INT16 sStartGridNo ) } ReconfigurePathAI( ABSMAX_SKIPLIST_LEVEL, ABSMAX_TRAIL_TREE, ABSMAX_PATHQ ); + gubNPCDistLimit = 0;//dnl without this ASTAR will not calculate map edgepoints FindBestPath( &s, NOWHERE, 0, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE ); RestorePathAIToDefaults(); } diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 1ec810ea..e7088692 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -2100,6 +2100,14 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) SaveMapLights( hfile ); } + if(gMapInformation.sCenterGridNo == -1 || (gMapInformation.sNorthGridNo == -1 && gMapInformation.sEastGridNo == -1 && gMapInformation.sSouthGridNo == -1 && gMapInformation.sWestGridNo == -1))//dnl + { + swprintf(gzErrorCatchString, L"SAVE ABORTED! Center entry point and at least one entry point (N,S,E,W) should be set."); + gfErrorCatch = TRUE; + FileClose(hfile); + return(FALSE); + } + SaveMapInformation( hfile ); if( uiFlags & MAP_FULLSOLDIER_SAVED ) @@ -3164,7 +3172,8 @@ BOOLEAN LoadWorld( const STR8 puiFilename, float* pMajorMapVersion, UINT8* pMino { SetRelativeStartAndEndPercentage( 0, 93, 94, L"Init Loaded World..." ); RenderProgressBar( 0, 0 ); - InitLoadedWorld( ); + if(!(gMapInformation.sNorthGridNo == -1 && gMapInformation.sEastGridNo == -1 && gMapInformation.sSouthGridNo == -1 && gMapInformation.sWestGridNo == -1))//dnl just rough solution for skiping InitLoadedWorld if loaded map doesn't contain any entry point which lead into assertion + InitLoadedWorld(); } if( fGenerateEdgePoints ) diff --git a/Utils/Text Input.cpp b/Utils/Text Input.cpp index a0df53d0..3b0bdb62 100644 --- a/Utils/Text Input.cpp +++ b/Utils/Text Input.cpp @@ -272,7 +272,7 @@ void AddTextInputField( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight, IN if( szInitText ) { pNode->ubStrLen = (UINT8)wcslen( szInitText ); - Assert( pNode->ubStrLen <= ubMaxChars ); + Assert( pNode->ubStrLen <= ubMaxChars );//dnl Warning if filename is longer this will throw assertion, need to be consider in future!!! swprintf( pNode->szString, szInitText ); } else @@ -1043,9 +1043,11 @@ void AddChar( UINT32 uiKey ) PlayJA2Sample( ENTERING_TEXT, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); if( gpActive->ubStrLen >= gpActive->ubMaxChars ) { //max length reached. Just replace the last character with new one. +/*dnl this part has no sense and is wrong escpecially when you insert characters then last was always replace gpActive->ubStrLen = gpActive->ubMaxChars; gpActive->szString[ gpActive->ubStrLen-1 ] = (UINT16)uiKey; gpActive->szString[ gpActive->ubStrLen ] = '\0'; +*/ return; } else if( gubCursorPos == gpActive->ubStrLen ) @@ -1058,7 +1060,7 @@ void AddChar( UINT32 uiKey ) else { //insert character after cursor INT16 sChar; - sChar = (INT16)gpActive->ubStrLen; + sChar = (INT16)gpActive->ubStrLen;//dnl sChar = (INT16)(gpActive->ubStrLen + 1); disbanded because was lead into heap breach detected by debugger because gpActive->szString[ sChar + 1 ] was always overlap 2 bytes out of allocation region while( sChar >= gubCursorPos ) { gpActive->szString[ sChar + 1 ] = gpActive->szString[ sChar ]; @@ -1066,6 +1068,7 @@ void AddChar( UINT32 uiKey ) } gpActive->szString[ gubCursorPos ] = (UINT16)uiKey; gpActive->ubStrLen++; + gpActive->szString[ gpActive->ubStrLen ] = '\0';//dnl gubCursorPos++; } } diff --git a/ja2_2005Express.vcproj b/ja2_2005Express.vcproj index ba3212b2..1498b115 100644 --- a/ja2_2005Express.vcproj +++ b/ja2_2005Express.vcproj @@ -66,7 +66,7 @@