Brief: //dnl ch74

- Couple map editor fixes.
Details:
- Map loading not properly set Vanilla global variable switch.
- Loading AIMNAS maps of version 28 cause CTD due to incorrect StackedObjectData loading sizeof.
- Only in editor mode and if NAS setting is on inseparable and default attachments will be always add, but default attachments will not, so older maps should be converted from mapeditor to new version.
- Fix CTD if try to place items from tab selection which contains no items.
- There was missing part from ch4 for mouse wheel support in mapeditor.
- There was conflict between keyboard and mouse events creating problems when try to select taskbar options by mouse.
- Fix annoying message of using improper attachment during item place if item consist of default or inseparable attachments.
- Remove hints to display if loading map from editor.
- Fix CTD if have previously selected merc and loading another (smaller) map.
- Saving map as Vanilla will check if attachment is valid for 1.12, that means you will lost some stuff from NIV if save in Vanilla mode, so you should always save map in newest format if want play map in 1.13.
- Add correct weight recalculation when saving in Vanilla format using old OBJECTTYPE.
- Remove entry points check during map save as Scheinworld reported problem with basement levels and similar maps which doesn't need entry points.
- Fix displaying wrong map version in summary window because MapInfo is incorrectly saved in all previous mapeditors.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6530 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-10-25 18:48:37 +00:00
parent c5e72c4265
commit f008316275
12 changed files with 101 additions and 46 deletions
+20 -4
View File
@@ -141,6 +141,7 @@
#include "connect.h"
#include "Map Screen Interface Map Inventory.h"//dnl ch51 081009
#include "Sys Globals.h"//dnl ch74 201013
/////////////////////////////////////////////////////
//
@@ -2602,8 +2603,8 @@ BOOLEAN StackedObjectData::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 u
// are now used. Due to this, we only have to reduce for the sizes of bDirtLevel and sObjectFlag, but not sRepairThreshold (sizeof(ObjectData) is now 40).
// But of course, we now 'read' the values for sRepairThreshold, but there weren't any in older map versions, resulting in garbage values - we therefore set that manually to 100
// Of course, once the ObjectData-Class is altered, this has to be altered as well!
LOADDATA(&(this->data), *hBuffer, sizeof(ObjectData) - (sizeof(this->data.bDirtLevel) + sizeof(this->data.sObjectFlag) ) );
//dnl ch74 241013 We cannot change past so hardcode 32 simply because that was sizeof(ObjectData) before current and all future changes ;-)
LOADDATA(&(this->data), *hBuffer, /*sizeof(ObjectData) - (sizeof(this->data.bDirtLevel) + sizeof(this->data.sObjectFlag) )*/32);
this->data.sRepairThreshold = 100;
}
else
@@ -2797,7 +2798,7 @@ BOOLEAN OBJECTTYPE::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorM
LOADDATA( &OldSavedObject101, *hBuffer, sizeof(OLD_OBJECTTYPE_101) );
(*this) = OldSavedObject101;
}
#if 0//dnl ch74 201013 only inseparable attachments should always exist but rather at gun status instead of 100%, if default attachments is missing then problem is map which should be fixed by modders with latest mapeditor or have really old savegame but that should not be fix just by magically add missing default attachment :-)
RemoveProhibitedAttachments(NULL, this, (*this).usItem);
//Madd: ok, so this drives me nuts -- why bother with default attachments if the map isn't going to load them for you?
@@ -2811,7 +2812,22 @@ BOOLEAN OBJECTTYPE::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorM
CreateItem(Item [ (*this).usItem ].defaultattachments[cnt],100,&defaultAttachment);
this->AttachObject(NULL,&defaultAttachment, FALSE);
}
#else
if(this->usItem && (gGameOptions.ubAttachmentSystem || gfEditMode))
{
RemoveProhibitedAttachments(NULL, this, this->usItem);
//Madd: ok, so this drives me nuts -- why bother with default attachments if the map isn't going to load them for you?
//this should fix that...
for(UINT8 cnt=0; cnt<MAX_DEFAULT_ATTACHMENTS; cnt++)
{
if(Item[this->usItem].defaultattachments[cnt] == NONE || !(gGameOptions.ubAttachmentSystem && Item[Item[this->usItem].defaultattachments[cnt]].inseparable || gfEditMode))
break;
OBJECTTYPE defaultAttachment;
CreateItem(Item[this->usItem].defaultattachments[cnt], (*this)[0]->data.gun.bGunStatus, &defaultAttachment);
this->AttachObject(NULL, &defaultAttachment, FALSE);
}
}
#endif
return TRUE;
}