Merge remote-tracking branch 'gzdoom/master' into qzdoom

This commit is contained in:
Magnus Norddahl 2017-08-03 23:04:01 +02:00
commit b2afcd1502
94 changed files with 1019 additions and 211 deletions

View file

@ -1,5 +1,5 @@
cmake_minimum_required( VERSION 2.8.7 )
project(QZDoom)
project(GZDoom)
if( COMMAND cmake_policy )
if( POLICY CMP0011 )
@ -122,7 +122,7 @@ IF( NOT CMAKE_BUILD_TYPE )
ENDIF()
set( ZDOOM_OUTPUT_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Directory where zdoom.pk3 and the executable will be created." )
set( ZDOOM_EXE_NAME "qzdoom" CACHE FILEPATH "Name of the executable to create" )
set( ZDOOM_EXE_NAME "gzdoom" CACHE FILEPATH "Name of the executable to create" )
if( MSVC )
# Allow the user to use ZDOOM_OUTPUT_DIR as a single release point.
# Use zdoom, zdoomd, zdoom64, and zdoomd64 for the binary names

View file

@ -944,6 +944,7 @@ set (PCH_SOURCES
portal.cpp
r_utility.cpp
r_sky.cpp
r_videoscale.cpp
s_advsound.cpp
s_environment.cpp
s_playlist.cpp

View file

@ -516,6 +516,26 @@ enum ActorBounceFlag
};
// this is a special flag set that is exposed directly to DECORATE/ZScript
// these flags are for filtering actor visibility based on certain conditions of the renderer's feature support.
// currently, no renderer supports every single one of these features.
enum ActorRenderFeatureFlag
{
RFF_FLATSPRITES = 1<<0, // flat sprites
RFF_MODELS = 1<<1, // 3d models
RFF_SLOPE3DFLOORS = 1<<2, // sloped 3d floor support
RFF_TILTPITCH = 1<<3, // full free-look
RFF_ROLLSPRITES = 1<<4, // roll sprites
RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls
RFF_MATSHADER = 1<<6, // material shaders
RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers)
RFF_BRIGHTMAP = 1<<8, // brightmaps
RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife)
RFF_POLYGONAL = 1<<10, // uses polygons instead of wallscans/visplanes (i.e. softpoly and hardware opengl)
RFF_TRUECOLOR = 1<<11, // renderer is currently truecolor
RFF_VOXELS = 1<<12, // renderer is capable of voxels
};
// [TP] Flagset definitions
typedef TFlags<ActorFlag> ActorFlags;
typedef TFlags<ActorFlag2> ActorFlags2;
@ -527,6 +547,7 @@ typedef TFlags<ActorFlag7> ActorFlags7;
typedef TFlags<ActorFlag8> ActorFlags8;
typedef TFlags<ActorRenderFlag> ActorRenderFlags;
typedef TFlags<ActorBounceFlag, uint16_t> ActorBounceFlags;
typedef TFlags<ActorRenderFeatureFlag> ActorRenderFeatureFlags;
DEFINE_TFLAGS_OPERATORS (ActorFlags)
DEFINE_TFLAGS_OPERATORS (ActorFlags2)
DEFINE_TFLAGS_OPERATORS (ActorFlags3)
@ -537,6 +558,7 @@ DEFINE_TFLAGS_OPERATORS (ActorFlags7)
DEFINE_TFLAGS_OPERATORS (ActorFlags8)
DEFINE_TFLAGS_OPERATORS (ActorRenderFlags)
DEFINE_TFLAGS_OPERATORS (ActorBounceFlags)
DEFINE_TFLAGS_OPERATORS (ActorRenderFeatureFlags)
// Used to affect the logic for thing activation through death, USESPECIAL and BUMPSPECIAL
// "thing" refers to what has the flag and the special, "trigger" refers to what used or bumped it
@ -1023,6 +1045,9 @@ public:
uint32_t fillcolor; // Color to draw when STYLE_Shaded
uint32_t Translation;
uint32_t RenderRequired; // current renderer must have this feature set
uint32_t RenderHidden; // current renderer must *not* have any of these features
ActorRenderFlags renderflags; // Different rendering flags
ActorFlags flags;
ActorFlags2 flags2; // Heretic flags

View file

@ -1279,3 +1279,23 @@ CCMD(angleconvtest)
ang, ang1, ang2, ang3);
}
}
extern uint32_t r_renderercaps;
#define PRINT_CAP(X, Y) Printf(" %-18s: %s (%s)\n", #Y, !!(r_renderercaps & Y) ? "Yes" : "No ", X);
CCMD(r_showcaps)
{
Printf("Renderer capabilities:\n");
PRINT_CAP("Flat Sprites", RFF_FLATSPRITES)
PRINT_CAP("3D Models", RFF_MODELS)
PRINT_CAP("Sloped 3D floors", RFF_SLOPE3DFLOORS)
PRINT_CAP("Full Freelook", RFF_TILTPITCH)
PRINT_CAP("Roll Sprites", RFF_ROLLSPRITES)
PRINT_CAP("Unclipped Sprites", RFF_UNCLIPPEDTEX)
PRINT_CAP("Material Shaders", RFF_MATSHADER)
PRINT_CAP("Post-processing Shaders", RFF_POSTSHADER)
PRINT_CAP("Brightmaps", RFF_BRIGHTMAP)
PRINT_CAP("Custom COLORMAP lumps", RFF_COLORMAP)
PRINT_CAP("Uses Polygon rendering", RFF_POLYGONAL)
PRINT_CAP("Truecolor Enabled", RFF_TRUECOLOR)
PRINT_CAP("Voxels", RFF_VOXELS)
}

View file

