Merge branch 'Saturn-Next' into unglobsavep
This commit is contained in:
commit
31370741f2
10 files changed
+455
-494
No files matched your search
+7
-17
@@ -260,25 +260,15 @@ static inline void AM_restoreScaleAndLoc(void)
|
||||
*/
|
||||
static void AM_findMinMaxBoundaries(void)
|
||||
{
|
||||
size_t i;
|
||||
fixed_t a;
|
||||
fixed_t b;
|
||||
fixed_t a, b;
|
||||
|
||||
min_x = min_y = +INT32_MAX;
|
||||
max_x = max_y = -INT32_MAX;
|
||||
min_x = minimapinfo.min_x << MAPBITS;
|
||||
max_x = minimapinfo.max_x << MAPBITS;
|
||||
min_y = minimapinfo.min_y << MAPBITS;
|
||||
max_y = minimapinfo.max_y << MAPBITS;
|
||||
|
||||
for (i = 0; i < numvertexes; i++)
|
||||
{
|
||||
if (vertexes[i].x < min_x)
|
||||
min_x = vertexes[i].x;
|
||||
else if (vertexes[i].x > max_x)
|
||||
max_x = vertexes[i].x;
|
||||
|
||||
if (vertexes[i].y < min_y)
|
||||
min_y = vertexes[i].y;
|
||||
else if (vertexes[i].y > max_y)
|
||||
max_y = vertexes[i].y;
|
||||
}
|
||||
max_w = minimapinfo.map_w << MAPBITS;
|
||||
max_h = minimapinfo.map_h << MAPBITS;
|
||||
|
||||
max_w = (max_x >>= FRACTOMAPBITS) - (min_x >>= FRACTOMAPBITS);
|
||||
max_h = (max_y >>= FRACTOMAPBITS) - (min_y >>= FRACTOMAPBITS);
|
||||
|
||||
+5
-2
@@ -5793,9 +5793,12 @@ static void GetPackets(void)
|
||||
{
|
||||
node = (SINT8)doomcom->remotenode;
|
||||
|
||||
if (netbuffer->packettype == PT_CLIENTJOIN && server && !levelloading)
|
||||
if (netbuffer->packettype == PT_CLIENTJOIN && server)
|
||||
{
|
||||
HandleConnect(node);
|
||||
if (!levelloading) // Otherwise just ignore
|
||||
{
|
||||
HandleConnect(node);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (node == servernode && client && cl_mode != CL_SEARCHING)
|
||||
|
||||
@@ -1677,6 +1677,10 @@ void D_SRB2Main(void)
|
||||
#undef PUSHSPEEDO
|
||||
memcpy(speedo_cons_t, speedo_cons_temp, sizeof(speedo_cons_t));
|
||||
|
||||
// Do it before P_InitMapData because PNG patch
|
||||
// conversion sometimes needs the palette
|
||||
V_ReloadPalette();
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
|
||||
+2
-2
@@ -537,11 +537,11 @@ consvar_t cv_nametagscore = {"kartnametagscore", "Off", CV_SAVE, CV_OnOff, NULL,
|
||||
consvar_t cv_shownametagfinish = {"kartshownametagfinished", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shownametagspectator = {"kartshownametagspectator", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
||||
static CV_PossibleValue_t driftgaugeoffset_cons_t[] = {
|
||||
{-FRACUNIT*128, "MIN"}, {FRACUNIT*128, "MAX"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t driftgaugestyle_cons_t[] = {
|
||||
{1, "Default"}, {2, "Small"}, {3, "Big Numbers"}, {4, "Numbers Only"}, {0, NULL}};
|
||||
{1, "Default"}, {2, "Small"}, {3, "Big Numbers"}, {4, "Numbers Only"}, {5, "Extra"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_driftgauge = {"kartdriftgauge", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftgaugeofs = {"kartdriftgaugeoffset", "-20", CV_FLOAT|CV_SAVE, driftgaugeoffset_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
+40
-73
@@ -8874,7 +8874,7 @@ static void K_drawKartSpeedometer(void)
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
V_DrawStretchyFixedPatch((SPDM_X-1)<<FRACBITS, (SPDM_Y + 5)<<FRACBITS, FRACUNIT*0.765, FRACUNIT*0.55, (V_HUDTRANS|splitflags), (skp_smallstickerclr3), colormap);
|
||||
}
|
||||
}
|
||||
else
|
||||
V_DrawStretchyFixedPatch((SPDM_X-1)<<FRACBITS, (SPDM_Y + 5)<<FRACBITS, FRACUNIT*0.765, FRACUNIT*0.55, (V_HUDTRANS|splitflags), (skp_smallsticker3), NULL);
|
||||
|
||||
@@ -9401,9 +9401,10 @@ skipcrap:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 5:
|
||||
if (driftgaugegfx)
|
||||
{
|
||||
if (cv_driftgaugestyle.value == 1 || cv_driftgaugestyle.value == 3)
|
||||
if (cv_driftgaugestyle.value == 1 || cv_driftgaugestyle.value == 3 || (cv_driftgaugestyle.value == 5 && xtra_speedo3))
|
||||
{
|
||||
barx = basex - dup*23;
|
||||
BAR_WIDTH = dup*47;
|
||||
@@ -9421,12 +9422,25 @@ skipcrap:
|
||||
INT32 level = min(driftcharge / driftval, 2);
|
||||
UINT8 *cmap;
|
||||
|
||||
if (!K_UseColorHud())
|
||||
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmall : driftgauge, NULL);
|
||||
else //Colourized hud
|
||||
if (cv_driftgaugestyle.value == 5 && xtra_speedo3) // why bother if we dont?
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmallcolor : driftgaugecolor, colormap);
|
||||
if (K_UseColorHud() && xtra_speedo_clr3) //Colourized hud
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
V_DrawStretchyFixedPatch((basex-300)<<FRACBITS, (basey-20)<<FRACBITS, FRACUNIT*0.765, FRACUNIT*0.55, V_NOSCALESTART|V_OFFSET|drifttrans, skp_smallstickerclr3, colormap);
|
||||
}
|
||||
else
|
||||
V_DrawStretchyFixedPatch((basex-300)<<FRACBITS, (basey-20)<<FRACBITS, FRACUNIT*0.765, FRACUNIT*0.55, V_NOSCALESTART|V_OFFSET|drifttrans, skp_smallsticker3, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!K_UseColorHud())
|
||||
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmall : driftgauge, NULL);
|
||||
else //Colourized hud
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmallcolor : driftgaugecolor, colormap);
|
||||
}
|
||||
}
|
||||
|
||||
if (driftcharge >= driftval*4) // rainbow sparks
|
||||
@@ -9622,7 +9636,7 @@ static void K_drawKartPlayerCheck(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, patch_t *AutomapPic)
|
||||
static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
|
||||
{
|
||||
// amnum xpos & ypos are the icon's speed around the HUD.
|
||||
// The number being divided by is for how fast it moves.
|
||||
@@ -9637,60 +9651,17 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
|
||||
fixed_t amnumxpos, amnumypos;
|
||||
INT32 amxpos, amypos;
|
||||
|
||||
node_t *bsp = &nodes[numnodes-1];
|
||||
fixed_t maxx, minx, maxy, miny;
|
||||
|
||||
fixed_t mapwidth, mapheight;
|
||||
fixed_t xoffset, yoffset;
|
||||
fixed_t xscale, yscale, zoom;
|
||||
|
||||
if (mo->skin)
|
||||
skin = ((skin_t*)((mo->localskin) ? mo->localskin : mo->skin))-((skinlocal) ? localskins : skins);
|
||||
skin = ((skin_t*)(mo->localskin ? mo->localskin : mo->skin))-(skinlocal ? localskins : skins);
|
||||
|
||||
maxx = maxy = INT32_MAX;
|
||||
minx = miny = INT32_MIN;
|
||||
minx = bsp->bbox[0][BOXLEFT];
|
||||
maxx = bsp->bbox[0][BOXRIGHT];
|
||||
miny = bsp->bbox[0][BOXBOTTOM];
|
||||
maxy = bsp->bbox[0][BOXTOP];
|
||||
|
||||
if (bsp->bbox[1][BOXLEFT] < minx)
|
||||
minx = bsp->bbox[1][BOXLEFT];
|
||||
if (bsp->bbox[1][BOXRIGHT] > maxx)
|
||||
maxx = bsp->bbox[1][BOXRIGHT];
|
||||
if (bsp->bbox[1][BOXBOTTOM] < miny)
|
||||
miny = bsp->bbox[1][BOXBOTTOM];
|
||||
if (bsp->bbox[1][BOXTOP] > maxy)
|
||||
maxy = bsp->bbox[1][BOXTOP];
|
||||
|
||||
// You might be wondering why these are being bitshift here
|
||||
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
|
||||
// map boundaries and sizes will ALWAYS be whole numbers thankfully
|
||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
||||
minx >>= FRACBITS;
|
||||
maxx >>= FRACBITS;
|
||||
miny >>= FRACBITS;
|
||||
maxy >>= FRACBITS;
|
||||
|
||||
mapwidth = maxx - minx;
|
||||
mapheight = maxy - miny;
|
||||
|
||||
// These should always be small enough to be bitshift back right now
|
||||
xoffset = (minx + mapwidth/2)<<FRACBITS;
|
||||
yoffset = (miny + mapheight/2)<<FRACBITS;
|
||||
|
||||
xscale = FixedDiv(AutomapPic->width, mapwidth);
|
||||
yscale = FixedDiv(AutomapPic->height, mapheight);
|
||||
zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20);
|
||||
|
||||
amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), zoom) - FixedMul(xoffset, zoom));
|
||||
amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), zoom) - FixedMul(yoffset, zoom));
|
||||
amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), minimapinfo.zoom) - minimapinfo.offs_x);
|
||||
amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), minimapinfo.zoom) - minimapinfo.offs_y);
|
||||
|
||||
if (encoremode)
|
||||
amnumxpos = -amnumxpos;
|
||||
|
||||
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin]->width/2))<<FRACBITS);
|
||||
amypos = amnumypos + ((y + AutomapPic->height/2 - (((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin]->height/2))<<FRACBITS);
|
||||
amxpos = amnumxpos + ((x + (SHORT(minimapinfo.minimap_pic->width)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->width))/2)<<FRACBITS);
|
||||
amypos = amnumypos + ((y + (SHORT(minimapinfo.minimap_pic->height)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->height))/2)<<FRACBITS);
|
||||
|
||||
if (!mo->color) // 'default' color
|
||||
V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT);
|
||||
@@ -9728,8 +9699,6 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
|
||||
|
||||
static void K_drawKartMinimap(void)
|
||||
{
|
||||
INT32 lumpnum;
|
||||
patch_t *AutomapPic;
|
||||
INT32 i = 0;
|
||||
INT32 x, y;
|
||||
INT32 minimaptrans, splitflags;
|
||||
@@ -9744,17 +9713,15 @@ static void K_drawKartMinimap(void)
|
||||
if (stplyr != &players[displayplayers[0]])
|
||||
return;
|
||||
|
||||
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
|
||||
|
||||
if (lumpnum != -1)
|
||||
AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_HUDGFX);
|
||||
else
|
||||
if (minimapinfo.minimap_pic == NULL)
|
||||
{
|
||||
return; // no pic, just get outta here
|
||||
}
|
||||
|
||||
drawinfo_t info;
|
||||
K_getMinimapDrawinfo(&info);
|
||||
x = info.x - (AutomapPic->width/2);
|
||||
y = info.y - (AutomapPic->height/2);
|
||||
x = info.x - (SHORT(minimapinfo.minimap_pic->width)/2);
|
||||
y = info.y - (SHORT(minimapinfo.minimap_pic->height)/2);
|
||||
splitflags = info.flags;
|
||||
|
||||
|
||||
@@ -9775,9 +9742,9 @@ static void K_drawKartMinimap(void)
|
||||
splitflags |= minimaptrans;
|
||||
|
||||
if (encoremode)
|
||||
V_DrawScaledPatch(x+(AutomapPic->width), y, splitflags|V_FLIP, AutomapPic);
|
||||
V_DrawScaledPatch(x+SHORT(minimapinfo.minimap_pic->width), y, minimaptrans|V_FLIP, minimapinfo.minimap_pic);
|
||||
else
|
||||
V_DrawScaledPatch(x, y, splitflags, AutomapPic);
|
||||
V_DrawScaledPatch(x, y, splitflags, minimapinfo.minimap_pic);
|
||||
|
||||
if (!(splitscreen == 2))
|
||||
{
|
||||
@@ -9787,10 +9754,10 @@ static void K_drawKartMinimap(void)
|
||||
|
||||
// let offsets transfer to the heads, too!
|
||||
if (encoremode)
|
||||
x += SHORT(AutomapPic->leftoffset);
|
||||
x += SHORT(minimapinfo.minimap_pic->leftoffset);
|
||||
else
|
||||
x -= SHORT(AutomapPic->leftoffset);
|
||||
y -= SHORT(AutomapPic->topoffset);
|
||||
x -= SHORT(minimapinfo.minimap_pic->leftoffset);
|
||||
y -= SHORT(minimapinfo.minimap_pic->topoffset);
|
||||
|
||||
// initialize
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -9802,7 +9769,7 @@ static void K_drawKartMinimap(void)
|
||||
demoghost *g = ghosts;
|
||||
while (g)
|
||||
{
|
||||
K_drawKartMinimapHead(g->mo, x, y, splitflags, AutomapPic);
|
||||
K_drawKartMinimapHead(g->mo, x, y, splitflags);
|
||||
g = g->next;
|
||||
}
|
||||
|
||||
@@ -9843,7 +9810,7 @@ static void K_drawKartMinimap(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
K_drawKartMinimapHead(players[i].mo, x, y, splitflags, AutomapPic);
|
||||
K_drawKartMinimapHead(players[i].mo, x, y, splitflags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9855,7 +9822,7 @@ static void K_drawKartMinimap(void)
|
||||
{
|
||||
if (i == -1)
|
||||
continue; // this doesn't interest us
|
||||
K_drawKartMinimapHead(players[localplayers[i]].mo, x, y, splitflags, AutomapPic);
|
||||
K_drawKartMinimapHead(players[localplayers[i]].mo, x, y, splitflags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -392,6 +392,18 @@ extern fixed_t bmaporgy; // origin of block map
|
||||
extern mobj_t **blocklinks; // for thing chains
|
||||
extern precipmobj_t **precipblocklinks; // special blockmap for precip rendering
|
||||
|
||||
extern struct minimapinfo
|
||||
{
|
||||
patch_t *minimap_pic;
|
||||
UINT8 mapthingcount;
|
||||
INT32 min_x, min_y;
|
||||
INT32 max_x, max_y;
|
||||
INT32 map_w, map_h;
|
||||
INT32 minimap_w, minimap_h;
|
||||
fixed_t offs_x, offs_y;
|
||||
fixed_t zoom;
|
||||
} minimapinfo;
|
||||
|
||||
//
|
||||
// P_INTER
|
||||
//
|
||||
|
||||
+211
-152
@@ -578,6 +578,7 @@ FUNCINLINE static ATTRINLINE void P_LoadRawSubsectors(void *data)
|
||||
|
||||
size_t numlevelflats;
|
||||
levelflat_t *levelflats;
|
||||
levelflat_t *foundflats;
|
||||
|
||||
//SoM: Other files want this info.
|
||||
size_t P_PrecacheLevelFlats(void)
|
||||
@@ -703,18 +704,9 @@ static void P_LoadRawSectors(UINT8 *data)
|
||||
{
|
||||
mapsector_t *ms = (mapsector_t *)data;
|
||||
sector_t *ss = sectors;
|
||||
levelflat_t *foundflats;
|
||||
|
||||
size_t i;
|
||||
|
||||
// Allocate a big chunk of memory as big as our MAXLEVELFLATS limit.
|
||||
//Fab : FIXME: allocate for whatever number of flats - 512 different flats per level should be plenty
|
||||
foundflats = calloc(MAXLEVELFLATS, sizeof (*foundflats));
|
||||
if (foundflats == NULL)
|
||||
I_Error("Ran out of memory while loading sectors\n");
|
||||
|
||||
numlevelflats = 0;
|
||||
|
||||
// For each counted sector, copy the sector raw data from our cache pointer ms, to the global table pointer ss.
|
||||
for (i = 0; i < numsectors; i++, ss++, ms++)
|
||||
{
|
||||
@@ -775,16 +767,6 @@ static void P_LoadRawSectors(UINT8 *data)
|
||||
ss->floorspeed = 0;
|
||||
ss->ceilspeed = 0;
|
||||
}
|
||||
|
||||
// set the sky flat num
|
||||
skyflatnum = P_AddLevelFlat(SKYFLATNAME, foundflats);
|
||||
|
||||
// copy table for global usage
|
||||
levelflats = M_Memcpy(Z_Calloc(numlevelflats * sizeof (*levelflats), PU_LEVEL, NULL), foundflats, numlevelflats * sizeof (levelflat_t));
|
||||
free(foundflats);
|
||||
|
||||
// search for animated flats and set up
|
||||
P_SetupLevelFlatAnims();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1469,7 +1451,6 @@ static void P_LoadRawSideDefs2(void *data)
|
||||
break;
|
||||
}
|
||||
}
|
||||
R_ClearTextureNumCache(true);
|
||||
}
|
||||
|
||||
static boolean LineInBlock(fixed_t cx1, fixed_t cy1, fixed_t cx2, fixed_t cy2, fixed_t bx1, fixed_t by1)
|
||||
@@ -1986,12 +1967,32 @@ static void P_LoadMapData(const virtres_t* virt)
|
||||
lines = Z_Calloc(numlines * sizeof (*lines), PU_LEVEL, NULL);
|
||||
mapthings = Z_Calloc(nummapthings * sizeof (*mapthings), PU_LEVEL, NULL);
|
||||
|
||||
// Allocate a big chunk of memory as big as our MAXLEVELFLATS limit.
|
||||
//Fab : FIXME: allocate for whatever number of flats - 512 different flats per level should be plenty
|
||||
foundflats = calloc(MAXLEVELFLATS, sizeof (*foundflats));
|
||||
if (foundflats == NULL)
|
||||
I_Error("Ran out of memory while loading sectors\n");
|
||||
numlevelflats = 0;
|
||||
|
||||
// Strict map data
|
||||
P_LoadRawVertexes(virtvertexes->data);
|
||||
P_LoadRawSectors(virtsectors->data);
|
||||
P_LoadRawLineDefs(virtlinedefs->data);
|
||||
P_SetupLines();
|
||||
P_LoadRawSideDefs2(virtsidedefs->data);
|
||||
P_PrepareRawThings(virtthings->data);
|
||||
|
||||
R_ClearTextureNumCache(true);
|
||||
|
||||
// set the sky flat num
|
||||
skyflatnum = P_AddLevelFlat(SKYFLATNAME, foundflats);
|
||||
|
||||
// copy table for global usage
|
||||
levelflats = M_Memcpy(Z_Calloc(numlevelflats * sizeof (*levelflats), PU_LEVEL, NULL), foundflats, numlevelflats * sizeof (levelflat_t));
|
||||
free(foundflats);
|
||||
|
||||
// search for animated flats and set up
|
||||
P_SetupLevelFlatAnims();
|
||||
}
|
||||
|
||||
/** Sets up a sky texture to use for the level.
|
||||
@@ -2242,16 +2243,6 @@ static void P_LoadMapFromFile(void)
|
||||
P_PrepareRawThings(vres_Find(curmapvirt, "THINGS")->data);
|
||||
|
||||
P_MakeMapMD5(curmapvirt, &mapmd5);
|
||||
|
||||
// We do the following silly
|
||||
// construction because vres_Free
|
||||
// no-sells deletions of pointers
|
||||
// that are == curmapvirt.
|
||||
{
|
||||
virtres_t *temp = curmapvirt;
|
||||
curmapvirt = NULL;
|
||||
vres_Free(temp);
|
||||
}
|
||||
}
|
||||
|
||||
static void P_RunLevelScript(const char *scriptname)
|
||||
@@ -2487,6 +2478,184 @@ static boolean P_CanSave(void)
|
||||
return false; // SRB2Kart: no SP, no saving.
|
||||
}
|
||||
|
||||
static void P_InitGametype(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
{
|
||||
players[i].pflags &= ~PF_NIGHTSMODE;
|
||||
|
||||
// Start players with pity shields if possible
|
||||
players[i].pity = -1;
|
||||
|
||||
if (!G_RaceGametype())
|
||||
{
|
||||
players[i].mo = NULL;
|
||||
G_DoReborn(i);
|
||||
}
|
||||
else // gametype is GT_COOP or GT_RACE
|
||||
{
|
||||
players[i].mo = NULL;
|
||||
|
||||
if (players[i].starposttime)
|
||||
{
|
||||
G_SpawnPlayer(i, true);
|
||||
}
|
||||
else
|
||||
G_SpawnPlayer(i, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (modeattacking == ATTACKING_RECORD && !demo.playback)
|
||||
P_LoadRecordGhosts();
|
||||
|
||||
if (G_TagGametype())
|
||||
{
|
||||
INT32 realnumplayers = 0;
|
||||
INT32 playersactive[MAXPLAYERS];
|
||||
|
||||
//I just realized how problematic this code can be.
|
||||
//D_NumPlayers() will not always cover the scope of the netgame.
|
||||
//What if one player is node 0 and the other node 31?
|
||||
//The solution? Make a temp array of all players that are currently playing and pick from them.
|
||||
//Future todo? When a player leaves, shift all nodes down so D_NumPlayers() can be used as intended?
|
||||
//Also, you'd never have to loop through all 32 players slots to find anything ever again.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
{
|
||||
playersactive[realnumplayers] = i; //stores the player's node in the array.
|
||||
realnumplayers++;
|
||||
}
|
||||
}
|
||||
|
||||
if (realnumplayers) //this should also fix the dedicated crash bug. You only pick a player if one exists to be picked.
|
||||
{
|
||||
i = P_RandomKey(realnumplayers);
|
||||
players[playersactive[i]].pflags |= PF_TAGIT; //choose our initial tagger before map starts.
|
||||
|
||||
// Taken and modified from G_DoReborn()
|
||||
// Remove the player so he can respawn elsewhere.
|
||||
// first dissasociate the corpse
|
||||
if (players[playersactive[i]].mo)
|
||||
P_RemoveMobj(players[playersactive[i]].mo);
|
||||
|
||||
G_SpawnPlayer(playersactive[i], false); //respawn the lucky player in his dedicated spawn location.
|
||||
}
|
||||
else
|
||||
CONS_Printf(M_GetText("No player currently available to become IT. Awaiting available players.\n"));
|
||||
|
||||
}
|
||||
else if (G_RaceGametype() && server)
|
||||
CV_StealthSetValue(&cv_numlaps,
|
||||
((netgame || multiplayer) && cv_basenumlaps.value
|
||||
&& (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
|
||||
|| (mapheaderinfo[gamemap - 1]->numlaps > cv_basenumlaps.value)))
|
||||
? cv_basenumlaps.value
|
||||
: mapheaderinfo[gamemap - 1]->numlaps);
|
||||
|
||||
// Start recording replay in multiplayer with a temp filename
|
||||
//Ensure dedis only record a replay if there is a player at the start of the map, otherwise we get invalid replays!
|
||||
if (!demo.playback && multiplayer && D_NumPlayers()) {
|
||||
static char buf[256];
|
||||
sprintf(buf, "replay"PATHSEP"online"PATHSEP"%d-%s", (int) (time(NULL)), G_BuildMapName(gamemap));
|
||||
|
||||
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
|
||||
I_mkdir(va("%s"PATHSEP"replay"PATHSEP"online", srb2home), 0755);
|
||||
G_RecordDemo(buf);
|
||||
if (dedicated)
|
||||
G_BeginRecording(); //this has to move here, since dedicated servers dont run got_mapcmd
|
||||
}
|
||||
|
||||
wantedcalcdelay = wantedfrequency*2;
|
||||
indirectitemcooldown = 0;
|
||||
hyubgone = 0;
|
||||
mapreset = 0;
|
||||
nospectategrief = 0;
|
||||
thwompsactive = false;
|
||||
spbplace = -1;
|
||||
|
||||
startedInFreePlay = false;
|
||||
{
|
||||
UINT8 nump = 0;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
nump++;
|
||||
if (nump == 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nump <= 1)
|
||||
{
|
||||
startedInFreePlay = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct minimapinfo minimapinfo;
|
||||
static void P_InitMinimapInfo(void)
|
||||
{
|
||||
INT32 lumpnum;
|
||||
fixed_t a;
|
||||
fixed_t b;
|
||||
node_t *bsp = &nodes[numnodes-1];
|
||||
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
|
||||
|
||||
if (lumpnum != -1)
|
||||
minimapinfo.minimap_pic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_HUDGFX);
|
||||
|
||||
minimapinfo.mapthingcount = 0;
|
||||
// TODO iterate over mapthings to look for possible user-defined bounds
|
||||
minimapinfo.min_x = bsp->bbox[0][BOXLEFT];
|
||||
minimapinfo.max_x = bsp->bbox[0][BOXRIGHT];
|
||||
minimapinfo.min_y = bsp->bbox[0][BOXBOTTOM];
|
||||
minimapinfo.max_y = bsp->bbox[0][BOXTOP];
|
||||
if (bsp->bbox[1][BOXLEFT] < minimapinfo.min_x)
|
||||
minimapinfo.min_x = bsp->bbox[1][BOXLEFT];
|
||||
if (bsp->bbox[1][BOXRIGHT] > minimapinfo.max_x)
|
||||
minimapinfo.max_x = bsp->bbox[1][BOXRIGHT];
|
||||
if (bsp->bbox[1][BOXBOTTOM] < minimapinfo.min_y)
|
||||
minimapinfo.min_y = bsp->bbox[1][BOXBOTTOM];
|
||||
if (bsp->bbox[1][BOXTOP] > minimapinfo.max_y)
|
||||
minimapinfo.max_y = bsp->bbox[1][BOXTOP];
|
||||
// You might be wondering why these are being bitshift here
|
||||
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
|
||||
// map boundaries and sizes will ALWAYS be whole numbers thankfully
|
||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
||||
minimapinfo.map_w = (minimapinfo.max_x >>= FRACBITS) - (minimapinfo.min_x >>= FRACBITS);
|
||||
minimapinfo.map_h = (minimapinfo.max_y >>= FRACBITS) - (minimapinfo.min_y >>= FRACBITS);
|
||||
minimapinfo.minimap_w = minimapinfo.minimap_h = 100;
|
||||
a = FixedDiv(minimapinfo.minimap_w<<FRACBITS, minimapinfo.map_w<<4);
|
||||
b = FixedDiv(minimapinfo.minimap_h<<FRACBITS, minimapinfo.map_h<<4);
|
||||
if (a < b)
|
||||
{
|
||||
minimapinfo.minimap_h = FixedMul(a, minimapinfo.map_h)>>(FRACBITS-4);
|
||||
minimapinfo.zoom = a;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (a != b)
|
||||
{
|
||||
minimapinfo.minimap_w = FixedMul(b, minimapinfo.map_w)>>(FRACBITS-4);
|
||||
}
|
||||
minimapinfo.zoom = b;
|
||||
}
|
||||
minimapinfo.zoom >>= (FRACBITS-4);
|
||||
minimapinfo.zoom -= (minimapinfo.zoom/20);
|
||||
// These should always be small enough to be bitshift back right now
|
||||
minimapinfo.offs_x = FixedMul((minimapinfo.min_x + minimapinfo.map_w/2) << FRACBITS, minimapinfo.zoom);
|
||||
minimapinfo.offs_y = FixedMul((minimapinfo.min_y + minimapinfo.map_h/2) << FRACBITS, minimapinfo.zoom);
|
||||
}
|
||||
|
||||
/** Loads a level from a lump or external wad.
|
||||
*
|
||||
* \param skipprecip If true, don't spawn precipitation.
|
||||
@@ -2738,6 +2907,8 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
|
||||
P_SpawnSecretItems(loademblems);
|
||||
|
||||
P_InitMinimapInfo();
|
||||
|
||||
for (numcoopstarts = 0; numcoopstarts < MAXPLAYERS; numcoopstarts++)
|
||||
if (!playerstarts[numcoopstarts])
|
||||
break;
|
||||
@@ -2765,131 +2936,19 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
// none of this needs to be done because it's not the beginning of the map when
|
||||
// a netgame save is being loaded, and could actively be harmful by messing with
|
||||
// the client's view of the data.)
|
||||
if (fromnetsave)
|
||||
goto netgameskip;
|
||||
// ==========
|
||||
if (!fromnetsave)
|
||||
P_InitGametype();
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
{
|
||||
players[i].pflags &= ~PF_NIGHTSMODE;
|
||||
|
||||
// Start players with pity shields if possible
|
||||
players[i].pity = -1;
|
||||
|
||||
if (!G_RaceGametype())
|
||||
{
|
||||
players[i].mo = NULL;
|
||||
G_DoReborn(i);
|
||||
}
|
||||
else // gametype is GT_COOP or GT_RACE
|
||||
{
|
||||
players[i].mo = NULL;
|
||||
|
||||
if (players[i].starposttime)
|
||||
{
|
||||
G_SpawnPlayer(i, true);
|
||||
}
|
||||
else
|
||||
G_SpawnPlayer(i, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (modeattacking == ATTACKING_RECORD && !demo.playback)
|
||||
P_LoadRecordGhosts();
|
||||
|
||||
if (G_TagGametype())
|
||||
// Now safe to free.
|
||||
// We do the following silly
|
||||
// construction because vres_Free
|
||||
// no-sells deletions of pointers
|
||||
// that are == curmapvirt.
|
||||
{
|
||||
INT32 realnumplayers = 0;
|
||||
INT32 playersactive[MAXPLAYERS];
|
||||
|
||||
//I just realized how problematic this code can be.
|
||||
//D_NumPlayers() will not always cover the scope of the netgame.
|
||||
//What if one player is node 0 and the other node 31?
|
||||
//The solution? Make a temp array of all players that are currently playing and pick from them.
|
||||
//Future todo? When a player leaves, shift all nodes down so D_NumPlayers() can be used as intended?
|
||||
//Also, you'd never have to loop through all 32 players slots to find anything ever again.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
{
|
||||
playersactive[realnumplayers] = i; //stores the player's node in the array.
|
||||
realnumplayers++;
|
||||
}
|
||||
}
|
||||
|
||||
if (realnumplayers) //this should also fix the dedicated crash bug. You only pick a player if one exists to be picked.
|
||||
{
|
||||
i = P_RandomKey(realnumplayers);
|
||||
players[playersactive[i]].pflags |= PF_TAGIT; //choose our initial tagger before map starts.
|
||||
|
||||
// Taken and modified from G_DoReborn()
|
||||
// Remove the player so he can respawn elsewhere.
|
||||
// first dissasociate the corpse
|
||||
if (players[playersactive[i]].mo)
|
||||
P_RemoveMobj(players[playersactive[i]].mo);
|
||||
|
||||
G_SpawnPlayer(playersactive[i], false); //respawn the lucky player in his dedicated spawn location.
|
||||
}
|
||||
else
|
||||
CONS_Printf(M_GetText("No player currently available to become IT. Awaiting available players.\n"));
|
||||
|
||||
virtres_t *temp = curmapvirt;
|
||||
curmapvirt = NULL;
|
||||
vres_Free(temp);
|
||||
}
|
||||
else if (G_RaceGametype() && server)
|
||||
CV_StealthSetValue(&cv_numlaps,
|
||||
((netgame || multiplayer) && cv_basenumlaps.value
|
||||
&& (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
|
||||
|| (mapheaderinfo[gamemap - 1]->numlaps > cv_basenumlaps.value)))
|
||||
? cv_basenumlaps.value
|
||||
: mapheaderinfo[gamemap - 1]->numlaps);
|
||||
|
||||
// Start recording replay in multiplayer with a temp filename
|
||||
//Ensure dedis only record a replay if there is a player at the start of the map, otherwise we get invalid replays!
|
||||
if (!demo.playback && multiplayer && D_NumPlayers()) {
|
||||
static char buf[256];
|
||||
sprintf(buf, "replay"PATHSEP"online"PATHSEP"%d-%s", (int) (time(NULL)), G_BuildMapName(gamemap));
|
||||
|
||||
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
|
||||
I_mkdir(va("%s"PATHSEP"replay"PATHSEP"online", srb2home), 0755);
|
||||
G_RecordDemo(buf);
|
||||
if (dedicated)
|
||||
G_BeginRecording(); //this has to move here, since dedicated servers dont run got_mapcmd
|
||||
}
|
||||
|
||||
wantedcalcdelay = wantedfrequency*2;
|
||||
indirectitemcooldown = 0;
|
||||
hyubgone = 0;
|
||||
mapreset = 0;
|
||||
nospectategrief = 0;
|
||||
thwompsactive = false;
|
||||
spbplace = -1;
|
||||
|
||||
startedInFreePlay = false;
|
||||
{
|
||||
UINT8 nump = 0;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
nump++;
|
||||
if (nump == 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nump <= 1)
|
||||
{
|
||||
startedInFreePlay = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========
|
||||
// landing point for netgames.
|
||||
netgameskip:
|
||||
|
||||
if (!reloadinggamestate)
|
||||
{
|
||||
|
||||
+168
-243
@@ -94,12 +94,16 @@ void R_DrawColumn_8(void)
|
||||
*dest = colormap[source[(frac>>FRACBITS) & heightmask]];
|
||||
dest += vid.width;
|
||||
frac += fracstep;
|
||||
|
||||
*dest = colormap[source[(frac>>FRACBITS) & heightmask]];
|
||||
dest += vid.width;
|
||||
frac += fracstep;
|
||||
}
|
||||
|
||||
if (count & 1)
|
||||
{
|
||||
*dest = colormap[source[(frac>>FRACBITS) & heightmask]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,7 +166,9 @@ void R_Draw2sMultiPatchColumn_8(void)
|
||||
val = source[frac>>FRACBITS];
|
||||
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
*dest = colormap[val];
|
||||
}
|
||||
|
||||
dest += vid.width;
|
||||
|
||||
@@ -182,20 +188,30 @@ void R_Draw2sMultiPatchColumn_8(void)
|
||||
{
|
||||
val = source[(frac>>FRACBITS) & heightmask];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
*dest = colormap[val];
|
||||
}
|
||||
|
||||
dest += vid.width;
|
||||
frac += fracstep;
|
||||
|
||||
val = source[(frac>>FRACBITS) & heightmask];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
*dest = colormap[val];
|
||||
}
|
||||
|
||||
dest += vid.width;
|
||||
frac += fracstep;
|
||||
}
|
||||
|
||||
if (count & 1)
|
||||
{
|
||||
val = source[(frac>>FRACBITS) & heightmask];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
*dest = colormap[val];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,7 +275,9 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void)
|
||||
val = source[frac>>FRACBITS];
|
||||
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
*dest = *(transmap + (colormap[val]<<8) + (*dest));
|
||||
}
|
||||
|
||||
dest += vid.width;
|
||||
|
||||
@@ -279,20 +297,30 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void)
|
||||
{
|
||||
val = source[(frac>>FRACBITS) & heightmask];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
*dest = *(transmap + (colormap[val]<<8) + (*dest));
|
||||
}
|
||||
|
||||
dest += vid.width;
|
||||
frac += fracstep;
|
||||
|
||||
val = source[(frac>>FRACBITS) & heightmask];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
*dest = *(transmap + (colormap[val]<<8) + (*dest));
|
||||
}
|
||||
|
||||
dest += vid.width;
|
||||
frac += fracstep;
|
||||
}
|
||||
|
||||
if (count & 1)
|
||||
{
|
||||
val = source[(frac>>FRACBITS) & heightmask];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
*dest = *(transmap + (colormap[val]<<8) + (*dest));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,6 +422,7 @@ void R_DrawTranslucentColumn_8(void)
|
||||
// heightmask is the Tutti-Frutti fix
|
||||
*dest = *(transmap + (colormap[source[frac>>FRACBITS]]<<8) + (*dest));
|
||||
dest += vid.width;
|
||||
|
||||
if ((frac += fracstep) >= heightmask)
|
||||
frac -= heightmask;
|
||||
}
|
||||
@@ -406,12 +435,16 @@ void R_DrawTranslucentColumn_8(void)
|
||||
*dest = *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest));
|
||||
dest += vid.width;
|
||||
frac += fracstep;
|
||||
|
||||
*dest = *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest));
|
||||
dest += vid.width;
|
||||
frac += fracstep;
|
||||
}
|
||||
|
||||
if (count & 1)
|
||||
{
|
||||
*dest = *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -461,10 +494,9 @@ void R_DrawTranslatedTranslucentColumn_8(void)
|
||||
// Re-map color indices from wall texture column
|
||||
// using a lighting/special effects LUT.
|
||||
// heightmask is the Tutti-Frutti fix
|
||||
|
||||
*dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]]<<8) + (*dest));
|
||||
|
||||
dest += vid.width;
|
||||
|
||||
if ((frac += fracstep) >= heightmask)
|
||||
frac -= heightmask;
|
||||
}
|
||||
@@ -477,12 +509,16 @@ void R_DrawTranslatedTranslucentColumn_8(void)
|
||||
*dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest));
|
||||
dest += vid.width;
|
||||
frac += fracstep;
|
||||
|
||||
*dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest));
|
||||
dest += vid.width;
|
||||
frac += fracstep;
|
||||
}
|
||||
|
||||
if (count & 1)
|
||||
{
|
||||
*dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -536,6 +572,12 @@ void R_DrawTranslatedColumn_8(void)
|
||||
// SPANS
|
||||
// ==========================================================================
|
||||
|
||||
#define SPANSIZE 16
|
||||
#define INVSPAN 0.0625f
|
||||
|
||||
// <Callum> 4194303 = (2048x2048)-1 (2048x2048 is maximum flat size)
|
||||
#define MAXFLATBYTES 4194303
|
||||
|
||||
/** \brief The R_DrawSpan_8 function
|
||||
Draws the actual span.
|
||||
*/
|
||||
@@ -544,6 +586,7 @@ void R_DrawSpan_8 (void)
|
||||
fixed_t xposition;
|
||||
fixed_t yposition;
|
||||
fixed_t xstep, ystep;
|
||||
UINT32 bit;
|
||||
|
||||
UINT8 *source;
|
||||
UINT8 *colormap;
|
||||
@@ -551,6 +594,7 @@ void R_DrawSpan_8 (void)
|
||||
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
|
||||
|
||||
size_t count = (ds_x2 - ds_x1 + 1);
|
||||
size_t i;
|
||||
|
||||
xposition = ds_xfrac; yposition = ds_yfrac;
|
||||
xstep = ds_xstep; ystep = ds_ystep;
|
||||
@@ -577,44 +621,23 @@ void R_DrawSpan_8 (void)
|
||||
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
|
||||
// have the uber complicated math to calculate it now, so that was a memory write we didn't
|
||||
// need!
|
||||
dest[0] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
|
||||
dest[i] = colormap[source[bit]];
|
||||
|
||||
dest[1] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[2] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[3] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[4] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[5] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[6] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[7] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
|
||||
dest += 8;
|
||||
count -= 8;
|
||||
}
|
||||
while (count-- && dest <= deststop)
|
||||
{
|
||||
*dest++ = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]];
|
||||
bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
|
||||
*dest++ = colormap[source[bit]];
|
||||
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
@@ -664,6 +687,7 @@ void R_DrawTiltedSpan_8(void)
|
||||
double izstep, uzstep, vzstep;
|
||||
double endz, endu, endv;
|
||||
UINT32 stepu, stepv;
|
||||
UINT32 bit;
|
||||
|
||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||
|
||||
@@ -683,6 +707,7 @@ void R_DrawTiltedSpan_8(void)
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
|
||||
source = ds_source;
|
||||
//colormap = ds_colormap;
|
||||
|
||||
@@ -695,18 +720,16 @@ void R_DrawTiltedSpan_8(void)
|
||||
u = (INT64)(uz*z) + viewx;
|
||||
v = (INT64)(vz*z) + viewy;
|
||||
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[source[bit]];
|
||||
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
dest++;
|
||||
iz += ds_szp->x;
|
||||
uz += ds_sup->x;
|
||||
vz += ds_svp->x;
|
||||
} while (--width >= 0);
|
||||
#else
|
||||
#define SPANSIZE 16
|
||||
#define INVSPAN 0.0625f
|
||||
|
||||
startz = 1.f/iz;
|
||||
startu = uz*startz;
|
||||
startv = vz*startz;
|
||||
@@ -733,8 +756,10 @@ void R_DrawTiltedSpan_8(void)
|
||||
|
||||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
*dest = colormap[source[bit]];
|
||||
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
@@ -749,8 +774,9 @@ void R_DrawTiltedSpan_8(void)
|
||||
{
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
*dest = colormap[source[bit]];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -770,8 +796,10 @@ void R_DrawTiltedSpan_8(void)
|
||||
|
||||
for (; width != 0; width--)
|
||||
{
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
*dest = colormap[source[bit]];
|
||||
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
@@ -800,6 +828,7 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||
double izstep, uzstep, vzstep;
|
||||
double endz, endu, endv;
|
||||
UINT32 stepu, stepv;
|
||||
UINT32 bit;
|
||||
|
||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||
|
||||
@@ -819,6 +848,7 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
|
||||
source = ds_source;
|
||||
//colormap = ds_colormap;
|
||||
|
||||
@@ -831,17 +861,16 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||
u = (INT64)(uz*z) + viewx;
|
||||
v = (INT64)(vz*z) + viewy;
|
||||
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
*dest = *(ds_transmap + (colormap[source[bit]] << 8) + *dest);
|
||||
|
||||
dest++;
|
||||
iz += ds_szp->x;
|
||||
uz += ds_sup->x;
|
||||
vz += ds_svp->x;
|
||||
} while (--width >= 0);
|
||||
#else
|
||||
#define SPANSIZE 16
|
||||
#define INVSPAN 0.0625f
|
||||
|
||||
startz = 1.f/iz;
|
||||
startu = uz*startz;
|
||||
startv = vz*startz;
|
||||
@@ -868,8 +897,10 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||
|
||||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
*dest = *(ds_transmap + (colormap[source[bit]] << 8) + *dest);
|
||||
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
@@ -884,8 +915,9 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||
{
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
*dest = *(ds_transmap + (colormap[source[bit]] << 8) + *dest);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -905,8 +937,10 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||
|
||||
for (; width != 0; width--)
|
||||
{
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
*dest = *(ds_transmap + (colormap[source[bit]] << 8) + *dest);
|
||||
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
@@ -937,6 +971,7 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||
double izstep, uzstep, vzstep;
|
||||
double endz, endu, endv;
|
||||
UINT32 stepu, stepv;
|
||||
UINT32 bit;
|
||||
|
||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||
|
||||
@@ -957,6 +992,7 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1;
|
||||
|
||||
source = ds_source;
|
||||
//colormap = ds_colormap;
|
||||
|
||||
@@ -969,17 +1005,16 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||
u = (INT64)(uz*z) + viewx;
|
||||
v = (INT64)(vz*z) + viewy;
|
||||
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++);
|
||||
*dest = *(ds_transmap + (colormap[source[bit]] << 8) + *dsrc++);
|
||||
|
||||
dest++;
|
||||
iz += ds_szp->x;
|
||||
uz += ds_sup->x;
|
||||
vz += ds_svp->x;
|
||||
} while (--width >= 0);
|
||||
#else
|
||||
#define SPANSIZE 16
|
||||
#define INVSPAN 0.0625f
|
||||
|
||||
startz = 1.f/iz;
|
||||
startu = uz*startz;
|
||||
startv = vz*startz;
|
||||
@@ -1006,8 +1041,10 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||
|
||||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++);
|
||||
*dest = *(ds_transmap + (colormap[source[bit]] << 8) + *dsrc++);
|
||||
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
@@ -1022,8 +1059,9 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||
{
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++);
|
||||
*dest = *(ds_transmap + (colormap[source[bit]] << 8) + *dsrc++);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1043,8 +1081,10 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||
|
||||
for (; width != 0; width--)
|
||||
{
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++);
|
||||
*dest = *(ds_transmap + (colormap[source[bit]] << 8) + *dsrc++);
|
||||
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
@@ -1073,6 +1113,7 @@ void R_DrawTiltedSplat_8(void)
|
||||
double izstep, uzstep, vzstep;
|
||||
double endz, endu, endv;
|
||||
UINT32 stepu, stepv;
|
||||
UINT32 bit;
|
||||
|
||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||
|
||||
@@ -1092,6 +1133,7 @@ void R_DrawTiltedSplat_8(void)
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
|
||||
source = ds_source;
|
||||
//colormap = ds_colormap;
|
||||
|
||||
@@ -1104,20 +1146,20 @@ void R_DrawTiltedSplat_8(void)
|
||||
u = (INT64)(uz*z) + viewx;
|
||||
v = (INT64)(vz*z) + viewy;
|
||||
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
val = source[bit];
|
||||
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[val];
|
||||
}
|
||||
dest++;
|
||||
iz += ds_szp->x;
|
||||
uz += ds_sup->x;
|
||||
vz += ds_svp->x;
|
||||
} while (--width >= 0);
|
||||
#else
|
||||
#define SPANSIZE 16
|
||||
#define INVSPAN 0.0625f
|
||||
|
||||
startz = 1.f/iz;
|
||||
startu = uz*startz;
|
||||
startv = vz*startz;
|
||||
@@ -1144,10 +1186,13 @@ void R_DrawTiltedSplat_8(void)
|
||||
|
||||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
val = source[bit];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[val];
|
||||
}
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
@@ -1162,10 +1207,13 @@ void R_DrawTiltedSplat_8(void)
|
||||
{
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
val = source[bit];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[val];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1185,10 +1233,13 @@ void R_DrawTiltedSplat_8(void)
|
||||
|
||||
for (; width != 0; width--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
val = source[bit];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[val];
|
||||
}
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
@@ -1206,12 +1257,14 @@ void R_DrawSplat_8 (void)
|
||||
UINT32 xposition;
|
||||
UINT32 yposition;
|
||||
UINT32 xstep, ystep;
|
||||
UINT32 bit;
|
||||
|
||||
UINT8 *source;
|
||||
UINT8 *colormap;
|
||||
UINT8 *dest;
|
||||
|
||||
size_t count;
|
||||
size_t i;
|
||||
UINT32 val;
|
||||
|
||||
// SoM: we only need 6 bits for the integer part (0 thru 63) so the rest
|
||||
@@ -1236,80 +1289,29 @@ void R_DrawSplat_8 (void)
|
||||
// need!
|
||||
//
|
||||
// <Callum> 4194303 = (2048x2048)-1 (2048x2048 is maximum flat size)
|
||||
val = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
val &= 4194303;
|
||||
val = source[val];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[0] = colormap[val];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
|
||||
bit &= MAXFLATBYTES;
|
||||
val = source[bit];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[i] = colormap[val];
|
||||
|
||||
val = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
val &= 4194303;
|
||||
val = source[val];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[1] = colormap[val];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
val &= 4194303;
|
||||
val = source[val];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[2] = colormap[val];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
val &= 4194303;
|
||||
val = source[val];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[3] = colormap[val];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
val &= 4194303;
|
||||
val = source[val];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[4] = colormap[val];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
val &= 4194303;
|
||||
val = source[val];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[5] = colormap[val];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
val &= 4194303;
|
||||
val = source[val];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[6] = colormap[val];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
val &= 4194303;
|
||||
val = source[val];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[7] = colormap[val];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
|
||||
dest += 8;
|
||||
count -= 8;
|
||||
}
|
||||
while (count--)
|
||||
{
|
||||
val = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
val &= 4194303;
|
||||
val = source[val];
|
||||
bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
|
||||
val = source[bit];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
{
|
||||
*dest = colormap[val];
|
||||
}
|
||||
|
||||
dest++;
|
||||
xposition += xstep;
|
||||
@@ -1325,12 +1327,14 @@ void R_DrawTranslucentSplat_8 (void)
|
||||
UINT32 xposition;
|
||||
UINT32 yposition;
|
||||
UINT32 xstep, ystep;
|
||||
UINT32 bit;
|
||||
|
||||
UINT8 *source;
|
||||
UINT8 *colormap;
|
||||
UINT8 *dest;
|
||||
|
||||
size_t count;
|
||||
size_t i;
|
||||
UINT8 val;
|
||||
|
||||
// SoM: we only need 6 bits for the integer part (0 thru 63) so the rest
|
||||
@@ -1353,60 +1357,24 @@ void R_DrawTranslucentSplat_8 (void)
|
||||
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
|
||||
// have the uber complicated math to calculate it now, so that was a memory write we didn't
|
||||
// need!
|
||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[0] = *(ds_transmap + (colormap[val] << 8) + dest[0]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
|
||||
val = source[bit];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[i] = *(ds_transmap + (colormap[val] << 8) + dest[i]);
|
||||
|
||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[1] = *(ds_transmap + (colormap[val] << 8) + dest[1]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[2] = *(ds_transmap + (colormap[val] << 8) + dest[2]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[3] = *(ds_transmap + (colormap[val] << 8) + dest[3]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[4] = *(ds_transmap + (colormap[val] << 8) + dest[4]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[5] = *(ds_transmap + (colormap[val] << 8) + dest[5]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[6] = *(ds_transmap + (colormap[val] << 8) + dest[6]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
dest[7] = *(ds_transmap + (colormap[val] << 8) + dest[7]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
|
||||
dest += 8;
|
||||
count -= 8;
|
||||
}
|
||||
while (count--)
|
||||
{
|
||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||
bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
|
||||
val = source[bit];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = *(ds_transmap + (colormap[val] << 8) + *dest);
|
||||
|
||||
@@ -1424,6 +1392,7 @@ void R_DrawTranslucentSpan_8 (void)
|
||||
fixed_t xposition;
|
||||
fixed_t yposition;
|
||||
fixed_t xstep, ystep;
|
||||
UINT32 bit;
|
||||
|
||||
UINT8 *source;
|
||||
UINT8 *colormap;
|
||||
@@ -1431,7 +1400,7 @@ void R_DrawTranslucentSpan_8 (void)
|
||||
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
|
||||
|
||||
size_t count = (ds_x2 - ds_x1 + 1);
|
||||
UINT32 val;
|
||||
size_t i;
|
||||
|
||||
xposition = ds_xfrac; yposition = ds_yfrac;
|
||||
xstep = ds_xstep; ystep = ds_ystep;
|
||||
@@ -1455,45 +1424,21 @@ void R_DrawTranslucentSpan_8 (void)
|
||||
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
|
||||
// have the uber complicated math to calculate it now, so that was a memory write we didn't
|
||||
// need!
|
||||
dest[0] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[0]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[1] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[1]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[2] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[2]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[3] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[3]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[4] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[4]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[5] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[5]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[6] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[6]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[7] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[7]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
|
||||
dest[i] = *(ds_transmap + (colormap[source[bit]] << 8) + dest[i]);
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
|
||||
dest += 8;
|
||||
count -= 8;
|
||||
}
|
||||
while (count-- && dest <= deststop)
|
||||
{
|
||||
val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
|
||||
*dest = *(ds_transmap + (colormap[source[val]] << 8) + *dest);
|
||||
bit = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift);
|
||||
*dest = *(ds_transmap + (colormap[source[bit]] << 8) + *dest);
|
||||
dest++;
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
@@ -1506,6 +1451,7 @@ void R_DrawTranslucentWaterSpan_8(void)
|
||||
UINT32 xposition;
|
||||
UINT32 yposition;
|
||||
UINT32 xstep, ystep;
|
||||
UINT32 bit;
|
||||
|
||||
UINT8 *source;
|
||||
UINT8 *colormap;
|
||||
@@ -1513,6 +1459,7 @@ void R_DrawTranslucentWaterSpan_8(void)
|
||||
UINT8 *dsrc;
|
||||
|
||||
size_t count;
|
||||
size_t i;
|
||||
|
||||
// SoM: we only need 6 bits for the integer part (0 thru 63) so the rest
|
||||
// can be used for the fraction part. This allows calculation of the memory address in the
|
||||
@@ -1535,44 +1482,22 @@ void R_DrawTranslucentWaterSpan_8(void)
|
||||
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
|
||||
// have the uber complicated math to calculate it now, so that was a memory write we didn't
|
||||
// need!
|
||||
dest[0] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[1] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[2] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[3] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[4] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[5] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[6] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
|
||||
dest[7] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
bit = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
dest[i] = colormap[*(ds_transmap + (source[bit] << 8) + *dsrc++)];
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
|
||||
dest += 8;
|
||||
count -= 8;
|
||||
}
|
||||
while (count--)
|
||||
{
|
||||
*dest++ = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)];
|
||||
bit = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift);
|
||||
*dest++ = colormap[*(ds_transmap + (source[bit] << 8) + *dsrc++)];
|
||||
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
}
|
||||
|
||||
+3
-5
@@ -528,7 +528,7 @@ const char *GetPalette(void)
|
||||
return "PLAYPAL";
|
||||
}
|
||||
|
||||
static void LoadMapPalette(void)
|
||||
void V_ReloadPalette(void)
|
||||
{
|
||||
LoadPalette(GetPalette());
|
||||
}
|
||||
@@ -540,7 +540,7 @@ static void LoadMapPalette(void)
|
||||
void V_SetPalette(INT32 palettenum)
|
||||
{
|
||||
if (!pLocalPalette)
|
||||
LoadMapPalette();
|
||||
V_ReloadPalette();
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
@@ -575,7 +575,7 @@ static void CV_palette_OnChange(void)
|
||||
if (loaded_config == false)
|
||||
return;
|
||||
// reload palette
|
||||
LoadMapPalette();
|
||||
V_ReloadPalette();
|
||||
V_SetPalette(0);
|
||||
}
|
||||
|
||||
@@ -3373,8 +3373,6 @@ void V_Init(void)
|
||||
UINT8 *base = vid.buffer;
|
||||
const INT32 screensize = vid.rowbytes * vid.height;
|
||||
|
||||
LoadMapPalette();
|
||||
|
||||
for (i = 0; i < NUMSCREENS; i++)
|
||||
screens[i] = NULL;
|
||||
|
||||
|
||||
@@ -49,6 +49,9 @@ extern UINT8 colorlookup[CLUTSIZE][CLUTSIZE][CLUTSIZE];
|
||||
|
||||
void InitColorLUT(void);
|
||||
|
||||
// Loads the correct palette into memory
|
||||
void V_ReloadPalette(void);
|
||||
|
||||
// Set the current RGB palette lookup to use for palettized graphics
|
||||
void V_SetPalette(INT32 palettenum);
|
||||
|
||||
|
||||
Reference in new issue
Block a user