Use macros for labels
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 22 Mar 2016 08:15:50 +0000 (19:15 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 22 Mar 2016 08:15:50 +0000 (19:15 +1100)
17 files changed:
qcsrc/client/hud/hud_config.qc
qcsrc/client/scoreboard.qc
qcsrc/client/view.qc
qcsrc/common/command/rpn.qc
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/common/physics/player.qc
qcsrc/common/t_items.qc
qcsrc/lib/compiler.qh
qcsrc/lib/warpzone/common.qc
qcsrc/menu/item/nexposee.qc
qcsrc/menu/menu.qc
qcsrc/menu/xonotic/campaign.qc
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/waypoints.qc
qcsrc/server/ipban.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/sv_main.qc

index 8e69a2d..0716610 100644 (file)
@@ -774,7 +774,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                vector candidate_pos = '0 0 0';
                const float LEVELS_NUM = 4;
                float level_height = vid_conheight / LEVELS_NUM;
-:find_tab_panel
+LABEL(find_tab_panel)
                level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
                candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
                start_posX = tab_panel_pos.x;
index c49fa65..a41c91f 100644 (file)
@@ -410,7 +410,7 @@ void Cmd_HUD_SetFields(int argc)
                                        if(str == strtolower(scores_label[j]))
                                                goto found; // sorry, but otherwise fteqcc -O3 miscompiles this and warns about "unreachable code"
 
-:notfound
+LABEL(notfound)
                                if(str == "frags")
                                        j = SP_FRAGS;
                                else
@@ -419,7 +419,7 @@ void Cmd_HUD_SetFields(int argc)
                                                LOG_INFOF("^1Error:^7 Unknown score field: '%s'\n", str);
                                        continue;
                                }
-:found
+LABEL(found)
                                hud_field[hud_num_fields] = j;
                                if(j == ps_primary)
                                        have_primary = 1;
index 6e8487b..8d001cb 100644 (file)
@@ -994,7 +994,7 @@ void HUD_Crosshair()
                                wcross_color = rainbow_prev_color;
                                break;
                        }
-                       :normalcolor
+LABEL(normalcolor)
                        default: { wcross_color = stov(autocvar_crosshair_color); break; }
                }
 
index 1ca075b..12bb99d 100644 (file)
@@ -437,7 +437,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                                if(argv(i) == argv(j))
                                                                        goto skip_union;
                                                        s = strcat(s, " ", argv(i));
-                                                       :skip_union
+LABEL(skip_union)
                                                }
                                                if(substring(s, 0, 1) == " ")
                                                        s = substring(s, 1, 99999);
@@ -480,7 +480,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                                if(argv(i) == argv(j))
                                                                        goto skip_difference;
                                                        s = strcat(s, " ", argv(i));
-                                                       :skip_difference
+LABEL(skip_difference)
                                                }
                                                if(substring(s, 0, 1) == " ")
                                                        s = substring(s, 1, 99999);
index e6599e6..6c7eb4d 100644 (file)
@@ -367,7 +367,7 @@ void HUD_ItemsTime()
        id = it.m_id;
        icon = it.m_icon;
 
-       :iteration
+LABEL(iteration)
         float item_time = ItemsTime_time[id];
         if (item_time < -1)
         {
index 253010c..545d71a 100644 (file)
@@ -1532,7 +1532,7 @@ void PM_Main(entity this)
        else
                PM_air(this, buttons_prev, maxspeed_mod);
 
-:end
+LABEL(end)
        if (IS_ONGROUND(this))
                this.lastground = time;
 
index e2bafb8..a381324 100644 (file)
@@ -644,7 +644,7 @@ float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax
 
        return false;
 
-:YEAH
+LABEL(YEAH)
        switch(mode)
        {
                case ITEM_MODE_FUEL:
@@ -740,7 +740,7 @@ float Item_GiveTo(entity item, entity player)
                player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
        }
 
-:skip
+LABEL(skip)
 
        // always eat teamed entities
        if(item.team)
@@ -811,7 +811,7 @@ void Item_Touch()
                return;
        }
 
-       :pickup
+LABEL(pickup)
 
        other.last_pickup = time;
 