@ -218,6 +218,7 @@ CUSTOM_CVAR (String, vid_cursor, "None", CVAR_ARCHIVE | CVAR_NOINITCALL)
CVAR (Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
CVAR (Bool, autoloadbrightmaps, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
CVAR (Bool, autoloadlights, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
CVAR (Bool, r_debug_disable_vis_filter, false, 0)
bool wantToRestart;
bool DrawFSHUD; // [RH] Draw fullscreen HUD?
@ -247,6 +248,9 @@ bool batchrun; // just run the startup and collect all error messages in a logfi
cycle_t FrameCycles;
// [SP] Store the capabilities of the renderer in a global variable, to prevent excessive per-frame processing
uint32_t r_renderercaps = 0;
// PRIVATE DATA DEFINITIONS ------------------------------------------------
@ -671,6 +675,7 @@ void D_Display ()
cycles.Clock();
r_UseVanillaTransparency = UseVanillaTransparency(); // [SP] Cache UseVanillaTransparency() call
r_renderercaps = Renderer->GetCaps(); // [SP] Get the current capabilities of the renderer
if (players[consoleplayer].camera == NULL)
{
@ -1017,7 +1022,8 @@ void D_DoomLoop ()
lasttic = gametic;
I_StartFrame ();
}
I_SetFrameTime();
// process one or more tics
if (singletics)
{

View file

@ -64,6 +64,9 @@ bool D_AddFile (TArray<FString> &wadfiles, const char *file, bool check = true,
// [RH] Set this to something to draw an icon during the next screen refresh.
extern const char *D_DrawIcon;
// [SP] Store the capabilities of the renderer in a global variable, to prevent excessive per-frame processing
extern uint32_t r_renderercaps;
struct WadStuff
{

View file

@ -1948,6 +1948,7 @@ void TryRunTics (void)
C_Ticker ();
M_Ticker ();
I_GetTime (true);
I_SetFrameTime();
G_Ticker();
gametic++;

View file

@ -219,7 +219,8 @@ enum ECheatCommand
CHT_BUDDHA,
CHT_NOCLIP2,
CHT_BUDDHA2,
CHT_GOD2
CHT_GOD2,
CHT_MASSACRE2
};
void StartChunk (int id, uint8_t **stream);

View file

@ -1195,7 +1195,7 @@ void G_Ticker ()
}
// check for turbo cheats
if (turbo > 100.f && cmd->ucmd.forwardmove > TURBOTHRESHOLD &&
if (multiplayer && turbo > 100.f && cmd->ucmd.forwardmove > TURBOTHRESHOLD &&
!(gametic&31) && ((gametic>>5)&(MAXPLAYERS-1)) == i )
{
Printf ("%s is turbo!\n", players[i].userinfo.GetName());

View file

@ -694,11 +694,13 @@ const char *G_GetSecretExitMap()
void G_ExitLevel (int position, bool keepFacing)
{
level.flags3 |= LEVEL3_EXITNORMALUSED;
G_ChangeLevel(G_GetExitMap(), position, keepFacing ? CHANGELEVEL_KEEPFACING : 0);
}
void G_SecretExitLevel (int position)
{
level.flags3 |= LEVEL3_EXITSECRETUSED;
G_ChangeLevel(G_GetSecretExitMap(), position, 0);
}
@ -1110,16 +1112,55 @@ void G_WorldDone (void)
}
}
F_StartFinale (thiscluster->MessageMusic, thiscluster->musicorder,
thiscluster->cdtrack, thiscluster->cdid,
thiscluster->FinaleFlat, thiscluster->ExitText,
thiscluster->flags & CLUSTER_EXITTEXTINLUMP,
thiscluster->flags & CLUSTER_FINALEPIC,
thiscluster->flags & CLUSTER_LOOKUPEXITTEXT,
true, endsequence);
auto ext = level.info->ExitMapTexts.CheckKey(level.flags3 & LEVEL3_EXITSECRETUSED ? NAME_Secret : NAME_Normal);
if (ext != nullptr && (ext->mDefined & FExitText::DEF_TEXT))
{
F_StartFinale(ext->mDefined & FExitText::DEF_MUSIC ? ext->mMusic : gameinfo.finaleMusic,
ext->mDefined & FExitText::DEF_MUSIC ? ext->mOrder : gameinfo.finaleOrder,
-1, 0,
ext->mDefined & FExitText::DEF_BACKDROP ? ext->mBackdrop : gameinfo.FinaleFlat,
ext->mText,
false,
ext->mDefined & FExitText::DEF_PIC,
ext->mDefined & FExitText::DEF_LOOKUP,
true, endsequence);
}
else
{
F_StartFinale(thiscluster->MessageMusic, thiscluster->musicorder,
thiscluster->cdtrack, thiscluster->cdid,
thiscluster->FinaleFlat, thiscluster->ExitText,
thiscluster->flags & CLUSTER_EXITTEXTINLUMP,
thiscluster->flags & CLUSTER_FINALEPIC,
thiscluster->flags & CLUSTER_LOOKUPEXITTEXT,
true, endsequence);
}
}
else
{
FExitText *ext = nullptr;
if (level.flags3 & LEVEL3_EXITSECRETUSED) ext = level.info->ExitMapTexts.CheckKey(NAME_Secret);
else if (level.flags3 & LEVEL3_EXITNORMALUSED) ext = level.info->ExitMapTexts.CheckKey(NAME_Normal);
if (ext == nullptr) ext = level.info->ExitMapTexts.CheckKey(nextlevel);
if (ext != nullptr)
{
if ((ext->mDefined & FExitText::DEF_TEXT))
{
F_StartFinale(ext->mDefined & FExitText::DEF_MUSIC ? ext->mMusic : gameinfo.finaleMusic,
ext->mDefined & FExitText::DEF_MUSIC ? ext->mOrder : gameinfo.finaleOrder,
-1, 0,
ext->mDefined & FExitText::DEF_BACKDROP ? ext->mBackdrop : gameinfo.FinaleFlat,
ext->mText,
false,
ext->mDefined & FExitText::DEF_PIC,
ext->mDefined & FExitText::DEF_LOOKUP,
false);
}
return;
}
nextcluster = FindClusterInfo (FindLevelInfo (nextlevel)->cluster);
if (nextcluster->cluster != level.cluster && !deathmatch)

View file

@ -95,6 +95,9 @@ struct FMapInfoParser
void ParseMusic(FString &name, int &order);
//void ParseLumpOrTextureName(char *name);
void ParseLumpOrTextureName(FString &name);
void ParseExitText(FName formap, level_info_t *info);
void ParseExitMusic(FName formap, level_info_t *info);
void ParseExitBackdrop(FName formap, level_info_t *info, bool ispic);
void ParseCluster();
void ParseNextMap(FString &mapname);
@ -241,6 +244,8 @@ enum ELevelFlags : unsigned int
LEVEL3_ATTENUATE = 0x00000004, // attenuate lights?
LEVEL3_NOLIGHTFADE = 0x00000008, // no light fading to black.
LEVEL3_NOCOLOREDSPRITELIGHTING = 0x00000010, // draw sprites only with color-less light
LEVEL3_EXITNORMALUSED = 0x00000020,
LEVEL3_EXITSECRETUSED = 0x00000040,
};
@ -287,6 +292,23 @@ enum EMapType : int
MAPTYPE_UDMF // This does not distinguish between namespaces.
};
struct FExitText
{
enum EDefined
{
DEF_TEXT = 1,
DEF_MUSIC = 2,
DEF_BACKDROP = 4,
DEF_LOOKUP = 8,
DEF_PIC = 16
};
int16_t mDefined = 0;
int16_t mOrder = -1;
FString mText;
FString mMusic;
FString mBackdrop;
};
struct level_info_t
{
int levelnum;
@ -302,6 +324,8 @@ struct level_info_t
FString BorderTexture;
FString MapBackground;
TMap<FName, FExitText> ExitMapTexts;
int cluster;
int partime;
int sucktime;

View file

@ -607,15 +607,6 @@ bool FMapInfoParser::ParseLookupName(FString &dest)
//
//==========================================================================
/*
void FMapInfoParser::ParseLumpOrTextureName(char *name)
{
sc.MustGetString();
uppercopy(name, sc.String);
name[8]=0;
}
*/
void FMapInfoParser::ParseLumpOrTextureName(FString &name)
{
sc.MustGetString();
@ -623,6 +614,91 @@ void FMapInfoParser::ParseLumpOrTextureName(FString &name)
}
//==========================================================================
//
//
//==========================================================================
void FMapInfoParser::ParseExitText(FName formap, level_info_t *info)
{
FString nexttext;
bool nextlookup = ParseLookupName(nexttext);
auto def = info->ExitMapTexts.CheckKey(formap);
if (def != nullptr)
{
def->mText = nexttext;
if (nextlookup) def->mDefined |= FExitText::DEF_LOOKUP;
else def->mDefined &= ~FExitText::DEF_LOOKUP;
def->mDefined |= FExitText::DEF_TEXT;
}
else
{
FExitText def;
def.mText = nexttext;
if (nextlookup) def.mDefined |= FExitText::DEF_LOOKUP;
def.mDefined |= FExitText::DEF_TEXT;
info->ExitMapTexts.Insert(formap, def);
}
}
//==========================================================================
//
//
//==========================================================================
void FMapInfoParser::ParseExitMusic(FName formap, level_info_t *info)
{
FString music;
int order;
ParseMusic(music, order);
auto def = info->ExitMapTexts.CheckKey(formap);
if (def != nullptr)
{
def->mMusic = music;
def->mOrder = order;
def->mDefined |= FExitText::DEF_MUSIC;
}
else
{
FExitText def;
def.mMusic = music;
def.mOrder = order;
def.mDefined |= FExitText::DEF_MUSIC;
info->ExitMapTexts.Insert(formap, def);
}
}
//==========================================================================
//
//
//==========================================================================
void FMapInfoParser::ParseExitBackdrop(FName formap, level_info_t *info, bool ispic)
{
FString drop;
ParseLumpOrTextureName(drop);
auto def = info->ExitMapTexts.CheckKey(formap);
if (def != nullptr)
{
def->mBackdrop = drop;
def->mDefined |= FExitText::DEF_BACKDROP;
if (ispic) def->mDefined |= FExitText::DEF_PIC;
else def->mDefined &= ~FExitText::DEF_PIC;
}
else
{
FExitText def;
def.mBackdrop = drop;
def.mDefined |= FExitText::DEF_BACKDROP;
def.mDefined |= FExitText::DEF_MUSIC;
if (ispic) def.mDefined |= FExitText::DEF_PIC;
info->ExitMapTexts.Insert(formap, def);
}
}
//==========================================================================
//
//
@ -1177,6 +1253,42 @@ DEFINE_MAP_OPTION(mapbackground, true)
parse.ParseLumpOrTextureName(info->MapBackground);
}
DEFINE_MAP_OPTION(exittext, false)
{
parse.ParseAssign();
parse.sc.MustGetString();
FName nextmap = parse.sc.String;
parse.ParseComma();
parse.ParseExitText(nextmap, info);
}
DEFINE_MAP_OPTION(textmusic, false)
{
parse.ParseAssign();
parse.sc.MustGetString();
FName nextmap = parse.sc.String;
parse.ParseComma();
parse.ParseExitMusic(nextmap, info);
}
DEFINE_MAP_OPTION(textflat, false)
{
parse.ParseAssign();
parse.sc.MustGetString();
FName nextmap = parse.sc.String;
parse.ParseComma();
parse.ParseExitBackdrop(nextmap, info, false);
}
DEFINE_MAP_OPTION(textpic, false)
{
parse.ParseAssign();
parse.sc.MustGetString();
FName nextmap = parse.sc.String;
parse.ParseComma();
parse.ParseExitBackdrop(nextmap, info, true);
}
DEFINE_MAP_OPTION(defaultenvironment, false)
{
int id;

View file

@ -414,6 +414,8 @@ void FMapInfoParser::ParseGameInfo()
else
{
DPrintf(DMSG_ERROR, "Unknown GAMEINFO key \"%s\" found in %s:%i\n", nextKey.GetChars(), sc.ScriptName.GetChars(), sc.Line);
// ignore unkown keys.
sc.UnGet();
SkipToNext();

View file

@ -285,13 +285,11 @@ struct FModelVertex
void SetNormal(float nx, float ny, float nz)
{
/*
int inx = int(nx * 512);
int iny = int(ny * 512);
int inz = int(nz * 512);
packedNormal = 0x40000000 | ((inx & 1023) << 20) | ((iny & 1023) << 10) | (inz & 1023);
*/
packedNormal = 0; // Per-pixel lighting for models isn't implemented yet so leave this at 0 for now.
int inx = clamp(int(nx * 512), -512, 511);
int iny = clamp(int(ny * 512), -512, 511);
int inz = clamp(int(nz * 512), -512, 511);
int inw = 0;
packedNormal = (inw << 30) | ((inz & 1023) << 20) | ((iny & 1023) << 10) | (inx & 1023);
}
};

View file

@ -248,7 +248,7 @@ unsigned int FModelVertexBuffer::SetupFrame(unsigned int frame1, unsigned int fr
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].x);
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].u);
glVertexAttribPointer(VATTR_VERTEX2, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame2].x);
glVertexAttribPointer(VATTR_NORMAL, 4, GL_UNSIGNED_INT_2_10_10_10_REV, false, sizeof(FModelVertex), &VMO[frame2].packedNormal);
glVertexAttribPointer(VATTR_NORMAL, 4, GL_INT_2_10_10_10_REV, true, sizeof(FModelVertex), &VMO[frame2].packedNormal);
}
else
{

View file

@ -133,14 +133,14 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
if (parms.style.Flags & STYLEF_ColorIsFixed)
{
color = parms.fillcolor;
std::swap(color.r, color.b);
}
else
{
color = PalEntry(light, light, light);
}
color.a = (uint8_t)(parms.Alpha * 255);
color = PalEntry((color.a * parms.color.a) / 255, (color.r * parms.color.r) / 255, (color.g * parms.color.g) / 255, (color.b * parms.color.b) / 255);
// red and blue channels are swapped to use value as vertex color
color = PalEntry((color.a * parms.color.a) / 255, (color.b * parms.color.b) / 255, (color.g * parms.color.g) / 255, (color.r * parms.color.r) / 255);
// scissor test doesn't use the current viewport for the coordinates, so use real screen coordinates
dg.mScissor[0] = GLRenderer->ScreenToWindowX(parms.lclip);

View file

@ -65,6 +65,7 @@
#include "gl/shaders/gl_postprocessshader.h"
#include "gl/renderer/gl_2ddrawer.h"
#include "gl/stereo3d/gl_stereo3d.h"
#include "r_videoscale.h"
//==========================================================================
//
@ -114,7 +115,7 @@ CUSTOM_CVAR(Int, gl_ssao, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
self = 0;
}
CUSTOM_CVAR(Int, gl_ssao_portals, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CUSTOM_CVAR(Int, gl_ssao_portals, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
if (self < 0)
self = 0;
@ -854,8 +855,16 @@ void FGLRenderer::DrawPresentTexture(const GL_IRECT &box, bool applyGamma)
glViewport(box.left, box.top, box.width, box.height);
glActiveTexture(GL_TEXTURE0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (ViewportLinearScale())
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
mPresentShader->Bind();
mPresentShader->InputTexture.Set(0);

View file

@ -72,8 +72,10 @@
#include "gl/utility/gl_templates.h"
#include "gl/models/gl_models.h"
#include "gl/dynlights/gl_lightbuffer.h"
#include "r_videoscale.h"
EXTERN_CVAR(Int, screenblocks)
EXTERN_CVAR(Int, vid_scalemode)
CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE);
@ -281,9 +283,19 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds)
}
int screenWidth = framebuffer->GetWidth();
int screenHeight = framebuffer->GetHeight();
float scale = MIN(clientWidth / (float)screenWidth, clientHeight / (float)screenHeight);
mOutputLetterbox.width = (int)round(screenWidth * scale);
mOutputLetterbox.height = (int)round(screenHeight * scale);
float scaleX, scaleY;
if (ViewportIsScaled43())
{
scaleX = MIN(clientWidth / (float)screenWidth, clientHeight / (screenHeight * 1.2f));
scaleY = scaleX * 1.2f;
}
else
{
scaleX = MIN(clientWidth / (float)screenWidth, clientHeight / (float)screenHeight);
scaleY = scaleX;
}
mOutputLetterbox.width = (int)round(screenWidth * scaleX);
mOutputLetterbox.height = (int)round(screenHeight * scaleY);
mOutputLetterbox.left = (clientWidth - mOutputLetterbox.width) / 2;
mOutputLetterbox.top = (clientHeight - mOutputLetterbox.height) / 2;
@ -300,14 +312,14 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds)
mSceneViewport.height = height;
// Scale viewports to fit letterbox
if ((gl_scale_viewport && !framebuffer->IsFullscreen()) || !FGLRenderBuffers::IsEnabled())
if ((gl_scale_viewport && !framebuffer->IsFullscreen() && vid_scalemode == 0) || !FGLRenderBuffers::IsEnabled())
{
mScreenViewport.width = mOutputLetterbox.width;
mScreenViewport.height = mOutputLetterbox.height;
mSceneViewport.left = (int)round(mSceneViewport.left * scale);
mSceneViewport.top = (int)round(mSceneViewport.top * scale);
mSceneViewport.width = (int)round(mSceneViewport.width * scale);
mSceneViewport.height = (int)round(mSceneViewport.height * scale);
mSceneViewport.left = (int)round(mSceneViewport.left * scaleX);
mSceneViewport.top = (int)round(mSceneViewport.top * scaleY);
mSceneViewport.width = (int)round(mSceneViewport.width * scaleX);
mSceneViewport.height = (int)round(mSceneViewport.height * scaleY);
// Without render buffers we have to render directly to the letterbox
if (!FGLRenderBuffers::IsEnabled())

View file

@ -280,7 +280,7 @@ bool FRenderState::ApplyShader()
mModelMatrix.matrixToGL(activeShader->modelmatrix_index);
VSMatrix norm;
norm.computeNormalMatrix(mModelMatrix);
mNormalModelMatrix.matrixToGL(activeShader->normalmodelmatrix_index);
norm.matrixToGL(activeShader->normalmodelmatrix_index);
activeShader->currentModelMatrixState = true;
}
else if (activeShader->currentModelMatrixState)

