Fixed some little bugs (thanks to Clang static analyzer)
This commit is contained in:
parent
ea273fc32b
commit
db88ee4703
@ -134,7 +134,7 @@ namespace spades {
|
||||
|
||||
// fade the map
|
||||
float fade = Clamp((time - 1.f) / 2.2f, 0.f, 1.f);
|
||||
sceneDef.globalBlur = Clamp((1.f - (time - 1.f) / 2.5f) * 4.f, 0.f, 1.f);
|
||||
sceneDef.globalBlur = Clamp((1.f - (time - 1.f) / 2.5f), 0.f, 1.f);
|
||||
if(!mainMenu.IsEnabled) {
|
||||
sceneDef.globalBlur = Max(sceneDef.globalBlur, 0.5f);
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ namespace spades {
|
||||
|
||||
alDevice = al::qalcOpenDevice(NULL);
|
||||
if(!alDevice){
|
||||
if(ext = al::qalcGetString(NULL, ALC_EXTENSIONS)){
|
||||
if((ext = al::qalcGetString(NULL, ALC_EXTENSIONS))){
|
||||
std::vector<std::string> strs = Split(ext, " ");
|
||||
SPLog("OpenAL ALC Extensions (NULL):");
|
||||
for(size_t i = 0; i < strs.size(); i++) {
|
||||
@ -409,7 +409,7 @@ namespace spades {
|
||||
SPLog(" Version: %s", al::qalGetString(AL_VERSION));
|
||||
SPLog(" Renderer: %s", al::qalGetString(AL_RENDERER));
|
||||
|
||||
if(ext = al::qalcGetString(alDevice, ALC_EXTENSIONS)){
|
||||
if((ext = al::qalcGetString(alDevice, ALC_EXTENSIONS))){
|
||||
std::vector<std::string> strs = Split(ext, " ");
|
||||
SPLog("OpenAL ALC Extensions:");
|
||||
for(size_t i = 0; i < strs.size(); i++) {
|
||||
|
@ -242,24 +242,27 @@ namespace spades {
|
||||
else if (c.x != a.x) {
|
||||
d.x = 1; f.x = a.x+1-v0.x; g.x = (v1.x-v0.x)*1024; cnt += c.x-a.x;
|
||||
}
|
||||
else
|
||||
f.x = g.x = 0;
|
||||
else {
|
||||
d.x = 0; f.x = g.x = 0;
|
||||
}
|
||||
if (c.y < a.y) {
|
||||
d.y = -1; f.y = v0.y-a.y; g.y = (v0.y-v1.y)*1024; cnt += a.y-c.y;
|
||||
}
|
||||
else if (c.y != a.y) {
|
||||
d.y = 1; f.y = a.y+1-v0.y; g.y = (v1.y-v0.y)*1024; cnt += c.y-a.y;
|
||||
}
|
||||
else
|
||||
f.y = g.y = 0;
|
||||
else {
|
||||
d.y = 0; f.y = g.y = 0;
|
||||
}
|
||||
if (c.z < a.z) {
|
||||
d.z = -1; f.z = v0.z-a.z; g.z = (v0.z-v1.z)*1024; cnt += a.z-c.z;
|
||||
}
|
||||
else if (c.z != a.z) {
|
||||
d.z = 1; f.z = a.z+1-v0.z; g.z = (v1.z-v0.z)*1024; cnt += c.z-a.z;
|
||||
}
|
||||
else
|
||||
f.z = g.z = 0;
|
||||
else {
|
||||
d.z = 0; f.z = g.z = 0;
|
||||
}
|
||||
|
||||
Vector3 pp = MakeVector3(f.x * g.z - f.z * g.x,
|
||||
f.y * g.z - f.z * g.y,
|
||||
|
@ -240,7 +240,8 @@ namespace spades {
|
||||
float newScale = scale <= .8f ?
|
||||
0.5f : std::max(1.f, floorf(scale));
|
||||
// vertical-align: baseline
|
||||
y += (scale - newScale) * glyph.size;
|
||||
// FIXME: not working correctly
|
||||
offset.y += (scale - newScale) * glyph.size;
|
||||
scale = newScale;
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,7 @@ namespace spades {
|
||||
fv.x = Mix(fv.x, avg, 0.5f);
|
||||
fv.y = Mix(fv.y, avg, 0.5f);
|
||||
fv.z = Mix(fv.z, avg, 0.5f);
|
||||
fv.w = 0.f; // suppress "operating on garbase value" static analyzer message
|
||||
fv = fv * 0.8f + 0.2f;
|
||||
fv.w = 1.f;
|
||||
return fv;
|
||||
|
@ -199,6 +199,7 @@ namespace spades {
|
||||
case HitTypeArms: return 33;
|
||||
case HitTypeLegs: return 33;
|
||||
case HitTypeBlock: return 50;
|
||||
default: SPAssert(false); return 0;
|
||||
}
|
||||
}
|
||||
virtual Vector3 GetRecoil () {
|
||||
@ -225,6 +226,7 @@ namespace spades {
|
||||
case HitTypeArms: return 18;
|
||||
case HitTypeLegs: return 18;
|
||||
case HitTypeBlock: return 25;
|
||||
default: SPAssert(false); return 0;
|
||||
}
|
||||
}
|
||||
virtual Vector3 GetRecoil () {
|
||||
@ -253,6 +255,7 @@ namespace spades {
|
||||
case HitTypeBlock:
|
||||
// Actually, you cast a hit per pallet. This value is a guess, by the way. --GM
|
||||
return 34;
|
||||
default: SPAssert(false); return 0;
|
||||
}
|
||||
}
|
||||
virtual Vector3 GetRecoil () {
|
||||
@ -283,6 +286,7 @@ namespace spades {
|
||||
case HitTypeArms: return 33;
|
||||
case HitTypeLegs: return 33;
|
||||
case HitTypeBlock: return 50;
|
||||
default: SPAssert(false); return 0;
|
||||
}
|
||||
}
|
||||
virtual Vector3 GetRecoil () {
|
||||
@ -309,6 +313,7 @@ namespace spades {
|
||||
case HitTypeArms: return 18;
|
||||
case HitTypeLegs: return 18;
|
||||
case HitTypeBlock: return 34;
|
||||
default: SPAssert(false); return 0;
|
||||
}
|
||||
}
|
||||
virtual Vector3 GetRecoil () {
|
||||
@ -336,6 +341,7 @@ namespace spades {
|
||||
case HitTypeLegs: return 16;
|
||||
case HitTypeBlock:
|
||||
return 34;
|
||||
default: SPAssert(false); return 0;
|
||||
}
|
||||
}
|
||||
virtual Vector3 GetRecoil () {
|
||||
|
@ -70,7 +70,7 @@ namespace spades {
|
||||
}
|
||||
void Set(T *p, bool add = true) {
|
||||
if(p == ptr){
|
||||
if(!add)
|
||||
if((!add) && ptr != nullptr)
|
||||
ptr->Release();
|
||||
return;
|
||||
}
|
||||
|
@ -387,6 +387,7 @@ namespace spades {
|
||||
|
||||
GLColorBuffer coc;
|
||||
|
||||
globalBlur = std::min(globalBlur * 3.f, 1.f);
|
||||
{
|
||||
GLProfiler p(dev, "CoC Computation");
|
||||
coc = GenerateCoC(blurDepthRange, vignetteBlur, globalBlur);
|
||||
@ -397,8 +398,7 @@ namespace spades {
|
||||
float sin60 = sinf(static_cast<float>(M_PI) / 3.f);
|
||||
|
||||
maxCoc *= .7f + vignetteBlur * 0.5f;
|
||||
maxCoc += 1.f + 5.f * globalBlur;
|
||||
globalBlur = std::min(globalBlur * 5.f, 1.f);
|
||||
maxCoc *= 1.f + 3.f * globalBlur;
|
||||
|
||||
// reduce resolution to make it faster
|
||||
int divide = 1;
|
||||
|
@ -62,6 +62,8 @@ namespace spades {
|
||||
case IGLDevice:: FramebufferIncompleteLayerTargets:
|
||||
type = "GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS";
|
||||
break;
|
||||
default: // IGLDevice::Enum contains values unrelevant to framebuffer status error causing static analyzer to say something
|
||||
type = "Unknown";
|
||||
}
|
||||
SPRaise("OpenGL Framebuffer completeness check failed: %s",
|
||||
type.c_str());
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "StartupScreen.h"
|
||||
#include <Core/Exception.h>
|
||||
#include <Client/Quake3Font.h>
|
||||
#include <Client/FontData.h>
|
||||
#include <ScriptBindings/ScriptFunction.h>
|
||||
#include "StartupScreenHelper.h"
|
||||
#include <Client/Client.h>
|
||||
|
@ -243,6 +243,7 @@ namespace spades {
|
||||
"void opAssign(const DynamicLightParam& in)",
|
||||
asFUNCTION(DynamicLightParamAssign),
|
||||
asCALL_CDECL_OBJLAST);
|
||||
manager->CheckError(r);
|
||||
r = eng->RegisterObjectProperty("DynamicLightParam",
|
||||
"DynamicLightType type",
|
||||
asOFFSET(DynamicLightParam, type));
|
||||
|
@ -22,6 +22,8 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
yvt: modified to fix some bug
|
||||
*/
|
||||
/**
|
||||
* BinPack2D is a 2 dimensional, multi-bin, bin-packer. ( Texture Atlas Array! )
|
||||
@ -162,6 +164,7 @@ public:
|
||||
|
||||
if(this->w != that.w) return this->w < that.w;
|
||||
if(this->h != that.h) return this->h < that.h;
|
||||
return false; // yvt
|
||||
}
|
||||
};
|
||||
|
||||
@ -199,6 +202,7 @@ public:
|
||||
if(this->x != that.x) return this->x < that.x;
|
||||
if(this->y != that.y) return this->y < that.y;
|
||||
if(this->z != that.z) return this->z < that.z;
|
||||
return false; // yvt
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1250,7 +1250,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
||||
return UNZ_PARAMERROR;
|
||||
|
||||
|
||||
if ((pfile_in_zip_read_info->read_buffer == NULL))
|
||||
if (pfile_in_zip_read_info->read_buffer == NULL)
|
||||
return UNZ_END_OF_LIST_OF_FILE;
|
||||
if (len==0)
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user