diff --git a/src/gamedata/textures/texturemanager.cpp b/src/gamedata/textures/texturemanager.cpp index cc2dc548f..3f1225f40 100644 --- a/src/gamedata/textures/texturemanager.cpp +++ b/src/gamedata/textures/texturemanager.cpp @@ -700,7 +700,7 @@ void FTextureManager::ParseColorization(FScanner& sc) if (sc.Compare("desaturation")) { sc.MustGetFloat(); - tm.DesaturationFactor = sc.Float; + tm.DesaturationFactor = (float)sc.Float; } else if (sc.Compare("AddColor")) { @@ -728,7 +728,7 @@ void FTextureManager::ParseColorization(FScanner& sc) if (sc.CheckToken(',')) { sc.MustGetFloat(); - tm.BlendColor.a = clamp(sc.Float, 0., 1.) * 255; + tm.BlendColor.a = (uint8_t)clamp(sc.Float, 0., 1.) * 255; } } else if (sc.Compare("invert")) diff --git a/src/utility/sc_man.cpp b/src/utility/sc_man.cpp index 986d41d7a..3901a1f44 100644 --- a/src/utility/sc_man.cpp +++ b/src/utility/sc_man.cpp @@ -31,29 +31,6 @@ ** */ -// This file contains some code by Raven Software, licensed under: - -//----------------------------------------------------------------------------- -// -// Copyright 1994-1996 Raven Software -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see http://www.gnu.org/licenses/ -// -//----------------------------------------------------------------------------- -// - - // HEADER FILES ------------------------------------------------------------ @@ -622,12 +599,14 @@ bool FScanner::GetToken () String[StringLen - 2] == 'u' || String[StringLen - 2] == 'U') { TokenType = TK_UIntConst; - Number = (int)strtoull(String, &stopper, 0); + BigNumber = (int64_t)strtoull(String, &stopper, 0); + Number = (int)clamp(BigNumber, 0, UINT_MAX); Float = (unsigned)Number; } else { - Number = (int)strtoll(String, &stopper, 0); + BigNumber = strtoll(String, &stopper, 0); + Number = (int)clamp(BigNumber, INT_MIN, INT_MAX); Float = Number; } } @@ -728,7 +707,8 @@ bool FScanner::GetNumber () } else { - Number = (int)strtoll (String, &stopper, 0); + BigNumber = strtoll(String, &stopper, 0); + Number = (int)clamp(BigNumber, INT_MIN, INT_MAX); if (*stopper != 0) { ScriptError ("SC_GetNumber: Bad numeric constant \"%s\".", String); @@ -779,11 +759,13 @@ bool FScanner::CheckNumber () } else if (strcmp (String, "MAXINT") == 0) { + BigNumber = INT64_MAX; Number = INT_MAX; } else { - Number = (int)strtoll (String, &stopper, 0); + BigNumber = strtoll (String, &stopper, 0); + Number = (int)clamp(BigNumber, INT_MIN, INT_MAX); if (*stopper != 0) { UnGet(); diff --git a/src/utility/sc_man.h b/src/utility/sc_man.h index b345ee15b..908089b8e 100644 --- a/src/utility/sc_man.h +++ b/src/utility/sc_man.h @@ -87,6 +87,7 @@ public: int StringLen; int TokenType; int Number; + int64_t BigNumber; double Float; int Line; bool End; diff --git a/src/win32/zdoom.rc b/src/win32/zdoom.rc index c455fa6cb..6ac1a2340 100644 --- a/src/win32/zdoom.rc +++ b/src/win32/zdoom.rc @@ -228,149 +228,6 @@ BEGIN CONTROL "SoftPoly",IDC_WELCOME_VULKAN3,"Button",BS_AUTORADIOBUTTON,13,188,43,10 END -IDD_EAXPROPERTYLIST DIALOGEX 0, 0, 265, 404 -STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VSCROLL -EXSTYLE WS_EX_CLIENTEDGE -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - EDITTEXT IDCE_ENVIRONMENTSIZE,76,7,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_ENVIRONMENTDIFFUSION,76,20,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_ROOM,76,33,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_ROOMHF,76,46,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_ROOMLF,76,59,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_DECAYTIME,76,72,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_DECAYHFRATIO,76,85,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_DECAYLFRATIO,76,98,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_REFLECTIONS,76,111,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_REFLECTIONSDELAY,76,124,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_REVERB,76,137,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_REVERBDELAY,76,150,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_ECHOTIME,76,163,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_ECHODEPTH,76,176,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_MODULATIONTIME,76,189,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_MODULATIONDEPTH,76,202,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_AIRABSORPTIONHF,76,215,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_HFREFERENCE,76,228,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_LFREFERENCE,76,241,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_ROOMROLLOFFFACTOR,76,254,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_REFLECTIONSPANX,76,267,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_REFLECTIONSPANY,76,280,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_REFLECTIONSPANZ,76,293,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_REVERBPANX,76,306,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_REVERBPANY,76,319,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - EDITTEXT IDCE_REVERBPANZ,76,332,48,12,ES_AUTOHSCROLL,WS_EX_RIGHT - CONTROL "",IDCS_ENVIRONMENTSIZE,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,7,123,12 - CONTROL "",IDCS_ENVIRONMENTDIFFUSION,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,20,123,12 - CONTROL "",IDCS_ROOM,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,33,123,12 - CONTROL "",IDCS_ROOMHF,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,46,123,12 - CONTROL "",IDCS_ROOMLF,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,59,123,12 - CONTROL "",IDCS_DECAYTIME,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,72,123,12 - CONTROL "",IDCS_DECAYHFRATIO,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,85,123,12 - CONTROL "",IDCS_DECAYLFRATIO,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,98,123,12 - CONTROL "",IDCS_REFLECTIONS,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,111,123,12 - CONTROL "",IDCS_REFLECTIONSDELAY,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,124,123,12 - CONTROL "",IDCS_REVERB,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,137,123,12 - CONTROL "",IDCS_REVERBDELAY,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,150,123,12 - CONTROL "",IDCS_ECHOTIME,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,163,123,12 - CONTROL "",IDCS_ECHODEPTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,176,123,12 - CONTROL "",IDCS_MODULATIONTIME,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,189,123,12 - CONTROL "",IDCS_MODULATIONDEPTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,202,123,12 - CONTROL "",IDCS_AIRABSORPTIONHF,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,215,123,12 - CONTROL "",IDCS_HFREFERENCE,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,228,123,12 - CONTROL "",IDCS_LFREFERENCE,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,241,123,12 - CONTROL "",IDCS_ROOMROLLOFFFACTOR,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,254,123,12 - CONTROL "",IDCS_REFLECTIONSPANX,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,267,123,12 - CONTROL "",IDCS_REFLECTIONSPANY,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,280,123,12 - CONTROL "",IDCS_REFLECTIONSPANZ,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,293,123,12 - CONTROL "",IDCS_REVERBPANX,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,306,123,12 - CONTROL "",IDCS_REVERBPANY,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,319,123,12 - CONTROL "",IDCS_REVERBPANZ,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,126,332,123,12 - CONTROL "Reflections Scale",IDC_REFLECTIONSSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,353,70,10 - CONTROL "Reflections Delay Scale",IDC_REFLECTIONSDELAYSCALE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,366,90,10 - CONTROL "Decay Time Scale",IDC_DECAYTIMESCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,377,71,10 - CONTROL "Decay HF Limit",IDC_DECAYHFLIMIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,390,63,10 - CONTROL "Reverb Scale",IDC_REVERBSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,353,58,10 - CONTROL "Reverb Delay Scale",IDC_REVERBDELAYSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,366,78,10 - CONTROL "Echo Time Scale",IDC_ECHOTIMESCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,377,67,10 - CONTROL "Modulation Time Scale",IDC_MODULATIONTIMESCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,390,86,10 - LTEXT "Environment Size",IDC_STATIC,17,9,56,8,0,WS_EX_RIGHT - LTEXT "Environment Diffusion",IDC_STATIC,2,22,71,8,0,WS_EX_RIGHT - LTEXT "Room",IDC_STATIC,53,35,19,8,0,WS_EX_RIGHT - LTEXT "Room HF",IDC_STATIC,43,48,30,8,0,WS_EX_RIGHT - LTEXT "Room LF",IDC_STATIC,45,60,28,8,0,WS_EX_RIGHT - LTEXT "Decay Time",IDC_STATIC,35,74,38,8,0,WS_EX_RIGHT - LTEXT "Decay HF Ratio",IDC_STATIC,23,87,50,8,0,WS_EX_RIGHT - LTEXT "Decay LF Ratio",IDC_STATIC,24,100,49,8,0,WS_EX_RIGHT - LTEXT "Reflections",IDC_STATIC,37,113,36,8,0,WS_EX_RIGHT - LTEXT "Reflections Delay",IDC_STATIC,17,126,56,8,0,WS_EX_RIGHT - LTEXT "Reflections Pan X",IDC_STATIC,17,267,56,8,0,WS_EX_RIGHT - LTEXT "Reflections Pan Y",IDC_STATIC,17,280,56,8,0,WS_EX_RIGHT - LTEXT "Reflections Pan Z",IDC_STATIC,17,293,56,8,0,WS_EX_RIGHT - LTEXT "Reverb",IDC_STATIC,49,137,24,8,0,WS_EX_RIGHT - LTEXT "Reverb Delay",IDC_STATIC,29,150,44,8,0,WS_EX_RIGHT - LTEXT "Reverb Pan X",IDC_STATIC,29,306,44,8,0,WS_EX_RIGHT - LTEXT "Reverb Pan Y",IDC_STATIC,29,319,44,8,0,WS_EX_RIGHT - LTEXT "Reverb Pan Z",IDC_STATIC,29,332,44,8,0,WS_EX_RIGHT - LTEXT "Echo Time",IDC_STATIC,40,163,33,8,0,WS_EX_RIGHT - LTEXT "Echo Depth",IDC_STATIC,35,176,38,8,0,WS_EX_RIGHT - LTEXT "Modulation Time",IDC_STATIC,21,189,52,8,0,WS_EX_RIGHT - LTEXT "Modulation Depth",IDC_STATIC,16,202,57,8,0,WS_EX_RIGHT - LTEXT "Air Absorption HF",IDC_STATIC,16,215,57,8,0,WS_EX_RIGHT - LTEXT "HF Reference",IDC_STATIC,28,228,45,8,0,WS_EX_RIGHT - LTEXT "LF Reference",IDC_STATIC,29,241,44,8,0,WS_EX_RIGHT - LTEXT "Room Rolloff Factor",IDC_STATIC,9,254,64,8,0,WS_EX_RIGHT -END - -IDD_EAXEDIT DIALOGEX 0, 0, 280, 326 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE -CAPTION "Environment Editor" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - COMBOBOX IDC_CURRENTENVIRONMENT,7,19,265,14,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Static",IDC_DUMMY,7,36,265,263,0,WS_EX_CLIENTEDGE - PUSHBUTTON "&New...",IDC_NEW,8,305,45,14 - PUSHBUTTON "&Save...",IDC_SAVE,60,305,45,14 - PUSHBUTTON "&Revert",IDC_REVERT,112,305,45,14 - CONTROL "&Test in level",IDC_TESTEAX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,307,54,10 - PUSHBUTTON "&Done",IDOK,228,305,45,14 - CONTROL "Show &IDs in List",IDC_SHOWIDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,66,10 - LTEXT "ID 2:",IDC_STATIC,239,7,19,8 - LTEXT "ID 1:",IDC_STATIC,198,7,19,8 - LTEXT "255",IDC_ID2,258,7,15,8 - LTEXT "255",IDC_ID1,218,7,15,8 -END - -IDD_NEWEAX DIALOGEX 0, 0, 348, 257 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Create New Environment..." -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - EDITTEXT IDC_NEWENVNAME,32,216,187,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDITID1,248,216,32,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPINID1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,236,216,11,14 - EDITTEXT IDC_EDITID2,309,216,32,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPINID2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,297,216,11,14 - CONTROL "",IDC_ENVIRONMENTLIST,"SysListView32",LVS_LIST | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,18,334,192 - DEFPUSHBUTTON "Create",IDOK,246,236,45,14 - PUSHBUTTON "Cancel",IDCANCEL,296,236,45,14 - LTEXT "Name:",IDC_STATIC,7,218,22,8 - LTEXT "ID 1:",IDC_STATIC,226,218,17,8 - LTEXT "ID 2:",IDC_STATIC,287,218,17,8 - LTEXT "Based on:",IDC_STATIC,7,7,33,8 -END - -IDD_SAVEEAX DIALOGEX 0, 0, 394, 95 -STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU -EXSTYLE WS_EX_TRANSPARENT -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - GROUPBOX "Include these environments:",IDC_SAVEGROUP,6,0,371,90,0,WS_EX_TRANSPARENT - CONTROL "",IDC_ENVLIST,"SysListView32",LVS_LIST | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,12,12,303,72 - PUSHBUTTON "Select All",IDC_SELECTALL,320,12,50,14 - PUSHBUTTON "Select None",IDC_SELECTNONE,320,31,50,14 -END IDD_CRASHDIALOG DIALOGEX 0, 0, 415, 308 STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU