From e4715af2d04656465b64492ddf1c02ac1503ac43 Mon Sep 17 00:00:00 2001 From: TimePath Date: Wed, 28 Jan 2015 09:10:55 +1100 Subject: [PATCH] Declare more ints as ints --- qcsrc/client/Defs.qc | 32 ++++++++++---------- qcsrc/client/Main.qc | 16 +++++----- qcsrc/client/csqcmodel_hooks.qc | 2 +- qcsrc/client/hook.qc | 2 +- qcsrc/client/hud.qh | 2 +- qcsrc/client/main.qh | 22 +++++++------- qcsrc/client/mapvoting.qc | 2 +- qcsrc/client/miscfunctions.qc | 10 +++---- qcsrc/client/movetypes.qc | 5 ++-- qcsrc/client/particles.qc | 2 +- qcsrc/client/player_skeleton.qc | 17 +++++------ qcsrc/client/player_skeleton.qh | 2 +- qcsrc/client/scoreboard.qc | 8 +++-- qcsrc/client/teamradar.qh | 2 +- qcsrc/client/tturrets.qc | 5 ++-- qcsrc/client/vehicles/vehicles.qc | 8 ++--- qcsrc/client/wall.qc | 2 +- qcsrc/common/animdecide.qh | 36 +++++++++++----------- qcsrc/common/csqcmodel_settings.qh | 6 ++-- qcsrc/common/nades.qh | 48 +++++++++++++++--------------- qcsrc/common/util.qc | 11 ++++--- qcsrc/common/util.qh | 10 +++---- qcsrc/dpdefs/csprogsdefs.qc | 48 +++++++++++++++--------------- qcsrc/dpdefs/dpextensions.qc | 4 +-- 24 files changed, 149 insertions(+), 153 deletions(-) diff --git a/qcsrc/client/Defs.qc b/qcsrc/client/Defs.qc index 604bfef52..0e7b14150 100644 --- a/qcsrc/client/Defs.qc +++ b/qcsrc/client/Defs.qc @@ -25,8 +25,8 @@ entity world; float time; float frametime; -float player_localentnum; //the entnum of the VIEW entity -float player_localnum; //the playernum +int player_localentnum; //the entnum of the VIEW entity +int player_localnum; //the playernum float maxclients; //a constant filled in by the engine. gah, portability eh? float clientcommandframe; //player movement @@ -57,7 +57,7 @@ void() CSQC_Init; void() CSQC_Shutdown; float(float f, float t, float n) CSQC_InputEvent; void(float w, float h) CSQC_UpdateView; -float(string s) CSQC_ConsoleCommand; +bool(string s) CSQC_ConsoleCommand; //these fields are read and set by the default player physics vector pmove_org; @@ -68,7 +68,7 @@ vector pmove_maxs; float input_timelength; vector input_angles; vector input_movevalues; //forwards, right, up. -float input_buttons; //attack, use, jump (default physics only uses jump) +int input_buttons; //attack, use, jump (default physics only uses jump) float movevar_gravity; float movevar_stopspeed; @@ -96,10 +96,10 @@ void end_sys_globals; // flag for structure dumping // // system fields (*** = do not set in prog code, maintained by C code) // -.float modelindex; // *** model index in the precached list +.int modelindex; // *** model index in the precached list .vector absmin, absmax; // *** origin + mins / maxs -.float entnum; // *** the ent number as on the server +.int entnum; // *** the ent number as on the server .float drawmask; .void() predraw; @@ -114,8 +114,8 @@ void end_sys_globals; // flag for structure dumping .string classname; // spawn function .string model; -.float frame; -.float skin; +.int frame; +.int skin; .int effects; .vector mins, maxs; // bounding box extents reletive to origin @@ -168,11 +168,11 @@ float dmg_take; // Basic variables .float enttype; // entity type sent from server .int sv_entnum; // entity number sent from server -.float team; -.float team_size; +.int team; +.int team_size; float vid_conwidth, vid_conheight; -float binddb; +int binddb; // QUALIFYING float race_checkpoint; @@ -220,8 +220,8 @@ float spectatee_status; string shortmapname; // database for misc stuff -float tempdb; -float ClientProgsDB; +int tempdb; +int ClientProgsDB; vector hook_shotorigin[4]; vector lightning_shotorigin[4]; @@ -238,14 +238,14 @@ float ticrate; const float MIN_DAMAGEEXTRARADIUS = 2; const float MAX_DAMAGEEXTRARADIUS = 16; .float damageextraradius; -.void(float thisdmg, float hittype, vector org, vector thisforce) event_damage; +.void(float thisdmg, int hittype, vector org, vector thisforce) event_damage; // only for Porto float angles_held_status; vector angles_held; // weapons -.float silent; +.bool silent; int w_deathtype; float w_issilent, w_random; @@ -269,7 +269,7 @@ int serverflags; float uid2name_dialog; -.float csqcmodel_isdead; // used by shownames and miscfunctions (float getplayerisdead(float) {}) to know when a player is dead +.bool csqcmodel_isdead; // used by shownames and miscfunctions (float getplayerisdead(float) {}) to know when a player is dead #define player_currententnum (spectatee_status > 0 ? spectatee_status : player_localnum + 1) diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 4ba741dfc..22b814f2d 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -10,7 +10,7 @@ void clearentity(entity e) clearentity_ent = spawn(); clearentity_ent.classname = "clearentity"; } - float n = e.entnum; + int n = e.entnum; copyentity(clearentity_ent, e); e.entnum = n; } @@ -39,7 +39,7 @@ void CSQC_Init(void) dprintf("^4CSQC Build information: ^1%s\n", WATERMARK); #endif - float i; + int i; binddb = db_create(); tempdb = db_create(); @@ -174,7 +174,7 @@ void Shutdown(void) } .float has_team; -float SetTeam(entity o, float Team) +float SetTeam(entity o, int Team) { entity tm; if(teamplay) @@ -386,8 +386,8 @@ void Ent_RemovePlayerScore() void Ent_ReadPlayerScore() { - float i, n; - float isNew; + int i, n; + bool isNew; entity o; // damnit -.- don't want to go change every single .sv_entnum in hud.qc AGAIN @@ -444,7 +444,7 @@ void Ent_ReadPlayerScore() void Ent_ReadTeamScore() { - float i; + int i; entity o; self.team = ReadByte(); @@ -458,7 +458,7 @@ void Ent_ReadTeamScore() sf = ReadShort(); lf = ReadShort(); #endif - float p; + int p; for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2) if(sf & p) { @@ -1153,7 +1153,7 @@ void Net_TeamNagger() void Net_ReadPingPLReport() { - float e, pi, pl, ml; + int e, pi, pl, ml; e = ReadByte(); pi = ReadShort(); pl = ReadByte(); diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 9a311fab9..8ca019457 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -484,7 +484,7 @@ void CSQCModel_Effects_PostUpdate(void) if(self.csqcmodel_teleported) Projectile_ResetTrail(self.origin); } -.bool snd_looping; +.int snd_looping; void CSQCModel_Effects_Apply(void) { int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST; diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index a537cbae6..b7c023b4d 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -52,7 +52,7 @@ void Draw_GrapplingHook() string tex; vector rgb; float t; - float s; + int s; vector vs; float intensity, offset; diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 70eb08128..85a1966ba 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -23,7 +23,7 @@ const float BORDER_MULTIPLIER = 0.25; float scoreboard_bottom; int weapon_accuracy[WEP_MAXCOUNT]; -float complain_weapon; +int complain_weapon; string complain_weapon_name; float complain_weapon_type; float complain_weapon_time; diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index 8b6cbac12..88db7ea21 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -44,19 +44,19 @@ float FONT_USER = 8; // -------------------------------------------------------------------------- // Scoreboard stuff -const float MAX_HUD_FIELDS = 16; +const int MAX_HUD_FIELDS = 16; -const float SP_END = -1; +const int SP_END = -1; -const float SP_PING = -2; -const float SP_NAME = -3; -const float SP_KDRATIO = -4; -const float SP_CLRATIO = -5; -const float SP_PL = -6; -const float SP_FRAGS = -7; -const float SP_SUM = -8; +const int SP_PING = -2; +const int SP_NAME = -3; +const int SP_KDRATIO = -4; +const int SP_CLRATIO = -5; +const int SP_PL = -6; +const int SP_FRAGS = -7; +const int SP_SUM = -8; -const float SP_SEPARATOR = -100; +const int SP_SEPARATOR = -100; float hud_field[MAX_HUD_FIELDS + 1]; float hud_size[MAX_HUD_FIELDS + 1]; @@ -147,4 +147,4 @@ entity entcs_receiver[255]; // 255 is the engine limit on maxclients float hud; float view_quality; -float framecount; +int framecount; diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index e82961e20..5bffcdee1 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -494,7 +494,7 @@ void MapVote_ReadMask() } } -const float NUM_SSDIRS = 4; +const int NUM_SSDIRS = 4; string ssdirs[NUM_SSDIRS]; int n_ssdirs; void MapVote_Init() diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index fcc248220..25741ce00 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -111,14 +111,12 @@ void RemoveTeam(entity Team) entity GetTeam(int Team, bool add) { - float num; - entity tm; - num = (Team == NUM_SPECTATOR) ? 16 : Team; + int num = (Team == NUM_SPECTATOR) ? 16 : Team; if(teamslots[num]) return teamslots[num]; if (!add) return world; - tm = spawn(); + entity tm = spawn(); tm.team = Team; teamslots[num] = tm; RegisterTeam(tm); @@ -615,7 +613,7 @@ float getplayerisdead(float pl) return false; } -void URI_Get_Callback(float id, float status, string data) +void URI_Get_Callback(int id, float status, string data) { if(url_URI_Get_Callback(id, status, data)) { @@ -647,7 +645,7 @@ void draw_endBoldFont() } -const float MAX_ACCURACY_LEVELS = 10; +const int MAX_ACCURACY_LEVELS = 10; float acc_lev[MAX_ACCURACY_LEVELS]; vector acc_col[MAX_ACCURACY_LEVELS]; float acc_col_loadtime; diff --git a/qcsrc/client/movetypes.qc b/qcsrc/client/movetypes.qc index a85ca13c2..a1e9a65f7 100644 --- a/qcsrc/client/movetypes.qc +++ b/qcsrc/client/movetypes.qc @@ -11,7 +11,7 @@ void _Movetype_CheckVelocity() // SV_CheckVelocity float _Movetype_CheckWater(entity ent) // SV_CheckWater { - float supercontents; + int supercontents; float nativecontents; vector point; @@ -189,10 +189,9 @@ void _Movetype_LinkEdict(float touch_triggers) // SV_LinkEdict float _Movetype_TestEntityPosition(vector ofs) // SV_TestEntityPosition { vector org; - float cont; org = self.move_origin + ofs; - cont = self.dphitcontentsmask; + int cont = self.dphitcontentsmask; self.dphitcontentsmask = DPCONTENTS_SOLID; tracebox(self.move_origin, self.mins, self.maxs, self.move_origin, MOVE_NOMONSTERS, self); self.dphitcontentsmask = cont; diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc index 578e96181..a8dd10c69 100644 --- a/qcsrc/client/particles.qc +++ b/qcsrc/client/particles.qc @@ -1,4 +1,4 @@ -.float dphitcontentsmask; +.int dphitcontentsmask; .int cnt; // effect number .vector velocity; // particle velocity diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc index a0d75057a..01cbfc605 100644 --- a/qcsrc/client/player_skeleton.qc +++ b/qcsrc/client/player_skeleton.qc @@ -1,14 +1,14 @@ .float skeleton_info_modelindex; .float skeleton_info_skin; -const float BONETYPE_LOWER = 0; -const float BONETYPE_UPPER = 1; -const float MAX_BONES = 128; +const int BONETYPE_LOWER = 0; +const int BONETYPE_UPPER = 1; +const int MAX_BONES = 128; .float skeleton_bonetype[MAX_BONES]; .float skeleton_numbones; void skeleton_loadinfo(entity e) { - float i; + int i; if(e.skeleton_info_modelindex == e.modelindex && e.skeleton_info_skin == e.skin) return; e.bone_upperbody = 0; @@ -56,11 +56,11 @@ void skeleton_markbones(entity e) { float s = e.skeletonindex; float n = (e.skeleton_numbones = skel_get_numbones(s)); - float i; + int i; for(i = 1; i <= n; ++i) { float t = BONETYPE_LOWER; - float p = skel_get_boneparent(s, i); + int p = skel_get_boneparent(s, i); if(p > 0) t = e.(skeleton_bonetype[p-1]); if(i == e.bone_upperbody) @@ -100,7 +100,6 @@ void free_skeleton_from_frames(entity e) void skeleton_from_frames(entity e, float is_dead) { - float i; float m = e.modelindex; if(!e.skeletonindex) { @@ -110,7 +109,6 @@ void skeleton_from_frames(entity e, float is_dead) float s = e.skeletonindex; if(!s) return; - float bone; float n = e.skeleton_numbones; float savelerpfrac = e.lerpfrac; float savelerpfrac3 = e.lerpfrac3; @@ -129,7 +127,7 @@ void skeleton_from_frames(entity e, float is_dead) skel_get_boneabs(s, e.bone_upperbody); fixbone_oldangles = fixedvectoangles2(v_forward, v_up); } - + int bone; for(bone = 0; bone < n; ) { float firstbone = bone; @@ -168,6 +166,7 @@ void skeleton_from_frames(entity e, float is_dead) if(!is_dead) { + int i; for(i = 0; i < MAX_AIM_BONES; ++i) { if(e.(bone_aim[i])) diff --git a/qcsrc/client/player_skeleton.qh b/qcsrc/client/player_skeleton.qh index d369bac4e..fdf5b3dfc 100644 --- a/qcsrc/client/player_skeleton.qh +++ b/qcsrc/client/player_skeleton.qh @@ -3,7 +3,7 @@ void skeleton_from_frames(entity e, float is_dead); void skeleton_loadinfo(entity e); .float bone_upperbody; -.float bone_weapon; +.int bone_weapon; .float bone_aim[MAX_AIM_BONES]; .float bone_aimweight[MAX_AIM_BONES]; .float fixbone; diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index 40ee14d5f..5f4cbc1b8 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -134,7 +134,7 @@ int HUD_CompareScore(float vl, float vr, int f) float HUD_ComparePlayerScores(entity left, entity right) { - float vl, vr, r, i; + float vl, vr, r; vl = GetPlayerColor(left.sv_entnum); vr = GetPlayerColor(right.sv_entnum); @@ -165,6 +165,7 @@ float HUD_ComparePlayerScores(entity left, entity right) if (r >= 0) return r; + int i; for(i = 0; i < MAX_SCORE; ++i) { r = HUD_CompareScore(left.scores[i], right.scores[i], scores_flags[i]); @@ -501,7 +502,7 @@ vector hud_field_icon2_rgb; float hud_field_icon0_alpha; float hud_field_icon1_alpha; float hud_field_icon2_alpha; -string HUD_GetField(entity pl, float field) +string HUD_GetField(entity pl, int field) { float tmp, num, denom, f; string str; @@ -813,7 +814,7 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size) { - float body_table_height, i; + float body_table_height; vector tmp = '0 0 0', column_dim = '0 0 0'; entity pl; @@ -868,6 +869,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz // print the strings of the columns headers and draw the columns draw_beginBoldFont(); + int i; for(i = 0; i < hud_num_fields; ++i) { if(hud_field[i] == SP_SEPARATOR) diff --git a/qcsrc/client/teamradar.qh b/qcsrc/client/teamradar.qh index dfa92ef1c..2ab26a343 100644 --- a/qcsrc/client/teamradar.qh +++ b/qcsrc/client/teamradar.qh @@ -1,4 +1,4 @@ -const float MAX_TEAMRADAR_TIMES = 32; +const int MAX_TEAMRADAR_TIMES = 32; // to make entities have dots on the team radar .float teamradar_icon; diff --git a/qcsrc/client/tturrets.qc b/qcsrc/client/tturrets.qc index 440067ada..0e5099936 100644 --- a/qcsrc/client/tturrets.qc +++ b/qcsrc/client/tturrets.qc @@ -13,7 +13,7 @@ void turrets_precache() turret_precache(TID_COMMON); } -void turret_precache(float _tid) +void turret_precache(int _tid) { if (!turret_is_precache[TID_COMMON]) { @@ -596,8 +596,7 @@ void turret_die() void ent_turret() { - float sf; - sf = ReadByte(); + int sf = ReadByte(); if(sf & TNSF_SETUP) { diff --git a/qcsrc/client/vehicles/vehicles.qc b/qcsrc/client/vehicles/vehicles.qc index 6f9a25a41..a986fa728 100644 --- a/qcsrc/client/vehicles/vehicles.qc +++ b/qcsrc/client/vehicles/vehicles.qc @@ -208,11 +208,11 @@ void Net_VehicleSetup() } } #define HUD_GETSTATS \ - int vh_health = getstati(STAT_VEHICLESTAT_HEALTH); \ - int shield = getstati(STAT_VEHICLESTAT_SHIELD); \ + int vh_health = getstati(STAT_VEHICLESTAT_HEALTH); \ + float shield = getstati(STAT_VEHICLESTAT_SHIELD); \ noref int energy = getstati(STAT_VEHICLESTAT_ENERGY); \ - noref int ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \ - noref int reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \ + noref float ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \ + noref float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \ noref int ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \ noref int reload2 = getstati(STAT_VEHICLESTAT_RELOAD2); diff --git a/qcsrc/client/wall.qc b/qcsrc/client/wall.qc index 7b5a6b071..314e8cce3 100644 --- a/qcsrc/client/wall.qc +++ b/qcsrc/client/wall.qc @@ -1,6 +1,6 @@ .float lip; .float bgmscriptangular; -.float lodmodelindex0, lodmodelindex1, lodmodelindex2; +.int lodmodelindex0, lodmodelindex1, lodmodelindex2; .float loddistance1, loddistance2; .vector saved; diff --git a/qcsrc/common/animdecide.qh b/qcsrc/common/animdecide.qh index f9261adae..58e069392 100644 --- a/qcsrc/common/animdecide.qh +++ b/qcsrc/common/animdecide.qh @@ -3,7 +3,7 @@ void animdecide_load_if_needed(entity e); // client side frame inferring void animdecide_setimplicitstate(entity e, float onground); -void animdecide_setframes(entity e, float support_blending, .float fld_frame, .float fld_frame1time, .float fld_frame2, .float fld_frame2time); +void animdecide_setframes(entity e, bool support_blending, .int fld_frame, .int fld_frame1time, .int fld_frame2, .int fld_frame2time); // please network this one .int anim_state; @@ -23,25 +23,25 @@ void animdecide_setframes(entity e, float support_blending, .float fld_frame, .f // explicit anim states (networked) void animdecide_setstate(entity e, float newstate, float restart); -const float ANIMSTATE_DEAD1 = 1; // base frames: die1 -const float ANIMSTATE_DEAD2 = 2; // base frames: die2 -const float ANIMSTATE_DUCK = 4; // turns walk into duckwalk, jump into duckjump, etc. -const float ANIMSTATE_FROZEN = 8; // force idle +const int ANIMSTATE_DEAD1 = 1; // base frames: die1 +const int ANIMSTATE_DEAD2 = 2; // base frames: die2 +const int ANIMSTATE_DUCK = 4; // turns walk into duckwalk, jump into duckjump, etc. +const int ANIMSTATE_FROZEN = 8; // force idle // implicit anim states (inferred from velocity, etc.) -const float ANIMIMPLICITSTATE_INAIR = 1; -const float ANIMIMPLICITSTATE_FORWARD = 2; -const float ANIMIMPLICITSTATE_BACKWARDS = 4; -const float ANIMIMPLICITSTATE_LEFT = 8; -const float ANIMIMPLICITSTATE_RIGHT = 16; -const float ANIMIMPLICITSTATE_JUMPRELEASED = 32; +const int ANIMIMPLICITSTATE_INAIR = 1; +const int ANIMIMPLICITSTATE_FORWARD = 2; +const int ANIMIMPLICITSTATE_BACKWARDS = 4; +const int ANIMIMPLICITSTATE_LEFT = 8; +const int ANIMIMPLICITSTATE_RIGHT = 16; +const int ANIMIMPLICITSTATE_JUMPRELEASED = 32; // explicit actions (networked); negative values are for lower body void animdecide_setaction(entity e, float action, float restart); -const float ANIMACTION_JUMP = -1; // jump -const float ANIMACTION_DRAW = 1; // draw -const float ANIMACTION_PAIN1 = 2; // pain -const float ANIMACTION_PAIN2 = 3; // pain -const float ANIMACTION_SHOOT = 4; // shoot -const float ANIMACTION_TAUNT = 5; // taunt -const float ANIMACTION_MELEE = 6; // melee +const int ANIMACTION_JUMP = -1; // jump +const int ANIMACTION_DRAW = 1; // draw +const int ANIMACTION_PAIN1 = 2; // pain +const int ANIMACTION_PAIN2 = 3; // pain +const int ANIMACTION_SHOOT = 4; // shoot +const int ANIMACTION_TAUNT = 5; // taunt +const int ANIMACTION_MELEE = 6; // melee diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index 16fd950b4..54ef11117 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -22,9 +22,9 @@ // add properties you want networked to CSQC here #define CSQCMODEL_EXTRAPROPERTIES \ - CSQCMODEL_PROPERTY(1, float, ReadShort, WriteShort, colormap) \ - CSQCMODEL_PROPERTY(2, float, ReadInt24_t, WriteInt24_t, effects) \ - CSQCMODEL_PROPERTY(4, float, ReadByte, WriteByte, modelflags) \ + CSQCMODEL_PROPERTY(1, int, ReadShort, WriteShort, colormap) \ + CSQCMODEL_PROPERTY(2, int, ReadInt24_t, WriteInt24_t, effects) \ + CSQCMODEL_PROPERTY(4, int, ReadByte, WriteByte, modelflags) \ CSQCMODEL_PROPERTY_SCALED(8, float, ReadByte, WriteByte, alpha, 254, -1, 254) \ CSQCMODEL_PROPERTY(16, float, ReadByte, WriteByte, skin) \ CSQCMODEL_PROPERTY(32, float, ReadApproxPastTime, WriteApproxPastTime, death_time) \ diff --git a/qcsrc/common/nades.qh b/qcsrc/common/nades.qh index 1004e1eca..b87375808 100644 --- a/qcsrc/common/nades.qh +++ b/qcsrc/common/nades.qh @@ -1,29 +1,29 @@ // use slots 70-100 -const float PROJECTILE_NADE = 71; -const float PROJECTILE_NADE_BURN = 72; -const float PROJECTILE_NADE_NAPALM = 73; -const float PROJECTILE_NADE_NAPALM_BURN = 74; -const float PROJECTILE_NAPALM_FOUNTAIN = 75; -const float PROJECTILE_NADE_ICE = 76; -const float PROJECTILE_NADE_ICE_BURN = 77; -const float PROJECTILE_NADE_TRANSLOCATE = 78; -const float PROJECTILE_NADE_SPAWN = 79; -const float PROJECTILE_NADE_HEAL = 80; -const float PROJECTILE_NADE_HEAL_BURN = 81; -const float PROJECTILE_NADE_MONSTER = 82; -const float PROJECTILE_NADE_MONSTER_BURN = 83; +const int PROJECTILE_NADE = 71; +const int PROJECTILE_NADE_BURN = 72; +const int PROJECTILE_NADE_NAPALM = 73; +const int PROJECTILE_NADE_NAPALM_BURN = 74; +const int PROJECTILE_NAPALM_FOUNTAIN = 75; +const int PROJECTILE_NADE_ICE = 76; +const int PROJECTILE_NADE_ICE_BURN = 77; +const int PROJECTILE_NADE_TRANSLOCATE = 78; +const int PROJECTILE_NADE_SPAWN = 79; +const int PROJECTILE_NADE_HEAL = 80; +const int PROJECTILE_NADE_HEAL_BURN = 81; +const int PROJECTILE_NADE_MONSTER = 82; +const int PROJECTILE_NADE_MONSTER_BURN = 83; -const float NADE_TYPE_NORMAL = 1; -const float NADE_TYPE_NAPALM = 2; -const float NADE_TYPE_ICE = 3; -const float NADE_TYPE_TRANSLOCATE = 4; -const float NADE_TYPE_SPAWN = 5; -const float NADE_TYPE_HEAL = 6; -const float NADE_TYPE_MONSTER = 7; +const int NADE_TYPE_NORMAL = 1; +const int NADE_TYPE_NAPALM = 2; +const int NADE_TYPE_ICE = 3; +const int NADE_TYPE_TRANSLOCATE = 4; +const int NADE_TYPE_SPAWN = 5; +const int NADE_TYPE_HEAL = 6; +const int NADE_TYPE_MONSTER = 7; -const float NADE_TYPE_LAST = 7; // a check to prevent using higher values & crashing +const int NADE_TYPE_LAST = 7; // a check to prevent using higher values & crashing -vector Nade_Color(float nadeid) +vector Nade_Color(int nadeid) { switch(nadeid) { @@ -39,7 +39,7 @@ vector Nade_Color(float nadeid) return '0 0 0'; } -float Nade_IDFromProjectile(float proj) +int Nade_IDFromProjectile(float proj) { switch(proj) { @@ -60,7 +60,7 @@ float Nade_IDFromProjectile(float proj) return 0; } -float Nade_ProjectileFromID(float proj, float burn) +int Nade_ProjectileFromID(int proj, bool burn) { switch(proj) { diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 5e200afeb..7b3df7f77 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -248,10 +248,9 @@ string fstrunzone(string s) return sc; } -float fexists(string f) +bool fexists(string f) { - float fh; - fh = fopen(f, FILE_READ); + int fh = fopen(f, FILE_READ); if (fh < 0) return false; fclose(fh); @@ -1884,7 +1883,7 @@ string getcurrentmod() #ifndef MENUQC #ifdef CSQC -float ReadInt24_t() +int ReadInt24_t() { float v; v = ReadShort() * 256; // note: this is signed @@ -2780,7 +2779,7 @@ float Announcer_PickNumber(float type, float num) #endif #ifndef MENUQC -float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents) +int Mod_Q1BSP_SuperContentsFromNativeContents(int nativecontents) { switch(nativecontents) { @@ -2800,7 +2799,7 @@ float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents) return 0; } -float Mod_Q1BSP_NativeContentsFromSuperContents(int supercontents) +int Mod_Q1BSP_NativeContentsFromSuperContents(int supercontents) { if(supercontents & (DPCONTENTS_SOLID | DPCONTENTS_BODY)) return CONTENT_SOLID; diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 6cac5fa56..3d4e9b9e9 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -71,7 +71,7 @@ float median(float a, float b, float c); // works for up to 10 decimals! string ftos_decimals(float number, float decimals); -float fexists(string f); +bool fexists(string f); vector colormapPaletteColor(float c, float isPants); @@ -222,7 +222,7 @@ string getcurrentmod(); #ifndef MENUQC #ifdef CSQC -float ReadInt24_t(); +int ReadInt24_t(); vector ReadInt48_t(); vector ReadInt72_t(); #else @@ -262,7 +262,7 @@ float get_model_parameters_age; string get_model_parameters_description; string get_model_parameters_bone_upperbody; string get_model_parameters_bone_weapon; -const float MAX_AIM_BONES = 4; +const int MAX_AIM_BONES = 4; string get_model_parameters_bone_aim[MAX_AIM_BONES]; float get_model_parameters_bone_aimweight[MAX_AIM_BONES]; float get_model_parameters_fixbone; @@ -430,8 +430,8 @@ float Announcer_PickNumber(float type, float num); #endif #ifndef MENUQC -float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents); -float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents); +int Mod_Q1BSP_SuperContentsFromNativeContents(int nativecontents); +int Mod_Q1BSP_NativeContentsFromSuperContents(int supercontents); #endif // Quadratic splines (bezier) diff --git a/qcsrc/dpdefs/csprogsdefs.qc b/qcsrc/dpdefs/csprogsdefs.qc index 8a5031291..3fc4e61ae 100644 --- a/qcsrc/dpdefs/csprogsdefs.qc +++ b/qcsrc/dpdefs/csprogsdefs.qc @@ -48,7 +48,7 @@ void() CSQC_Init; void() CSQC_Shutdown; float(float f, float t, float n) CSQC_InputEvent; void(float w, float h) CSQC_UpdateView; -float(string s) CSQC_ConsoleCommand; +bool(string s) CSQC_ConsoleCommand; //these fields are read and set by the default player physics vector pmove_org; @@ -88,7 +88,7 @@ void end_sys_globals; // flag for structure dumping // // system fields (*** = do not set in prog code, maintained by C code) // -.float modelindex; // *** model index in the precached list +.int modelindex; // *** model index in the precached list .vector absmin, absmax; // *** origin + mins / maxs .int entnum; // *** the ent number as on the server @@ -106,8 +106,8 @@ void end_sys_globals; // flag for structure dumping .string classname; // spawn function .string model; -.float frame; -.float skin; +.int frame; +.int skin; .int effects; .vector mins, maxs; // bounding box extents reletive to origin @@ -419,7 +419,7 @@ entity(entity start, .float fld, float match) findfloat = #98; float(string s) checkextension = #99; // FrikaC and Telejano range #100-#199 -float(string filename, float mode) fopen = #110; +int(string filename, int mode) fopen = #110; void(float fhandle) fclose = #111; string(float fhandle) fgets = #112; void(float fhandle, string s) fputs = #113; @@ -479,12 +479,12 @@ void(void) drawresetcliparea = #325; float(vector position, string text, vector scale, float alpha, float flag) drawcolorcodedstring = #326; vector(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawcolorcodedstring2 = #326; -float(float stnum) getstatf = #330; -float(float stnum, ...) getstati = #331; // can optionally take first bit and count +float(int stnum) getstatf = #330; +int(int stnum, ...) getstati = #331; // can optionally take first bit and count string(float firststnum) getstats = #332; void(entity e, float mdlindex) setmodelindex = #333; string(float mdlindex) modelnameforindex = #334; -float(string effectname) particleeffectnum = #335; +int(string effectname) particleeffectnum = #335; void(entity ent, float effectnum, vector start, vector end) trailparticles = #336; //void(float effectnum, vector origin [, vector dir, float count]) pointparticles = #337; void(float effectnum, vector origin , vector dir, float count) pointparticles = #337; @@ -558,7 +558,7 @@ string(entity e, float s) getsurfacetexture = #437; float(entity e, vector p) getsurfacenearpoint = #438; vector(entity e, float s, vector p) getsurfaceclippedpoint = #439; -float(string s) tokenize = #441; +int(string s) tokenize = #441; string(float n) argv = #442; void(entity e, entity tagentity, string tagname) setattachment = #443; float(string pattern, float caseinsensitive, float quiet) search_begin = #444; @@ -568,7 +568,7 @@ string(float handle, float num) search_getfilename = #447; string(string s) cvar_string = #448; entity(entity start, .float fld, float match) findflags = #449; entity(.float fld, float match) findchainflags = #450; -float(entity ent, string tagname) gettagindex = #451; +int(entity ent, string tagname) gettagindex = #451; vector(entity ent, float tagindex) gettaginfo = #452; void(vector org, vector vel, float howmany) te_flamejet = #457; @@ -1017,7 +1017,7 @@ float GETTIME_CDTRACK = 4; //idea: Electro, SavageX, LordHavoc //darkplaces implementation: LordHavoc //builtin definitions: -float(string s, string separator1, ...) tokenizebyseparator = #479; +int(string s, string separator1, ...) tokenizebyseparator = #479; //description: //this function returns tokens separated by any of the supplied separator strings, example: //numnumbers = tokenizebyseparator("10.2.3.4", "."); @@ -1028,9 +1028,9 @@ float(string s, string separator1, ...) tokenizebyseparator = #479; //idea: divVerent //darkplaces implementation: divVerent //builtin definitions: -float(string s) tokenize_console = #514; -float(float i) argv_start_index = #515; -float(float i) argv_end_index = #516; +int(string s) tokenize_console = #514; +int(float i) argv_start_index = #515; +int(float i) argv_end_index = #516; //description: //this function returns tokens separated just like the console does //also, functions are provided to get the index of the first and last character of each token in the original string @@ -1229,10 +1229,10 @@ float(float modlindex, string framename) frameforname = #276; // finds number of float(float modlindex, float framenum) frameduration = #277; // returns the intended play time (in seconds) of the specified framegroup, if it does not exist the result is 0, if it is a single frame it may be a small value around 0.1 or 0. //fields: .float skeletonindex; // active skeleton overriding standard animation on model -.float frame; // primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4) -.float frame2; // secondary framegroup animation (strength = lerpfrac) -.float frame3; // tertiary framegroup animation (strength = lerpfrac3) -.float frame4; // quaternary framegroup animation (strength = lerpfrac4) +.int frame; // primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4) +.int frame2; // secondary framegroup animation (strength = lerpfrac) +.int frame3; // tertiary framegroup animation (strength = lerpfrac3) +.int frame4; // quaternary framegroup animation (strength = lerpfrac4) .float lerpfrac; // strength of framegroup blend .float lerpfrac3; // strength of framegroup blend .float lerpfrac4; // strength of framegroup blend @@ -1416,12 +1416,12 @@ float(string s) isfunction = #607; void(entity e, string s) parseentitydata = #608; // assorted builtins -const float STAT_MOVEVARS_TICRATE = 240; -const float STAT_MOVEVARS_TIMESCALE = 241; -const float STAT_FRAGLIMIT = 235; -const float STAT_TIMELIMIT = 236; -const float STAT_MOVEVARS_GRAVITY = 242; -string(void) ReadPicture = #501; +const int STAT_MOVEVARS_TICRATE = 240; +const int STAT_MOVEVARS_TIMESCALE = 241; +const int STAT_FRAGLIMIT = 235; +const int STAT_TIMELIMIT = 236; +const int STAT_MOVEVARS_GRAVITY = 242; +string(void) ReadPicture = #501; const int PARTICLES_USEALPHA = 1; float particles_alphamin, particles_alphamax; const int PARTICLES_USECOLOR = 2; diff --git a/qcsrc/dpdefs/dpextensions.qc b/qcsrc/dpdefs/dpextensions.qc index 6696d7c3a..a38746e59 100644 --- a/qcsrc/dpdefs/dpextensions.qc +++ b/qcsrc/dpdefs/dpextensions.qc @@ -2137,8 +2137,8 @@ float(float modlindex) skel_create = #263; // create a skeleton (be sure to assi float(float skel, entity ent, float modlindex, float retainfrac, float firstbone, float lastbone) skel_build = #264; // blend in a percentage of standard animation, 0 replaces entirely, 1 does nothing, 0.5 blends half, etc, and this only alters the bones in the specified range for which out of bounds values like 0,100000 are safe (uses .frame, .frame2, .frame3, .frame4, .lerpfrac, .lerpfrac3, .lerpfrac4, .frame1time, .frame2time, .frame3time, .frame4time), returns skel on success, 0 on failure float(float skel) skel_get_numbones = #265; // returns how many bones exist in the created skeleton, 0 if skeleton does not exist string(float skel, float bonenum) skel_get_bonename = #266; // returns name of bone (as a tempstring), "" if invalid bonenum (< 1 for example) or skeleton does not exist -float(float skel, float bonenum) skel_get_boneparent = #267; // returns parent num for supplied bonenum, 0 if bonenum has no parent or bone does not exist (returned value is always less than bonenum, you can loop on this) -float(float skel, string tagname) skel_find_bone = #268; // get number of bone with specified name, 0 on failure, bonenum (1-based) on success, same as using gettagindex but takes modelindex instead of entity +int(float skel, float bonenum) skel_get_boneparent = #267; // returns parent num for supplied bonenum, 0 if bonenum has no parent or bone does not exist (returned value is always less than bonenum, you can loop on this) +int(float skel, string tagname) skel_find_bone = #268; // get number of bone with specified name, 0 on failure, bonenum (1-based) on success, same as using gettagindex but takes modelindex instead of entity vector(float skel, float bonenum) skel_get_bonerel = #269; // get matrix of bone in skeleton relative to its parent - sets v_forward, v_right, v_up, returns origin (relative to parent bone) vector(float skel, float bonenum) skel_get_boneabs = #270; // get matrix of bone in skeleton in model space - sets v_forward, v_right, v_up, returns origin (relative to entity) void(float skel, float bonenum, vector org) skel_set_bone = #271; // set matrix of bone relative to its parent, reads v_forward, v_right, v_up, takes origin as parameter (relative to parent bone) -- 2.39.2