Merge pull request #640 from chocolate-doom/de-obfuscate
De-obfuscate some numerical constants found in the source code
This commit is contained in:
commit
d368801835
15 changed files with 34 additions and 34 deletions
|
|
@ -99,8 +99,8 @@
|
|||
#define M_ZOOMOUT ((int) (FRACUNIT/1.02))
|
||||
|
||||
// translates between frame-buffer and map distances
|
||||
#define FTOM(x) FixedMul(((x)<<16),scale_ftom)
|
||||
#define MTOF(x) (FixedMul((x),scale_mtof)>>16)
|
||||
#define FTOM(x) FixedMul(((x)<<FRACBITS),scale_ftom)
|
||||
#define MTOF(x) (FixedMul((x),scale_mtof)>>FRACBITS)
|
||||
// translates between frame-buffer and map coordinates
|
||||
#define CXMTOF(x) (f_x + MTOF((x)-m_x))
|
||||
#define CYMTOF(y) (f_y + (f_h - MTOF((y)-m_y)))
|
||||
|
|
@ -199,7 +199,7 @@ static int leveljuststarted = 1; // kluge until AM_LevelInit() is called
|
|||
|
||||
boolean automapactive = false;
|
||||
static int finit_width = SCREENWIDTH;
|
||||
static int finit_height = SCREENHEIGHT - 32;
|
||||
static int finit_height = SCREENHEIGHT - ST_HEIGHT;
|
||||
|
||||
// location of window on screen
|
||||
static int f_x;
|
||||
|
|
|
|||
|
|
@ -217,12 +217,12 @@ void D_Display (void)
|
|||
break;
|
||||
if (automapactive)
|
||||
AM_Drawer ();
|
||||
if (wipe || (viewheight != 200 && fullscreen) || disk_indicator == disk_dirty)
|
||||
if (wipe || (viewheight != SCREENHEIGHT && fullscreen) || disk_indicator == disk_dirty)
|
||||
redrawsbar = true;
|
||||
if (inhelpscreensstate && !inhelpscreens)
|
||||
redrawsbar = true; // just put away the help screen
|
||||
ST_Drawer (viewheight == 200, redrawsbar );
|
||||
fullscreen = viewheight == 200;
|
||||
ST_Drawer (viewheight == SCREENHEIGHT, redrawsbar );
|
||||
fullscreen = viewheight == SCREENHEIGHT;
|
||||
break;
|
||||
|
||||
case GS_INTERMISSION:
|
||||
|
|
@ -260,7 +260,7 @@ void D_Display (void)
|
|||
}
|
||||
|
||||
// see if the border needs to be updated to the screen
|
||||
if (gamestate == GS_LEVEL && !automapactive && scaledviewwidth != 320)
|
||||
if (gamestate == GS_LEVEL && !automapactive && scaledviewwidth != SCREENWIDTH)
|
||||
{
|
||||
if (menuactive || menuactivestate || !viewactivestate)
|
||||
borderdrawcount = 3;
|
||||
|
|
|
|||
|
|
@ -512,7 +512,7 @@ void F_CastPrint (char* text)
|
|||
}
|
||||
|
||||
// draw it
|
||||
cx = 160-width/2;
|
||||
cx = SCREENWIDTH/2-width/2;
|
||||
ch = text;
|
||||
while (ch)
|
||||
{
|
||||
|
|
@ -559,9 +559,9 @@ void F_CastDrawer (void)
|
|||
|
||||
patch = W_CacheLumpNum (lump+firstspritelump, PU_CACHE);
|
||||
if (flip)
|
||||
V_DrawPatchFlipped(160, 170, patch);
|
||||
V_DrawPatchFlipped(SCREENWIDTH/2, 170, patch);
|
||||
else
|
||||
V_DrawPatch(160, 170, patch);
|
||||
V_DrawPatch(SCREENWIDTH/2, 170, patch);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -618,18 +618,18 @@ void F_BunnyScroll (void)
|
|||
|
||||
V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
|
||||
scrolled = (320 - ((signed int) finalecount-230)/2);
|
||||
if (scrolled > 320)
|
||||
scrolled = 320;
|
||||
scrolled = (SCREENWIDTH - ((signed int) finalecount-230)/2);
|
||||
if (scrolled > SCREENWIDTH)
|
||||
scrolled = SCREENWIDTH;
|
||||
if (scrolled < 0)
|
||||
scrolled = 0;
|
||||
|
||||
for ( x=0 ; x<SCREENWIDTH ; x++)
|
||||
{
|
||||
if (x+scrolled < 320)
|
||||
if (x+scrolled < SCREENWIDTH)
|
||||
F_DrawPatchCol (x, p1, x+scrolled);
|
||||
else
|
||||
F_DrawPatchCol (x, p2, x+scrolled - 320);
|
||||
F_DrawPatchCol (x, p2, x+scrolled - SCREENWIDTH);
|
||||
}
|
||||
|
||||
if (finalecount < 1130)
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ wipe_shittyColMajorXform
|
|||
int y;
|
||||
short* dest;
|
||||
|
||||
dest = (short*) Z_Malloc(width*height*2, PU_STATIC, 0);
|
||||
dest = (short*) Z_Malloc(width*height*sizeof(*dest), PU_STATIC, 0);
|
||||
|
||||
for(y=0;y<height;y++)
|
||||
for(x=0;x<width;x++)
|
||||
dest[x*height+y] = array[y*width+x];
|
||||
|
||||
memcpy(array, dest, width*height*2);
|
||||
memcpy(array, dest, width*height*sizeof(*dest));
|
||||
|
||||
Z_Free(dest);
|
||||
|
||||
|
|
|
|||
|
|
@ -1962,7 +1962,7 @@ void M_Drawer (void)
|
|||
if (messageToPrint)
|
||||
{
|
||||
start = 0;
|
||||
y = 100 - M_StringHeight(messageString) / 2;
|
||||
y = SCREENHEIGHT/2 - M_StringHeight(messageString) / 2;
|
||||
while (messageString[start] != '\0')
|
||||
{
|
||||
int foundnewline = 0;
|
||||
|
|
@ -1990,7 +1990,7 @@ void M_Drawer (void)
|
|||
start += strlen(string);
|
||||
}
|
||||
|
||||
x = 160 - M_StringWidth(string) / 2;
|
||||
x = SCREENWIDTH/2 - M_StringWidth(string) / 2;
|
||||
M_WriteText(x, y, string);
|
||||
y += SHORT(hu_font[0]->height);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ boolean P_CheckMissileRange (mobj_t* actor)
|
|||
if (!actor->info->meleestate)
|
||||
dist -= 128*FRACUNIT; // no melee attack, so fire more
|
||||
|
||||
dist >>= 16;
|
||||
dist >>= FRACBITS;
|
||||
|
||||
if (actor->type == MT_VILE)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1083,8 +1083,8 @@ P_AimLineAttack
|
|||
shootz = t1->z + (t1->height>>1) + 8*FRACUNIT;
|
||||
|
||||
// can't shoot outside view angles
|
||||
topslope = 100*FRACUNIT/160;
|
||||
bottomslope = -100*FRACUNIT/160;
|
||||
topslope = (SCREENHEIGHT/2)*FRACUNIT/(SCREENWIDTH/2);
|
||||
bottomslope = -(SCREENHEIGHT/2)*FRACUNIT/(SCREENWIDTH/2);
|
||||
|
||||
attackrange = distance;
|
||||
linetarget = NULL;
|
||||
|
|
|
|||
|
|
@ -726,7 +726,7 @@ A_FireShotgun2
|
|||
{
|
||||
damage = 5*(P_Random ()%3+1);
|
||||
angle = player->mo->angle;
|
||||
angle += (P_Random()-P_Random())<<19;
|
||||
angle += (P_Random()-P_Random())<<ANGLETOFINESHIFT;
|
||||
P_LineAttack (player->mo,
|
||||
angle,
|
||||
MISSILERANGE,
|
||||
|
|
|
|||
|
|
@ -192,8 +192,8 @@ void P_LoadSegs (int lump)
|
|||
li->v1 = &vertexes[SHORT(ml->v1)];
|
||||
li->v2 = &vertexes[SHORT(ml->v2)];
|
||||
|
||||
li->angle = (SHORT(ml->angle))<<16;
|
||||
li->offset = (SHORT(ml->offset))<<16;
|
||||
li->angle = (SHORT(ml->angle))<<FRACBITS;
|
||||
li->offset = (SHORT(ml->offset))<<FRACBITS;
|
||||
linedef = SHORT(ml->linedef);
|
||||
ldef = &lines[linedef];
|
||||
li->linedef = ldef;
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ void P_MovePlayer (player_t* player)
|
|||
|
||||
cmd = &player->cmd;
|
||||
|
||||
player->mo->angle += (cmd->angleturn<<16);
|
||||
player->mo->angle += (cmd->angleturn<<FRACBITS);
|
||||
|
||||
// Do not let the player control movement
|
||||
// if not onground.
|
||||
|
|
|
|||
|
|
@ -482,7 +482,7 @@ fixed_t R_ScaleFromGlobalAngle (angle_t visangle)
|
|||
num = FixedMul(projection,sineb)<<detailshift;
|
||||
den = FixedMul(rw_distance,sinea);
|
||||
|
||||
if (den > num>>16)
|
||||
if (den > num>>FRACBITS)
|
||||
{
|
||||
scale = FixedDiv (num, den);
|
||||
|
||||
|
|
@ -841,7 +841,7 @@ void R_SetupFrame (player_t* player)
|
|||
{
|
||||
fixedcolormap =
|
||||
colormaps
|
||||
+ player->fixedcolormap*256*sizeof(lighttable_t);
|
||||
+ player->fixedcolormap*256;
|
||||
|
||||
walllights = scalelightfixed;
|
||||
|
||||
|
|
|
|||
|
|
@ -715,7 +715,7 @@ R_StoreWallRange
|
|||
if ( ((ds_p->silhouette & SIL_TOP) || maskedtexture)
|
||||
&& !ds_p->sprtopclip)
|
||||
{
|
||||
memcpy (lastopening, ceilingclip+start, 2*(rw_stopx-start));
|
||||
memcpy (lastopening, ceilingclip+start, sizeof(*lastopening)*(rw_stopx-start));
|
||||
ds_p->sprtopclip = lastopening - start;
|
||||
lastopening += rw_stopx - start;
|
||||
}
|
||||
|
|
@ -723,7 +723,7 @@ R_StoreWallRange
|
|||
if ( ((ds_p->silhouette & SIL_BOTTOM) || maskedtexture)
|
||||
&& !ds_p->sprbottomclip)
|
||||
{
|
||||
memcpy (lastopening, floorclip+start, 2*(rw_stopx-start));
|
||||
memcpy (lastopening, floorclip+start, sizeof(*lastopening)*(rw_stopx-start));
|
||||
ds_p->sprbottomclip = lastopening - start;
|
||||
lastopening += rw_stopx - start;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,6 @@ int skytexturemid;
|
|||
void R_InitSkyMap (void)
|
||||
{
|
||||
// skyflatnum = R_FlatNumForName ( SKYFLATNAME );
|
||||
skytexturemid = 100*FRACUNIT;
|
||||
skytexturemid = SCREENHEIGHT/2*FRACUNIT;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
|
||||
#define MINZ (FRACUNIT*4)
|
||||
#define BASEYCENTER 100
|
||||
#define BASEYCENTER (SCREENHEIGHT/2)
|
||||
|
||||
//void R_DrawColumn (void);
|
||||
//void R_DrawFuzzColumn (void);
|
||||
|
|
@ -665,7 +665,7 @@ void R_DrawPSprite (pspdef_t* psp)
|
|||
flip = (boolean)sprframe->flip[0];
|
||||
|
||||
// calculate edges of the shape
|
||||
tx = psp->sx-160*FRACUNIT;
|
||||
tx = psp->sx-(SCREENWIDTH/2)*FRACUNIT;
|
||||
|
||||
tx -= spriteoffset[lump];
|
||||
x1 = (centerxfrac + FixedMul (tx,pspritescale) ) >>FRACBITS;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ fixed_t FixedDiv(fixed_t a, fixed_t b)
|
|||
{
|
||||
int64_t result;
|
||||
|
||||
result = ((int64_t) a << 16) / b;
|
||||
result = ((int64_t) a << FRACBITS) / b;
|
||||
|
||||
return (fixed_t) result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue