Fixed a few endian issues in ACS system

KDiZD Intro, a.k.a. Title Map, is now played correctly; camera on Z1M1 is functional
This commit is contained in:
alexey.lysiuk 2014-11-16 13:15:56 +02:00
parent fd85e116e5
commit 1bda54f3cd

View file

@ -1873,7 +1873,7 @@ FBehavior::FBehavior (int lumpnum, FileReader * fr, int len)
funcm->HasReturnValue = funcf->HasReturnValue;
funcm->ImportNum = funcf->ImportNum;
funcm->LocalCount = funcf->LocalCount;
funcm->Address = funcf->Address;
funcm->Address = LittleLong(funcf->Address);
}
}
@ -2058,7 +2058,7 @@ FBehavior::FBehavior (int lumpnum, FileReader * fr, int len)
const char *const parse = (char *)&chunk[2];
DWORD i;
for (i = 0; i < chunk[1]; )
for (i = 0; i < LittleLong(chunk[1]); )
{
if (parse[i])
{
@ -2351,7 +2351,7 @@ void FBehavior::LoadScriptsDirectory ()
scripts.b = FindChunk (MAKE_ID('S','F','L','G'));
if (scripts.dw != NULL)
{
max = scripts.dw[1] / 4;
max = LittleLong(scripts.dw[1]) / 4;
scripts.dw += 2;
for (i = max; i > 0; --i, scripts.w += 2)
{
@ -2367,7 +2367,7 @@ void FBehavior::LoadScriptsDirectory ()
scripts.b = FindChunk (MAKE_ID('S','V','C','T'));
if (scripts.dw != NULL)
{
max = scripts.dw[1] / 4;
max = LittleLong(scripts.dw[1]) / 4;
scripts.dw += 2;
for (i = max; i > 0; --i, scripts.w += 2)
{
@ -2681,7 +2681,7 @@ BYTE *FBehavior::FindChunk (DWORD id) const
{
return chunk;
}
chunk += ((DWORD *)chunk)[1] + 8;
chunk += LittleLong(((DWORD *)chunk)[1]) + 8;
}
return NULL;
}
@ -2689,14 +2689,14 @@ BYTE *FBehavior::FindChunk (DWORD id) const
BYTE *FBehavior::NextChunk (BYTE *chunk) const
{
DWORD id = *(DWORD *)chunk;
chunk += ((DWORD *)chunk)[1] + 8;
chunk += LittleLong(((DWORD *)chunk)[1]) + 8;
while (chunk != NULL && chunk < Data + DataSize)
{
if (((DWORD *)chunk)[0] == id)
{
return chunk;
}
chunk += ((DWORD *)chunk)[1] + 8;
chunk += LittleLong(((DWORD *)chunk)[1]) + 8;
}
return NULL;
}