mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-06-08 11:03:14 +00:00
Cleanups
This commit is contained in:
@@ -35,7 +35,7 @@ SparseDataStorage::SparseDataStorage()
|
||||
{
|
||||
planeIndices[i] = i - 1;
|
||||
}
|
||||
XMemSet(data, 0, 128 * 127);
|
||||
memset(data, 0, 128 * 127);
|
||||
|
||||
// Data and count packs together the pointer to our data and the count of planes allocated - 127 planes allocated in this case
|
||||
#pragma warning ( disable : 4826 )
|
||||
@@ -99,7 +99,7 @@ SparseDataStorage::SparseDataStorage(SparseDataStorage *copyFrom)
|
||||
dataAndCount = ( sourceDataAndCount & 0xffff000000000000L ) | ( ((int64_t) destIndicesAndData ) & 0x0000ffffffffffffL );
|
||||
#pragma warning ( default : 4826 )
|
||||
|
||||
XMemCpy( destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128 );
|
||||
memcpy( destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128 );
|
||||
|
||||
#ifdef DATA_COMPRESSION_STATS
|
||||
count = sourceCount;
|
||||
@@ -147,7 +147,7 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset)
|
||||
// Allocate required storage
|
||||
unsigned char *planeIndices = static_cast<unsigned char *>(malloc(128 * allocatedPlaneCount + 128));
|
||||
unsigned char *data = planeIndices + 128;
|
||||
XMemCpy(planeIndices, _planeIndices, 128);
|
||||
memcpy(planeIndices, _planeIndices, 128);
|
||||
|
||||
// Second pass through to actually copy the data in to the storage allocated for the required planes
|
||||
unsigned char *pucOut = data;
|
||||
@@ -185,7 +185,7 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset)
|
||||
// Gets all data values into an array of length 16384. Destination data will have same order as original java game.
|
||||
void SparseDataStorage::getData(byteArray retArray, unsigned int retOffset)
|
||||
{
|
||||
XMemSet(retArray.data + + retOffset, 0, 16384);
|
||||
memset(retArray.data + + retOffset, 0, 16384);
|
||||
unsigned char *planeIndices, *data;
|
||||
getPlaneIndicesAndData(&planeIndices, &data);
|
||||
|
||||
@@ -394,8 +394,8 @@ void SparseDataStorage::addNewPlane(int y)
|
||||
|
||||
// Allocate new memory storage, copy over anything from old storage, and initialise remainder
|
||||
auto dataPointer = static_cast<unsigned char *>(malloc(linesUsed * 128 + 128));
|
||||
XMemCpy( dataPointer, lastDataPointer, 128 * lastLinesUsed + 128);
|
||||
XMemSet( dataPointer + ( 128 * lastLinesUsed ) + 128, 0, 128 );
|
||||
memcpy( dataPointer, lastDataPointer, 128 * lastLinesUsed + 128);
|
||||
memset( dataPointer + ( 128 * lastLinesUsed ) + 128, 0, 128 );
|
||||
dataPointer[y] = lastLinesUsed;
|
||||
|
||||
// Get new data and count packed info
|
||||
@@ -544,13 +544,13 @@ int SparseDataStorage::compress()
|
||||
{
|
||||
unsigned char *newIndicesAndData = static_cast<unsigned char *>(malloc(128 + 128 * planesToAlloc));
|
||||
unsigned char *pucData = newIndicesAndData + 128;
|
||||
XMemCpy( newIndicesAndData, _planeIndices, 128 );
|
||||
memcpy( newIndicesAndData, _planeIndices, 128 );
|
||||
|
||||
for( int i = 0; i < 128; i++ )
|
||||
{
|
||||
if( newIndicesAndData[i] < ALL_0_INDEX )
|
||||
{
|
||||
XMemCpy( pucData, &data[ 128 * planeIndices[i] ], 128 );
|
||||
memcpy( pucData, &data[ 128 * planeIndices[i] ], 128 );
|
||||
pucData += 128;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user