Merge pull request #113 from nzp-team/cypress_warnings

GLOBAL: Compile with -Wall and resolve many warnings
This commit is contained in:
cypress 2025-03-02 14:06:56 -08:00 committed by GitHub
commit 62228b72d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 67 additions and 89 deletions

View file

@ -109,13 +109,6 @@ float sniper_hold_breath;
float K_LEFTDOWN, K_RIGHTDOWN, K_BACKDOWN, K_FORWARDDOWN; float K_LEFTDOWN, K_RIGHTDOWN, K_BACKDOWN, K_FORWARDDOWN;
#define P_JUG 1
#define P_DOUBLE 2
#define P_SPEED 4
#define P_REVIVE 8
#define P_FLOP 16
#define P_STAMIN 32
vector TEXT_LIGHTBLUE = [0, 0.46, 0.70]; vector TEXT_LIGHTBLUE = [0, 0.46, 0.70];
vector TEXT_ORANGE = [0.92, 0.74, 0]; vector TEXT_ORANGE = [0.92, 0.74, 0];
vector TEXT_GREEN = [0, 0.90, 0.13]; vector TEXT_GREEN = [0, 0.90, 0.13];

View file

@ -260,7 +260,7 @@ float(float order, string id, string bsp_name, float usermap_index) Menu_MapButt
} }
// Author/Description // Author/Description
if (user_maps[index].map_author) { if (user_maps[index].map_author != "") {
sui_set_align([SUI_ALIGN_CENTER, SUI_ALIGN_END]); sui_set_align([SUI_ALIGN_CENTER, SUI_ALIGN_END]);
string author = user_maps[index].map_author; string author = user_maps[index].map_author;

View file

@ -60,7 +60,7 @@ string UserMapNameLookup(string bsp_name) =
if (user_maps[i].map_name != bsp_name) if (user_maps[i].map_name != bsp_name)
continue; continue;
if (user_maps[i].map_name_pretty) if (user_maps[i].map_name_pretty != "")
return user_maps[i].map_name_pretty; return user_maps[i].map_name_pretty;
return user_maps[i].map_name; return user_maps[i].map_name;

View file

@ -564,7 +564,7 @@ void() Load_Waypoints
{ {
string line; string line;
line = fgets(file); line = fgets(file);
if not (line) { if (line == "") {
bprint(PRINT_HIGH, "End of file\n"); bprint(PRINT_HIGH, "End of file\n");
loop = 0; loop = 0;
break; break;

View file

@ -380,7 +380,7 @@ void LoadWaypointData() {
{ {
string line; string line;
line = fgets(file); line = fgets(file);
if not (line) { if (line == "") {
//bprint(PRINT_HIGH, "End of file\n"); //bprint(PRINT_HIGH, "End of file\n");
loop = 0; loop = 0;
break; break;

View file

@ -198,7 +198,7 @@ void() creator_way_touch =
void () Create_New_Waypoint = void () Create_New_Waypoint =
{ {
float way_count; float way_count = 0;
float tempf; float tempf;
entity tempe; entity tempe;
entity new_way; entity new_way;
@ -389,7 +389,7 @@ void () Link_Waypoints =
active_way.target7 = current_way.waynum; active_way.target7 = current_way.waynum;
active_way.target7 = strzone(active_way.target7); active_way.target7 = strzone(active_way.target7);
} }
else if (active_way.target8) else if (active_way.target8 != __NULL__)
{ {
active_way.target8 = current_way.waynum; active_way.target8 = current_way.waynum;
active_way.target8 = strzone(active_way.target8); active_way.target8 = strzone(active_way.target8);
@ -588,10 +588,11 @@ void () Select_Waypoint =
} }
entity() closestDoor = entity() closestDoor =
{ {
local float bestdist,dist; float bestdist;
float dist = 0;
bestdist = 10000; bestdist = 10000;
dist = 0; entity d;
local entity d,best; entity best = world;
d = find(world,classname,"door_nzp"); d = find(world,classname,"door_nzp");
while(d) while(d)
{ {
@ -691,7 +692,7 @@ void (vector here, float which, string special, string trg, string trg2, string
dprint ("\n"); dprint ("\n");
//current_special++; //current_special++;
} }
if (trg) if (trg != "")
{ {
new_way.target = trg; new_way.target = trg;
new_way.target = strzone(new_way.target); new_way.target = strzone(new_way.target);
@ -699,7 +700,7 @@ void (vector here, float which, string special, string trg, string trg2, string
dprint (new_way.target); dprint (new_way.target);
dprint ("\n"); dprint ("\n");
} }
if (trg2) if (trg2 != "")
{ {
new_way.target2 = trg2; new_way.target2 = trg2;
new_way.target2 = strzone(new_way.target2); new_way.target2 = strzone(new_way.target2);
@ -707,7 +708,7 @@ void (vector here, float which, string special, string trg, string trg2, string
dprint (new_way.target2); dprint (new_way.target2);
dprint ("\n"); dprint ("\n");
} }
if (trg3) if (trg3 != "")
{ {
new_way.target3 = trg3; new_way.target3 = trg3;
new_way.target3 = strzone(new_way.target3); new_way.target3 = strzone(new_way.target3);
@ -715,7 +716,7 @@ void (vector here, float which, string special, string trg, string trg2, string
dprint (new_way.target3); dprint (new_way.target3);
dprint ("\n"); dprint ("\n");
} }
if (trg4) if (trg4 != "")
{ {
new_way.target4 = trg4; new_way.target4 = trg4;
new_way.target4 = strzone(new_way.target4); new_way.target4 = strzone(new_way.target4);
@ -723,7 +724,7 @@ void (vector here, float which, string special, string trg, string trg2, string
dprint (new_way.target4); dprint (new_way.target4);
dprint ("\n"); dprint ("\n");
} }
if (trg5) if (trg5 != "")
{ {
new_way.target5 = trg5; new_way.target5 = trg5;
new_way.target5 = strzone(new_way.target5); new_way.target5 = strzone(new_way.target5);
@ -731,7 +732,7 @@ void (vector here, float which, string special, string trg, string trg2, string
dprint (new_way.target5); dprint (new_way.target5);
dprint ("\n"); dprint ("\n");
} }
if (trg6) if (trg6 != "")
{ {
new_way.target6 = trg6; new_way.target6 = trg6;
new_way.target6 = strzone(new_way.target6); new_way.target6 = strzone(new_way.target6);
@ -739,7 +740,7 @@ void (vector here, float which, string special, string trg, string trg2, string
dprint (new_way.target6); dprint (new_way.target6);
dprint ("\n"); dprint ("\n");
} }
if (trg7) if (trg7 != "")
{ {
new_way.target7 = trg7; new_way.target7 = trg7;
new_way.target7 = strzone(new_way.target7); new_way.target7 = strzone(new_way.target7);
@ -747,7 +748,7 @@ void (vector here, float which, string special, string trg, string trg2, string
dprint (new_way.target7); dprint (new_way.target7);
dprint ("\n"); dprint ("\n");
} }
if (trg8) if (trg8 != "")
{ {
new_way.target8 = trg8; new_way.target8 = trg8;
new_way.target8 = strzone(new_way.target8); new_way.target8 = strzone(new_way.target8);

View file

@ -348,12 +348,6 @@ void (entity who, float low_frequency, float high_frequency, float duration)
#define CONTENT_LAVA -5 #define CONTENT_LAVA -5
#define CONTENT_SKY -6 #define CONTENT_SKY -6
//doors
#define STATE_TOP 0
#define STATE_BOTTOM 1
#define STATE_UP 2
#define STATE_DOWN 3
#define VEC_ORIGIN '0 0 0' #define VEC_ORIGIN '0 0 0'
// protocol bytes // protocol bytes

View file

@ -194,7 +194,7 @@ void() door_fire =
self.message = string_null; // no more message self.message = string_null; // no more message
oself = self; oself = self;
if (self.door_model_target) if (self.door_model_target != "")
{ {
entity tempe = find(world, classname, "func_door_model"); entity tempe = find(world, classname, "func_door_model");
if (tempe != world) { if (tempe != world) {
@ -485,7 +485,7 @@ void() LinkDoors =
if (self.health) if (self.health)
starte.health = self.health; starte.health = self.health;
if (self.targetname) if (self.targetname != "")
starte.targetname = self.targetname; starte.targetname = self.targetname;
if (self.message != "") if (self.message != "")
starte.message = self.message; starte.message = self.message;

View file

@ -141,7 +141,7 @@ void() teddy_spawn =
self.health = 0; self.health = 0;
self.th_die = teddy_react; self.th_die = teddy_react;
if (self.noise) if (self.noise != "")
precache_sound(self.noise); precache_sound(self.noise);
}; };

View file

@ -855,7 +855,7 @@ void(float mbox_file) MBOX_ParseMB2File =
file_line = fgets(mbox_file); file_line = fgets(mbox_file);
// End of file. // End of file.
if not (file_line) { if (file_line == "") {
finished_parsing = true; finished_parsing = true;
break; break;
} }

View file

@ -190,7 +190,7 @@ void(entity pap, entity buyer) PAP_UpgradeWeapon =
Sound_PlaySound(pap, pap.oldmodel, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); Sound_PlaySound(pap, pap.oldmodel, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS);
// Mapper-provided musical sting. // Mapper-provided musical sting.
if (pap.powerup_vo) if (pap.powerup_vo != "")
Sound_PlaySound(pap, pap.powerup_vo, SOUND_TYPE_ENV_MUSIC, SOUND_PRIORITY_PLAYALWAYS); Sound_PlaySound(pap, pap.powerup_vo, SOUND_TYPE_ENV_MUSIC, SOUND_PRIORITY_PLAYALWAYS);
// //
@ -425,7 +425,7 @@ void() perk_pap =
precache_sound(self.oldmodel); precache_sound(self.oldmodel);
if (self.powerup_vo) if (self.powerup_vo != "")
precache_sound(self.powerup_vo); precache_sound(self.powerup_vo);
precache_sound("sounds/machines/papsound.wav"); precache_sound("sounds/machines/papsound.wav");

View file

@ -427,7 +427,7 @@ void() setup_perk =
Turn_PerkLight_On(self); Turn_PerkLight_On(self);
// Perk Jingle Timer // Perk Jingle Timer
if (self.powerup_vo) { if (self.powerup_vo != "") {
self.think = Perk_Jingle; self.think = Perk_Jingle;
self.nextthink = time + rint((random() * 30)) + 30; self.nextthink = time + rint((random() * 30)) + 30;
} }
@ -510,8 +510,8 @@ float drink_skin, float perk_id) Perk_InitMachine =
precache_sound(self.oldmodel); precache_sound(self.oldmodel);
precache_sound("sounds/machines/vend.wav"); precache_sound("sounds/machines/vend.wav");
if (self.aistatus) { precache_sound(self.aistatus); } if (self.aistatus != "") { precache_sound(self.aistatus); }
if (self.powerup_vo) { precache_sound(self.powerup_vo); } if (self.powerup_vo != "") { precache_sound(self.powerup_vo); }
} }
// General Machine Setup // General Machine Setup

View file

@ -100,7 +100,7 @@ void() Power_Touch =
Power_HandleFlip(); Power_HandleFlip();
// Play the sound of the Power Switch flipping // Play the sound of the Power Switch flipping
if (self.powerup_vo) if (self.powerup_vo != "")
Sound_PlaySound(self, self.powerup_vo, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); Sound_PlaySound(self, self.powerup_vo, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS);
isPowerOn = true; isPowerOn = true;
@ -122,7 +122,7 @@ void() Power_Touch =
self = old_self; self = old_self;
} }
} }
if (tempe.targetname) { if (tempe.targetname != "") {
old_self = self; old_self = self;
self = tempe; self = tempe;
remove(self); remove(self);
@ -176,7 +176,7 @@ void() power_switch =
self.box1 = '-4 0 12'; self.box1 = '-4 0 12';
// Switch Flip Sound (Spatialized) // Switch Flip Sound (Spatialized)
if (self.powerup_vo) if (self.powerup_vo != "")
precache_sound(self.powerup_vo); precache_sound(self.powerup_vo);
self.solid = SOLID_TRIGGER; self.solid = SOLID_TRIGGER;

View file

@ -67,21 +67,21 @@ void() SUB_UseTargets =
tempcount = 0; tempcount = 0;
breakthis = false; breakthis = false;
if (self.target) if (self.target != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target2) if (self.target2 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target3) if (self.target3 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target4) if (self.target4 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target5) if (self.target5 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target6) if (self.target6 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target7) if (self.target7 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target8) if (self.target8 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
// //
@ -163,7 +163,7 @@ void() SUB_UseTargets =
// //
// fire targets // fire targets
// //
if (tempstring) if (tempstring != "")
{ {
act = activator; act = activator;
t = find (world, targetname, tempstring); t = find (world, targetname, tempstring);

View file

@ -326,7 +326,7 @@ void() teleport_touch =
} }
if (other.button1) { if (other.button1) {
if (self.targetname) { if (self.targetname != "") {
if (self.nextthink < time) if (self.nextthink < time)
return; // not fired yet return; // not fired yet
} }

View file

@ -145,33 +145,33 @@ void() trigger_activator_touch =
tempstring = ""; tempstring = "";
t = world; t = world;
if (self.target2) if (self.target2 != "")
tempcount =+ 1; tempcount =+ 1;
if (self.target3) if (self.target3 != "")
tempcount =+ 1; tempcount =+ 1;
if (self.target4) if (self.target4 != "")
tempcount =+ 1; tempcount =+ 1;
if (self.target5) if (self.target5 != "")
tempcount =+ 1; tempcount =+ 1;
if (self.target6) if (self.target6 != "")
tempcount =+ 1; tempcount =+ 1;
if (self.target7) if (self.target7 != "")
tempcount =+ 1; tempcount =+ 1;
if (self.target8) if (self.target8 != "")
tempcount =+ 1; tempcount =+ 1;
if (self.target2) if (self.target2 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target3) if (self.target3 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target4) if (self.target4 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target5) if (self.target5 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target6) if (self.target6 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target7) if (self.target7 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target8) if (self.target8 != "")
tempcount = tempcount + 1; tempcount = tempcount + 1;
while(tempcount > temptotal) while(tempcount > temptotal)
@ -193,7 +193,7 @@ void() trigger_activator_touch =
tempstring = self.target7; tempstring = self.target7;
if (temptotal == 8) if (temptotal == 8)
tempstring = self.target8; tempstring = self.target8;
if (tempstring) if (tempstring != "")
{ {
t = find (world, targetname, tempstring); t = find (world, targetname, tempstring);
breakthis = 0; breakthis = 0;
@ -230,7 +230,7 @@ void() trigger_interact_touch =
return; return;
if (Player_UseButtonPressed(other, self)) { if (Player_UseButtonPressed(other, self)) {
if (self.noise) if (self.noise != "")
Sound_PlaySound(other, self.noise, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); Sound_PlaySound(other, self.noise, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS);
multi_trigger(); multi_trigger();
} }
@ -254,7 +254,7 @@ void() teddy_react =
if (t) if (t)
Ent_FakeRemove(t); Ent_FakeRemove(t);
} else if (self.target) { } else if (self.target != "") {
SUB_UseTargets(); SUB_UseTargets();
} }
@ -264,7 +264,7 @@ void() teddy_react =
dummy.nextthink = time + 10; dummy.nextthink = time + 10;
if (self.noise) if (self.noise != "")
Sound_PlaySound(dummy, self.noise, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); Sound_PlaySound(dummy, self.noise, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS);
Ent_FakeRemove(self); Ent_FakeRemove(self);
@ -427,7 +427,7 @@ void() hurt_touch =
self.nextthink = time + 1; self.nextthink = time + 1;
} }
if (self.message) if (self.message != "")
centerprint(other, strcat(self.message, "\n")); centerprint(other, strcat(self.message, "\n"));
} }

View file

@ -78,7 +78,7 @@ void() StartFrame =
zent = find (world, classname, "waypoint"); zent = find (world, classname, "waypoint");
while (zent) while (zent)
{ {
if (zent.targetname) if (zent.targetname != "")
setmodel(zent, "models/way/normal_way_door.spr"); setmodel(zent, "models/way/normal_way_door.spr");
else else
setmodel(zent, "models/way/normal_way.spr"); setmodel(zent, "models/way/normal_way.spr");

View file

@ -86,7 +86,7 @@ void() MapRotation_SelectNextMap =
while(load_loop) { while(load_loop) {
// End of file, use the first map in the file. // End of file, use the first map in the file.
if not (current_map) { if (current_map == "") {
load_loop = false; load_loop = false;
break; break;
} }

View file

@ -259,7 +259,7 @@ void() NewRound =
roundtype = 1; roundtype = 1;
string fog_value; string fog_value;
if (world.fog) if (world.fog != "")
fog_value = strcat(world.fog, "\n"); fog_value = strcat(world.fog, "\n");
else else
fog_value = "0 0 0 0 0\n"; fog_value = "0 0 0 0 0\n";

View file

@ -36,8 +36,6 @@ void(entity ent) MBOX_FreeEnt;
entity() MBOX_GetFreeEnt; entity() MBOX_GetFreeEnt;
void() MBOX_Touch; void() MBOX_Touch;
#define MBOX_SPAWNFLAG_NOLIGHT 2
// //
// GameRestart_CleanPowerUps() // GameRestart_CleanPowerUps()
// Cleans Power-Ups thrown about on the map, // Cleans Power-Ups thrown about on the map,
@ -208,7 +206,7 @@ void() GameRestart_ResetMysteryBox =
} }
// Spawn the Box Glow if permitted // Spawn the Box Glow if permitted
if (!(mystery_box.spawnflags & MBOX_SPAWNFLAG_NOLIGHT)) { if (!(mystery_box.spawnflags & 2)) {
entity light = MBOX_GetFreeEnt(); entity light = MBOX_GetFreeEnt();
light.classname = "mystery_glow"; light.classname = "mystery_glow";
original_box.goaldummy = light; original_box.goaldummy = light;

View file

@ -25,9 +25,6 @@
*/ */
#define true 1
#define false 0
// //
// CSQC Particle Types // CSQC Particle Types
// //
@ -109,11 +106,6 @@
#define SCREENFLASH_FADE_IN 1 #define SCREENFLASH_FADE_IN 1
#define SCREENFLASH_FADE_OUT 2 #define SCREENFLASH_FADE_OUT 2
// Define our FTE platform
#ifndef STANDARD
#define FTE
#endif // STANDARD
// Player Hull Sizes // Player Hull Sizes
// 32x32x72 // 32x32x72
#define PLAYER_MINS_STANDING '-16 -16 -32' #define PLAYER_MINS_STANDING '-16 -16 -32'

View file

@ -52,10 +52,10 @@ function compile_progs()
function main() function main()
{ {
setup; setup;
compile_progs "csqc" "FTE CSQC" "-DFTE" compile_progs "csqc" "FTE CSQC" "-DFTE -Wall"
compile_progs "ssqc" "FTE SSQC" "-O3 -DFTE" compile_progs "ssqc" "FTE SSQC" "-O3 -DFTE -Wall"
compile_progs "menu" "FTE MenuQC" "-O3 -DFTE" compile_progs "menu" "FTE MenuQC" "-O3 -DFTE -Wall"
compile_progs "ssqc" "Vril SSQC" "-O3" compile_progs "ssqc" "Vril SSQC" "-O3 -Wall"
exit ${RC} exit ${RC}
} }