This commit is contained in:
GabsPuNs
2026-06-05 16:05:55 -04:00
parent d6e58df26d
commit 8bea50b1e5
29 changed files with 162 additions and 1670 deletions

View File

@@ -35,7 +35,7 @@ SparseLightStorage::SparseLightStorage(bool sky)
{
planeIndices[i] = i;
}
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 @@ SparseLightStorage::SparseLightStorage(SparseLightStorage *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 LIGHT_COMPRESSION_STATS
count = sourceCount;
@@ -151,7 +151,7 @@ void SparseLightStorage::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;
@@ -189,7 +189,7 @@ void SparseLightStorage::setData(byteArray dataIn, unsigned int inOffset)
// Gets all lighting values into an array of length 16384. Destination data will have same order as original java game.
void SparseLightStorage::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);
@@ -400,8 +400,8 @@ void SparseLightStorage::addNewPlane(int y)
// Allocate new memory storage, copy over anything from old storage, and initialise remainder
unsigned char *dataPointer = static_cast<unsigned char *>(malloc(linesUsed * 128 + 128));
XMemCpy( dataPointer, lastDataPointer, 128 * lastLinesUsed + 128);
XMemSet( dataPointer + ( 128 * lastLinesUsed ) + 128, prefill, 128 );
memcpy( dataPointer, lastDataPointer, 128 * lastLinesUsed + 128);
memset( dataPointer + ( 128 * lastLinesUsed ) + 128, prefill, 128 );
dataPointer[y] = lastLinesUsed;
// Get new data and count packed info
@@ -561,13 +561,13 @@ int SparseLightStorage::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;
}
}