Permalink
Browse files

Added initial support for MultiCollection.uop multi format (still inc…

…omplete)

MultiCollection.uop support is required to use new TOL multis, which includes many new keeps/castles

This commit is only to make Sphere detect when MultiCollection.uop is found on UO folder to make it override old multi.mul + multi.idx. But the code is commented out, still need to find a way to read MultiCollection.uop data properly

PS: I don't know how to deal with UO file reading so maybe someday this thing will work, or maybe not. If someone want try it, these OrionUO commits should help with something:
Hotride/OrionUO@70eab08
Hotride/OrionUO@7931745
  • Loading branch information...
coruja747 committed Jan 9, 2019
1 parent e3ef2ff commit 5c9d97b882e2aad735c8ebb4993a12ce77cb5d5e
Showing with 59 additions and 31 deletions.
  1. +9 −1 docs/REVISIONS-56-SERIES.TXT
  2. +32 −26 src/common/CGrayData.cpp
  3. +13 −1 src/common/CGrayInst.cpp
  4. +3 −1 src/common/CGrayInst.h
  5. +2 −2 src/common/graymul.h
@@ -1326,4 +1326,12 @@ Fixed: Recall spell on ship keys not working correctly.
30-12-2018, Coruja
Added: Missing functionality of item ATTR flags 'attr_blessed', 'attr_insured' and 'attr_nodroptrade'
Changed: Updated REPAIR function on craft skills.
[sphere_msgs.scp]: Updated 'repair_*' messages and added new 'item_cantdroptrade'
[sphere_msgs.scp]: Updated 'repair_*' messages and added new 'item_cantdroptrade'

31-12-2018, Coruja
[items/multis/multis_foundations.scp]: Added new TOL house foundations
[items/multis/multis_houses.scp]: Added new TOL keeps/castles
[items/sphere_item_artifacts.scp]: Misc improvements and added new Artifacts of the Cult
[items/sphere_item_artifacts_minor.scp]: Misc improvements
[items/sphere_item_artifacts_tokuno.scp]: Misc improvements
[items/sphere_item_magic_wands.scp]: Removed unused file
@@ -332,55 +332,61 @@ size_t CGrayMulti::Load( MULTI_TYPE id )
ADDTOCALLSTACK("CGrayMulti::Load");
// Just load the whole thing.

CUOIndexRec Index;
if ( (id >= MULTI_QTY) || !g_Install.ReadMulIndex(VERFILE_MULTIIDX, VERFILE_MULTI, id, Index) )
if ( id >= MULTI_QTY )
return 0;

Release();
InitCacheTime(); // This is invalid !
m_id = id;

switch ( g_Install.GetMulFormat( VERFILE_MULTIIDX ) )
//if ( g_Install.m_IsMultiUopFormat )
// TO-DO: add support to read new multi UOP format here (MultiCollection.uop)
//else
{
case VERFORMAT_HIGHSEAS: // high seas multi format (CUOMultiItemRec2)
m_iItemQty = Index.GetBlockLength() / sizeof(CUOMultiItemRec2);
m_pItems = new CUOMultiItemRec2 [ m_iItemQty ];
ASSERT( m_pItems );

ASSERT( (sizeof(m_pItems[0]) * m_iItemQty) >= Index.GetBlockLength() );
if ( ! g_Install.ReadMulData( VERFILE_MULTI, Index, static_cast <CUOMultiItemRec2 *>(m_pItems) ))
return 0;
break;
CUOIndexRec index;
if ( !g_Install.ReadMulIndex(VERFILE_MULTIIDX, VERFILE_MULTI, id, index) )
return 0;

case VERFORMAT_ORIGINAL: // old format (CUOMultiItemRec)
default:
m_iItemQty = Index.GetBlockLength() / sizeof(CUOMultiItemRec);
m_pItems = new CUOMultiItemRec2 [ m_iItemQty ];
ASSERT( m_pItems );
if ( g_Install.GetMulFormat(VERFILE_MULTIIDX) == VERFORMAT_HIGHSEAS )
{
// High Seas multi format (CUOMultiItemRec2)
m_iItemQty = index.GetBlockLength() / sizeof(CUOMultiItemRec2);
m_pItems = new CUOMultiItemRec2[m_iItemQty];
ASSERT(m_pItems);

CUOMultiItemRec* pItems = new CUOMultiItemRec[m_iItemQty];
ASSERT( (sizeof(pItems[0]) * m_iItemQty) >= Index.GetBlockLength() );
if ( ! g_Install.ReadMulData( VERFILE_MULTI, Index, static_cast <CUOMultiItemRec *>(pItems) ))
ASSERT(m_iItemQty * sizeof(m_pItems[0]) >= index.GetBlockLength());
if ( !g_Install.ReadMulData(VERFILE_MULTI, index, static_cast<void *>(m_pItems)) )
return 0;
}
else
{
// Old multi format (CUOMultiItemRec)
m_iItemQty = index.GetBlockLength() / sizeof(CUOMultiItemRec);
m_pItems = new CUOMultiItemRec2[m_iItemQty];
ASSERT(m_pItems);

CUOMultiItemRec *pItems = new CUOMultiItemRec[m_iItemQty];
ASSERT(m_iItemQty * sizeof(pItems[0]) >= index.GetBlockLength());
if ( !g_Install.ReadMulData(VERFILE_MULTI, index, static_cast<void *>(pItems)) )
{
delete[] pItems;
return 0;
}

// copy to new format
for (size_t i = 0; i < m_iItemQty; i++)
// Copy to new format
for ( size_t i = 0; i < m_iItemQty; ++i )
{
m_pItems[i].m_wTileID = pItems[i].m_wTileID;
m_pItems[i].m_dx = pItems[i].m_dx;
m_pItems[i].m_dy = pItems[i].m_dy;
m_pItems[i].m_dz = pItems[i].m_dz;
m_pItems[i].m_visible = pItems[i].m_visible;
m_pItems[i].m_unknown = 0;
m_pItems[i].m_shipAccess = 0;
}

delete[] pItems;
break;
}
}