View file

@ -132,7 +132,6 @@ public:
VSMatrix mModelMatrix;
VSMatrix mTextureMatrix;
VSMatrix mNormalViewMatrix;
VSMatrix mNormalModelMatrix;
FRenderState()
{

View file

@ -84,6 +84,8 @@ EXTERN_CVAR (Bool, cl_capfps)
EXTERN_CVAR (Bool, r_deathcamera)
EXTERN_CVAR (Float, underwater_fade_scalar)
EXTERN_CVAR (Float, r_visibility)
EXTERN_CVAR (Bool, gl_legacy_mode)
EXTERN_CVAR (Bool, r_drawvoxels)
extern bool NoInterpolateView;
@ -993,6 +995,7 @@ struct FGLInterface : public FRenderer
int GetMaxViewPitch(bool down) override;
void SetClearColor(int color) override;
void Init() override;
uint32_t GetCaps() override;
};
//==========================================================================
@ -1160,6 +1163,31 @@ bool FGLInterface::RequireGLNodes()
return true;
}
uint32_t FGLInterface::GetCaps()
{
// describe our basic feature set
ActorRenderFeatureFlags FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS |
RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL;
if (r_drawvoxels)
FlagSet |= RFF_VOXELS;
if (gl_legacy_mode)
{
// legacy mode always has truecolor because palette tonemap is not available
FlagSet |= RFF_TRUECOLOR;
}
else if (!(FGLRenderBuffers::IsEnabled()))
{
// truecolor is always available when renderbuffers are unavailable because palette tonemap is not possible
FlagSet |= RFF_TRUECOLOR | RFF_MATSHADER | RFF_BRIGHTMAP;
}
else
{
if (gl_tonemap != 5) // not running palette tonemap shader
FlagSet |= RFF_TRUECOLOR;
FlagSet |= RFF_MATSHADER | RFF_POSTSHADER | RFF_BRIGHTMAP;
}
return (uint32_t)FlagSet;
}
//===========================================================================
//
//

View file

@ -76,9 +76,11 @@ CUSTOM_CVAR(Int, gl_fuzztype, 0, CVAR_ARCHIVE)
}
EXTERN_CVAR (Float, transsouls)
EXTERN_CVAR (Bool, r_debug_disable_vis_filter)
extern TArray<spritedef_t> sprites;
extern TArray<spriteframe_t> SpriteFrames;
extern uint32_t r_renderercaps;
enum HWRenderStyle
{
@ -677,6 +679,13 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
if (!(thing->flags & MF_STEALTH) || !mDrawer->FixedColormap || !gl_enhanced_nightvision || thing == camera)
return;
}
// check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature,
// check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it.
if (!r_debug_disable_vis_filter && (!!(thing->RenderRequired & ~r_renderercaps)) ||
(!!(thing->RenderHidden & r_renderercaps)))
return;
int spritenum = thing->sprite;
DVector2 sprscale = thing->Scale;
if (thing->player != NULL)

View file

@ -34,6 +34,8 @@
#include "gl/renderer/gl_postprocessstate.h"
#include "gl/renderer/gl_renderbuffers.h"
#include "gl/shaders/gl_postprocessshader.h"
#include "textures/textures.h"
#include "textures/bitmap.h"
CVAR(Bool, gl_custompost, true, 0)
@ -67,6 +69,12 @@ void FCustomPostProcessShaders::Run(FString target)
/////////////////////////////////////////////////////////////////////////////
PostProcessShaderInstance::~PostProcessShaderInstance()
{
for (const auto &it : mTextureHandles)
glDeleteTextures(1, (GLuint*)&it.second);
}
void PostProcessShaderInstance::Run()
{
if (!IsShaderSupported())
@ -80,6 +88,7 @@ void PostProcessShaderInstance::Run()
FGLDebug::PushGroup(Desc->ShaderLumpName.GetChars());
FGLPostProcessState savedState;
savedState.SaveTextureBindings(1 + Desc->Textures.CountUsed());
GLRenderer->mBuffers->BindNextFB();
GLRenderer->mBuffers->BindCurrentTexture(0);
@ -89,11 +98,13 @@ void PostProcessShaderInstance::Run()
mProgram.Bind();
UpdateUniforms();
BindTextures();
mInputTexture.Set(0);
GLRenderer->RenderScreenQuad();
glActiveTexture(GL_TEXTURE0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLRenderer->mBuffers->NextTexture();
@ -145,6 +156,13 @@ void PostProcessShaderInstance::CompileShader()
FString uniformTextures;
uniformTextures += "uniform sampler2D InputTexture;\n";
TMap<FString, FString>::Iterator itTextures(Desc->Textures);
TMap<FString, FString>::Pair *pairTextures;
while (itTextures.NextPair(pairTextures))
{
uniformTextures.AppendFormat("uniform sampler2D %s;\n", pairTextures->Key.GetChars());
}
// Setup pipeline
FString pipelineInOut;
pipelineInOut += "in vec2 TexCoord;\n";
@ -192,3 +210,46 @@ void PostProcessShaderInstance::UpdateUniforms()
}
}
}
void PostProcessShaderInstance::BindTextures()
{
int textureUnit = 1;
TMap<FString, FString>::Iterator it(Desc->Textures);
TMap<FString, FString>::Pair *pair;
while (it.NextPair(pair))
{
int location = glGetUniformLocation(mProgram, pair->Key.GetChars());
if (location == -1)
continue;
FString name = pair->Value;
FTexture *tex = TexMan(TexMan.CheckForTexture(name, FTexture::TEX_Any));
if (tex && tex->UseType != FTexture::TEX_Null)
{
glUniform1i(location, textureUnit);
glActiveTexture(GL_TEXTURE0 + 1);
auto it = mTextureHandles.find(tex);
if (it == mTextureHandles.end())
{
FBitmap bitmap;
bitmap.Create(tex->GetWidth(), tex->GetHeight());
tex->CopyTrueColorPixels(&bitmap, 0, 0);
GLuint handle = 0;
glGenTextures(1, &handle);
glBindTexture(GL_TEXTURE_2D, handle);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tex->GetWidth(), tex->GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap.GetPixels());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
mTextureHandles[tex] = handle;
}
else
{
glBindTexture(GL_TEXTURE_2D, it->second);
}
textureUnit++;
}
}
}

View file

@ -1,6 +1,7 @@
#pragma once
#include "gl_shaderprogram.h"
#include <map>
class PostProcessShaderInstance;
@ -29,6 +30,7 @@ struct PostProcessShader
bool Enabled = false;
TMap<FString, PostProcessUniformValue> Uniforms;
TMap<FString, FString> Textures;
};
extern TArray<PostProcessShader> PostProcessShaders;
@ -37,6 +39,7 @@ class PostProcessShaderInstance
{
public:
PostProcessShaderInstance(PostProcessShader *desc) : Desc(desc) { }
~PostProcessShaderInstance();
void Run();
@ -46,9 +49,11 @@ private:
bool IsShaderSupported();
void CompileShader();
void UpdateUniforms();
void BindTextures();
FShaderProgram mProgram;
FBufferedUniformSampler mInputTexture;
std::map<FTexture*, int> mTextureHandles;
};
class FCustomPostProcessShaders

View file

@ -683,6 +683,13 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump)
PostProcessShader shaderdesc;
shaderdesc.Target = sc.String;
bool validTarget = false;
if (sc.Compare("beforebloom")) validTarget = true;
if (sc.Compare("scene")) validTarget = true;
if (sc.Compare("screen")) validTarget = true;
if (!validTarget)
sc.ScriptError("Invalid target '%s' for postprocess shader",sc.String);
sc.MustGetToken('{');
while (!sc.CheckToken('}'))
{
@ -694,6 +701,8 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump)
sc.MustGetNumber();
shaderdesc.ShaderVersion = sc.Number;
if (sc.Number > 450 || sc.Number < 330)
sc.ScriptError("Shader version must be in range 330 to 450!");
}
else if (sc.Compare("name"))
{
@ -719,14 +728,30 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump)
parsedType = PostProcessUniformType::Vec2;
else if (uniformType.Compare("vec3") == 0)
parsedType = PostProcessUniformType::Vec3;
else
sc.ScriptError("Unrecognized uniform type '%s'", sc.String);
if (parsedType != PostProcessUniformType::Undefined)
shaderdesc.Uniforms[uniformName].Type = parsedType;
}
else if (sc.Compare("texture"))
{
sc.MustGetString();
FString textureName = sc.String;
sc.MustGetString();
FString textureSource = sc.String;
shaderdesc.Textures[textureName] = textureSource;
}
else if (sc.Compare("enabled"))
{
shaderdesc.Enabled = true;
}
else
{
sc.ScriptError("Unknown keyword '%s'", sc.String);
}
}
PostProcessShaders.Push(shaderdesc);

View file

@ -51,10 +51,12 @@
#include "gl/gl_functions.h"
#include "gl/renderer/gl_2ddrawer.h"
#include "gl_debug.h"
#include "r_videoscale.h"
EXTERN_CVAR (Float, vid_brightness)
EXTERN_CVAR (Float, vid_contrast)
EXTERN_CVAR (Bool, vid_vsync)
EXTERN_CVAR(Int, vid_scalemode)
CVAR(Bool, gl_aalines, false, CVAR_ARCHIVE)
@ -180,18 +182,15 @@ void OpenGLFrameBuffer::Update()
Unlock();
CheckBench();
if (!IsFullscreen())
int clientWidth = ViewportScaledWidth(IsFullscreen() ? VideoWidth : GetClientWidth());
int clientHeight = ViewportScaledHeight(IsFullscreen() ? VideoHeight : GetClientHeight());
if (clientWidth > 0 && clientHeight > 0 && (Width != clientWidth || Height != clientHeight))
{
int clientWidth = GetClientWidth();
int clientHeight = GetClientHeight();
if (clientWidth > 0 && clientHeight > 0 && (Width != clientWidth || Height != clientHeight))
{
// Do not call Resize here because it's only for software canvases
Pitch = Width = clientWidth;
Height = clientHeight;
V_OutputResized(Width, Height);
GLRenderer->mVBO->OutputResized(Width, Height);
}
// Do not call Resize here because it's only for software canvases
Pitch = Width = clientWidth;
Height = clientHeight;
V_OutputResized(Width, Height);
GLRenderer->mVBO->OutputResized(Width, Height);
}
GLRenderer->SetOutputViewport(nullptr);
@ -549,3 +548,18 @@ void OpenGLFrameBuffer::GameRestart()
gl_GenerateGlobalBrightmapFromColormap();
}
void OpenGLFrameBuffer::ScaleCoordsFromWindow(int16_t &x, int16_t &y)
{
int letterboxX = GLRenderer->mOutputLetterbox.left;
int letterboxY = GLRenderer->mOutputLetterbox.top;
int letterboxWidth = GLRenderer->mOutputLetterbox.width;
int letterboxHeight = GLRenderer->mOutputLetterbox.height;
// Subtract the LB video mode letterboxing
if (IsFullscreen())
y -= (GetTrueHeight() - VideoHeight) / 2;
x = int16_t((x - letterboxX) * Width / letterboxWidth);
y = int16_t((y - letterboxY) * Height / letterboxHeight);
}

