Merge remote-tracking branch 'upstream/master' into zdoom-rgb666-take2

# Conflicts:
#	src/r_draw_pal.cpp
This commit is contained in:
Magnus Norddahl 2016-12-23 21:27:50 +01:00
commit 8cc4c8a192
14 changed files with 261 additions and 374 deletions

View file

@ -80,7 +80,7 @@ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ZD_FASTMATH_FLAG}" )
#endif() #endif()
# [ZDoom] Set always to OFF. # [ZDoom] Set always to OFF.
set(BUILD_SHARED_LIBS 0 BOOL "Build shared library (set to OFF for static library)") set(BUILD_SHARED_LIBS OFF)
# Check for GCC "visibility" support. # Check for GCC "visibility" support.
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)

View file

@ -1523,8 +1523,6 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
buffer.Text.StripLeftRight(); buffer.Text.StripLeftRight();
Printf(127, TEXTCOLOR_WHITE "]%s\n", buffer.Text.GetChars()); Printf(127, TEXTCOLOR_WHITE "]%s\n", buffer.Text.GetChars());
AddCommandString(buffer.Text.LockBuffer());
buffer.Text.UnlockBuffer();
if (buffer.Text.Len() == 0) if (buffer.Text.Len() == 0)
{ {
@ -1568,7 +1566,21 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
} }
} }
HistPos = NULL; HistPos = NULL;
{
// Work with a copy of command to avoid side effects caused by
// exception raised during execution, like with 'error' CCMD.
// It's problematic to maintain FString's lock symmetry.
static TArray<char> command;
const size_t length = buffer.Text.Len();
command.Resize(length + 1);
memcpy(&command[0], buffer.Text.GetChars(), length);
command[length] = '\0';
buffer.SetString(""); buffer.SetString("");
AddCommandString(&command[0]);
}
TabbedLast = false; TabbedLast = false;
TabbedList = false; TabbedList = false;
break; break;

View file

@ -533,8 +533,9 @@ void SetCompatibilityParams()
if (CompatParams[i+1] < numsectors) if (CompatParams[i+1] < numsectors)
{ {
sector_t *sec = &sectors[CompatParams[i+1]]; sector_t *sec = &sectors[CompatParams[i+1]];
sec->floorplane.ChangeHeight(CompatParams[i+2]); const double delta = CompatParams[i + 2] / 65536.0;
sec->ChangePlaneTexZ(sector_t::floor, CompatParams[i+2] / 65536.); sec->floorplane.ChangeHeight(delta);
sec->ChangePlaneTexZ(sector_t::floor, delta);
} }
i += 3; i += 3;
break; break;

View file

@ -1232,6 +1232,7 @@ DThinker *FDecalStretcherAnim::CreateThinker (DBaseDecal *actor, side_t *wall) c
} }
else else
{ {
thinker->GoalX = 0;
thinker->bStretchX = false; thinker->bStretchX = false;
} }
if (GoalY >= 0) if (GoalY >= 0)
@ -1241,6 +1242,7 @@ DThinker *FDecalStretcherAnim::CreateThinker (DBaseDecal *actor, side_t *wall) c
} }
else else
{ {
thinker->GoalY = 0;
thinker->bStretchY = false; thinker->bStretchY = false;
} }
thinker->bStarted = false; thinker->bStarted = false;

View file

