This commit is contained in:
Rachael Alexanderson 2017-06-04 21:04:33 -04:00
commit 5d40b2c36c
11 changed files with 104 additions and 17 deletions

View file

@ -595,7 +595,12 @@ xx(portal_floor_nopass)
xx(portal_floor_norender)
xx(portal_floor_overlaytype)
xx(portal_floor_useglobaltex)
xx(scroll_ceil_x)
xx(scroll_ceil_y)
xx(scroll_ceil_type)
xx(scroll_floor_x)
xx(scroll_floor_y)
xx(scroll_floor_type)
xx(offsetx_top)
xx(offsety_top)
@ -918,3 +923,7 @@ xx(DynArray)
xx(Struct)
xx(ReflectType)
xx(MessageBoxMenu)
xx(Both)
xx(Physical)
xx(Visual)

View file

@ -3877,7 +3877,7 @@ bool AActor::IsOkayToAttack (AActor *link)
void AActor::SetShade (uint32_t rgb)
{
PalEntry *entry = (PalEntry *)&rgb;
fillcolor = rgb | (ColorMatcher.Pick (entry->r, entry->g, entry->b) << 24);
fillcolor = (rgb & 0xffffff) | (ColorMatcher.Pick (entry->r, entry->g, entry->b) << 24);
}
void AActor::SetShade (int r, int g, int b)
@ -6062,7 +6062,8 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
if (mthing->score)
mobj->Score = mthing->score;
if (mthing->fillcolor)
mobj->fillcolor = mthing->fillcolor;
mobj->fillcolor = (mthing->fillcolor & 0xffffff) | (ColorMatcher.Pick((mthing->fillcolor & 0xff0000) >> 16,
(mthing->fillcolor & 0xff00) >> 8, (mthing->fillcolor & 0xff)) << 24);
mobj->CallBeginPlay ();
if (!(mobj->ObjectFlags & OF_EuthanizeMe))

View file

@ -48,6 +48,7 @@
#include "w_wad.h"
#include "p_tags.h"
#include "p_terrain.h"
#include "p_spec.h"
#include "g_levellocals.h"
#include "info.h"
#include "vm.h"
@ -443,6 +444,14 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, GetUDMFString)
//
//===========================================================================
struct UDMFScroll
{
bool ceiling;
int index;
double x, y;
FName type;
};
class UDMFParser : public UDMFParserBase
{
bool isTranslated;
@ -454,6 +463,7 @@ class UDMFParser : public UDMFParserBase
TArray<intmapsidedef_t> ParsedSideTextures;
TArray<sector_t> ParsedSectors;
TArray<vertex_t> ParsedVertices;
TArray<UDMFScroll> UDMFScrollers;
FDynamicColormap *fogMap, *normMap;
FMissingTextureTracker &missingTex;
@ -1348,6 +1358,16 @@ public:
double fp[4] = { 0 }, cp[4] = { 0 };
FString tagstring;
// Brand new UDMF scroller properties
double scroll_ceil_x = 0;
double scroll_ceil_y = 0;
FName scroll_ceil_type;
double scroll_floor_x = 0;
double scroll_floor_y = 0;
FName scroll_floor_type;
memset(sec, 0, sizeof(*sec));
sec->lightlevel = 160;
sec->SetXScale(sector_t::floor, 1.); // [RH] floor and ceiling scaling
@ -1726,6 +1746,30 @@ public:
else if (!stricmp(CheckString(key), "additive")) sec->planes[sector_t::floor].Flags |= PLANEF_ADDITIVE;
break;
case NAME_scroll_ceil_x:
scroll_ceil_x = CheckFloat(key);
break;
case NAME_scroll_ceil_y:
scroll_ceil_y = CheckFloat(key);
break;
case NAME_scroll_ceil_type:
scroll_ceil_type = CheckString(key);
break;
case NAME_scroll_floor_x:
scroll_floor_x = CheckFloat(key);
break;
case NAME_scroll_floor_y:
scroll_floor_y = CheckFloat(key);
break;
case NAME_scroll_floor_type:
scroll_floor_type = CheckString(key);
break;
// These two are used by Eternity for something I do not understand.
//case NAME_portal_ceil_useglobaltex:
//case NAME_portal_floor_useglobaltex:
@ -1759,6 +1803,17 @@ public:
sec->leakydamage = 0;
sec->Flags &= ~SECF_DAMAGEFLAGS;
}
// Cannot be initialized yet because they need the final sector array.
if (scroll_ceil_type != NAME_None)
{
UDMFScrollers.Push({ true, index, scroll_ceil_x, scroll_ceil_y, scroll_ceil_type });
}
if (scroll_floor_type != NAME_None)
{
UDMFScrollers.Push({ false, index, scroll_floor_x, scroll_floor_y, scroll_floor_type });
}
// Reset the planes to their defaults if not all of the plane equation's parameters were found.
if (fplaneflags != 15)
@ -2110,6 +2165,20 @@ public:
{
level.sectors[i].e = &level.sectors[0].e[i];
}
// Now create the scrollers.
for (auto &scroll : UDMFScrollers)
{
const double scrollfactor = 1 / 3.2; // I hope this is correct, it's just a guess taken from Eternity's code.
if (scroll.type == NAME_Both || scroll.type == NAME_Visual)
{
P_CreateScroller(scroll.ceiling ? EScroll::sc_ceiling : EScroll::sc_floor, scroll.x * scrollfactor, scroll.y * scrollfactor, -1, scroll.index, 0);
}
if (scroll.type == NAME_Both || scroll.type == NAME_Physical)
{
// sc_carry_ceiling doesn't do anything yet.
P_CreateScroller(scroll.ceiling ? EScroll::sc_carry_ceiling : EScroll::sc_carry, scroll.x * scrollfactor, scroll.y * scrollfactor, -1, scroll.index, 0);
}
}
// Create the real linedefs and decompress the sidedefs
ProcessLineDefs();