View file

@ -82,6 +82,8 @@ public:
void SetVSync(bool vsync);
void ScaleCoordsFromWindow(int16_t &x, int16_t &y) override;
bool HWGammaActive = false; // Are we using hardware or software gamma?
std::shared_ptr<FGLDebug> mDebug; // Debug API
private:

View file

@ -68,6 +68,7 @@
#include "gl/utility/gl_templates.h"
#include "gl/gl_functions.h"
#include "gl_debug.h"
#include "r_videoscale.h"
#include "swrenderer/scene/r_light.h"
@ -94,15 +95,6 @@ EXTERN_CVAR(Float, transsouls)
EXTERN_CVAR(Int, vid_refreshrate)
EXTERN_CVAR(Bool, gl_legacy_mode)
CVAR(Int, vid_max_width, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Int, vid_max_height, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
namespace
{
int ClampWidth(int width) { return (vid_max_width == 0 || width < vid_max_width) ? width : vid_max_width; }
int ClampHeight(int height) { return (vid_max_height == 0 || height < vid_max_height) ? height : vid_max_height; }
}
#ifdef WIN32
extern cycle_t BlitCycles;
#endif
@ -147,7 +139,7 @@ const char *const OpenGLSWFrameBuffer::ShaderDefines[OpenGLSWFrameBuffer::NUM_SH
};
OpenGLSWFrameBuffer::OpenGLSWFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra) :
Super(hMonitor, ClampWidth(width), ClampHeight(height), bits, refreshHz, fullscreen, bgra)
Super(hMonitor, width, height, bits, refreshHz, fullscreen, bgra)
{
VertexBuffer = nullptr;
IndexBuffer = nullptr;
@ -722,6 +714,29 @@ void OpenGLSWFrameBuffer::DrawTriangleList(int minIndex, int numVertices, int st
glDrawRangeElements(GL_TRIANGLES, minIndex, minIndex + numVertices - 1, primitiveCount * 3, GL_UNSIGNED_SHORT, (const void*)(startIndex * sizeof(uint16_t)));
}
void OpenGLSWFrameBuffer::GetLetterboxFrame(int &letterboxX, int &letterboxY, int &letterboxWidth, int &letterboxHeight)
{
int clientWidth = GetClientWidth();
int clientHeight = GetClientHeight();
float scaleX, scaleY;
if (ViewportIsScaled43())
{
scaleX = MIN(clientWidth / (float)Width, clientHeight / (Height * 1.2f));
scaleY = scaleX * 1.2f;
}
else
{
scaleX = MIN(clientWidth / (float)Width, clientHeight / (float)Height);
scaleY = scaleX;
}
letterboxWidth = (int)round(Width * scaleX);
letterboxHeight = (int)round(Height * scaleY);
letterboxX = (clientWidth - letterboxWidth) / 2;
letterboxY = (clientHeight - letterboxHeight) / 2;
}
void OpenGLSWFrameBuffer::Present()
{
int clientWidth = GetClientWidth();
@ -731,18 +746,26 @@ void OpenGLSWFrameBuffer::Present()
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, clientWidth, clientHeight);
float scale = MIN(clientWidth / (float)Width, clientHeight / (float)Height);
int letterboxWidth = (int)round(Width * scale);
int letterboxHeight = (int)round(Height * scale);
int letterboxX = (clientWidth - letterboxWidth) / 2;
int letterboxY = (clientHeight - letterboxHeight) / 2;
int letterboxX, letterboxY, letterboxWidth, letterboxHeight;
GetLetterboxFrame(letterboxX, letterboxY, letterboxWidth, letterboxHeight);
DrawLetterbox(letterboxX, letterboxY, letterboxWidth, letterboxHeight);
glViewport(letterboxX, letterboxY, letterboxWidth, letterboxHeight);
FBVERTEX verts[4];
CalcFullscreenCoords(verts, false, 0, 0xFFFFFFFF);
SetTexture(0, OutputFB->Texture.get());
if (ViewportLinearScale())
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
SetPixelShader(Shaders[SHADER_GammaCorrection].get());
SetAlphaBlend(0);
EnableAlphaTest(false);
@ -1174,6 +1197,14 @@ void OpenGLSWFrameBuffer::Unlock()
else if (--m_Lock == 0)
{
Buffer = nullptr;
if (MappedMemBuffer)
{
BindFBBuffer();
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
MappedMemBuffer = nullptr;
}
}
}
@ -1283,8 +1314,8 @@ void OpenGLSWFrameBuffer::Flip()
if (!IsFullscreen())
{
int clientWidth = ClampWidth(GetClientWidth());
int clientHeight = ClampHeight(GetClientHeight());
int clientWidth = ViewportScaledWidth(GetClientWidth());
int clientHeight = ViewportScaledHeight(GetClientHeight());
if (clientWidth > 0 && clientHeight > 0 && (Width != clientWidth || Height != clientHeight))
{
Resize(clientWidth, clientHeight);
@ -3807,3 +3838,16 @@ void OpenGLSWFrameBuffer::SetPaletteTexture(HWTexture *texture, int count, uint3
SetConstant(PSCONST_PaletteMod, 255 * fcount, 0.5f * fcount, 0, 0);
SetTexture(1, texture);
}
void OpenGLSWFrameBuffer::ScaleCoordsFromWindow(int16_t &x, int16_t &y)
{
int letterboxX, letterboxY, letterboxWidth, letterboxHeight;
GetLetterboxFrame(letterboxX, letterboxY, letterboxWidth, letterboxHeight);
// Subtract the LB video mode letterboxing
if (IsFullscreen())
y -= (GetTrueHeight() - VideoHeight) / 2;
x = int16_t((x - letterboxX) * Width / letterboxWidth);
y = int16_t((y - letterboxY) * Height / letterboxHeight);
}

View file

@ -72,6 +72,8 @@ public:
int GetTrueHeight() override { return TrueHeight; }
#endif
void ScaleCoordsFromWindow(int16_t &x, int16_t &y) override;
private:
struct FBVERTEX
{
@ -194,6 +196,8 @@ private:
void DrawLineList(int count);
void DrawTriangleList(int minIndex, int numVertices, int startIndex, int primitiveCount);
void Present();
void GetLetterboxFrame(int &x, int &y, int &width, int &height);
static void BgraToRgba(uint32_t *dest, const uint32_t *src, int width, int height, int srcpitch);

View file

@ -15,7 +15,7 @@
#include <errno.h>
#include <stdarg.h>
#include <signal.h>
#if !defined(__APPLE__) && !defined(__FreeBSD__)
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
#include <malloc.h>
#endif
#include <time.h>

View file

@ -38,6 +38,8 @@
#elif defined(__APPLE__)
#include <stdlib.h>
#include <malloc/malloc.h>
#elif defined(__OpenBSD__)
#include <stdlib.h>
#else
#include <malloc.h>
#endif
@ -52,14 +54,14 @@
#endif
#if defined(__APPLE__)
#define _msize(p) malloc_size(p)
#elif defined(__sun)
#elif __solaris__ || defined(__OpenBSD__)
#define _msize(p) (*((size_t*)(p)-1))
#elif !defined(_WIN32)
#define _msize(p) malloc_usable_size(p) // from glibc/FreeBSD
#endif
#ifndef _DEBUG
#if !defined(__sun)
#if !__solaris__ && !defined(__OpenBSD__)
void *M_Malloc(size_t size)
{
void *block = malloc(size);
@ -129,7 +131,7 @@ void *M_Realloc(void *memblock, size_t size)
#include <crtdbg.h>
#endif
#if !defined(__sun)
#if !__solaris__ && !defined(__OpenBSD__)
void *M_Malloc_Dbg(size_t size, const char *file, int lineno)
{
void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno);
@ -197,7 +199,7 @@ void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno)
#endif
#endif
#if !defined(__sun)
#if !__solaris__ && !defined(__OpenBSD__)
void M_Free (void *block)
{
if (block != NULL)

View file

@ -321,11 +321,13 @@ void cht_DoCheat (player_t *player, int cheat)
break;
case CHT_MASSACRE:
case CHT_MASSACRE2:
{
int killcount = P_Massacre ();
int killcount = P_Massacre (cheat == CHT_MASSACRE2);
// killough 3/22/98: make more intelligent about plural
// Ty 03/27/98 - string(s) *not* externalized
mysnprintf (msgbuild, countof(msgbuild), "%d Monster%s Killed", killcount, killcount==1 ? "" : "s");
mysnprintf (msgbuild, countof(msgbuild), "%d %s%s Killed", killcount,
cheat==CHT_MASSACRE2 ? "Baddie" : "Monster", killcount==1 ? "" : "s");
msg = msgbuild;
}
break;

View file

@ -54,6 +54,7 @@
#include "sbar.h"
#include "hardware.h"
#include "vm.h"
#include "r_videoscale.h"
/*=======================================
*

View file

@ -3595,7 +3595,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BossDeath)
//
//----------------------------------------------------------------------------
int P_Massacre ()
int P_Massacre (bool baddies)
{
// jff 02/01/98 'em' cheat - kill all monsters
// partially taken from Chi's .46 port
@ -3609,7 +3609,7 @@ int P_Massacre ()
while ( (actor = iterator.Next ()) )
{
if (!(actor->flags2 & MF2_DORMANT) && (actor->flags3 & MF3_ISMONSTER))
if (!(actor->flags2 & MF2_DORMANT) && (actor->flags3 & MF3_ISMONSTER) && (!baddies || !(actor->flags & MF_FRIENDLY)))
{
killcount += actor->Massacre();
}

View file

@ -68,7 +68,7 @@ void A_FaceTarget(AActor *actor);
void A_Face(AActor *self, AActor *other, DAngle max_turn = 0., DAngle max_pitch = 270., DAngle ang_offset = 0., DAngle pitch_offset = 0., int flags = 0, double z_add = 0);
bool CheckBossDeath (AActor *);
int P_Massacre ();
int P_Massacre (bool baddies = false);
bool P_CheckMissileRange (AActor *actor);
#define SKULLSPEED (20.)

View file

@ -1013,6 +1013,7 @@ static FString CreateCacheName(MapData *map, bool create)
if (create) CreatePath(path);
lumpname.ReplaceChars('/', '%');
lumpname.ReplaceChars(':', '$');
path << '/' << lumpname.Right(lumpname.Len() - separator - 1) << ".gzc";
return path;
}

View file

@ -79,9 +79,9 @@ CVAR (Bool, cl_showsprees, true, CVAR_ARCHIVE)
CVAR (Bool, cl_showmultikills, true, CVAR_ARCHIVE)
EXTERN_CVAR (Bool, show_obituaries)
CVAR (Float, sv_damagefactormobj, 1.0, CVAR_SERVERINFO|CVAR_NOSAVE)
CVAR (Float, sv_damagefactorfriendly, 1.0, CVAR_SERVERINFO|CVAR_NOSAVE)
CVAR (Float, sv_damagefactorplayer, 1.0, CVAR_SERVERINFO|CVAR_NOSAVE)
CVAR (Float, sv_damagefactormobj, 1.0, CVAR_SERVERINFO|CVAR_CHEAT)
CVAR (Float, sv_damagefactorfriendly, 1.0, CVAR_SERVERINFO|CVAR_CHEAT)
CVAR (Float, sv_damagefactorplayer, 1.0, CVAR_SERVERINFO|CVAR_CHEAT)
FName MeansOfDeath;
@ -1979,6 +1979,15 @@ CCMD (kill)
Net_WriteByte (DEM_GENERICCHEAT);
Net_WriteByte (CHT_MASSACRE);
}
else if (!stricmp (argv[1], "baddies"))
{
// Kill all the unfriendly monsters
if (CheckCheatmode ())
return;
Net_WriteByte (DEM_GENERICCHEAT);
Net_WriteByte (CHT_MASSACRE2);
}
else
{
Net_WriteByte (DEM_KILLCLASSCHEAT);

View file

@ -352,6 +352,8 @@ DEFINE_FIELD(AActor, StealthAlpha)
DEFINE_FIELD(AActor, WoundHealth)
DEFINE_FIELD(AActor, BloodColor)
DEFINE_FIELD(AActor, BloodTranslation)
DEFINE_FIELD(AActor, RenderHidden)
DEFINE_FIELD(AActor, RenderRequired)
//==========================================================================
//
@ -526,8 +528,9 @@ void AActor::Serialize(FSerializer &arc)
A("woundhealth", WoundHealth)
A("rdfactor", RadiusDamageFactor)
A("selfdamagefactor", SelfDamageFactor)
A("stealthalpha", StealthAlpha);
A("stealthalpha", StealthAlpha)
A("renderhidden", RenderHidden)
A("renderrequired", RenderRequired);
}
#undef A
@ -6718,7 +6721,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
th->tics = 1;
}
DVector3 newpos = th->Pos();
DVector3 newpos = { 0,0,0 };
if (maxdist > 0)
{
@ -6736,6 +6739,9 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
newpos += advance;
}
newpos = th->Vec3Offset(newpos);
th->SetXYZ(newpos);
FCheckPosition tm(!!(th->flags2 & MF2_RIP));
// killough 8/12/98: for non-missile objects (e.g. grenades)
@ -8325,7 +8331,7 @@ DEFINE_ACTION_FUNCTION(AActor, AccuracyFactor)
DEFINE_ACTION_FUNCTION(AActor, CountsAsKill)
{
PARAM_SELF_PROLOGUE(AActor);
ACTION_RETURN_FLOAT(self->CountsAsKill());
ACTION_RETURN_BOOL(self->CountsAsKill());
}
DEFINE_ACTION_FUNCTION(AActor, IsZeroDamage)

View file

@ -103,7 +103,7 @@
static FRandom pr_skullpop ("SkullPop");
// [SP] Allows respawn in single player
CVAR(Bool, sv_singleplayerrespawn, false, CVAR_SERVERINFO | CVAR_LATCH)
CVAR(Bool, sv_singleplayerrespawn, false, CVAR_SERVERINFO | CVAR_CHEAT)
// Variables for prediction
CVAR (Bool, cl_noprediction, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)

View file

@ -32,6 +32,8 @@
EXTERN_CVAR(Float, transsouls)
EXTERN_CVAR(Int, r_drawfuzz)
EXTERN_CVAR (Bool, r_debug_disable_vis_filter)
extern uint32_t r_renderercaps;
bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right)
{
@ -176,6 +178,12 @@ bool RenderPolySprite::IsThingCulled(AActor *thing)
return true;
}
// check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature,
// check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it.
if (!r_debug_disable_vis_filter && (!!(thing->RenderRequired & ~r_renderercaps)) ||
(!!(thing->RenderHidden & r_renderercaps)))
return true;
return false;
}

View file

@ -178,9 +178,17 @@ unsigned int I_FPSTime()
}
static uint32_t FrameTime;
void I_SetFrameTime()
{
FrameTime = I_MSTime();
}
double I_GetTimeFrac(uint32_t* ms)
{
const uint32_t now = I_MSTime();
const uint32_t now = FrameTime;
if (NULL != ms)
{

View file

@ -140,8 +140,8 @@ CUSTOM_CVAR(Bool, swtruecolor, TRUECOLOR_DEFAULT, CVAR_ARCHIVE | CVAR_GLOBALCONF
if (currentrenderer == 0)
{
extern int NewWidth, NewHeight, NewBits, DisplayBits;
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
setmodeneeded = true;
}
@ -151,8 +151,8 @@ CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
extern int NewWidth, NewHeight, NewBits, DisplayBits;
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
setmodeneeded = true;
}

View file

@ -65,6 +65,7 @@ public:
int GetClientWidth();
int GetClientHeight();
virtual int GetTrueHeight() { return GetClientHeight(); }
protected:
int m_Lock;
bool UpdatePending;

View file

@ -30,6 +30,8 @@
#include <dirent.h>
#include <ctype.h>
#define __solaris__ (defined(__sun) || defined(__sun__) || defined(__SRV4) || defined(__srv4__))
#include "doomtype.h"
struct ticcmd_t;
@ -67,6 +69,7 @@ extern int (*I_WaitForTic) (int);
extern void (*I_FreezeTime) (bool frozen);
double I_GetTimeFrac (uint32_t *ms);
void I_SetFrameTime();
// Return a seed value for the RNG.
unsigned int I_MakeRNGSeed();

View file

@ -5,7 +5,6 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <sys/ucontext.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
@ -15,7 +14,7 @@
#ifndef PR_SET_PTRACER
#define PR_SET_PTRACER 0x59616d61
#endif
#elif defined (__APPLE__) || defined (__FreeBSD__)
#elif defined (__APPLE__) || defined (__FreeBSD__) || defined(__OpenBSD__)
#include <signal.h>
#endif

View file

@ -241,7 +241,7 @@ void I_ClosestResolution (int *width, int *height, int bits)
EXTERN_CVAR(Int, vid_maxfps);
EXTERN_CVAR(Bool, cl_capfps);
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__OpenBSD__)
Semaphore FPSLimitSemaphore;
static void FPSLimitNotify(sigval val)
@ -325,17 +325,17 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC
// way to force a CreateFramebuffer call without a lot of refactoring.
if (currentrenderer == 0)
{
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
setmodeneeded = true;
}
}
CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
setmodeneeded = true;
}
@ -349,8 +349,8 @@ CUSTOM_CVAR (Float, vid_winscale, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
else if (Video)
{
Video->SetWindowedScale (self);
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
setmodeneeded = true;
}

View file

@ -208,10 +208,18 @@ void I_SelectTimer()
}
}
static uint32_t FrameTime;
void I_SetFrameTime()
{
FrameTime = SDL_GetTicks();
}
// Returns the fractional amount of a tic passed since the most recent tic
double I_GetTimeFrac (uint32_t *ms)
{
uint32_t now = SDL_GetTicks ();
uint32_t now = FrameTime;
if (ms) *ms = TicStart + (1000 / TICRATE);
if (TicStart == 0)
{

View file

@ -535,7 +535,7 @@ void SDLGLFB::NewRefreshRate ()
void SDLGLFB::SwapBuffers()
{
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__OpenBSD__)
if (vid_maxfps && !cl_capfps)
{
SEMAPHORE_WAIT(FPSLimitSemaphore)

View file

@ -76,6 +76,7 @@ public:
SDL_Window *GetSDLWindow() override { return Screen; }
virtual int GetTrueHeight() { return GetClientHeight(); }
protected:
bool CanUpdate();
void SetGammaTable(uint16_t *tbl);

View file

@ -227,7 +227,7 @@ void SDLFB::Update ()
DrawRateStuff ();
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__OpenBSD__)
if(vid_maxfps && !cl_capfps)
{
SEMAPHORE_WAIT(FPSLimitSemaphore)

View file

@ -52,8 +52,8 @@ struct seg_t;
struct sector_t;
class AActor;
#define MAXWIDTH 5760
#define MAXHEIGHT 3600
#define MAXWIDTH 12000
#define MAXHEIGHT 5000
const uint16_t NO_INDEX = 0xffffu;
const uint32_t NO_SIDE = 0xffffffffu;

View file

@ -54,6 +54,7 @@ struct FRenderer
virtual void CleanLevelData() {}
virtual bool RequireGLNodes() { return false; }
virtual uint32_t GetCaps() { return 0; }
};

87
src/r_videoscale.cpp Normal file
View file

@ -0,0 +1,87 @@
//
//---------------------------------------------------------------------------
//
// Copyright(C) 2017 Magnus Norddahl
// Copyright(C) 2017 Rachael Alexanderson
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/
//
//--------------------------------------------------------------------------
//
#include <math.h>
#include "c_dispatch.h"
#include "c_cvars.h"
CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
if (self < 0 || self > 6)
{
self = 0;
}
}
bool ViewportLinearScale()
{
switch(vid_scalemode)
{
default: return false;
case 4:
case 5:
case 6: return true;
}
}
int ViewportScaledWidth(int width)
{
switch (vid_scalemode)
{
default:
case 0: return width;
case 1: return 320;
case 2: return 640;
case 3: return (int)roundf(width * 0.5f);
case 4: return (int)roundf(width * 0.75f);
case 5: return width * 2;
case 6: return 1280;
}
}
int ViewportScaledHeight(int height)
{
switch (vid_scalemode)
{
default:
case 0: return height;
case 1: return 200;
case 2: return 400;
case 3: return (int)roundf(height * 0.5f);
case 4: return (int)roundf(height * 0.75f);
case 5: return height * 2;
case 6: return 800;
}
}
bool ViewportIsScaled43()
{
switch (vid_scalemode)
{
default: return false;
case 1:
case 2:
case 6: return true;
}
}

31
src/r_videoscale.h Normal file
View file

@ -0,0 +1,31 @@
//
//---------------------------------------------------------------------------
//
// Copyright(C) 2017 Magnus Norddahl
// Copyright(C) 2017 Rachael Alexanderson
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/
//
//--------------------------------------------------------------------------
//
#ifndef __VIDEOSCALE_H__
#define __VIDEOSCALE_H__
EXTERN_CVAR (Int, vid_scalemode)
bool ViewportLinearScale();
int ViewportScaledWidth(int width);
int ViewportScaledHeight(int height);
bool ViewportIsScaled43();
#endif //__VIDEOSCALE_H__

View file

@ -1252,3 +1252,18 @@ DEFINE_ACTION_FUNCTION(FStringStruct, Filter)
ACTION_RETURN_STRING(strbin1(*self));
}
DEFINE_ACTION_FUNCTION(FStringStruct, IndexOf)
{
PARAM_SELF_STRUCT_PROLOGUE(FString);
PARAM_STRING(substr);
PARAM_INT_DEF(startIndex);
ACTION_RETURN_INT(self->IndexOf(substr, startIndex));
}
DEFINE_ACTION_FUNCTION(FStringStruct, LastIndexOf)
{
PARAM_SELF_STRUCT_PROLOGUE(FString);
PARAM_STRING(substr);
ACTION_RETURN_INT(self->LastIndexOf(substr));
}

View file

@ -1090,6 +1090,7 @@ DEFINE_PROPERTY(distancecheck, S, Actor)
}
}
//==========================================================================
//
// Special inventory properties
@ -1836,4 +1837,3 @@ DEFINE_SCRIPTED_PROPERTY(unmorphflash, S, PowerMorph)
defaults->PointerVar<PClassActor>(NAME_UnMorphFlash) = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate);
}

View file

@ -34,6 +34,7 @@
*/
%stack_size 0
%include
{

View file

@ -39,7 +39,6 @@
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <wordexp.h>
#include "mus2midi.h"
extern void ChildSigHandler (int signum);
#endif

View file

@ -46,7 +46,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <wordexp.h>
#include <glob.h>
#include <signal.h>
int ChildQuit;
@ -269,7 +269,7 @@ int TimidityPPMIDIDevice::Open(MidiCallback callback, void *userdata)
#ifdef _WIN32
static SECURITY_ATTRIBUTES inheritable = { sizeof(inheritable), NULL, true };
if (!Validated && !ValidateTimidity ())
{
return 101;
@ -287,7 +287,7 @@ int TimidityPPMIDIDevice::Open(MidiCallback callback, void *userdata)
// buffer reads in FillStream() under NT. This does not seem to be an
// issue under 9x.
int bitmask = pipeSize & -pipeSize;
while (bitmask < pipeSize)
bitmask <<= 1;
pipeSize = bitmask;
@ -321,7 +321,7 @@ int TimidityPPMIDIDevice::Open(MidiCallback callback, void *userdata)
#endif
}
}
if (pipeSize == 0)
{
Printf(PRINT_BOLD, "If your soundcard cannot play more than one\n"
@ -514,26 +514,83 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
// Timidity was previously launched, so the write end of the pipe
// is closed, and the read end is still open. Close the pipe
// completely and reopen it.
close (WavePipe[0]);
WavePipe[0] = -1;
delete Stream;
Stream = NULL;
Open (NULL, NULL);
}
int forkres;
wordexp_t words = {};
switch (wordexp (CommandLine.GetChars(), &words, 0))
int forkres;
glob_t glb;
// Get timidity executable path
int spaceIdx = 0;
int spaceInExePathCount = -1;
FString TimidityExe;
do
{
case 0: // all good
break;
case WRDE_NOSPACE:
wordfree (&words);
default:
return false;
spaceIdx = CommandLine.IndexOf(' ', spaceIdx);
TimidityExe = CommandLine.Left(spaceIdx);
glob(TimidityExe.GetChars(), 0, NULL, &glb);
spaceIdx += 1;
spaceInExePathCount += 1;
} while (spaceIdx != 0 && glb.gl_pathc == 0);
if (spaceIdx == 0)
{
TimidityExe = FString("timidity"); // Maybe it's in your PATH?
spaceInExePathCount = 0;
}
globfree(&glb);
int strCount = 1;
for (spaceIdx = 0; spaceIdx < CommandLine.Len(); spaceIdx++)
{
if (CommandLine[spaceIdx] == ' ')
{
++strCount;
if (CommandLine[spaceIdx+1] == ' ')
{
--strCount;
}
}
}
strCount -= spaceInExePathCount;
char** TimidityArgs = new char*[strCount + 1];
TimidityArgs[strCount] = NULL;
spaceIdx = CommandLine.IndexOf(' ');
int curSpace = spaceIdx, i = 1;
TimidityArgs[0] = new char[TimidityExe.Len() + 1];
TimidityArgs[0][TimidityExe.Len()] = 0;
strcpy(TimidityArgs[0], TimidityExe.GetChars());
int argLen;
while (curSpace != -1)
{
curSpace = CommandLine.IndexOf(' ', spaceIdx);
if (curSpace != spaceIdx)
{
argLen = curSpace - spaceIdx + 1;
if (argLen < 0)
{
argLen = CommandLine.Len() - curSpace;
}
TimidityArgs[i] = new char[argLen];
TimidityArgs[i][argLen-1] = 0;
strcpy(TimidityArgs[i], CommandLine.Mid(spaceIdx, curSpace - spaceIdx).GetChars());
i += 1;
}
spaceIdx = curSpace + 1;
}
DPrintf(DMSG_NOTIFY, "Timidity EXE: \x1cG%s\n", TimidityExe.GetChars());
for (i = 0; i < strCount; i++)
{
DPrintf(DMSG_NOTIFY, "arg %d: \x1cG%s\n", i, TimidityArgs[i]);
}
forkres = fork ();
@ -546,8 +603,8 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
// freopen ("/dev/null", "w", stderr);
close (WavePipe[1]);
execvp (words.we_wordv[0], words.we_wordv);
fprintf(stderr,"execvp failed\n");
execvp (TimidityExe.GetChars(), TimidityArgs);
fprintf(stderr,"execvp failed: %s\n", strerror(errno));
_exit (0); // if execvp succeeds, we never get here
}
else if (forkres < 0)
@ -566,8 +623,8 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
fprintf(stderr,"Launching timidity failed\n");
}*/
}
wordfree (&words);
globfree (&glb);
return ChildProcess != -1;
#endif // _WIN32
}
@ -581,7 +638,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
bool TimidityPPMIDIDevice::FillStream(SoundStream *stream, void *buff, int len, void *userdata)
{
TimidityPPMIDIDevice *song = (TimidityPPMIDIDevice *)userdata;
#ifdef _WIN32
DWORD avail, got, didget;
@ -606,7 +663,7 @@ bool TimidityPPMIDIDevice::FillStream(SoundStream *stream, void *buff, int len,
memset ((uint8_t *)buff+didget, 0, len-didget);
break;
}
}
}
}
#else
ssize_t got;

