From: Mario Date: Sat, 24 Jan 2015 08:29:38 +0000 (+1100) Subject: More fun stuff X-Git-Tag: xonotic-v0.8.1~133^2~47^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0017bd2dd09458440a6df647a46b460eb08e2280;p=xonotic%2Fxonotic-data.pk3dir.git More fun stuff --- diff --git a/qcsrc/client/casings.qc b/qcsrc/client/casings.qc index 2225c0f35..5b74e11b5 100644 --- a/qcsrc/client/casings.qc +++ b/qcsrc/client/casings.qc @@ -1,4 +1,4 @@ -.float silent; +.bool silent; void Casing_Delete() { @@ -44,16 +44,15 @@ void Casing_Touch() if(time >= self.nextthink) { string s; - float f; + int f = floor(prandom() * 3) + 1;; - f = floor(prandom() * 3) + 1; switch(self.state) { case 1: - s = strcat("weapons/casings", ftos(f), ".wav"); + s = strcat("weapons/casings", itos(f), ".wav"); break; default: - s = strcat("weapons/brass", ftos(f), ".wav"); + s = strcat("weapons/brass", itos(f), ".wav"); break; } @@ -65,7 +64,7 @@ void Casing_Touch() self.nextthink = time + 0.2; } -void Casing_Damage(float thisdmg, float hittype, vector org, vector thisforce) +void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce) { if(thisforce_z < 0) thisforce_z = 0; diff --git a/qcsrc/client/csqc_constants.qc b/qcsrc/client/csqc_constants.qc index 1794d6e42..b568947bc 100644 --- a/qcsrc/client/csqc_constants.qc +++ b/qcsrc/client/csqc_constants.qc @@ -1,51 +1,51 @@ // Mask Constants (set .drawmask on entities; use R_AddEntities to add all entities based on mask) -const float MASK_ENGINE = 1; -const float MASK_ENGINEVIEWMODELS = 2; -const float MASK_NORMAL = 4; +const int MASK_ENGINE = 1; +const int MASK_ENGINEVIEWMODELS = 2; +const int MASK_NORMAL = 4; // Renderflag Constants (used for CSQC entities) -const float RF_VIEWMODEL = 1; -const float RF_EXTERNALMODEL = 2; -const float RF_DEPTHHACK = 4; -const float RF_ADDITIVE = 8; -const float RF_USEAXIS = 16; +const int RF_VIEWMODEL = 1; +const int RF_EXTERNALMODEL = 2; +const int RF_DEPTHHACK = 4; +const int RF_ADDITIVE = 8; +const int RF_USEAXIS = 16; // Viewflag Constants (use with R_SetView) -const float VF_MIN = 1; //(vector) -const float VF_MIN_X = 2; //(float) -const float VF_MIN_Y = 3; //(float) -const float VF_SIZE = 4; //(vector) (viewport size) -const float VF_SIZE_Y = 5; //(float) -const float VF_SIZE_X = 6; //(float) -const float VF_VIEWPORT = 7; //(vector, vector) -const float VF_FOV = 8; //(vector) -const float VF_FOVX = 9; //(float) -const float VF_FOVY = 10; //(float) -const float VF_ORIGIN = 11; //(vector) -const float VF_ORIGIN_X = 12; //(float) -const float VF_ORIGIN_Y = 13; //(float) -const float VF_ORIGIN_Z = 14; //(float) -const float VF_ANGLES = 15; //(vector) -const float VF_ANGLES_X = 16; //(float) -const float VF_ANGLES_Y = 17; //(float) -const float VF_ANGLES_Z = 18; //(float) -const float VF_DRAWWORLD = 19; //(float) -const float VF_DRAWENGINEHUD = 20; //(float) -const float VF_DRAWCROSSHAIR = 21; //(float) -const float VF_PERSPECTIVE = 200; //(float) - -const float VF_CL_VIEWANGLES = 33; //(vector) -const float VF_CL_VIEWANGLES_X = 34; //(float) -const float VF_CL_VIEWANGLES_Y = 35; //(float) -const float VF_CL_VIEWANGLES_Z = 36; //(float) +const int VF_MIN = 1; //(vector) +const int VF_MIN_X = 2; //(float) +const int VF_MIN_Y = 3; //(float) +const int VF_SIZE = 4; //(vector) (viewport size) +const int VF_SIZE_Y = 5; //(float) +const int VF_SIZE_X = 6; //(float) +const int VF_VIEWPORT = 7; //(vector, vector) +const int VF_FOV = 8; //(vector) +const int VF_FOVX = 9; //(float) +const int VF_FOVY = 10; //(float) +const int VF_ORIGIN = 11; //(vector) +const int VF_ORIGIN_X = 12; //(float) +const int VF_ORIGIN_Y = 13; //(float) +const int VF_ORIGIN_Z = 14; //(float) +const int VF_ANGLES = 15; //(vector) +const int VF_ANGLES_X = 16; //(float) +const int VF_ANGLES_Y = 17; //(float) +const int VF_ANGLES_Z = 18; //(float) +const int VF_DRAWWORLD = 19; //(float) +const int VF_DRAWENGINEHUD = 20; //(float) +const int VF_DRAWCROSSHAIR = 21; //(float) +const int VF_PERSPECTIVE = 200; //(float) + +const int VF_CL_VIEWANGLES = 33; //(vector) +const int VF_CL_VIEWANGLES_X = 34; //(float) +const int VF_CL_VIEWANGLES_Y = 35; //(float) +const int VF_CL_VIEWANGLES_Z = 36; //(float) // Quake-style Point Contents -const float CONTENT_EMPTY = -1; -const float CONTENT_SOLID = -2; -const float CONTENT_WATER = -3; -const float CONTENT_SLIME = -4; -const float CONTENT_LAVA = -5; -const float CONTENT_SKY = -6; +const int CONTENT_EMPTY = -1; +const int CONTENT_SOLID = -2; +const int CONTENT_WATER = -3; +const int CONTENT_SLIME = -4; +const int CONTENT_LAVA = -5; +const int CONTENT_SKY = -6; // Vector / Hull Constants const vector VEC_1 = '1 1 1'; @@ -56,85 +56,85 @@ const vector VEC_HULL_MIN = '-16 -16 -24'; const vector VEC_HULL_MAX = '16 16 32'; // Effect Constants -const float EF_NODRAW = 16; -const float EF_ADDITIVE = 32; -const float EF_BLUE = 64; -const float EF_RED = 128; -const float EF_FULLBRIGHT = 512; -const float EF_FLAME = 1024; -const float EF_STARDUST = 2048; -const float EF_NOSHADOW = 4096; -const float EF_NODEPTHTEST = 8192; +const int EF_NODRAW = 16; +const int EF_ADDITIVE = 32; +const int EF_BLUE = 64; +const int EF_RED = 128; +const int EF_FULLBRIGHT = 512; +const int EF_FLAME = 1024; +const int EF_STARDUST = 2048; +const int EF_NOSHADOW = 4096; +const int EF_NODEPTHTEST = 8192; // Quake Player Flag Constants -const float PFL_ONGROUND = 1; -const float PFL_CROUCH = 2; -const float PFL_DEAD = 4; -const float PFL_GIBBED = 8; +const int PFL_ONGROUND = 1; +const int PFL_CROUCH = 2; +const int PFL_DEAD = 4; +const int PFL_GIBBED = 8; // Quake Temporary Entity Constants -const float TE_SPIKE = 0; -const float TE_SUPERSPIKE = 1; -const float TE_GUNSHOT = 2; -const float TE_EXPLOSION = 3; -const float TE_TAREXPLOSION = 4; -const float TE_LIGHTNING1 = 5; -const float TE_LIGHTNING2 = 6; -const float TE_WIZSPIKE = 7; -const float TE_KNIGHTSPIKE = 8; -const float TE_LIGHTNING3 = 9; -const float TE_LAVASPLASH = 10; -const float TE_TELEPORT = 11; -const float TE_EXPLOSION2 = 12; +const int TE_SPIKE = 0; +const int TE_SUPERSPIKE = 1; +const int TE_GUNSHOT = 2; +const int TE_EXPLOSION = 3; +const int TE_TAREXPLOSION = 4; +const int TE_LIGHTNING1 = 5; +const int TE_LIGHTNING2 = 6; +const int TE_WIZSPIKE = 7; +const int TE_KNIGHTSPIKE = 8; +const int TE_LIGHTNING3 = 9; +const int TE_LAVASPLASH = 10; +const int TE_TELEPORT = 11; +const int TE_EXPLOSION2 = 12; // Darkplaces Additions -const float TE_EXPLOSIONRGB = 53; -const float TE_GUNSHOTQUAD = 57; -const float TE_EXPLOSIONQUAD = 70; +const int TE_EXPLOSIONRGB = 53; +const int TE_GUNSHOTQUAD = 57; +const int TE_EXPLOSIONQUAD = 70; // Math Constants -const float EXTRA_LOW = -99999999; -const float EXTRA_HIGH = 99999999; +const int EXTRA_LOW = -99999999; +const int EXTRA_HIGH = 99999999; // Frik File Constants -const float FILE_READ = 0; -const float FILE_APPEND = 1; -const float FILE_WRITE = 2; +const int FILE_READ = 0; +const int FILE_APPEND = 1; +const int FILE_WRITE = 2; // Button values used by input_buttons -const float BUTTON_ATTACK = 1; -const float BUTTON_JUMP = 2; -const float BUTTON_3 = 4; -const float BUTTON_4 = 8; -const float BUTTON_5 = 16; -const float BUTTON_6 = 32; -const float BUTTON7 = 64; -const float BUTTON8 = 128; -const float BUTTON_USE = 256; -const float BUTTON_CHAT = 512; -const float BUTTON_PRYDONCURSOR = 1024; -const float BUTTON_9 = 2048; -const float BUTTON_10 = 4096; -const float BUTTON_11 = 8192; -const float BUTTON_12 = 16384; -const float BUTTON_13 = 32768; -const float BUTTON_14 = 65536; -const float BUTTON_15 = 131072; -const float BUTTON_16 = 262144; - -const float SOLID_NOT = 0; // no interaction with other objects -const float SOLID_TRIGGER = 1; // touch on edge, but not blocking -const float SOLID_BBOX = 2; // touch on edge, block -const float SOLID_SLIDEBOX = 3; // touch on edge, but not an onground -const float SOLID_BSP = 4; // bsp clip, touch on edge, block -const float SOLID_CORPSE = 5; // same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters) - -const float MOVE_NORMAL = 0; // same as FALSE -const float MOVE_NOMONSTERS = 1; // same as TRUE -const float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE -const float MOVE_HITMODEL = 4; -const float MOVE_WORLDONLY = 3; - -const float CAMERA_FREE = 1; -const float CAMERA_CHASE = 2; - -const float EF_NOMODELFLAGS = 8388608; +const int BUTTON_ATTACK = 1; +const int BUTTON_JUMP = 2; +const int BUTTON_3 = 4; +const int BUTTON_4 = 8; +const int BUTTON_5 = 16; +const int BUTTON_6 = 32; +const int BUTTON7 = 64; +const int BUTTON8 = 128; +const int BUTTON_USE = 256; +const int BUTTON_CHAT = 512; +const int BUTTON_PRYDONCURSOR = 1024; +const int BUTTON_9 = 2048; +const int BUTTON_10 = 4096; +const int BUTTON_11 = 8192; +const int BUTTON_12 = 16384; +const int BUTTON_13 = 32768; +const int BUTTON_14 = 65536; +const int BUTTON_15 = 131072; +const int BUTTON_16 = 262144; + +const int SOLID_NOT = 0; // no interaction with other objects +const int SOLID_TRIGGER = 1; // touch on edge, but not blocking +const int SOLID_BBOX = 2; // touch on edge, block +const int SOLID_SLIDEBOX = 3; // touch on edge, but not an onground +const int SOLID_BSP = 4; // bsp clip, touch on edge, block +const int SOLID_CORPSE = 5; // same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters) + +const int MOVE_NORMAL = 0; // same as FALSE +const int MOVE_NOMONSTERS = 1; // same as TRUE +const int MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE +const int MOVE_HITMODEL = 4; +const int MOVE_WORLDONLY = 3; + +const int CAMERA_FREE = 1; +const int CAMERA_CHASE = 2; + +const int EF_NOMODELFLAGS = 8388608; diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index 162ef6a07..1d97ead13 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -31,11 +31,12 @@ void DamageEffect_Think() pointparticles(self.team, org, '0 0 0', 1); } -void DamageEffect(vector hitorg, float dmg, float type, float specnum) +void DamageEffect(vector hitorg, float dmg, int type, int specnum) { // particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets) - float life, nearestbone = 0; + int nearestbone = 0; + float life; string specstr, effectname; entity e; @@ -104,7 +105,9 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum) void Ent_DamageInfo(float isNew) { - float dmg, rad, edge, thisdmg, forcemul, species, hitplayer = FALSE; + float dmg, rad, edge, thisdmg; + bool hitplayer = FALSE; + int species, forcemul; vector force, thisforce; entity oldself; @@ -329,9 +332,7 @@ void Ent_DamageInfo(float isNew) if(!DEATH_ISSPECIAL(w_deathtype)) if(!hitplayer || rad) // don't show ground impacts for hitscan weapons if a player was hit { - float hitwep; - - hitwep = DEATH_WEAPONOFWEAPONDEATH(w_deathtype); + int hitwep = DEATH_WEAPONOFWEAPONDEATH(w_deathtype); w_random = prandom(); traceline(w_org - normalize(force) * 16, w_org + normalize(force) * 16, MOVE_NOMONSTERS, world); diff --git a/qcsrc/client/effects.qc b/qcsrc/client/effects.qc index c35a3a94a..a515fdb61 100644 --- a/qcsrc/client/effects.qc +++ b/qcsrc/client/effects.qc @@ -30,7 +30,7 @@ void b_make(vector s,vector e, string t,float l,float z) } */ -void cl_effetcs_lightningarc(vector from, vector to,float seglength,float drifts,float drifte,float branchfactor,float branchfactor_add) +void cl_effects_lightningarc(vector from, vector to,float seglength,float drifts,float drifte,float branchfactor,float branchfactor_add) { vector direction,dirnew, pos, pos_l; float length, steps, steplength, i,drift; @@ -58,7 +58,7 @@ void cl_effetcs_lightningarc(vector from, vector to,float seglength,float drifts pos = pos_l + dirnew * steplength; te_lightning1(world,pos_l,pos); if(random() < branchfactor) - cl_effetcs_lightningarc(pos, pos + (dirnew * length * 0.25),seglength,drifts,drifte,min(branchfactor + branchfactor_add,1),branchfactor_add); + cl_effects_lightningarc(pos, pos + (dirnew * length * 0.25),seglength,drifts,drifte,min(branchfactor + branchfactor_add,1),branchfactor_add); pos_l = pos; } @@ -91,7 +91,7 @@ void Net_ReadLightningarc() branchfactor = autocvar_cl_effects_lightningarc_branchfactor_start; branchfactor_add = autocvar_cl_effects_lightningarc_branchfactor_add; - cl_effetcs_lightningarc(from,to,seglength,drifts,drifte,branchfactor,branchfactor_add); + cl_effects_lightningarc(from,to,seglength,drifts,drifte,branchfactor,branchfactor_add); } } diff --git a/qcsrc/common/util-pre.qh b/qcsrc/common/util-pre.qh index 8f36914c1..c23174ce1 100644 --- a/qcsrc/common/util-pre.qh +++ b/qcsrc/common/util-pre.qh @@ -4,6 +4,9 @@ #ifndef QCC_SUPPORT_INT #define int float + +#define stoi(s) stof(s) +#define itos(s) stoi(s) #endif #ifndef QCC_SUPPORT_BOOL @@ -14,6 +17,4 @@ const float true = 1; const float false = 0; const float TRUE = 1; const float FALSE = 0; - -#define stoi(s) stof(s) #endif