@ -31,6 +31,7 @@
#include "p_lnspec.h" #include "p_lnspec.h"
#include "doomstat.h" #include "doomstat.h"
#include "p_maputl.h"
// State. // State.
#include "r_state.h" #include "r_state.h"
@ -914,7 +915,7 @@ void DPhased::Tick ()
int DPhased::PhaseHelper (sector_t *sector, int index, int light, sector_t *prev) int DPhased::PhaseHelper (sector_t *sector, int index, int light, sector_t *prev)
{ {
if (!sector) if (!sector || sector->validcount == validcount)
{ {
return index; return index;
} }
@ -922,6 +923,7 @@ int DPhased::PhaseHelper (sector_t *sector, int index, int light, sector_t *prev
{ {
DPhased *l; DPhased *l;
int baselevel = sector->lightlevel ? sector->lightlevel : light; int baselevel = sector->lightlevel ? sector->lightlevel : light;
sector->validcount = validcount;
if (index == 0) if (index == 0)
{ {
@ -958,6 +960,7 @@ DPhased::DPhased (sector_t *sector, int baselevel)
DPhased::DPhased (sector_t *sector) DPhased::DPhased (sector_t *sector)
: DLighting (sector) : DLighting (sector)
{ {
validcount++;
PhaseHelper (sector, 0, 0, NULL); PhaseHelper (sector, 0, 0, NULL);
} }

View file

@ -96,17 +96,15 @@ namespace swrenderer
uint8_t *dc_destorg; uint8_t *dc_destorg;
int dc_destheight; int dc_destheight;
int dc_count; int dc_count;
uint32_t vplce[4]; uint32_t dc_wall_texturefrac[4];
uint32_t vince[4]; uint32_t dc_wall_iscale[4];
uint8_t *palookupoffse[4]; uint8_t *dc_wall_colormap[4];
fixed_t palookuplight[4]; fixed_t dc_wall_light[4];
const uint8_t *bufplce[4]; const uint8_t *dc_wall_source[4];
const uint8_t *bufplce2[4]; const uint8_t *dc_wall_source2[4];
uint32_t buftexturefracx[4]; uint32_t dc_wall_texturefracx[4];
uint32_t bufheight[4]; uint32_t dc_wall_sourceheight[4];
int vlinebits; int dc_wall_fracbits;
int mvlinebits;
int tmvlinebits;
int ds_y; int ds_y;
int ds_x1; int ds_x1;
int ds_x2; int ds_x2;
@ -491,50 +489,35 @@ namespace swrenderer
return tex->GetColumn(col, nullptr); return tex->GetColumn(col, nullptr);
} }
bool R_GetTransMaskDrawers(fixed_t(**tmvline1)(), void(**tmvline4)()) bool R_GetTransMaskDrawers(void(**drawCol1)(), void(**drawCol4)())
{ {
if (colfunc == R_DrawAddColumn) if (colfunc == R_DrawAddColumn)
{ {
*tmvline1 = tmvline1_add; *drawCol1 = R_DrawWallAddCol1;
*tmvline4 = tmvline4_add; *drawCol4 = R_DrawWallAddCol4;
return true; return true;
} }
if (colfunc == R_DrawAddClampColumn) if (colfunc == R_DrawAddClampColumn)
{ {
*tmvline1 = tmvline1_addclamp; *drawCol1 = R_DrawWallAddClampCol1;
*tmvline4 = tmvline4_addclamp; *drawCol4 = R_DrawWallAddClampCol4;
return true; return true;
} }
if (colfunc == R_DrawSubClampColumn) if (colfunc == R_DrawSubClampColumn)
{ {
*tmvline1 = tmvline1_subclamp; *drawCol1 = R_DrawWallSubClampCol1;
*tmvline4 = tmvline4_subclamp; *drawCol4 = R_DrawWallSubClampCol4;
return true; return true;
} }
if (colfunc == R_DrawRevSubClampColumn) if (colfunc == R_DrawRevSubClampColumn)
{ {
*tmvline1 = tmvline1_revsubclamp; *drawCol1 = R_DrawWallRevSubClampCol1;
*tmvline4 = tmvline4_revsubclamp; *drawCol4 = R_DrawWallRevSubClampCol4;
return true; return true;
} }
return false; return false;
} }
void setupvline(int fracbits)
{
drawerargs::vlinebits = fracbits;
}
void setupmvline(int fracbits)
{
drawerargs::mvlinebits = fracbits;
}
void setuptmvline(int fracbits)
{
drawerargs::tmvlinebits = fracbits;
}
void R_SetColorMapLight(lighttable_t *base_colormap, float light, int shade) void R_SetColorMapLight(lighttable_t *base_colormap, float light, int shade)
{ {
using namespace drawerargs; using namespace drawerargs;
@ -967,118 +950,64 @@ namespace swrenderer
rt_revsubclamp4cols(sx, yl, yh); rt_revsubclamp4cols(sx, yl, yh);
} }
uint32_t vlinec1() void R_DrawWallCol1()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWall1PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWall1PalCommand>();
return dc_texturefrac + dc_count * dc_iscale;
} }
void vlinec4() void R_DrawWallCol4()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWall4PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWall4PalCommand>();
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
} }
uint32_t mvlinec1() void R_DrawWallMaskedCol1()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallMasked1PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallMasked1PalCommand>();
return dc_texturefrac + dc_count * dc_iscale;
} }
void mvlinec4() void R_DrawWallMaskedCol4()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallMasked4PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallMasked4PalCommand>();
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
} }
fixed_t tmvline1_add() void R_DrawWallAddCol1()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallAdd1PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallAdd1PalCommand>();
return dc_texturefrac + dc_count * dc_iscale;
} }
void tmvline4_add() void R_DrawWallAddCol4()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallAdd4PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallAdd4PalCommand>();
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
} }
fixed_t tmvline1_addclamp() void R_DrawWallAddClampCol1()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallAddClamp1PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallAddClamp1PalCommand>();
return dc_texturefrac + dc_count * dc_iscale;
} }
void tmvline4_addclamp() void R_DrawWallAddClampCol4()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallAddClamp4PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallAddClamp4PalCommand>();
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
} }
fixed_t tmvline1_subclamp() void R_DrawWallSubClampCol1()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallSubClamp1PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallSubClamp1PalCommand>();
return dc_texturefrac + dc_count * dc_iscale;
} }
void tmvline4_subclamp() void R_DrawWallSubClampCol4()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallSubClamp4PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallSubClamp4PalCommand>();
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
} }
fixed_t tmvline1_revsubclamp() void R_DrawWallRevSubClampCol1()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1PalCommand>();
return dc_texturefrac + dc_count * dc_iscale;
} }
void tmvline4_revsubclamp() void R_DrawWallRevSubClampCol4()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp4PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp4PalCommand>();
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
} }
void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom) void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom)

View file

@ -41,17 +41,15 @@ namespace swrenderer
extern int dc_destheight; extern int dc_destheight;
extern int dc_count; extern int dc_count;
extern uint32_t vplce[4]; extern uint32_t dc_wall_texturefrac[4];
extern uint32_t vince[4]; extern uint32_t dc_wall_iscale[4];
extern uint8_t *palookupoffse[4]; extern uint8_t *dc_wall_colormap[4];
extern fixed_t palookuplight[4]; extern fixed_t dc_wall_light[4];
extern const uint8_t *bufplce[4]; extern const uint8_t *dc_wall_source[4];
extern const uint8_t *bufplce2[4]; extern const uint8_t *dc_wall_source2[4];
extern uint32_t buftexturefracx[4]; extern uint32_t dc_wall_texturefracx[4];
extern uint32_t bufheight[4]; extern uint32_t dc_wall_sourceheight[4];
extern int vlinebits; extern int dc_wall_fracbits;
extern int mvlinebits;
extern int tmvlinebits;
extern int ds_y; extern int ds_y;
extern int ds_x1; extern int ds_x1;
@ -100,7 +98,7 @@ namespace swrenderer
ESPSResult R_SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color); ESPSResult R_SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color);
ESPSResult R_SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color); ESPSResult R_SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color);
void R_FinishSetPatchStyle(); // Call this after finished drawing the current thing, in case its style was STYLE_Shade void R_FinishSetPatchStyle(); // Call this after finished drawing the current thing, in case its style was STYLE_Shade
bool R_GetTransMaskDrawers(fixed_t(**tmvline1)(), void(**tmvline4)()); bool R_GetTransMaskDrawers(void(**drawCol1)(), void(**drawCol4)());
const uint8_t *R_GetColumn(FTexture *tex, int col); const uint8_t *R_GetColumn(FTexture *tex, int col);
@ -162,29 +160,21 @@ namespace swrenderer
void R_SetupDrawSlab(uint8_t *colormap); void R_SetupDrawSlab(uint8_t *colormap);
void R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p); void R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p);
void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip); void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip);
uint32_t vlinec1();
void vlinec4();
uint32_t mvlinec1();
void mvlinec4();
fixed_t tmvline1_add();
void tmvline4_add();
fixed_t tmvline1_addclamp();
void tmvline4_addclamp();
fixed_t tmvline1_subclamp();
void tmvline4_subclamp();
fixed_t tmvline1_revsubclamp();
void tmvline4_revsubclamp();
void R_FillColumnHoriz(); void R_FillColumnHoriz();
void R_FillSpan(); void R_FillSpan();
inline uint32_t dovline1() { return vlinec1(); } void R_DrawWallCol1();
inline void dovline4() { vlinec4(); } void R_DrawWallCol4();
inline uint32_t domvline1() { return mvlinec1(); } void R_DrawWallMaskedCol1();
inline void domvline4() { mvlinec4(); } void R_DrawWallMaskedCol4();
void R_DrawWallAddCol1();
void setupvline(int fracbits); void R_DrawWallAddCol4();
void setupmvline(int fracbits); void R_DrawWallAddClampCol1();
void setuptmvline(int fracbits); void R_DrawWallAddClampCol4();
void R_DrawWallSubClampCol1();
void R_DrawWallSubClampCol4();
void R_DrawWallRevSubClampCol1();
void R_DrawWallRevSubClampCol4();
void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom); void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom);
void R_DrawSingleSkyCol4(uint32_t solid_top, uint32_t solid_bottom); void R_DrawSingleSkyCol4(uint32_t solid_top, uint32_t solid_bottom);