View file

@ -33,7 +33,7 @@
// HEADER FILES ------------------------------------------------------------
#if !defined(__FreeBSD__) && !defined(__APPLE__)
#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__OpenBSD__)
#include <malloc.h>
#else
#include <stdlib.h>

View file

@ -355,6 +355,10 @@ namespace swrenderer
lit.b += (light_color.b * attenuation) >> 8;
}
lit.r = MIN<uint32_t>(lit.r, 256);
lit.g = MIN<uint32_t>(lit.g, 256);
lit.b = MIN<uint32_t>(lit.b, 256);
fgcolor.r = MIN<uint32_t>(fgcolor.r + ((material.r * lit.r) >> 8), 255);
fgcolor.g = MIN<uint32_t>(fgcolor.g + ((material.g * lit.g) >> 8), 255);
fgcolor.b = MIN<uint32_t>(fgcolor.b + ((material.b * lit.b) >> 8), 255);

View file

@ -399,6 +399,8 @@ namespace swrenderer
lit = _mm_add_epi16(lit, _mm_srli_epi16(_mm_mullo_epi16(light_color, attenuation), 8));
}
lit = _mm_min_epi16(lit, _mm_set1_epi16(256));
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, lit), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
return fgcolor;

View file

@ -269,6 +269,10 @@ namespace swrenderer
lit.b += (light_color.b * attenuation) >> 8;
}
lit.r = MIN<uint32_t>(lit.r, 256);
lit.g = MIN<uint32_t>(lit.g, 256);
lit.b = MIN<uint32_t>(lit.b, 256);
fgcolor.r = MIN<uint32_t>(fgcolor.r + ((material.r * lit.r) >> 8), 255);
fgcolor.g = MIN<uint32_t>(fgcolor.g + ((material.g * lit.g) >> 8), 255);
fgcolor.b = MIN<uint32_t>(fgcolor.b + ((material.b * lit.b) >> 8), 255);

