This commit is contained in:
Rachael Alexanderson 2017-02-01 21:57:37 -05:00
commit 226e5238fc
28 changed files with 74 additions and 42 deletions

View file

@ -424,6 +424,7 @@ enum ActorRenderFlag
RF_MASKROTATION = 0x00200000, // [MC] Only draw the actor when viewed from a certain angle range. RF_MASKROTATION = 0x00200000, // [MC] Only draw the actor when viewed from a certain angle range.
RF_ABSMASKANGLE = 0x00400000, // [MC] The mask rotation does not offset by the actor's angle. RF_ABSMASKANGLE = 0x00400000, // [MC] The mask rotation does not offset by the actor's angle.
RF_ABSMASKPITCH = 0x00800000, // [MC] The mask rotation does not offset by the actor's pitch. RF_ABSMASKPITCH = 0x00800000, // [MC] The mask rotation does not offset by the actor's pitch.
RF_INTERPOLATEANGLES = 0x01000000, // [MC] Allow interpolation of the actor's angle, pitch and roll.
RF_FORCEYBILLBOARD = 0x10000, // [BB] OpenGL only: draw with y axis billboard, i.e. anchored to the floor (overrides gl_billboard_mode setting) RF_FORCEYBILLBOARD = 0x10000, // [BB] OpenGL only: draw with y axis billboard, i.e. anchored to the floor (overrides gl_billboard_mode setting)
RF_FORCEXYBILLBOARD = 0x20000, // [BB] OpenGL only: draw with xy axis billboard, i.e. unanchored (overrides gl_billboard_mode setting) RF_FORCEXYBILLBOARD = 0x20000, // [BB] OpenGL only: draw with xy axis billboard, i.e. unanchored (overrides gl_billboard_mode setting)

View file

