1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2025-09-07 16:50:15 +02:00

x64 build - no collision bug found(

Either lost in decompilation or introduced in x64 port.
This commit is contained in:
oz 2021-01-29 16:42:05 +03:00
parent 6756c54d3b
commit cd4679194c
19 changed files with 100 additions and 79 deletions

View file

@ -2,8 +2,9 @@
#include "partman.h"
#include "gdrv.h"
#include "memory.h"
#include "zdrv.h"
short partman::_field_size[] =
short partman::_field_size[] =
{
2, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0
};
@ -14,6 +15,7 @@ datFileStruct* partman::load_records(LPCSTR lpFileName)
_OFSTRUCT ReOpenBuff{};
datFileHeader header{};
dat8BitBmpHeader bmpHeader{};
dat16BitBmpHeader zMapHeader{};
const HFILE fileHandle = OpenFile(lpFileName, &ReOpenBuff, 0);
if (fileHandle == -1)
@ -90,11 +92,11 @@ datFileStruct* partman::load_records(LPCSTR lpFileName)
{
auto entryType = static_cast<datFieldTypes>(_lread_char(fileHandle));
entryData->EntryType = entryType;
int fieldSize = _field_size[static_cast<int>(entryType)];
if (fieldSize < 0)
{
fieldSize = _lread_long(fileHandle);
}
if (entryType == datFieldTypes::Bitmap8bit)
{
_hread(fileHandle, &bmpHeader, sizeof(dat8BitBmpHeader));
@ -117,6 +119,18 @@ datFileStruct* partman::load_records(LPCSTR lpFileName)
bmp->XPosition = bmpHeader.XPosition;
bmp->YPosition = bmpHeader.YPosition;
}
else if (entryType == datFieldTypes::Bitmap16bit)
{
_hread(fileHandle, &zMapHeader, sizeof(dat16BitBmpHeader));
int length = fieldSize - sizeof(dat16BitBmpHeader);
auto zmap = reinterpret_cast<zmap_header_type*>(memory::allocate(sizeof(zmap_header_type) + length));
zmap->Width = zMapHeader.Width;
zmap->Height = zMapHeader.Height;
zmap->Stride = zMapHeader.Stride;
_hread(fileHandle, zmap->ZBuffer, length);
entryData->Buffer = reinterpret_cast<char*>(zmap);
}
else
{
char* entryBuffer = static_cast<char*>(memory::allocate(fieldSize));