Fix armor indirection bug. The compiler ought to warn about name conflicts like these.
This commit is contained in:
parent
68669fb701
commit
4d201c281b
10 changed files with 3480 additions and 3446 deletions
|
@ -22,7 +22,8 @@ Draws a little notification for anyone using voice chat
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Voice_DrawHUD(void) {
|
Voice_DrawHUD(void)
|
||||||
|
{
|
||||||
vector pos = video_mins + [video_res[0] - 160, video_res[1] - 136];
|
vector pos = video_mins + [video_res[0] - 160, video_res[1] - 136];
|
||||||
|
|
||||||
for (int i = -1; i > -32; i--) {
|
for (int i = -1; i > -32; i--) {
|
||||||
|
@ -61,7 +62,6 @@ Voice_DrawHUD(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
Player_PreDraw
|
Player_PreDraw
|
||||||
|
@ -74,10 +74,10 @@ Voice_Draw3D(entity t)
|
||||||
vector vpos = t.origin + [0,0,48];
|
vector vpos = t.origin + [0,0,48];
|
||||||
makevectors(view_angles);
|
makevectors(view_angles);
|
||||||
R_BeginPolygon("gfx/vgui/icntlk_pl");
|
R_BeginPolygon("gfx/vgui/icntlk_pl");
|
||||||
R_PolygonVertex(vpos + v_right*8 - v_up*8, '1 1', [1,1,1], 1);
|
R_PolygonVertex(vpos + v_right * 8 - v_up * 8, [1,1], [1,1,1], 1.0f);
|
||||||
R_PolygonVertex(vpos - v_right*8 - v_up*8, '0 1', [1,1,1], 1);
|
R_PolygonVertex(vpos - v_right * 8 - v_up * 8, [0,1], [1,1,1], 1.0f);
|
||||||
R_PolygonVertex(vpos - v_right*8 + v_up*8, '0 0', [1,1,1], 1);
|
R_PolygonVertex(vpos - v_right * 8 + v_up * 8, [0,0], [1,1,1], 1.0f);
|
||||||
R_PolygonVertex(vpos + v_right*8 + v_up*8, '1 0', [1,1,1], 1);
|
R_PolygonVertex(vpos + v_right * 8 + v_up * 8, [1,0], [1,1,1], 1.0f);
|
||||||
R_EndPolygon();
|
R_EndPolygon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,14 +58,15 @@ void func_recharge::PlayerUse(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eActivator.armor >= 100) {
|
base_player pl = (base_player)eActivator;
|
||||||
|
if (pl.armor >= 100) {
|
||||||
eActivator.gflags &= ~GF_USE_RELEASED;
|
eActivator.gflags &= ~GF_USE_RELEASED;
|
||||||
sound(this, CHAN_VOICE, m_strSndDone, 1.0, ATTN_NORM);
|
sound(this, CHAN_VOICE, m_strSndDone, 1.0, ATTN_NORM);
|
||||||
} else {
|
} else {
|
||||||
if (m_eUser == world) {
|
if (m_eUser == world) {
|
||||||
sound(this, CHAN_ITEM, m_strSndCharging, 1.0, ATTN_NORM);
|
sound(this, CHAN_ITEM, m_strSndCharging, 1.0, ATTN_NORM);
|
||||||
}
|
}
|
||||||
eActivator.armor = bound(0, eActivator.armor += 1, 100);
|
pl.armor = bound(0, pl.armor += 1, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_eUser = eActivator;
|
m_eUser = eActivator;
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#define CLASSEXPORT(classname,classa) void classname(void) { spawnfunc_##classa(); }
|
#define CLASSEXPORT(classname,classa) void classname(void) { spawnfunc_##classa(); }
|
||||||
|
|
||||||
var int autocvar_mp_flashlight = TRUE;
|
var int autocvar_mp_flashlight = TRUE;
|
||||||
var int g_hlbsp_materials = FALSE;
|
|
||||||
|
|
||||||
void FX_Impact(int, vector, vector);
|
void FX_Impact(int, vector, vector);
|
||||||
void FX_Explosion(vector);
|
void FX_Explosion(vector);
|
||||||
|
@ -55,7 +54,6 @@ entity g_eAttacker;
|
||||||
.int iBleeds;
|
.int iBleeds;
|
||||||
.entity eUser;
|
.entity eUser;
|
||||||
.float material;
|
.float material;
|
||||||
.float armor;
|
|
||||||
.float deaths;
|
.float deaths;
|
||||||
.float fStepTime;
|
.float fStepTime;
|
||||||
|
|
||||||
|
|
|
@ -150,10 +150,8 @@ void initents(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fileMaterial);
|
fclose(fileMaterial);
|
||||||
g_hlbsp_materials = TRUE;
|
|
||||||
} else {
|
} else {
|
||||||
print("Failed to load sound/materials.txt!\n");
|
print("Failed to load sound/materials.txt!\n");
|
||||||
g_hlbsp_materials = FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,6 @@ Footsteps_HLBSP(entity target)
|
||||||
string mat_name = "";
|
string mat_name = "";
|
||||||
string tex_name = "";
|
string tex_name = "";
|
||||||
|
|
||||||
if (!g_hlbsp_materials) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
traceline(target.origin + target.view_ofs, target.origin + [0,0,-48], FALSE, target);
|
traceline(target.origin + target.view_ofs, target.origin + [0,0,-48], FALSE, target);
|
||||||
tex_name = getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos));
|
tex_name = getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos));
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
void
|
void
|
||||||
Damage_Apply(entity t, entity c, float dmg, int w, int type)
|
Damage_Apply(entity t, entity c, float dmg, int w, int type)
|
||||||
{
|
{
|
||||||
|
base_player tp = (base_player)t;
|
||||||
|
|
||||||
CGameRules rules = (CGameRules)g_grMode;
|
CGameRules rules = (CGameRules)g_grMode;
|
||||||
if (t.flags & FL_GODMODE) {
|
if (t.flags & FL_GODMODE) {
|
||||||
return;
|
return;
|
||||||
|
@ -30,20 +32,20 @@ Damage_Apply(entity t, entity c, float dmg, int w, int type)
|
||||||
|
|
||||||
/* skip armor */
|
/* skip armor */
|
||||||
if not (type & DMG_SKIP_ARMOR)
|
if not (type & DMG_SKIP_ARMOR)
|
||||||
if (t.armor && dmg > 0) {
|
if (tp.armor && dmg > 0) {
|
||||||
float flArmor;
|
float flArmor;
|
||||||
float flNewDamage;
|
float flNewDamage;
|
||||||
|
|
||||||
flNewDamage = dmg * 0.2;
|
flNewDamage = dmg * 0.2;
|
||||||
flArmor = (dmg - flNewDamage) * 0.5;
|
flArmor = (dmg - flNewDamage) * 0.5;
|
||||||
|
|
||||||
if (flArmor > t.armor) {
|
if (flArmor > tp.armor) {
|
||||||
flArmor = t.armor;
|
flArmor = tp.armor;
|
||||||
flArmor *= (1/0.5);
|
flArmor *= (1/0.5);
|
||||||
flNewDamage = dmg - flArmor;
|
flNewDamage = dmg - flArmor;
|
||||||
t.armor = 0;
|
tp.armor = 0;
|
||||||
} else {
|
} else {
|
||||||
t.armor -= flArmor;
|
tp.armor -= flArmor;
|
||||||
}
|
}
|
||||||
dmg = flNewDamage;
|
dmg = flNewDamage;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,14 +39,16 @@ void item_battery::touch(void)
|
||||||
if (other.classname != "player") {
|
if (other.classname != "player") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base_player pl = (base_player)other;
|
||||||
|
|
||||||
if (other.armor >= 100) {
|
if (pl.armor >= 100) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Move this somewhere else? */
|
/* Move this somewhere else? */
|
||||||
other.armor += Skill_GetValue("battery");
|
pl.armor += Skill_GetValue("battery");
|
||||||
if (other.armor > 100) {
|
if (pl.armor > 100) {
|
||||||
other.armor = 100;
|
pl.armor = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging_Pickup(other, this, __NULL__);
|
Logging_Pickup(other, this, __NULL__);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -59,8 +59,8 @@ class base_player
|
||||||
int old_flags;
|
int old_flags;
|
||||||
int old_activeweapon;
|
int old_activeweapon;
|
||||||
int old_items;
|
int old_items;
|
||||||
int old_health;
|
float old_health;
|
||||||
int old_armor;
|
float old_armor;
|
||||||
int old_movetype;
|
int old_movetype;
|
||||||
float old_viewofs;
|
float old_viewofs;
|
||||||
int old_baseframe;
|
int old_baseframe;
|
||||||
|
|
|
@ -31,6 +31,7 @@ Tripmine Weapon
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
class monster_tripmine:CBaseMonster
|
class monster_tripmine:CBaseMonster
|
||||||
{
|
{
|
||||||
|
float armor;
|
||||||
void(void) monster_tripmine;
|
void(void) monster_tripmine;
|
||||||
|
|
||||||
virtual float(entity, float) SendEntity;
|
virtual float(entity, float) SendEntity;
|
||||||
|
@ -43,15 +44,15 @@ float
|
||||||
monster_tripmine::SendEntity(entity pvsent, float flags)
|
monster_tripmine::SendEntity(entity pvsent, float flags)
|
||||||
{
|
{
|
||||||
WriteByte(MSG_ENTITY, ENT_TRIPMINE);
|
WriteByte(MSG_ENTITY, ENT_TRIPMINE);
|
||||||
WriteCoord(MSG_ENTITY, self.origin[0]);
|
WriteCoord(MSG_ENTITY, origin[0]);
|
||||||
WriteCoord(MSG_ENTITY, self.origin[1]);
|
WriteCoord(MSG_ENTITY, origin[1]);
|
||||||
WriteCoord(MSG_ENTITY, self.origin[2]);
|
WriteCoord(MSG_ENTITY, origin[2]);
|
||||||
WriteCoord(MSG_ENTITY, self.angles[0]);
|
WriteCoord(MSG_ENTITY, angles[0]);
|
||||||
WriteCoord(MSG_ENTITY, self.angles[1]);
|
WriteCoord(MSG_ENTITY, angles[1]);
|
||||||
WriteCoord(MSG_ENTITY, self.angles[2]);
|
WriteCoord(MSG_ENTITY, angles[2]);
|
||||||
WriteFloat(MSG_ENTITY, self.armor);
|
WriteFloat(MSG_ENTITY, armor);
|
||||||
WriteByte(MSG_ENTITY, self.health);
|
WriteByte(MSG_ENTITY, health);
|
||||||
WriteShort(MSG_ENTITY, self.modelindex);
|
WriteShort(MSG_ENTITY, modelindex);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue