From 7f06e006e078ef21e450ddc3618ccf126bfb1c28 Mon Sep 17 00:00:00 2001 From: skyjake Date: Sat, 21 Aug 2004 14:37:01 +0000 Subject: [PATCH] Fixed endianness issues --- doomsday/Src/Common/f_infine.c | 11 +-- doomsday/Src/jHeretic/Mn_menu.c | 13 ++- doomsday/Src/jHeretic/P_setup.c | 34 ++++--- doomsday/Src/jHexen/Mn_menu.c | 10 +- doomsday/Src/jHexen/P_acs.c | 157 ++++++++++++++++---------------- doomsday/Src/jHexen/P_setup.c | 34 ++++--- doomsday/Src/jHexen/Po_man.c | 34 +++---- 7 files changed, 145 insertions(+), 148 deletions(-) diff --git a/doomsday/Src/Common/f_infine.c b/doomsday/Src/Common/f_infine.c index 29be7eb0a2..2f77980656 100644 --- a/doomsday/Src/Common/f_infine.c +++ b/doomsday/Src/Common/f_infine.c @@ -1536,15 +1536,14 @@ int FI_CharWidth(int ch, boolean fontb) #if __JDOOM__ if(ch < 33) return 4; - return fontb ? hu_font_b[ch - HU_FONTSTART].width : hu_font_a[ch - - HU_FONTSTART]. - width; + return fontb ? SHORT(hu_font_b[ch - HU_FONTSTART].width) : + SHORT(hu_font_a[ch - HU_FONTSTART].width); #else if(ch < 33) return 5; - return ((patch_t *) - W_CacheLumpNum((fontb ? FontBBase : FontABase) + ch - 33, - PU_CACHE))->width; + return SHORT( ((patch_t *) + W_CacheLumpNum((fontb ? FontBBase : FontABase) + ch - 33, + PU_CACHE))->width ); #endif } diff --git a/doomsday/Src/jHeretic/Mn_menu.c b/doomsday/Src/jHeretic/Mn_menu.c index aa4d42f5bb..37e839084b 100644 --- a/doomsday/Src/jHeretic/Mn_menu.c +++ b/doomsday/Src/jHeretic/Mn_menu.c @@ -690,7 +690,7 @@ void MN_DrTextA(char *text, int x, int y) { p = W_CacheLumpNum(FontABaseLump + c - 33, PU_CACHE); GL_DrawPatch(x, y, FontABaseLump + c - 33); - x += p->width - 1; + x += SHORT(p->width) - 1; } } } @@ -719,7 +719,7 @@ void MN_DrTextA_CS(char *text, int x, int y) { p = W_CacheLumpNum(FontABaseLump + c - 33, PU_CACHE); GL_DrawPatch_CS(x, y, FontABaseLump + c - 33); - x += p->width - 1; + x += SHORT(p->width) - 1; } } } @@ -766,7 +766,7 @@ int MN_TextAWidth(char *text) else { p = W_CacheLumpNum(FontABaseLump + c - 33, PU_CACHE); - width += p->width - 1; + width += SHORT(p->width) - 1; } } return (width); @@ -779,7 +779,6 @@ int MN_TextAWidth(char *text) // Draw text using font B. // //--------------------------------------------------------------------------- - void MN_DrTextB(char *text, int x, int y) { char c; @@ -796,7 +795,7 @@ void MN_DrTextB(char *text, int x, int y) { p = W_CacheLumpNum(FontBBaseLump + c - 33, PU_CACHE); GL_DrawPatch(x, y, FontBBaseLump + c - 33); - x += p->width - 1; + x += SHORT(p->width) - 1; } } } @@ -825,7 +824,7 @@ void MN_DrTextB_CS(char *text, int x, int y) { p = W_CacheLumpNum(FontBBaseLump + c - 33, PU_CACHE); GL_DrawPatch_CS(x, y, FontBBaseLump + c - 33); - x += p->width - 1; + x += SHORT(p->width) - 1; } } } @@ -857,7 +856,7 @@ int MN_TextBWidth(char *text) else { p = W_CacheLumpNum(FontBBaseLump + c - 33, PU_CACHE); - width += p->width - 1; + width += SHORT(p->width) - 1; } } return (width); diff --git a/doomsday/Src/jHeretic/P_setup.c b/doomsday/Src/jHeretic/P_setup.c index 736815083b..572de848e0 100644 --- a/doomsday/Src/jHeretic/P_setup.c +++ b/doomsday/Src/jHeretic/P_setup.c @@ -83,11 +83,8 @@ void P_LoadVertexes(int lump, int gllump) } // There are additional vertices in gllump. numvertexes += - (W_LumpLength(gllump) - (ver == 2 ? 4 : 0)) / (ver == - 1 ? - sizeof(mapvertex_t) - : - sizeof(glvert2_t)); + (W_LumpLength(gllump) - (ver == 2 ? 4 : 0)) / + (ver == 1 ? sizeof(mapvertex_t) : sizeof(glvert2_t)); } vertexes = Z_Malloc(numvertexes * sizeof(vertex_t), PU_LEVEL, 0); data = W_CacheLumpNum(lump, PU_STATIC); @@ -115,8 +112,8 @@ void P_LoadVertexes(int lump, int gllump) } else { - li->x = glv->x; - li->y = glv->y; + li->x = LONG(glv->x); + li->y = LONG(glv->y); } } Z_Free(glverts); @@ -192,22 +189,23 @@ void P_LoadSegsGL(int lump) for(i = 0; i < numsegs; i++, li++, gls++) { li->v1 = - &vertexes[gls->v1 & 0x8000 ? firstGLvertex + - (gls->v1 & 0x7fff) : gls->v1]; + &vertexes[USHORT(gls->v1) & 0x8000 ? firstGLvertex + + (USHORT(gls->v1) & 0x7fff) : USHORT(gls->v1)]; li->v2 = - &vertexes[gls->v2 & 0x8000 ? firstGLvertex + - (gls->v2 & 0x7fff) : gls->v2]; + &vertexes[USHORT(gls->v2) & 0x8000 ? firstGLvertex + + (USHORT(gls->v2) & 0x7fff) : USHORT(gls->v2)]; - if(gls->linedef != -1) + if(USHORT(gls->linedef) != USHORT(-1)) { - ldef = &lines[gls->linedef]; + ldef = &lines[USHORT(gls->linedef)]; li->linedef = ldef; - li->sidedef = &sides[ldef->sidenum[gls->side]]; - li->frontsector = sides[ldef->sidenum[gls->side]].sector; + li->sidedef = &sides[ldef->sidenum[USHORT(gls->side)]]; + li->frontsector = sides[ldef->sidenum[USHORT(gls->side)]].sector; if(ldef->flags & ML_TWOSIDED) { - li->backsector = sides[ldef->sidenum[gls->side ^ 1]].sector; + li->backsector = sides[ldef->sidenum + [USHORT(gls->side) ^ 1]].sector; } else { @@ -270,8 +268,8 @@ void P_LoadSubsectors(int lump) ss = subsectors; for(i = 0; i < numsubsectors; i++, ss++, ms++) { - ss->linecount = ms->numSegs; - ss->firstline = ms->firstseg; + ss->linecount = USHORT(ms->numSegs); + ss->firstline = USHORT(ms->firstseg); } Z_Free(data); diff --git a/doomsday/Src/jHexen/Mn_menu.c b/doomsday/Src/jHexen/Mn_menu.c index 4dc8fbfde8..42a5179a10 100644 --- a/doomsday/Src/jHexen/Mn_menu.c +++ b/doomsday/Src/jHexen/Mn_menu.c @@ -789,7 +789,7 @@ void MN_DrTextA_CS(char *text, int x, int y) { p = W_CacheLumpNum(FontABaseLump + c - 33, PU_CACHE); GL_DrawPatch_CS(x, y, FontABaseLump + c - 33); - x += p->width - 1; + x += SHORT(p->width) - 1; } } } @@ -822,7 +822,7 @@ void MN_DrTextAYellow_CS(char *text, int x, int y) { p = W_CacheLumpNum(FontAYellowBaseLump + c - 33, PU_CACHE); GL_DrawPatch_CS(x, y, FontAYellowBaseLump + c - 33); - x += p->width - 1; + x += SHORT(p->width) - 1; } } } @@ -858,7 +858,7 @@ int MN_TextAWidth(char *text) else { p = W_CacheLumpNum(FontABaseLump + c - 33, PU_CACHE); - width += p->width - 1; + width += SHORT(p->width) - 1; } } return (width); @@ -888,7 +888,7 @@ void MN_DrTextB_CS(char *text, int x, int y) { p = W_CacheLumpNum(FontBBaseLump + c - 33, PU_CACHE); GL_DrawPatch_CS(x, y, FontBBaseLump + c - 33); - x += p->width - 1; + x += SHORT(p->width) - 1; } } } @@ -924,7 +924,7 @@ int MN_TextBWidth(char *text) else { p = W_CacheLumpNum(FontBBaseLump + c - 33, PU_CACHE); - width += p->width - 1; + width += SHORT(p->width) - 1; } } return (width); diff --git a/doomsday/Src/jHexen/P_acs.c b/doomsday/Src/jHexen/P_acs.c index f19ebf0f20..cd6c6d6259 100644 --- a/doomsday/Src/jHexen/P_acs.c +++ b/doomsday/Src/jHexen/P_acs.c @@ -230,8 +230,8 @@ void P_LoadACScripts(int lump) header = W_CacheLumpNum(lump, PU_LEVEL); ActionCodeBase = (byte *) header; - buffer = (int *) ((byte *) header + header->infoOffset); - ACScriptCount = *buffer++; + buffer = (int *) ((byte *) header + LONG(header->infoOffset)); + ACScriptCount = LONG(*buffer++); if(ACScriptCount == 0 || IS_CLIENT) { // Empty behavior lump ACScriptCount = 0; @@ -241,9 +241,9 @@ void P_LoadACScripts(int lump) memset(ACSInfo, 0, ACScriptCount * sizeof(acsInfo_t)); for(i = 0, info = ACSInfo; i < ACScriptCount; i++, info++) { - info->number = *buffer++; - info->address = (int *) ((byte *) ActionCodeBase + *buffer++); - info->argCount = *buffer++; + info->number = LONG(*buffer++); + info->address = (int *) ((byte *) ActionCodeBase + LONG(*buffer++)); + info->argCount = LONG(*buffer++); if(info->number >= OPEN_SCRIPTS_BASE) { // Auto-activate info->number -= OPEN_SCRIPTS_BASE; @@ -255,11 +255,12 @@ void P_LoadACScripts(int lump) info->state = ASTE_INACTIVE; } } - ACStringCount = *buffer++; + ACStringCount = LONG(*buffer++); ACStrings = (char **) buffer; for(i = 0; i < ACStringCount; i++) { - ACStrings[i] += (int) ActionCodeBase; + ACStrings[i] = (char*) (LONG((int)ACStrings[i]) + + (int) ActionCodeBase); } memset(MapVars, 0, sizeof(MapVars)); } @@ -541,7 +542,7 @@ void T_InterpretACS(acs_t * script) PCodePtr = ACScript->ip; do { - cmd = *PCodePtr++; + cmd = LONG(*PCodePtr++); action = PCodeCmds[cmd] (); } while(action == SCRIPT_CONTINUE); ACScript->ip = PCodePtr; @@ -733,7 +734,7 @@ static int CmdSuspend(void) static int CmdPushNumber(void) { - Push(*PCodePtr++); + Push(LONG(*PCodePtr++)); return SCRIPT_CONTINUE; } @@ -741,7 +742,7 @@ static int CmdLSpec1(void) { int special; - special = *PCodePtr++; + special = LONG(*PCodePtr++); SpecArgs[0] = Pop(); P_ExecuteLineSpecial(special, SpecArgs, ACScript->line, ACScript->side, ACScript->activator); @@ -752,7 +753,7 @@ static int CmdLSpec2(void) { int special; - special = *PCodePtr++; + special = LONG(*PCodePtr++); SpecArgs[1] = Pop(); SpecArgs[0] = Pop(); P_ExecuteLineSpecial(special, SpecArgs, ACScript->line, ACScript->side, @@ -764,7 +765,7 @@ static int CmdLSpec3(void) { int special; - special = *PCodePtr++; + special = LONG(*PCodePtr++); SpecArgs[2] = Pop(); SpecArgs[1] = Pop(); SpecArgs[0] = Pop(); @@ -777,7 +778,7 @@ static int CmdLSpec4(void) { int special; - special = *PCodePtr++; + special = LONG(*PCodePtr++); SpecArgs[3] = Pop(); SpecArgs[2] = Pop(); SpecArgs[1] = Pop(); @@ -791,7 +792,7 @@ static int CmdLSpec5(void) { int special; - special = *PCodePtr++; + special = LONG(*PCodePtr++); SpecArgs[4] = Pop(); SpecArgs[3] = Pop(); SpecArgs[2] = Pop(); @@ -806,8 +807,8 @@ static int CmdLSpec1Direct(void) { int special; - special = *PCodePtr++; - SpecArgs[0] = *PCodePtr++; + special = LONG(*PCodePtr++); + SpecArgs[0] = LONG(*PCodePtr++); P_ExecuteLineSpecial(special, SpecArgs, ACScript->line, ACScript->side, ACScript->activator); return SCRIPT_CONTINUE; @@ -817,9 +818,9 @@ static int CmdLSpec2Direct(void) { int special; - special = *PCodePtr++; - SpecArgs[0] = *PCodePtr++; - SpecArgs[1] = *PCodePtr++; + special = LONG(*PCodePtr++); + SpecArgs[0] = LONG(*PCodePtr++); + SpecArgs[1] = LONG(*PCodePtr++); P_ExecuteLineSpecial(special, SpecArgs, ACScript->line, ACScript->side, ACScript->activator); return SCRIPT_CONTINUE; @@ -829,10 +830,10 @@ static int CmdLSpec3Direct(void) { int special; - special = *PCodePtr++; - SpecArgs[0] = *PCodePtr++; - SpecArgs[1] = *PCodePtr++; - SpecArgs[2] = *PCodePtr++; + special = LONG(*PCodePtr++); + SpecArgs[0] = LONG(*PCodePtr++); + SpecArgs[1] = LONG(*PCodePtr++); + SpecArgs[2] = LONG(*PCodePtr++); P_ExecuteLineSpecial(special, SpecArgs, ACScript->line, ACScript->side, ACScript->activator); return SCRIPT_CONTINUE; @@ -842,11 +843,11 @@ static int CmdLSpec4Direct(void) { int special; - special = *PCodePtr++; - SpecArgs[0] = *PCodePtr++; - SpecArgs[1] = *PCodePtr++; - SpecArgs[2] = *PCodePtr++; - SpecArgs[3] = *PCodePtr++; + special = LONG(*PCodePtr++); + SpecArgs[0] = LONG(*PCodePtr++); + SpecArgs[1] = LONG(*PCodePtr++); + SpecArgs[2] = LONG(*PCodePtr++); + SpecArgs[3] = LONG(*PCodePtr++); P_ExecuteLineSpecial(special, SpecArgs, ACScript->line, ACScript->side, ACScript->activator); return SCRIPT_CONTINUE; @@ -856,12 +857,12 @@ static int CmdLSpec5Direct(void) { int special; - special = *PCodePtr++; - SpecArgs[0] = *PCodePtr++; - SpecArgs[1] = *PCodePtr++; - SpecArgs[2] = *PCodePtr++; - SpecArgs[3] = *PCodePtr++; - SpecArgs[4] = *PCodePtr++; + special = LONG(*PCodePtr++); + SpecArgs[0] = LONG(*PCodePtr++); + SpecArgs[1] = LONG(*PCodePtr++); + SpecArgs[2] = LONG(*PCodePtr++); + SpecArgs[3] = LONG(*PCodePtr++); + SpecArgs[4] = LONG(*PCodePtr++); P_ExecuteLineSpecial(special, SpecArgs, ACScript->line, ACScript->side, ACScript->activator); return SCRIPT_CONTINUE; @@ -956,169 +957,169 @@ static int CmdGE(void) static int CmdAssignScriptVar(void) { - ACScript->vars[*PCodePtr++] = Pop(); + ACScript->vars[LONG(*PCodePtr++)] = Pop(); return SCRIPT_CONTINUE; } static int CmdAssignMapVar(void) { - MapVars[*PCodePtr++] = Pop(); + MapVars[LONG(*PCodePtr++)] = Pop(); return SCRIPT_CONTINUE; } static int CmdAssignWorldVar(void) { - WorldVars[*PCodePtr++] = Pop(); + WorldVars[LONG(*PCodePtr++)] = Pop(); return SCRIPT_CONTINUE; } static int CmdPushScriptVar(void) { - Push(ACScript->vars[*PCodePtr++]); + Push(ACScript->vars[LONG(*PCodePtr++)]); return SCRIPT_CONTINUE; } static int CmdPushMapVar(void) { - Push(MapVars[*PCodePtr++]); + Push(MapVars[LONG(*PCodePtr++)]); return SCRIPT_CONTINUE; } static int CmdPushWorldVar(void) { - Push(WorldVars[*PCodePtr++]); + Push(WorldVars[LONG(*PCodePtr++)]); return SCRIPT_CONTINUE; } static int CmdAddScriptVar(void) { - ACScript->vars[*PCodePtr++] += Pop(); + ACScript->vars[LONG(*PCodePtr++)] += Pop(); return SCRIPT_CONTINUE; } static int CmdAddMapVar(void) { - MapVars[*PCodePtr++] += Pop(); + MapVars[LONG(*PCodePtr++)] += Pop(); return SCRIPT_CONTINUE; } static int CmdAddWorldVar(void) { - WorldVars[*PCodePtr++] += Pop(); + WorldVars[LONG(*PCodePtr++)] += Pop(); return SCRIPT_CONTINUE; } static int CmdSubScriptVar(void) { - ACScript->vars[*PCodePtr++] -= Pop(); + ACScript->vars[LONG(*PCodePtr++)] -= Pop(); return SCRIPT_CONTINUE; } static int CmdSubMapVar(void) { - MapVars[*PCodePtr++] -= Pop(); + MapVars[LONG(*PCodePtr++)] -= Pop(); return SCRIPT_CONTINUE; } static int CmdSubWorldVar(void) { - WorldVars[*PCodePtr++] -= Pop(); + WorldVars[LONG(*PCodePtr++)] -= Pop(); return SCRIPT_CONTINUE; } static int CmdMulScriptVar(void) { - ACScript->vars[*PCodePtr++] *= Pop(); + ACScript->vars[LONG(*PCodePtr++)] *= Pop(); return SCRIPT_CONTINUE; } static int CmdMulMapVar(void) { - MapVars[*PCodePtr++] *= Pop(); + MapVars[LONG(*PCodePtr++)] *= Pop(); return SCRIPT_CONTINUE; } static int CmdMulWorldVar(void) { - WorldVars[*PCodePtr++] *= Pop(); + WorldVars[LONG(*PCodePtr++)] *= Pop(); return SCRIPT_CONTINUE; } static int CmdDivScriptVar(void) { - ACScript->vars[*PCodePtr++] /= Pop(); + ACScript->vars[LONG(*PCodePtr++)] /= Pop(); return SCRIPT_CONTINUE; } static int CmdDivMapVar(void) { - MapVars[*PCodePtr++] /= Pop(); + MapVars[LONG(*PCodePtr++)] /= Pop(); return SCRIPT_CONTINUE; } static int CmdDivWorldVar(void) { - WorldVars[*PCodePtr++] /= Pop(); + WorldVars[LONG(*PCodePtr++)] /= Pop(); return SCRIPT_CONTINUE; } static int CmdModScriptVar(void) { - ACScript->vars[*PCodePtr++] %= Pop(); + ACScript->vars[LONG(*PCodePtr++)] %= Pop(); return SCRIPT_CONTINUE; } static int CmdModMapVar(void) { - MapVars[*PCodePtr++] %= Pop(); + MapVars[LONG(*PCodePtr++)] %= Pop(); return SCRIPT_CONTINUE; } static int CmdModWorldVar(void) { - WorldVars[*PCodePtr++] %= Pop(); + WorldVars[LONG(*PCodePtr++)] %= Pop(); return SCRIPT_CONTINUE; } static int CmdIncScriptVar(void) { - ACScript->vars[*PCodePtr++]++; + ACScript->vars[LONG(*PCodePtr++)]++; return SCRIPT_CONTINUE; } static int CmdIncMapVar(void) { - MapVars[*PCodePtr++]++; + MapVars[LONG(*PCodePtr++)]++; return SCRIPT_CONTINUE; } static int CmdIncWorldVar(void) { - WorldVars[*PCodePtr++]++; + WorldVars[LONG(*PCodePtr++)]++; return SCRIPT_CONTINUE; } static int CmdDecScriptVar(void) { - ACScript->vars[*PCodePtr++]--; + ACScript->vars[LONG(*PCodePtr++)]--; return SCRIPT_CONTINUE; } static int CmdDecMapVar(void) { - MapVars[*PCodePtr++]--; + MapVars[LONG(*PCodePtr++)]--; return SCRIPT_CONTINUE; } static int CmdDecWorldVar(void) { - WorldVars[*PCodePtr++]--; + WorldVars[LONG(*PCodePtr++)]--; return SCRIPT_CONTINUE; } static int CmdGoto(void) { - PCodePtr = (int *) (ActionCodeBase + *PCodePtr); + PCodePtr = (int *) (ActionCodeBase + LONG(*PCodePtr)); return SCRIPT_CONTINUE; } @@ -1126,7 +1127,7 @@ static int CmdIfGoto(void) { if(Pop()) { - PCodePtr = (int *) (ActionCodeBase + *PCodePtr); + PCodePtr = (int *) (ActionCodeBase + LONG(*PCodePtr)); } else { @@ -1149,7 +1150,7 @@ static int CmdDelay(void) static int CmdDelayDirect(void) { - ACScript->delayCount = *PCodePtr++; + ACScript->delayCount = LONG(*PCodePtr++); return SCRIPT_STOP; } @@ -1169,8 +1170,8 @@ static int CmdRandomDirect(void) int low; int high; - low = *PCodePtr++; - high = *PCodePtr++; + low = LONG(*PCodePtr++); + high = LONG(*PCodePtr++); Push(low + (P_Random() % (high - low + 1))); return SCRIPT_CONTINUE; } @@ -1188,8 +1189,8 @@ static int CmdThingCountDirect(void) { int type; - type = *PCodePtr++; - ThingCount(type, *PCodePtr++); + type = LONG(*PCodePtr++); + ThingCount(type, LONG(*PCodePtr++)); return SCRIPT_CONTINUE; } @@ -1259,7 +1260,7 @@ static int CmdTagWait(void) static int CmdTagWaitDirect(void) { - ACSInfo[ACScript->infoIndex].waitValue = *PCodePtr++; + ACSInfo[ACScript->infoIndex].waitValue = LONG(*PCodePtr++); ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORTAG; return SCRIPT_STOP; } @@ -1273,7 +1274,7 @@ static int CmdPolyWait(void) static int CmdPolyWaitDirect(void) { - ACSInfo[ACScript->infoIndex].waitValue = *PCodePtr++; + ACSInfo[ACScript->infoIndex].waitValue = LONG(*PCodePtr++); ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORPOLY; return SCRIPT_STOP; } @@ -1300,8 +1301,8 @@ static int CmdChangeFloorDirect(void) int flat; int sectorIndex; - tag = *PCodePtr++; - flat = R_FlatNumForName(ACStrings[*PCodePtr++]); + tag = LONG(*PCodePtr++); + flat = R_FlatNumForName(ACStrings[LONG(*PCodePtr++)]); sectorIndex = -1; while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) { @@ -1332,8 +1333,8 @@ static int CmdChangeCeilingDirect(void) int flat; int sectorIndex; - tag = *PCodePtr++; - flat = R_FlatNumForName(ACStrings[*PCodePtr++]); + tag = LONG(*PCodePtr++); + flat = R_FlatNumForName(ACStrings[LONG(*PCodePtr++)]); sectorIndex = -1; while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) { @@ -1416,7 +1417,7 @@ static int CmdIfNotGoto(void) } else { - PCodePtr = (int *) (ActionCodeBase + *PCodePtr); + PCodePtr = (int *) (ActionCodeBase + LONG(*PCodePtr)); } return SCRIPT_CONTINUE; } @@ -1436,7 +1437,7 @@ static int CmdScriptWait(void) static int CmdScriptWaitDirect(void) { - ACSInfo[ACScript->infoIndex].waitValue = *PCodePtr++; + ACSInfo[ACScript->infoIndex].waitValue = LONG(*PCodePtr++); ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORSCRIPT; return SCRIPT_STOP; } @@ -1452,9 +1453,9 @@ static int CmdClearLineSpecial(void) static int CmdCaseGoto(void) { - if(Top() == *PCodePtr++) + if(Top() == LONG(*PCodePtr++)) { - PCodePtr = (int *) (ActionCodeBase + *PCodePtr); + PCodePtr = (int *) (ActionCodeBase + LONG(*PCodePtr)); Drop(); } else diff --git a/doomsday/Src/jHexen/P_setup.c b/doomsday/Src/jHexen/P_setup.c index e110ee991d..d96c5f872a 100644 --- a/doomsday/Src/jHexen/P_setup.c +++ b/doomsday/Src/jHexen/P_setup.c @@ -185,11 +185,8 @@ void P_LoadVertexes(int lump, int gllump) } // There are additional vertices in gllump. numvertexes += - (W_LumpLength(gllump) - (ver == 2 ? 4 : 0)) / (ver == - 1 ? - sizeof(mapvertex_t) - : - sizeof(glvert2_t)); + (W_LumpLength(gllump) - (ver == 2 ? 4 : 0)) / + (ver == 1 ? sizeof(mapvertex_t) : sizeof(glvert2_t)); } vertexes = Z_Malloc(numvertexes * sizeof(vertex_t), PU_LEVEL, 0); data = W_CacheLumpNum(lump, PU_STATIC); @@ -217,8 +214,8 @@ void P_LoadVertexes(int lump, int gllump) } else { - li->x = glv->x; - li->y = glv->y; + li->x = LONG(glv->x); + li->y = LONG(glv->y); } } Z_Free(glverts); @@ -294,20 +291,21 @@ void P_LoadSegsGL(int lump) for(i = 0; i < numsegs; i++, li++, gls++) { li->v1 = - &vertexes[gls->v1 & 0x8000 ? firstGLvertex + - (gls->v1 & ~0x8000) : gls->v1]; + &vertexes[USHORT(gls->v1) & 0x8000 ? firstGLvertex + + (USHORT(gls->v1) & ~0x8000) : USHORT(gls->v1)]; li->v2 = - &vertexes[gls->v2 & 0x8000 ? firstGLvertex + - (gls->v2 & ~0x8000) : gls->v2]; + &vertexes[USHORT(gls->v2) & 0x8000 ? firstGLvertex + + (USHORT(gls->v2) & ~0x8000) : USHORT(gls->v2)]; //Con_Message( "seg %i: linedef %i\n", i, gls->linedef); - if(gls->linedef != -1) + if(USHORT(gls->linedef) != USHORT(-1)) { - ldef = &lines[gls->linedef]; + ldef = &lines[USHORT(gls->linedef)]; li->linedef = ldef; - li->sidedef = &sides[ldef->sidenum[gls->side]]; - li->frontsector = sides[ldef->sidenum[gls->side]].sector; + li->sidedef = &sides[ldef->sidenum[USHORT(gls->side)]]; + li->frontsector = sides[ldef->sidenum[USHORT(gls->side)]].sector; if(ldef->flags & ML_TWOSIDED) - li->backsector = sides[ldef->sidenum[gls->side ^ 1]].sector; + li->backsector = sides[ldef->sidenum + [USHORT(gls->side) ^ 1]].sector; else li->backsector = 0; if(gls->side == 0) @@ -377,8 +375,8 @@ void P_LoadSubsectors(int lump) ss = subsectors; for(i = 0; i < numsubsectors; i++, ss++, ms++) { - ss->linecount = ms->numSegs; - ss->firstline = ms->firstseg; + ss->linecount = USHORT(ms->numSegs); + ss->firstline = USHORT(ms->firstseg); } Z_Free(data); diff --git a/doomsday/Src/jHexen/Po_man.c b/doomsday/Src/jHexen/Po_man.c index 77c9ab0d3b..83b89efeff 100644 --- a/doomsday/Src/jHexen/Po_man.c +++ b/doomsday/Src/jHexen/Po_man.c @@ -1458,6 +1458,7 @@ void PO_Init(int lump) mapthing_t *mt; int numthings; int polyIndex; + short x, y, angle, type; // ThrustMobj will handle polyobj <-> mobj interaction. PO_SetCallback(ThrustMobj); @@ -1475,18 +1476,19 @@ void PO_Init(int lump) // Find the startSpot points, and spawn each polyobj for(i = 0; i < numthings; i++, mt++) { - mt->x = SHORT(mt->x); - mt->y = SHORT(mt->y); - mt->angle = SHORT(mt->angle); - mt->type = SHORT(mt->type); + x = SHORT(mt->x); + y = SHORT(mt->y); + angle = SHORT(mt->angle); + type = SHORT(mt->type); // 3001 = no crush, 3002 = crushing - if(mt->type == PO_SPAWN_TYPE || mt->type == PO_SPAWNCRUSH_TYPE) + if(type == PO_SPAWN_TYPE || + type == PO_SPAWNCRUSH_TYPE) { // Polyobj StartSpot Pt. - polyobjs[polyIndex].startSpot.x = mt->x << FRACBITS; - polyobjs[polyIndex].startSpot.y = mt->y << FRACBITS; - SpawnPolyobj(polyIndex, mt->angle, - (mt->type == PO_SPAWNCRUSH_TYPE)); + polyobjs[polyIndex].startSpot.x = x << FRACBITS; + polyobjs[polyIndex].startSpot.y = y << FRACBITS; + SpawnPolyobj(polyIndex, angle, + (type == PO_SPAWNCRUSH_TYPE)); polyIndex++; } } @@ -1494,14 +1496,14 @@ void PO_Init(int lump) mt = (mapthing_t *) data; for(i = 0; i < numthings; i++, mt++) { - mt->x = SHORT(mt->x); - mt->y = SHORT(mt->y); - mt->angle = SHORT(mt->angle); - mt->type = SHORT(mt->type); - if(mt->type == PO_ANCHOR_TYPE) + x = SHORT(mt->x); + y = SHORT(mt->y); + angle = SHORT(mt->angle); + type = SHORT(mt->type); + + if(type == PO_ANCHOR_TYPE) { // Polyobj Anchor Pt. - TranslateToStartSpot(mt->angle, mt->x << FRACBITS, - mt->y << FRACBITS); + TranslateToStartSpot(angle, x << FRACBITS, y << FRACBITS); } } Z_Free(data);