#include "gibs.qh"
#include "player_skeleton.qh"
-#include "sortlist.qh"
#include "weapons/projectile.qh"
#include "../csqcmodellib/cl_player.qh"
#include "../csqcmodellib/interpolate.qh"
-#include "../warpzonelib/mathlib.qh"
.float death_time;
.int modelflags;
.int count;
.float max_health;
-vector randompos(vector m1, vector m2)
-{
- vector v;
- m2 = m2 - m1;
- v_x = m2_x * random() + m1_x;
- v_y = m2_y * random() + m1_y;
- v_z = m2_z * random() + m1_z;
- return v;
-}
-
void generator_precache()
{
if(generator_precached)
#include "_all.qh"
#include "hud.qh"
-#include "noise.qh"
#include "../common/teams.qh"
#include "../csqcmodellib/interpolate.qh"
#include "../warpzonelib/common.qh"
-#include "../warpzonelib/mathlib.qh"
entityclass(Hook);
class(Hook) .float HookType; // ENT_CLIENT_*
class(Hook) .float HookSilent;
class(Hook) .float HookRange;
-void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg)
-{
- // I want to draw a quad...
- // from and to are MIDPOINTS.
-
- vector axis, thickdir, A, B, C, D;
- float length_tex;
-
- axis = normalize(to - from);
- length_tex = aspect * vlen(to - from) / thickness;
-
- // direction is perpendicular to the view normal, and perpendicular to the axis
- thickdir = normalize(cross(axis, vieworg - from));
-
- A = from - thickdir * (thickness / 2);
- B = from + thickdir * (thickness / 2);
- C = to + thickdir * (thickness / 2);
- D = to - thickdir * (thickness / 2);
-
- R_BeginPolygon(texture, drawflag);
- R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, theAlpha);
- R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, theAlpha);
- R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
- R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
- R_EndPolygon();
-}
-
string Draw_GrapplingHook_trace_callback_tex;
float Draw_GrapplingHook_trace_callback_rnd;
vector Draw_GrapplingHook_trace_callback_rgb;
#include "hud_config.qh"
#include "mapvoting.qh"
#include "scoreboard.qh"
-#include "sortlist.qh"
#include "teamradar.qh"
#include "t_items.qh"
#include "../csqcmodellib/cl_player.qh"
-#include "../warpzonelib/mathlib.qh"
/*
==================
==================
*/
-// a border picture is a texture containing nine parts:
-// 1/4 width: left part
-// 1/2 width: middle part (stretched)
-// 1/4 width: right part
-// divided into
-// 1/4 height: top part
-// 1/2 height: middle part (stretched)
-// 1/4 height: bottom part
-void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
-{
- if (theBorderSize.x < 0 && theBorderSize.y < 0) // draw whole image as it is
- {
- drawpic(theOrigin, pic, theSize, theColor, theAlpha, 0);
- return;
- }
- if (theBorderSize.x == 0 && theBorderSize.y == 0) // no border
- {
- // draw only the central part
- drawsubpic(theOrigin, theSize, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
- return;
- }
-
- vector dX, dY;
- vector width, height;
- vector bW, bH;
- //pic = draw_UseSkinFor(pic);
- width = eX * theSize.x;
- height = eY * theSize.y;
- if(theSize.x <= theBorderSize.x * 2)
- {
- // not wide enough... draw just left and right then
- bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2));
- if(theSize.y <= theBorderSize.y * 2)
- {
- // not high enough... draw just corners
- bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
- drawsubpic(theOrigin, width * 0.5 + height * 0.5, pic, '0 0 0', bW + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width * 0.5, width * 0.5 + height * 0.5, pic, eX - bW, bW + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + height * 0.5, width * 0.5 + height * 0.5, pic, eY - bH, bW + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + theSize * 0.5, width * 0.5 + height * 0.5, pic, eX + eY - bW - bH, bW + bH, theColor, theAlpha, 0);
- }
- else
- {
- dY = theBorderSize.x * eY;
- drawsubpic(theOrigin, width * 0.5 + dY, pic, '0 0 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width * 0.5, width * 0.5 + dY, pic, '0 0 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
- drawsubpic(theOrigin + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0', '0 0.5 0' + bW, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width * 0.5 + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0' + eX - bW, '0 0.5 0' + bW, theColor, theAlpha, 0);
- drawsubpic(theOrigin + height - dY, width * 0.5 + dY, pic, '0 0.75 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width * 0.5 + height - dY, width * 0.5 + dY, pic, '0 0.75 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
- }
- }
- else
- {
- if(theSize.y <= theBorderSize.y * 2)
- {
- // not high enough... draw just top and bottom then
- bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
- dX = theBorderSize.x * eX;
- drawsubpic(theOrigin, dX + height * 0.5, pic, '0 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + dX, width - 2 * dX + height * 0.5, pic, '0.25 0 0', '0.5 0 0' + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width - dX, dX + height * 0.5, pic, '0.75 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + height * 0.5, dX + height * 0.5, pic, '0 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + dX + height * 0.5, width - 2 * dX + height * 0.5, pic, '0.25 0 0' + eY - bH, '0.5 0 0' + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width - dX + height * 0.5, dX + height * 0.5, pic, '0.75 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
- }
- else
- {
- dX = theBorderSize.x * eX;
- dY = theBorderSize.x * eY;
- drawsubpic(theOrigin, dX + dY, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + dX, width - 2 * dX + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + width - dX, dX + dY, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + dY, dX + height - 2 * dY, pic, '0 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + dY + dX, width - 2 * dX + height - 2 * dY, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + dY + width - dX, dX + height - 2 * dY, pic, '0.75 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + height - dY, dX + dY, pic, '0 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + height - dY + dX, width - 2 * dX + dY, pic, '0.25 0.75 0', '0.5 0.25 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + height - dY + width - dX, dX + dY, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
- }
- }
-}
-
vector HUD_Get_Num_Color (float x, float maxvalue)
{
float blinkingamt;
return eX * best_columns + eY * best_rows;
}
-float stringwidth_colors(string s, vector theSize)
-{
- return stringwidth(s, true, theSize);
-}
-
-float stringwidth_nocolors(string s, vector theSize)
-{
- return stringwidth(s, false, theSize);
-}
-
-void drawstringright(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
-{
- position.x -= 2 / 3 * strlen(text) * theScale.x;
- drawstring(position, text, theScale, rgb, theAlpha, flag);
-}
-
-void drawstringcenter(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
-{
- position.x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale.x);
- drawstring(position, text, theScale, rgb, theAlpha, flag);
-}
-
// return the string of the onscreen race timer
string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
{
return 0;
}
-int GetPlayerColorForce(int i)
-{
- if(!teamplay)
- return 0;
- else
- return stof(getplayerkeyvalue(i, "colors")) & 15;
-}
-
-int GetPlayerColor(int i)
-{
- if(!playerslots[i].gotscores) // unconnected
- return NUM_SPECTATOR;
- else if(stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR)
- return NUM_SPECTATOR;
- else
- return GetPlayerColorForce(i);
-}
-
-string GetPlayerName(int i)
-{
- return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
-}
-
-
/*
==================
HUD panels
notify_count = count;
}
-// Timer (#5)
-//
-// TODO: macro
-string seconds_tostring(float sec)
-{
- float minutes;
- minutes = floor(sec / 60);
-
- sec -= minutes * 60;
- return sprintf("%d:%02d", minutes, sec);
-}
-
void HUD_Timer(void)
{
if(intermission == 2) return;
#include "particles.qh"
#include "scoreboard.qh"
#include "shownames.qh"
-#include "sortlist.qh"
#include "tuba.qh"
#include "t_items.qh"
#include "wall.qh"
#include "_all.qh"
#include "hud.qh"
-#include "sortlist.qh"
#include "../common/command/generic.qh"
#include "../csqcmodellib/cl_model.qh"
-#include "../warpzonelib/mathlib.qh"
void AuditLists()
{
return w;
}
-string ColorTranslateRGB(string s)
-{
- if(ColorTranslateMode & 1)
- return strdecolorize(s);
- else
- return s;
-}
-
// decolorizes and team colors the player name when needed
string playername(string thename, float teamid)
{
vector rotate(vector v, float a);
-int ColorTranslateMode;
string ColorTranslateRGB(string s);
+++ /dev/null
-#include "noise.qh"
-#include "_all.qh"
-
-entityclass(Noise);
-class(Noise) .float noise_baccum;
-class(Noise) .float noise_paccum;
-class(Noise) .float noise_paccum2;
-class(Noise) .float noise_paccum3;
-class(Noise) .float noise_bstate;
-
-float Noise_Brown(entity e, float dt)
-{
- e.noise_baccum += random() * sqrt(dt); // same stddev for all dt
- return e.noise_baccum;
-}
-float Noise_Pink(entity e, float dt)
-{
- float f;
- f = dt * 60;
- // http://home.earthlink.net/~ltrammell/tech/pinkalg.htm
- if(random() > pow(0.3190, f))
- e.noise_paccum = 0.34848 * (2 * random() - 1);
- if(random() > pow(0.7756, f))
- e.noise_paccum2 = 0.28768 * (2 * random() - 1);
- if(random() > pow(0.9613, f))
- e.noise_paccum3 = 0.43488 * (2 * random() - 1);
- return e.noise_paccum + e.noise_paccum2 + e.noise_paccum3;
-}
-float Noise_White(entity e, float dt)
-{
- return random() * 2 - 1;
-}
-float Noise_Burst(entity e, float dt, float p)
-{
- if(random() > pow(p, dt))
- e.noise_bstate = !e.noise_bstate;
- return 2 * e.noise_bstate - 1;
-}
+++ /dev/null
-#ifndef NOISE_H
-#define NOISE_H
-
-// noises "usually" start in the range -1..1
-float Noise_Brown(entity e, float dt);
-float Noise_Pink(entity e, float dt);
-float Noise_White(entity e, float dt);
-float Noise_Burst(entity e, float dt, float p); // +1 or -1
-#endif
miscfunctions.qc
modeleffects.qc
movelib.qc
-noise.qc
particles.qc
player_skeleton.qc
rubble.qc
scoreboard.qc
shownames.qc
-sortlist.qc
teamradar.qc
tuba.qc
t_items.qc
../common/notifications.qc
../common/physics.qc
../common/playerstats.qc
-../common/p2mathlib.qc
../common/util.qc
../common/viewloc.qc
../warpzonelib/anglestransform.qc
../warpzonelib/client.qc
../warpzonelib/common.qc
-../warpzonelib/mathlib.qc
../warpzonelib/util_server.qc
../../mod/client/progs.inc
#include "_all.qh"
#include "hud.qh"
-#include "sortlist.qh"
#include "../common/constants.qh"
#include "../common/mapinfo.qh"
+++ /dev/null
-#include "sortlist.qh"
-
-entity Sort_Spawn()
-{
- entity sort;
- sort = spawn();
- sort.sort_next = world;
- sort.chain = sort;
- return sort;
-}
-/*
-entity Sort_New(float(entity,entity) cmp)
-{
- entity sort;
- sort = spawn();
- sort.sort_cmp = cmp;
- sort.sort_next = world;
- sort.chain = sort;
- return sort;
-}
-
-void Sort_Remove(entity sort)
-{
- entity next;
- while(sort.sort_next)
- {
- next = sort.sort_next;
- remove(sort);
- sort = next;
- }
- remove(sort);
-}
-
-void Sort_Add(entity sort, entity ent)
-{
- entity next, parent;
- parent = sort;
- next = sort.sort_next;
- while(next)
- {
- if(!sort.sort_cmp(next, ent))
- break;
- parent = next;
- next = next.sort_next;
- }
- ent.sort_next = next;
- ent.sort_prev = parent;
- parent.sort_next = ent;
- if(next)
- next.sort_prev = ent;
-}
-
-void Sort_Reset(entity sort)
-{
- sort.chain = sort;
-}
-
-float Sort_HasNext(entity sort)
-{
- return (sort.chain.sort_next != world);
-}
-
-entity Sort_Next(entity sort)
-{
- entity next;
- next = sort.chain.sort_next;
- if(!next) {
- next = spawn();
- sort.chain.sort_next = next;
- next.sort_prev = sort.chain;
- next.sort_next = world;
- }
- sort.chain = next;
- return next;
-}
-
-void Sort_Finish(entity sort)
-{
- entity next;
- next = sort.chain;
- if(!next)
- return;
-
- while(next.sort_next)
- {
- sort = next.sort_next;
- next.sort_next = sort.sort_next;
- remove(sort);
- }
-}
-
-entity Sort_Get(entity sort, float i)
-{
- for (; sort.sort_next && i > 0; --i)
- sort = sort.sort_next;
- return sort;
-}
-*/
-
-/*
-void Sort_Erase(entity ent)
-{
- ent.sort_prev.sort_next = ent.sort_next;
- if(ent.sort_next)
- ent.sort_next.sort_prev = ent.sort_prev;
- remove(ent);
-}
-
-void Sort_RemoveOld(entity sort)
-{
- entity tmp;
- for(tmp = sort.sort_next; tmp; tmp = tmp.sort_next)
- {
- if(tmp.frame < time)
- {
- tmp = tmp.sort_prev;
- Sort_Erase(tmp.sort_next);
- }
- }
-}
-*/
+++ /dev/null
-#ifndef SORTLIST_H
-#define SORTLIST_H
-
-entityclass(Sort);
-//.float(entity,entity) sort_cmp;
-class(Sort) .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
#include "../csqcmodellib/interpolate.qh"
-float vlen2d(vector v)
-{
- return sqrt(v.x * v.x + v.y * v.y);
-}
-
-float vlen_maxnorm2d(vector v)
-{
- return max(v.x, v.y, -v.x, -v.y);
-}
-
-float vlen_minnorm2d(vector v)
-{
- return min(max(v.x, -v.x), max(v.y, -v.y));
-}
-
vector teamradar_3dcoord_to_texcoord(vector in)
{
vector out;
float hud_panel_radar_maximized_rotation;
-float vlen2d(vector v);
-
-float vlen_maxnorm2d(vector v);
-
-float vlen_minnorm2d(vector v);
-
vector teamradar_2dcoord_to_texcoord(vector in);
vector teamradar_3dcoord_to_texcoord(vector in);
#include "../common/constants.qh"
#include "../common/util.qh"
-#include "../warpzonelib/mathlib.qh"
#define TUBA_STARTNOTE(i, n) W_Sound(strcat("tuba", (i ? ftos(i) : ""), "_loopnote", ftos(n)))
#include "hud.qh"
#include "hud_config.qh"
#include "mapvoting.qh"
-#include "noise.qh"
#include "scoreboard.qh"
#include "shownames.qh"
#include "../warpzonelib/client.qh"
#include "../warpzonelib/common.qh"
-#include "../warpzonelib/mathlib.qh"
entity porto;
vector polyline[16];
#include "command.qh"
#include "rpn.qh"
-#include "../../warpzonelib/mathlib.qh"
// ========================================
// RPN command code, written by divVerent
const int HUD_NORMAL = 0;
const int HUD_BUMBLEBEE_GUN = 25;
-const vector eX = '1 0 0';
-const vector eY = '0 1 0';
-const vector eZ = '0 0 1';
-
// moved that here so the client knows the max.
// # of maps, I'll use arrays for them :P
const int MAPVOTE_COUNT = 30;
+++ /dev/null
-/*
- Copyright (C) 2015 Micah Talkiewicz.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-vector vec_bias(vector v, float f){
- vector c;
- c_x = v_x + f;
- c_y = v_y + f;
- c_z = v_z + f;
- return c;
-}
-vector vec_to_min (vector a, vector b) {
- vector c;
- c_x = min (a_x, b_x);
- c_y = min (a_y, b_y);
- c_z = min (a_z, b_z);
- return c;
-}
-
-vector vec_to_max (vector a, vector b) {
- vector c;
- c_x = max (a_x, b_x);
- c_y = max (a_y, b_y);
- c_z = max (a_z, b_z);
- return c;
-}
-
-// there may already be a function for bounding a vector in this manner, however my very quick search did not reveal one -- Player_2
-vector vec_bounds_in (vector point, vector a, vector b) {
- vector c, d, e;
-
- d = vec_to_min(a,b);
- e = vec_to_max(a,b);
-
- c = vec_to_max(point, d);
- c = vec_to_min(c, e);
-
- return c;
-
-}
-
-vector vec_bounds_out (vector point, vector a, vector b) {
- vector c, d, e;
-
- d = vec_to_max(a,b);
- e = vec_to_min(a,b);
-
- c = vec_to_max(point, d);
- c = vec_to_min(c, e);
-
- return c;
-
-}
-
-float angle_snap_f (float f, float increment){
-
- float i;
- for (i = 0; i <= 360; ){
- if (f <= i - increment)
- return i - increment;
- i = i + increment;
- }
-
- return 0;
-}
-
-vector angle_snap_vec (vector v, float increment) {
- vector c;
- c_x = angle_snap_f (v_x, increment);
- c_y = angle_snap_f (v_y, increment);
- c_z = angle_snap_f (v_z, increment);
- return c;
-}
-
-vector aim_vec (vector origin, vector target) {
- vector v;
- //we float around x and y, but rotate around z
- v_x = target_x - origin_x;
- v_y = target_y - origin_y;
- v_z = origin_z - target_z;
- //get the angles actual
- return vectoangles(normalize(v));
-}
+++ /dev/null
-/*
- Copyright (C) 2015 Micah Talkiewicz.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-vector vec_bias(vector v, float f);
-
-
-vector vec_to_min (vector a, vector b);
-vector vec_to_max (vector a, vector b);
-
-// there may already be a function for bounding a vector in this manner, however my very quick search did not reveal one -- Player_2
-vector vec_bounds_in (vector point, vector a, vector b);
-vector vec_bounds_out (vector point, vector a, vector b);
-
-float angle_snap_f (float f, float increment);
-vector angle_snap_vec (vector v, float increment);
-
-vector aim_vec (vector origin, vector target);
#include "../dpdefs/csprogsdefs.qh"
#include "../client/defs.qh"
#include "constants.qh"
- #include "../warpzonelib/mathlib.qh"
#include "../client/mutators/events.qh"
#include "mapinfo.qh"
#include "notifications.qh"
#elif defined(SVQC)
#include "../dpdefs/progsdefs.qh"
#include "../dpdefs/dpextensions.qh"
- #include "../warpzonelib/mathlib.qh"
#include "constants.qh"
#include "../server/autocvars.qh"
#include "../server/defs.qh"
#include "../constants.qh"
#include "../stats.qh"
#include "../../warpzonelib/anglestransform.qh"
- #include "../../warpzonelib/mathlib.qh"
#include "../../warpzonelib/common.qh"
#include "../../warpzonelib/client.qh"
#include "../util.qh"
#include "../../dpdefs/progsdefs.qh"
#include "../../dpdefs/dpextensions.qh"
#include "../../warpzonelib/anglestransform.qh"
- #include "../../warpzonelib/mathlib.qh"
#include "../../warpzonelib/common.qh"
#include "../../warpzonelib/util_server.qh"
#include "../../warpzonelib/server.qh"
#include "../dpdefs/csprogsdefs.qh"
#include "../client/defs.qh"
#include "../common/constants.qh"
- #include "../common/p2mathlib.qh"
#include "../common/stats.qh"
#include "../common/util.qh"
#include "interpolate.qh"
--- /dev/null
+#ifdef CSQC
+#ifndef DRAW_H
+#define DRAW_H
+
+#include "I18N.qh"
+#include "Vector.qh"
+
+#include "../client/defs.qh"
+
+void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg)
+{
+ // I want to draw a quad...
+ // from and to are MIDPOINTS.
+
+ vector axis, thickdir, A, B, C, D;
+ float length_tex;
+
+ axis = normalize(to - from);
+ length_tex = aspect * vlen(to - from) / thickness;
+
+ // direction is perpendicular to the view normal, and perpendicular to the axis
+ thickdir = normalize(cross(axis, vieworg - from));
+
+ A = from - thickdir * (thickness / 2);
+ B = from + thickdir * (thickness / 2);
+ C = to + thickdir * (thickness / 2);
+ D = to - thickdir * (thickness / 2);
+
+ R_BeginPolygon(texture, drawflag);
+ R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, theAlpha);
+ R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, theAlpha);
+ R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
+ R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
+ R_EndPolygon();
+}
+
+// a border picture is a texture containing nine parts:
+// 1/4 width: left part
+// 1/2 width: middle part (stretched)
+// 1/4 width: right part
+// divided into
+// 1/4 height: top part
+// 1/2 height: middle part (stretched)
+// 1/4 height: bottom part
+void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
+{
+ if (theBorderSize.x < 0 && theBorderSize.y < 0) // draw whole image as it is
+ {
+ drawpic(theOrigin, pic, theSize, theColor, theAlpha, 0);
+ return;
+ }
+ if (theBorderSize.x == 0 && theBorderSize.y == 0) // no border
+ {
+ // draw only the central part
+ drawsubpic(theOrigin, theSize, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
+ return;
+ }
+
+ vector dX, dY;
+ vector width, height;
+ vector bW, bH;
+ //pic = draw_UseSkinFor(pic);
+ width = eX * theSize.x;
+ height = eY * theSize.y;
+ if(theSize.x <= theBorderSize.x * 2)
+ {
+ // not wide enough... draw just left and right then
+ bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2));
+ if(theSize.y <= theBorderSize.y * 2)
+ {
+ // not high enough... draw just corners
+ bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
+ drawsubpic(theOrigin, width * 0.5 + height * 0.5, pic, '0 0 0', bW + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5, width * 0.5 + height * 0.5, pic, eX - bW, bW + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height * 0.5, width * 0.5 + height * 0.5, pic, eY - bH, bW + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + theSize * 0.5, width * 0.5 + height * 0.5, pic, eX + eY - bW - bH, bW + bH, theColor, theAlpha, 0);
+ }
+ else
+ {
+ dY = theBorderSize.x * eY;
+ drawsubpic(theOrigin, width * 0.5 + dY, pic, '0 0 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5, width * 0.5 + dY, pic, '0 0 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0', '0 0.5 0' + bW, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5 + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0' + eX - bW, '0 0.5 0' + bW, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY, width * 0.5 + dY, pic, '0 0.75 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5 + height - dY, width * 0.5 + dY, pic, '0 0.75 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
+ }
+ }
+ else
+ {
+ if(theSize.y <= theBorderSize.y * 2)
+ {
+ // not high enough... draw just top and bottom then
+ bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
+ dX = theBorderSize.x * eX;
+ drawsubpic(theOrigin, dX + height * 0.5, pic, '0 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dX, width - 2 * dX + height * 0.5, pic, '0.25 0 0', '0.5 0 0' + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width - dX, dX + height * 0.5, pic, '0.75 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height * 0.5, dX + height * 0.5, pic, '0 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dX + height * 0.5, width - 2 * dX + height * 0.5, pic, '0.25 0 0' + eY - bH, '0.5 0 0' + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width - dX + height * 0.5, dX + height * 0.5, pic, '0.75 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
+ }
+ else
+ {
+ dX = theBorderSize.x * eX;
+ dY = theBorderSize.x * eY;
+ drawsubpic(theOrigin, dX + dY, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dX, width - 2 * dX + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width - dX, dX + dY, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY, dX + height - 2 * dY, pic, '0 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY + dX, width - 2 * dX + height - 2 * dY, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY + width - dX, dX + height - 2 * dY, pic, '0.75 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY, dX + dY, pic, '0 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY + dX, width - 2 * dX + dY, pic, '0.25 0.75 0', '0.5 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY + width - dX, dX + dY, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ }
+ }
+}
+
+void drawstringright(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
+{
+ position.x -= 2 / 3 * strlen(text) * theScale.x;
+ drawstring(position, text, theScale, rgb, theAlpha, flag);
+}
+
+void drawstringcenter(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
+{
+ position.x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale.x);
+ drawstring(position, text, theScale, rgb, theAlpha, flag);
+}
+
+#endif
+#endif
--- /dev/null
+#ifdef CSQC
+#ifndef PLAYER_H
+#define PLAYER_H
+
+#include "String.qh"
+
+#include "../client/main.qh"
+#include "../common/teams.qh"
+
+int GetPlayerColorForce(int i)
+{
+ if(!teamplay)
+ return 0;
+ else
+ return stof(getplayerkeyvalue(i, "colors")) & 15;
+}
+
+int GetPlayerColor(int i)
+{
+ if(!playerslots[i].gotscores) // unconnected
+ return NUM_SPECTATOR;
+ else if(stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR)
+ return NUM_SPECTATOR;
+ else
+ return GetPlayerColorForce(i);
+}
+
+string GetPlayerName(int i)
+{
+ return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
+}
+
+#endif
+#endif
--- /dev/null
+#ifndef STRING_H
+#define STRING_H
+
+#ifndef SVQC
+float stringwidth_colors(string s, vector theSize)
+{
+ return stringwidth(s, true, theSize);
+}
+
+float stringwidth_nocolors(string s, vector theSize)
+{
+ return stringwidth(s, false, theSize);
+}
+#endif
+
+// Timer (#5)
+//
+// TODO: macro
+string seconds_tostring(float sec)
+{
+ float minutes;
+ minutes = floor(sec / 60);
+
+ sec -= minutes * 60;
+ return sprintf("%d:%02d", minutes, sec);
+}
+
+int ColorTranslateMode;
+
+string ColorTranslateRGB(string s)
+{
+ if(ColorTranslateMode & 1)
+ return strdecolorize(s);
+ else
+ return s;
+}
+
+#endif
--- /dev/null
+#ifndef VECTOR_H
+#define VECTOR_H
+
+const vector eX = '1 0 0';
+const vector eY = '0 1 0';
+const vector eZ = '0 0 1';
+
+vector randompos(vector m1, vector m2)
+{
+ vector v;
+ m2 = m2 - m1;
+ v_x = m2_x * random() + m1_x;
+ v_y = m2_y * random() + m1_y;
+ v_z = m2_z * random() + m1_z;
+ return v;
+}
+
+float vlen2d(vector v)
+{
+ return sqrt(v.x * v.x + v.y * v.y);
+}
+
+float vlen_maxnorm2d(vector v)
+{
+ return max(v.x, v.y, -v.x, -v.y);
+}
+
+float vlen_minnorm2d(vector v)
+{
+ return min(max(v.x, -v.x), max(v.y, -v.y));
+}
+
+
+#endif
+#include "../warpzonelib/mathlib.qc"
+
#include "Accumulate.qh"
#include "Counting.qh"
#include "Cvar.qh"
+#include "Draw.qh"
#include "I18N.qh"
#include "Lazy.qh"
#include "Nil.qh"
+#include "noise.qc"
#include "OO.qh"
+#include "p2mathlib.qc"
+#include "Player.qh"
#include "prandom.qc"
#include "Progname.qh"
#include "Registry.qh"
+#include "sortlist.qc"
+#include "String.qh"
#include "test.qc"
#include "urllib.qc"
+#include "Vector.qh"
--- /dev/null
+// noises "usually" start in the range -1..1
+entityclass(Noise);
+class(Noise) .float noise_baccum;
+class(Noise) .float noise_paccum;
+class(Noise) .float noise_paccum2;
+class(Noise) .float noise_paccum3;
+class(Noise) .float noise_bstate;
+
+float Noise_Brown(entity e, float dt)
+{
+ e.noise_baccum += random() * sqrt(dt); // same stddev for all dt
+ return e.noise_baccum;
+}
+float Noise_Pink(entity e, float dt)
+{
+ float f;
+ f = dt * 60;
+ // http://home.earthlink.net/~ltrammell/tech/pinkalg.htm
+ if(random() > pow(0.3190, f))
+ e.noise_paccum = 0.34848 * (2 * random() - 1);
+ if(random() > pow(0.7756, f))
+ e.noise_paccum2 = 0.28768 * (2 * random() - 1);
+ if(random() > pow(0.9613, f))
+ e.noise_paccum3 = 0.43488 * (2 * random() - 1);
+ return e.noise_paccum + e.noise_paccum2 + e.noise_paccum3;
+}
+float Noise_White(entity e, float dt)
+{
+ return random() * 2 - 1;
+}
+/** +1 or -1 */
+float Noise_Burst(entity e, float dt, float p)
+{
+ if(random() > pow(p, dt))
+ e.noise_bstate = !e.noise_bstate;
+ return 2 * e.noise_bstate - 1;
+}
--- /dev/null
+/*
+ Copyright (C) 2015 Micah Talkiewicz.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+vector vec_bias(vector v, float f){
+ vector c;
+ c_x = v_x + f;
+ c_y = v_y + f;
+ c_z = v_z + f;
+ return c;
+}
+vector vec_to_min (vector a, vector b) {
+ vector c;
+ c_x = min (a_x, b_x);
+ c_y = min (a_y, b_y);
+ c_z = min (a_z, b_z);
+ return c;
+}
+
+vector vec_to_max (vector a, vector b) {
+ vector c;
+ c_x = max (a_x, b_x);
+ c_y = max (a_y, b_y);
+ c_z = max (a_z, b_z);
+ return c;
+}
+
+// there may already be a function for bounding a vector in this manner, however my very quick search did not reveal one -- Player_2
+vector vec_bounds_in (vector point, vector a, vector b) {
+ vector c, d, e;
+
+ d = vec_to_min(a,b);
+ e = vec_to_max(a,b);
+
+ c = vec_to_max(point, d);
+ c = vec_to_min(c, e);
+
+ return c;
+
+}
+
+vector vec_bounds_out (vector point, vector a, vector b) {
+ vector c, d, e;
+
+ d = vec_to_max(a,b);
+ e = vec_to_min(a,b);
+
+ c = vec_to_max(point, d);
+ c = vec_to_min(c, e);
+
+ return c;
+
+}
+
+float angle_snap_f (float f, float increment){
+
+ float i;
+ for (i = 0; i <= 360; ){
+ if (f <= i - increment)
+ return i - increment;
+ i = i + increment;
+ }
+
+ return 0;
+}
+
+vector angle_snap_vec (vector v, float increment) {
+ vector c;
+ c_x = angle_snap_f (v_x, increment);
+ c_y = angle_snap_f (v_y, increment);
+ c_z = angle_snap_f (v_z, increment);
+ return c;
+}
+
+vector aim_vec (vector origin, vector target) {
+ vector v;
+ //we float around x and y, but rotate around z
+ v_x = target_x - origin_x;
+ v_y = target_y - origin_y;
+ v_z = origin_z - target_z;
+ //get the angles actual
+ return vectoangles(normalize(v));
+}
--- /dev/null
+/*
+ Copyright (C) 2015 Micah Talkiewicz.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+vector vec_bias(vector v, float f);
+
+
+vector vec_to_min (vector a, vector b);
+vector vec_to_max (vector a, vector b);
+
+// there may already be a function for bounding a vector in this manner, however my very quick search did not reveal one -- Player_2
+vector vec_bounds_in (vector point, vector a, vector b);
+vector vec_bounds_out (vector point, vector a, vector b);
+
+float angle_snap_f (float f, float increment);
+vector angle_snap_vec (vector v, float increment);
+
+vector aim_vec (vector origin, vector target);
#include "prandom.qh"
-#include "../warpzonelib/mathlib.qh"
-
// prandom - PREDICTABLE random number generator (not seeded yet)
#ifdef USE_PRANDOM
--- /dev/null
+#include "sortlist.qh"
+
+entity Sort_Spawn()
+{
+ entity sort;
+ sort = spawn();
+ sort.sort_next = NULL;
+ sort.chain = sort;
+ return sort;
+}
+/*
+entity Sort_New(float(entity,entity) cmp)
+{
+ entity sort;
+ sort = spawn();
+ sort.sort_cmp = cmp;
+ sort.sort_next = world;
+ sort.chain = sort;
+ return sort;
+}
+
+void Sort_Remove(entity sort)
+{
+ entity next;
+ while(sort.sort_next)
+ {
+ next = sort.sort_next;
+ remove(sort);
+ sort = next;
+ }
+ remove(sort);
+}
+
+void Sort_Add(entity sort, entity ent)
+{
+ entity next, parent;
+ parent = sort;
+ next = sort.sort_next;
+ while(next)
+ {
+ if(!sort.sort_cmp(next, ent))
+ break;
+ parent = next;
+ next = next.sort_next;
+ }
+ ent.sort_next = next;
+ ent.sort_prev = parent;
+ parent.sort_next = ent;
+ if(next)
+ next.sort_prev = ent;
+}
+
+void Sort_Reset(entity sort)
+{
+ sort.chain = sort;
+}
+
+float Sort_HasNext(entity sort)
+{
+ return (sort.chain.sort_next != world);
+}
+
+entity Sort_Next(entity sort)
+{
+ entity next;
+ next = sort.chain.sort_next;
+ if(!next) {
+ next = spawn();
+ sort.chain.sort_next = next;
+ next.sort_prev = sort.chain;
+ next.sort_next = world;
+ }
+ sort.chain = next;
+ return next;
+}
+
+void Sort_Finish(entity sort)
+{
+ entity next;
+ next = sort.chain;
+ if(!next)
+ return;
+
+ while(next.sort_next)
+ {
+ sort = next.sort_next;
+ next.sort_next = sort.sort_next;
+ remove(sort);
+ }
+}
+
+entity Sort_Get(entity sort, float i)
+{
+ for (; sort.sort_next && i > 0; --i)
+ sort = sort.sort_next;
+ return sort;
+}
+*/
+
+/*
+void Sort_Erase(entity ent)
+{
+ ent.sort_prev.sort_next = ent.sort_next;
+ if(ent.sort_next)
+ ent.sort_next.sort_prev = ent.sort_prev;
+ remove(ent);
+}
+
+void Sort_RemoveOld(entity sort)
+{
+ entity tmp;
+ for(tmp = sort.sort_next; tmp; tmp = tmp.sort_next)
+ {
+ if(tmp.frame < time)
+ {
+ tmp = tmp.sort_prev;
+ Sort_Erase(tmp.sort_next);
+ }
+ }
+}
+*/
--- /dev/null
+#ifndef SORTLIST_H
+#define SORTLIST_H
+
+entityclass(Sort);
+//.float(entity,entity) sort_cmp;
+class(Sort) .entity chain, 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
../common/vehicles/all.qc
../common/weapons/all.qc
-../warpzonelib/mathlib.qc
../../mod/menu/progs.inc
-#include "../../warpzonelib/mathlib.qh"
-
#ifndef SLIDER_DECIBELS_H
#define SLIDER_DECIBELS_H
#include "slider.qc"
#include "../dpdefs/progsdefs.qh"
#include "../dpdefs/dpextensions.qh"
-#include "../warpzonelib/mathlib.qh"
#include "command/common.qh"
#include "../../common/monsters/sv_monsters.qh"
-#include "../../warpzonelib/mathlib.qh"
void PutObserverInServer (void);
#include "../../common/stats.qh"
#include "../../common/teams.qh"
-#include "../../warpzonelib/mathlib.qh"
#include "../../warpzonelib/server.qh"
#include "../../warpzonelib/util_server.qh"
#endif
#include "../../warpzonelib/common.qh"
-#include "../../warpzonelib/mathlib.qh"
void ctf_FakeTimeLimit(entity e, float t)
{
#include "../controlpoint.qh"
#include "../generator.qh"
-vector randompos(vector m1, vector m2)
-{
- vector v;
- m2 = m2 - m1;
- v_x = m2_x * random() + m1_x;
- v_y = m2_y * random() + m1_y;
- v_z = m2_z * random() + m1_z;
- return v;
-}
-
// =======================
// CaptureShield Functions
// =======================
#include "../../common/monsters/all.qh"
#include "../../warpzonelib/anglestransform.qh"
-#include "../../warpzonelib/mathlib.qh"
#include "../../warpzonelib/server.qh"
#include "../../warpzonelib/util_server.qh"
#include "../../dpdefs/progsdefs.qh"
#include "../../dpdefs/dpextensions.qh"
#include "../../warpzonelib/anglestransform.qh"
- #include "../../warpzonelib/mathlib.qh"
#include "../../warpzonelib/common.qh"
#include "../../warpzonelib/util_server.qh"
#include "../../warpzonelib/server.qh"
../common/notifications.qc
../common/physics.qc
../common/playerstats.qc
-../common/p2mathlib.qc
../common/viewloc.qc
../common/triggers/include.qc
../common/util.qc
../warpzonelib/anglestransform.qc
../warpzonelib/common.qc
-../warpzonelib/mathlib.qc
../warpzonelib/server.qc
../warpzonelib/util_server.qc
#include "../csqcmodellib/sv_model.qh"
#include "../warpzonelib/common.qh"
-#include "../warpzonelib/mathlib.qh"
#include "../warpzonelib/util_server.qh"
.float height;