From: TimePath Date: Sun, 25 Jan 2015 01:19:14 +0000 (+1100) Subject: Declare more ints as ints X-Git-Tag: xonotic-v0.8.1~133^2~38 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=df803373fe80398fd65a1516712ea0338b366740;p=xonotic%2Fxonotic-data.pk3dir.git Declare more ints as ints --- diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index 791508e52..d36e7d869 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -217,11 +217,9 @@ void HUD_Configure_Exit_Force() // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector vector HUD_Panel_CheckMove(vector myPos, vector mySize) { - float i; float myCenter_x, myCenter_y, targCenter_x, targCenter_y; - vector myTarget; - myTarget = myPos; - + vector myTarget = myPos; + int i; for (i = 0; i < HUD_PANEL_NUM; ++i) { panel = hud_panel[i]; if(panel == highlightedPanel) continue; @@ -625,11 +623,11 @@ void HUD_Panel_Arrow_Action(float nPrimary) } } -const float S_MOUSE1 = 1; -const float S_MOUSE2 = 2; -const float S_MOUSE3 = 4; -float mouseClicked; -float prevMouseClicked; // previous state +const int S_MOUSE1 = 1; +const int S_MOUSE2 = 2; +const int S_MOUSE3 = 4; +int mouseClicked; +int prevMouseClicked; // previous state float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks @@ -964,8 +962,8 @@ float HUD_Panel_Check_Mouse_Pos(float allow_move) // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else) void HUD_Panel_FirstInDrawQ(float id) { - float i; - var float place = -1; + int i; + int place = -1; // find out where in the array our current id is, save into place for(i = 0; i < HUD_PANEL_NUM; ++i) { diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index 743793bad..eae512af5 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -20,12 +20,9 @@ string GetProgramCommandPrefix(void) // used by curl command void Curl_URI_Get_Callback(float id, float status, string data) { - float i; - float do_exec; - string do_cvar; - i = id - URI_GET_CURL; - do_exec = curl_uri_get_exec[i]; - do_cvar = curl_uri_get_cvar[i]; + int i = id - URI_GET_CURL; + float do_exec = curl_uri_get_exec[i]; + string do_cvar = curl_uri_get_cvar[i]; if(status != 0) { dprintf("error: status is %d\n", status); @@ -56,8 +53,6 @@ void GenericCommand_addtolist(float request, float argc) { case CMD_REQUEST_COMMAND: { - float i; - if(argc >= 2) { string original_cvar = argv(1); @@ -70,7 +65,7 @@ void GenericCommand_addtolist(float request, float argc) else // add it to the end of the list if the list doesn't already have it { argc = tokenizebyseparator(cvar_string(original_cvar), " "); - + int i; for(i = 0; i < argc; ++i) if(argv(i) == tmp_string) return; // already in list @@ -99,18 +94,10 @@ void GenericCommand_qc_curl(float request, float argc) { case CMD_REQUEST_COMMAND: { - float do_exec; - string do_cvar; - float key; - float i, j; - string url; - float buf; - float r; - - do_exec = FALSE; - do_cvar = string_null; - key = -1; - + bool do_exec = FALSE; + string do_cvar = string_null; + float key = -1; + int i; for(i = 1; i+1 < argc; ++i) { if(argv(i) == "--cvar" && i+2 < argc) @@ -135,15 +122,16 @@ void GenericCommand_qc_curl(float request, float argc) // now, argv(i) is the URL // following args may be POST parameters - url = argv(i); + string url = argv(i); ++i; - buf = buf_create(); - j = 0; - for(; i+1 < argc; i += 2) + float buf = buf_create(); + int j; + for(j = 0; i+1 < argc; i += 2) bufstr_set(buf, ++j, sprintf("%s=%s", uri_escape(argv(i)), uri_escape(argv(i+1)))); if(i < argc) bufstr_set(buf, ++j, sprintf("submit=%s", uri_escape(argv(i)))); + float r; if(j == 0) // no args: GET r = crypto_uri_postbuf(url, URI_GET_CURL + curl_uri_get_pos, string_null, string_null, -1, key); else // with args: POST diff --git a/qcsrc/common/command/markup.qc b/qcsrc/common/command/markup.qc index d1562aaac..1c80018ba 100644 --- a/qcsrc/common/command/markup.qc +++ b/qcsrc/common/command/markup.qc @@ -5,11 +5,10 @@ void GenericCommand_markup_init() { - float i; if (markup_init) return; - markup_init = 1; - i = 0; + markup_init = true; + int i = 0; markup_from[i] = "&alien"; markup_to[i] = "\x12"; ++i; markup_from[i] = "&:-)"; markup_to[i] = "\x13"; ++i; markup_from[i] = "&:-("; markup_to[i] = "\x14"; ++i; @@ -56,7 +55,7 @@ void GenericCommand_markup_init() string GenericCommand_markup(string s2) { - float red, ccase, i, j; + int red, ccase, i, j; string s, s3; GenericCommand_markup_init(); diff --git a/qcsrc/common/command/markup.qh b/qcsrc/common/command/markup.qh index 4193691b5..cf72f850e 100644 --- a/qcsrc/common/command/markup.qh +++ b/qcsrc/common/command/markup.qh @@ -3,7 +3,7 @@ // Last updated: December 28th, 2011 // ========================================================== -const float NUM_MARKUPS = 41; -float markup_init; +const int NUM_MARKUPS = 41; +bool markup_init; string markup_from[NUM_MARKUPS]; string markup_to[NUM_MARKUPS]; diff --git a/qcsrc/common/command/rpn.qh b/qcsrc/common/command/rpn.qh index d182264c4..5f6856c3a 100644 --- a/qcsrc/common/command/rpn.qh +++ b/qcsrc/common/command/rpn.qh @@ -4,7 +4,7 @@ // ========================================================= const float MAX_RPN_STACK = 16; -float rpn_db; -float rpn_error; -float rpn_sp; +int rpn_db; +int rpn_error; +int rpn_sp; string rpn_stack[MAX_RPN_STACK]; diff --git a/qcsrc/common/deathtypes.qh b/qcsrc/common/deathtypes.qh index c8512cdcf..e5e87c65f 100644 --- a/qcsrc/common/deathtypes.qh +++ b/qcsrc/common/deathtypes.qh @@ -67,15 +67,15 @@ #define DT_FIRST 10000 #define DT_MAX 128 // limit of recursive functions with ACCUMULATE_FUNCTION -float DT_COUNT; +int DT_COUNT; entity deathtypes[DT_MAX]; .entity death_msgself; .entity death_msgmurder; #define DEATHTYPE(name,msg_death,msg_death_by,position) \ - float name; \ - float position; \ + int name; \ + int position; \ void RegisterDeathtype_##name() \ { \ SET_FIRST_OR_LAST(position, DT_FIRST, DT_COUNT) \ @@ -116,10 +116,10 @@ string Deathtype_Name(float deathtype) else { return ftos(deathtype); } } -const float DEATH_WEAPONMASK = 0xFF; -const float DEATH_HITTYPEMASK = 0x1F00; // which is WAY below 10000 used for normal deaths -const float HITTYPE_SECONDARY = 0x100; -const float HITTYPE_SPLASH = 0x200; // automatically set by RadiusDamage -const float HITTYPE_BOUNCE = 0x400; -const float HITTYPE_RESERVED2 = 0x800; -const float HITTYPE_RESERVED = 0x1000; // unused yet +const int DEATH_WEAPONMASK = 0xFF; +const int DEATH_HITTYPEMASK = 0x1F00; // which is WAY below 10000 used for normal deaths +const int HITTYPE_SECONDARY = 0x100; +const int HITTYPE_SPLASH = 0x200; // automatically set by RadiusDamage +const int HITTYPE_BOUNCE = 0x400; +const int HITTYPE_RESERVED2 = 0x800; +const int HITTYPE_RESERVED = 0x1000; // unused yet diff --git a/qcsrc/common/monsters/monsters.qh b/qcsrc/common/monsters/monsters.qh index 4966d9518..18d06ada4 100644 --- a/qcsrc/common/monsters/monsters.qh +++ b/qcsrc/common/monsters/monsters.qh @@ -1,20 +1,20 @@ // monster requests -const float MR_SETUP = 1; // (SERVER) setup monster data -const float MR_THINK = 2; // (SERVER) logic to run every frame -const float MR_DEATH = 3; // (SERVER) called when monster dies -const float MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this monster +const int MR_SETUP = 1; // (SERVER) setup monster data +const int MR_THINK = 2; // (SERVER) logic to run every frame +const int MR_DEATH = 3; // (SERVER) called when monster dies +const int MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this monster // functions: entity get_monsterinfo(float id); // special spawn flags -const float MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died -const float MONSTER_TYPE_FLY = 32; -const float MONSTER_TYPE_SWIM = 64; -const float MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced -const float MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster -const float MON_FLAG_RANGED = 512; // monster shoots projectiles -const float MON_FLAG_MELEE = 1024; +const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died +const int MONSTER_TYPE_FLY = 32; +const int MONSTER_TYPE_SWIM = 64; +const int MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced +const int MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster +const int MON_FLAG_RANGED = 512; // monster shoots projectiles +const int MON_FLAG_MELEE = 1024; // entity properties of monsterinfo: .float monsterid; // MON_... @@ -38,13 +38,13 @@ float m_null(float dummy); void register_monster(float id, float(float) func, float monsterflags, vector min_s, vector max_s, string modelname, string shortname, string mname); void register_monsters_done(); -const float MON_MAXCOUNT = 24; -const float MON_FIRST = 1; -float MON_COUNT; -float MON_LAST; +const int MON_MAXCOUNT = 24; +const int MON_FIRST = 1; +int MON_COUNT; +int MON_LAST; #define REGISTER_MONSTER_2(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \ - float id; \ + int id; \ float func(float); \ void RegisterMonsters_##id() \ { \ diff --git a/qcsrc/server/t_items.qh b/qcsrc/server/t_items.qh index 9db934196..26aa170b3 100644 --- a/qcsrc/server/t_items.qh +++ b/qcsrc/server/t_items.qh @@ -1,65 +1,65 @@ // constants #define WANT_CONST /* we WANT these to be constant, but it conflicts with the declaration in dpdefs/progsdefs.qc */ -const float IT_UNLIMITED_WEAPON_AMMO = 1; // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup. -const float IT_UNLIMITED_SUPERWEAPONS = 2; // when this bit is set, superweapons don't expire. Checkpoints can give this powerup. -const float IT_CTF_SHIELDED = 4; // set for the flag shield -const float IT_USING_JETPACK = 8; // confirmation that button is pressed -const float IT_JETPACK = 16; // actual item -const float IT_FUEL_REGEN = 32; // fuel regeneration trigger +const int IT_UNLIMITED_WEAPON_AMMO = 1; // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup. +const int IT_UNLIMITED_SUPERWEAPONS = 2; // when this bit is set, superweapons don't expire. Checkpoints can give this powerup. +const int IT_CTF_SHIELDED = 4; // set for the flag shield +const int IT_USING_JETPACK = 8; // confirmation that button is pressed +const int IT_JETPACK = 16; // actual item +const int IT_FUEL_REGEN = 32; // fuel regeneration trigger // where is 64... ? -const float IT_FUEL = 128; -WANT_CONST float IT_SHELLS = 256; -WANT_CONST float IT_NAILS = 512; -WANT_CONST float IT_ROCKETS = 1024; -WANT_CONST float IT_CELLS = 2048; -const float IT_SUPERWEAPON = 4096; -const float IT_STRENGTH = 8192; -const float IT_INVINCIBLE = 16384; -const float IT_HEALTH = 32768; -const float IT_PLASMA = 65536; +const int IT_FUEL = 128; +WANT_CONST int IT_SHELLS = 256; +WANT_CONST int IT_NAILS = 512; +WANT_CONST int IT_ROCKETS = 1024; +WANT_CONST int IT_CELLS = 2048; +const int IT_SUPERWEAPON = 4096; +const int IT_STRENGTH = 8192; +const int IT_INVINCIBLE = 16384; +const int IT_HEALTH = 32768; +const int IT_PLASMA = 65536; // shared value space (union): // for items: - WANT_CONST float IT_KEY1 = 131072; - WANT_CONST float IT_KEY2 = 262144; + WANT_CONST int IT_KEY1 = 131072; + WANT_CONST int IT_KEY2 = 262144; // for players: - const float IT_RED_FLAG_TAKEN = 32768; - const float IT_RED_FLAG_LOST = 65536; - const float IT_RED_FLAG_CARRYING = 98304; - const float IT_BLUE_FLAG_TAKEN = 131072; - const float IT_BLUE_FLAG_LOST = 262144; - const float IT_BLUE_FLAG_CARRYING = 393216; + const int IT_RED_FLAG_TAKEN = 32768; + const int IT_RED_FLAG_LOST = 65536; + const int IT_RED_FLAG_CARRYING = 98304; + const int IT_BLUE_FLAG_TAKEN = 131072; + const int IT_BLUE_FLAG_LOST = 262144; + const int IT_BLUE_FLAG_CARRYING = 393216; // end -const float IT_5HP = 524288; -const float IT_25HP = 1048576; -const float IT_ARMOR_SHARD = 2097152; -const float IT_ARMOR = 4194304; +const int IT_5HP = 524288; +const int IT_25HP = 1048576; +const int IT_ARMOR_SHARD = 2097152; +const int IT_ARMOR = 4194304; // item masks -const float IT_AMMO = 3968; // IT_FUEL | IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_PLASMA; -const float IT_PICKUPMASK = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately -const float IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO; +const int IT_AMMO = 3968; // IT_FUEL | IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_PLASMA; +const int IT_PICKUPMASK = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately +const int IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO; -const float AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel +const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel // item networking -const float ISF_LOCATION = 2; -const float ISF_MODEL = 4; -const float ISF_STATUS = 8; - const float ITS_STAYWEP = 1; - const float ITS_ANIMATE1 = 2; - const float ITS_ANIMATE2 = 4; - const float ITS_AVAILABLE = 8; - const float ITS_ALLOWFB = 16; - const float ITS_ALLOWSI = 32; - const float ITS_POWERUP = 64; -const float ISF_COLORMAP = 16; -const float ISF_DROP = 32; -const float ISF_ANGLES = 64; -const float ISF_SIZE = 128; - -.float ItemStatus; +const int ISF_LOCATION = 2; +const int ISF_MODEL = 4; +const int ISF_STATUS = 8; + const int ITS_STAYWEP = 1; + const int ITS_ANIMATE1 = 2; + const int ITS_ANIMATE2 = 4; + const int ITS_AVAILABLE = 8; + const int ITS_ALLOWFB = 16; + const int ITS_ALLOWSI = 32; + const int ITS_POWERUP = 64; +const int ISF_COLORMAP = 16; +const int ISF_DROP = 32; +const int ISF_ANGLES = 64; +const int ISF_SIZE = 128; + +.int ItemStatus; #ifdef CSQC diff --git a/qcsrc/server/tturrets/include/turrets_early.qh b/qcsrc/server/tturrets/include/turrets_early.qh index c13e45137..77d7cda9d 100644 --- a/qcsrc/server/tturrets/include/turrets_early.qh +++ b/qcsrc/server/tturrets/include/turrets_early.qh @@ -441,32 +441,32 @@ void turrets_precash(); #endif // SVQC // common -.float turret_type; -const float TID_COMMON = 1; -const float TID_EWHEEL = 2; -const float TID_FLAC = 3; -const float TID_FUSION = 4; -const float TID_HELLION = 5; -const float TID_HK = 6; -const float TID_MACHINEGUN = 7; -const float TID_MLRS = 8; -const float TID_PHASER = 9; -const float TID_PLASMA = 10; -const float TID_PLASMA_DUAL = 11; -const float TID_TESLA = 12; -const float TID_WALKER = 13; -const float TID_LAST = 13; - -const float TNSF_UPDATE = 2; -const float TNSF_STATUS = 4; -const float TNSF_SETUP = 8; -const float TNSF_ANG = 16; -const float TNSF_AVEL = 32; -const float TNSF_MOVE = 64; +.int turret_type; +const int TID_COMMON = 1; +const int TID_EWHEEL = 2; +const int TID_FLAC = 3; +const int TID_FUSION = 4; +const int TID_HELLION = 5; +const int TID_HK = 6; +const int TID_MACHINEGUN = 7; +const int TID_MLRS = 8; +const int TID_PHASER = 9; +const int TID_PLASMA = 10; +const int TID_PLASMA_DUAL = 11; +const int TID_TESLA = 12; +const int TID_WALKER = 13; +const int TID_LAST = 13; + +const int TNSF_UPDATE = 2; +const int TNSF_STATUS = 4; +const int TNSF_SETUP = 8; +const int TNSF_ANG = 16; +const int TNSF_AVEL = 32; +const int TNSF_MOVE = 64; .float anim_start_time; -const float TNSF_ANIM = 128; +const int TNSF_ANIM = 128; -const float TNSF_FULL_UPDATE = 16777215; +const int TNSF_FULL_UPDATE = 16777215; #endif // TTURRETS_ENABLED diff --git a/qcsrc/warpzonelib/common.qc b/qcsrc/warpzonelib/common.qc index 6db41d133..c1b3614c1 100644 --- a/qcsrc/warpzonelib/common.qc +++ b/qcsrc/warpzonelib/common.qc @@ -1,4 +1,4 @@ -float trace_dphitcontents; +int trace_dphitcontents; .float dphitcontentsmask; void WarpZone_Accumulator_Clear(entity acc) @@ -469,7 +469,7 @@ void WarpZone_TrailParticles_WithMultiplier_trace_callback(vector from, vector e boxparticles(WarpZone_TrailParticles_trace_callback_eff, WarpZone_TrailParticles_trace_callback_own, from, endpos, WarpZone_TrailParticles_trace_callback_own.velocity, WarpZone_TrailParticles_trace_callback_own.velocity, WarpZone_TrailParticles_trace_callback_f, WarpZone_TrailParticles_trace_callback_flags); } -void WarpZone_TrailParticles_WithMultiplier(entity own, float eff, vector org, vector end, float f, float boxflags) +void WarpZone_TrailParticles_WithMultiplier(entity own, float eff, vector org, vector end, float f, int boxflags) { WarpZone_TrailParticles_trace_callback_own = own; WarpZone_TrailParticles_trace_callback_eff = eff;