View file

@ -96,9 +96,7 @@ namespace swrenderer
_count = dc_count; _count = dc_count;
_source = dc_source; _source = dc_source;
_dest = dc_dest; _dest = dc_dest;
_vlinebits = vlinebits; _fracbits = dc_wall_fracbits;
_mvlinebits = mvlinebits;
_tmvlinebits = tmvlinebits;
_pitch = dc_pitch; _pitch = dc_pitch;
_srcblend = dc_srcblend; _srcblend = dc_srcblend;
_destblend = dc_destblend; _destblend = dc_destblend;
@ -111,15 +109,13 @@ namespace swrenderer
_dest = dc_dest; _dest = dc_dest;
_count = dc_count; _count = dc_count;
_pitch = dc_pitch; _pitch = dc_pitch;
_vlinebits = vlinebits; _fracbits = dc_wall_fracbits;
_mvlinebits = mvlinebits;
_tmvlinebits = tmvlinebits;
for (int col = 0; col < 4; col++) for (int col = 0; col < 4; col++)
{ {
_palookupoffse[col] = palookupoffse[col]; _colormap[col] = dc_wall_colormap[col];
_bufplce[col] = bufplce[col]; _source[col] = dc_wall_source[col];
_vince[col] = vince[col]; _iscale[col] = dc_wall_iscale[col];
_vplce[col] = vplce[col]; _texturefrac[col] = dc_wall_texturefrac[col];
} }
_srcblend = dc_srcblend; _srcblend = dc_srcblend;
_destblend = dc_destblend; _destblend = dc_destblend;
@ -133,7 +129,7 @@ namespace swrenderer
int count = _count; int count = _count;
const uint8_t *source = _source; const uint8_t *source = _source;
uint8_t *dest = _dest; uint8_t *dest = _dest;
int bits = _vlinebits; int bits = _fracbits;
int pitch = _pitch; int pitch = _pitch;
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
@ -157,24 +153,24 @@ namespace swrenderer
{ {
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int bits = _vlinebits; int bits = _fracbits;
uint32_t place; uint32_t place;
auto pal0 = _palookupoffse[0]; auto pal0 = _colormap[0];
auto pal1 = _palookupoffse[1]; auto pal1 = _colormap[1];
auto pal2 = _palookupoffse[2]; auto pal2 = _colormap[2];
auto pal3 = _palookupoffse[3]; auto pal3 = _colormap[3];
auto buf0 = _bufplce[0]; auto buf0 = _source[0];
auto buf1 = _bufplce[1]; auto buf1 = _source[1];
auto buf2 = _bufplce[2]; auto buf2 = _source[2];
auto buf3 = _bufplce[3]; auto buf3 = _source[3];
auto vince0 = _vince[0]; auto dc_wall_iscale0 = _iscale[0];
auto vince1 = _vince[1]; auto dc_wall_iscale1 = _iscale[1];
auto vince2 = _vince[2]; auto dc_wall_iscale2 = _iscale[2];
auto vince3 = _vince[3]; auto dc_wall_iscale3 = _iscale[3];
auto vplce0 = _vplce[0]; auto dc_wall_texturefrac0 = _texturefrac[0];
auto vplce1 = _vplce[1]; auto dc_wall_texturefrac1 = _texturefrac[1];
auto vplce2 = _vplce[2]; auto dc_wall_texturefrac2 = _texturefrac[2];
auto vplce3 = _vplce[3]; auto dc_wall_texturefrac3 = _texturefrac[3];
auto pitch = _pitch; auto pitch = _pitch;
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
@ -183,22 +179,22 @@ namespace swrenderer
int skipped = thread->skipped_by_thread(_dest_y); int skipped = thread->skipped_by_thread(_dest_y);
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
vplce0 += vince0 * skipped; dc_wall_texturefrac0 += dc_wall_iscale0 * skipped;
vplce1 += vince1 * skipped; dc_wall_texturefrac1 += dc_wall_iscale1 * skipped;
vplce2 += vince2 * skipped; dc_wall_texturefrac2 += dc_wall_iscale2 * skipped;
vplce3 += vince3 * skipped; dc_wall_texturefrac3 += dc_wall_iscale3 * skipped;
vince0 *= thread->num_cores; dc_wall_iscale0 *= thread->num_cores;
vince1 *= thread->num_cores; dc_wall_iscale1 *= thread->num_cores;
vince2 *= thread->num_cores; dc_wall_iscale2 *= thread->num_cores;
vince3 *= thread->num_cores; dc_wall_iscale3 *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
do do
{ {
dest[0] = pal0[buf0[(place = vplce0) >> bits]]; vplce0 = place + vince0; dest[0] = pal0[buf0[(place = dc_wall_texturefrac0) >> bits]]; dc_wall_texturefrac0 = place + dc_wall_iscale0;
dest[1] = pal1[buf1[(place = vplce1) >> bits]]; vplce1 = place + vince1; dest[1] = pal1[buf1[(place = dc_wall_texturefrac1) >> bits]]; dc_wall_texturefrac1 = place + dc_wall_iscale1;
dest[2] = pal2[buf2[(place = vplce2) >> bits]]; vplce2 = place + vince2; dest[2] = pal2[buf2[(place = dc_wall_texturefrac2) >> bits]]; dc_wall_texturefrac2 = place + dc_wall_iscale2;
dest[3] = pal3[buf3[(place = vplce3) >> bits]]; vplce3 = place + vince3; dest[3] = pal3[buf3[(place = dc_wall_texturefrac3) >> bits]]; dc_wall_texturefrac3 = place + dc_wall_iscale3;
dest += pitch; dest += pitch;
} while (--count); } while (--count);
} }
@ -211,7 +207,7 @@ namespace swrenderer
int count = _count; int count = _count;
const uint8_t *source = _source; const uint8_t *source = _source;
uint8_t *dest = _dest; uint8_t *dest = _dest;
int bits = _mvlinebits; int bits = _fracbits;
int pitch = _pitch; int pitch = _pitch;
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
@ -239,24 +235,24 @@ namespace swrenderer
{ {
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int bits = _mvlinebits; int bits = _fracbits;
uint32_t place; uint32_t place;
auto pal0 = _palookupoffse[0]; auto pal0 = _colormap[0];
auto pal1 = _palookupoffse[1]; auto pal1 = _colormap[1];
auto pal2 = _palookupoffse[2]; auto pal2 = _colormap[2];
auto pal3 = _palookupoffse[3]; auto pal3 = _colormap[3];
auto buf0 = _bufplce[0]; auto buf0 = _source[0];
auto buf1 = _bufplce[1]; auto buf1 = _source[1];
auto buf2 = _bufplce[2]; auto buf2 = _source[2];
auto buf3 = _bufplce[3]; auto buf3 = _source[3];
auto vince0 = _vince[0]; auto dc_wall_iscale0 = _iscale[0];
auto vince1 = _vince[1]; auto dc_wall_iscale1 = _iscale[1];
auto vince2 = _vince[2]; auto dc_wall_iscale2 = _iscale[2];
auto vince3 = _vince[3]; auto dc_wall_iscale3 = _iscale[3];
auto vplce0 = _vplce[0]; auto dc_wall_texturefrac0 = _texturefrac[0];
auto vplce1 = _vplce[1]; auto dc_wall_texturefrac1 = _texturefrac[1];
auto vplce2 = _vplce[2]; auto dc_wall_texturefrac2 = _texturefrac[2];
auto vplce3 = _vplce[3]; auto dc_wall_texturefrac3 = _texturefrac[3];
auto pitch = _pitch; auto pitch = _pitch;
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
@ -265,24 +261,24 @@ namespace swrenderer
int skipped = thread->skipped_by_thread(_dest_y); int skipped = thread->skipped_by_thread(_dest_y);
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
vplce0 += vince0 * skipped; dc_wall_texturefrac0 += dc_wall_iscale0 * skipped;
vplce1 += vince1 * skipped; dc_wall_texturefrac1 += dc_wall_iscale1 * skipped;
vplce2 += vince2 * skipped; dc_wall_texturefrac2 += dc_wall_iscale2 * skipped;
vplce3 += vince3 * skipped; dc_wall_texturefrac3 += dc_wall_iscale3 * skipped;
vince0 *= thread->num_cores; dc_wall_iscale0 *= thread->num_cores;
vince1 *= thread->num_cores; dc_wall_iscale1 *= thread->num_cores;
vince2 *= thread->num_cores; dc_wall_iscale2 *= thread->num_cores;
vince3 *= thread->num_cores; dc_wall_iscale3 *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
do do
{ {
uint8_t pix; uint8_t pix;
pix = buf0[(place = vplce0) >> bits]; if (pix) dest[0] = pal0[pix]; vplce0 = place + vince0; pix = buf0[(place = dc_wall_texturefrac0) >> bits]; if (pix) dest[0] = pal0[pix]; dc_wall_texturefrac0 = place + dc_wall_iscale0;
pix = buf1[(place = vplce1) >> bits]; if (pix) dest[1] = pal1[pix]; vplce1 = place + vince1; pix = buf1[(place = dc_wall_texturefrac1) >> bits]; if (pix) dest[1] = pal1[pix]; dc_wall_texturefrac1 = place + dc_wall_iscale1;
pix = buf2[(place = vplce2) >> bits]; if (pix) dest[2] = pal2[pix]; vplce2 = place + vince2; pix = buf2[(place = dc_wall_texturefrac2) >> bits]; if (pix) dest[2] = pal2[pix]; dc_wall_texturefrac2 = place + dc_wall_iscale2;
pix = buf3[(place = vplce3) >> bits]; if (pix) dest[3] = pal3[pix]; vplce3 = place + vince3; pix = buf3[(place = dc_wall_texturefrac3) >> bits]; if (pix) dest[3] = pal3[pix]; dc_wall_texturefrac3 = place + dc_wall_iscale3;
dest += pitch; dest += pitch;
} while (--count); } while (--count);
} }
@ -295,12 +291,9 @@ namespace swrenderer
int count = _count; int count = _count;
const uint8_t *source = _source; const uint8_t *source = _source;
uint8_t *dest = _dest; uint8_t *dest = _dest;
int bits = _tmvlinebits; int bits = _fracbits;
int pitch = _pitch; int pitch = _pitch;
uint32_t *fg2rgb = _srcblend;
uint32_t *bg2rgb = _destblend;
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
return; return;
@ -329,13 +322,10 @@ namespace swrenderer
{ {
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int bits = _tmvlinebits; int bits = _fracbits;
uint32_t *fg2rgb = _srcblend; uint32_t dc_wall_texturefrac[4] = { _texturefrac[0], _texturefrac[1], _texturefrac[2], _texturefrac[3] };
uint32_t *bg2rgb = _destblend; uint32_t dc_wall_iscale[4] = { _iscale[0], _iscale[1], _iscale[2], _iscale[3] };
uint32_t vplce[4] = { _vplce[0], _vplce[1], _vplce[2], _vplce[3] };
uint32_t vince[4] = { _vince[0], _vince[1], _vince[2], _vince[3] };
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
@ -346,8 +336,8 @@ namespace swrenderer
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
vplce[i] += vince[i] * skipped; dc_wall_texturefrac[i] += dc_wall_iscale[i] * skipped;
vince[i] *= thread->num_cores; dc_wall_iscale[i] *= thread->num_cores;
} }
pitch *= thread->num_cores; pitch *= thread->num_cores;
@ -355,15 +345,15 @@ namespace swrenderer
{ {
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
uint8_t pix = _bufplce[i][vplce[i] >> bits]; uint8_t pix = _source[i][dc_wall_texturefrac[i] >> bits];
if (pix != 0) if (pix != 0)
{ {
uint32_t r = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].r + GPalette.BaseColors[dest[i]].r, 255); uint32_t r = MIN(GPalette.BaseColors[_colormap[i][pix]].r + GPalette.BaseColors[dest[i]].r, 255);
uint32_t g = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].g + GPalette.BaseColors[dest[i]].g, 255); uint32_t g = MIN(GPalette.BaseColors[_colormap[i][pix]].g + GPalette.BaseColors[dest[i]].g, 255);
uint32_t b = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].b + GPalette.BaseColors[dest[i]].b, 255); uint32_t b = MIN(GPalette.BaseColors[_colormap[i][pix]].b + GPalette.BaseColors[dest[i]].b, 255);
dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2]; dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2];
} }
vplce[i] += vince[i]; dc_wall_texturefrac[i] += dc_wall_iscale[i];
} }
dest += pitch; dest += pitch;
} while (--count); } while (--count);
@ -377,12 +367,9 @@ namespace swrenderer
int count = _count; int count = _count;
const uint8_t *source = _source; const uint8_t *source = _source;
uint8_t *dest = _dest; uint8_t *dest = _dest;
int bits = _tmvlinebits; int bits = _fracbits;
int pitch = _pitch; int pitch = _pitch;
uint32_t *fg2rgb = _srcblend;
uint32_t *bg2rgb = _destblend;
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
return; return;
@ -411,13 +398,10 @@ namespace swrenderer
{ {
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int bits = _tmvlinebits; int bits = _fracbits;
uint32_t *fg2rgb = _srcblend; uint32_t dc_wall_texturefrac[4] = { _texturefrac[0], _texturefrac[1], _texturefrac[2], _texturefrac[3] };
uint32_t *bg2rgb = _destblend; uint32_t dc_wall_iscale[4] = { _iscale[0], _iscale[1], _iscale[2], _iscale[3] };
uint32_t vplce[4] = { _vplce[0], _vplce[1], _vplce[2], _vplce[3] };
uint32_t vince[4] = { _vince[0], _vince[1], _vince[2], _vince[3] };
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
@ -428,8 +412,8 @@ namespace swrenderer
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
vplce[i] += vince[i] * skipped; dc_wall_texturefrac[i] += dc_wall_iscale[i] * skipped;
vince[i] *= thread->num_cores; dc_wall_iscale[i] *= thread->num_cores;
} }
pitch *= thread->num_cores; pitch *= thread->num_cores;
@ -437,15 +421,15 @@ namespace swrenderer
{ {
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
uint8_t pix = _bufplce[i][vplce[i] >> bits]; uint8_t pix = _source[i][dc_wall_texturefrac[i] >> bits];
if (pix != 0) if (pix != 0)
{ {
uint32_t r = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].r + GPalette.BaseColors[dest[i]].r, 255); uint32_t r = MIN(GPalette.BaseColors[_colormap[i][pix]].r + GPalette.BaseColors[dest[i]].r, 255);
uint32_t g = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].g + GPalette.BaseColors[dest[i]].g, 255); uint32_t g = MIN(GPalette.BaseColors[_colormap[i][pix]].g + GPalette.BaseColors[dest[i]].g, 255);
uint32_t b = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].b + GPalette.BaseColors[dest[i]].b, 255); uint32_t b = MIN(GPalette.BaseColors[_colormap[i][pix]].b + GPalette.BaseColors[dest[i]].b, 255);
dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2]; dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2];
} }
vplce[i] += vince[i]; dc_wall_texturefrac[i] += dc_wall_iscale[i];
} }
dest += pitch; dest += pitch;
} while (--count); } while (--count);
@ -459,12 +443,9 @@ namespace swrenderer
int count = _count; int count = _count;
const uint8_t *source = _source; const uint8_t *source = _source;
uint8_t *dest = _dest; uint8_t *dest = _dest;
int bits = _tmvlinebits; int bits = _fracbits;
int pitch = _pitch; int pitch = _pitch;
uint32_t *fg2rgb = _srcblend;
uint32_t *bg2rgb = _destblend;
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
return; return;
@ -493,13 +474,10 @@ namespace swrenderer
{ {
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int bits = _tmvlinebits; int bits = _fracbits;
uint32_t *fg2rgb = _srcblend; uint32_t dc_wall_texturefrac[4] = { _texturefrac[0], _texturefrac[1], _texturefrac[2], _texturefrac[3] };
uint32_t *bg2rgb = _destblend; uint32_t dc_wall_iscale[4] = { _iscale[0], _iscale[1], _iscale[2], _iscale[3] };
uint32_t vplce[4] = { _vplce[0], _vplce[1], _vplce[2], _vplce[3] };
uint32_t vince[4] = { _vince[0], _vince[1], _vince[2], _vince[3] };
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
@ -510,8 +488,8 @@ namespace swrenderer
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
vplce[i] += vince[i] * skipped; dc_wall_texturefrac[i] += dc_wall_iscale[i] * skipped;
vince[i] *= thread->num_cores; dc_wall_iscale[i] *= thread->num_cores;
} }
pitch *= thread->num_cores; pitch *= thread->num_cores;
@ -519,15 +497,15 @@ namespace swrenderer
{ {
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
uint8_t pix = _bufplce[i][vplce[i] >> bits]; uint8_t pix = _source[i][dc_wall_texturefrac[i] >> bits];
if (pix != 0) if (pix != 0)
{ {
int r = clamp(-GPalette.BaseColors[_palookupoffse[i][pix]].r + GPalette.BaseColors[dest[i]].r, 0, 255); int r = clamp(-GPalette.BaseColors[_colormap[i][pix]].r + GPalette.BaseColors[dest[i]].r, 0, 255);
int g = clamp(-GPalette.BaseColors[_palookupoffse[i][pix]].g + GPalette.BaseColors[dest[i]].g, 0, 255); int g = clamp(-GPalette.BaseColors[_colormap[i][pix]].g + GPalette.BaseColors[dest[i]].g, 0, 255);
int b = clamp(-GPalette.BaseColors[_palookupoffse[i][pix]].b + GPalette.BaseColors[dest[i]].b, 0, 255); int b = clamp(-GPalette.BaseColors[_colormap[i][pix]].b + GPalette.BaseColors[dest[i]].b, 0, 255);
dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2]; dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2];
} }
vplce[i] += vince[i]; dc_wall_texturefrac[i] += dc_wall_iscale[i];
} }
dest += pitch; dest += pitch;
} while (--count); } while (--count);
@ -541,12 +519,9 @@ namespace swrenderer
int count = _count; int count = _count;
const uint8_t *source = _source; const uint8_t *source = _source;
uint8_t *dest = _dest; uint8_t *dest = _dest;
int bits = _tmvlinebits; int bits = _fracbits;
int pitch = _pitch; int pitch = _pitch;
uint32_t *fg2rgb = _srcblend;
uint32_t *bg2rgb = _destblend;
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
return; return;
@ -575,13 +550,10 @@ namespace swrenderer
{ {
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int bits = _tmvlinebits; int bits = _fracbits;
uint32_t *fg2rgb = _srcblend; uint32_t dc_wall_texturefrac[4] = { _texturefrac[0], _texturefrac[1], _texturefrac[2], _texturefrac[3] };
uint32_t *bg2rgb = _destblend; uint32_t dc_wall_iscale[4] = { _iscale[0], _iscale[1], _iscale[2], _iscale[3] };
uint32_t vplce[4] = { _vplce[0], _vplce[1], _vplce[2], _vplce[3] };
uint32_t vince[4] = { _vince[0], _vince[1], _vince[2], _vince[3] };
count = thread->count_for_thread(_dest_y, count); count = thread->count_for_thread(_dest_y, count);
if (count <= 0) if (count <= 0)
@ -592,8 +564,8 @@ namespace swrenderer
dest = thread->dest_for_thread(_dest_y, pitch, dest); dest = thread->dest_for_thread(_dest_y, pitch, dest);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
vplce[i] += vince[i] * skipped; dc_wall_texturefrac[i] += dc_wall_iscale[i] * skipped;
vince[i] *= thread->num_cores; dc_wall_iscale[i] *= thread->num_cores;
} }
pitch *= thread->num_cores; pitch *= thread->num_cores;
@ -601,15 +573,15 @@ namespace swrenderer
{ {
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
uint8_t pix = _bufplce[i][vplce[i] >> bits]; uint8_t pix = _source[i][dc_wall_texturefrac[i] >> bits];
if (pix != 0) if (pix != 0)
{ {
uint32_t r = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].r - GPalette.BaseColors[dest[i]].r, 0, 255); uint32_t r = clamp(GPalette.BaseColors[_colormap[i][pix]].r - GPalette.BaseColors[dest[i]].r, 0, 255);
uint32_t g = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].g - GPalette.BaseColors[dest[i]].g, 0, 255); uint32_t g = clamp(GPalette.BaseColors[_colormap[i][pix]].g - GPalette.BaseColors[dest[i]].g, 0, 255);
uint32_t b = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].b - GPalette.BaseColors[dest[i]].b, 0, 255); uint32_t b = clamp(GPalette.BaseColors[_colormap[i][pix]].b - GPalette.BaseColors[dest[i]].b, 0, 255);
dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2]; dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2];
} }
vplce[i] += vince[i]; dc_wall_texturefrac[i] += dc_wall_iscale[i];
} }
dest += _pitch; dest += _pitch;
} while (--count); } while (--count);
@ -626,11 +598,11 @@ namespace swrenderer
_pitch = dc_pitch; _pitch = dc_pitch;
for (int col = 0; col < 4; col++) for (int col = 0; col < 4; col++)
{ {
_bufplce[col] = bufplce[col]; _source[col] = dc_wall_source[col];
_bufplce2[col] = bufplce2[col]; _source2[col] = dc_wall_source2[col];
_bufheight[col] = bufheight[col]; _sourceheight[col] = dc_wall_sourceheight[col];
_vince[col] = vince[col]; _iscale[col] = dc_wall_iscale[col];
_vplce[col] = vplce[col]; _texturefrac[col] = dc_wall_texturefrac[col];
} }
} }
@ -639,11 +611,11 @@ namespace swrenderer
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int pitch = _pitch; int pitch = _pitch;
const uint8_t *source0 = _bufplce[0]; const uint8_t *source0 = _source[0];
int textureheight0 = _bufheight[0]; int textureheight0 = _sourceheight[0];
int32_t frac = _vplce[0]; int32_t frac = _texturefrac[0];
int32_t fracstep = _vince[0]; int32_t fracstep = _iscale[0];
int start_fade = 2; // How fast it should fade out int start_fade = 2; // How fast it should fade out
@ -704,11 +676,11 @@ namespace swrenderer
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int pitch = _pitch; int pitch = _pitch;
const uint8_t *source0[4] = { _bufplce[0], _bufplce[1], _bufplce[2], _bufplce[3] }; const uint8_t *source0[4] = { _source[0], _source[1], _source[2], _source[3] };
int textureheight0 = _bufheight[0]; int textureheight0 = _sourceheight[0];
const uint32_t *palette = (const uint32_t *)GPalette.BaseColors; const uint32_t *palette = (const uint32_t *)GPalette.BaseColors;
int32_t frac[4] = { (int32_t)_vplce[0], (int32_t)_vplce[1], (int32_t)_vplce[2], (int32_t)_vplce[3] }; int32_t frac[4] = { (int32_t)_texturefrac[0], (int32_t)_texturefrac[1], (int32_t)_texturefrac[2], (int32_t)_texturefrac[3] };
int32_t fracstep[4] = { (int32_t)_vince[0], (int32_t)_vince[1], (int32_t)_vince[2], (int32_t)_vince[3] }; int32_t fracstep[4] = { (int32_t)_iscale[0], (int32_t)_iscale[1], (int32_t)_iscale[2], (int32_t)_iscale[3] };
uint8_t output[4]; uint8_t output[4];
int start_fade = 2; // How fast it should fade out int start_fade = 2; // How fast it should fade out
@ -844,13 +816,13 @@ namespace swrenderer
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int pitch = _pitch; int pitch = _pitch;
const uint8_t *source0 = _bufplce[0]; const uint8_t *source0 = _source[0];
const uint8_t *source1 = _bufplce2[0]; const uint8_t *source1 = _source2[0];
int textureheight0 = _bufheight[0]; int textureheight0 = _sourceheight[0];
uint32_t maxtextureheight1 = _bufheight[1] - 1; uint32_t maxtextureheight1 = _sourceheight[1] - 1;
int32_t frac = _vplce[0]; int32_t frac = _texturefrac[0];
int32_t fracstep = _vince[0]; int32_t fracstep = _iscale[0];
int start_fade = 2; // How fast it should fade out int start_fade = 2; // How fast it should fade out
@ -916,13 +888,13 @@ namespace swrenderer
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int pitch = _pitch; int pitch = _pitch;
const uint8_t *source0[4] = { _bufplce[0], _bufplce[1], _bufplce[2], _bufplce[3] }; const uint8_t *source0[4] = { _source[0], _source[1], _source[2], _source[3] };
const uint8_t *source1[4] = { _bufplce2[0], _bufplce2[1], _bufplce2[2], _bufplce2[3] }; const uint8_t *source1[4] = { _source2[0], _source2[1], _source2[2], _source2[3] };
int textureheight0 = _bufheight[0]; int textureheight0 = _sourceheight[0];
uint32_t maxtextureheight1 = _bufheight[1] - 1; uint32_t maxtextureheight1 = _sourceheight[1] - 1;
const uint32_t *palette = (const uint32_t *)GPalette.BaseColors; const uint32_t *palette = (const uint32_t *)GPalette.BaseColors;
int32_t frac[4] = { (int32_t)_vplce[0], (int32_t)_vplce[1], (int32_t)_vplce[2], (int32_t)_vplce[3] }; int32_t frac[4] = { (int32_t)_texturefrac[0], (int32_t)_texturefrac[1], (int32_t)_texturefrac[2], (int32_t)_texturefrac[3] };
int32_t fracstep[4] = { (int32_t)_vince[0], (int32_t)_vince[1], (int32_t)_vince[2], (int32_t)_vince[3] }; int32_t fracstep[4] = { (int32_t)_iscale[0], (int32_t)_iscale[1], (int32_t)_iscale[2], (int32_t)_iscale[3] };
uint8_t output[4]; uint8_t output[4];
int start_fade = 2; // How fast it should fade out int start_fade = 2; // How fast it should fade out

