1
0
Fork 0
forked from fte/fteqw

*** empty log message ***

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1754 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Magnus 2006-01-02 00:14:21 +00:00
parent 6efc0d6bde
commit d773113378
7 changed files with 174 additions and 74 deletions

View file

@ -485,6 +485,7 @@ void() PutClientInServer =
self.movetype = MOVETYPE_WALK;
self.show_hostile = 0;
self.max_health = 100;
self.health = 100;
self.flags = FL_CLIENT;
self.air_finished = time + 12;
self.dmg = 2; // initial water damage
@ -521,6 +522,17 @@ void() PutClientInServer =
self.angles = spot.angles;
self.fixangle = TRUE; // turn this way immediately
if (self.class == 1)
self.max_health = 80;
if (self.class == 2)
self.max_health = 80;
if (self.class == 3)
self.max_health = 100;
if (self.class == 4)
self.max_health = 60;
self.health = self.max_health;
// oh, this is a hack!
setmodel (self, "progs/eyes.mdl");
modelindex_eyes = self.modelindex;
@ -759,6 +771,66 @@ void() CheckRules =
NextLevel ();
};
void () LocateSpectatorTarget =
{
local float playercnt;
local float total;
local float player;
local entity ke;
local entity de;
if (self.ghost == 1)
{
ke = find (world, classname, "player");
de = find (world, classname, "player");
total = CONTENT_EMPTY;
player = MULTICAST_ALL;
playercnt = MULTICAST_ALL;
while (ke)
{
if (((ke.classname == "player") && (ke.ghost == MULTICAST_ALL)))
{
total = (total + 1);
}
ke = find (ke, classname, "player");
}
while (de)
{
if (((de.classname == "player") && (de.ghost == MULTICAST_ALL)))
{
if ((player == self.ghostcnt))
{
makevectors (de.angles);
self.view2 = de;
self.ghostcnt = (self.ghostcnt + 1);
self.cnt = 0;
sprint(self, 2, "now following ");
sprint(self, 2, de.netname);
sprint(self, 2, ".\n");
if ((self.ghostcnt > total))
self.ghostcnt = 0;
return;
}
player = (player + 1);
if ((self.ghostcnt > total))
{
self.ghostcnt = 0;
}
}
de = find (de, classname, "player");
}
if (player == 0)
{
self.view2 = world;
centerprint (self, "No players found...\n");
return;
}
}
};
//============================================================================
void() PlayerDeathThink =
@ -766,6 +838,9 @@ void() PlayerDeathThink =
local entity old_self;
local float forward;
self.modelindex = modelindex_dead;
if ((self.flags & FL_ONGROUND))
{
forward = vlen (self.velocity);
@ -789,10 +864,16 @@ void() PlayerDeathThink =
if (!self.button2 && !self.button1 && !self.button0)
return;
if (self.dtime < time)
{
LocateSpectatorTarget();
self.dtime = time + 1;
}
self.button0 = 0;
self.button1 = 0;
self.button2 = 0;
respawn();
//respawn();
};
@ -1110,7 +1191,14 @@ void() PlayerPreThink =
DisplayMenu ();
}
self.recoil = self.recoil - 0.2;
if (self.class == 1)
self.recoil = self.recoil - 0.16;
if (self.class == 2)
self.recoil = self.recoil - 0.14;
if (self.class == 3)
self.recoil = self.recoil - 0.12;
if (self.class == 4)
self.recoil = self.recoil - 0.19;
if (self.recoil <= 0)
self.recoil = 0;
@ -1132,6 +1220,14 @@ void() PlayerPreThink =
if (self.health > self.max_health)
self.health = self.max_health;
if (self.ragetime > time)
stuffcmd(self, "v_cshift 75 0 0 75\n");
else if (self.sneak > 0)
stuffcmd(self, "v_cshift 0 75 0 75\n");
else
stuffcmd(self, "v_cshift 0 0 0 0\n");
self.cycle1 = time + 0.5;
}
@ -1152,7 +1248,7 @@ void() PlayerPreThink =
}
if (self.sneak >= 1)
{
self.ammo_cells = self.ammo_cells = 1;
self.ammo_cells = self.ammo_cells - 1;
if (self.ammo_cells <= 0)
{
@ -1422,14 +1518,9 @@ void() PlayerPostThink =
self.jump_flag = self.velocity_z;
if (self.rtime >= 1)
{
if (self.rtime > time)
self.weaponframe = 3;
self.rtime = (self.rtime - 1);
if (self.perk == 3)
self.rtime = (self.rtime - 1);
}
CheckPowerups ();

View file

@ -75,6 +75,9 @@ void(entity targ, entity attacker) Killed =
self.enemy = attacker;
targ.grab = 0;
targ.equipment_state = 0; //turn off stealth-boys, climbing gear, etc
// bump the monster counter
if (self.flags & FL_MONSTER)
{
@ -84,6 +87,9 @@ void(entity targ, entity attacker) Killed =
ClientObituary(self, attacker);
if (self.classname == "player") //so dead players can spectate
self.ghost = 1;
self.takedamage = DAMAGE_NO;
self.touch = SUB_Null;
self.effects = 0;
@ -277,7 +283,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage =
if (self != attacker && attacker != self.enemy)
{
if ( (self.classname != attacker.classname)
|| (self.classname == "monster_army" ) )
|| (self.classname == "monster" ) )
{
if (self.enemy.classname == "player")
self.oldenemy = self.enemy;

View file

@ -562,6 +562,8 @@ float blue_armor;
float red_armor;
.float ghost;
.float ghostcnt;
.float dtime;
.float active;
.float class;
.float vote1;

View file

@ -184,11 +184,9 @@ void (float wt, float cost, float item) BuyWeapon =
if (self.slot2 == 0)
self.slot2 = self.slot1;
if (self.slot1 != 0)
{
DropWeapon (self.slot1, 1, 0);
self.slot1 = 0;
}
if (self.slot2 != 0)
DropWeapon (self.slot2, 1, 0);
GetWeaponModel ();
}
if ((self.current_slot == 2))
@ -197,9 +195,9 @@ void (float wt, float cost, float item) BuyWeapon =
if (self.slot1 == 0)
self.slot1 = self.slot2;
if (self.slot2 != 0)
if (self.slot1 != 0)
{
DropWeapon (self.slot2, 1, 0);
DropWeapon (self.slot1, 1, 0);
self.slot2 = 0;
}
@ -592,11 +590,11 @@ void() W_PlayerMenu =
if (self.impulse == 3)
BuyWeapon(2, 9, 7); //weight, cost, item
if (self.impulse == 4)
BuyWeapon(2, 21, 8); //weight, cost, item
if (self.impulse == 5)
BuyWeapon(3, 14, 13); //weight, cost, item
if (self.impulse == 6)
if (self.impulse == 5)
BuyWeapon(3, 17, 14); //weight, cost, item
if (self.impulse == 6)
BuyWeapon(2, 21, 8); //weight, cost, item
return;
}

View file

@ -160,7 +160,7 @@ void () player_run = [ 137, player_run ]
{
local float crap;
if (self.rtime == 0)
if (self.rtime < time)
self.weaponframe = 0;
if (self.equipment == 7 && self.equipment_state == 1 && self.grab == 1 && !(self.flags & FL_ONGROUND))
@ -204,13 +204,6 @@ void () player_run = [ 137, player_run ]
void () player_reload1 = [ 123, player_reload2 ]
{
if (self.current_slot == 1 && self.slot1 == 26)
sound (self, CHAN_WEAPON, "weapons/shell.wav", WEAPON_SHOTGUN, ATTN_NORM);
else if (self.current_slot == 2 && self.slot2 == 26)
sound (self, CHAN_WEAPON, "weapons/shell.wav", WEAPON_SHOTGUN, ATTN_NORM);
else
sound (self, CHAN_WEAPON, "misc/greload.wav", WEAPON_SHOTGUN, ATTN_NORM);
};
void () player_reload2 = [ 124, player_reload3 ]
@ -268,7 +261,6 @@ void () player_reload14 = [ 136, player_run ]
void () player_creload1 = [ 74, player_creload2 ]
{
sound (self, CHAN_WEAPON, "misc/greload.wav", WEAPON_SHOTGUN, ATTN_NORM);
};
void () player_creload2 = [ 75, player_creload3 ]

View file

@ -22,6 +22,7 @@ void() ExitScreen;
void() CharacterSheet;
void() UseEquipment;
void (float weap, float snd, float drop) DropWeapon;
void() PositionControl;
float () weightx;
void (entity guy, float slot) GetWeaponWeight;
@ -831,7 +832,7 @@ void(float temp_weapon) GetWeaponModel =
else if (temp_weapon == 8)
self.weaponmodel = "progs/v_alien.mdl";
else if (temp_weapon == 9)
self.weaponmodel = "progs/v_pipe.mdl";
self.weaponmodel = "progs/v_piperifle.mdl";
else if (temp_weapon == 10)
self.weaponmodel = "progs/v_double.mdl";
else if (temp_weapon == 11)
@ -841,7 +842,7 @@ void(float temp_weapon) GetWeaponModel =
else if (temp_weapon == 13)
self.weaponmodel = "progs/v_mp9.mdl";
else if (temp_weapon == 14)
self.weaponmodel = "progs/v_mp7.mdl";
self.weaponmodel = "progs/v_mp5.mdl";
else if (temp_weapon == 15)
self.weaponmodel = "progs/v_rangem.mdl";
else if (temp_weapon == 16)
@ -947,7 +948,7 @@ void () ReloadWeapon =
if (self.current_slot != 1 && self.current_slot != 2)
return;
if (self.rtime > 0)
if (self.rtime > time)
return;
if (self.current_slot == 1)
@ -965,7 +966,8 @@ void () ReloadWeapon =
self.mag1 = self.mag1 + 1;
self.ammo1 = self.ammo1 - 1;
self.currentammo = self.mag1;
self.rtime = 50;
self.rtime = time + 0.5;
player_run();
return;
}
sound (self, CHAN_WEAPON, "weapons/reload.wav", TRUE, ATTN_NORM);
@ -975,7 +977,9 @@ void () ReloadWeapon =
self.mag1 = self.mag1 + x;
self.ammo1 = self.ammo1 - x;
self.currentammo = self.mag1;
self.rtime = 200;
self.rtime = time + 2;
player_run();
return;
}
if (self.current_slot == 2)
{
@ -992,7 +996,8 @@ void () ReloadWeapon =
self.mag2 = self.mag2 + 1;
self.ammo2 = self.ammo2 - 1;
self.currentammo = self.mag2;
self.rtime = 50;
self.rtime = time + 0.5;
player_run();
return;
}
sound (self, CHAN_WEAPON, "weapons/reload.wav", TRUE, ATTN_NORM);
@ -1002,7 +1007,9 @@ void () ReloadWeapon =
self.mag2 = self.mag2 + x;
self.ammo2 = self.ammo2 - x;
self.currentammo = self.mag2;
self.rtime = 200;
self.rtime = time + 2;
player_run();
return;
}
};
@ -1074,7 +1081,7 @@ void() W_Attack =
if (W_CheckNoAmmo())
return;
if (self.rtime > 0)
if (self.rtime > time)
return;
if (weap >= 0 && weap <= 4)
@ -1099,9 +1106,9 @@ void() W_Attack =
else if (weap == 12)
W_FireShotgun (1, 5, 6, 160, 3000, 1);
else if (weap == 13)
FireSMG(12, 2, "weapons/mp9.wav", 2000, 0.06);
FireSMG(12, 2, "weapons/mp9.wav", 2000, 0.1);
else if (weap == 14)
FireSMG(12, 2, "weapons/mp7.wav", 2000, 0.06);
FireSMG(12, 2, "weapons/mp7.wav", 2000, 0.1);
else if (weap == 15)
FireAssaultRifle(14, 2, "weapons/rangem.wav", 4000, 0.5);
else if (weap == 16)
@ -1265,6 +1272,7 @@ void () ProneOff =
{
sprint (self, 2, "position: stand.\n");
self.position = 0;
PositionControl();
player_run ();
};
@ -1285,6 +1293,7 @@ void () ProneOn =
self.position = 2;
self.view_ofs = '0 0 -10';
sprint (self, 2, "position: prone.\n");
PositionControl();
};
@ -1292,6 +1301,7 @@ void () DuckOff =
{
sprint (self, 2, "position: stand.\n");
self.position = 0;
PositionControl();
player_run ();
};
@ -1309,8 +1319,8 @@ void () DuckOn =
self.maxspeed = (self.maxspeed * 0.50);
self.position = 1;
self.view_ofs = '0 0 12';
sprint (self, 2, "position: duck.\n");
PositionControl();
};
@ -2189,7 +2199,7 @@ void (float dam, float rec, string snd, float rng, float rate) FireSMG =
void (float dam, float rec, string snd, float rng, float rate) FireAssaultRifle =
{
local float var, var1, var2, zdif, xdif, ydif, true;
local float var, var1, var2, zdif, xdif, ydif, true, z;
local vector dir, source, targ, org, org2, adjust;
local string x;
@ -2197,7 +2207,6 @@ void (float dam, float rec, string snd, float rng, float rate) FireAssaultRifle
self.attack_finished = (time + rate);
if (self.attack == 0 && self.position == POS_STAND)
player_single1 ();
if (self.attack == 0 && self.position >= POS_DUCK)
@ -2214,7 +2223,6 @@ void (float dam, float rec, string snd, float rng, float rate) FireAssaultRifle
if (self.position == 2)
adjust = '0 0 -32';
DropAmmo ();
makevectors (self.v_angle);
if (self.recoil >= 15)
@ -2241,9 +2249,17 @@ void (float dam, float rec, string snd, float rng, float rate) FireAssaultRifle
var = 50;
if (self.velocity != '0 0 0')
var = 400;
if (self.velocity_y < 0)
z = z + (self.velocity_y*-1);
else if (self.velocity_y > 0)
z = z + (self.velocity_y);
if (self.velocity_x < 0)
z = z + (self.velocity_x*-1);
else if (self.velocity_x > 0)
z = z + (self.velocity_x);
var = var + z;
var = var + (40 * self.recoil);
if (self.attack <= 3 && self.position == 1 && self.velocity_z == 0)
@ -2272,16 +2288,18 @@ void (float dam, float rec, string snd, float rng, float rate) FireAssaultRifle
ydif = org2_y - trace_ent.origin_y;
xdif = org2_x - trace_ent.origin_x;
true = 0;
if (((ydif >= CONTENT_SKY) && (ydif <= TE_LIGHTNING2)))
if (ydif >= -6 && ydif <= 6)
true = 1;
if (((xdif >= CONTENT_SKY) && (xdif <= TE_LIGHTNING2)))
if (xdif >= -6 && xdif <= 6)
true = 1;
if (self.attack <= 5 && true == 1 && zdif >= (trace_ent.size_z / 2 * 0.8))
self.critical = 3;
dam = (dam * (1 - trace_fraction));
if (trace_ent.solid != SOLID_BSP)
if (trace_ent.solid != SOLID_BSP && self.critical == 3)
SpawnBlood (org, 1);
else
SpawnBlood (org, 0.5);
if (trace_ent.solid == SOLID_BSP)
SpawnWood (trace_ent, org, 1);
@ -2928,7 +2946,7 @@ void() UseChem =
if (self.chemcount == 0)
self.chem = 0;
self.rtime = 100;
self.rtime = time + 1;
};
void() Bandage =
@ -3890,7 +3908,13 @@ void (vector s_aim, float dam, float var, float ran) W_FireBuckshotSpread1 =
local float true;
makevectors (self.v_angle);
source = (self.origin + '0 0 20');
if (self.position == 0)
source = (self.origin + '0 0 20');
if (self.position == 1)
source = (self.origin + '0 0 4');
if (self.position == 2)
source = (self.origin + '0 0 -12');
targ = ((((((s_aim + ((v_right * random ()) * var)) - ((v_right * random ()) * var)) + ((v_up * random ()) * var)) - ((v_up * random ()) * var)) + (((v_up * random ()) * var) * 0.5)) + (v_forward * ran));
traceline (source, targ, FALSE, self);
if ((trace_fraction == 1))
@ -3994,12 +4018,7 @@ void (float rec, float number, float dam, float var, float ran, float auto) W_Fi
sound (self, CHAN_WEAPON, "weapons/shotgun1.wav", 1.5, ATTN_NORM);
if (self.position == 0)
p_aim = (((((self.origin + '0 0 20' + adjust) + (v_right * var1)) - (v_right * var2)) + (v_up * var3)) - (v_up * var4));
else if (self.position == 1)
p_aim = (((((self.origin + '0 0 4' + adjust) + (v_right * var1)) - (v_right * var2)) + (v_up * var3)) - (v_up * var4));
else if (self.position == 2)
p_aim = (((((self.origin + '0 0 -12' + adjust) + (v_right * var1)) - (v_right * var2)) + (v_up * var3)) - (v_up * var4));
p_aim = (((((self.origin + '0 0 20') + (v_right * var1)) - (v_right * var2)) + (v_up * var3)) - (v_up * var4));
msg_entity = self;
WriteByte (MSG_ONE, SVC_BIGKICK);
@ -4008,26 +4027,15 @@ void (float rec, float number, float dam, float var, float ran, float auto) W_Fi
self.recoil = (self.recoil + 8);
Crosshair();
if ((self.recoil >= 30))
{
if (self.recoil >= 30)
self.recoil = 30;
}
if ((auto == 0))
{
if (auto == 0)
self.attack_finished = (time + 0.5);
}
if ((auto == 1))
{
if (auto == 1)
self.attack_finished = (time + 0.2);
}
if ((weap == DRAW4))
{
self.attack_finished = (time + 0.75);
}
if ((weap == IDLE2A))
{
self.attack_finished = (time + 0.4);
}
dir = aim (self, 10000);
var = SVC_INTERMISSION;
if ((number == MULTICAST_PVS_R))

View file

@ -399,6 +399,9 @@ void() worldspawn =
precache_model ("progs/v_alien.mdl");
precache_model ("progs/v_srifle.mdl");
precache_model ("progs/v_night.mdl");
precache_model ("progs/v_nailer.mdl");
precache_model ("progs/v_piperifle.mdl");
precache_model ("progs/sneak.mdl");
precache_model ("progs/dead.mdl");
precache_model ("progs/hbar.spr");