HitCacheTime();
return( m_iItemQty );
return m_iItemQty;
}
@@ -150,7 +150,7 @@ bool CGrayInstall::OpenFile(VERFILE_TYPE i)
if ( !pFile->GetFilePath().IsEmpty() && pFile->Open(pFile->GetFilePath(), OF_READ|OF_SHARE_DENY_WRITE) )
return true;

LPCTSTR pszFileName = GetBaseFileName(static_cast<VERFILE_TYPE>(i));
LPCTSTR pszFileName = GetBaseFileName(i);
if ( !pszFileName )
return false;

@@ -346,6 +346,18 @@ VERFILE_TYPE CGrayInstall::OpenFiles(DWORD dwMask)
}
break;
}
/*case VERFILE_MULTIIDX:
{
// If MultiCollection.uop is found, use it instead multi.idx + multi.mul (STILL INCOMPLETE)
OpenFile(m_File[VERFILE_MULTI], "MultiCollection.uop", OF_READ|OF_SHARE_DENY_WRITE);
if ( m_File[VERFILE_MULTI].IsFileOpen() )
{
m_IsMultiUopFormat = true;
++i; // skip VERFILE_MULTI
break;
}
// fall through
}*/
default:
{
if ( !OpenFile(static_cast<VERFILE_TYPE>(i)) )
@@ -22,13 +22,15 @@ extern struct CGrayInstall
CGrayInstall()
{
memset(m_FileFormat, 0, sizeof(m_FileFormat));
m_IsMultiUopFormat = false;
memset(m_IsMapUopFormat, 0, sizeof(m_IsMapUopFormat));
memset(m_UopMapAddress, 0, sizeof(m_UopMapAddress));
};

public:
VERFILE_FORMAT m_FileFormat[VERFILE_QTY]; // File format versions
bool m_IsMapUopFormat[256]; // True for maps that are uop format
bool m_IsMultiUopFormat; // True when multi file is MultiCollection.uop instead multi.mul (STILL INCOMPLETE)
bool m_IsMapUopFormat[256]; // True when map file is map[x]LegacyMUL.uop instead map[x].mul
MapAddress m_UopMapAddress[256][256]; // For UOP parsing (note: might need to be ajusted later if format changes)

CGFile m_File[VERFILE_QTY]; // List of files to access
@@ -1712,8 +1712,8 @@ struct CUOMultiItemRec2 // (Multi.mul, High Seas+)
signed short m_dx; // signed delta.
signed short m_dy;
signed short m_dz;
DWORD m_visible; // 0 or 1 (non-visible items are things like doors and signs)
DWORD m_unknown; // unknown data
DWORD m_visible; // 0 or 1 (non-static item, like doors and signs)
DWORD m_shipAccess; // 0 or 1 (rope item used to enter/exit galleons)

ITEMID_TYPE GetDispID() const
{

0 comments on commit 5c9d97b

Please sign in to comment.