View file

@ -315,6 +315,8 @@ namespace swrenderer
lit = _mm_add_epi16(lit, _mm_srli_epi16(_mm_mullo_epi16(light_color, attenuation), 8));
}
lit = _mm_min_epi16(lit, _mm_set1_epi16(256));
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, lit), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
return fgcolor;

View file

@ -113,7 +113,7 @@ namespace swrenderer
//walltop.Project(Thread->Viewport.get(), mFrontSector->ceilingplane, &WallC, mLineSegment, Thread->Portal->MirrorFlags & RF_XFLIP);
wallbottom.Project(Thread->Viewport.get(), mFrontSector->floorplane, &WallC, mLineSegment, Thread->Portal->MirrorFlags & RF_XFLIP);
memcpy(walltop.ScreenY, wallbottom.ScreenY, sizeof(short) * MAXWIDTH);
memcpy(walltop.ScreenY, wallbottom.ScreenY, sizeof(short) * Thread->Viewport->RenderTarget->GetWidth());
}
ClipSegmentTopBottom(x1, x2);

View file

@ -478,9 +478,9 @@ namespace swrenderer
iend = 1 / iend;
draw_segment->yscale = (float)yscale;
draw_segment->iscale = (float)istart;
if (stop - start > 0)
if (stop - start > 1)
{
draw_segment->iscalestep = float((iend - istart) / (stop - start));
draw_segment->iscalestep = float((iend - istart) / (stop - start - 1));
}
else
{
@ -1292,45 +1292,58 @@ namespace swrenderer
swapvalues(tleft.Y, tright.Y);
}
float fsx1, fsz1, fsx2, fsz2;
if (tleft.X >= -tleft.Y)
{
if (tleft.X > tleft.Y) return true; // left edge is off the right side
if (tleft.Y == 0) return true;
sx1 = xs_RoundToInt(viewport->CenterX + tleft.X * viewport->CenterX / tleft.Y);
sz1 = tleft.Y;
fsx1 = viewport->CenterX + tleft.X * viewport->CenterX / tleft.Y;
fsz1 = tleft.Y;
}
else
{
if (tright.X < -tright.Y) return true; // wall is off the left side
float den = tleft.X - tright.X - tright.Y + tleft.Y;
if (den == 0) return true;
sx1 = 0;
sz1 = tleft.Y + (tright.Y - tleft.Y) * (tleft.X + tleft.Y) / den;
fsx1 = 0;
fsz1 = tleft.Y + (tright.Y - tleft.Y) * (tleft.X + tleft.Y) / den;
}
if (sz1 < too_close)
if (fsz1 < too_close)
return true;
if (tright.X <= tright.Y)
{
if (tright.X < -tright.Y) return true; // right edge is off the left side
if (tright.Y == 0) return true;
sx2 = xs_RoundToInt(viewport->CenterX + tright.X * viewport->CenterX / tright.Y);
sz2 = tright.Y;
fsx2 = viewport->CenterX + tright.X * viewport->CenterX / tright.Y;
fsz2 = tright.Y;
}
else
{
if (tleft.X > tleft.Y) return true; // wall is off the right side
float den = tright.Y - tleft.Y - tright.X + tleft.X;
if (den == 0) return true;
sx2 = viewwidth;
sz2 = tleft.Y + (tright.Y - tleft.Y) * (tleft.X - tleft.Y) / den;
fsx2 = viewwidth;
fsz2 = tleft.Y + (tright.Y - tleft.Y) * (tleft.X - tleft.Y) / den;
}
if (sz2 < too_close || sx2 <= sx1)
if (fsz2 < too_close)
return true;
return false;
sx1 = xs_RoundToInt(fsx1);
sx2 = xs_RoundToInt(fsx2);
float delta = fsx2 - fsx1;
float t1 = (sx1 + 0.5f - fsx1) / delta;
float t2 = (sx2 + 0.5f - fsx1) / delta;
float invZ1 = 1.0f / fsz1;
float invZ2 = 1.0f / fsz2;
sz1 = 1.0f / (invZ1 * (1.0f - t1) + invZ2 * t1);
sz2 = 1.0f / (invZ1 * (1.0f - t2) + invZ2 * t2);
return sx2 <= sx1;
}
/////////////////////////////////////////////////////////////////////////
@ -1346,9 +1359,9 @@ namespace swrenderer
{
swapvalues(left, right);
}
UoverZorg = left->X * thread->Viewport->viewwindow.centerx;
UoverZorg = left->X * thread->Viewport->CenterX;
UoverZstep = -left->Y;
InvZorg = (left->X - right->X) * thread->Viewport->viewwindow.centerx;
InvZorg = (left->X - right->X) * thread->Viewport->CenterX;
InvZstep = right->Y - left->Y;
}
@ -1371,9 +1384,9 @@ namespace swrenderer
fullx2 = -fullx2;
}
UoverZorg = float(fullx1 * viewport->viewwindow.centerx);
UoverZorg = float(fullx1 * viewport->CenterX);
UoverZstep = float(-fully1);
InvZorg = float((fullx1 - fullx2) * viewport->viewwindow.centerx);
InvZorg = float((fullx1 - fullx2) * viewport->CenterX);
InvZstep = float(fully2 - fully1);
}
}

View file

