mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Brief: //dnl ch86
- Fixing mapeditor move building and improving some related mapeditor stuff. Details: - Change the way exit grids are add, remove, save and load through editor, also add undo option for exit grids and you can place unlimited number of them. - Fix incorrect gridno save in temporary map file for bigmap exit grids. - Increase maximum number of light sprite from 256 to 4096 per map. - Using DEL key for QuickEraseMapTile will now erase ItemPool too, and with improved function DeleteStuffFromMapTile will erase light sprites, exit grids and door locks. - Cliff hang tiles used for middle cliffs are now possible to erase with when erase button is on. - Add support for undo door locks, also you can now erase them if erase button is on. - Move building function is completely rewrite and will properly move exit grids, door locks, lights and items too. - Removing unnecessary tiles during copy building is improved too. - Fix undo function for light sprites which now will also store all three types and undo them properly. - Fix CTD situation if tile elements are deleted and after that items too, then undo will crash mapeditor. - Fix spawning of item pool cursors during when adding items. - Fix text glitches over door locks form. - Fix sticky tooltip when loadsave screen or door locks form is active. - High ground marking cursors will not be drawn in invisible map tiles anymore to increase speed and maybe fix some render problems but I doubt it. - Move GLOCK_17_ForUseWithLOS item generation from init.cpp to los.cpp to avoid potential problems if global world items array not set. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7004 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+58
-5
@@ -43,6 +43,7 @@
|
||||
#include "Pits.h"
|
||||
#include "keys.h"
|
||||
#include "InterfaceItemImages.h"
|
||||
#include "Editor Undo.h"//dnl ch86 220214
|
||||
#endif
|
||||
|
||||
#include <vfs/Tools/vfs_log.h>
|
||||
@@ -844,7 +845,7 @@ void ShowItemCursor( INT32 iMapIndex )
|
||||
pNode = gpWorldLevelData[ iMapIndex ].pTopmostHead;
|
||||
while( pNode )
|
||||
{
|
||||
if( pNode->usIndex == SELRING )
|
||||
if( pNode->usIndex == SELRING1 )//dnl ch86 240214
|
||||
return;
|
||||
pNode = pNode->pNext;
|
||||
}
|
||||
@@ -982,6 +983,8 @@ void AddSelectedItemToWorld( INT32 sGridNo )
|
||||
break;
|
||||
}
|
||||
|
||||
ITEM_POOL *pItemPoolOld;
|
||||
GetItemPoolFromGround(sGridNo, &pItemPoolOld);//dnl ch86 220214
|
||||
pObject = InternalAddItemToPool( &sGridNo, &gTempObject, bVisibility, 0, usFlags, 0, -1, &iItemIndex );
|
||||
if( gTempObject.usItem != OWNERSHIP )
|
||||
{
|
||||
@@ -1026,6 +1029,7 @@ void AddSelectedItemToWorld( INT32 sGridNo )
|
||||
|
||||
if( !GetItemPoolFromGround( sGridNo, &pItemPool ) )
|
||||
Assert( 0 );
|
||||
UpdateItemPoolInUndoList(sGridNo, pItemPoolOld, pItemPool);//dnl ch86 220214
|
||||
while( pItemPool )
|
||||
{
|
||||
if( &(gWorldItems[ pItemPool->iItemIndex ].object) == pObject )
|
||||
@@ -1122,7 +1126,7 @@ void DeleteSelectedItem()
|
||||
{
|
||||
SpecifyItemToEdit( NULL, -1 );
|
||||
//First, check to see if there even is a currently selected item.
|
||||
if( iCurrentTaskbar == TASK_MERCS )
|
||||
if( gsSelectedMercID != -1 )//dnl ch86 220214
|
||||
{
|
||||
DeleteSelectedMercsItem();
|
||||
return;
|
||||
@@ -1136,7 +1140,6 @@ void DeleteSelectedItem()
|
||||
SpecifyItemToEdit( &gWorldItems[ gpItemPool->pNext->iItemIndex ].object, gpItemPool->sGridNo );
|
||||
}
|
||||
sGridNo = gpItemPool->sGridNo;
|
||||
|
||||
//remove the item
|
||||
if( gWorldItems[ gpItemPool->iItemIndex ].object.usItem == ACTION_ITEM )
|
||||
{
|
||||
@@ -1148,10 +1151,16 @@ void DeleteSelectedItem()
|
||||
if( gpEditingItemPool == gpItemPool )
|
||||
gpEditingItemPool = NULL;
|
||||
RemoveItemFromPool( sGridNo, gpItemPool->iItemIndex, 0 );
|
||||
#if 0//dnl ch86 220214
|
||||
gpItemPool = NULL;
|
||||
|
||||
//determine if there are still any items at this location
|
||||
if( GetItemPoolFromGround( sGridNo, &gpItemPool ) )
|
||||
#else
|
||||
ITEM_POOL *pItemPoolOld = gpItemPool;
|
||||
GetItemPoolFromGround(sGridNo, &gpItemPool);
|
||||
UpdateItemPoolInUndoList(sGridNo, pItemPoolOld, gpItemPool);
|
||||
if(gpItemPool)
|
||||
#endif
|
||||
{ //reset display for remaining items
|
||||
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo );
|
||||
}
|
||||
@@ -1173,7 +1182,7 @@ void DeleteSelectedItem()
|
||||
gpCurrItemPoolNode = pIPCurr->next;
|
||||
else
|
||||
gpCurrItemPoolNode = pIPHead;
|
||||
if( gpCurrItemPoolNode )
|
||||
if( gpCurrItemPoolNode && iCurrentTaskbar == TASK_ITEMS )//dnl ch86 220214
|
||||
{
|
||||
//get the item pool at this node's gridno.
|
||||
GetItemPoolFromGround( gpCurrItemPoolNode->sGridNo, &gpItemPool );
|
||||
@@ -1776,4 +1785,48 @@ void ScrollEditorItemsInfo(BOOLEAN fForward)//dnl ch80 011213
|
||||
gfRenderTaskbar = TRUE;
|
||||
}
|
||||
|
||||
//dnl ch86 120214
|
||||
BOOLEAN ItemPoolListMove(INT32 iOldGridNo, INT32 iNewGridNo, ITEM_POOL *pItemPool)
|
||||
{
|
||||
while(pItemPool)
|
||||
{
|
||||
if(gWorldItems[pItemPool->iItemIndex].sGridNo == iOldGridNo)
|
||||
gWorldItems[pItemPool->iItemIndex].sGridNo = iNewGridNo;
|
||||
pItemPool->sGridNo = iNewGridNo;
|
||||
pItemPool = pItemPool->pNext;
|
||||
}
|
||||
IPListNode *curr = pIPHead;
|
||||
while(curr)
|
||||
{
|
||||
if(curr->sGridNo == iOldGridNo)
|
||||
curr->sGridNo = iNewGridNo;
|
||||
curr = curr->next;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
BOOLEAN DeleteItemNode(INT32 iMapIndex)
|
||||
{
|
||||
IPListNode *pIPPrev = NULL, *pIPCurr = pIPHead;
|
||||
while(pIPCurr)
|
||||
{
|
||||
if(pIPCurr->sGridNo == iMapIndex)// remove node from the list
|
||||
{
|
||||
if(pIPPrev)
|
||||
pIPPrev->next = pIPCurr->next;// middle of list
|
||||
else
|
||||
pIPHead = pIPHead->next;// head of list
|
||||
if(pIPCurr->next)// move the curr item pool to the next one
|
||||
gpCurrItemPoolNode = pIPCurr->next;
|
||||
else
|
||||
gpCurrItemPoolNode = pIPHead;
|
||||
MemFree(pIPCurr);
|
||||
pIPCurr = NULL;
|
||||
return(TRUE);
|
||||
}
|
||||
pIPPrev = pIPCurr, pIPCurr = pIPCurr->next;
|
||||
}
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user