mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
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:
+12
-4
@@ -1125,13 +1125,18 @@ OLD_OBJECTTYPE_101& OLD_OBJECTTYPE_101::operator=(OBJECTTYPE& src)
|
||||
if((void*)this != (void*)&src)
|
||||
{
|
||||
memset(this, 0, sizeof(OLD_OBJECTTYPE_101));
|
||||
if(src.usItem >= OLD_MAXITEMS)//dnl ch74 191013
|
||||
{
|
||||
this->fFlags = OBJECT_UNDROPPABLE;
|
||||
return(*this);
|
||||
}
|
||||
this->usItem = src.usItem;
|
||||
this->ubNumberOfObjects = src.ubNumberOfObjects;
|
||||
this->ubWeight = (UINT8)CalculateObjectWeight(&src);//dnl??? need test, probably this should be calculated after you create old object
|
||||
this->fFlags = src.fFlags;
|
||||
this->ubMission = src.ubMission;
|
||||
this->ubNumberOfObjects = src.ubNumberOfObjects;
|
||||
this->usItem = src.usItem;
|
||||
this->ubWeight = Item[this->usItem].ubWeight * this->ubNumberOfObjects;//dnl ch74 191013
|
||||
if(ubNumberOfObjects == 1)
|
||||
{
|
||||
this->ugYucky.bGunStatus = (INT8)src[0]->data.gun.bGunStatus;
|
||||
@@ -1158,6 +1163,8 @@ OLD_OBJECTTYPE_101& OLD_OBJECTTYPE_101::operator=(OBJECTTYPE& src)
|
||||
this->ugYucky.usGunAmmoItem = src[0]->data.gun.usGunAmmoItem;
|
||||
this->ugYucky.bGunAmmoStatus = (INT8)src[0]->data.gun.bGunAmmoStatus;
|
||||
this->ugYucky.ubGunState = src[0]->data.gun.ubGunState;
|
||||
if(this->ugYucky.ubGunAmmoType && this->ugYucky.ubGunShotsLeft)//dnl ch74 191013
|
||||
this->ubWeight += Item[this->ugYucky.usGunAmmoItem].ubWeight;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1211,9 +1218,10 @@ OLD_OBJECTTYPE_101& OLD_OBJECTTYPE_101::operator=(OBJECTTYPE& src)
|
||||
int i = 0;
|
||||
for(attachmentList::iterator iter=src[0]->attachments.begin(); iter!=src[0]->attachments.end(); ++iter)
|
||||
{
|
||||
//dnl??? this part should check if attachment is valid for 1.12, but then means you will lost some stuff from NIV, and if you wnat play map in older 1.13 versions this is not good
|
||||
//if(iter->usItem)
|
||||
// ;
|
||||
//dnl ch74 191013 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
|
||||
if(iter->usItem >= OLD_MAXITEMS || iter->usItem == NONE)
|
||||
continue;
|
||||
this->ubWeight += Item[iter->usItem].ubWeight;
|
||||
this->usAttachItem[i] = iter->usItem;
|
||||
this->bAttachStatus[i] = (INT8)(*iter)[0]->data.objectStatus;
|
||||
if(++i >= OLD_MAX_ATTACHMENTS_101)
|
||||
|
||||
@@ -1249,7 +1249,7 @@ typedef enum ePOCKET_TYPE
|
||||
#define FIRST_ARMOUR 161
|
||||
#define FIRST_MISC 201
|
||||
#define FIRST_KEY 271
|
||||
|
||||
#define OLD_MAXITEMS 351//dnl ch74 191013
|
||||
#define NOTHING NONE
|
||||
typedef enum
|
||||
{
|
||||
|
||||
+15
-1
@@ -56,6 +56,7 @@
|
||||
#include "drugs and alcohol.h"
|
||||
#include "Food.h"
|
||||
#include "opplist.h"
|
||||
#include "Sys Globals.h"//dnl ch74 201013
|
||||
#endif
|
||||
|
||||
#ifdef JA2UB
|
||||
@@ -7842,6 +7843,7 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj )
|
||||
{
|
||||
(*pObj).fFlags |= OBJECT_UNDROPPABLE;
|
||||
}
|
||||
#if 0//dnl ch74 201013 create default attachments rather at gun status instead of 100%
|
||||
for(UINT8 cnt = 0; cnt < MAX_DEFAULT_ATTACHMENTS; cnt++){
|
||||
if(Item [ usItem ].defaultattachments[cnt] == 0)
|
||||
break;
|
||||
@@ -7851,9 +7853,21 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj )
|
||||
CreateItem(Item [ usItem ].defaultattachments[cnt],100,&defaultAttachment);
|
||||
pObj->AttachObject(NULL,&defaultAttachment, FALSE);
|
||||
}
|
||||
#else
|
||||
if(gGameOptions.ubAttachmentSystem || gfEditMode)
|
||||
{
|
||||
for(UINT8 cnt=0; cnt<MAX_DEFAULT_ATTACHMENTS; cnt++)
|
||||
{
|
||||
if(Item[usItem].defaultattachments[cnt] == NONE)
|
||||
break;
|
||||
OBJECTTYPE defaultAttachment;
|
||||
CreateItem(Item[usItem].defaultattachments[cnt], (*pObj)[0]->data.gun.bGunStatus, &defaultAttachment);
|
||||
pObj->AttachObject(NULL, &defaultAttachment, FALSE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateItem: return %d",fRet));
|
||||
return( fRet );
|
||||
}
|
||||
|
||||
@@ -559,13 +559,21 @@ void TrashWorldItems()
|
||||
}
|
||||
}
|
||||
|
||||
//dnl ch33 150909
|
||||
//dnl ch33 150909 //dnl ch74 191013
|
||||
void SaveWorldItemsToMap(HWFILE fp, float dMajorMapVersion, UINT8 ubMinorMapVersion)
|
||||
{
|
||||
UINT32 i, uiBytesWritten, uiActualNumWorldItems;
|
||||
UINT32 i, uiBytesWritten, uiActualNumWorldItems=0;
|
||||
OLD_WORLDITEM_101 oldWorldItem;
|
||||
|
||||
uiActualNumWorldItems = GetNumUsedWorldItems();
|
||||
for(i=0; i<guiNumWorldItems; i++)
|
||||
{
|
||||
if(gWorldItems[i].fExists)
|
||||
{
|
||||
if(dMajorMapVersion == VANILLA_MAJOR_MAP_VERSION && ubMinorMapVersion == VANILLA_MINOR_MAP_VERSION && gWorldItems[i].object.usItem >= OLD_MAXITEMS)
|
||||
continue;
|
||||
uiActualNumWorldItems++;
|
||||
}
|
||||
}
|
||||
FileWrite(fp, &uiActualNumWorldItems, sizeof(UINT32), &uiBytesWritten);
|
||||
for(i=0; i<guiNumWorldItems; i++)
|
||||
{
|
||||
@@ -573,6 +581,8 @@ void SaveWorldItemsToMap(HWFILE fp, float dMajorMapVersion, UINT8 ubMinorMapVers
|
||||
{
|
||||
if(dMajorMapVersion == VANILLA_MAJOR_MAP_VERSION && ubMinorMapVersion == VANILLA_MINOR_MAP_VERSION)
|
||||
{
|
||||
if(gWorldItems[i].object.usItem >= OLD_MAXITEMS)
|
||||
continue;
|
||||
oldWorldItem = gWorldItems[i];
|
||||
FileWrite(fp, &oldWorldItem, sizeof(OLD_WORLDITEM_101), &uiBytesWritten);
|
||||
}
|
||||
@@ -704,7 +714,7 @@ void LoadWorldItemsFromMap( INT8 **hBuffer, float dMajorMapVersion, int ubMinorM
|
||||
{ //all armed bombs are buried
|
||||
dummyItem.bVisible = BURIED;
|
||||
}
|
||||
|
||||
#if 0//dnl ch74 201013 this is already done in OBJECTTYPE::Load()
|
||||
//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++)
|
||||
@@ -716,7 +726,7 @@ void LoadWorldItemsFromMap( INT8 **hBuffer, float dMajorMapVersion, int ubMinorM
|
||||
CreateItem(Item [ dummyItem.object.usItem ].defaultattachments[cnt],100,&defaultAttachment);
|
||||
dummyItem.object.AttachObject(NULL,&defaultAttachment, FALSE);
|
||||
}
|
||||
|
||||
#endif
|
||||
AddItemToPoolAndGetIndex( dummyItem.sGridNo, &dummyItem.object, dummyItem.bVisible, dummyItem.ubLevel, dummyItem.usFlags, dummyItem.bRenderZHeightAboveLevel, dummyItem.soldierID, &iItemIndex );
|
||||
gWorldItems[ iItemIndex ].ubNonExistChance = dummyItem.ubNonExistChance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user