void LocalCommand_blurtest(int request)
{
+ TC(int, request);
// Simple command to work with postprocessing temporarily... possibly completely pointless, the glsl shader is used for a real feature now...
// Anyway, to enable it, just compile the client with -DBLURTEST and then you can use the command.
void LocalCommand_boxparticles(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_create_scrshot_ent(int request)
{
+ TC(int, request);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_debugmodel(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_handlevote(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_hud(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_localprint(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_mv_download(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_sendcvar(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
}
int CSQCPlayer_FallbackFrame(entity this, int f)
{
+ TC(int, f);
if(frameduration(this.modelindex, f) > 0)
return f; // goooooood
if(frameduration(this.modelindex, 1) <= 0)
float HUD_GetRowCount(int item_count, vector size, float item_aspect)
{
+ TC(int, item_count);
float aspect = size_y / size_x;
return bound(1, floor((sqrt(4 * item_aspect * aspect * item_count + aspect * aspect) + aspect + 0.5) / 2), item_count);
}
vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect)
{
+ TC(int, item_count);
float columns, rows;
float ratio, best_ratio = 0;
float best_columns = 1, best_rows = 1;
// return the string of the onscreen race timer
string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
{
+ TC(int, cp);
string col;
string timestr;
string cpname;
//basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag)
{
+ TC(bool, vertical); TC(int, drawflag);
if(!length_ratio || !theAlpha)
return;
if(length_ratio > 1)
void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag)
{
+ TC(int, drawflag);
if(!theAlpha)
return;
void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha, float fadelerp)
{
+ TC(bool, vertical); TC(bool, icon_right_align);
vector newPos = '0 0 0', newSize = '0 0 0';
vector picpos, numpos;
void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha)
{
+ TC(bool, vertical); TC(bool, icon_right_align);
DrawNumIcon_expanding(myPos, mySize, x, icon, vertical, icon_right_align, color, theAlpha, 0);
}
bool HUD_Panel_CheckFlags(int showflags)
{
+ TC(int, showflags);
if ( HUD_Minigame_Showpanels() )
return showflags & PANEL_SHOW_MINIGAME;
if(intermission == 2)
void HUD_Panel_FirstInDrawQ(float id);
void reset_tab_panels()
{
- int i;
- for(i = 0; i < hud_panels_COUNT; ++i)
+ for (int i = 0; i < hud_panels_COUNT; ++i)
tab_panels[i] = world;
}
float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
void DrawAmmoItem(vector myPos, vector mySize, .int ammoType, bool isCurrent, bool isInfinite)
{
+ TC(bool, isCurrent); TC(bool, isInfinite);
if(ammoType == ammo_none)
return;
void centerprint_generic(int new_id, string strMessage, float duration, int countdown_num)
{
+ TC(int, new_id); TC(int, countdown_num);
//printf("centerprint_generic(%d, '%s^7', %d, %d);\n", new_id, strMessage, duration, countdown_num);
int i, j;
centerprint_countdown_num[j] = countdown_num;
}
-void centerprint_kill(float id)
+void centerprint_kill(int id)
{
+ TC(int, id);
centerprint_generic(id, "", 0, 0);
}
void reset_centerprint_messages()
{
- int i;
- for (i=0; i<CENTERPRINT_MAX_MSGS; ++i)
+ for (int i=0; i<CENTERPRINT_MAX_MSGS; ++i)
{
centerprint_expire_time[i] = 0;
centerprint_time[i] = 1;
void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, int layout, int i)
{
+ TC(int, layout); TC(int, i);
int stat = -1;
string pic = "";
vector color = '0 0 0';
void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, int layout, int i)
{
+ TC(int, layout); TC(int, i);
float stat = -1;
string pic = "";
vector color = '0 0 0';
int getPowerupItemAlign(int align, int column, int row, int columns, int rows, bool isVertical)
{
+ TC(int, align); TC(int, column); TC(int, row); TC(int, columns); TC(int, rows); TC(bool, isVertical);
if(align < 2)
return align;
void HUD_Radar_Show_Maximized(bool doshow,float clickable)
{
+ TC(bool, doshow);
hud_panel_radar_maximized = doshow;
hud_panel_radar_temp_hidden = 0;
}
-float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary)
+float HUD_Radar_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
+ TC(int, bInputType);
if(!hud_panel_radar_maximized || !hud_panel_radar_mouse ||
autocvar__hud_configure || mv_active)
return false;
entity weaponorder[Weapons_MAX];
void weaponorder_swap(int i, int j, entity pass)
{
+ TC(int, i); TC(int, j);
entity h = weaponorder[i];
weaponorder[i] = weaponorder[j];
weaponorder[j] = h;
string weaponorder_cmp_str;
int weaponorder_cmp(int i, int j, entity pass)
{
+ TC(int, i); TC(int, j);
int ai = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[i].m_id), 0);
int aj = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[j].m_id), 0);
return aj - ai; // the string is in REVERSE order (higher prio at the right is what we want, but higher prio first is the string)
.float has_team;
float SetTeam(entity o, int Team)
{
+ TC(int, Team);
devassert_once(Team);
entity tm;
if(teamplay)
// In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
// In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
// In the case of mouse input after a setcursormode(1) call, nPrimary is xpos, nSecondary is ypos.
-float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
+float CSQC_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
+ TC(int, bInputType);
if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
return true;
string MapVote_FormatMapItem(int id, string map, float _count, float maxwidth, vector fontsize)
{
+ TC(int, id);
string pre, post;
pre = sprintf("%d. ", id+1);
if(mv_detail)
vector MapVote_RGB(int id)
{
+ TC(int, id);
if(!(mv_flags[id] & GTV_AVAILABLE))
return '1 1 1';
if(id == mv_ownvote)
void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float _count, int id)
{
+ TC(int, id);
// Find the correct alpha
float alpha;
if(!(mv_flags_start[id] & GTV_AVAILABLE))
void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float _count, int id)
{
+ TC(int, id);
vector img_size = '0 0 0';
string label;
float text_size;
void MapVote_DrawAbstain(vector pos, float isize, float tsize, float _count, int id)
{
+ TC(int, id);
vector rgb;
float text_size;
string label;
vector MapVote_GridVec(vector gridspec, int i, int m)
{
+ TC(int, i); TC(int, m);
int r = i % m;
return
'1 0 0' * (gridspec.x * r)
draw_cursor_normal(mv_mousepos, '1 1 1', 1 - autocvar__menu_alpha);
}
-void Cmd_MapVote_MapDownload(float argc)
+void Cmd_MapVote_MapDownload(int argc)
{
+ TC(int, argc);
entity pak;
if(argc != 2 || !mv_pk3list)
void MapVote_CheckPK3(string pic, string pk3, int id)
{
+ TC(int, id);
entity pak;
pak = spawn();
pak.netname = pk3;
void MapVote_CheckPic(string pic, string pk3, int id)
{
+ TC(int, id);
// never try to retrieve a pic for the "don't care" 'map'
if(mv_abstain && id == mv_num_maps - 1)
return;
void MapVote_ReadOption(int i)
{
+ TC(int, i);
string map = strzone(ReadString());
string pk3 = strzone(ReadString());
int j = bound(0, ReadByte(), n_ssdirs - 1);
void GameTypeVote_ReadOption(int i)
{
+ TC(int, i);
string gt = strzone(ReadString());
mv_maps[i] = gt;
n_ssdirs = 0;
}
-void MapVote_SendChoice(float index)
+void MapVote_SendChoice(int index)
{
+ TC(int, index);
localcmd(strcat("\nimpulse ", ftos(index+1), "\n"));
}
int MapVote_MoveLeft(int pos)
{
+ TC(int, pos);
int imp;
if ( pos < 0 )
imp = mv_num_maps - 1;
}
int MapVote_MoveRight(int pos)
{
+ TC(int, pos);
int imp;
if ( pos < 0 )
imp = 0;
}
int MapVote_MoveUp(int pos)
{
+ TC(int, pos);
int imp;
if ( pos < 0 )
imp = mv_num_maps - 1;
}
int MapVote_MoveDown(int pos)
{
+ TC(int, pos);
int imp;
if ( pos < 0 )
imp = 0;
return imp;
}
-float MapVote_InputEvent(float bInputType, float nPrimary, float nSecondary)
+float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
+ TC(int, bInputType);
float imp;
if (!mv_active)
entity GetTeam(int Team, bool add)
{
+ TC(int, Team); TC(bool, add);
int num = (Team == NUM_SPECTATOR) ? 16 : Team;
if(teamslots[num])
return teamslots[num];
// decolorizes and team colors the player name when needed
string playername(string thename, float teamid)
{
+ TC(int, teamid);
string t;
if (teamplay)
{
}
/** engine callback */
-void URI_Get_Callback(int id, float status, string data)
+void URI_Get_Callback(int id, int status, string data)
{
+ TC(int, id); TC(int, status);
if(url_URI_Get_Callback(id, status, data))
{
// handled
}
}
-void skel_set_boneabs(float s, float bone, vector absorg)
+void skel_set_boneabs(float s, int bone, vector absorg)
{
+ TC(int, bone);
vector absang = fixedvectoangles2(v_forward, v_up);
vector parentorg = skel_get_boneabs(s, skel_get_boneparent(s, bone));
}
}
-void skeleton_from_frames(entity e, float is_dead)
+void skeleton_from_frames(entity e, bool is_dead)
{SELFPARAM();
+ TC(bool, is_dead);
float m = e.modelindex;
if(!e.skeletonindex)
{
// if s1 is not empty s will be displayed as command otherwise as submenu
void QuickMenu_Page_LoadEntry(int i, string s, string s1)
{
+ TC(int, i);
//printf("^xc80 entry %d: %s, %s\n", i, s, s1);
if (QuickMenu_Page_Description[i])
strunzone(QuickMenu_Page_Description[i]);
void QuickMenu_Page_ClearEntry(int i)
{
+ TC(int, i);
if (QuickMenu_Page_Description[i])
strunzone(QuickMenu_Page_Description[i]);
QuickMenu_Page_Description[i] = string_null;
return (QuickMenu_Page_Entries > 0);
}
-void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, float without_me);
-bool HUD_Quickmenu_PlayerListEntries_Create(string cmd, int teamplayers, float without_me)
+void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me);
+bool HUD_Quickmenu_PlayerListEntries_Create(string cmd, int teamplayers, bool without_me)
{
+ TC(int, teamplayers); TC(bool, without_me);
int i;
for(i = 0; i < QUICKMENU_MAXLINES; ++i)
QuickMenu_Page_ClearEntry(i);
// new_page 0 means page 0, new_page != 0 means next page
int QuickMenu_Buffer_Index_Prev;
-bool QuickMenu_Page_Load(string target_submenu, int new_page)
+bool QuickMenu_Page_Load(string target_submenu, bool new_page)
{
+ TC(bool, new_page);
string s = string_null, cmd = string_null, z_submenu;
if (new_page == 0)
bool QuickMenu_ActionForNumber(int num)
{
+ TC(int, num);
if (!QuickMenu_IsLastPage)
{
if (num < 0 || num >= QUICKMENU_MAXLINES)
return false;
}
-void QuickMenu_Page_ActiveEntry(float entry_num)
+void QuickMenu_Page_ActiveEntry(int entry_num)
{
+ TC(int, entry_num);
QuickMenu_Page_ActivatedEntry = entry_num;
QuickMenu_Page_ActivatedEntry_Time = time + 0.1;
if(QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
QuickMenu_Page_ActivatedEntry_Close = (!(hudShiftState & S_CTRL));
}
-bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary)
+bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
+ TC(int, bInputType);
// we only care for keyboard events
if(bInputType == 2)
return false;
QUICKMENU_ENTRY(strcat("(", prvm_language, ")", title), sprintf(command, translated_text)) \
}
-void HUD_Quickmenu_PlayerListEntries(string cmd, float teamplayers, float without_me)
+void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me)
{
+ TC(int, teamplayers); TC(bool, without_me);
entity pl;
if(teamplayers && !team_count)
return;
*/
}
-int HUD_CompareScore(float vl, float vr, int f)
+int HUD_CompareScore(int vl, int vr, int f)
{
+ TC(int, vl); TC(int, vr); TC(int, f);
if(f & SFL_ZERO_IS_WORST)
{
if(vl == 0 && vr != 0)
"+as/objectives +nb/faults +nb/goals +ka/pickups +ka/bckills +ka/bctime +ft/revivals " \
"-lms,rc,nb/score"
-void Cmd_HUD_SetFields(float argc)
+void Cmd_HUD_SetFields(int argc)
{
+ TC(int, argc);
int i, j, slash;
string str, pattern;
float have_name = 0, have_primary = 0, have_secondary = 0, have_separator = 0;
float hud_field_icon2_alpha;
string HUD_GetField(entity pl, int field)
{
+ TC(int, field);
float tmp, num, denom;
int f;
string str;
string HUD_FixScoreboardColumnWidth(int i, string str)
{
+ TC(int, i);
float field, f;
vector sz;
field = hud_field[i];
return str;
}
-void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_self, int pl_number)
+void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, bool is_self, int pl_number)
{
+ TC(bool, is_self); TC(int, pl_number);
vector tmp, rgb;
rgb = Team_ColorRGB(pl.team);
string str;
void draw_teamradar_link(vector start, vector end, int colors)
{
+ TC(int, colors);
vector c0, c1, norm;
start = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(start));
void WaypointSprite_Load();
void CSQC_UpdateView(float w, float h)
{SELFPARAM();
+ TC(int, w); TC(int, h);
entity e;
float fov;
float f;
void loopsound(entity e, int ch, string samp, float vol, float attn)
{
+ TC(int, ch);
if (e.silent)
return;
#define _MUTATOR_HANDLE_NOP(type, id)
#define _MUTATOR_HANDLE_PARAMS(type, id) , type in_##id
#define _MUTATOR_HANDLE_PREPARE(type, id) id = in_##id;
-#define _MUTATOR_HANDLE_PUSHTMP(type, id) type tmp_##id = id;
+#define _MUTATOR_HANDLE_PUSHTMP(type, id) TC(type, id); type tmp_##id = id;
#define _MUTATOR_HANDLE_PUSHOUT(type, id) type out_##id = id;
#define _MUTATOR_HANDLE_POPTMP(type, id) id = tmp_##id;
#define _MUTATOR_HANDLE_POPOUT(type, id) id = out_##id;
#include "macro.qh"
-#ifndef NDEBUG
+#if NDEBUG
+ #define TC(T, sym) MACRO_BEGIN MACRO_END
+#else
#define TC(T, sym) MACRO_BEGIN \
if (!is_##T(sym)) LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
MACRO_END
-#else
- #define TC(T, sym) MACRO_BEGIN MACRO_END
#endif
-bool is_int(float f) { return f == f | 0; }
-bool is_bool(float f) { return f == true || f == false; }
+bool is_float (float this) { return true; }
+bool is_vector(vector this) { return true; }
+bool is_string(string this) { return true; }
+bool is_entity(entity this) { return true; }
+bool is_int (float this) { return this == floor(this); }
+bool is_bool (float this) { return this == true || this == false; }
#include "warpzone/mathlib.qc"
#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
#define IS_CLIENT(v) (v.flags & FL_CLIENT)
-#define is_client IS_CLIENT
+#define is_Client IS_CLIENT
#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
#define IS_NOT_A_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)