From: TimePath Date: Thu, 29 Jan 2015 03:07:19 +0000 (+1100) Subject: Clean up CSQC #includes X-Git-Tag: xonotic-v0.8.1~133^2~17 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d3a7bb2616410f0252504af2a84e11fb4dac21a3;p=xonotic%2Fxonotic-data.pk3dir.git Clean up CSQC #includes --- diff --git a/qcsrc/client/casings.qc b/qcsrc/client/casings.qc index bee5b540b..b7693efbb 100644 --- a/qcsrc/client/casings.qc +++ b/qcsrc/client/casings.qc @@ -1,13 +1,11 @@ #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../common/util.qh" - #include "autocvars.qh" #include "movetypes.qh" #include "prandom.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" + #include "rubble.qh" + + .float cnt; + .float alpha; + .float state; #elif defined(MENUQC) #elif defined(SVQC) #endif diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index 8658ae2cd..7b74d2dd7 100644 --- a/qcsrc/client/command/cl_cmd.qc +++ b/qcsrc/client/command/cl_cmd.qc @@ -3,19 +3,8 @@ // Last updated: December 28th, 2011 // ============================================== -#if defined(CSQC) - #include "../../dpdefs/csprogsdefs.qh" - #include "../defs.qh" - #include "../../common/util.qh" - #include "../../common/mapinfo.qh" - #include "../../common/command/shared_defs.qh" - #include "cl_cmd.qh" - #include "../autocvars.qh" - #include "../hud.qh" - #include "../main.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif +#include "../../common/command/generic.qh" +#include "../../common/command/shared_defs.qh" void DrawDebugModel() { diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 1bdaaf114..d139f589c 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -1,20 +1,22 @@ #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../warpzonelib/mathlib.qh" - #include "../common/teams.qh" - #include "../common/util.qh" + #include "gibs.qh" + #include "miscfunctions.qh" + #include "player_skeleton.qh" + #include "sortlist.qh" + + #include "../client/weapons/projectile.qh" + #include "../common/animdecide.qh" - #include "autocvars.qh" - #include "../csqcmodellib/interpolate.qh" - #include "main.qh" #include "../common/csqcmodel_settings.qh" - #include "../csqcmodellib/common.qh" + #include "../csqcmodellib/cl_model.qh" #include "../csqcmodellib/cl_player.qh" - #include "weapons/projectile.qh" - #include "player_skeleton.qh" + #include "../csqcmodellib/interpolate.qh" + + #include "../warpzonelib/mathlib.qh" + + .float death_time; + .float modelflags; #elif defined(MENUQC) #elif defined(SVQC) #endif diff --git a/qcsrc/client/defs.qh b/qcsrc/client/defs.qh index b13583f6f..4ae2a0696 100644 --- a/qcsrc/client/defs.qh +++ b/qcsrc/client/defs.qh @@ -1,152 +1,6 @@ #ifndef DEFS_H #define DEFS_H -//NOTE: THIS IS AN INTERFACE FILE. DO NOT EDIT. -//MODIFYING THIS FILE CAN RESULT IN CRC ERRORS. -//YOU HAVE BEEN WARNED. - -//feel free to look though. :) - - - - - -/* -============================================================================== - - SOURCE FOR GLOBALVARS_T C STRUCTURE - -============================================================================== -*/ - -// -// system globals -// -//entity self; -//entity other; -//entity world; -//float time; -//float frametime; - -//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 -//float servercommandframe; //clientframe echoed off the server - -//string mapname; - -// -// global variables set by built in functions -// -//vector v_forward, v_up, v_right; // set by makevectors() - -// set by traceline / tracebox -//float trace_allsolid; -//float trace_startsolid; -//float trace_fraction; -//vector trace_endpos; -//vector trace_plane_normal; -//float trace_plane_dist; -//entity trace_ent; -//float trace_inopen; -//float trace_inwater; - -// -// required prog functions -// -void() CSQC_Init; -void() CSQC_Shutdown; -float(float f, float t, float n) CSQC_InputEvent; -void(float w, float h) CSQC_UpdateView; -bool(string s) CSQC_ConsoleCommand; - -//these fields are read and set by the default player physics -//vector pmove_org; -//vector pmove_vel; -//vector pmove_mins; -//vector pmove_maxs; -//retrieved from the current movement commands (read by player physics) -//float input_timelength; -//vector input_angles; -//vector input_movevalues; //forwards, right, up. -//int input_buttons; //attack, use, jump (default physics only uses jump) - -//float movevar_gravity; -//float movevar_stopspeed; -//float movevar_maxspeed; -//float movevar_spectatormaxspeed; //used by NOCLIP movetypes. -//float movevar_accelerate; -//float movevar_airaccelerate; -//float movevar_wateraccelerate; -//float movevar_friction; -//float movevar_waterfriction; -//float movevar_entgravity; //the local player's gravity field. Is a multiple (1 is the normal value) - -//================================================ -//void end_sys_globals; // flag for structure dumping -//================================================ - -/* -============================================================================== - - SOURCE FOR ENTVARS_T C STRUCTURE - -============================================================================== -*/ - -// -// system fields (*** = do not set in prog code, maintained by C code) -// -.int modelindex; // *** model index in the precached list -.vector absmin, absmax; // *** origin + mins / maxs - -.int entnum; // *** the ent number as on the server -.float drawmask; -.void() predraw; - -.float movetype; -.float solid; - -.vector origin; // *** -.vector oldorigin; // *** -.vector velocity; -.vector angles; -.vector avelocity; - -.string classname; // spawn function -.string model; -.int frame; -.int skin; -.int effects; - -.vector mins, maxs; // bounding box extents reletive to origin -.vector size; // maxs - mins - -.void() touch; -.void() use; -.void() think; -.void() blocked; // for doors or plats, called when can't push other - -.float nextthink; - -.entity chain; - -.string netname; - -.entity enemy; - -.int flags; - -.int colormap; - -.entity owner; // who launched a missile - -//================================================ -//void end_sys_fields; // flag for structure dumping -//================================================ - // Additional OPTIONAL Fields and Globals //float intermission; float scoreboard_showscores; diff --git a/qcsrc/client/gibs.qc b/qcsrc/client/gibs.qc index 00c774f71..2d8f48b1a 100644 --- a/qcsrc/client/gibs.qc +++ b/qcsrc/client/gibs.qc @@ -1,20 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../common/util.qh" - #include "../common/buffs.qh" - #include "autocvars.qh" - #include "movetypes.qh" - #include "prandom.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" - #include "../server/t_items.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - -.bool silent; +#include "gibs.qh" void Gib_Delete() { diff --git a/qcsrc/client/gibs.qh b/qcsrc/client/gibs.qh new file mode 100644 index 000000000..e863ddf3c --- /dev/null +++ b/qcsrc/client/gibs.qh @@ -0,0 +1,27 @@ +#ifndef GIBS_H +#define GIBS_H + +.vector colormod; + +.bool silent; + +void Gib_Delete(); + +string species_prefix(int specnum); + +void Gib_setmodel(entity gib, string mdlname, int specnum); + +void new_te_bloodshower (int ef, vector org, float explosionspeed, int howmany); + +void SUB_RemoveOnNoImpact(); + +void Gib_Touch(); + +void Gib_Draw(); + +void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector vrand, int specnum, bool destroyontouch, bool issilent); + +void Ent_GibSplash(bool isNew); + +void GibSplash_Precache(); +#endif \ No newline at end of file diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index 7bd1027f8..8436ff622 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -1,19 +1,6 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../warpzonelib/common.qh" - #include "../common/teams.qh" - #include "../common/util.qh" - #include "autocvars.qh" - #include "../csqcmodellib/interpolate.qh" - #include "noise.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - +#include "hud.qh" +#include "noise.qh" +#include "../warpzonelib/common.qh" .float HookType; // ENT_CLIENT_* .vector origin; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 528b0f19a..e97c89e09 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -1,27 +1,10 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../common/stats.qh" - #include "../warpzonelib/mathlib.qh" - #include "../common/teams.qh" - #include "../common/util.qh" - #include "../common/nades.qh" - #include "../common/buffs.qh" - #include "../common/counting.qh" - #include "../common/weapons/weapons.qh" - #include "../common/mapinfo.qh" - #include "autocvars.qh" - #include "../common/deathtypes.qh" - #include "teamradar.qh" - #include "hud.qh" - #include "scoreboard.qh" - #include "main.qh" - #include "../csqcmodellib/cl_player.qh" - #include "../server/t_items.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif +#include "scoreboard.qh" +#include "teamradar.qh" +#include "../common/buffs.qh" +#include "../common/counting.qh" +#include "../common/mapinfo.qh" +#include "../common/nades.qh" +#include "../server/t_items.qh" /* ================== diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 5c21886c5..d2b225765 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -1,6 +1,8 @@ #ifndef HUD_H #define HUD_H +#include "../common/weapons/weapons.qh" + const int HUD_PANEL_MAX = 24; entity hud_panel[HUD_PANEL_MAX]; const int HUD_PANEL_FIRST = 0; @@ -99,6 +101,8 @@ string panel_bg_padding_str; float current_player; +float GetPlayerColorForce(float i); + #define HUD_PANELS(HUD_PANEL) \ HUD_PANEL(WEAPONS , HUD_Weapons , weapons) \ diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 828812d61..42140aced 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1,28 +1,23 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../common/stats.qh" - #include "../warpzonelib/client.qh" - #include "../common/teams.qh" - #include "../common/util.qh" - #include "../common/nades.qh" - #include "../common/weapons/weapons.qh" - #include "../common/mapinfo.qh" - #include "command/cl_cmd.qh" - #include "autocvars.qh" - #include "../common/notifications.qh" - #include "../csqcmodellib/interpolate.qh" - #include "hud.qh" - #include "waypointsprites.qh" - #include "prandom.qh" - #include "tturrets.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" - #include "shownames.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif +#include "mapvoting.qh" +#include "modeleffects.qh" +#include "particles.qh" +#include "scoreboard.qh" +#include "shownames.qh" +#include "target_music.qh" +#include "tturrets.qh" +#include "tuba.qh" +#include "wall.qh" +#include "waypointsprites.qh" + +#include "vehicles/vehicles.qh" + +#include "../server/vehicles/bumblebee.qh" + +#include "../common/net_notice.qh" + +#include "../common/monsters/monsters.qh" + +#include "../warpzonelib/client.qh" // -------------------------------------------------------------------------- // BEGIN REQUIRED CSQC FUNCTIONS diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index ab9d36c63..f6e86516f 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -1,56 +1,16 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../dpdefs/keycodes.qh" - #include "../common/constants.qh" - #include "../common/util.qh" - #include "../common/mapinfo.qh" - #include "autocvars.qh" - #include "main.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - - -int mv_num_maps; - -float mv_active; -string mv_maps[MAPVOTE_COUNT]; -string mv_pics[MAPVOTE_COUNT]; -string mv_pk3[MAPVOTE_COUNT]; -float mv_preview[MAPVOTE_COUNT]; -float mv_votes[MAPVOTE_COUNT]; -float mv_avail[MAPVOTE_COUNT]; -float mv_avail_start[MAPVOTE_COUNT]; -entity mv_pk3list; -float mv_abstain; -float mv_ownvote; -float mv_detail; -float mv_timeout; -float mv_top2_time; -float mv_top2_alpha; - -vector mv_mousepos; -int mv_selection; -int mv_columns; -int mv_mouse_selection; -int mv_selection_keyboard; - -float gametypevote; -string mapvote_chosenmap; -vector gtv_text_size; -vector gtv_text_size_small; - -string MapVote_FormatMapItem(int id, string map, float count, float maxwidth, vector fontsize) +#include "mapvoting.qh" +#include "scoreboard.qh" + +string MapVote_FormatMapItem(int id, string map, float _count, float maxwidth, vector fontsize) { string pre, post; pre = sprintf("%d. ", id+1); if(mv_detail) { - if(count == 1) + if(_count == 1) post = _(" (1 vote)"); - else if(count >= 0 && mv_avail[id] == GTV_AVAILABLE) - post = sprintf(_(" (%d votes)"), count); + else if(_count >= 0 && mv_avail[id] == GTV_AVAILABLE) + post = sprintf(_(" (%d votes)"), _count); else post = ""; } @@ -78,7 +38,7 @@ vector MapVote_RGB(int id) return '1 1 1'; } -void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float count, int id) +void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float _count, int id) { float alpha; float desc_padding = gtv_text_size.x * 3; @@ -111,7 +71,7 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g entity title; title = spawn(); title.message = MapVote_FormatMapItem(id, MapInfo_Type_ToText(MapInfo_Type_FromString(gtype)), - count, tsize, gtv_text_size); + _count, tsize, gtv_text_size); title.origin = pos-offset; pos.y += gtv_text_size_small.y; @@ -172,7 +132,7 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g remove(title); } -void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float count, int id) +void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float _count, int id) { vector img_size = '0 0 0'; vector rgb; @@ -188,7 +148,7 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin pos_y = pos.y + img_size.y; - label = MapVote_FormatMapItem(id, map, count, tsize, hud_fontsize); + label = MapVote_FormatMapItem(id, map, _count, tsize, hud_fontsize); text_size = stringwidth(label, false, hud_fontsize); @@ -227,7 +187,7 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin drawfill(pos, img_size, '1 1 1', 0.1, DRAWFLAG_NORMAL); } -void MapVote_DrawAbstain(vector pos, float isize, float tsize, float count, int id) +void MapVote_DrawAbstain(vector pos, float isize, float tsize, float _count, int id) { vector rgb; float text_size; @@ -237,7 +197,7 @@ void MapVote_DrawAbstain(vector pos, float isize, float tsize, float count, int pos_y = pos.y + hud_fontsize.y; - label = MapVote_FormatMapItem(id, _("Don't care"), count, tsize, hud_fontsize); + label = MapVote_FormatMapItem(id, _("Don't care"), _count, tsize, hud_fontsize); text_size = stringwidth(label, false, hud_fontsize); @@ -508,9 +468,6 @@ void MapVote_ReadMask() } } -const int NUM_SSDIRS = 4; -string ssdirs[NUM_SSDIRS]; -int n_ssdirs; void MapVote_Init() { int i, j; diff --git a/qcsrc/client/mapvoting.qh b/qcsrc/client/mapvoting.qh new file mode 100644 index 000000000..d8ace5549 --- /dev/null +++ b/qcsrc/client/mapvoting.qh @@ -0,0 +1,81 @@ +#ifndef MAPVOTING_H +#define MAPVOTING_H + +int mv_num_maps; + +float mv_active; +string mv_maps[MAPVOTE_COUNT]; +string mv_pics[MAPVOTE_COUNT]; +string mv_pk3[MAPVOTE_COUNT]; +float mv_preview[MAPVOTE_COUNT]; +float mv_votes[MAPVOTE_COUNT]; +float mv_avail[MAPVOTE_COUNT]; +float mv_avail_start[MAPVOTE_COUNT]; +entity mv_pk3list; +float mv_abstain; +float mv_ownvote; +float mv_detail; +float mv_timeout; +float mv_top2_time; +float mv_top2_alpha; + +vector mv_mousepos; +int mv_selection; +int mv_columns; +int mv_mouse_selection; +int mv_selection_keyboard; + +float gametypevote; +string mapvote_chosenmap; +vector gtv_text_size; +vector gtv_text_size_small; + +string MapVote_FormatMapItem(int id, string map, float count, float maxwidth, vector fontsize); + +string GameTypeVote_DescriptionByID(float id); + +vector MapVote_RGB(int id); + +void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float count, int id); + +void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float count, int id); + +void MapVote_DrawAbstain(vector pos, float isize, float tsize, float count, int id); + +vector MapVote_GridVec(vector gridspec, int i, int m); + +float MapVote_Selection(vector topleft, vector cellsize, float rows, float columns); + +void MapVote_Draw(); + +void Cmd_MapVote_MapDownload(float argc); + +void MapVote_CheckPK3(string pic, string pk3, int id); + +void MapVote_CheckPic(string pic, string pk3, int id); + +void MapVote_ReadMask(); + +const int NUM_SSDIRS = 4; +string ssdirs[NUM_SSDIRS]; +int n_ssdirs; +void MapVote_Init(); + +void MapVote_SendChoice(float index); + +int MapVote_MoveLeft(int pos); +int MapVote_MoveRight(int pos); +int MapVote_MoveUp(int pos); + +int MapVote_MoveDown(int pos); + +float MapVote_InputEvent(float bInputType, float nPrimary, float nSecondary); + +void MapVote_UpdateMask(); + +void MapVote_UpdateVotes(); + +void Ent_MapVote(); + +void Net_MapVote_Picture(); +#endif \ No newline at end of file diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index a152baee0..449d89cd0 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -1,24 +1,8 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../warpzonelib/mathlib.qh" - #include "../common/teams.qh" - #include "../common/util.qh" - #include "../common/command/generic.qh" - #include "../common/urllib.qh" - #include "autocvars.qh" - #include "hud.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - - -entity players; -entity teams; -float team_count; // real teams +#include "miscfunctions.qh" + +#include "../common/urllib.qh" + +#include "../common/command/generic.qh" void AuditLists() { @@ -175,8 +159,6 @@ vector rotate(vector v, float a) return w; } -int ColorTranslateMode; - string ColorTranslateRGB(string s) { if(ColorTranslateMode & 1) @@ -275,54 +257,6 @@ void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, } } -// drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box -float _drawpic_imgaspect; -vector _drawpic_imgsize; -vector _drawpic_sz; -float _drawpic_oldsz; -string _drawpic_picpath; -#define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\ - do {\ - _drawpic_imgsize = draw_getimagesize(pic);\ - if(_drawpic_imgsize != '0 0 0') {\ - _drawpic_imgaspect = _drawpic_imgsize.x/_drawpic_imgsize.y;\ - _drawpic_sz = mySize;\ - if(_drawpic_sz.x/_drawpic_sz.y > _drawpic_imgaspect) {\ - _drawpic_oldsz = _drawpic_sz.x;\ - _drawpic_sz_x = _drawpic_sz.y * _drawpic_imgaspect;\ - if(_drawpic_sz.x)\ - drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz.x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\ - } else {\ - _drawpic_oldsz = _drawpic_sz.y;\ - _drawpic_sz_y = _drawpic_sz.x / _drawpic_imgaspect;\ - if(_drawpic_sz.y)\ - drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz.y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\ - }\ - }\ - } while(0) - -// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga -#define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\ - do{\ - _drawpic_picpath = strcat(hud_skin_path, "/", pic);\ - if(precache_pic(_drawpic_picpath) == "") {\ - _drawpic_picpath = strcat("gfx/hud/default/", pic);\ - }\ - drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\ - _drawpic_picpath = string_null;\ - } while(0) - -// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga -#define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\ - do{\ - _drawpic_picpath = strcat(hud_skin_path, "/", pic);\ - if(precache_pic(_drawpic_picpath) == "") {\ - _drawpic_picpath = strcat("gfx/hud/default/", pic);\ - }\ - drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\ - _drawpic_picpath = string_null;\ - } while(0) - void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp) { float sz; @@ -336,19 +270,6 @@ void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theSc drawpic_aspect_skin_expanding(position, pic, theScale, rgb, theAlpha, flag, fadelerp); drawpic_skin(position, pic, theScale, rgb, theAlpha * fadelerp, flag); } -#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) do { \ - float textaspect, oldsz; \ - textaspect = stringwidth(text, allow_colors, '1 1 1' * sz.y) / sz.y; \ - if(sz.x/sz.y > textaspect) { \ - oldsz = sz.x; \ - sz_x = sz.y * textaspect; \ - pos.x += (oldsz - sz.x) * 0.5; \ - } else { \ - oldsz = sz.y; \ - sz_y = sz.x / textaspect; \ - pos.y += (oldsz - sz.y) * 0.5; \ - } \ -} while(0) // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag) { @@ -362,7 +283,6 @@ void drawcolorcodedstring_aspect(vector pos, string text, vector sz, float theAl drawcolorcodedstring(pos, text, '1 1 0' * sz.y, theAlpha, drawflag); } -vector drawfontscale; void drawstring_expanding(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp) { float sz; @@ -579,7 +499,6 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect } } -const vector GETPLAYERORIGIN_ERROR = '1123581321 2357111317 3141592653'; // way out of bounds for anything on the map vector getplayerorigin(int pl) { entity e; @@ -662,13 +581,6 @@ void draw_endBoldFont() drawfont = FONT_USER+1; } - -const int MAX_ACCURACY_LEVELS = 10; -float acc_lev[MAX_ACCURACY_LEVELS]; -vector acc_col[MAX_ACCURACY_LEVELS]; -float acc_col_loadtime; -int acc_levels; -string acc_color_levels; void Accuracy_LoadLevels() { if(autocvar_accuracy_color_levels != acc_color_levels) diff --git a/qcsrc/client/miscfunctions.qh b/qcsrc/client/miscfunctions.qh new file mode 100644 index 000000000..f5830c489 --- /dev/null +++ b/qcsrc/client/miscfunctions.qh @@ -0,0 +1,165 @@ +#ifndef MISCFUNCTIONS_H +#define MISCFUNCTIONS_H + +entity players; +entity teams; +float team_count; // real teams + +void AuditLists(); + +float RegisterPlayer(entity player); + +void RemovePlayer(entity player); + +void MoveToLast(entity e); + +float RegisterTeam(entity Team); + +void RemoveTeam(entity Team); + +entity GetTeam(int Team, bool add); + +vector HUD_GetFontsize(string cvarname); + +float PreviewExists(string name); + +vector rotate(vector v, float a); + +int ColorTranslateMode; + +string ColorTranslateRGB(string s); + +// decolorizes and team colors the player name when needed +string playername(string thename, float teamid); + +float cvar_or(string cv, float v); + +vector project_3d_to_2d(vector vec); + +void dummyfunction(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8); + +float expandingbox_sizefactor_from_fadelerp(float fadelerp); + +vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor); + +void drawborderlines(float thickness, vector pos, vector dim, vector color, float theAlpha, float drawflag); + +void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, float theAlpha, float drawflag); + +// drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box +float _drawpic_imgaspect; +vector _drawpic_imgsize; +vector _drawpic_sz; +float _drawpic_oldsz; +string _drawpic_picpath; +#define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\ + do {\ + _drawpic_imgsize = draw_getimagesize(pic);\ + if(_drawpic_imgsize != '0 0 0') {\ + _drawpic_imgaspect = _drawpic_imgsize.x/_drawpic_imgsize.y;\ + _drawpic_sz = mySize;\ + if(_drawpic_sz.x/_drawpic_sz.y > _drawpic_imgaspect) {\ + _drawpic_oldsz = _drawpic_sz.x;\ + _drawpic_sz_x = _drawpic_sz.y * _drawpic_imgaspect;\ + if(_drawpic_sz.x)\ + drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz.x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\ + } else {\ + _drawpic_oldsz = _drawpic_sz.y;\ + _drawpic_sz_y = _drawpic_sz.x / _drawpic_imgaspect;\ + if(_drawpic_sz.y)\ + drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz.y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\ + }\ + }\ + } while(0) + +// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga +#define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\ + do{\ + _drawpic_picpath = strcat(hud_skin_path, "/", pic);\ + if(precache_pic(_drawpic_picpath) == "") {\ + _drawpic_picpath = strcat("gfx/hud/default/", pic);\ + }\ + drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\ + _drawpic_picpath = string_null;\ + } while(0) + +// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga +#define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\ + do{\ + _drawpic_picpath = strcat(hud_skin_path, "/", pic);\ + if(precache_pic(_drawpic_picpath) == "") {\ + _drawpic_picpath = strcat("gfx/hud/default/", pic);\ + }\ + drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\ + _drawpic_picpath = string_null;\ + } while(0) + +void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp); + +void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp); + +#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) do { \ + float textaspect, oldsz; \ + textaspect = stringwidth(text, allow_colors, '1 1 1' * sz.y) / sz.y; \ + if(sz.x/sz.y > textaspect) { \ + oldsz = sz.x; \ + sz_x = sz.y * textaspect; \ + pos.x += (oldsz - sz.x) * 0.5; \ + } else { \ + oldsz = sz.y; \ + sz_y = sz.x / textaspect; \ + pos.y += (oldsz - sz.y) * 0.5; \ + } \ +} while(0) + +// drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box +void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag); + +// drawstring wrapper to draw a colorcodedstring as large as possible with preserved aspect ratio into a box +void drawcolorcodedstring_aspect(vector pos, string text, vector sz, float theAlpha, float drawflag); + +vector drawfontscale; +void drawstring_expanding(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp); + +// drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box +void drawstring_aspect_expanding(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag, float fadelerp); + +void drawcolorcodedstring_expanding(vector position, string text, vector theScale, float theAlpha, float flag, float fadelerp); + +void drawcolorcodedstring_aspect_expanding(vector pos, string text, vector sz, float theAlpha, float drawflag, float fadelerp); + +// this draws the triangles of a model DIRECTLY. Don't expect high performance, really... +float PolyDrawModelSurface(entity e, float i_s); +void PolyDrawModel(entity e); + +void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vector rgb, float a, float drawflag); + +const vector GETPLAYERORIGIN_ERROR = '1123581321 2357111317 3141592653'; // way out of bounds for anything on the map +vector getplayerorigin(int pl); + +float getplayeralpha(float pl); + +vector getcsqcplayercolor(float pl); + +float getplayerisdead(float pl); + +void URI_Get_Callback(int id, float status, string data); + +void draw_beginBoldFont(); + +void draw_endBoldFont(); + + +const int MAX_ACCURACY_LEVELS = 10; +float acc_lev[MAX_ACCURACY_LEVELS]; +vector acc_col[MAX_ACCURACY_LEVELS]; +float acc_col_loadtime; +int acc_levels; +string acc_color_levels; +void Accuracy_LoadLevels(); + +void Accuracy_LoadColors(); + +vector Accuracy_GetColor(float accuracy); + +#endif \ No newline at end of file diff --git a/qcsrc/client/modeleffects.qc b/qcsrc/client/modeleffects.qc index a48403b8f..c376085e0 100644 --- a/qcsrc/client/modeleffects.qc +++ b/qcsrc/client/modeleffects.qc @@ -1,16 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - - -.float frame1time; -.float lifetime, fadetime; -.float teleport_time; -.float scale1, scale2; +#include "modeleffects.qh" void ModelEffect_Draw() { diff --git a/qcsrc/client/modeleffects.qh b/qcsrc/client/modeleffects.qh new file mode 100644 index 000000000..df500b86b --- /dev/null +++ b/qcsrc/client/modeleffects.qh @@ -0,0 +1,12 @@ +#ifndef MODELEFFECTS_H +#define MODELEFFECTS_H + +.float frame1time; +.float lifetime, fadetime; +.float teleport_time; +.float scale1, scale2; + +void ModelEffect_Draw(); + +void Ent_ModelEffect(bool isNew); +#endif \ No newline at end of file diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc index 6dcc2e1cb..66fdd6a0f 100644 --- a/qcsrc/client/particles.qc +++ b/qcsrc/client/particles.qc @@ -1,30 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "../common/constants.qh" - #include "../common/stats.qh" - #include "../warpzonelib/common.qh" - #include "../common/util.qh" - #include "../common/weapons/weapons.qh" - #include "autocvars.qh" - #include "bgmscript.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - -.int dphitcontentsmask; - -.int cnt; // effect number -.vector velocity; // particle velocity -.float waterlevel; // direction jitter -.int count; // count multiplier -.int impulse; // density -.string noise; // sound -.float atten; -.float volume; -.float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle -.vector movedir; // trace direction +#include "particles.qh" void Draw_PointParticles() { @@ -203,7 +177,6 @@ void Ent_PointParticles() self.entremove = Ent_PointParticles_Remove; } -.float glow_color; // palette index void Draw_Rain() { te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color); diff --git a/qcsrc/client/particles.qh b/qcsrc/client/particles.qh new file mode 100644 index 000000000..ea9c5b660 --- /dev/null +++ b/qcsrc/client/particles.qh @@ -0,0 +1,32 @@ +#ifndef PARTICLES_H +#define PARTICLES_H + +.int dphitcontentsmask; + +.int cnt; // effect number +.vector velocity; // particle velocity +.float waterlevel; // direction jitter +.int count; // count multiplier +.int impulse; // density +.string noise; // sound +.float atten; +.float volume; +.float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle +.vector movedir; // trace direction + +void Draw_PointParticles(); + +void Ent_PointParticles_Remove(); + +void Ent_PointParticles(); + +.float glow_color; // palette index + +void Draw_Rain(); + +void Draw_Snow(); + +void Ent_RainOrSnow(); + +void Net_ReadVortexBeamParticle(); +#endif \ No newline at end of file diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc index c459b7ab1..0a9ac8cac 100644 --- a/qcsrc/client/player_skeleton.qc +++ b/qcsrc/client/player_skeleton.qc @@ -1,11 +1,6 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "../common/util.qh" - #include "../csqcmodellib/interpolate.qh" - #include "player_skeleton.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif +#include "player_skeleton.qh" + +#include "../warpzonelib/anglestransform.qh" .float skeleton_info_modelindex; .float skeleton_info_skin; diff --git a/qcsrc/client/progs.src b/qcsrc/client/progs.src index 5ea354fab..650c16c4f 100644 --- a/qcsrc/client/progs.src +++ b/qcsrc/client/progs.src @@ -5,129 +5,71 @@ sys-pre.qh ../dpdefs/csprogsdefs.qh sys-post.qh -defs.qh -../dpdefs/keycodes.qh -../common/constants.qh -../common/stats.qh - -../warpzonelib/anglestransform.qh -../warpzonelib/mathlib.qh -../warpzonelib/common.qh -../warpzonelib/client.qh - -../common/playerstats.qh -../common/teams.qh -../common/util.qh -../common/nades.qh -../common/buffs.qh -../common/test.qh -../common/counting.qh -../common/weapons/weapons.qh // TODO -../common/mapinfo.qh -../common/command/markup.qh -../common/command/rpn.qh -../common/command/generic.qh -../common/command/shared_defs.qh -../common/urllib.qh -../common/animdecide.qh -command/cl_cmd.qh - -../common/monsters/monsters.qh - -autocvars.qh - -../common/notifications.qh // must be after autocvars -../common/deathtypes.qh // must be after notifications - -damage.qh - -../csqcmodellib/interpolate.qh -teamradar.qh -hud.qh -scoreboard.qh -waypointsprites.qh -movetypes.qh -prandom.qh -bgmscript.qh -noise.qh -tturrets.qh -../server/tturrets/include/turrets_early.qh -../server/movelib.qc -main.qh -vehicles/vehicles.qh -../common/csqcmodel_settings.qh -../csqcmodellib/common.qh -../csqcmodellib/cl_model.qh -../csqcmodellib/cl_player.qh -weapons/projectile.qh // TODO -player_skeleton.qh - -sortlist.qc -miscfunctions.qc -../server/t_items.qh -../server/t_items.qc - -teamradar.qc -hud_config.qc -hud.qc -scoreboard.qc -mapvoting.qc +announcer.qc +bgmscript.qc +casings.qc csqcmodel_hooks.qc -../common/net_notice.qc - -rubble.qc -hook.qc -particles.qc -laser.qc -weapons/projectile.qc // TODO -gibs.qc damage.qc -casings.qc -../csqcmodellib/cl_model.qc -../csqcmodellib/cl_player.qc effects.qc -wall.qc +gibs.qc +hook.qc +hud_config.qc +hud.qc +laser.qc +main.qc +mapvoting.qc +miscfunctions.qc modeleffects.qc -tuba.qc +movetypes.qc +noise.qc +particles.qc +player_skeleton.qc +prandom.qc +rubble.qc +scoreboard.qc +shownames.qc +sortlist.qc target_music.qc - +teamradar.qc +tturrets.qc +tuba.qc vehicles/vehicles.qc -../server/vehicles/bumblebee.qc -shownames.qh -shownames.qc - -announcer.qc -main.qc view.qc -../csqcmodellib/interpolate.qc +wall.qc waypointsprites.qc -movetypes.qc -prandom.qc -bgmscript.qc -noise.qc +command/cl_cmd.qc + +weapons/projectile.qc // TODO + +../common/animdecide.qc +../common/buffs.qc +../common/mapinfo.qc +../common/nades.qc +../common/net_notice.qc +../common/notifications.qc +../common/playerstats.qc ../common/test.qc +../common/urllib.qc ../common/util.qc -../common/playerstats.qc -../common/notifications.qc + +../common/command/generic.qc ../common/command/markup.qc ../common/command/rpn.qc -../common/command/generic.qc -../common/mapinfo.qc -../common/weapons/weapons.qc // TODO -../common/urllib.qc -command/cl_cmd.qc ../common/monsters/monsters.qc -../common/nades.qc -../common/buffs.qc +../common/weapons/weapons.qc // TODO + +../csqcmodellib/cl_model.qc +../csqcmodellib/cl_player.qc +../csqcmodellib/interpolate.qc + +../server/movelib.qc +../server/t_items.qc +../server/vehicles/bumblebee.qc ../warpzonelib/anglestransform.qc -../warpzonelib/mathlib.qc -../warpzonelib/common.qc ../warpzonelib/client.qc -tturrets.qc - -player_skeleton.qc -../common/animdecide.qc +../warpzonelib/common.qc +../warpzonelib/mathlib.qc \ No newline at end of file diff --git a/qcsrc/client/rubble.qc b/qcsrc/client/rubble.qc index 3363f8971..c09dd18ae 100644 --- a/qcsrc/client/rubble.qc +++ b/qcsrc/client/rubble.qc @@ -1,11 +1,9 @@ #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" + #include "rubble.qh" #elif defined(MENUQC) #elif defined(SVQC) #endif -.float creationtime; - // LordHavoc: rewrote this file, it was really bad code void RubbleLimit(string cname, float limit, void() deleteproc) diff --git a/qcsrc/client/rubble.qh b/qcsrc/client/rubble.qh new file mode 100644 index 000000000..b907adc25 --- /dev/null +++ b/qcsrc/client/rubble.qh @@ -0,0 +1,6 @@ +#ifndef RUBBLE_H +#define RUBBLE_H +.float creationtime; +void RubbleLimit(string cname, float limit, void() deleteproc); +entity RubbleNew(string cname); +#endif \ No newline at end of file diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index ebc0db350..e468514d9 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -1,22 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../common/stats.qh" - #include "../common/teams.qh" - #include "../common/util.qh" - #include "../common/buffs.qh" - #include "../common/counting.qh" - #include "../common/weapons/weapons.qh" - #include "../common/mapinfo.qh" - #include "command/cl_cmd.qh" - #include "autocvars.qh" - #include "hud.qh" - #include "scoreboard.qh" - #include "main.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif +#include "scoreboard.qh" float scoreboard_alpha_bg; float scoreboard_alpha_fg; @@ -74,7 +56,6 @@ string TranslateScoresLabel(string l) } } -void Cmd_HUD_SetFields(float argc); void HUD_InitScores() { int i, f; @@ -105,7 +86,6 @@ void HUD_InitScores() Cmd_HUD_SetFields(0); } -void HUD_UpdatePlayerPos(entity pl); float SetTeam(entity pl, float Team); //float lastpnum; void HUD_UpdatePlayerTeams() @@ -627,7 +607,6 @@ string HUD_GetField(entity pl, int field) //return "error"; } -float xmin, xmax, ymin, ymax, sbwidth; float hud_fixscoreboardcolumnwidth_len; float hud_fixscoreboardcolumnwidth_iconlen; float hud_fixscoreboardcolumnwidth_marginlen; diff --git a/qcsrc/client/scoreboard.qh b/qcsrc/client/scoreboard.qh index 388e254c2..f2b155fb1 100644 --- a/qcsrc/client/scoreboard.qh +++ b/qcsrc/client/scoreboard.qh @@ -1,7 +1,14 @@ #ifndef SCOREBOARD_H #define SCOREBOARD_H -float HUD_WouldDrawScoreboard(void); +float xmin, xmax, ymin, ymax, sbwidth; + float scoreboard_active; float scoreboard_fade_alpha; + +void Cmd_HUD_SetFields(float argc); +void HUD_InitScores(); +void HUD_UpdatePlayerPos(entity pl); +void HUD_UpdateTeamPos(entity Team); +float HUD_WouldDrawScoreboard(void); #endif \ No newline at end of file diff --git a/qcsrc/client/sortlist.qc b/qcsrc/client/sortlist.qc index c1b60f962..7093ee07d 100644 --- a/qcsrc/client/sortlist.qc +++ b/qcsrc/client/sortlist.qc @@ -1,11 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - -//.float(entity,entity) sort_cmp; -.entity sort_next, sort_prev; +#include "sortlist.qh" entity Sort_Spawn() { @@ -104,19 +97,6 @@ entity Sort_Get(entity sort, float i) } */ -/** - * Swap two neighbours in a sortlist. - * @param a FIRST entity - * @param b entity after a - */ -#define SORT_SWAP(a,b) \ - b.sort_prev = a.sort_prev; \ - a.sort_next = b.sort_next; \ - if(b.sort_next) b.sort_next.sort_prev = a; \ - if(a.sort_prev) a.sort_prev.sort_next = b; \ - a.sort_prev = b; \ - b.sort_next = a - /* void Sort_Erase(entity ent) { diff --git a/qcsrc/client/sortlist.qh b/qcsrc/client/sortlist.qh new file mode 100644 index 000000000..17512342e --- /dev/null +++ b/qcsrc/client/sortlist.qh @@ -0,0 +1,22 @@ +#ifndef SORTLIST_H +#define SORTLIST_H + +//.float(entity,entity) sort_cmp; +.entity sort_next, sort_prev; + +entity Sort_Spawn(); + +/** + * Swap two neighbours in a sortlist. + * @param a FIRST entity + * @param b entity after a + */ +#define SORT_SWAP(a,b) \ + b.sort_prev = a.sort_prev; \ + a.sort_next = b.sort_next; \ + if(b.sort_next) b.sort_next.sort_prev = a; \ + if(a.sort_prev) a.sort_prev.sort_next = b; \ + a.sort_prev = b; \ + b.sort_next = a + +#endif \ No newline at end of file diff --git a/qcsrc/client/target_music.qc b/qcsrc/client/target_music.qc index 2db1f40be..6006aeb47 100644 --- a/qcsrc/client/target_music.qc +++ b/qcsrc/client/target_music.qc @@ -1,24 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../warpzonelib/common.qh" - #include "../common/util.qh" - #include "autocvars.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - -float music_disabled; -entity music_default; -entity music_target; -entity music_trigger; -// FIXME also control bgmvolume here, to not require a target_music for the default track. - -.int state; -.float lastvol; +#include "target_music.qh" void TargetMusic_Advance() { diff --git a/qcsrc/client/target_music.qh b/qcsrc/client/target_music.qh new file mode 100644 index 000000000..5a1538902 --- /dev/null +++ b/qcsrc/client/target_music.qh @@ -0,0 +1,22 @@ +#ifndef TARGET_MUSIC_H +#define TARGET_MUSIC_H + +float music_disabled; +entity music_default; +entity music_target; +entity music_trigger; +// FIXME also control bgmvolume here, to not require a target_music for the default track. + +.int state; +.float lastvol; + +void TargetMusic_Advance(); + +void Net_TargetMusic(); + +void Ent_TriggerMusic_Think(); + +void Ent_TriggerMusic_Remove(); + +void Ent_ReadTriggerMusic(); +#endif \ No newline at end of file diff --git a/qcsrc/client/teamradar.qc b/qcsrc/client/teamradar.qc index 02b083692..8f6b17e1b 100644 --- a/qcsrc/client/teamradar.qc +++ b/qcsrc/client/teamradar.qc @@ -1,25 +1,9 @@ #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/util.qh" - #include "autocvars.qh" - #include "../csqcmodellib/interpolate.qh" #include "teamradar.qh" - #include "hud.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" #elif defined(MENUQC) #elif defined(SVQC) #endif -float teamradar_angle; // player yaw angle -vector teamradar_origin3d_in_texcoord; // player origin -vector teamradar_origin2d; // 2D origin -vector teamradar_size2d; // 2D size -vector teamradar_extraclip_mins, teamradar_extraclip_maxs; // for non-centered radar display -float teamradar_size; // 2D scale factor -float v_flipped; - float vlen2d(vector v) { return sqrt(v.x * v.x + v.y * v.y); @@ -180,14 +164,6 @@ void draw_teamradar_link(vector start, vector end, int colors) R_EndPolygon(); } -float hud_panel_radar_scale; // window size = ...qu -float hud_panel_radar_foreground_alpha; -float hud_panel_radar_rotation; -vector hud_panel_radar_size; -float hud_panel_radar_zoommode; -float hud_panel_radar_maximized_zoommode; -float hud_panel_radar_maximized_rotation; - void teamradar_loadcvars() { v_flipped = autocvar_v_flipped; diff --git a/qcsrc/client/teamradar.qh b/qcsrc/client/teamradar.qh index 3585b7329..777098a99 100644 --- a/qcsrc/client/teamradar.qh +++ b/qcsrc/client/teamradar.qh @@ -8,4 +8,48 @@ const int MAX_TEAMRADAR_TIMES = 32; .float teamradar_times[MAX_TEAMRADAR_TIMES]; .int teamradar_time_index; .vector teamradar_color; + +float teamradar_angle; // player yaw angle +vector teamradar_origin3d_in_texcoord; // player origin +vector teamradar_origin2d; // 2D origin +vector teamradar_size2d; // 2D size +vector teamradar_extraclip_mins, teamradar_extraclip_maxs; // for non-centered radar display +float teamradar_size; // 2D scale factor +float v_flipped; + +float hud_panel_radar_scale; // window size = ...qu +float hud_panel_radar_foreground_alpha; +float hud_panel_radar_rotation; +vector hud_panel_radar_size; +float hud_panel_radar_zoommode; +float hud_panel_radar_maximized_zoommode; +float hud_panel_radar_maximized_rotation; + + +float vlen2d(vector v); + +float vlen_maxnorm2d(vector v); + +float vlen_minnorm2d(vector v); + +vector teamradar_3dcoord_to_texcoord(vector in); + +vector teamradar_texcoord_to_2dcoord(vector in); + +vector yinvert(vector v); + +void draw_teamradar_background(float fg); + +void draw_teamradar_player(vector coord3d, vector pangles, vector rgb); + +void draw_teamradar_icon(vector coord, float icon, entity pingdata, vector rgb, float a); + +void draw_teamradar_link(vector start, vector end, int colors); + +void teamradar_loadcvars(); + +// radar links + +void Ent_RadarLink(); + #endif \ No newline at end of file diff --git a/qcsrc/client/tturrets.qc b/qcsrc/client/tturrets.qc index 707c79209..9dbecd384 100644 --- a/qcsrc/client/tturrets.qc +++ b/qcsrc/client/tturrets.qc @@ -1,22 +1,7 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../warpzonelib/mathlib.qh" - #include "../common/teams.qh" - #include "../common/buffs.qh" - #include "autocvars.qh" - #include "teamradar.qh" - #include "movetypes.qh" - #include "tturrets.qh" - #include "../server/tturrets/include/turrets_early.qh" - #include "main.qh" - #include "../csqcmodellib/common.qh" - #include "../csqcmodellib/cl_model.qh" - #include "../server/t_items.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif +#include "tturrets.qh" +#include "waypointsprites.qh" + +#include "../server/movelib.qh" string tid2info_base; string tid2info_head; diff --git a/qcsrc/client/tturrets.qh b/qcsrc/client/tturrets.qh index b6184dc4d..767e5112d 100644 --- a/qcsrc/client/tturrets.qh +++ b/qcsrc/client/tturrets.qh @@ -1,6 +1,8 @@ #ifndef TTURRETS_H #define TTURRETS_H +#include "../server/tturrets/include/turrets_early.qh" + void ent_turret(); void turrets_precache(); .entity tur_head; diff --git a/qcsrc/client/tuba.qc b/qcsrc/client/tuba.qc index 33378a041..dec00043f 100644 --- a/qcsrc/client/tuba.qc +++ b/qcsrc/client/tuba.qc @@ -1,27 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "../common/constants.qh" - #include "../warpzonelib/mathlib.qh" - #include "../common/util.qh" - #include "autocvars.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - -const float TUBA_MIN = -18; -const float TUBA_MAX = 27; -const float TUBA_INSTRUMENTS = 3; - -#define TUBA_STARTNOTE(i,n) strcat("weapons/tuba", (i ? ftos(i) : ""), "_loopnote", ftos(n), ".wav") -.int note; // note -.float attenuate; // if set, attenuate it -.float cnt; // current volume -.float count; // initial volume -.float tuba_instrument; - -int Tuba_PitchStep; +#include "tuba.qh" void tubasound(entity e, float restart) { diff --git a/qcsrc/client/tuba.qh b/qcsrc/client/tuba.qh new file mode 100644 index 000000000..e84300972 --- /dev/null +++ b/qcsrc/client/tuba.qh @@ -0,0 +1,28 @@ +#ifndef TUBA_H +#define TUBA_H + +const float TUBA_MIN = -18; +const float TUBA_MAX = 27; +const float TUBA_INSTRUMENTS = 3; + +#define TUBA_STARTNOTE(i,n) strcat("weapons/tuba", (i ? ftos(i) : ""), "_loopnote", ftos(n), ".wav") +.int note; // note +.float attenuate; // if set, attenuate it +.float cnt; // current volume +.float count; // initial volume +.float tuba_instrument; + +int Tuba_PitchStep; + +void tubasound(entity e, float restart); + +void Ent_TubaNote_Think(); + +void Ent_TubaNote_UpdateSound(); + +void Ent_TubaNote_StopSound(); + +void Ent_TubaNote(float bIsNew); + +void Tuba_Precache(); +#endif \ No newline at end of file diff --git a/qcsrc/client/vehicles/vehicles.qh b/qcsrc/client/vehicles/vehicles.qh index fa4875b60..19bce0c7e 100644 --- a/qcsrc/client/vehicles/vehicles.qh +++ b/qcsrc/client/vehicles/vehicles.qh @@ -4,4 +4,6 @@ void RaptorCBShellfragDraw(); void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang); void Vehicles_Precache(); +void Net_AuXair2(bool bIsNew); +void Net_VehicleSetup(); #endif \ No newline at end of file diff --git a/qcsrc/client/wall.qc b/qcsrc/client/wall.qc index 2f086eac2..1ae8fa85a 100644 --- a/qcsrc/client/wall.qc +++ b/qcsrc/client/wall.qc @@ -1,20 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "../common/util.qh" - #include "autocvars.qh" - #include "../csqcmodellib/interpolate.qh" - #include "bgmscript.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - -.float lip; -.float bgmscriptangular; -.int lodmodelindex0, lodmodelindex1, lodmodelindex2; -.float loddistance1, loddistance2; -.vector saved; +#include "wall.qh" void Ent_Wall_Draw() { diff --git a/qcsrc/client/wall.qh b/qcsrc/client/wall.qh new file mode 100644 index 000000000..4a3955e6f --- /dev/null +++ b/qcsrc/client/wall.qh @@ -0,0 +1,15 @@ +#ifndef WALL_H +#define WALL_H + +.float lip; +.float bgmscriptangular; +.int lodmodelindex0, lodmodelindex1, lodmodelindex2; +.float loddistance1, loddistance2; +.vector saved; + +void Ent_Wall_Draw(); + +void Ent_Wall_Remove(); + +void Ent_Wall(); +#endif \ No newline at end of file diff --git a/qcsrc/client/waypointsprites.qc b/qcsrc/client/waypointsprites.qc index ac1b40a67..2b4ffd684 100644 --- a/qcsrc/client/waypointsprites.qc +++ b/qcsrc/client/waypointsprites.qc @@ -1,71 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "defs.qh" - #include "../common/constants.qh" - #include "../warpzonelib/mathlib.qh" - #include "../common/teams.qh" - #include "../common/util.qh" - #include "../common/buffs.qh" - #include "../common/weapons/weapons.qh" - #include "autocvars.qh" - #include "../csqcmodellib/interpolate.qh" - #include "teamradar.qh" - #include "waypointsprites.qh" - #include "main.qh" - #include "../csqcmodellib/cl_model.qh" - #include "../server/t_items.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - -float waypointsprite_initialized; -float waypointsprite_fadedistance; -float waypointsprite_normdistance; -float waypointsprite_minscale; -float waypointsprite_minalpha; -float waypointsprite_distancealphaexponent; -float waypointsprite_timealphaexponent; -float waypointsprite_scale; -float waypointsprite_fontsize; -float waypointsprite_edgefadealpha; -float waypointsprite_edgefadescale; -float waypointsprite_edgefadedistance; -float waypointsprite_edgeoffset_bottom; -float waypointsprite_edgeoffset_left; -float waypointsprite_edgeoffset_right; -float waypointsprite_edgeoffset_top; -float waypointsprite_crosshairfadealpha; -float waypointsprite_crosshairfadescale; -float waypointsprite_crosshairfadedistance; -float waypointsprite_distancefadealpha; -float waypointsprite_distancefadescale; -float waypointsprite_distancefadedistance; -float waypointsprite_alpha; - -.float helpme; -.float rule; -.string netname; // primary picture -.string netname2; // secondary picture -.string netname3; // tertiary picture -.float team; // team that gets netname2 -.float lifetime; -.float fadetime; -.float maxdistance; -.int hideflags; -.float spawntime; -.float health; -.float build_started; -.float build_starthealth; -.float build_finished; - -const float SPRITE_HEALTHBAR_WIDTH = 144; -const float SPRITE_HEALTHBAR_HEIGHT = 9; -const float SPRITE_HEALTHBAR_MARGIN = 6; -const float SPRITE_HEALTHBAR_BORDER = 2; -const float SPRITE_HEALTHBAR_BORDERALPHA = 1; -const float SPRITE_HEALTHBAR_HEALTHALPHA = 0.5; -const float SPRITE_ARROW_SCALE = 1.0; -const float SPRITE_HELPME_BLINK = 2; +#include "waypointsprites.qh" void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, vector rgb, float a, float f) { @@ -368,7 +301,6 @@ vector fixrgbexcess(vector rgb) return rgb; } -float waypointsprite_count, waypointsprite_newcount; void Draw_WaypointSprite() { string spriteimage; diff --git a/qcsrc/client/waypointsprites.qh b/qcsrc/client/waypointsprites.qh index 9a066a4ee..aff39639e 100644 --- a/qcsrc/client/waypointsprites.qh +++ b/qcsrc/client/waypointsprites.qh @@ -1,7 +1,86 @@ #ifndef WAYPOINTSPRITES_H #define WAYPOINTSPRITES_H + +float waypointsprite_initialized; +float waypointsprite_fadedistance; +float waypointsprite_normdistance; +float waypointsprite_minscale; +float waypointsprite_minalpha; +float waypointsprite_distancealphaexponent; +float waypointsprite_timealphaexponent; +float waypointsprite_scale; +float waypointsprite_fontsize; +float waypointsprite_edgefadealpha; +float waypointsprite_edgefadescale; +float waypointsprite_edgefadedistance; +float waypointsprite_edgeoffset_bottom; +float waypointsprite_edgeoffset_left; +float waypointsprite_edgeoffset_right; +float waypointsprite_edgeoffset_top; +float waypointsprite_crosshairfadealpha; +float waypointsprite_crosshairfadescale; +float waypointsprite_crosshairfadedistance; +float waypointsprite_distancefadealpha; +float waypointsprite_distancefadescale; +float waypointsprite_distancefadedistance; +float waypointsprite_alpha; + +.float helpme; +.float rule; +.string netname; // primary picture +.string netname2; // secondary picture +.string netname3; // tertiary picture +.float team; // team that gets netname2 +.float lifetime; +.float fadetime; +.float maxdistance; +.int hideflags; +.float spawntime; +.float health; +.float build_started; +.float build_starthealth; +.float build_finished; + +const float SPRITE_HEALTHBAR_WIDTH = 144; +const float SPRITE_HEALTHBAR_HEIGHT = 9; +const float SPRITE_HEALTHBAR_MARGIN = 6; +const float SPRITE_HEALTHBAR_BORDER = 2; +const float SPRITE_HEALTHBAR_BORDERALPHA = 1; +const float SPRITE_HEALTHBAR_HEALTHALPHA = 0.5; +const float SPRITE_ARROW_SCALE = 1.0; +const float SPRITE_HELPME_BLINK = 2; + +float waypointsprite_count, waypointsprite_newcount; + +void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, vector rgb, float a, float f); + +void drawquad(vector o, vector ri, vector up, string pic, vector rgb, float a, float f); + +void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, float width, float height, float margin, float border, float align, vector rgb, float a, vector hrgb, float ha, float f); + +// returns location of sprite text +vector drawspritearrow(vector o, float ang, vector rgb, float a, float t); + +// returns location of sprite healthbar +vector drawspritetext(vector o, float ang, float minwidth, vector rgb, float a, vector fontsize, string s); + +float spritelookupblinkvalue(string s); +vector spritelookupcolor(string s, vector def); +string spritelookuptext(string s); + +vector fixrgbexcess_move(vector rgb, vector src, vector dst); +vector fixrgbexcess(vector rgb); + +void Draw_WaypointSprite(); + // they are drawn using a .draw function -void Ent_WaypointSprite(); + void Ent_RemoveWaypointSprite(); +void Ent_WaypointSprite(); + +void WaypointSprite_Load_Frames(string ext); + +void WaypointSprite_Load(); + #endif \ No newline at end of file diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index fe7df5d79..54095e7c4 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -1,27 +1,4 @@ -#if defined(CSQC) - #include "../../dpdefs/csprogsdefs.qh" - #include "../defs.qh" - #include "../../common/constants.qh" - #include "../../warpzonelib/anglestransform.qh" - #include "../../common/util.qh" - #include "../../common/nades.qh" - #include "../../common/buffs.qh" - #include "../autocvars.qh" - #include "../../csqcmodellib/interpolate.qh" - #include "../movetypes.qh" - #include "../main.qh" - #include "../../csqcmodellib/cl_model.qh" - #include "projectile.qh" - #include "../../server/t_items.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - -.vector iorigin1, iorigin2; -.float spawntime; -.vector trail_oldorigin; -.float trail_oldtime; -.float fade_time, fade_rate; +#include "projectile.qh" void SUB_Stop() { @@ -29,13 +6,6 @@ void SUB_Stop() self.move_movetype = MOVETYPE_NONE; } -.float alphamod; -.int count; // set if clientside projectile -.int cnt; // sound index -.float gravity; -.int snd_looping; -.bool silent; - void Projectile_ResetTrail(vector to) { self.trail_oldorigin = to; diff --git a/qcsrc/client/weapons/projectile.qh b/qcsrc/client/weapons/projectile.qh index a48ff1ad5..c6076f2fe 100644 --- a/qcsrc/client/weapons/projectile.qh +++ b/qcsrc/client/weapons/projectile.qh @@ -2,6 +2,34 @@ #define PROJECTILE_H .int traileffect; + +.vector iorigin1, iorigin2; +.float spawntime; +.vector trail_oldorigin; +.float trail_oldtime; +.float fade_time, fade_rate; + +.float alphamod; +.int count; // set if clientside projectile +.int cnt; // sound index +.float gravity; +.int snd_looping; +.bool silent; + +void SUB_Stop(); + void Projectile_ResetTrail(vector to); + void Projectile_DrawTrail(vector to); + +void Projectile_Draw(); + +void loopsound(entity e, int ch, string samp, float vol, float attn); + +void Ent_RemoveProjectile(); + +void Ent_Projectile(); + +void Projectile_Precache(); + #endif \ No newline at end of file diff --git a/qcsrc/common/command/generic.qh b/qcsrc/common/command/generic.qh index d1faa250e..8858ab74f 100644 --- a/qcsrc/common/command/generic.qh +++ b/qcsrc/common/command/generic.qh @@ -1,11 +1,22 @@ #ifndef GENERIC_H #define GENERIC_H +#include "markup.qh" +#include "rpn.qh" + // ========================================================= // Declarations for common command code, written by Samual // Last updated: December 28th, 2011 // ========================================================= +void GenericCommand_macro_help(); + +float GenericCommand_macro_command(float argc, string command); + +float GenericCommand_macro_usage(float argc); + +void GenericCommand_macro_write_aliases(float fh); + // Used by other game command systems for common commands, // and it returns true if handled, false if not. // Note: It tokenizes its input, so be careful! diff --git a/qcsrc/common/command/markup.qc b/qcsrc/common/command/markup.qc index 1b61089e8..8030f9e00 100644 --- a/qcsrc/common/command/markup.qc +++ b/qcsrc/common/command/markup.qc @@ -1,13 +1,4 @@ -#if defined(CSQC) - #include "../../dpdefs/csprogsdefs.qh" - #include "../util.qh" - #include "markup.qh" -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../../dpdefs/dpextensions.qh" - #include "../util.qh" - #include "markup.qh" -#endif +#include "markup.qh" // ========================================================= // Markup chat characters command code, reworked by Samual diff --git a/qcsrc/common/command/markup.qh b/qcsrc/common/command/markup.qh index 918d3d3cc..5f85499a6 100644 --- a/qcsrc/common/command/markup.qh +++ b/qcsrc/common/command/markup.qh @@ -10,4 +10,6 @@ const int NUM_MARKUPS = 41; bool markup_init; string markup_from[NUM_MARKUPS]; string markup_to[NUM_MARKUPS]; + +string GenericCommand_markup(string s2); #endif \ No newline at end of file diff --git a/qcsrc/common/command/rpn.qc b/qcsrc/common/command/rpn.qc index 1a67b37bb..bb920d697 100644 --- a/qcsrc/common/command/rpn.qc +++ b/qcsrc/common/command/rpn.qc @@ -1,20 +1,4 @@ -#if defined(CSQC) - #include "../../dpdefs/csprogsdefs.qh" - #include "../../warpzonelib/mathlib.qh" - #include "../util.qh" - #include "rpn.qh" - #include "generic.qh" - #include "shared_defs.qh" -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../../dpdefs/progsdefs.qh" - #include "../../dpdefs/dpextensions.qh" - #include "../../warpzonelib/mathlib.qh" - #include "../util.qh" - #include "rpn.qh" - #include "generic.qh" - #include "shared_defs.qh" -#endif +#include "rpn.qh" // ======================================== // RPN command code, written by divVerent diff --git a/qcsrc/common/command/rpn.qh b/qcsrc/common/command/rpn.qh index e811a78bb..073223f89 100644 --- a/qcsrc/common/command/rpn.qh +++ b/qcsrc/common/command/rpn.qh @@ -11,4 +11,7 @@ int rpn_db; int rpn_error; int rpn_sp; string rpn_stack[MAX_RPN_STACK]; + +void GenericCommand_rpn(float request, float argc, string command); + #endif \ No newline at end of file diff --git a/qcsrc/common/deathtypes.qh b/qcsrc/common/deathtypes.qh index ddc7b1477..0e6336af6 100644 --- a/qcsrc/common/deathtypes.qh +++ b/qcsrc/common/deathtypes.qh @@ -1,6 +1,8 @@ #ifndef DEATHTYPES_H #define DEATHTYPES_H +#include "notifications.qh" + // ================================ // Deathtypes, reworked by Samual // ================================ diff --git a/qcsrc/common/net_notice.qc b/qcsrc/common/net_notice.qc index 946d16673..bc520e59d 100644 --- a/qcsrc/common/net_notice.qc +++ b/qcsrc/common/net_notice.qc @@ -1,15 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "../client/defs.qh" - #include "../csqcmodellib/cl_model.qh" -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "constants.qh" - #include "net_notice.qh" - #include "../server/defs.qh" -#endif +#include "net_notice.qh" #ifdef SVQC void sv_notice_join_think() diff --git a/qcsrc/common/net_notice.qh b/qcsrc/common/net_notice.qh index 958b89adb..41820bf0c 100644 --- a/qcsrc/common/net_notice.qh +++ b/qcsrc/common/net_notice.qh @@ -1,11 +1,6 @@ #ifndef NET_NOTICE_H #define NET_NOTICE_H -#ifdef CSQC -void cl_notice_read(); -void sv_notice_to(entity _to, string _notice, float _howlong, float _modal); -#endif - #ifdef SVQC string autocvar_sv_join_notices; float autocvar_sv_join_notices_time; @@ -14,4 +9,9 @@ void sv_notice_to(entity _to, string _notice, float _howlong, float _modal); void sv_notice_toall(string _notice, float _howlong, float _modal); void sv_notice_join(); #endif + +#ifdef CSQC +void cl_notice_read(); +#endif + #endif \ No newline at end of file diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 76b1d33f3..24e20aa75 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -1,14 +1,4 @@ #if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" - #include "../client/defs.qh" - #include "teams.qh" - #include "util.qh" - #include "buffs.qh" - #include "counting.qh" - #include "weapons/weapons.qh" - #include "../client/autocvars.qh" - #include "notifications.qh" - #include "../client/main.qh" #elif defined(MENUQC) #elif defined(SVQC) #include "../dpdefs/progsdefs.qh" diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 4bd519227..60080b187 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -1,6 +1,9 @@ #ifndef NOTIFICATIONS_H #define NOTIFICATIONS_H +#include "constants.qh" +#include "teams.qh" + // ================================================ // Unified notification system, written by Samual // Last updated: March, 2013 diff --git a/qcsrc/csqcmodellib/cl_model.qh b/qcsrc/csqcmodellib/cl_model.qh index 0204cd17e..68547e1b3 100644 --- a/qcsrc/csqcmodellib/cl_model.qh +++ b/qcsrc/csqcmodellib/cl_model.qh @@ -22,6 +22,8 @@ #ifndef CL_MODEL_H #define CL_MODEL_H +#include "common.qh" + void CSQCModel_Read(float isnew); #define CSQCMODEL_IF(cond) diff --git a/qcsrc/csqcmodellib/common.qh b/qcsrc/csqcmodellib/common.qh index 8b92221e7..ac460bbab 100644 --- a/qcsrc/csqcmodellib/common.qh +++ b/qcsrc/csqcmodellib/common.qh @@ -22,6 +22,8 @@ #ifndef CSQCMODELLIB_COMMON_H #define CSQCMODELLIB_COMMON_H +#include "../common/csqcmodel_settings.qh" + noref string csqcmodel_license = "\ Copyright (c) 2011 Rudolf Polzer\ \ diff --git a/qcsrc/server/movelib.qc b/qcsrc/server/movelib.qc index f5e34f287..29137c3d3 100644 --- a/qcsrc/server/movelib.qc +++ b/qcsrc/server/movelib.qc @@ -1,11 +1,4 @@ -#if defined(CSQC) - #include "../dpdefs/csprogsdefs.qh" -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../csqcmodellib/sv_model.qh" -#endif +#include "movelib.qh" #ifdef SVQC .vector moveto; @@ -62,7 +55,6 @@ vector movelib_inertmove(vector new_vel,float new_bias) return new_vel * new_bias + self.velocity * (1-new_bias); } -.float movelib_lastupdate; void movelib_move(vector force,float max_velocity,float drag,float theMass,float breakforce) { float deltatime; @@ -171,18 +163,6 @@ void movelib_update(vector dir,float force) } */ -/* -void movelib_move_simple(vector newdir,float velo,float blendrate) -{ - self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo; -} -*/ -#define movelib_move_simple(newdir,velo,blendrate) \ - self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo - -#define movelib_move_simple_gravity(newdir,velo,blendrate) \ - if(self.flags & FL_ONGROUND) movelib_move_simple(newdir,velo,blendrate) - void movelib_beak_simple(float force) { float mspeed; diff --git a/qcsrc/server/movelib.qh b/qcsrc/server/movelib.qh new file mode 100644 index 000000000..3eeb3a57b --- /dev/null +++ b/qcsrc/server/movelib.qh @@ -0,0 +1,53 @@ +#ifndef MOVELIB_H +#define MOVELIB_H + +#ifdef SVQC +.vector moveto; + +/** + Simulate drag + self.velocity = movelib_dragvec(self.velocity,0.02,0.5); +**/ +vector movelib_dragvec(float drag, float exp_); + +/** + Simulate drag + self.velocity *= movelib_dragflt(somespeed,0.01,0.7); +**/ +float movelib_dragflt(float fspeed,float drag,float exp_); + +/** + Do a inertia simulation based on velocity. + Basicaly, this allows you to simulate loss of steering with higher speed. + self.velocity = movelib_inertmove_byspeed(self.velocity,newvel,1000,0.1,0.9); +**/ +vector movelib_inertmove_byspeed(vector vel_new, float vel_max,float newmin,float oldmax); + +vector movelib_inertmove(vector new_vel,float new_bias); + +.float movelib_lastupdate; +void movelib_move(vector force,float max_velocity,float drag,float theMass,float breakforce); + +/* +void movelib_move_simple(vector newdir,float velo,float blendrate) +{ + self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo; +} +*/ +#define movelib_move_simple(newdir,velo,blendrate) \ + self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo + +#define movelib_move_simple_gravity(newdir,velo,blendrate) \ + if(self.flags & FL_ONGROUND) movelib_move_simple(newdir,velo,blendrate) + +void movelib_beak_simple(float force); + +/** +Pitches and rolls the entity to match the gound. +Yed need to set v_up and v_forward (generally by calling makevectors) before calling this. +**/ +#endif + +void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max); + +#endif \ No newline at end of file diff --git a/qcsrc/server/vehicles/bumblebee.qc b/qcsrc/server/vehicles/bumblebee.qc index 1fddc8720..68733b5b7 100644 --- a/qcsrc/server/vehicles/bumblebee.qc +++ b/qcsrc/server/vehicles/bumblebee.qc @@ -1,98 +1,6 @@ -#if defined(CSQC) - #include "../../dpdefs/csprogsdefs.qh" - #include "../../client/defs.qh" - #include "../../common/buffs.qh" - #include "../../client/damage.qh" - #include "../../client/movetypes.qh" - #include "../../client/main.qh" - #include "../../csqcmodellib/cl_model.qh" - #include "../../client/weapons/projectile.qh" -#elif defined(MENUQC) -#elif defined(SVQC) -#endif - -const float BRG_SETUP = 2; -const float BRG_START = 4; -const float BRG_END = 8; +#include "bumblebee.qh" #ifdef SVQC -// Auto cvars -float autocvar_g_vehicle_bumblebee_speed_forward; -float autocvar_g_vehicle_bumblebee_speed_strafe; -float autocvar_g_vehicle_bumblebee_speed_up; -float autocvar_g_vehicle_bumblebee_speed_down; -float autocvar_g_vehicle_bumblebee_turnspeed; -float autocvar_g_vehicle_bumblebee_pitchspeed; -float autocvar_g_vehicle_bumblebee_pitchlimit; -float autocvar_g_vehicle_bumblebee_friction; - -float autocvar_g_vehicle_bumblebee_energy; -float autocvar_g_vehicle_bumblebee_energy_regen; -float autocvar_g_vehicle_bumblebee_energy_regen_pause; - -float autocvar_g_vehicle_bumblebee_health; -float autocvar_g_vehicle_bumblebee_health_regen; -float autocvar_g_vehicle_bumblebee_health_regen_pause; - -float autocvar_g_vehicle_bumblebee_shield; -float autocvar_g_vehicle_bumblebee_shield_regen; -float autocvar_g_vehicle_bumblebee_shield_regen_pause; - -float autocvar_g_vehicle_bumblebee_cannon_cost; -float autocvar_g_vehicle_bumblebee_cannon_damage; -float autocvar_g_vehicle_bumblebee_cannon_radius; -float autocvar_g_vehicle_bumblebee_cannon_refire; -float autocvar_g_vehicle_bumblebee_cannon_speed; -float autocvar_g_vehicle_bumblebee_cannon_spread; -float autocvar_g_vehicle_bumblebee_cannon_force; - -float autocvar_g_vehicle_bumblebee_cannon_ammo; -float autocvar_g_vehicle_bumblebee_cannon_ammo_regen; -float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause; - -float autocvar_g_vehicle_bumblebee_cannon_lock = 0; - -float autocvar_g_vehicle_bumblebee_cannon_turnspeed; -float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down; -float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up; -float autocvar_g_vehicle_bumblebee_cannon_turnlimit_in; -float autocvar_g_vehicle_bumblebee_cannon_turnlimit_out; - - -float autocvar_g_vehicle_bumblebee_raygun_turnspeed; -float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down; -float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up; -float autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides; - -float autocvar_g_vehicle_bumblebee_raygun_range; -float autocvar_g_vehicle_bumblebee_raygun_dps; -float autocvar_g_vehicle_bumblebee_raygun_aps; -float autocvar_g_vehicle_bumblebee_raygun_fps; - -float autocvar_g_vehicle_bumblebee_raygun; -float autocvar_g_vehicle_bumblebee_healgun_hps; -float autocvar_g_vehicle_bumblebee_healgun_hmax; -float autocvar_g_vehicle_bumblebee_healgun_aps; -float autocvar_g_vehicle_bumblebee_healgun_amax; -float autocvar_g_vehicle_bumblebee_healgun_sps; -float autocvar_g_vehicle_bumblebee_healgun_locktime; - -float autocvar_g_vehicle_bumblebee_respawntime; - -float autocvar_g_vehicle_bumblebee_blowup_radius; -float autocvar_g_vehicle_bumblebee_blowup_coredamage; -float autocvar_g_vehicle_bumblebee_blowup_edgedamage; -float autocvar_g_vehicle_bumblebee_blowup_forceintensity; -vector autocvar_g_vehicle_bumblebee_bouncepain; - -float autocvar_g_vehicle_bumblebee = 0; - - -float bumble_raygun_send(entity to, float sf); - -const vector BUMB_MIN = '-130 -130 -130'; -const vector BUMB_MAX = '130 130 130'; - void bumb_fire_cannon(entity _gun, string _tagname, entity _owner) { vector v = gettaginfo(_gun, gettagindex(_gun, _tagname)); diff --git a/qcsrc/server/vehicles/bumblebee.qh b/qcsrc/server/vehicles/bumblebee.qh new file mode 100644 index 000000000..132f1f02d --- /dev/null +++ b/qcsrc/server/vehicles/bumblebee.qh @@ -0,0 +1,142 @@ +#ifndef BUMBLEBEE_H +#define BUMBLEBEE_H + +const float BRG_SETUP = 2; +const float BRG_START = 4; +const float BRG_END = 8; + +#ifdef SVQC +// Auto cvars +float autocvar_g_vehicle_bumblebee_speed_forward; +float autocvar_g_vehicle_bumblebee_speed_strafe; +float autocvar_g_vehicle_bumblebee_speed_up; +float autocvar_g_vehicle_bumblebee_speed_down; +float autocvar_g_vehicle_bumblebee_turnspeed; +float autocvar_g_vehicle_bumblebee_pitchspeed; +float autocvar_g_vehicle_bumblebee_pitchlimit; +float autocvar_g_vehicle_bumblebee_friction; + +float autocvar_g_vehicle_bumblebee_energy; +float autocvar_g_vehicle_bumblebee_energy_regen; +float autocvar_g_vehicle_bumblebee_energy_regen_pause; + +float autocvar_g_vehicle_bumblebee_health; +float autocvar_g_vehicle_bumblebee_health_regen; +float autocvar_g_vehicle_bumblebee_health_regen_pause; + +float autocvar_g_vehicle_bumblebee_shield; +float autocvar_g_vehicle_bumblebee_shield_regen; +float autocvar_g_vehicle_bumblebee_shield_regen_pause; + +float autocvar_g_vehicle_bumblebee_cannon_cost; +float autocvar_g_vehicle_bumblebee_cannon_damage; +float autocvar_g_vehicle_bumblebee_cannon_radius; +float autocvar_g_vehicle_bumblebee_cannon_refire; +float autocvar_g_vehicle_bumblebee_cannon_speed; +float autocvar_g_vehicle_bumblebee_cannon_spread; +float autocvar_g_vehicle_bumblebee_cannon_force; + +float autocvar_g_vehicle_bumblebee_cannon_ammo; +float autocvar_g_vehicle_bumblebee_cannon_ammo_regen; +float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause; + +float autocvar_g_vehicle_bumblebee_cannon_lock = 0; + +float autocvar_g_vehicle_bumblebee_cannon_turnspeed; +float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down; +float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up; +float autocvar_g_vehicle_bumblebee_cannon_turnlimit_in; +float autocvar_g_vehicle_bumblebee_cannon_turnlimit_out; + + +float autocvar_g_vehicle_bumblebee_raygun_turnspeed; +float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down; +float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up; +float autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides; + +float autocvar_g_vehicle_bumblebee_raygun_range; +float autocvar_g_vehicle_bumblebee_raygun_dps; +float autocvar_g_vehicle_bumblebee_raygun_aps; +float autocvar_g_vehicle_bumblebee_raygun_fps; + +float autocvar_g_vehicle_bumblebee_raygun; +float autocvar_g_vehicle_bumblebee_healgun_hps; +float autocvar_g_vehicle_bumblebee_healgun_hmax; +float autocvar_g_vehicle_bumblebee_healgun_aps; +float autocvar_g_vehicle_bumblebee_healgun_amax; +float autocvar_g_vehicle_bumblebee_healgun_sps; +float autocvar_g_vehicle_bumblebee_healgun_locktime; + +float autocvar_g_vehicle_bumblebee_respawntime; + +float autocvar_g_vehicle_bumblebee_blowup_radius; +float autocvar_g_vehicle_bumblebee_blowup_coredamage; +float autocvar_g_vehicle_bumblebee_blowup_edgedamage; +float autocvar_g_vehicle_bumblebee_blowup_forceintensity; +vector autocvar_g_vehicle_bumblebee_bouncepain; + +float autocvar_g_vehicle_bumblebee = 0; + + +float bumble_raygun_send(entity to, float sf); + +const vector BUMB_MIN = '-130 -130 -130'; +const vector BUMB_MAX = '130 130 130'; + +void bumb_fire_cannon(entity _gun, string _tagname, entity _owner); + +float bumb_gunner_frame(); + +void bumb_gunner_exit(float _exitflag); + +float bumb_gunner_enter(); + +float vehicles_valid_pilot(); + +void bumb_touch(); + +void bumb_regen(); + +float bumb_pilot_frame(); + +void bumb_think(); + +void bumb_enter(); + +void bumb_exit(float eject); + +void bumb_blowup(); + +void bumb_diethink(); + +void bumb_die(); + +void bumb_impact(); + +void bumb_spawn(float _f); + +void spawnfunc_vehicle_bumblebee(); + +float bumble_raygun_send(entity to, float sf); +#endif // SVQC + +#ifdef CSQC +/* +.vector raygun_l1 +.vector raygun_l2; +.vector raygun_l3; +*/ + +void bumble_raygun_draw(); + +void bumble_raygun_read(float bIsNew); + +void bumblebee_draw(); + +void bumblebee_draw2d(); + +void bumblebee_read_extra(); + +void vehicle_bumblebee_assemble(); +#endif //CSQC +#endif \ No newline at end of file diff --git a/qcsrc/warpzonelib/common.qh b/qcsrc/warpzonelib/common.qh index 892d326bf..c6ebb8b2d 100644 --- a/qcsrc/warpzonelib/common.qh +++ b/qcsrc/warpzonelib/common.qh @@ -19,6 +19,7 @@ float warpzone_cameras_exist; .float warpzone_fadestart; .float warpzone_fadeend; void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, vector other_ang); +void WarpZone_Camera_SetUp(entity e, vector my_org, vector my_ang); float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig); vector WarpZoneLib_NearestPointOnBox(vector mi, vector ma, vector org);