@ -1190,7 +1190,7 @@ static void PrintSecretString(const char *string, bool thislevel)
{ {
if (string[1] == 'S' || string[1] == 's') if (string[1] == 'S' || string[1] == 's')
{ {
auto secnum = strtoul(string+2, (char**)&string, 10); auto secnum = (unsigned)strtoull(string+2, (char**)&string, 10);
if (*string == ';') string++; if (*string == ';') string++;
if (thislevel && secnum < level.sectors.Size()) if (thislevel && secnum < level.sectors.Size())
{ {
@ -1201,7 +1201,7 @@ static void PrintSecretString(const char *string, bool thislevel)
} }
else if (string[1] == 'T' || string[1] == 't') else if (string[1] == 'T' || string[1] == 't')
{ {
long tid = strtol(string+2, (char**)&string, 10); long tid = (long)strtoll(string+2, (char**)&string, 10);
if (*string == ';') string++; if (*string == ';') string++;
FActorIterator it(tid); FActorIterator it(tid);
AActor *actor; AActor *actor;

View file

@ -200,7 +200,7 @@ bool FBaseCVar::ToBool (UCVarValue value, ECVarType type)
else if (stricmp (value.String, "false") == 0) else if (stricmp (value.String, "false") == 0)
return false; return false;
else else
return !!strtol (value.String, NULL, 0); return !!strtoll (value.String, NULL, 0);
case CVAR_GUID: case CVAR_GUID:
return false; return false;
@ -233,7 +233,7 @@ int FBaseCVar::ToInt (UCVarValue value, ECVarType type)
else if (stricmp (value.String, "false") == 0) else if (stricmp (value.String, "false") == 0)
res = 0; res = 0;
else else
res = strtol (value.String, NULL, 0); res = (int)strtoll (value.String, NULL, 0);
break; break;
} }
case CVAR_GUID: res = 0; break; case CVAR_GUID: res = 0; break;
@ -458,7 +458,7 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
else if (stricmp (value, "false") == 0) else if (stricmp (value, "false") == 0)
ret.Bool = false; ret.Bool = false;
else else
ret.Bool = strtol (value, NULL, 0) != 0; ret.Bool = strtoll (value, NULL, 0) != 0;
break; break;
case CVAR_Int: case CVAR_Int:
@ -467,7 +467,7 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
else if (stricmp (value, "false") == 0) else if (stricmp (value, "false") == 0)
ret.Int = 0; ret.Int = 0;
else else
ret.Int = strtol (value, NULL, 0); ret.Int = (int)strtoll (value, NULL, 0);
break; break;
case CVAR_Float: case CVAR_Float:

View file

@ -705,7 +705,7 @@ void AddCommandString (char *cmd, int keynum)
if (cmd[4] == ' ') if (cmd[4] == ' ')
{ {
tics = strtol (cmd + 5, NULL, 0); tics = (int)strtoll (cmd + 5, NULL, 0);
} }
else else
{ {

View file

@ -885,7 +885,7 @@ static int PatchThing (int thingy)
while ((result = GetLine ()) == 1) while ((result = GetLine ()) == 1)
{ {
char *endptr; char *endptr;
unsigned long val = strtoul (Line2, &endptr, 10); unsigned long val = (unsigned long)strtoull (Line2, &endptr, 10);
size_t linelen = strlen (Line1); size_t linelen = strlen (Line1);
if (linelen == 10 && stricmp (Line1, "Hit points") == 0) if (linelen == 10 && stricmp (Line1, "Hit points") == 0)
@ -1064,11 +1064,7 @@ static int PatchThing (int thingy)
{ {
if (IsNum (strval)) if (IsNum (strval))
{ {
// I have no idea why everyone insists on using strtol here even though it fails value[0] |= (unsigned long)strtoll(strval, NULL, 10);
// dismally if a value is parsed where the highest bit it set. Do people really
// use negative values here? Let's better be safe and check both.
if (strchr(strval, '-')) value[0] |= (unsigned long)strtol(strval, NULL, 10);
else value[0] |= (unsigned long)strtoul(strval, NULL, 10);
vchanged[0] = true; vchanged[0] = true;
} }
else else

View file

@ -1059,6 +1059,7 @@ void D_PageTicker (void)
void D_PageDrawer (void) void D_PageDrawer (void)
{ {
screen->Clear(0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0);
if (Page != NULL) if (Page != NULL)
{ {
screen->DrawTexture (Page, 0, 0, screen->DrawTexture (Page, 0, 0,
@ -1066,11 +1067,9 @@ void D_PageDrawer (void)
DTA_Masked, false, DTA_Masked, false,
DTA_BilinearFilter, true, DTA_BilinearFilter, true,
TAG_DONE); TAG_DONE);
screen->FillBorder (NULL);
} }
else else
{ {
screen->Clear (0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0);
if (!PageBlank) if (!PageBlank)
{ {
screen->DrawText (SmallFont, CR_WHITE, 0, 0, "Page graphic goes here", TAG_DONE); screen->DrawText (SmallFont, CR_WHITE, 0, 0, "Page graphic goes here", TAG_DONE);

View file

@ -192,7 +192,7 @@ void FS_EmulateCmd(char * string)
else if (sc.Compare("gr_fogcolor")) else if (sc.Compare("gr_fogcolor"))
{ {
sc.MustGetString(); sc.MustGetString();
level.fadeto = strtol(sc.String, NULL, 16); level.fadeto = (uint32_t)strtoull(sc.String, NULL, 16);
} }
else else

View file

@ -1099,7 +1099,7 @@ void G_WorldDone (void)
if (strncmp (nextlevel, "enDSeQ", 6) == 0) if (strncmp (nextlevel, "enDSeQ", 6) == 0)
{ {
FName endsequence = ENamedName(strtol(nextlevel.GetChars()+6, NULL, 16)); FName endsequence = ENamedName(strtoll(nextlevel.GetChars()+6, NULL, 16));
// Strife needs a special case here to choose between good and sad ending. Bad is handled elsewhere. // Strife needs a special case here to choose between good and sad ending. Bad is handled elsewhere.
if (endsequence == NAME_Inter_Strife) if (endsequence == NAME_Inter_Strife)
{ {

View file

@ -386,7 +386,7 @@ void ADynamicLight::UpdateLocation()
intensity = m_currentRadius; intensity = m_currentRadius;
} }
radius = intensity * 2.0f; radius = intensity * 2.0f;
assert(radius >= m_currentRadius * 2); if (radius < m_currentRadius * 2) radius = m_currentRadius * 2;
if (X() != oldx || Y() != oldy || radius != oldradius) if (X() != oldx || Y() != oldy || radius != oldradius)
{ {

View file

@ -38,6 +38,7 @@
#include "r_state.h" #include "r_state.h"
#include "d_player.h" #include "d_player.h"
#include "g_levellocals.h" #include "g_levellocals.h"
#include "r_utility.h"
//#include "resources/voxels.h" //#include "resources/voxels.h"
//#include "gl/gl_intern.h" //#include "gl/gl_intern.h"
@ -1011,6 +1012,13 @@ void gl_RenderModel(GLSprite * spr)
// Model space => World space // Model space => World space
gl_RenderState.mModelMatrix.translate(spr->x, spr->z, spr->y ); gl_RenderState.mModelMatrix.translate(spr->x, spr->z, spr->y );
if (spr->actor->renderflags & RF_INTERPOLATEANGLES)
{
// [Nash] use interpolated angles
DRotator Angles = spr->actor->InterpolatedAngles(r_TicFracF);
angle = Angles.Yaw.Degrees;
}
// Applying model transformations: // Applying model transformations:
// 1) Applying actor angle, pitch and roll to the model // 1) Applying actor angle, pitch and roll to the model
gl_RenderState.mModelMatrix.rotate(-angle, 0, 1, 0); gl_RenderState.mModelMatrix.rotate(-angle, 0, 1, 0);

View file

@ -552,7 +552,7 @@ CCMD(skyfog)
{ {
if (argv.argc()>1) if (argv.argc()>1)
{ {
skyfog=strtol(argv[1],NULL,0); skyfog = MAX(0, (int)strtoull(argv[1], NULL, 0));
} }
} }

View file

@ -737,8 +737,11 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
int clipres = GLRenderer->mClipPortal->ClipPoint(thingpos); int clipres = GLRenderer->mClipPortal->ClipPoint(thingpos);
if (clipres == GLPortal::PClip_InFront) return; if (clipres == GLPortal::PClip_InFront) return;
} }
// disabled because almost none of the actual game code is even remotely prepared for this. Sorry for the few cases where it may be desired, but the overall effect is too bad. // disabled because almost none of the actual game code is even remotely prepared for this. If desired, use the INTERPOLATE flag.
Angles = thing->Angles;// InterpolatedAngles(r_TicFracF); if (thing->renderflags & RF_INTERPOLATEANGLES)
Angles = thing->InterpolatedAngles(r_TicFracF);
else
Angles = thing->Angles;
player_t *player = &players[consoleplayer]; player_t *player = &players[consoleplayer];
FloatRect r; FloatRect r;

View file

@ -65,7 +65,7 @@ CVAR (Bool, show_obituaries, true, CVAR_ARCHIVE)
CVAR (Float, snd_menuvolume, 0.6f, CVAR_ARCHIVE) CVAR (Float, snd_menuvolume, 0.6f, CVAR_ARCHIVE)
CVAR(Int, m_use_mouse, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Int, m_use_mouse, 2, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Int, m_show_backbutton, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Int, m_show_backbutton, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
DMenu *DMenu::CurrentMenu; DMenu *DMenu::CurrentMenu;

View file

@ -666,7 +666,7 @@ static EColorRange ParseOptionColor(FScanner &sc, FOptionMenuDescriptor *desc)
cr = V_FindFontColor(sc.String); cr = V_FindFontColor(sc.String);
if (cr == CR_UNTRANSLATED && !sc.Compare("untranslated") && isdigit(sc.String[0])) if (cr == CR_UNTRANSLATED && !sc.Compare("untranslated") && isdigit(sc.String[0]))
{ {
if (strtol(sc.String, NULL, 0)) cr = OptionSettings.mFontColorHeader; if (strtoll(sc.String, NULL, 0)) cr = OptionSettings.mFontColorHeader;
} }
} }
return cr; return cr;

View file

@ -366,8 +366,8 @@ static bool GetSelectedSize (int *width, int *height)
char *breakpt; char *breakpt;
if (it->GetString(FOptionMenuScreenResolutionLine::SRL_INDEX+hsel, buffer, sizeof(buffer))) if (it->GetString(FOptionMenuScreenResolutionLine::SRL_INDEX+hsel, buffer, sizeof(buffer)))
{ {
*width = strtol (buffer, &breakpt, 10); *width = (int)strtoll (buffer, &breakpt, 10);
*height = strtol (breakpt+1, NULL, 10); *height = (int)strtoll (breakpt+1, NULL, 10);
return true; return true;
} }
} }

View file

@ -982,7 +982,12 @@ CCMD (dump3df)
{ {
if (argv.argc() > 1) if (argv.argc() > 1)
{ {
int sec = strtol(argv[1], NULL, 10); int sec = (int)strtoll(argv[1], NULL, 10);
if ((unsigned)sec >= level.sectors.Size())
{
Printf("Sector %d does not exist.\n", sec);
return;
}
sector_t *sector = &level.sectors[sec]; sector_t *sector = &level.sectors[sec];
TArray<F3DFloor*> & ffloors=sector->e->XFloor.ffloors; TArray<F3DFloor*> & ffloors=sector->e->XFloor.ffloors;

View file

@ -1086,12 +1086,12 @@ static void ReadArrayVars (FSerializer &file, FWorldGlobalArray *vars, size_t co
const char *arraykey; const char *arraykey;
while ((arraykey = file.GetKey())) while ((arraykey = file.GetKey()))
{ {
int i = (int)strtol(arraykey, nullptr, 10); int i = (int)strtoll(arraykey, nullptr, 10);
if (file.BeginObject(nullptr)) if (file.BeginObject(nullptr))
{ {
while ((arraykey = file.GetKey())) while ((arraykey = file.GetKey()))
{ {
int k = (int)strtol(arraykey, nullptr, 10); int k = (int)strtoll(arraykey, nullptr, 10);
int val; int val;
file(nullptr, val); file(nullptr, val);
vars[i].Insert(k, val); vars[i].Insert(k, val);

View file

@ -2540,7 +2540,7 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmaps
case Sector_Set3DFloor: case Sector_Set3DFloor:
if (msd->toptexture[0]=='#') if (msd->toptexture[0]=='#')
{ {
sd->SetTexture(side_t::top, FNullTextureID() +(-strtol(&msd->toptexture[1], NULL, 10))); // store the alpha as a negative texture index sd->SetTexture(side_t::top, FNullTextureID() +(int)(-strtoll(&msd->toptexture[1], NULL, 10))); // store the alpha as a negative texture index
// This will be sorted out by the 3D-floor code later. // This will be sorted out by the 3D-floor code later.
} }
else else
@ -2978,6 +2978,15 @@ static bool P_VerifyBlockMap(int count)
break; break;
} }
// there's some node builder which carelessly removed the initial 0-entry.
// Rather than second-guessing the intent, let's just discard such blockmaps entirely
// to be on the safe side.
if (*list != 0)
{
Printf(PRINT_HIGH, "P_VerifyBlockMap: first entry is not 0.\n");
return false;
}
// scan the list for out-of-range linedef indicies in list // scan the list for out-of-range linedef indicies in list
for(tmplist = list; *tmplist != -1; tmplist++) for(tmplist = list; *tmplist != -1; tmplist++)
{ {

View file

@ -731,7 +731,7 @@ FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, PClassActor *mytype,
*pt = '\0'; *pt = '\0';
offset = pt + 1; offset = pt + 1;
} }
v = offset ? strtol (offset, NULL, 0) : 0; v = offset ? (int)strtoll (offset, NULL, 0) : 0;
// Get the state's address. // Get the state's address.
if (type == mytype) if (type == mytype)

View file

@ -103,7 +103,7 @@ loop:
c = *sourcep++; c = *sourcep++;
if (c == 'x' || c == 'X') if (c == 'x' || c == 'X')
{ {
yylval->val = (int)strtol(sourcep, &sourcep, 16); yylval->val = (int)strtoll(sourcep, &sourcep, 16);
return TokenTrans[NUM]; return TokenTrans[NUM];
} }
else else
@ -114,7 +114,7 @@ loop:
char *endp; char *endp;
sourcep--; sourcep--;
yylval->val = (int)strtol(sourcep, &endp, 10); yylval->val = (int)strtoll(sourcep, &endp, 10);
if (*endp == '.') if (*endp == '.')
{ {
// It's a float // It's a float

View file

@ -238,7 +238,7 @@ struct FUDMFKey
FUDMFKey& operator =(const FString &val) FUDMFKey& operator =(const FString &val)
{ {
Type = UDMF_String; Type = UDMF_String;
IntVal = strtol(val.GetChars(), NULL, 0); IntVal = (int)strtoll(val.GetChars(), NULL, 0);
FloatVal = strtod(val.GetChars(), NULL); FloatVal = strtod(val.GetChars(), NULL);
StringVal = val; StringVal = val;
return *this; return *this;

View file

@ -554,12 +554,12 @@ bool FScanner::GetToken ()
String[StringLen - 2] == 'u' || String[StringLen - 2] == 'U') String[StringLen - 2] == 'u' || String[StringLen - 2] == 'U')
{ {
TokenType = TK_UIntConst; TokenType = TK_UIntConst;
Number = strtoul(String, &stopper, 0); Number = (int)strtoull(String, &stopper, 0);
Float = (unsigned)Number; Float = (unsigned)Number;
} }
else else
{ {
Number = strtol(String, &stopper, 0); Number = (int)strtoll(String, &stopper, 0);
Float = Number; Float = Number;
} }
} }
@ -660,7 +660,7 @@ bool FScanner::GetNumber ()
} }
else else
{ {
Number = strtol (String, &stopper, 0); Number = (int)strtoll (String, &stopper, 0);
if (*stopper != 0) if (*stopper != 0)
{ {
ScriptError ("SC_GetNumber: Bad numeric constant \"%s\".", String); ScriptError ("SC_GetNumber: Bad numeric constant \"%s\".", String);
@ -715,7 +715,7 @@ bool FScanner::CheckNumber ()
} }
else else
{ {
Number = strtol (String, &stopper, 0); Number = (int)strtoll (String, &stopper, 0);
if (*stopper != 0) if (*stopper != 0)
{ {
UnGet(); UnGet();

View file

@ -635,7 +635,7 @@ static void ParseSpriteFrames (PClassActor *info, TArray<FState> &states, TArray
char *stop; char *stop;
*colon = 0; *colon = 0;
rate = strtol (token, &stop, 10); rate = (int)strtoll (token, &stop, 10);
if (stop == token || rate < 1 || rate > 65534) if (stop == token || rate < 1 || rate > 65534)
{ {
sc.ScriptError ("Rates must be in the range [0,65534]"); sc.ScriptError ("Rates must be in the range [0,65534]");

View file

@ -326,6 +326,7 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(RF, ABSMASKPITCH, AActor, renderflags), DEFINE_FLAG(RF, ABSMASKPITCH, AActor, renderflags),
DEFINE_FLAG(RF, XFLIP, AActor, renderflags), DEFINE_FLAG(RF, XFLIP, AActor, renderflags),
DEFINE_FLAG(RF, YFLIP, AActor, renderflags), DEFINE_FLAG(RF, YFLIP, AActor, renderflags),
DEFINE_FLAG(RF, INTERPOLATEANGLES, AActor, renderflags),
// Bounce flags // Bounce flags
DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags), DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags),

View file

@ -346,6 +346,16 @@ static void PrintProperty(FLispString &out, ZCC_TreeNode *node)
out.Close(); out.Close();
} }
static void PrintStaticArrayState(FLispString &out, ZCC_TreeNode *node)
{
auto *snode = (ZCC_StaticArrayStatement *)node;
out.Break();
out.Open("static-array");
out.AddName(snode->Id);
PrintNodes(out, snode->Values, false, true);
out.Close();
}
static void PrintEnum(FLispString &out, ZCC_TreeNode *node) static void PrintEnum(FLispString &out, ZCC_TreeNode *node)
{ {
ZCC_Enum *enode = (ZCC_Enum *)node; ZCC_Enum *enode = (ZCC_Enum *)node;
@ -944,6 +954,7 @@ void (* const TreeNodePrinter[NUM_AST_NODE_TYPES])(FLispString &, ZCC_TreeNode *
PrintVectorInitializer, PrintVectorInitializer,
PrintDeclFlags, PrintDeclFlags,
PrintExprClassCast, PrintExprClassCast,
PrintStaticArrayState,
PrintProperty, PrintProperty,
}; };

View file

@ -2731,7 +2731,7 @@ static bool ReadResponse (HWND hDlg, char *header, SOCKET sock, char *buf, int b
char *lenhead = strstr (header, "content-length: "); char *lenhead = strstr (header, "content-length: ");
if (lenhead != 0) if (lenhead != 0)
{ {
len = strtol (lenhead + 16, NULL, 10); len = (int)strtoll (lenhead + 16, NULL, 10);
if (file != INVALID_HANDLE_VALUE) if (file != INVALID_HANDLE_VALUE)
{ {
ShowWindow (GetDlgItem (hDlg, IDC_BOINGPROGRESS), SW_SHOW); ShowWindow (GetDlgItem (hDlg, IDC_BOINGPROGRESS), SW_SHOW);

View file

@ -1104,12 +1104,12 @@ digits = [0-9];
long FString::ToLong (int base) const long FString::ToLong (int base) const
{ {
return strtol (Chars, NULL, base); return (long)strtoll (Chars, NULL, base);
} }
unsigned long FString::ToULong (int base) const unsigned long FString::ToULong (int base) const
{ {
return strtoul (Chars, NULL, base); return (unsigned long)strtoull (Chars, NULL, base);
} }
double FString::ToDouble () const double FString::ToDouble () const

View file

@ -1,5 +1,4 @@
in vec4 pixelpos; in vec4 pixelpos;
in vec2 glowdist;
out vec4 FragColor; out vec4 FragColor;
//=========================================================================== //===========================================================================