@ -75,7 +75,7 @@ namespace swrenderer
v *= height;
v *= (1 << uv_fracbits);
uv_pos = (uint32_t)v;
uv_pos = (uint32_t)(int64_t)v;
uv_step = xs_ToFixed(uv_fracbits, uv_stepd);
if (uv_step == 0) // To prevent divide by zero elsewhere
uv_step = 1;
@ -117,8 +117,8 @@ namespace swrenderer
}
// Convert to uint32_t:
uv_pos = (uint32_t)(v * 0x100000000LL);
uv_step = (uint32_t)(v_step * 0x100000000LL);
uv_pos = (uint32_t)(int64_t)(v * 0x100000000LL);
uv_step = (uint32_t)(int64_t)(v_step * 0x100000000LL);
uv_max = 0;
// Texture mipmap and filter selection:
@ -288,6 +288,7 @@ namespace swrenderer
uint32_t uv_pos = sampler.uv_pos;
uint32_t left = y2 - y1;
int y = y1;
while (left > 0)
{
uint32_t available = sampler.uv_max - uv_pos;
@ -298,12 +299,13 @@ namespace swrenderer
drawerargs.SetTexture(sampler.source, sampler.source2, sampler.height);
drawerargs.SetTextureUPos(sampler.texturefracx);
drawerargs.SetDest(Thread->Viewport.get(), x, y1);
drawerargs.SetDest(Thread->Viewport.get(), x, y);
drawerargs.SetCount(count);
drawerargs.SetTextureVStep(sampler.uv_step);
drawerargs.SetTextureVPos(uv_pos);
drawerargs.DrawColumn(Thread);
y += count;
left -= count;
uv_pos += sampler.uv_step * count;
if (uv_pos >= sampler.uv_max)

View file

@ -108,7 +108,7 @@ namespace swrenderer
planeang += M_PI / 2;
double cosine = cos(planeang), sine = -sin(planeang);
x = pl->right - viewport->CenterX - 0.5;
x = pl->right - viewport->CenterX + 0.5;
rightxfrac = _xscale * (cosine + x * xstep);
rightyfrac = _yscale * (sine + x * ystep);
x = pl->left - viewport->CenterX + 0.5;
@ -117,8 +117,16 @@ namespace swrenderer
basexfrac = leftxfrac;
baseyfrac = leftyfrac;
xstepscale = (rightxfrac - leftxfrac) / (pl->right - pl->left + 1);
ystepscale = (rightyfrac - leftyfrac) / (pl->right - pl->left + 1);
if (pl->left != pl->right)
{
xstepscale = (rightxfrac - leftxfrac) / (pl->right - pl->left);
ystepscale = (rightyfrac - leftyfrac) / (pl->right - pl->left);
}
else
{
xstepscale = 0;
ystepscale = 0;
}
minx = pl->left;
@ -166,8 +174,8 @@ namespace swrenderer
auto viewport = Thread->Viewport.get();
double curxfrac = basexfrac + xstepscale * (x1 + 0.5 - minx);
double curyfrac = baseyfrac + ystepscale * (x1 + 0.5 - minx);
double curxfrac = basexfrac + xstepscale * (x1 - minx);
double curyfrac = baseyfrac + ystepscale * (x1 - minx);
double distance = viewport->PlaneDepth(y, planeheight);

View file

@ -128,7 +128,7 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
// There is not enough precision in the drawing routines to keep the full
// precision for y0. :(
double sprtopscreen;
modf(y0, &sprtopscreen);
modf(y0 + 0.5, &sprtopscreen);
double yscale = parms.destheight / img->GetHeight();
double iyscale = 1 / yscale;
@ -192,6 +192,8 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
int x2_i = int(x2);
fixed_t xiscale_i = FLOAT2FIXED(xiscale);
frac += xiscale_i / 2;
while (x < x2_i)
{
drawerargs.DrawMaskedColumn(&thread, x, iscale, img, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, !parms.masked);

View file

@ -60,7 +60,8 @@ CUSTOM_CVAR (Bool, cl_oldfreelooklimit, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG
}
EXTERN_CVAR(Bool, r_shadercolormaps)
EXTERN_CVAR(Float, maxviewpitch) // [SP] CVAR from GZDoom
EXTERN_CVAR(Float, maxviewpitch) // [SP] CVAR from OpenGL Renderer
EXTERN_CVAR(Bool, r_drawvoxels)
CUSTOM_CVAR(Bool, r_polyrenderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
@ -251,8 +252,8 @@ void FSoftwareRenderer::DrawRemainingPlayerSprites()
int FSoftwareRenderer::GetMaxViewPitch(bool down)
{
const int MAX_DN_ANGLE = 56; // Max looking down angle
const int MAX_UP_ANGLE = 32; // Max looking up angle
int MAX_DN_ANGLE = MIN(56, (int)maxviewpitch); // Max looking down angle
int MAX_UP_ANGLE = MIN(32, (int)maxviewpitch); // Max looking up angle
return (r_polyrenderer) ? int(maxviewpitch) : (down ? MAX_DN_ANGLE : ((cl_oldfreelooklimit) ? MAX_UP_ANGLE : MAX_DN_ANGLE));
}
@ -378,3 +379,20 @@ void FSoftwareRenderer::PreprocessLevel()
void FSoftwareRenderer::CleanLevelData()
{
}
uint32_t FSoftwareRenderer::GetCaps()
{
ActorRenderFeatureFlags FlagSet = RFF_UNCLIPPEDTEX;
if (r_polyrenderer)
FlagSet |= RFF_POLYGONAL | RFF_TILTPITCH;
else if (r_drawvoxels)
FlagSet |= RFF_VOXELS;
if (screen && screen->IsBgra())
FlagSet |= RFF_TRUECOLOR;
else
FlagSet |= RFF_COLORMAP;
return (uint32_t)FlagSet;
}

View file

@ -35,6 +35,8 @@ struct FSoftwareRenderer : public FRenderer
void PreprocessLevel() override;
void CleanLevelData() override;
uint32_t GetCaps() override;
private:
void PrecacheTexture(FTexture *tex, int cache);

View file

@ -142,8 +142,8 @@ namespace swrenderer
curr = (ClipStack*)M_Malloc(sizeof(ClipStack));
curr->next = 0;
memcpy(curr->floorclip, Thread->OpaquePass->floorclip, sizeof(short) * MAXWIDTH);
memcpy(curr->ceilingclip, Thread->OpaquePass->ceilingclip, sizeof(short) * MAXWIDTH);
memcpy(curr->floorclip, Thread->OpaquePass->floorclip, sizeof(short) * Thread->Viewport->RenderTarget->GetWidth());
memcpy(curr->ceilingclip, Thread->OpaquePass->ceilingclip, sizeof(short) * Thread->Viewport->RenderTarget->GetWidth());
curr->ffloor = fakeFloor;
assert(fakeFloor->floorclip == nullptr);
assert(fakeFloor->ceilingclip == nullptr);

View file

@ -72,6 +72,8 @@
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
EXTERN_CVAR(Bool, r_drawvoxels);
EXTERN_CVAR(Bool, r_debug_disable_vis_filter);
extern uint32_t r_renderercaps;
namespace
{
@ -79,7 +81,7 @@ namespace
double line_distance_cull = 1e16;
}
CUSTOM_CVAR(Float, r_sprite_distance_cull, 5000.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CUSTOM_CVAR(Float, r_sprite_distance_cull, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
if (r_sprite_distance_cull > 0.0)
{
@ -91,7 +93,7 @@ CUSTOM_CVAR(Float, r_sprite_distance_cull, 5000.0, CVAR_ARCHIVE | CVAR_GLOBALCON
}
}
CUSTOM_CVAR(Float, r_line_distance_cull, 8000.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CUSTOM_CVAR(Float, r_line_distance_cull, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
if (r_line_distance_cull > 0.0)
{
@ -968,6 +970,12 @@ namespace swrenderer
return false;
}
// check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature,
// check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it.
if (!r_debug_disable_vis_filter && (!!(thing->RenderRequired & ~r_renderercaps)) ||
(!!(thing->RenderHidden & r_renderercaps)))
return false;
// [ZZ] Or less definitely not visible (hue)
// [ZZ] 10.01.2016: don't try to clip stuff inside a skybox against the current portal.
RenderPortal *renderportal = Thread->Portal.get();

View file

@ -51,7 +51,6 @@
#include "r_data/colormaps.h"
#include "p_maputl.h"
#include "p_setup.h"
#include "version.h"
#include "r_utility.h"
#include "r_3dfloors.h"
#include "g_levellocals.h"

View file

@ -539,7 +539,7 @@ namespace swrenderer
thread->PrepareTexture(pic);
for (int x = x1; x < x2; x++)
{
drawerargs.DrawMaskedColumn(thread, x, iscale, pic, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, false);
drawerargs.DrawMaskedColumn(thread, x, iscale, pic, frac + xiscale / 2, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, false);
frac += xiscale;
}

View file

@ -381,6 +381,7 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count,
Next = FirstFont;
FirstFont = this;
Cursor = '_';
ActiveColors = 0;
maxyoffs = 0;

View file

@ -83,6 +83,7 @@
#include "menu/menu.h"
#include "r_data/voxels.h"
#include "vm.h"
#include "r_videoscale.h"
EXTERN_CVAR(Bool, r_blendmethod)
@ -782,7 +783,7 @@ void DSimpleCanvas::Unlock ()
//==========================================================================
DFrameBuffer::DFrameBuffer (int width, int height, bool bgra)
: DSimpleCanvas (width, height, bgra)
: DSimpleCanvas (ViewportScaledWidth(width), ViewportScaledHeight(height), bgra)
{
LastMS = LastSec = FrameCount = LastCount = LastTic = 0;
Accel2D = false;
@ -1289,7 +1290,7 @@ bool V_DoModeSetup (int width, int height, int bits)
FFont::StaticPreloadFonts();
DisplayBits = bits;
V_UpdateModeSize(width, height);
V_UpdateModeSize(screen->GetWidth(), screen->GetHeight());
M_RefreshModesList ();
@ -1627,6 +1628,10 @@ int ActiveFakeRatio(int width, int height)
fakeratio = 3;
}
}
else if (vid_aspect == 0 && ViewportIsScaled43())
{
fakeratio = 0;
}
if (vid_nowidescreen)
{
if (!vid_tft)

View file

@ -48,12 +48,12 @@ const char *GetVersionString();
#ifdef GIT_DESCRIPTION
#define VERSIONSTR GIT_DESCRIPTION
#else
#define VERSIONSTR "2.1pre"
#define VERSIONSTR "3.2pre"
#endif
// The version as seen in the Windows resource
#define RC_FILEVERSION 2,1,9999,0
#define RC_PRODUCTVERSION 2,1,9999,0
#define RC_FILEVERSION 3,1,9999,0
#define RC_PRODUCTVERSION 3,1,9999,0
#define RC_PRODUCTVERSION2 VERSIONSTR
// These are for content versioning. The current state is '3.2'.
#define VER_MAJOR 3
@ -94,15 +94,15 @@ const char *GetVersionString();
#define SAVEVER 4552
// This is so that derivates can use the same savegame versions without worrying about engine compatibility
#define GAMESIG "QZDOOM"
#define BASEWAD "qzdoom.pk3"
#define GAMESIG "GZDOOM"
#define BASEWAD "gzdoom.pk3"
#define BASESF "gzdoom.sf2"
// More stuff that needs to be different for derivatives.
#define GAMENAME "QZDoom"
#define GAMENAMELOWERCASE "qzdoom"
#define FORUM_URL "http://forum.drdteam.org/viewforum.php?f=196"
#define BUGS_FORUM_URL "http://forum.drdteam.org/viewforum.php?f=197"
#define GAMENAME "GZDoom"
#define GAMENAMELOWERCASE "gzdoom"
#define FORUM_URL "http://forum.drdteam.org"
#define BUGS_FORUM_URL "http://forum.drdteam.org/viewforum.php?f=24"
#if defined(__APPLE__) || defined(_WIN32)
#define GAME_DIR GAMENAME

View file

@ -425,8 +425,8 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC
// way to force a CreateFramebuffer call without a lot of refactoring.
if (currentrenderer == 0)
{
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
setmodeneeded = true;
}
@ -434,8 +434,8 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC
CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
setmodeneeded = true;
}
@ -449,8 +449,8 @@ CUSTOM_CVAR (Float, vid_winscale, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
else if (Video)
{
Video->SetWindowedScale (self);
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
//setmodeneeded = true; // This CVAR doesn't do anything and only causes problems!
}

View file

@ -484,10 +484,22 @@ static void CALLBACK TimerTicked(UINT id, UINT msg, DWORD_PTR user, DWORD_PTR dw
// saved tic.
//
//==========================================================================
static uint32_t FrameTime;
void I_SetFrameTime()
{
FrameTime = timeGetTime();
}
double I_GetTimeFrac(uint32_t *ms)
{
DWORD now = timeGetTime();
//DWORD now = MAX<uint32_t>(FrameTime, TicStart);
DWORD now = FrameTime;
if (FrameTime < TicStart)
{
// Preliminary kept in to see if this can happen. Should be removed once confirmed ok.
Printf("Timer underflow!\n");
}
if (ms != NULL)
{
*ms = TicNext;

View file

@ -63,6 +63,7 @@ extern int (*I_WaitForTic) (int);
extern void (*I_FreezeTime) (bool frozen);
double I_GetTimeFrac (uint32_t *ms);
void I_SetFrameTime();
// Return a seed value for the RNG.
unsigned int I_MakeRNGSeed();

View file

@ -1260,8 +1260,8 @@ void Win32GLFrameBuffer::NewRefreshRate ()
if (m_Fullscreen)
{
setmodeneeded = true;
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
NewBits = DisplayBits;
}
}

View file

@ -72,13 +72,13 @@ BEGIN
" BEGIN\r\n"
" VALUE ""Comments"", ""Thanks to id Software for creating DOOM and then releasing the source code. Thanks also to TeamTNT for creating BOOM, which ZDoom is partially based on. Includes code based on the Cajun Bot 0.97 by Martin Collberg.""\r\n"
" VALUE ""CompanyName"", "" ""\r\n"
" VALUE ""FileDescription"", ""QZDoom""\r\n"
" VALUE ""FileDescription"", ""GZDoom""\r\n"
" VALUE ""FileVersion"", RC_FILEVERSION2\r\n"
" VALUE ""InternalName"", ""QZDoom""\r\n"
" VALUE ""InternalName"", ""GZDoom""\r\n"
" VALUE ""LegalCopyright"", ""Copyright \\u00A9 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al.""\r\n"
" VALUE ""LegalTrademarks"", ""DoomR is a Registered Trademark of id Software, Inc.""\r\n"
" VALUE ""OriginalFilename"", ""qzdoom.exe""\r\n"
" VALUE ""ProductName"", ""QZDoom""\r\n"
" VALUE ""OriginalFilename"", ""gzdoom.exe""\r\n"
" VALUE ""ProductName"", ""GZDoom""\r\n"
" VALUE ""ProductVersion"", RC_PRODUCTVERSION2\r\n"
" END\r\n"
" END\r\n"
@ -228,7 +228,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
CONTROL 101, IDC_STATIC, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 7, 7, 21, 20
CONTROL "Welcome to QZDoom!", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 42, 8, 180, 8
CONTROL "Welcome to GZDoom!", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 42, 8, 180, 8
CONTROL "<Version info>", IDC_WELCOME_VERSION, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 42, 18, 180, 8
CONTROL "IWAD selection", IDC_STATIC, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 8, 32, 208, 117
CONTROL "Select which game file (IWAD) to run.", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 12, 44, 190, 8
@ -242,7 +242,7 @@ FONT 8, "MS Shell Dlg"
CONTROL "Load lights", IDC_WELCOME_LIGHTS, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 130, 180, 51, 10
CONTROL "Load brightmaps", IDC_WELCOME_BRIGHTMAPS, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 130, 190, 65, 10
CONTROL "Don't ask me this again", IDC_DONTASKIWAD, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 73, 211, 87, 10
CONTROL "Play QZDoom", IDOK, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 8, 228, 90, 14
CONTROL "Play GZDoom", IDOK, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 8, 228, 90, 14
CONTROL "Exit", IDCANCEL, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 166, 228, 50, 14
}
@ -504,13 +504,13 @@ BEGIN
BEGIN
VALUE "Comments", "Thanks to id Software for creating DOOM and then releasing the source code. Thanks also to TeamTNT for creating BOOM, which ZDoom is partially based on. Includes code based on the Cajun Bot 0.97 by Martin Collberg."
VALUE "CompanyName", " "
VALUE "FileDescription", "QZDoom"
VALUE "FileDescription", "GZDoom"
VALUE "FileVersion", RC_FILEVERSION2
VALUE "InternalName", "QZDoom"
VALUE "InternalName", "GZDoom"
VALUE "LegalCopyright", "Copyright \u00A9 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al."
VALUE "LegalTrademarks", "DoomR is a Registered Trademark of id Software, Inc."
VALUE "OriginalFilename", "qzdoom.exe"
VALUE "ProductName", "QZDoom"
VALUE "OriginalFilename", "gzdoom.exe"
VALUE "ProductName", "GZDoom"
VALUE "ProductVersion", RC_PRODUCTVERSION2
END
END

View file

@ -296,10 +296,10 @@ static int yyGrowStack(yyParser *p){
newSize = p->yystksz*2 + 100;
idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
if( p->yystack==&p->yystk0 ){
pNew = malloc(newSize*sizeof(pNew[0]));
pNew = (yyStackEntry *)malloc(newSize*sizeof(pNew[0]));
if( pNew ) pNew[0] = p->yystk0;
}else{
pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
pNew = (yyStackEntry *)realloc(p->yystack, newSize*sizeof(pNew[0]));
}
if( pNew ){
p->yystack = pNew;

View file

@ -1,3 +1,3 @@
cmake_minimum_required( VERSION 2.8.7 )
add_pk3(qzdoom.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static)
add_pk3(gzdoom.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static)

View file

@ -2191,6 +2191,7 @@ VIDMNU_HIDPI = "Retina/HiDPI support";
VIDMNU_ASPECTRATIO = "Aspect ratio";
VIDMNU_FORCEASPECT = "Force aspect ratio";
VIDMNU_5X4ASPECTRATIO = "Enable 5:4 aspect ratio";
VIDMNU_SCALEMODE = "Resolution scale";
VIDMNU_ENTERTEXT = "Press ENTER to set mode";
VIDMNU_TESTTEXT1 = "T to test mode for 5 seconds";
VIDMNU_TESTTEXT2 = "Please wait 5 seconds...";

View file

@ -21,7 +21,6 @@ gameinfo
defkickback = 100
skyflatname = "F_SKY1"
translator = "xlat/doom.txt"
mapinfo = "mapinfo/doom2.txt"
defaultbloodcolor = "68 00 00"
defaultbloodparticlecolor = "ff 00 00"
backpacktype = "Backpack"

View file

@ -1849,6 +1849,16 @@ OptionValue RatiosTFT
6.0, "21:9"
-1, "$OPTVAL_ALL"
}
OptionValue ScaleModes
{
0, "$OPTVAL_OFF"
1, "320x200"
2, "640x400"
3, "0.5x"
4, "0.75x"
5, "2x SSAA"
6, "1280x800"
}
OptionMenu VideoModeMenu protected
{
@ -1862,6 +1872,7 @@ OptionMenu VideoModeMenu protected
Option "$VIDMNU_ASPECTRATIO", "menu_screenratios", "Ratios"
Option "$VIDMNU_FORCEASPECT", "vid_aspect", "ForceRatios"
Option "$VIDMNU_5X4ASPECTRATIO", "vid_tft", "YesNo"
Option "$VIDMNU_SCALEMODE", "vid_scalemode", "ScaleModes"
StaticText " "
ScreenResolution "res_0"
ScreenResolution "res_1"

View file

@ -122,7 +122,7 @@ float R_DoomLightingEquation(float light)
float shade = 2.0 - (L + 12.0) / 128.0;
float lightscale;
if ((uPalLightLevels & 0xff) != 0)
lightscale = float(-int(-(shade - vis) * 32.0)) / 32.0;
lightscale = float(-floor(-(shade - vis) * 31.0) - 0.5) / 31.0;
else
lightscale = shade - vis;

View file

@ -62,7 +62,7 @@ void main()
gl_ClipDistance[4] = worldcoord.y + ((uSplitBottomPlane.w + uSplitBottomPlane.x * worldcoord.x + uSplitBottomPlane.y * worldcoord.z) * uSplitBottomPlane.z);
}
vWorldNormal = NormalModelMatrix * aNormal;
vWorldNormal = NormalModelMatrix * normalize(aNormal);
vEyeNormal = NormalViewMatrix * vWorldNormal;
#endif

View file

@ -199,6 +199,8 @@ class Actor : Thinker native
native int WoundHealth; // Health needed to enter wound state
native readonly color BloodColor;
native readonly int BloodTranslation;
native int RenderHidden;
native int RenderRequired;
meta String Obituary; // Player was killed by this actor
meta String HitObituary; // Player was killed by this actor in melee
@ -285,6 +287,8 @@ class Actor : Thinker native
property Ripperlevel: RipperLevel;
property RipLevelMin: RipLevelMin;
property RipLevelMax: RipLevelMax;
property RenderHidden: RenderHidden;
property RenderRequired: RenderRequired;
// need some definition work first
//FRenderStyle RenderStyle;
@ -362,6 +366,8 @@ class Actor : Thinker native
GibHealth int.min;
DeathHeight -1;
BurnHeight -1;
RenderHidden 0;
RenderRequired 0;
}
// Functions

View file

@ -656,6 +656,8 @@ struct StringStruct native
native String CharAt(int pos) const;
native int CharCodeAt(int pos) const;
native String Filter();
native int IndexOf(String substr, int startIndex = 0) const;
native int LastIndexOf(String substr) const;
}
class SectorEffect : Thinker native

View file

@ -1171,4 +1171,24 @@ enum EWeaponState
WF_USER2OK = 1 << 9,
WF_USER3OK = 1 << 10,
WF_USER4OK = 1 << 11,
};
};
// these flags are for filtering actor visibility based on certain conditions of the renderer's feature support.
// currently, no renderer supports every single one of these features.
enum ActorRenderFeatureFlag
{
RFF_FLATSPRITES = 1<<0, // flat sprites
RFF_MODELS = 1<<1, // 3d models
RFF_SLOPE3DFLOORS = 1<<2, // sloped 3d floor support
RFF_TILTPITCH = 1<<3, // full free-look
RFF_ROLLSPRITES = 1<<4, // roll sprites
RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls
RFF_MATSHADER = 1<<6, // material shaders
RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers)
RFF_BRIGHTMAP = 1<<8, // brightmaps
RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife)
RFF_POLYGONAL = 1<<10, // uses polygons instead of wallscans/visplanes (i.e. softpoly and hardware opengl)
RFF_TRUECOLOR = 1<<11, // renderer is currently truecolor
RFF_VOXELS = 1<<12, // renderer is capable of voxels
};

View file

@ -82,7 +82,7 @@ class CWeapStaff : ClericWeapon
{
angle = t.angleFromSource;
if (((t.linetarget.player && (!t.linetarget.IsTeammate(self) || level.teamdamage != 0)) || t.linetarget.bIsMonster)
&& (!t.linetarget.bDormant && !bInvulnerable))
&& (!t.linetarget.bDormant && !t.linetarget.bInvulnerable))
{
int newLife = player.health + (damage >> 3);
newLife = newLife > max ? max : newLife;