DW2/Tinsel2 endian fixes. Apart from some palette glitches the game is playable now.

svn-id: r36218
This commit is contained in:
Joost Peters 2009-02-04 19:52:00 +00:00
parent 22812367aa
commit b89031b8d2
4 changed files with 17 additions and 17 deletions

View File

@ -125,9 +125,9 @@ typedef struct {
typedef struct {
short x;
short y;
short stringId;
int16 x;
int16 y;
int16 stringId;
unsigned char duration;
unsigned char fontId;
@ -596,10 +596,10 @@ static int MovieCommand(char cmd, int commandOffset) {
PPRINT_CMD pCmd;
pCmd = (PPRINT_CMD)(bigBuffer + commandOffset);
MovieText(nullContext, pCmd->stringId,
pCmd->x,
pCmd->y,
MovieText(nullContext, (int16)READ_LE_UINT16(&pCmd->stringId),
(int16)READ_LE_UINT16(&pCmd->x),
(int16)READ_LE_UINT16(&pCmd->y),
pCmd->fontId,
NULL,
pCmd->duration);
@ -612,9 +612,9 @@ static int MovieCommand(char cmd, int commandOffset) {
pCmd = (PTALK_CMD)(bigBuffer + commandOffset);
talkColour = RGB(pCmd->r, pCmd->g, pCmd->b);
MovieText(nullContext, pCmd->stringId,
pCmd->x,
pCmd->y,
MovieText(nullContext, (int16)READ_LE_UINT16(&pCmd->stringId),
(int16)READ_LE_UINT16(&pCmd->x),
(int16)READ_LE_UINT16(&pCmd->y),
0,
&talkColour,
pCmd->duration);

View File

@ -257,7 +257,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
if (TinselV2)
// Copy all the colours
memcpy(p->palRGB, pNewPal->palRGB, FROM_LE_32(pNewPal->numColours) * sizeof(COLORREF));
memcpy(p->palRGB, pNewPal->palRGB, p->numColours * sizeof(COLORREF));
#ifdef DEBUG
// one more palette in use
@ -267,7 +267,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
// Q the change to the video DAC
if (TinselV2)
UpdateDACqueue(p->posInDAC, FROM_LE_32(pNewPal->numColours), p->palRGB);
UpdateDACqueue(p->posInDAC, p->numColours, p->palRGB);
else
UpdateDACqueueHandle(p->posInDAC, p->numColours, p->hPal);
@ -372,10 +372,10 @@ void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) {
pPalQ->hPal = hNewPal;
if (TinselV2) {
pPalQ->numColours = pNewPal->numColours;
pPalQ->numColours = FROM_LE_32(pNewPal->numColours);
// Copy all the colours
memcpy(pPalQ->palRGB, pNewPal->palRGB, pNewPal->numColours * sizeof(COLORREF));
memcpy(pPalQ->palRGB, pNewPal->palRGB, FROM_LE_32(pNewPal->numColours) * sizeof(COLORREF));
if (!pPalQ->bFading)
// Q the change to the video DAC
@ -512,7 +512,7 @@ void CreateGhostPalette(SCNHANDLE hPalette) {
// leave background colour alone
ghostPalette[0] = 0;
for (i = 0; i < pPal->numColours; i++) {
for (i = 0; i < (int)FROM_LE_32(pPal->numColours); i++) {
// get the RGB colour model values
uint8 red = GetRValue(pPal->palRGB[i]);
uint8 green = GetGValue(pPal->palRGB[i]);

View File

@ -295,7 +295,7 @@ static void SoundReel(CORO_PARAM, SCNHANDLE hFilm, int column, int speed,
case ANI_JUMP:
_ctx->frameNumber++;
assert(pAni[_ctx->frameNumber].op < 0);
assert((int32)FROM_LE_32(pAni[_ctx->frameNumber].op) < 0);
_ctx->frameNumber += FROM_LE_32(pAni[_ctx->frameNumber].op);

View File

@ -804,7 +804,7 @@ void T2MoverProcess(CORO_PARAM, const void *param) {
InitialPathChecks(pMover, rpos->X, rpos->Y);
pFilm = (FILM *)LockMem(pMover->walkReels[i][FORWARD]); // Any old reel
pmi = (PMULTI_INIT)LockMem(pFilm->reels[0].mobj);
pmi = (PMULTI_INIT)LockMem(FROM_LE_32(pFilm->reels[0].mobj));
// Poke in the background palette
PokeInPalette(pmi);