View file

@ -5975,7 +5975,7 @@ ExpEmit FxRandomSeed::Emit(VMFunctionBuilder *build)
build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, build->GetConstantAddress(rng));
EmitParameter(build, seed, ScriptPosition);
build->Emit(opcode, build->GetConstantAddress(callfunc), 2, 1);
build->Emit(opcode, build->GetConstantAddress(callfunc), 2, 0);
ExpEmit call;
if (EmitTail) call.Final = true;

View file

@ -1396,7 +1396,7 @@ namespace swrenderer
int color = args.SolidColor();
do
{
uint32_t val = source[frac >> FRACBITS];
uint32_t val = colormap[source[frac >> FRACBITS]] << 2;
int r = (palette[*dest].r * (255-val) + palette[color].r * val) >> 10;
int g = (palette[*dest].g * (255-val) + palette[color].g * val) >> 10;
@ -1439,7 +1439,7 @@ namespace swrenderer
int color = args.SolidColor();
do
{
uint32_t val = source[frac >> FRACBITS];
uint32_t val = colormap[source[frac >> FRACBITS]] << 2;
int r = (palette[*dest].r * (255) + palette[color].r * val) >> 10;
int g = (palette[*dest].g * (255) + palette[color].g * val) >> 10;

View file

@ -194,7 +194,8 @@ namespace swrenderer
uint32_t srcalpha = args.SrcAlpha() >> (FRACBITS - 8);
uint32_t destalpha = args.DestAlpha() >> (FRACBITS - 8);
uint32_t srccolor = args.SrcColorBgra();
uint32_t color = LightBgra::shade_pal_index_simple(args.SolidColor(), light);
uint32_t color = LightBgra::shade_bgra_simple(args.SolidColorBgra(),
LightBgra::calc_light_multiplier(light));
for (int index = 0; index < count; index++)
{
@ -290,7 +291,7 @@ namespace swrenderer
{
using namespace DrawSprite32TModes;
if (BlendT::Mode == (int)SpriteBlendModes::Copy || BlendT::Mode == (int)SpriteBlendModes::Shaded)
if (BlendT::Mode == (int)SpriteBlendModes::Copy)
return fgcolor;
if (ShadeModeT::Mode == (int)ShadeMode::Simple)
@ -340,9 +341,9 @@ namespace swrenderer
{
uint32_t alpha = ifgshade;
BgraColor outcolor;
outcolor.r = ((fgcolor.r * alpha) >> 8) + bgcolor.r;
outcolor.g = ((fgcolor.g * alpha) >> 8) + bgcolor.g;
outcolor.b = ((fgcolor.b * alpha) >> 8) + bgcolor.b;
outcolor.r = MIN<uint32_t>(((fgcolor.r * alpha) >> 8) + bgcolor.r, 255);
outcolor.g = MIN<uint32_t>(((fgcolor.g * alpha) >> 8) + bgcolor.g, 255);
outcolor.b = MIN<uint32_t>(((fgcolor.b * alpha) >> 8) + bgcolor.b, 255);
outcolor.a = 255;
return outcolor;
}

View file

@ -185,7 +185,8 @@ namespace swrenderer
uint32_t srcalpha = args.SrcAlpha() >> (FRACBITS - 8);
uint32_t destalpha = args.DestAlpha() >> (FRACBITS - 8);
uint32_t srccolor = args.SrcColorBgra();
uint32_t color = LightBgra::shade_pal_index_simple(args.SolidColor(), light);
uint32_t color = LightBgra::shade_bgra_simple(args.SolidColorBgra(),
LightBgra::calc_light_multiplier(light));
int ssecount = count / 2;
for (int index = 0; index < ssecount; index++)
@ -325,7 +326,7 @@ namespace swrenderer
{
using namespace DrawSprite32TModes;
if (BlendT::Mode == (int)SpriteBlendModes::Copy || BlendT::Mode == (int)SpriteBlendModes::Shaded)
if (BlendT::Mode == (int)SpriteBlendModes::Copy)
return fgcolor;
if (ShadeModeT::Mode == (int)ShadeMode::Simple)

View file

@ -105,7 +105,9 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
drawerargs.SetTranslationMap(translation);
drawerargs.SetLight(basecolormap, 0.0f, shade);
uint32_t myfillcolor = (RGB256k.All[((parms.fillcolor & 0xfc0000) >> 6) | ((parms.fillcolor & 0xfc00) >> 4) | ((parms.fillcolor & 0xfc) >> 2)]) << 24;
uint32_t myfillcolor = (RGB256k.All[((parms.fillcolor & 0xfc0000) >> 6) |
((parms.fillcolor & 0xfc00) >> 4) | ((parms.fillcolor & 0xfc) >> 2)]) << 24 |
(parms.fillcolor & 0xffffff);
bool visible = drawerargs.SetStyle(viewport, parms.style, parms.Alpha, -1, myfillcolor, basecolormap);
double x0 = parms.x - parms.left * parms.destwidth / parms.texwidth;

View file

@ -440,6 +440,7 @@ namespace swrenderer
drawer_needs_pal_input = true;
CameraLight *cameraLight = CameraLight::Instance();
dc_color = cameraLight->FixedColormap() ? cameraLight->FixedColormap()->Maps[APART(color)] : basecolormap->Maps[APART(color)];
dc_color_bgra = color;
basecolormap = &ShadeFakeColormap[16 - alpha];
if (cameraLight->FixedLightLevel() >= 0 && !cameraLight->FixedColormap())
{
@ -465,6 +466,7 @@ namespace swrenderer
uint32_t b = BPART(color);
// dc_color is used by the rt_* routines. It is indexed into dc_srcblend.
dc_color = RGB256k.RGB[r >> 2][g >> 2][b >> 2];
dc_color_bgra = color;
if (style.Flags & STYLEF_InvertSource)
{
r = 255 - r;

View file

@ -19,7 +19,7 @@ namespace swrenderer
bool SetStyle(RenderViewport *viewport, FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0);
void SetDest(RenderViewport *viewport, int x, int y);
void SetCount(int count) { dc_count = count; }
void SetSolidColor(int color) { dc_color = color; }
void SetSolidColor(int color) { dc_color = color; dc_color_bgra = GPalette.BaseColors[color]; }
void SetDynamicLight(uint32_t color) { dynlightcolor = color; }
void DrawMaskedColumn(RenderThread *thread, int x, fixed_t iscale, FTexture *texture, fixed_t column, double spryscale, double sprtopscreen, bool sprflipvert, const short *mfloorclip, const short *mceilingclip, bool unmasked = false);
@ -39,6 +39,7 @@ namespace swrenderer
fixed_t TextureVStep() const { return dc_iscale; }
int SolidColor() const { return dc_color; }
uint32_t SolidColorBgra() const { return dc_color_bgra; }
uint32_t SrcColorIndex() const { return dc_srccolor; }
uint32_t SrcColorBgra() const { return dc_srccolor_bgra; }
@ -84,6 +85,7 @@ namespace swrenderer
int dc_yh = 0;
int dc_color = 0;
uint32_t dc_color_bgra = 0;
uint32_t dc_srccolor = 0;
uint32_t dc_srccolor_bgra = 0;

View file

@ -523,8 +523,8 @@ class ListMenuItemSlider : ListMenuItemSelectable
double x = SmallFont.StringWidth ("Green") + 8 + mXpos;
double x2 = SmallFont.StringWidth (text) + 8 + mXpos;
mDrawX = MAX(x2, x);
mDrawX = int(MAX(x2, x));
DrawSlider (mDrawX, mYpos);
}
}
}