mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 05:21:16 +00:00
Remove warnings warned by Clang
This commit is contained in:
parent
6d0679cbd9
commit
d84c85d40f
14 changed files with 37 additions and 34 deletions
|
@ -2086,7 +2086,7 @@ void LzmaEnc_Finish(CLzmaEncHandle pp)
|
|||
if (p->mtMode)
|
||||
MatchFinderMt_ReleaseStream(&p->matchFinderMt);
|
||||
#else
|
||||
pp = pp;
|
||||
(void)pp;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -845,7 +845,8 @@ public:
|
|||
DWORD fillcolor; // Color to draw when STYLE_Shaded
|
||||
|
||||
// interaction info
|
||||
fixed_t pitch, roll;
|
||||
fixed_t pitch;
|
||||
angle_t roll; // This was fixed_t before, which is probably wrong
|
||||
FBlockNode *BlockNode; // links in blocks (if needed)
|
||||
struct sector_t *Sector;
|
||||
subsector_t * subsector;
|
||||
|
|
|
@ -123,7 +123,7 @@ bool DBot::Check_LOS (AActor *to, angle_t vangle)
|
|||
if (vangle == 0)
|
||||
return false; //Looker seems to be blind.
|
||||
|
||||
return (angle_t)abs (R_PointToAngle2 (player->mo->x, player->mo->y, to->x, to->y) - player->mo->angle) <= vangle/2;
|
||||
return absangle(R_PointToAngle2 (player->mo->x, player->mo->y, to->x, to->y) - player->mo->angle) <= vangle/2;
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
@ -210,7 +210,7 @@ void DBot::Dofire (ticcmd_t *cmd)
|
|||
{
|
||||
angle = an;
|
||||
//have to be somewhat precise. to avoid suicide.
|
||||
if (abs (angle - player->mo->angle) < 12*ANGLE_1)
|
||||
if (absangle(angle - player->mo->angle) < 12*ANGLE_1)
|
||||
{
|
||||
t_rocket = 9;
|
||||
no_fire = false;
|
||||
|
@ -252,7 +252,7 @@ shootmissile:
|
|||
angle -= m;
|
||||
}
|
||||
|
||||
if (abs (angle - player->mo->angle) < 4*ANGLE_1)
|
||||
if (absangle(angle - player->mo->angle) < 4*ANGLE_1)
|
||||
{
|
||||
increase = !increase;
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ static struct TicSpecial
|
|||
|
||||
specialsize = MAX(specialsize * 2, needed + 30);
|
||||
|
||||
DPrintf ("Expanding special size to %d\n", specialsize);
|
||||
DPrintf ("Expanding special size to %zu\n", specialsize);
|
||||
|
||||
for (i = 0; i < BACKUPTICS; i++)
|
||||
streams[i] = (BYTE *)M_Realloc (streams[i], specialsize);
|
||||
|
|
|
@ -1020,11 +1020,11 @@ void G_Ticker ()
|
|||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
if ((players[i].playerstate == PST_GONE))
|
||||
if (players[i].playerstate == PST_GONE)
|
||||
{
|
||||
G_DoPlayerPop(i);
|
||||
}
|
||||
if ((players[i].playerstate == PST_REBORN || players[i].playerstate == PST_ENTER))
|
||||
if (players[i].playerstate == PST_REBORN || players[i].playerstate == PST_ENTER)
|
||||
{
|
||||
G_DoReborn(i, false);
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
|
|||
if (target->flags&MF_SHOOTABLE && pr_dragonseek() < 64)
|
||||
{ // attack the destination mobj if it's attackable
|
||||
AActor *oldTarget;
|
||||
|
||||
if (abs(actor->angle-R_PointToAngle2(actor->x, actor->y,
|
||||
|
||||
if (absangle(actor->angle-R_PointToAngle2(actor->x, actor->y,
|
||||
target->x, target->y)) < ANGLE_45/2)
|
||||
{
|
||||
oldTarget = actor->target;
|
||||
|
@ -121,9 +121,9 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
|
|||
}
|
||||
angleToSpot = R_PointToAngle2(actor->x, actor->y,
|
||||
mo->x, mo->y);
|
||||
if ((angle_t)abs(angleToSpot-angleToTarget) < bestAngle)
|
||||
if (absangle(angleToSpot-angleToTarget) < bestAngle)
|
||||
{
|
||||
bestAngle = abs(angleToSpot-angleToTarget);
|
||||
bestAngle = absangle(angleToSpot-angleToTarget);
|
||||
bestActor = mo;
|
||||
}
|
||||
}
|
||||
|
@ -198,14 +198,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight)
|
|||
}
|
||||
angle = R_PointToAngle2(self->x, self->y, self->target->x,
|
||||
self->target->y);
|
||||
if (abs(self->angle-angle) < ANGLE_45/2 && self->CheckMeleeRange())
|
||||
if (absangle(self->angle-angle) < ANGLE_45/2 && self->CheckMeleeRange())
|
||||
{
|
||||
int damage = pr_dragonflight.HitDice (8);
|
||||
int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
|
||||
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
|
||||
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
|
||||
}
|
||||
else if (abs(self->angle-angle) <= ANGLE_1*20)
|
||||
else if (absangle(self->angle-angle) <= ANGLE_1*20)
|
||||
{
|
||||
self->SetState (self->MissileState);
|
||||
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
|
||||
|
|
|
@ -314,7 +314,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
|
|||
case SORC_STOPPING: // Balls stopping
|
||||
if ((parent->StopBall == RUNTIME_TYPE(actor)) &&
|
||||
(parent->args[1] > SORCBALL_SPEED_ROTATIONS) &&
|
||||
(abs(angle - (parent->angle>>ANGLETOFINESHIFT)) < (30<<5)))
|
||||
(absangle(angle - (parent->angle>>ANGLETOFINESHIFT)) < (30<<5)))
|
||||
{
|
||||
// Can stop now
|
||||
actor->target->args[3] = SORC_FIRESPELL;
|
||||
|
|
|
@ -109,14 +109,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryCheck)
|
|||
if (playeringame[i])
|
||||
{
|
||||
AActor *pmo = players[i].mo;
|
||||
if (P_CheckSight (self, pmo) && (abs (R_PointToAngle2 (pmo->x,
|
||||
if (P_CheckSight (self, pmo) && (absangle(R_PointToAngle2 (pmo->x,
|
||||
pmo->y, self->x, self->y) - pmo->angle) <= ANGLE_45))
|
||||
{ // Previous state (pottery bit waiting state)
|
||||
self->SetState (self->state - 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lynched corpse (no heart) ------------------------------------------------
|
||||
|
|
|
@ -2754,7 +2754,7 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
|
|||
|
||||
// 0 means no limit. Also, if we turn in a single step anyways, no need to go through the algorithms.
|
||||
// It also means that there is no need to check for going past the other.
|
||||
if (max_turn && (max_turn < (angle_t)abs(self->angle - other_angle)))
|
||||
if (max_turn && (max_turn < absangle(self->angle - other_angle)))
|
||||
{
|
||||
if (self->angle > other_angle)
|
||||
{
|
||||
|
|
|
@ -2951,7 +2951,7 @@ bool AActor::AdjustReflectionAngle (AActor *thing, angle_t &angle)
|
|||
if (thing->flags4&MF4_SHIELDREFLECT)
|
||||
{
|
||||
// Shield reflection (from the Centaur
|
||||
if (abs (angle - thing->angle)>>24 > 45)
|
||||
if (absangle(angle - thing->angle)>>24 > 45)
|
||||
return true; // Let missile explode
|
||||
|
||||
if (thing->IsKindOf (RUNTIME_CLASS(AHolySpirit))) // shouldn't this be handled by another flag???
|
||||
|
|
|
@ -1311,7 +1311,7 @@ void P_LoadSegs (MapData * map)
|
|||
|
||||
ptp_angle = R_PointToAngle2 (li->v1->x, li->v1->y, li->v2->x, li->v2->y);
|
||||
dis = 0;
|
||||
delta_angle = (abs(ptp_angle-(segangle<<16))>>ANGLETOFINESHIFT)*360/FINEANGLES;
|
||||
delta_angle = (absangle(ptp_angle-(segangle<<16))>>ANGLETOFINESHIFT)*360/FINEANGLES;
|
||||
|
||||
if (delta_angle != 0)
|
||||
{
|
||||
|
|
|
@ -56,13 +56,13 @@ extern TArray<FSpecialColormap> SpecialColormaps;
|
|||
// some utility functions to store special colormaps in powerup blends
|
||||
#define SPECIALCOLORMAP_MASK 0x00b60000
|
||||
|
||||
inline int MakeSpecialColormap(int index)
|
||||
inline uint32 MakeSpecialColormap(int index)
|
||||
{
|
||||
assert(index >= 0 && index < 65536);
|
||||
return index | SPECIALCOLORMAP_MASK;
|
||||
}
|
||||
|
||||
inline bool IsSpecialColormap(int map)
|
||||
inline bool IsSpecialColormap(uint32 map)
|
||||
{
|
||||
return (map & 0xFFFF0000) == SPECIALCOLORMAP_MASK;
|
||||
}
|
||||
|
@ -86,4 +86,4 @@ extern bool NormalLightHasFixedLights;
|
|||
FDynamicColormap *GetSpecialLights (PalEntry lightcolor, PalEntry fadecolor, int desaturate);
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
14
src/tables.h
14
src/tables.h
|
@ -36,6 +36,7 @@
|
|||
#ifndef __TABLES_H__
|
||||
#define __TABLES_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "basictypes.h"
|
||||
|
||||
|
@ -92,14 +93,15 @@ extern fixed_t finetangent[FINEANGLES/2];
|
|||
|
||||
typedef uint32 angle_t;
|
||||
|
||||
// Avoid "ambiguous call to overloaded function" errors
|
||||
// Only to be used when you have subtracted two angles.
|
||||
#ifndef __GNUC__
|
||||
inline angle_t abs (angle_t ang)
|
||||
// Previously seen all over the place, code like this: abs(ang1 - ang2)
|
||||
// Clang warns (and is absolutely correct) that technically, this
|
||||
// could be optimized away and do nothing:
|
||||
// warning: taking the absolute value of unsigned type 'unsigned int' has no effect
|
||||
// note: remove the call to 'abs' since unsigned values cannot be negative
|
||||
inline angle_t absangle(angle_t a)
|
||||
{
|
||||
return (angle_t)abs((SDWORD)ang);
|
||||
return (angle_t)abs((int32)a);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Effective size is 2049;
|
||||
// The +1 size is to handle the case when x==y
|
||||
|
|
|
@ -871,8 +871,8 @@ int append_to_zip(FILE *zip_file, file_sorted_t *filep, FILE *ozip, BYTE *odir)
|
|||
LocalFileHeader local;
|
||||
uLong crc;
|
||||
file_entry_t *file;
|
||||
char *readbuf;
|
||||
char *compbuf[2];
|
||||
Byte *readbuf;
|
||||
Byte *compbuf[2];
|
||||
unsigned int comp_len[2];
|
||||
int offset[2];
|
||||
int method[2];
|
||||
|
@ -937,7 +937,7 @@ int append_to_zip(FILE *zip_file, file_sorted_t *filep, FILE *ozip, BYTE *odir)
|
|||
if (odir != NULL && ozip != NULL)
|
||||
{
|
||||
CentralDirectoryEntry *dirent;
|
||||
|
||||
|
||||
dirent = find_file_in_zip(odir, filep->path_in_zip, len, crc, file->date, file->time);
|
||||
if (dirent != NULL)
|
||||
{
|
||||
|
@ -1256,7 +1256,7 @@ int compress_lzma(Byte *out, unsigned int *outlen, const Byte *in, unsigned int
|
|||
|
||||
int compress_bzip2(Byte *out, unsigned int *outlen, const Byte *in, unsigned int inlen)
|
||||
{
|
||||
if (BZ_OK == BZ2_bzBuffToBuffCompress(out, outlen, (char *)in, inlen, 9, 0, 0))
|
||||
if (BZ_OK == BZ2_bzBuffToBuffCompress((char *)out, outlen, (char *)in, inlen, 9, 0, 0))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -1525,7 +1525,7 @@ int copy_zip_file(FILE *zip, file_entry_t *file, FILE *ozip, CentralDirectoryEnt
|
|||
return 0;
|
||||
}
|
||||
// Check to be sure name matches.
|
||||
if (strncmp(buf, (char *)(ent + 1), LittleShort(lfh.NameLength)) != 0)
|
||||
if (strncmp((char *)buf, (char *)(ent + 1), LittleShort(lfh.NameLength)) != 0)
|
||||
{
|
||||
free(buf);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue