Skip to content

Commit

Permalink
Fixed endianness issues
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 21, 2004
1 parent 6fa055e commit 7f06e00
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 148 deletions.
11 changes: 5 additions & 6 deletions doomsday/Src/Common/f_infine.c
Expand Up @@ -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
}

Expand Down
13 changes: 6 additions & 7 deletions doomsday/Src/jHeretic/Mn_menu.c
Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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;
}
}
}
Expand Down Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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);
Expand Down
34 changes: 16 additions & 18 deletions doomsday/Src/jHeretic/P_setup.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions doomsday/Src/jHexen/Mn_menu.c
Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7f06e00

Please sign in to comment.