index 14824dc..7cd34bc 100644 (file)
@@ -11,3 +11,9 @@
                #define QCC_SUPPORT_NIL
        #endif
 #endif
+
+#ifdef GMQCC
+    #define LABEL(id) :id
+#else
+    #define LABEL(id) id:
+#endif
index e5cd151..7309ff7 100644 (file)
@@ -320,7 +320,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
                org = trace_endpos;
        }
        WarpZone_MakeAllOther();
-:fail
+LABEL(fail)
        if(contentshack)
                BITCLR_ASSIGN(WarpZone_trace_forent.dphitcontentsmask, DPCONTENTS_SOLID);
        trace_startsolid = sol;
@@ -438,7 +438,7 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
                e.velocity = -e.velocity;
        }
        WarpZone_MakeAllOther();
-:fail
+LABEL(fail)
        WarpZone_tracetoss_velocity = e.velocity;
        v_forward = vf;
        v_right = vr;
index 3e3575f..c0f18cf 100644 (file)
@@ -67,7 +67,7 @@
                        }
 
                        break;
-                       : have_overlap
+LABEL(have_overlap)
                }
 
                scale *= 0.95;
index 70c8aed..e523a51 100644 (file)
@@ -399,7 +399,7 @@ void drawBackground(string img, float a, string algn, float force1)
                        draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l + 1)), a);
                }
                ++l;
-               : nopic
+LABEL(nopic)
        }
 }
 
index b6dfc60..cb418a4 100644 (file)
@@ -37,11 +37,11 @@ void rewrapCampaign(float w, float l0, float emptyheight, vector theFontSize)
                        }
                }
                goto nottoolong;
-:toolong
+LABEL(toolong)
                while(substring(r, strlen(r) - 1, 1) == "\n")
                        r = substring(r, 0, strlen(r) - 1);
                r = strcat(r, "...\n");
-:nottoolong
+LABEL(nottoolong)
                campaign_longdesc_wrapped[i] = strzone(substring(r, 0, strlen(r) - 1));
        }
 }
index a2e1372..e83007d 100644 (file)
@@ -917,7 +917,7 @@ void havocbot_chooseenemy()
        while(true)
        {
                scan_secondary_targets = false;
-               :scan_targets
+LABEL(scan_targets)
                for( ; head; head = head.chain)
                {
                        if(!scan_secondary_targets)
index a19b2a0..0abc94a 100644 (file)
@@ -1109,7 +1109,7 @@ void botframe_deleteuselesswaypoints()
                                        goto next;
                                }
                        }
-:next
+LABEL(next)
                }
        }
        // d) The waypoint is a dead end. Dead end waypoints must be kept as
index deffa8e..d129d99 100644 (file)
@@ -192,7 +192,7 @@ void OnlineBanList_URI_Get_Callback(float id, float status, string data)
                LOG_INFO("Ban list syncing: accepted ban of ", ip, " by ", serverip, " at ", uri, ": ");
                LOG_INFO(reason, "\n");
 
-:skip
+LABEL(skip)
        }
 }
 
@@ -242,7 +242,7 @@ void OnlineBanList_Think()
                goto killme;
        return;
 
-:killme
+LABEL(killme)
        remove(self);
 }
 
@@ -380,7 +380,7 @@ float Ban_GetClientIP(entity client)
        ban_ip4 = strcat1(s); // 32
        return true;
 
-:ipv6
+LABEL(ipv6)
        i1 = strstrofs(s, ":", 0);
        if(i1 < 0)
                return false;
index 34ed909..d1316d2 100644 (file)
@@ -760,7 +760,7 @@ void kh_Key_Think()  // runs all the time
                        if(vlen(key.owner.origin - p) > autocvar_g_balance_keyhunt_maxdist)
                                goto not_winning;
                kh_WinnerTeam(self.team);
-:not_winning
+LABEL(not_winning)
        }
 
        if(kh_interferemsg_time && time > kh_interferemsg_time)
index ad1b458..4aa404d 100644 (file)
@@ -348,7 +348,7 @@ void SV_OnEntityPreSpawnFunction()
                        }
                }
                inv = !inv;
-:cvar_fail
+LABEL(cvar_fail)
                // now inv is 1 if we want to keep the item, and 0 if we want to get rid of it
                if (!inv)
                {