View file

@ -20,9 +20,7 @@ namespace swrenderer
int _count; int _count;
const uint8_t *_source; const uint8_t *_source;
uint8_t *_dest; uint8_t *_dest;
int _vlinebits; int _fracbits;
int _mvlinebits;
int _tmvlinebits;
int _pitch; int _pitch;
uint32_t *_srcblend; uint32_t *_srcblend;
uint32_t *_destblend; uint32_t *_destblend;
@ -38,13 +36,11 @@ namespace swrenderer
uint8_t *_dest; uint8_t *_dest;
int _count; int _count;
int _pitch; int _pitch;
int _vlinebits; int _fracbits;
int _mvlinebits; uint8_t *_colormap[4];
int _tmvlinebits; const uint8_t *_source[4];
uint8_t *_palookupoffse[4]; uint32_t _iscale[4];
const uint8_t *_bufplce[4]; uint32_t _texturefrac[4];
uint32_t _vince[4];
uint32_t _vplce[4];
uint32_t *_srcblend; uint32_t *_srcblend;
uint32_t *_destblend; uint32_t *_destblend;
}; };
@ -75,11 +71,11 @@ namespace swrenderer
uint8_t *_dest; uint8_t *_dest;
int _count; int _count;
int _pitch; int _pitch;
const uint8_t *_bufplce[4]; const uint8_t *_source[4];
const uint8_t *_bufplce2[4]; const uint8_t *_source2[4];
int _bufheight[4]; int _sourceheight[4];
uint32_t _vince[4]; uint32_t _iscale[4];
uint32_t _vplce[4]; uint32_t _texturefrac[4];
}; };
class DrawSingleSky1PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; }; class DrawSingleSky1PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; };

