ref: 59d5f4e54e320dafddb2ad38493a23f7f7fc054c
parent: b0585fa6ecdfb58250b0dc15bfbf830b3e4c52d5
parent: 3dd823caaba8ba1a7d5a3271416b5b6f30b266cf
author: Simon Howard <[email protected]>
date: Fri Dec 25 08:36:22 EST 2015
Merge branch 'master' of github.com:chocolate-doom/chocolate-doom
--- a/src/doom/am_map.c
+++ b/src/doom/am_map.c
@@ -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 @@
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;
@@ -833,7 +833,7 @@
//
void AM_clearFB(int color)
{
- memset(fb, color, f_w*f_h);
+ memset(fb, color, f_w*f_h*sizeof(*fb));
}
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -217,12 +217,12 @@
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 @@
}
// 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;
--- a/src/doom/f_finale.c
+++ b/src/doom/f_finale.c
@@ -512,7 +512,7 @@
}
// draw it
- cx = 160-width/2;
+ cx = SCREENWIDTH/2-width/2;
ch = text;
while (ch)
{
@@ -559,9 +559,9 @@
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 @@
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)
--- a/src/doom/f_wipe.c
+++ b/src/doom/f_wipe.c
@@ -49,13 +49,13 @@
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);
@@ -67,7 +67,7 @@
int height,
int ticks )
{
- memcpy(wipe_scr, wipe_scr_start, width*height);
+ memcpy(wipe_scr, wipe_scr_start, width*height*sizeof(*wipe_scr));
return 0;
}
@@ -138,7 +138,7 @@
int i, r;
// copy start screen to main screen
- memcpy(wipe_scr, wipe_scr_start, width*height);
+ memcpy(wipe_scr, wipe_scr_start, width*height*sizeof(*wipe_scr));
// makes this wipe faster (in theory)
// to have stuff in column-major format
@@ -234,7 +234,7 @@
int width,
int height )
{
- wipe_scr_start = Z_Malloc(SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL);
+ wipe_scr_start = Z_Malloc(SCREENWIDTH * SCREENHEIGHT * sizeof(*wipe_scr_start), PU_STATIC, NULL);
I_ReadScreen(wipe_scr_start);
return 0;
}
@@ -246,7 +246,7 @@
int width,
int height )
{
- wipe_scr_end = Z_Malloc(SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL);
+ wipe_scr_end = Z_Malloc(SCREENWIDTH * SCREENHEIGHT * sizeof(*wipe_scr_end), PU_STATIC, NULL);
I_ReadScreen(wipe_scr_end);
V_DrawBlock(x, y, width, height, wipe_scr_start); // restore start scr.
return 0;
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -1962,7 +1962,7 @@
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 @@
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);
}
--- a/src/doom/p_enemy.c
+++ b/src/doom/p_enemy.c
@@ -212,7 +212,7 @@
if (!actor->info->meleestate)
dist -= 128*FRACUNIT; // no melee attack, so fire more
- dist >>= 16;
+ dist >>= FRACBITS;
if (actor->type == MT_VILE)
{
--- a/src/doom/p_map.c
+++ b/src/doom/p_map.c
@@ -1083,8 +1083,8 @@
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;
--- a/src/doom/p_pspr.c
+++ b/src/doom/p_pspr.c
@@ -726,7 +726,7 @@
{
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,
--- a/src/doom/p_setup.c
+++ b/src/doom/p_setup.c
@@ -192,8 +192,8 @@
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;
--- a/src/doom/p_user.c
+++ b/src/doom/p_user.c
@@ -144,7 +144,7 @@
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.
--- a/src/doom/r_draw.c
+++ b/src/doom/r_draw.c
@@ -843,7 +843,7 @@
if (background_buffer == NULL)
{
- background_buffer = Z_Malloc(SCREENWIDTH * (SCREENHEIGHT - SBARHEIGHT),
+ background_buffer = Z_Malloc(SCREENWIDTH * (SCREENHEIGHT - SBARHEIGHT) * sizeof(*background_buffer),
PU_STATIC, NULL);
}
@@ -928,7 +928,7 @@
if (background_buffer != NULL)
{
- memcpy(I_VideoBuffer + ofs, background_buffer + ofs, count);
+ memcpy(I_VideoBuffer + ofs, background_buffer + ofs, count * sizeof(*I_VideoBuffer));
}
}
--- a/src/doom/r_main.c
+++ b/src/doom/r_main.c
@@ -482,7 +482,7 @@
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 @@
{
fixedcolormap =
colormaps
- + player->fixedcolormap*256*sizeof(lighttable_t);
+ + player->fixedcolormap*256;
walllights = scalelightfixed;
--- a/src/doom/r_segs.c
+++ b/src/doom/r_segs.c
@@ -715,7 +715,7 @@
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 @@
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;
}
--- a/src/doom/r_sky.c
+++ b/src/doom/r_sky.c
@@ -47,6 +47,6 @@
void R_InitSkyMap (void)
{
// skyflatnum = R_FlatNumForName ( SKYFLATNAME );
- skytexturemid = 100*FRACUNIT;
+ skytexturemid = SCREENHEIGHT/2*FRACUNIT;
}
--- a/src/doom/r_things.c
+++ b/src/doom/r_things.c
@@ -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 @@
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;
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -1430,6 +1430,6 @@
void ST_Init (void)
{
ST_loadData();
- st_backing_screen = (byte *) Z_Malloc(ST_WIDTH * ST_HEIGHT, PU_STATIC, 0);
+ st_backing_screen = (byte *) Z_Malloc(ST_WIDTH * ST_HEIGHT * sizeof(*st_backing_screen), PU_STATIC, 0);
}
--- a/src/hexen/h2def.h
+++ b/src/hexen/h2def.h
@@ -58,19 +58,22 @@
#endif
// Past distributions
-#ifndef VER_ID
-#define VER_ID "DVL"
-#endif
+//#ifndef VER_ID
+//#define VER_ID "DVL"
+//#endif
//#define HEXEN_VERSIONTEXT "ID V1.2"
//#define HEXEN_VERSIONTEXT "RETAIL STORE BETA" // 9/26/95
//#define HEXEN_VERSIONTEXT "DVL BETA 10 05 95" // Used for GT for testing
//#define HEXEN_VERSIONTEXT "DVL BETA 10 07 95" // Just an update for Romero
//#define HEXEN_VERSIONTEXT "FINAL 1.0 (10 13 95)" // Just an update for Romero
-#ifdef RANGECHECK
-#define HEXEN_VERSIONTEXT "Version 1.1 +R "__DATE__" ("VER_ID")"
-#else
-#define HEXEN_VERSIONTEXT "Version 1.1 "__DATE__" ("VER_ID")"
-#endif
+//#ifdef RANGECHECK
+//#define HEXEN_VERSIONTEXT "Version 1.1 +R "__DATE__" ("VER_ID")"
+//#else
+//#define HEXEN_VERSIONTEXT "Version 1.1 "__DATE__" ("VER_ID")"
+//#endif
+#define HEXEN_VERSIONTEXT ((gamemode == shareware) ? \
+ "DEMO 10 16 95" : \
+ "VERSION 1.1 MAR 22 1996 (BCP)")
// all exterior data is defined here
#include "xddefs.h"
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1020,7 +1020,7 @@
//
void I_ReadScreen (byte* scr)
{
- memcpy(scr, I_VideoBuffer, SCREENWIDTH*SCREENHEIGHT);
+ memcpy(scr, I_VideoBuffer, SCREENWIDTH*SCREENHEIGHT*sizeof(*scr));
}
--- a/src/m_fixed.c
+++ b/src/m_fixed.c
@@ -54,7 +54,7 @@
{
int64_t result;
- result = ((int64_t) a << 16) / b;
+ result = ((int64_t) a << FRACBITS) / b;
return (fixed_t) result;
}
--- a/src/tables.c
+++ b/src/tables.c
@@ -61,7 +61,7 @@
}
}
-const int finetangent[4096] =
+const fixed_t finetangent[4096] =
{
-170910304,-56965752,-34178904,-24413316,-18988036,-15535599,-13145455,-11392683,
-10052327,-8994149,-8137527,-7429880,-6835455,-6329090,-5892567,-5512368,
@@ -578,7 +578,7 @@
};
-const int finesine[10240] =
+const fixed_t finesine[10240] =
{
25,75,125,175,226,276,326,376,
427,477,527,578,628,678,728,779,
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -110,7 +110,7 @@
for ( ; height>0 ; height--)
{
- memcpy(dest, src, width);
+ memcpy(dest, src, width * sizeof(*dest));
src += SCREENWIDTH;
dest += SCREENWIDTH;
}
@@ -520,7 +520,7 @@
while (height--)
{
- memcpy (dest, src, width);
+ memcpy (dest, src, width * sizeof(*dest));
src += width;
dest += SCREENWIDTH;
}
--- a/textscreen/txt_table.c
+++ b/textscreen/txt_table.c
@@ -149,11 +149,8 @@
unsigned int *row_heights,
unsigned int *w, unsigned int *h)
{
- txt_widget_t *widget;
int cell_w, cell_h;
int x1, y1;
-
- widget = table->widgets[y * table->columns + x];
// Find which cells this widget occupies.
CellOverflowedSize(table, x, y, &cell_w, &cell_h);