diff --git a/src/actor.h b/src/actor.h index d83446827..652d40aa1 100644 --- a/src/actor.h +++ b/src/actor.h @@ -424,6 +424,7 @@ enum ActorRenderFlag 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_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_FORCEXYBILLBOARD = 0x20000, // [BB] OpenGL only: draw with xy axis billboard, i.e. unanchored (overrides gl_billboard_mode setting) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 46ab072f2..7428fceea 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -1190,7 +1190,7 @@ static void PrintSecretString(const char *string, bool thislevel) { 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 (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') { - long tid = strtol(string+2, (char**)&string, 10); + long tid = (long)strtoll(string+2, (char**)&string, 10); if (*string == ';') string++; FActorIterator it(tid); AActor *actor; diff --git a/src/c_cvars.cpp b/src/c_cvars.cpp index 11ebf5574..82be8663e 100644 --- a/src/c_cvars.cpp +++ b/src/c_cvars.cpp @@ -200,7 +200,7 @@ bool FBaseCVar::ToBool (UCVarValue value, ECVarType type) else if (stricmp (value.String, "false") == 0) return false; else - return !!strtol (value.String, NULL, 0); + return !!strtoll (value.String, NULL, 0); case CVAR_GUID: return false; @@ -233,7 +233,7 @@ int FBaseCVar::ToInt (UCVarValue value, ECVarType type) else if (stricmp (value.String, "false") == 0) res = 0; else - res = strtol (value.String, NULL, 0); + res = (int)strtoll (value.String, NULL, 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) ret.Bool = false; else - ret.Bool = strtol (value, NULL, 0) != 0; + ret.Bool = strtoll (value, NULL, 0) != 0; break; case CVAR_Int: @@ -467,7 +467,7 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type) else if (stricmp (value, "false") == 0) ret.Int = 0; else - ret.Int = strtol (value, NULL, 0); + ret.Int = (int)strtoll (value, NULL, 0); break; case CVAR_Float: diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index 296697ee7..52ea3d63a 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -705,7 +705,7 @@ void AddCommandString (char *cmd, int keynum) if (cmd[4] == ' ') { - tics = strtol (cmd + 5, NULL, 0); + tics = (int)strtoll (cmd + 5, NULL, 0); } else { diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 312333676..7fecec550 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -885,7 +885,7 @@ static int PatchThing (int thingy) while ((result = GetLine ()) == 1) { char *endptr; - unsigned long val = strtoul (Line2, &endptr, 10); + unsigned long val = (unsigned long)strtoull (Line2, &endptr, 10); size_t linelen = strlen (Line1); if (linelen == 10 && stricmp (Line1, "Hit points") == 0) @@ -1064,11 +1064,7 @@ static int PatchThing (int thingy) { if (IsNum (strval)) { - // I have no idea why everyone insists on using strtol here even though it fails - // 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); + value[0] |= (unsigned long)strtoll(strval, NULL, 10); vchanged[0] = true; } else diff --git a/src/d_main.cpp b/src/d_main.cpp index fb4acefda..671bddb8c 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1059,6 +1059,7 @@ void D_PageTicker (void) void D_PageDrawer (void) { + screen->Clear(0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0); if (Page != NULL) { screen->DrawTexture (Page, 0, 0, @@ -1066,11 +1067,9 @@ void D_PageDrawer (void) DTA_Masked, false, DTA_BilinearFilter, true, TAG_DONE); - screen->FillBorder (NULL); } else { - screen->Clear (0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0); if (!PageBlank) { screen->DrawText (SmallFont, CR_WHITE, 0, 0, "Page graphic goes here", TAG_DONE); diff --git a/src/fragglescript/t_cmd.cpp b/src/fragglescript/t_cmd.cpp index 691740024..5101d0034 100644 --- a/src/fragglescript/t_cmd.cpp +++ b/src/fragglescript/t_cmd.cpp @@ -192,7 +192,7 @@ void FS_EmulateCmd(char * string) else if (sc.Compare("gr_fogcolor")) { sc.MustGetString(); - level.fadeto = strtol(sc.String, NULL, 16); + level.fadeto = (uint32_t)strtoull(sc.String, NULL, 16); } else diff --git a/src/g_level.cpp b/src/g_level.cpp index 0367e7d91..89e335351 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1099,7 +1099,7 @@ void G_WorldDone (void) 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. if (endsequence == NAME_Inter_Strife) { diff --git a/src/gl/dynlights/a_dynlight.cpp b/src/gl/dynlights/a_dynlight.cpp index 812ab7fec..e6bde18dd 100644 --- a/src/gl/dynlights/a_dynlight.cpp +++ b/src/gl/dynlights/a_dynlight.cpp @@ -386,7 +386,7 @@ void ADynamicLight::UpdateLocation() intensity = m_currentRadius; } 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) { diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index ce6b22ee8..47283b51a 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -38,6 +38,7 @@ #include "r_state.h" #include "d_player.h" #include "g_levellocals.h" +#include "r_utility.h" //#include "resources/voxels.h" //#include "gl/gl_intern.h" @@ -1010,6 +1011,13 @@ void gl_RenderModel(GLSprite * spr) // Model space => World space 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: // 1) Applying actor angle, pitch and roll to the model diff --git a/src/gl/renderer/gl_lightdata.cpp b/src/gl/renderer/gl_lightdata.cpp index ae7f2a80d..b4912f825 100644 --- a/src/gl/renderer/gl_lightdata.cpp +++ b/src/gl/renderer/gl_lightdata.cpp @@ -552,7 +552,7 @@ CCMD(skyfog) { if (argv.argc()>1) { - skyfog=strtol(argv[1],NULL,0); + skyfog = MAX(0, (int)strtoull(argv[1], NULL, 0)); } } diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index e4c9f45af..2b9756873 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -737,8 +737,11 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) int clipres = GLRenderer->mClipPortal->ClipPoint(thingpos); 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. - Angles = thing->Angles;// InterpolatedAngles(r_TicFracF); + // disabled because almost none of the actual game code is even remotely prepared for this. If desired, use the INTERPOLATE flag. + if (thing->renderflags & RF_INTERPOLATEANGLES) + Angles = thing->InterpolatedAngles(r_TicFracF); + else + Angles = thing->Angles; player_t *player = &players[consoleplayer]; FloatRect r; diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 0c6019a5f..a3e7532f9 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -65,7 +65,7 @@ CVAR (Bool, show_obituaries, true, 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) DMenu *DMenu::CurrentMenu; diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index d09cb40b6..f684a8bab 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -666,7 +666,7 @@ static EColorRange ParseOptionColor(FScanner &sc, FOptionMenuDescriptor *desc) cr = V_FindFontColor(sc.String); 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; diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index d8edee8f1..29192a60b 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -366,8 +366,8 @@ static bool GetSelectedSize (int *width, int *height) char *breakpt; if (it->GetString(FOptionMenuScreenResolutionLine::SRL_INDEX+hsel, buffer, sizeof(buffer))) { - *width = strtol (buffer, &breakpt, 10); - *height = strtol (breakpt+1, NULL, 10); + *width = (int)strtoll (buffer, &breakpt, 10); + *height = (int)strtoll (breakpt+1, NULL, 10); return true; } } diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 77e34adba..f367c4637 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -982,7 +982,12 @@ CCMD (dump3df) { 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]; TArray & ffloors=sector->e->XFloor.ffloors; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index e346579c4..8e7ba7688 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1086,12 +1086,12 @@ static void ReadArrayVars (FSerializer &file, FWorldGlobalArray *vars, size_t co const char *arraykey; while ((arraykey = file.GetKey())) { - int i = (int)strtol(arraykey, nullptr, 10); + int i = (int)strtoll(arraykey, nullptr, 10); if (file.BeginObject(nullptr)) { while ((arraykey = file.GetKey())) { - int k = (int)strtol(arraykey, nullptr, 10); + int k = (int)strtoll(arraykey, nullptr, 10); int val; file(nullptr, val); vars[i].Insert(k, val); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index a4e4ef1b9..0c3b65710 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -2540,7 +2540,7 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmaps case Sector_Set3DFloor: 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. } else @@ -2978,6 +2978,15 @@ static bool P_VerifyBlockMap(int count) 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 for(tmplist = list; *tmplist != -1; tmplist++) { diff --git a/src/p_states.cpp b/src/p_states.cpp index 09591d70f..221ff6ced 100644 --- a/src/p_states.cpp +++ b/src/p_states.cpp @@ -731,7 +731,7 @@ FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, PClassActor *mytype, *pt = '\0'; offset = pt + 1; } - v = offset ? strtol (offset, NULL, 0) : 0; + v = offset ? (int)strtoll (offset, NULL, 0) : 0; // Get the state's address. if (type == mytype) diff --git a/src/parsecontext.cpp b/src/parsecontext.cpp index 2cfaafa29..cdc28c15a 100644 --- a/src/parsecontext.cpp +++ b/src/parsecontext.cpp @@ -103,7 +103,7 @@ loop: c = *sourcep++; if (c == 'x' || c == 'X') { - yylval->val = (int)strtol(sourcep, &sourcep, 16); + yylval->val = (int)strtoll(sourcep, &sourcep, 16); return TokenTrans[NUM]; } else @@ -114,7 +114,7 @@ loop: char *endp; sourcep--; - yylval->val = (int)strtol(sourcep, &endp, 10); + yylval->val = (int)strtoll(sourcep, &endp, 10); if (*endp == '.') { // It's a float diff --git a/src/r_defs.h b/src/r_defs.h index acc214b62..8726abe94 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -238,7 +238,7 @@ struct FUDMFKey FUDMFKey& operator =(const FString &val) { Type = UDMF_String; - IntVal = strtol(val.GetChars(), NULL, 0); + IntVal = (int)strtoll(val.GetChars(), NULL, 0); FloatVal = strtod(val.GetChars(), NULL); StringVal = val; return *this; diff --git a/src/sc_man.cpp b/src/sc_man.cpp index 5f944735a..70bdabd76 100644 --- a/src/sc_man.cpp +++ b/src/sc_man.cpp @@ -554,12 +554,12 @@ bool FScanner::GetToken () String[StringLen - 2] == 'u' || String[StringLen - 2] == 'U') { TokenType = TK_UIntConst; - Number = strtoul(String, &stopper, 0); + Number = (int)strtoull(String, &stopper, 0); Float = (unsigned)Number; } else { - Number = strtol(String, &stopper, 0); + Number = (int)strtoll(String, &stopper, 0); Float = Number; } } @@ -660,7 +660,7 @@ bool FScanner::GetNumber () } else { - Number = strtol (String, &stopper, 0); + Number = (int)strtoll (String, &stopper, 0); if (*stopper != 0) { ScriptError ("SC_GetNumber: Bad numeric constant \"%s\".", String); @@ -715,7 +715,7 @@ bool FScanner::CheckNumber () } else { - Number = strtol (String, &stopper, 0); + Number = (int)strtoll (String, &stopper, 0); if (*stopper != 0) { UnGet(); diff --git a/src/scripting/decorate/olddecorations.cpp b/src/scripting/decorate/olddecorations.cpp index 1eeed5796..5861138d6 100644 --- a/src/scripting/decorate/olddecorations.cpp +++ b/src/scripting/decorate/olddecorations.cpp @@ -635,7 +635,7 @@ static void ParseSpriteFrames (PClassActor *info, TArray &states, TArray char *stop; *colon = 0; - rate = strtol (token, &stop, 10); + rate = (int)strtoll (token, &stop, 10); if (stop == token || rate < 1 || rate > 65534) { sc.ScriptError ("Rates must be in the range [0,65534]"); diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 9fa33314e..421ef6ae5 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -326,6 +326,7 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(RF, ABSMASKPITCH, AActor, renderflags), DEFINE_FLAG(RF, XFLIP, AActor, renderflags), DEFINE_FLAG(RF, YFLIP, AActor, renderflags), + DEFINE_FLAG(RF, INTERPOLATEANGLES, AActor, renderflags), // Bounce flags DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags), diff --git a/src/scripting/zscript/ast.cpp b/src/scripting/zscript/ast.cpp index 586601890..c4c8a12a5 100644 --- a/src/scripting/zscript/ast.cpp +++ b/src/scripting/zscript/ast.cpp @@ -346,6 +346,16 @@ static void PrintProperty(FLispString &out, ZCC_TreeNode *node) 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) { ZCC_Enum *enode = (ZCC_Enum *)node; @@ -944,6 +954,7 @@ void (* const TreeNodePrinter[NUM_AST_NODE_TYPES])(FLispString &, ZCC_TreeNode * PrintVectorInitializer, PrintDeclFlags, PrintExprClassCast, + PrintStaticArrayState, PrintProperty, }; diff --git a/src/win32/i_crash.cpp b/src/win32/i_crash.cpp index 57c93d768..b45cda168 100644 --- a/src/win32/i_crash.cpp +++ b/src/win32/i_crash.cpp @@ -2731,7 +2731,7 @@ static bool ReadResponse (HWND hDlg, char *header, SOCKET sock, char *buf, int b char *lenhead = strstr (header, "content-length: "); if (lenhead != 0) { - len = strtol (lenhead + 16, NULL, 10); + len = (int)strtoll (lenhead + 16, NULL, 10); if (file != INVALID_HANDLE_VALUE) { ShowWindow (GetDlgItem (hDlg, IDC_BOINGPROGRESS), SW_SHOW); diff --git a/src/zstring.cpp b/src/zstring.cpp index d17348bd3..665b9312e 100644 --- a/src/zstring.cpp +++ b/src/zstring.cpp @@ -1104,12 +1104,12 @@ digits = [0-9]; long FString::ToLong (int base) const { - return strtol (Chars, NULL, base); + return (long)strtoll (Chars, NULL, base); } unsigned long FString::ToULong (int base) const { - return strtoul (Chars, NULL, base); + return (unsigned long)strtoull (Chars, NULL, base); } double FString::ToDouble () const diff --git a/wadsrc/static/shaders/glsl/fogboundary.fp b/wadsrc/static/shaders/glsl/fogboundary.fp index d8259c845..52ea9791b 100644 --- a/wadsrc/static/shaders/glsl/fogboundary.fp +++ b/wadsrc/static/shaders/glsl/fogboundary.fp @@ -1,5 +1,4 @@ in vec4 pixelpos; -in vec2 glowdist; out vec4 FragColor; //===========================================================================