View file

@ -499,7 +499,6 @@ namespace swrenderer
void DrawColumnRt1ShadedPalCommand::Execute(DrawerThread *thread) void DrawColumnRt1ShadedPalCommand::Execute(DrawerThread *thread)
{ {
uint32_t *fgstart;
const uint8_t *colormap; const uint8_t *colormap;
uint8_t *source; uint8_t *source;
uint8_t *dest; uint8_t *dest;
@ -529,7 +528,6 @@ namespace swrenderer
void DrawColumnRt4ShadedPalCommand::Execute(DrawerThread *thread) void DrawColumnRt4ShadedPalCommand::Execute(DrawerThread *thread)
{ {
uint32_t *fgstart;
const uint8_t *colormap; const uint8_t *colormap;
uint8_t *source; uint8_t *source;
uint8_t *dest; uint8_t *dest;

View file

@ -705,15 +705,15 @@ static void R_DrawSkyColumnStripe(int start_x, int y1, int y2, int columns, doub
angle1 = (DWORD)((UMulScale16(ang, frontcyl) + frontpos) >> FRACBITS); angle1 = (DWORD)((UMulScale16(ang, frontcyl) + frontpos) >> FRACBITS);
angle2 = (DWORD)((UMulScale16(ang, backcyl) + backpos) >> FRACBITS); angle2 = (DWORD)((UMulScale16(ang, backcyl) + backpos) >> FRACBITS);
bufplce[i] = (const BYTE *)frontskytex->GetColumn(angle1, nullptr); dc_wall_source[i] = (const BYTE *)frontskytex->GetColumn(angle1, nullptr);
bufplce2[i] = backskytex ? (const BYTE *)backskytex->GetColumn(angle2, nullptr) : nullptr; dc_wall_source2[i] = backskytex ? (const BYTE *)backskytex->GetColumn(angle2, nullptr) : nullptr;
vince[i] = uv_step; dc_wall_iscale[i] = uv_step;
vplce[i] = uv_pos; dc_wall_texturefrac[i] = uv_pos;
} }
bufheight[0] = height; dc_wall_sourceheight[0] = height;
bufheight[1] = backskytex ? backskytex->GetHeight() : height; dc_wall_sourceheight[1] = backskytex ? backskytex->GetHeight() : height;
dc_dest = (ylookup[y1] + start_x) + dc_destorg; dc_dest = (ylookup[y1] + start_x) + dc_destorg;
dc_count = y2 - y1; dc_count = y2 - y1;

View file

@ -96,7 +96,7 @@ WallSampler::WallSampler(int y1, float swal, double yrepeat, fixed_t xoffset, FT
} }
// Draw a column with support for non-power-of-two ranges // Draw a column with support for non-power-of-two ranges
static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, DWORD(*draw1column)()) static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1column)())
{ {
if (sampler.uv_max == 0 || sampler.uv_step == 0) // power of two if (sampler.uv_max == 0 || sampler.uv_step == 0) // power of two
{ {
@ -151,9 +151,9 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
int count = y2 - y1; int count = y2 - y1;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
bufplce[i] = sampler[i].source; dc_wall_source[i] = sampler[i].source;
vplce[i] = sampler[i].uv_pos; dc_wall_texturefrac[i] = sampler[i].uv_pos;
vince[i] = sampler[i].uv_step; dc_wall_iscale[i] = sampler[i].uv_step;
uint64_t step64 = sampler[i].uv_step; uint64_t step64 = sampler[i].uv_step;
uint64_t pos64 = sampler[i].uv_pos; uint64_t pos64 = sampler[i].uv_pos;
@ -168,7 +168,7 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
dc_dest = (ylookup[y1] + x) + dc_destorg; dc_dest = (ylookup[y1] + x) + dc_destorg;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
bufplce[i] = sampler[i].source; dc_wall_source[i] = sampler[i].source;
} }
uint32_t left = y2 - y1; uint32_t left = y2 - y1;
@ -188,8 +188,8 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
// Draw until that column wraps // Draw until that column wraps
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
vplce[i] = sampler[i].uv_pos; dc_wall_texturefrac[i] = sampler[i].uv_pos;
vince[i] = sampler[i].uv_step; dc_wall_iscale[i] = sampler[i].uv_step;
} }
dc_count = count; dc_count = count;
draw4columns(); draw4columns();
@ -207,13 +207,11 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
} }
} }
typedef DWORD(*Draw1ColumnFuncPtr)(); typedef void(*DrawColumnFuncPtr)();
typedef void(*Draw4ColumnsFuncPtr)();
static void ProcessWallWorker( static void ProcessWallWorker(
int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat,
const BYTE *(*getcol)(FTexture *tex, int x), const BYTE *(*getcol)(FTexture *tex, int x), DrawColumnFuncPtr draw1column, DrawColumnFuncPtr draw4columns)
void(setupProcessNormalWall(int bits, Draw1ColumnFuncPtr &draw1, Draw4ColumnsFuncPtr &draw2)))
{ {
if (rw_pic->UseType == FTexture::TEX_Null) if (rw_pic->UseType == FTexture::TEX_Null)
return; return;
@ -228,17 +226,15 @@ static void ProcessWallWorker(
dc_texturemid = 0; dc_texturemid = 0;
} }
DWORD(*draw1column)(); dc_wall_fracbits = fracbits;
void(*draw4columns)();
setupProcessNormalWall(fracbits, draw1column, draw4columns);
bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0); bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
if (fixed) if (fixed)
{ {
palookupoffse[0] = dc_colormap; dc_wall_colormap[0] = dc_colormap;
palookupoffse[1] = dc_colormap; dc_wall_colormap[1] = dc_colormap;
palookupoffse[2] = dc_colormap; dc_wall_colormap[2] = dc_colormap;
palookupoffse[3] = dc_colormap; dc_wall_colormap[3] = dc_colormap;
} }
if (fixedcolormap) if (fixedcolormap)
@ -331,7 +327,7 @@ static void ProcessWallWorker(
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
palookupoffse[i] = basecolormap->Maps + (GETPALOOKUP(lights[i], wallshade) << COLORMAPSHIFT); dc_wall_colormap[i] = basecolormap->Maps + (GETPALOOKUP(lights[i], wallshade) << COLORMAPSHIFT);
} }
} }
Draw4Columns(x, middle_y1, middle_y2, sampler, draw4columns); Draw4Columns(x, middle_y1, middle_y2, sampler, draw4columns);
@ -367,12 +363,7 @@ static void ProcessWallWorker(
static void ProcessNormalWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn) static void ProcessNormalWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
{ {
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4) ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, R_DrawWallCol1, R_DrawWallCol4);
{
setupvline(bits);
line1 = dovline1;
line4 = dovline4;
});
} }
static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn) static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
@ -383,32 +374,22 @@ static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *s
} }
else else
{ {
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4) ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, R_DrawWallMaskedCol1, R_DrawWallMaskedCol4);
{
setupmvline(bits);
line1 = domvline1;
line4 = domvline4;
});
} }
} }
static void ProcessTranslucentWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn) static void ProcessTranslucentWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
{ {
static fixed_t(*tmvline1)(); void (*drawcol1)();
static void(*tmvline4)(); void (*drawcol4)();
if (!R_GetTransMaskDrawers(&tmvline1, &tmvline4)) if (!R_GetTransMaskDrawers(&drawcol1, &drawcol4))
{ {
// The current translucency is unsupported, so draw with regular ProcessMaskedWall instead. // The current translucency is unsupported, so draw with regular ProcessMaskedWall instead.
ProcessMaskedWall(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol); ProcessMaskedWall(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol);
} }
else else
{ {
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4) ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, drawcol1, drawcol4);
{
setuptmvline(bits);
line1 = reinterpret_cast<DWORD(*)()>(tmvline1);
line4 = tmvline4;
});
} }
} }

