Fix most compiler warnings

This commit is contained in:
Kawe Mazidjatari 2022-08-14 18:35:01 +02:00
parent 066bbdeaf0
commit 851682ab89
13 changed files with 144 additions and 144 deletions

View File

@ -12,7 +12,7 @@ struct TickUpdate
int command_number;
};
struct __declspec(align(1)) CFrameSnapshot
struct CFrameSnapshot
{
char field_0;
_DWORD last_entity;

View File

@ -121,9 +121,9 @@ float CNetChan::GetAvgData(int flow) const
//-----------------------------------------------------------------------------
// Purpose: gets the netchannel total data
// Input : flow -
// Output : int
// Output : int64_t
//-----------------------------------------------------------------------------
int CNetChan::GetTotalData(int flow) const
int64_t CNetChan::GetTotalData(int flow) const
{
return this->m_DataFlow[flow].totalbytes;
}
@ -131,9 +131,9 @@ int CNetChan::GetTotalData(int flow) const
//-----------------------------------------------------------------------------
// Purpose: gets the netchannel total packets
// Input : flow -
// Output : int
// Output : int64_t
//-----------------------------------------------------------------------------
int CNetChan::GetTotalPackets(int flow) const
int64_t CNetChan::GetTotalPackets(int flow) const
{
return this->m_DataFlow[flow].totalpackets;
}

View File

@ -91,8 +91,8 @@ public:
float GetAvgPackets(int flow) const;
float GetAvgData(int flow) const;
int GetTotalData(int flow) const;
int GetTotalPackets(int flow) const;
int64_t GetTotalData(int flow) const;
int64_t GetTotalPackets(int flow) const;
int GetSequenceNr(int flow) const;
float GetTimeoutSeconds(void) const;

View File

@ -133,7 +133,7 @@ void CBrowser::Think(void)
{
if (m_flFadeAlpha <= 1.f)
{
m_flFadeAlpha += 0.05;
m_flFadeAlpha += .05f;
}
}
else // Reset to full transparent.
@ -261,13 +261,13 @@ void CBrowser::BrowserPanel(void)
ImGui::InputTextWithHint("##ServerBrowser_ServerEncKey", "Enter encryption key", m_szServerEncKeyBuffer, IM_ARRAYSIZE(m_szServerEncKeyBuffer));
ImGui::SameLine();
if (ImGui::Button("Connect", ImVec2(ImGui::GetWindowContentRegionWidth() / 4.3, ImGui::GetFrameHeight())))
if (ImGui::Button("Connect", ImVec2(ImGui::GetWindowContentRegionWidth() / 4.3f, ImGui::GetFrameHeight())))
{
g_pServerListManager->ConnectToServer(m_szServerAddressBuffer, m_szServerEncKeyBuffer);
}
ImGui::SameLine();
if (ImGui::Button("Private Servers", ImVec2(ImGui::GetWindowContentRegionWidth() / 4.3, ImGui::GetFrameHeight())))
if (ImGui::Button("Private Servers", ImVec2(ImGui::GetWindowContentRegionWidth() / 4.3f, ImGui::GetFrameHeight())))
{
ImGui::OpenPopup("Connect to Private Server");
}
@ -603,10 +603,10 @@ void CBrowser::SendHostingPostRequest(void)
{
m_HostRequestMessageColor = ImVec4(0.00f, 1.00f, 0.00f, 1.00f);
stringstream ssMessage;
ssMessage << "Broadcasting! ";
ssMessage << "Broadcasting: ";
if (!m_svHostToken.empty())
{
ssMessage << "Share the following token for clients to connect: ";
ssMessage << "share the following token for clients to connect: ";
}
m_svHostRequestMessage = ssMessage.str();
}

View File

@ -732,7 +732,7 @@ int CConsole::TextEditCallback(ImGuiInputTextCallbackData* iData)
}
else // Allow user to navigate through the history if suggest isn't drawn.
{
const int nPrevHistoryPos = m_nHistoryPos;
const ssize_t nPrevHistoryPos = m_nHistoryPos;
if (iData->EventKey == ImGuiKey_UpArrow)
{
if (m_nHistoryPos == -1)

View File

@ -35,70 +35,70 @@ static float g_Mathlib_LinearToGamma[256]; // linear (0..1) to gamma (0..1)
// linking it everywhere via mathlib.
ALIGN128 float power2_n[256] = // 2**(index - 128) / 255
{
1.152445441982634800E-041, 2.304890883965269600E-041, 4.609781767930539200E-041, 9.219563535861078400E-041,
1.843912707172215700E-040, 3.687825414344431300E-040, 7.375650828688862700E-040, 1.475130165737772500E-039,
2.950260331475545100E-039, 5.900520662951090200E-039, 1.180104132590218000E-038, 2.360208265180436100E-038,
4.720416530360872100E-038, 9.440833060721744200E-038, 1.888166612144348800E-037, 3.776333224288697700E-037,
7.552666448577395400E-037, 1.510533289715479100E-036, 3.021066579430958200E-036, 6.042133158861916300E-036,
1.208426631772383300E-035, 2.416853263544766500E-035, 4.833706527089533100E-035, 9.667413054179066100E-035,
1.933482610835813200E-034, 3.866965221671626400E-034, 7.733930443343252900E-034, 1.546786088668650600E-033,
3.093572177337301200E-033, 6.187144354674602300E-033, 1.237428870934920500E-032, 2.474857741869840900E-032,
4.949715483739681800E-032, 9.899430967479363700E-032, 1.979886193495872700E-031, 3.959772386991745500E-031,
7.919544773983491000E-031, 1.583908954796698200E-030, 3.167817909593396400E-030, 6.335635819186792800E-030,
1.267127163837358600E-029, 2.534254327674717100E-029, 5.068508655349434200E-029, 1.013701731069886800E-028,
2.027403462139773700E-028, 4.054806924279547400E-028, 8.109613848559094700E-028, 1.621922769711818900E-027,
3.243845539423637900E-027, 6.487691078847275800E-027, 1.297538215769455200E-026, 2.595076431538910300E-026,
5.190152863077820600E-026, 1.038030572615564100E-025, 2.076061145231128300E-025, 4.152122290462256500E-025,
8.304244580924513000E-025, 1.660848916184902600E-024, 3.321697832369805200E-024, 6.643395664739610400E-024,
1.328679132947922100E-023, 2.657358265895844200E-023, 5.314716531791688300E-023, 1.062943306358337700E-022,
2.125886612716675300E-022, 4.251773225433350700E-022, 8.503546450866701300E-022, 1.700709290173340300E-021,
3.401418580346680500E-021, 6.802837160693361100E-021, 1.360567432138672200E-020, 2.721134864277344400E-020,
5.442269728554688800E-020, 1.088453945710937800E-019, 2.176907891421875500E-019, 4.353815782843751100E-019,
8.707631565687502200E-019, 1.741526313137500400E-018, 3.483052626275000900E-018, 6.966105252550001700E-018,
1.393221050510000300E-017, 2.786442101020000700E-017, 5.572884202040001400E-017, 1.114576840408000300E-016,
2.229153680816000600E-016, 4.458307361632001100E-016, 8.916614723264002200E-016, 1.783322944652800400E-015,
3.566645889305600900E-015, 7.133291778611201800E-015, 1.426658355722240400E-014, 2.853316711444480700E-014,
5.706633422888961400E-014, 1.141326684577792300E-013, 2.282653369155584600E-013, 4.565306738311169100E-013,
9.130613476622338300E-013, 1.826122695324467700E-012, 3.652245390648935300E-012, 7.304490781297870600E-012,
1.460898156259574100E-011, 2.921796312519148200E-011, 5.843592625038296500E-011, 1.168718525007659300E-010,
2.337437050015318600E-010, 4.674874100030637200E-010, 9.349748200061274400E-010, 1.869949640012254900E-009,
3.739899280024509800E-009, 7.479798560049019500E-009, 1.495959712009803900E-008, 2.991919424019607800E-008,
5.983838848039215600E-008, 1.196767769607843100E-007, 2.393535539215686200E-007, 4.787071078431372500E-007,
9.574142156862745000E-007, 1.914828431372549000E-006, 3.829656862745098000E-006, 7.659313725490196000E-006,
1.531862745098039200E-005, 3.063725490196078400E-005, 6.127450980392156800E-005, 1.225490196078431400E-004,
2.450980392156862700E-004, 4.901960784313725400E-004, 9.803921568627450800E-004, 1.960784313725490200E-003,
3.921568627450980300E-003, 7.843137254901960700E-003, 1.568627450980392100E-002, 3.137254901960784300E-002,
6.274509803921568500E-002, 1.254901960784313700E-001, 2.509803921568627400E-001, 5.019607843137254800E-001,
1.003921568627451000E+000, 2.007843137254901900E+000, 4.015686274509803900E+000, 8.031372549019607700E+000,
1.606274509803921500E+001, 3.212549019607843100E+001, 6.425098039215686200E+001, 1.285019607843137200E+002,
2.570039215686274500E+002, 5.140078431372548900E+002, 1.028015686274509800E+003, 2.056031372549019600E+003,
4.112062745098039200E+003, 8.224125490196078300E+003, 1.644825098039215700E+004, 3.289650196078431300E+004,
6.579300392156862700E+004, 1.315860078431372500E+005, 2.631720156862745100E+005, 5.263440313725490100E+005,
1.052688062745098000E+006, 2.105376125490196000E+006, 4.210752250980392100E+006, 8.421504501960784200E+006,
1.684300900392156800E+007, 3.368601800784313700E+007, 6.737203601568627400E+007, 1.347440720313725500E+008,
2.694881440627450900E+008, 5.389762881254901900E+008, 1.077952576250980400E+009, 2.155905152501960800E+009,
4.311810305003921500E+009, 8.623620610007843000E+009, 1.724724122001568600E+010, 3.449448244003137200E+010,
6.898896488006274400E+010, 1.379779297601254900E+011, 2.759558595202509800E+011, 5.519117190405019500E+011,
1.103823438081003900E+012, 2.207646876162007800E+012, 4.415293752324015600E+012, 8.830587504648031200E+012,
1.766117500929606200E+013, 3.532235001859212500E+013, 7.064470003718425000E+013, 1.412894000743685000E+014,
2.825788001487370000E+014, 5.651576002974740000E+014, 1.130315200594948000E+015, 2.260630401189896000E+015,
4.521260802379792000E+015, 9.042521604759584000E+015, 1.808504320951916800E+016, 3.617008641903833600E+016,
7.234017283807667200E+016, 1.446803456761533400E+017, 2.893606913523066900E+017, 5.787213827046133800E+017,
1.157442765409226800E+018, 2.314885530818453500E+018, 4.629771061636907000E+018, 9.259542123273814000E+018,
1.851908424654762800E+019, 3.703816849309525600E+019, 7.407633698619051200E+019, 1.481526739723810200E+020,
2.963053479447620500E+020, 5.926106958895241000E+020, 1.185221391779048200E+021, 2.370442783558096400E+021,
4.740885567116192800E+021, 9.481771134232385600E+021, 1.896354226846477100E+022, 3.792708453692954200E+022,
7.585416907385908400E+022, 1.517083381477181700E+023, 3.034166762954363400E+023, 6.068333525908726800E+023,
1.213666705181745400E+024, 2.427333410363490700E+024, 4.854666820726981400E+024, 9.709333641453962800E+024,
1.941866728290792600E+025, 3.883733456581585100E+025, 7.767466913163170200E+025, 1.553493382632634000E+026,
3.106986765265268100E+026, 6.213973530530536200E+026, 1.242794706106107200E+027, 2.485589412212214500E+027,
4.971178824424429000E+027, 9.942357648848857900E+027, 1.988471529769771600E+028, 3.976943059539543200E+028,
7.953886119079086300E+028, 1.590777223815817300E+029, 3.181554447631634500E+029, 6.363108895263269100E+029,
1.272621779052653800E+030, 2.545243558105307600E+030, 5.090487116210615300E+030, 1.018097423242123100E+031,
2.036194846484246100E+031, 4.072389692968492200E+031, 8.144779385936984400E+031, 1.628955877187396900E+032,
3.257911754374793800E+032, 6.515823508749587500E+032, 1.303164701749917500E+033, 2.606329403499835000E+033,
5.212658806999670000E+033, 1.042531761399934000E+034, 2.085063522799868000E+034, 4.170127045599736000E+034,
8.340254091199472000E+034, 1.668050818239894400E+035, 3.336101636479788800E+035, 6.672203272959577600E+035
1.152445441982634800E-041f, 2.304890883965269600E-041f, 4.609781767930539200E-041f, 9.219563535861078400E-041f,
1.843912707172215700E-040f, 3.687825414344431300E-040f, 7.375650828688862700E-040f, 1.475130165737772500E-039f,
2.950260331475545100E-039f, 5.900520662951090200E-039f, 1.180104132590218000E-038f, 2.360208265180436100E-038f,
4.720416530360872100E-038f, 9.440833060721744200E-038f, 1.888166612144348800E-037f, 3.776333224288697700E-037f,
7.552666448577395400E-037f, 1.510533289715479100E-036f, 3.021066579430958200E-036f, 6.042133158861916300E-036f,
1.208426631772383300E-035f, 2.416853263544766500E-035f, 4.833706527089533100E-035f, 9.667413054179066100E-035f,
1.933482610835813200E-034f, 3.866965221671626400E-034f, 7.733930443343252900E-034f, 1.546786088668650600E-033f,
3.093572177337301200E-033f, 6.187144354674602300E-033f, 1.237428870934920500E-032f, 2.474857741869840900E-032f,
4.949715483739681800E-032f, 9.899430967479363700E-032f, 1.979886193495872700E-031f, 3.959772386991745500E-031f,
7.919544773983491000E-031f, 1.583908954796698200E-030f, 3.167817909593396400E-030f, 6.335635819186792800E-030f,
1.267127163837358600E-029f, 2.534254327674717100E-029f, 5.068508655349434200E-029f, 1.013701731069886800E-028f,
2.027403462139773700E-028f, 4.054806924279547400E-028f, 8.109613848559094700E-028f, 1.621922769711818900E-027f,
3.243845539423637900E-027f, 6.487691078847275800E-027f, 1.297538215769455200E-026f, 2.595076431538910300E-026f,
5.190152863077820600E-026f, 1.038030572615564100E-025f, 2.076061145231128300E-025f, 4.152122290462256500E-025f,
8.304244580924513000E-025f, 1.660848916184902600E-024f, 3.321697832369805200E-024f, 6.643395664739610400E-024f,
1.328679132947922100E-023f, 2.657358265895844200E-023f, 5.314716531791688300E-023f, 1.062943306358337700E-022f,
2.125886612716675300E-022f, 4.251773225433350700E-022f, 8.503546450866701300E-022f, 1.700709290173340300E-021f,
3.401418580346680500E-021f, 6.802837160693361100E-021f, 1.360567432138672200E-020f, 2.721134864277344400E-020f,
5.442269728554688800E-020f, 1.088453945710937800E-019f, 2.176907891421875500E-019f, 4.353815782843751100E-019f,
8.707631565687502200E-019f, 1.741526313137500400E-018f, 3.483052626275000900E-018f, 6.966105252550001700E-018f,
1.393221050510000300E-017f, 2.786442101020000700E-017f, 5.572884202040001400E-017f, 1.114576840408000300E-016f,
2.229153680816000600E-016f, 4.458307361632001100E-016f, 8.916614723264002200E-016f, 1.783322944652800400E-015f,
3.566645889305600900E-015f, 7.133291778611201800E-015f, 1.426658355722240400E-014f, 2.853316711444480700E-014f,
5.706633422888961400E-014f, 1.141326684577792300E-013f, 2.282653369155584600E-013f, 4.565306738311169100E-013f,
9.130613476622338300E-013f, 1.826122695324467700E-012f, 3.652245390648935300E-012f, 7.304490781297870600E-012f,
1.460898156259574100E-011f, 2.921796312519148200E-011f, 5.843592625038296500E-011f, 1.168718525007659300E-010f,
2.337437050015318600E-010f, 4.674874100030637200E-010f, 9.349748200061274400E-010f, 1.869949640012254900E-009f,
3.739899280024509800E-009f, 7.479798560049019500E-009f, 1.495959712009803900E-008f, 2.991919424019607800E-008f,
5.983838848039215600E-008f, 1.196767769607843100E-007f, 2.393535539215686200E-007f, 4.787071078431372500E-007f,
9.574142156862745000E-007f, 1.914828431372549000E-006f, 3.829656862745098000E-006f, 7.659313725490196000E-006f,
1.531862745098039200E-005f, 3.063725490196078400E-005f, 6.127450980392156800E-005f, 1.225490196078431400E-004f,
2.450980392156862700E-004f, 4.901960784313725400E-004f, 9.803921568627450800E-004f, 1.960784313725490200E-003f,
3.921568627450980300E-003f, 7.843137254901960700E-003f, 1.568627450980392100E-002f, 3.137254901960784300E-002f,
6.274509803921568500E-002f, 1.254901960784313700E-001f, 2.509803921568627400E-001f, 5.019607843137254800E-001f,
1.003921568627451000E+000f, 2.007843137254901900E+000f, 4.015686274509803900E+000f, 8.031372549019607700E+000f,
1.606274509803921500E+001f, 3.212549019607843100E+001f, 6.425098039215686200E+001f, 1.285019607843137200E+002f,
2.570039215686274500E+002f, 5.140078431372548900E+002f, 1.028015686274509800E+003f, 2.056031372549019600E+003f,
4.112062745098039200E+003f, 8.224125490196078300E+003f, 1.644825098039215700E+004f, 3.289650196078431300E+004f,
6.579300392156862700E+004f, 1.315860078431372500E+005f, 2.631720156862745100E+005f, 5.263440313725490100E+005f,
1.052688062745098000E+006f, 2.105376125490196000E+006f, 4.210752250980392100E+006f, 8.421504501960784200E+006f,
1.684300900392156800E+007f, 3.368601800784313700E+007f, 6.737203601568627400E+007f, 1.347440720313725500E+008f,
2.694881440627450900E+008f, 5.389762881254901900E+008f, 1.077952576250980400E+009f, 2.155905152501960800E+009f,
4.311810305003921500E+009f, 8.623620610007843000E+009f, 1.724724122001568600E+010f, 3.449448244003137200E+010f,
6.898896488006274400E+010f, 1.379779297601254900E+011f, 2.759558595202509800E+011f, 5.519117190405019500E+011f,
1.103823438081003900E+012f, 2.207646876162007800E+012f, 4.415293752324015600E+012f, 8.830587504648031200E+012f,
1.766117500929606200E+013f, 3.532235001859212500E+013f, 7.064470003718425000E+013f, 1.412894000743685000E+014f,
2.825788001487370000E+014f, 5.651576002974740000E+014f, 1.130315200594948000E+015f, 2.260630401189896000E+015f,
4.521260802379792000E+015f, 9.042521604759584000E+015f, 1.808504320951916800E+016f, 3.617008641903833600E+016f,
7.234017283807667200E+016f, 1.446803456761533400E+017f, 2.893606913523066900E+017f, 5.787213827046133800E+017f,
1.157442765409226800E+018f, 2.314885530818453500E+018f, 4.629771061636907000E+018f, 9.259542123273814000E+018f,
1.851908424654762800E+019f, 3.703816849309525600E+019f, 7.407633698619051200E+019f, 1.481526739723810200E+020f,
2.963053479447620500E+020f, 5.926106958895241000E+020f, 1.185221391779048200E+021f, 2.370442783558096400E+021f,
4.740885567116192800E+021f, 9.481771134232385600E+021f, 1.896354226846477100E+022f, 3.792708453692954200E+022f,
7.585416907385908400E+022f, 1.517083381477181700E+023f, 3.034166762954363400E+023f, 6.068333525908726800E+023f,
1.213666705181745400E+024f, 2.427333410363490700E+024f, 4.854666820726981400E+024f, 9.709333641453962800E+024f,
1.941866728290792600E+025f, 3.883733456581585100E+025f, 7.767466913163170200E+025f, 1.553493382632634000E+026f,
3.106986765265268100E+026f, 6.213973530530536200E+026f, 1.242794706106107200E+027f, 2.485589412212214500E+027f,
4.971178824424429000E+027f, 9.942357648848857900E+027f, 1.988471529769771600E+028f, 3.976943059539543200E+028f,
7.953886119079086300E+028f, 1.590777223815817300E+029f, 3.181554447631634500E+029f, 6.363108895263269100E+029f,
1.272621779052653800E+030f, 2.545243558105307600E+030f, 5.090487116210615300E+030f, 1.018097423242123100E+031f,
2.036194846484246100E+031f, 4.072389692968492200E+031f, 8.144779385936984400E+031f, 1.628955877187396900E+032f,
3.257911754374793800E+032f, 6.515823508749587500E+032f, 1.303164701749917500E+033f, 2.606329403499835000E+033f,
5.212658806999670000E+033f, 1.042531761399934000E+034f, 2.085063522799868000E+034f, 4.170127045599736000E+034f,
8.340254091199472000E+034f, 1.668050818239894400E+035f, 3.336101636479788800E+035f, 6.672203272959577600E+035f
};
// You can use this to double check the exponent table and assert that
@ -129,12 +129,12 @@ void BuildGammaTable(float gamma, float texGamma, float brightness, int overbrig
// Con_Printf("BuildGammaTable %.1f %.1f %.1f\n", g, v_lightgamma.GetFloat(), v_texgamma.GetFloat() );
float g = gamma;
if (g > 3.0)
if (g > 3.0f)
{
g = 3.0;
g = 3.0f;
}
g = 1.0 / g;
g = 1.0f / g;
g1 = texGamma * g;
if (brightness <= 0.0)
@ -143,11 +143,11 @@ void BuildGammaTable(float gamma, float texGamma, float brightness, int overbrig
}
else if (brightness > 1.0)
{
g3 = 0.05;
g3 = 0.05f;
}
else
{
g3 = 0.125 - (brightness * brightness) * 0.075;
g3 = 0.125f - (brightness * brightness) * 0.075;
}
for (i = 0; i < 256; i++)
@ -164,17 +164,17 @@ void BuildGammaTable(float gamma, float texGamma, float brightness, int overbrig
{
float f;
f = i / 1023.0;
f = i / 1023.0f;
// scale up
if (brightness > 1.0)
if (brightness > 1.0f)
f = f * brightness;
// shift up
if (f <= g3)
f = (f / g3) * 0.125;
f = (f / g3) * 0.125f;
else
f = 0.125 + ((f - g3) / (1.0 - g3)) * 0.875;
f = 0.125f + ((f - g3) / (1.0f - g3)) * 0.875f;
// convert linear space to desired gamma space
inf = (int)(255 * pow(f, g));
@ -246,7 +246,7 @@ void BuildGammaTable(float gamma, float texGamma, float brightness, int overbrig
for (i = 0; i < 4096; i++)
{
// convert from linear 0..4 (x1024) to screen corrected vertex space (0..1?)
f = pow(i / 1024.0, 1.0 / gamma);
f = static_cast<float>(pow(i / 1024.0, 1.0 / gamma));
lineartovertex[i] = f * overbrightFactor;
if (lineartovertex[i] > 1)

View File

@ -22,8 +22,8 @@ HaltonSequenceGenerator_t::HaltonSequenceGenerator_t(int b)
float HaltonSequenceGenerator_t::GetElement(int elem)
{
int tmpseed = seed;
float ret = 0.0;
float base_inv = 1.0 / fbase;
float ret = 0.0f;
float base_inv = 1.0f / fbase;
while (tmpseed)
{
int dig = tmpseed % base;

View File

@ -52,10 +52,10 @@ public:
Vector3D NextValue(void)
{
float zvalue = zdot.NextValue();
zvalue = 2 * zvalue - 1.0; // map from 0..1 to -1..1
zvalue = 2 * zvalue - 1.0f; // map from 0..1 to -1..1
float phi = acos(zvalue);
// now, generate a random rotation angle for x/y
float theta = 2.0 * M_PI * vrot.NextValue();
float theta = 2.0f * M_PI * vrot.NextValue();
float sin_p = sin(phi);
return Vector3D(cos(theta) * sin_p,
sin(theta) * sin_p,

View File

@ -2279,7 +2279,7 @@ float CubicBasis3(float t);
inline float QuinticInterpolatingPolynomial(float t)
{
// 6t^5-15t^4+10t^3
return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
return t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f);
}
// given a table of sorted tabulated positions, return the two indices and blendfactor to linear
@ -2380,7 +2380,7 @@ float TriangleArea(const Vector3D& p0, const Vector3D& p1, const Vector3D& p2);
FORCEINLINE float BoxSurfaceArea(Vector3D const& vecBoxMin, Vector3D const& vecBoxMax)
{
Vector3D boxdim = vecBoxMax - vecBoxMin;
return 2.0 * ((boxdim[0] * boxdim[2]) + (boxdim[0] * boxdim[1]) + (boxdim[1] * boxdim[2]));
return 2.0f * ((boxdim[0] * boxdim[2]) + (boxdim[0] * boxdim[1]) + (boxdim[1] * boxdim[2]));
}
//-----------------------------------------------------------------------------
@ -2869,7 +2869,7 @@ inline float Approach(float target, float value, float speed)
// return a 0..1 value based on the position of x between edge0 and edge1
inline float smoothstep_bounds(float edge0, float edge1, float x)
{
x = clamp(static_cast<int>((x - edge0) / (edge1 - edge0)), 0, 1);
x = static_cast<float>(clamp(static_cast<int>((x - edge0) / (edge1 - edge0)), 0, 1));
return x * x * (3 - 2 * x);
}

View File

@ -37,9 +37,9 @@ const fltx4 Four_2ToThe21s = { (float)(1 << 21), (float)(1 << 21), (float)(1 <<
const fltx4 Four_2ToThe22s = { (float)(1 << 22), (float)(1 << 22), (float)(1 << 22), (float)(1 << 22) };
const fltx4 Four_2ToThe23s = { (float)(1 << 23), (float)(1 << 23), (float)(1 << 23), (float)(1 << 23) };
const fltx4 Four_2ToThe24s = { (float)(1 << 24), (float)(1 << 24), (float)(1 << 24), (float)(1 << 24) };
const fltx4 Four_Thirds = { 0.33333333, 0.33333333, 0.33333333, 0.33333333 };
const fltx4 Four_TwoThirds = { 0.66666666, 0.66666666, 0.66666666, 0.66666666 };
const fltx4 Four_Point225s = { .225, .225, .225, .225 };
const fltx4 Four_Thirds = { 0.33333333f, 0.33333333f, 0.33333333f, 0.33333333f };
const fltx4 Four_TwoThirds = { 0.66666666f, 0.66666666f, 0.66666666f, 0.66666666f };
const fltx4 Four_Point225s = { .225f, .225f, .225f, .225f };
const fltx4 Four_Epsilons = { FLT_EPSILON,FLT_EPSILON,FLT_EPSILON,FLT_EPSILON };
const fltx4 Four_DegToRad = { ((float)(M_PI_F / 180.f)), ((float)(M_PI_F / 180.f)), ((float)(M_PI_F / 180.f)), ((float)(M_PI_F / 180.f)) };
@ -47,16 +47,16 @@ const fltx4 Four_FLT_MAX = { FLT_MAX,FLT_MAX,FLT_MAX,FLT_MAX };
const fltx4 Four_Negative_FLT_MAX = { -FLT_MAX,-FLT_MAX,-FLT_MAX,-FLT_MAX };
const fltx4 g_SIMD_0123 = { 0., 1., 2., 3. };
const fltx4 Four_LinearToGammaCoefficients_A = { -3.7295, -3.7295, -3.7295, -3.7295 };
const fltx4 Four_LinearToGammaCoefficients_B = { 8.9635, 8.9635, 8.9635, 8.9635 };
const fltx4 Four_LinearToGammaCoefficients_C = { -7.7397, -7.7397, -7.7397, -7.7397 };
const fltx4 Four_LinearToGammaCoefficients_D = { 3.443, 3.443, 3.443, 3.443 };
const fltx4 Four_LinearToGammaCoefficients_E = { 0.048, 0.048, 0.048, 0.048 };
const fltx4 Four_LinearToGammaCoefficients_A = { -3.7295f, -3.7295f, -3.7295f, -3.7295f };
const fltx4 Four_LinearToGammaCoefficients_B = { 8.9635f, 8.9635f, 8.9635f, 8.9635f };
const fltx4 Four_LinearToGammaCoefficients_C = { -7.7397f, -7.7397f, -7.7397f, -7.7397f };
const fltx4 Four_LinearToGammaCoefficients_D = { 3.443f, 3.443f, 3.443f, 3.443f };
const fltx4 Four_LinearToGammaCoefficients_E = { 0.048f, 0.048f, 0.048f, 0.048f };
const fltx4 Four_GammaToLinearCoefficients_A = { .1731, .1731, .1731, .1731 };
const fltx4 Four_GammaToLinearCoefficients_B = { .8717, .8717, .8717, .8717 };
const fltx4 Four_GammaToLinearCoefficients_C = { -.0452, -.0452, -.0452, -.0452 };
const fltx4 Four_GammaToLinearCoefficients_D = { .0012, .0012, .0012, .0012 };
const fltx4 Four_GammaToLinearCoefficients_A = { .1731f, .1731f, .1731f, .1731f };
const fltx4 Four_GammaToLinearCoefficients_B = { .8717f, .8717f, .8717f, .8717f };
const fltx4 Four_GammaToLinearCoefficients_C = { -.0452f, -.0452f, -.0452f, -.0452f };
const fltx4 Four_GammaToLinearCoefficients_D = { .0012f, .0012f, .0012f, .0012f };
const fltx4 g_QuatMultRowSign[4] =
{

View File

@ -2830,7 +2830,7 @@ inline QAngle Quaternion::ToQAngle() const
FORCEINLINE vec_t InvRSquared(const float* v)
{
return 1.0 / MAX(1.0, v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
return 1.0f / MAX(1.0f, v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
}
FORCEINLINE vec_t InvRSquared(const Vector3D& v)

View File

@ -45,11 +45,11 @@ class CUtlFixedMemory
{
public:
// constructor, destructor
CUtlFixedMemory(int nGrowSize = 0, int nInitSize = 0);
CUtlFixedMemory(ssize_t nGrowSize = 0, ssize_t nInitSize = 0);
~CUtlFixedMemory();
// Set the size by which the memory grows
void Init(int nGrowSize = 0, int nInitSize = 0);
void Init(ssize_t nGrowSize = 0, ssize_t nInitSize = 0);
// here to match CUtlMemory, but only used by ResetDbgInfo, so it can just return NULL
T* Base() { return NULL; }
@ -62,9 +62,9 @@ public:
class Iterator_t
{
public:
Iterator_t(BlockHeader_t* p, int i) : m_pBlockHeader(p), m_nIndex(i) {}
Iterator_t(BlockHeader_t* p, ssize_t i) : m_pBlockHeader(p), m_nIndex(i) {}
BlockHeader_t* m_pBlockHeader;
int m_nIndex;
ssize_t m_nIndex;
bool operator==(const Iterator_t it) const { return m_pBlockHeader == it.m_pBlockHeader && m_nIndex == it.m_nIndex; }
bool operator!=(const Iterator_t it) const { return m_pBlockHeader != it.m_pBlockHeader || m_nIndex != it.m_nIndex; }
@ -82,15 +82,15 @@ public:
return pHeader->m_pNext ? Iterator_t(pHeader->m_pNext, 0) : InvalidIterator();
}
int GetIndex(const Iterator_t& it) const
ssize_t GetIndex(const Iterator_t& it) const
{
Assert(IsValidIterator(it));
if (!IsValidIterator(it))
return InvalidIndex();
return (int)(HeaderToBlock(it.m_pBlockHeader) + it.m_nIndex);
return (ssize_t)(HeaderToBlock(it.m_pBlockHeader) + it.m_nIndex);
}
bool IsIdxAfter(int i, const Iterator_t& it) const
bool IsIdxAfter(ssize_t i, const Iterator_t& it) const
{
Assert(IsValidIterator(it));
if (!IsValidIterator(it))
@ -110,27 +110,27 @@ public:
Iterator_t InvalidIterator() const { return Iterator_t(NULL, -1); }
// element access
T& operator[](int i);
const T& operator[](int i) const;
T& Element(int i);
const T& Element(int i) const;
T& operator[](ssize_t i);
const T& operator[](ssize_t i) const;
T& Element(ssize_t i);
const T& Element(ssize_t i) const;
// Can we use this index?
bool IsIdxValid(int i) const;
bool IsIdxValid(ssize_t i) const;
// Specify the invalid ('null') index that we'll only return on failure
static const int INVALID_INDEX = 0; // For use with COMPILE_TIME_ASSERT
static int InvalidIndex() { return INVALID_INDEX; }
static const ssize_t INVALID_INDEX = 0; // For use with COMPILE_TIME_ASSERT
static ssize_t InvalidIndex() { return INVALID_INDEX; }
// Size
int NumAllocated() const;
int Count() const { return NumAllocated(); }
ssize_t NumAllocated() const;
ssize_t Count() const { return NumAllocated(); }
// Grows memory by max(num,growsize), and returns the allocation index/ptr
void Grow(int num = 1);
void Grow(ssize_t num = 1);
// Makes sure we've got at least this much memory
void EnsureCapacity(int num);
void EnsureCapacity(ssize_t num);
// Memory deallocation
void Purge();
@ -139,7 +139,7 @@ protected:
// Fast swap - WARNING: Swap invalidates all ptr-based indices!!!
void Swap(CUtlFixedMemory< T >& mem);
bool IsInBlock(int i, BlockHeader_t* pBlockHeader) const
bool IsInBlock(ssize_t i, BlockHeader_t* pBlockHeader) const
{
T* p = (T*)i;
const T* p0 = HeaderToBlock(pBlockHeader);
@ -149,15 +149,15 @@ protected:
struct BlockHeader_t
{
BlockHeader_t* m_pNext;
int m_nBlockSize;
ssize_t m_nBlockSize;
};
const T* HeaderToBlock(const BlockHeader_t* pHeader) const { return (T*)(pHeader + 1); }
const BlockHeader_t* BlockToHeader(const T* pBlock) const { return (BlockHeader_t*)(pBlock)-1; }
BlockHeader_t* m_pBlocks;
int m_nAllocationCount;
int m_nGrowSize;
ssize_t m_nAllocationCount;
ssize_t m_nGrowSize;
};
//-----------------------------------------------------------------------------
@ -165,7 +165,7 @@ protected:
//-----------------------------------------------------------------------------
template< class T >
CUtlFixedMemory<T>::CUtlFixedMemory(int nGrowSize, int nInitAllocationCount)
CUtlFixedMemory<T>::CUtlFixedMemory(ssize_t nGrowSize, ssize_t nInitAllocationCount)
: m_pBlocks(0), m_nAllocationCount(0), m_nGrowSize(0)
{
Init(nGrowSize, nInitAllocationCount);
@ -194,7 +194,7 @@ void CUtlFixedMemory<T>::Swap(CUtlFixedMemory< T >& mem)
// Set the size by which the memory grows - round up to the next power of 2
//-----------------------------------------------------------------------------
template< class T >
void CUtlFixedMemory<T>::Init(int nGrowSize /* = 0 */, int nInitSize /* = 0 */)
void CUtlFixedMemory<T>::Init(ssize_t nGrowSize /* = 0 */, ssize_t nInitSize /* = 0 */)
{
Purge();
@ -207,28 +207,28 @@ void CUtlFixedMemory<T>::Init(int nGrowSize /* = 0 */, int nInitSize /* = 0 */)
// element access
//-----------------------------------------------------------------------------
template< class T >
inline T& CUtlFixedMemory<T>::operator[](int i)
inline T& CUtlFixedMemory<T>::operator[](ssize_t i)
{
Assert(IsIdxValid(i));
return *(T*)i;
}
template< class T >
inline const T& CUtlFixedMemory<T>::operator[](int i) const
inline const T& CUtlFixedMemory<T>::operator[](ssize_t i) const
{
Assert(IsIdxValid(i));
return *(T*)i;
}
template< class T >
inline T& CUtlFixedMemory<T>::Element(int i)
inline T& CUtlFixedMemory<T>::Element(ssize_t i)
{
Assert(IsIdxValid(i));
return *(T*)i;
}
template< class T >
inline const T& CUtlFixedMemory<T>::Element(int i) const
inline const T& CUtlFixedMemory<T>::Element(ssize_t i) const
{
Assert(IsIdxValid(i));
return *(T*)i;
@ -239,7 +239,7 @@ inline const T& CUtlFixedMemory<T>::Element(int i) const
// Size
//-----------------------------------------------------------------------------
template< class T >
inline int CUtlFixedMemory<T>::NumAllocated() const
inline ssize_t CUtlFixedMemory<T>::NumAllocated() const
{
return m_nAllocationCount;
}
@ -249,7 +249,7 @@ inline int CUtlFixedMemory<T>::NumAllocated() const
// Is element index valid?
//-----------------------------------------------------------------------------
template< class T >
inline bool CUtlFixedMemory<T>::IsIdxValid(int i) const
inline bool CUtlFixedMemory<T>::IsIdxValid(ssize_t i) const
{
#ifdef _DEBUG
for (BlockHeader_t* pbh = m_pBlocks; pbh; pbh = pbh->m_pNext)
@ -264,12 +264,12 @@ inline bool CUtlFixedMemory<T>::IsIdxValid(int i) const
}
template< class T >
void CUtlFixedMemory<T>::Grow(int num)
void CUtlFixedMemory<T>::Grow(ssize_t num)
{
if (num <= 0)
return;
int nBlockSize = m_nGrowSize;
ssize_t nBlockSize = m_nGrowSize;
if (nBlockSize == 0)
{
if (m_nAllocationCount)
@ -285,7 +285,7 @@ void CUtlFixedMemory<T>::Grow(int num)
}
if (nBlockSize < num)
{
int n = (num + nBlockSize - 1) / nBlockSize;
ssize_t n = (num + nBlockSize - 1) / nBlockSize;
Assert(n * nBlockSize >= num);
Assert((n - 1) * nBlockSize < num);
nBlockSize *= n;
@ -326,7 +326,7 @@ void CUtlFixedMemory<T>::Grow(int num)
// Makes sure we've got at least this much memory
//-----------------------------------------------------------------------------
template< class T >
inline void CUtlFixedMemory<T>::EnsureCapacity(int num)
inline void CUtlFixedMemory<T>::EnsureCapacity(ssize_t num)
{
Grow(num - NumAllocated());
}

View File

@ -83,10 +83,10 @@ void CLogSystem::DrawLog(void)
if (i < cl_consoleoverlay_lines->GetSizeT())
{
float fadepct = fminf(static_cast<float>(m_vLogs[i].m_nTicks) / 255.f, 4.f); // TODO [ AMOS ]: register a ConVar for this!
float ptc = static_cast<int>(ceilf(fadepct * 100.f));
float ptc = ceilf(fadepct * 100.f);
int alpha = static_cast<int>(ptc);
int x = cl_consoleoverlay_offset_x->GetInt();
int y = cl_consoleoverlay_offset_y->GetInt() + (m_nFontHeight * i);
int y = cl_consoleoverlay_offset_y->GetInt() + (m_nFontHeight * static_cast<int>(i));
Color c = GetLogColorForType(m_vLogs[i].m_type);
if (cl_consoleoverlay_invert_rect_x->GetBool())
@ -96,7 +96,7 @@ void CLogSystem::DrawLog(void)
if (cl_consoleoverlay_invert_rect_y->GetBool())
{
y = g_nWindowHeight - cl_consoleoverlay_offset_y->GetInt();
y += m_nFontHeight * i;
y += m_nFontHeight * static_cast<int>(i);
}
CMatSystemSurface_DrawColoredText(g_pMatSystemSurface, v_Rui_GetFontFace(), m_nFontHeight, x, y, c.r(), c.g(), c.b(), alpha, m_vLogs[i].m_svMessage.c_str());