diff options
author | Paul Gilbert | 2012-05-14 20:21:54 +1000 |
---|---|---|
committer | Paul Gilbert | 2012-05-14 20:22:52 +1000 |
commit | 9eb66a2324120a6c4e22a980a9114bce437fcd8b (patch) | |
tree | 945bb4a6d5c7e32a10ad63c268bdf0157b75e81b /engines/tony/mpal | |
parent | 8f4694a80c92b20d76a69c46dc43d1a990ec82c6 (diff) | |
download | scummvm-rg350-9eb66a2324120a6c4e22a980a9114bce437fcd8b.tar.gz scummvm-rg350-9eb66a2324120a6c4e22a980a9114bce437fcd8b.tar.bz2 scummvm-rg350-9eb66a2324120a6c4e22a980a9114bce437fcd8b.zip |
TONY: Added endian fixes for reading data
Diffstat (limited to 'engines/tony/mpal')
-rw-r--r-- | engines/tony/mpal/loadmpc.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp index 937374517f..6430325503 100644 --- a/engines/tony/mpal/loadmpc.cpp +++ b/engines/tony/mpal/loadmpc.cpp @@ -96,27 +96,27 @@ static const byte *ParseScript(const byte *lpBuf, LPMPALSCRIPT lpmsScript) { int curCmd,j,len; uint i; - lpmsScript->nObj=*(int *)lpBuf; - lpBuf+=4; + lpmsScript->nObj = (int32)READ_LE_UINT32(lpBuf); + lpBuf += 4; - lpmsScript->nMoments=*(uint16 *)lpBuf; - lpBuf+=2; + lpmsScript->nMoments = READ_LE_UINT16(lpBuf); + lpBuf += 2; curCmd=0; for (i=0;i<lpmsScript->nMoments;i++) { - lpmsScript->Moment[i].dwTime=*(int *)lpBuf; lpBuf+=4; + lpmsScript->Moment[i].dwTime = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; lpmsScript->Moment[i].nCmds=*lpBuf; lpBuf++; for (j=0;j<lpmsScript->Moment[i].nCmds;j++) { lpmsScript->Command[curCmd].type=*lpBuf; lpBuf++; switch (lpmsScript->Command[curCmd].type) { case 1: - lpmsScript->Command[curCmd].nCf =*(uint16 *)(lpBuf); lpBuf+=2; - lpmsScript->Command[curCmd].arg1=*(int *)(lpBuf); lpBuf+=4; - lpmsScript->Command[curCmd].arg2=*(int *)(lpBuf); lpBuf+=4; - lpmsScript->Command[curCmd].arg3=*(int *)(lpBuf); lpBuf+=4; - lpmsScript->Command[curCmd].arg4=*(int *)(lpBuf); lpBuf+=4; + lpmsScript->Command[curCmd].nCf = READ_LE_UINT16(lpBuf); lpBuf += 2; + lpmsScript->Command[curCmd].arg1 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; + lpmsScript->Command[curCmd].arg2 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; + lpmsScript->Command[curCmd].arg3 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; + lpmsScript->Command[curCmd].arg4 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; break; case 2: // Variable assign @@ -260,7 +260,7 @@ static const byte *ParseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) { error("Too much commands in dialog #%d",lpmdDialog->nObj); /* Choices */ - num=*(uint16 *)lpBuf; lpBuf += 2; + num = READ_LE_UINT16(lpBuf); lpBuf += 2; if (num >= MAX_CHOICES_PER_DIALOG) error("Too much choices in dialog #%d",lpmdDialog->nObj); @@ -343,8 +343,8 @@ static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) { uint32 i,j,kk; uint32 curCmd; - lpmiItem->nObj=*(int *)lpBuf; - lpBuf+=4; + lpmiItem->nObj = (int32)READ_LE_UINT32(lpBuf); + lpBuf += 4; len=*lpBuf; lpBuf++; @@ -367,12 +367,12 @@ static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) { lpmiItem->Action[i].num=*lpBuf; lpBuf++; - lpmiItem->Action[i].wParm=*(uint16 *)lpBuf; - lpBuf+=2; + lpmiItem->Action[i].wParm = READ_LE_UINT16(lpBuf); + lpBuf += 2; if (lpmiItem->Action[i].num==0xFF) { - lpmiItem->Action[i].wTime=*(uint16 *)lpBuf; - lpBuf+=2; + lpmiItem->Action[i].wTime = READ_LE_UINT16(lpBuf); + lpBuf += 2; lpmiItem->Action[i].perc=*lpBuf; lpBuf++; @@ -400,11 +400,11 @@ static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) { lpBuf++; switch (lpmiItem->Command[curCmd].type) { case 1: // Call custom function - lpmiItem->Command[curCmd].nCf =*(uint16 *)(lpBuf); lpBuf+=2; - lpmiItem->Command[curCmd].arg1=*(int *)(lpBuf); lpBuf+=4; - lpmiItem->Command[curCmd].arg2=*(int *)(lpBuf); lpBuf+=4; - lpmiItem->Command[curCmd].arg3=*(int *)(lpBuf); lpBuf+=4; - lpmiItem->Command[curCmd].arg4=*(int *)(lpBuf); lpBuf+=4; + lpmiItem->Command[curCmd].nCf = READ_LE_UINT16(lpBuf); lpBuf += 2; + lpmiItem->Command[curCmd].arg1 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; + lpmiItem->Command[curCmd].arg2 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; + lpmiItem->Command[curCmd].arg3 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; + lpmiItem->Command[curCmd].arg4 = (int32)READ_LE_UINT32(lpBuf); lpBuf += 4; break; case 2: // Variable assign @@ -444,7 +444,7 @@ static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) { } } - lpmiItem->dwRes=*(uint32 *)lpBuf; lpBuf+=4; + lpmiItem->dwRes = READ_LE_UINT32(lpBuf); lpBuf += 4; return lpBuf; } @@ -468,14 +468,14 @@ static const byte *ParseItem(const byte *lpBuf, LPMPALITEM lpmiItem) { \****************************************************************************/ static const byte *ParseLocation(const byte *lpBuf, LPMPALLOCATION lpmlLocation) { - lpmlLocation->nObj=*(int *)lpBuf; - lpBuf+=4; - lpmlLocation->dwXlen=*(uint16 *)lpBuf; - lpBuf+=2; - lpmlLocation->dwYlen=*(uint16 *)lpBuf; - lpBuf+=2; - lpmlLocation->dwPicRes=*(uint32 *)lpBuf; - lpBuf+=4; + lpmlLocation->nObj = (int32)READ_LE_UINT32(lpBuf); + lpBuf += 4; + lpmlLocation->dwXlen = READ_LE_UINT16(lpBuf); + lpBuf += 2; + lpmlLocation->dwYlen = READ_LE_UINT16(lpBuf); + lpBuf += 2; + lpmlLocation->dwPicRes = READ_LE_UINT32(lpBuf); + lpBuf += 4; return lpBuf; } |