View file

@ -527,7 +527,9 @@ inline bool Writer<StringBuffer>::WriteDouble(double d) {
if (!(kWriteDefaultFlags & kWriteNanAndInfFlag)) if (!(kWriteDefaultFlags & kWriteNanAndInfFlag))
{ {
// At least ensure that the output does not get broken. // At least ensure that the output does not get broken.
PutReserve(*os_, 1); PutReserve(*os_, 3);
PutUnsafe(*os_, '0');
PutUnsafe(*os_, '.');
PutUnsafe(*os_, '0'); PutUnsafe(*os_, '0');
return false; return false;
} }

View file

@ -125,25 +125,26 @@ extend class Actor
void A_VileAttack(sound snd = "vile/stop", int initialdmg = 20, int blastdmg = 70, int blastradius = 70, double thrust = 1.0, name damagetype = "Fire", int flags = 0) void A_VileAttack(sound snd = "vile/stop", int initialdmg = 20, int blastdmg = 70, int blastradius = 70, double thrust = 1.0, name damagetype = "Fire", int flags = 0)
{ {
if (target) Actor targ = target;
if (targ)
{ {
A_FaceTarget(); A_FaceTarget();
if (!CheckSight(target, 0)) return; if (!CheckSight(targ, 0)) return;
A_PlaySound(snd, CHAN_WEAPON); A_PlaySound(snd, CHAN_WEAPON);
int newdam = target.DamageMobj (self, self, initialdmg, (flags & VAF_DMGTYPEAPPLYTODIRECT)? damagetype : 'none'); int newdam = targ.DamageMobj (self, self, initialdmg, (flags & VAF_DMGTYPEAPPLYTODIRECT)? damagetype : 'none');
TraceBleed (newdam > 0 ? newdam : initialdmg, target); TraceBleed (newdam > 0 ? newdam : initialdmg, targ);
Actor fire = tracer; Actor fire = tracer;
if (fire) if (fire)
{ {
// move the fire between the vile and the player // move the fire between the vile and the player
fire.SetOrigin(target.Vec3Angle(-24., angle, 0), true); fire.SetOrigin(targ.Vec3Angle(-24., angle, 0), true);
fire.A_Explode(blastdmg, blastradius, XF_NOSPLASH, false, 0, 0, 0, "BulletPuff", damagetype); fire.A_Explode(blastdmg, blastradius, XF_NOSPLASH, false, 0, 0, 0, "BulletPuff", damagetype);
} }
if (!target.bDontThrust) if (!targ.bDontThrust)
{ {
target.Vel.z = thrust * 1000 / max(1, target.Mass); targ.Vel.z = thrust * 1000 / max(1, targ.Mass);
} }
} }
} }